Skip to content

Commit a390e66

Browse files
bvanasschemartinkpetersen
authored andcommitted
scsi: ufs: core: Expand the ufshcd_device_init(hba, true) call
Expand the ufshcd_device_init(hba, true) call and remove all code that depends on init_dev_params == false. This change prepares for combining the two scsi_add_host() calls. Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 69f5eb7 commit a390e66

File tree

1 file changed

+55
-1
lines changed

1 file changed

+55
-1
lines changed

drivers/ufs/core/ufshcd.c

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10593,7 +10593,61 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
1059310593
ufshcd_set_ufs_dev_active(hba);
1059410594

1059510595
/* Initialize hba, detect and initialize UFS device */
10596-
err = ufshcd_device_init(hba, /*init_dev_params=*/true);
10596+
ktime_t probe_start = ktime_get();
10597+
10598+
hba->ufshcd_state = UFSHCD_STATE_RESET;
10599+
10600+
err = ufshcd_link_startup(hba);
10601+
if (err)
10602+
goto out_disable;
10603+
10604+
if (hba->quirks & UFSHCD_QUIRK_SKIP_PH_CONFIGURATION)
10605+
goto initialized;
10606+
10607+
/* Debug counters initialization */
10608+
ufshcd_clear_dbg_ufs_stats(hba);
10609+
10610+
/* UniPro link is active now */
10611+
ufshcd_set_link_active(hba);
10612+
10613+
/* Verify device initialization by sending NOP OUT UPIU */
10614+
err = ufshcd_verify_dev_init(hba);
10615+
if (err)
10616+
goto out_disable;
10617+
10618+
/* Initiate UFS initialization, and waiting until completion */
10619+
err = ufshcd_complete_dev_init(hba);
10620+
if (err)
10621+
goto out_disable;
10622+
10623+
err = ufshcd_device_params_init(hba);
10624+
if (err)
10625+
goto out_disable;
10626+
10627+
if (is_mcq_supported(hba)) {
10628+
ufshcd_mcq_enable(hba);
10629+
err = ufshcd_alloc_mcq(hba);
10630+
if (!err) {
10631+
ufshcd_config_mcq(hba);
10632+
} else {
10633+
/* Continue with SDB mode */
10634+
ufshcd_mcq_disable(hba);
10635+
use_mcq_mode = false;
10636+
dev_err(hba->dev, "MCQ mode is disabled, err=%d\n",
10637+
err);
10638+
}
10639+
err = scsi_add_host(host, hba->dev);
10640+
if (err) {
10641+
dev_err(hba->dev, "scsi_add_host failed\n");
10642+
goto out_disable;
10643+
}
10644+
hba->scsi_host_added = true;
10645+
}
10646+
10647+
err = ufshcd_post_device_init(hba);
10648+
10649+
initialized:
10650+
ufshcd_process_probe_result(hba, probe_start, err);
1059710651
if (err)
1059810652
goto out_disable;
1059910653

0 commit comments

Comments
 (0)