scsi: ufs: core: Configure MCQ after link startup

Commit f46b9a595fa9 ("scsi: ufs: core: Allocate the SCSI host earlier")
did not only cause scsi_add_host() to be called earlier. It also swapped
the order of link startup and enabling and configuring MCQ mode. Before
that commit, the call chains for link startup and enabling MCQ were as
follows:

ufshcd_init()
ufshcd_link_startup()
ufshcd_add_scsi_host()
ufshcd_mcq_enable()

Apparently this change causes link startup to fail. Fix this by configuring
MCQ after link startup has completed.

Reported-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
Fixes: f46b9a595fa9 ("scsi: ufs: core: Allocate the SCSI host earlier")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Link: https://patch.msgid.link/20251218230741.2661049-1-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by Bart Van Assche and committed by Martin K. Petersen ee229e7c 9a49157d

+4 -3
+4 -3
drivers/ufs/core/ufshcd.c
··· 10736 if (is_mcq_supported(hba)) { 10737 ufshcd_mcq_enable(hba); 10738 err = ufshcd_alloc_mcq(hba); 10739 - if (!err) { 10740 - ufshcd_config_mcq(hba); 10741 - } else { 10742 /* Continue with SDB mode */ 10743 ufshcd_mcq_disable(hba); 10744 use_mcq_mode = false; ··· 11008 err = ufshcd_link_startup(hba); 11009 if (err) 11010 goto out_disable; 11011 11012 if (hba->quirks & UFSHCD_QUIRK_SKIP_PH_CONFIGURATION) 11013 goto initialized;
··· 10736 if (is_mcq_supported(hba)) { 10737 ufshcd_mcq_enable(hba); 10738 err = ufshcd_alloc_mcq(hba); 10739 + if (err) { 10740 /* Continue with SDB mode */ 10741 ufshcd_mcq_disable(hba); 10742 use_mcq_mode = false; ··· 11010 err = ufshcd_link_startup(hba); 11011 if (err) 11012 goto out_disable; 11013 + 11014 + if (hba->mcq_enabled) 11015 + ufshcd_config_mcq(hba); 11016 11017 if (hba->quirks & UFSHCD_QUIRK_SKIP_PH_CONFIGURATION) 11018 goto initialized;