[COMMON] scsi: ufs: Fix problems in clock enable fail and hibern8 fail cases
authorhgchu <hg.chu@samsung.com>
Fri, 12 Jan 2018 10:26:38 +0000 (19:26 +0900)
committerJaeHun Jung <jh0801.jung@samsung.com>
Tue, 8 May 2018 08:20:50 +0000 (17:20 +0900)
Change-Id: I33d16b03022baa441cfe101f81364295f3d9f476
Signed-off-by: hgchu <hg.chu@samsung.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h

index 4900522746a6a5f6c1071a195502ad5b8912e5de..ccf07d8b4cf3943a2c000b548cb70341ca927136 100644 (file)
@@ -4506,7 +4506,7 @@ link_startup:
                 * but we can't be sure if the link is up until link startup
                 * succeeds. So reset the local Uni-Pro and try again.
                 */
-               if (ret && ufshcd_hba_enable(hba))
+               if ((ret && !retries) || (ret && ufshcd_hba_enable(hba)))
                        goto out;
        } while (ret && retries--);
 
@@ -7530,6 +7530,7 @@ static int __ufshcd_setup_clocks(struct ufs_hba *hba, bool on,
                        if (on && !clki->enabled) {
                                ret = clk_prepare_enable(clki->clk);
                                if (ret) {
+                                       hba->clk_gating.state = CLKS_DISABLE;
                                        dev_err(hba->dev, "%s: %s prepare enable failed, %d\n",
                                                __func__, clki->name, ret);
                                        goto out;
index c46de5e4a0ff9e0d94e8842b3eb407beb3f34d09..9b80eb1605cb62a35927827cd0a08b0206770f48 100644 (file)
@@ -353,6 +353,7 @@ enum clk_gating_state {
        REQ_CLKS_OFF,
        REQ_CLKS_ON,
        __CLKS_ON,
+       CLKS_DISABLE = 0x99,
 };
 
 /**