scsi: ufs: re-probing hba when UFS initialization failed.

We observed several failures when probing hba.
Since there is no error recovery design, the device is
not boot into Android.

Log as shown below:
    pwr ctrl cmd 0x2 failed, host upmcrs:0x4
    ...
    ufshcd_change_power_mode: power mode change failed 4
    ufshcd_probe_hba: Failed setting power mode, err = 4

Because we do not support removable UFS card,
we can introduce a retry design in async_scan().

The UFS can be initlized after re-probing hba.

Log as shown below:
    ufshcd_async_scan failed. Err = 4. Retry 3
    qcom_ice 1d90000.ufsice: QC ICE 3.1.79 device found @0xffffff800d9a0000
    ufshcd_print_pwr_info:[RX, TX]: gear=[1, 1], lane[1, 1], pwr[SLOWAUTO_MODE, SLOWAUTO_MODE], rate = 0
    ufshcd_print_pwr_info:[RX, TX]: gear=[3, 3], lane[2, 2], pwr[FAST MODE, FAST MODE], rate = 2

Bug: 151080047
Test: inject failure and boot to Android
Change-Id: I76af5c89f91c72aecb1b5824fcada66dadbc5c4a
Signed-off-by: Randall Huang <huangrandall@google.com>
Signed-off-by: Alexander Winkowski <dereference23@outlook.com>
fourteen
Randall Huang 5 years ago committed by Jenna
parent 6b74dfa86d
commit 7f460c7d32
  1. 8
      drivers/scsi/ufs/ufshcd.c

@ -10375,13 +10375,19 @@ static int ufshcd_extcon_unregister(struct ufs_hba *hba)
static void ufshcd_async_scan(void *data, async_cookie_t cookie)
{
struct ufs_hba *hba = (struct ufs_hba *)data;
int ret, retry = 3;
/*
* Don't allow clock gating and hibern8 enter for faster device
* detection.
*/
ufshcd_hold_all(hba);
ufshcd_probe_hba(hba);
ret = ufshcd_probe_hba(hba);
while (ret && retry) {
pr_err("%s failed. Err = %d. Retry %d\n", __func__, ret, retry);
ret = ufshcd_host_reset_and_restore(hba);
retry--;
}
ufshcd_release_all(hba);
ufshcd_extcon_register(hba);

Loading…
Cancel
Save