scsi: ufs: fix setting init power mode
authorsubhashj@codeaurora.org <subhashj@codeaurora.org>
Fri, 23 Dec 2016 02:41:33 +0000 (18:41 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 5 Jan 2017 23:10:04 +0000 (18:10 -0500)
Immediately after successful UFS link startup, UFS link power mode would
be in PWM-G1, 1-lane, SLOW-AUTO mode. But currently we are doing few
of the DME local/peer attributes access before setting the "hba->pwr_info"
to default power mode. If we are doing link startup as part of error
recovery then old power mode might be set to FAST mode and doing DME peer
access (after link startup but before updating "hba->pwr_info" to default
power mode) unintentionally tries to switch from FAST to FAST_AUTO mode (if
UFSHCD_QUIRK_DME_PEER_ACCESS_AUTO_MODE quirk is enabled).

Above issue is fixed by setting the default power mode immediately after
successful link startup.

Reviewed-by: Sahitya Tummala <stummala@codeaurora.org>
Signed-off-by: Subhash Jadavani <subhashj@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c

index 10840306f663fa6fd4ae349a72bb37ec7dcc1e03..184106fa21da586c0341e5bf559c6208c2f8c6f9 100644 (file)
@@ -3512,6 +3512,10 @@ link_startup:
                goto link_startup;
        }
 
+       /* Mark that link is up in PWM-G1, 1-lane, SLOW-AUTO mode */
+       ufshcd_init_pwr_info(hba);
+       ufshcd_print_pwr_info(hba);
+
        if (hba->quirks & UFSHCD_QUIRK_BROKEN_LCC) {
                ret = ufshcd_disable_device_tx_lcc(hba);
                if (ret)
@@ -5547,9 +5551,6 @@ static int ufshcd_probe_hba(struct ufs_hba *hba)
        if (ret)
                goto out;
 
-       ufshcd_init_pwr_info(hba);
-       ufshcd_print_pwr_info(hba);
-
        /* set the default level for urgent bkops */
        hba->urgent_bkops_lvl = BKOPS_STATUS_PERF_IMPACT;
        hba->is_urgent_bkops_lvl_checked = false;