From 228eb8ba2c98f3fb33d39e34a26c8f6961a1db9c Mon Sep 17 00:00:00 2001 From: "Bao D. Nguyen" Date: Mon, 20 Jul 2020 21:19:59 -0700 Subject: [PATCH] ufs: ufs-qcom: add device quirk for Micron to avoid OCP Before going into suspend, the host sends a SSU(SLEEP) command to the device. Once the SSU(SLEEP) command completes, the Micron still draws high power on the vccq for some time before going into low power mode completely. Add a delay before setting the vccq regulator source into low power mode to account for the extra time the Micron needs before it completely goes into sleep mode. As a result, avoid over current protection (OCP) event from the pmic. Change-Id: Ic35803fc9e07157cff2a637c003834dbf7846e44 Signed-off-by: Bao D. Nguyen --- drivers/scsi/ufs/ufs-qcom.c | 3 +++ drivers/scsi/ufs/ufs-qcom.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/scsi/ufs/ufs-qcom.c b/drivers/scsi/ufs/ufs-qcom.c index e29db94d7578..d07eba373fd4 100644 --- a/drivers/scsi/ufs/ufs-qcom.c +++ b/drivers/scsi/ufs/ufs-qcom.c @@ -1619,6 +1619,9 @@ static int ufs_qcom_apply_dev_quirks(struct ufs_hba *hba) if (hba->dev_info.wmanufacturerid == UFS_VENDOR_WDC) hba->dev_quirks |= UFS_DEVICE_QUIRK_HOST_PA_TACTIVATE; + if (hba->dev_info.wmanufacturerid == UFS_VENDOR_MICRON) + hba->dev_quirks |= UFS_DEVICE_QUIRK_DELAY_BEFORE_LPM; + return err; } diff --git a/drivers/scsi/ufs/ufs-qcom.h b/drivers/scsi/ufs/ufs-qcom.h index 391989de1071..5c364be0842b 100644 --- a/drivers/scsi/ufs/ufs-qcom.h +++ b/drivers/scsi/ufs/ufs-qcom.h @@ -30,6 +30,8 @@ #define UFS_HW_VER_STEP_SHFT (0) #define UFS_HW_VER_STEP_MASK (0xFFFF << UFS_HW_VER_STEP_SHFT) +#define UFS_VENDOR_MICRON 0x12C + /* vendor specific pre-defined parameters */ #define SLOW 1 #define FAST 2