|
95 | 95 | /* UFSHC 4.0 compliant HC support this mode, refer param_set_mcq_mode() */
|
96 | 96 | static bool use_mcq_mode = true;
|
97 | 97 |
|
| 98 | +static bool is_mcq_supported(struct ufs_hba *hba) |
| 99 | +{ |
| 100 | + return hba->mcq_sup && use_mcq_mode; |
| 101 | +} |
| 102 | + |
98 | 103 | static int param_set_mcq_mode(const char *val, const struct kernel_param *kp)
|
99 | 104 | {
|
100 | 105 | int ret;
|
@@ -8292,6 +8297,7 @@ static int ufshcd_add_lus(struct ufs_hba *hba)
|
8292 | 8297 | static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
|
8293 | 8298 | {
|
8294 | 8299 | int ret;
|
| 8300 | + struct Scsi_Host *host = hba->host; |
8295 | 8301 |
|
8296 | 8302 | hba->ufshcd_state = UFSHCD_STATE_RESET;
|
8297 | 8303 |
|
@@ -8326,6 +8332,14 @@ static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
|
8326 | 8332 | ret = ufshcd_device_params_init(hba);
|
8327 | 8333 | if (ret)
|
8328 | 8334 | return ret;
|
| 8335 | + if (is_mcq_supported(hba) && !hba->scsi_host_added) { |
| 8336 | + ret = scsi_add_host(host, hba->dev); |
| 8337 | + if (ret) { |
| 8338 | + dev_err(hba->dev, "scsi_add_host failed\n"); |
| 8339 | + return ret; |
| 8340 | + } |
| 8341 | + hba->scsi_host_added = true; |
| 8342 | + } |
8329 | 8343 | }
|
8330 | 8344 |
|
8331 | 8345 | ufshcd_tune_unipro_params(hba);
|
@@ -9964,10 +9978,12 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
|
9964 | 9978 | hba->is_irq_enabled = true;
|
9965 | 9979 | }
|
9966 | 9980 |
|
9967 |
| - err = scsi_add_host(host, hba->dev); |
9968 |
| - if (err) { |
9969 |
| - dev_err(hba->dev, "scsi_add_host failed\n"); |
9970 |
| - goto out_disable; |
| 9981 | + if (!is_mcq_supported(hba)) { |
| 9982 | + err = scsi_add_host(host, hba->dev); |
| 9983 | + if (err) { |
| 9984 | + dev_err(hba->dev, "scsi_add_host failed\n"); |
| 9985 | + goto out_disable; |
| 9986 | + } |
9971 | 9987 | }
|
9972 | 9988 |
|
9973 | 9989 | hba->tmf_tag_set = (struct blk_mq_tag_set) {
|
|
0 commit comments