@@ -89,6 +89,9 @@
/* Polling time to wait for fDeviceInit */
#define FDEVICEINIT_COMPL_TIMEOUT 1500 /* millisecs */
+/* Default value of turn off VCC rail: 5000us */
+#define UFS_VCC_TURNOFF_DELAY_US 5000
+
#define ufshcd_toggle_vreg(_dev, _vreg, _on) \
({ \
int _ret; \
@@ -7784,6 +7787,9 @@ static int ufs_get_device_desc(struct ufs_hba *hba)
ufs_fixup_device_setup(hba);
+ if (hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM && !hba->vcc_turnoff_delay)
+ hba->vcc_turnoff_delay = UFS_VCC_TURNOFF_DELAY_US;
+
ufshcd_wb_probe(hba, desc_buf);
ufshcd_temp_notif_probe(hba, desc_buf);
@@ -8917,8 +8923,9 @@ static void ufshcd_vreg_set_lpm(struct ufs_hba *hba)
* Some UFS devices require delay after VCC power rail is turned-off.
*/
if (vcc_off && hba->vreg_info.vcc &&
- hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM)
- usleep_range(5000, 5100);
+ hba->dev_quirks & UFS_DEVICE_QUIRK_DELAY_AFTER_LPM &&
+ hba->vcc_turnoff_delay)
+ usleep_range(hba->vcc_turnoff_delay, hba->vcc_turnoff_delay + 100);
}
#ifdef CONFIG_PM
@@ -828,6 +828,7 @@ struct ufs_hba_monitor {
* device
* @complete_put: whether or not to call ufshcd_rpm_put() from inside
* ufshcd_resume_complete()
+ * @vcc_turnoff_delay: VCC turnoff delay value.
*/
struct ufs_hba {
void __iomem *mmio_base;
@@ -975,6 +976,7 @@ struct ufs_hba {
#endif
u32 luns_avail;
bool complete_put;
+ u32 vcc_turnoff_delay;
};
/* Returns true if clocks can be gated. Otherwise false */