* [PATCH V1 0/2] scsi: ufs: ufs-qcom: Fix OCP issue during powerdown
@ 2026-05-31 23:50 Nitin Rawat
2026-05-31 23:50 ` [PATCH V1 1/2] scsi: ufs: core: Add UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk Nitin Rawat
2026-05-31 23:50 ` [PATCH V1 2/2] scsi: ufs: ufs-qcom: Enable SKIP DEVICE RESET Quirk Nitin Rawat
0 siblings, 2 replies; 5+ messages in thread
From: Nitin Rawat @ 2026-05-31 23:50 UTC (permalink / raw)
To: mani, James.Bottomley, alim.akhtar, avri.altman, bvanassche,
martin.petersen
Cc: linux-scsi, linux-kernel, linux-arm-msm, Nitin Rawat
This series addresses an OCP (Over Current Protection) fault observed
on Micron UFS parts during UFS power down (PC=3).
Background
==========
According to the UFS specification, the power-off sequence includes
sending an SSU command with Power_Condition=3, followed by asserting
RST_N low (hardware reset), turning off REF_CLK, and then disabling
the power rails (VCC, VCCQ/VCCQ2).
When RST_N is asserted, the UFS device firmware wakes up and executes
its internal reset routine. This routine initializes multiple hardware
blocks and causing the device to draw a large curreny during this time.
A previous fix [1] addressed the resulting OCP issue by adding a 10ms
delay after asserting HWRST. The delay allows the reset routine to
complete while the power rails remain active and in high-power mode,
before the regulator framework transitions the rail to LPM (Low Power
Mode) after the UFS driver disables it.
Problem
==========
The 10ms delay fix is insufficient for Micron UFS parts. Unlike
other vendors whose reset routine completes within ~10ms, Micron parts
continue to draw current beyond the LPM threshold for a longer duration
after reset is asserted - specifically until the reset line is deasserted
(RST_N goes high). No fixed delay can reliably cover this window since
there is currently no mechanism for the host to query whether the device
reset routine has completed.
Solution
==========
Introduce a new host quirk UFSHCD_QUIRK_SKIP_DEVICE_RESET to skip
asserting device reset during UFS power down for Micron parts .
For all other vendors, the existing behavior (assert reset + 10ms delay)
is preserved. The device reset will be asserted as part of the
platform shutdown sequence.
[1] commit 5127be409c6c ("scsi: ufs: ufs-qcom: Fix UFS OCP issue during
UFS power down (PC=3)")
Nitin Rawat (2):
scsi: ufs: core: Add UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk
scsi: ufs: ufs-qcom: Enable SKIP DEVICE RESET Quirk
drivers/ufs/host/ufs-qcom.c | 27 ++++++++++++++++++++++++---
include/ufs/ufshcd.h | 14 ++++++++++++++
2 files changed, 38 insertions(+), 3 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH V1 1/2] scsi: ufs: core: Add UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk
2026-05-31 23:50 [PATCH V1 0/2] scsi: ufs: ufs-qcom: Fix OCP issue during powerdown Nitin Rawat
@ 2026-05-31 23:50 ` Nitin Rawat
2026-06-08 9:33 ` Konrad Dybcio
2026-05-31 23:50 ` [PATCH V1 2/2] scsi: ufs: ufs-qcom: Enable SKIP DEVICE RESET Quirk Nitin Rawat
1 sibling, 1 reply; 5+ messages in thread
From: Nitin Rawat @ 2026-05-31 23:50 UTC (permalink / raw)
To: mani, James.Bottomley, alim.akhtar, avri.altman, bvanassche,
martin.petersen
Cc: linux-scsi, linux-kernel, linux-arm-msm, Nitin Rawat
Add a new host quirk UFSHCD_QUIRK_SKIP_DEVICE_RESET to allow host
controller drivers to skip asserting device reset during UFS power
down.
When RST_N is asserted, the UFS device firmware wakes up and executes
its internal reset routine. This routine initializes multiple hardware
blocks and causing the device to draw a large curreny during this time.
If the power rail transitions to LPM (Low Power Mode) while the device
is still drawing this elevated current, it may trigger an
OCP (Over Current Protection) fault in the regulator.
For some UFS devices (e.g., Micron), the elevated current draw persists
until the reset line is deasserted, making a fixed delay insufficient
to prevent OCP. This quirk allows such devices to skip device reset
during UFS power down. The device reset will instead be asserted as
part of the platform shutdown sequence.
Signed-off-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
---
include/ufs/ufshcd.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
index 3eaae082329c..18d634499ce5 100644
--- a/include/ufs/ufshcd.h
+++ b/include/ufs/ufshcd.h
@@ -813,6 +813,20 @@ enum ufshcd_quirks {
* allowed by M-PHY spec ver 6.0.
*/
UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 = 1 << 28,
+
+ /*
+ * Some UFS devices keep drawing larger current after reset is
+ * asserted until it is deasserted. Asserting device reset
+ * during UFS power down causes the device firmware to wake up and
+ * execute its reset routine, drawing current beyond the permissible
+ * limit for low-power mode (LPM). This may trigger an OCP fault on
+ * the regulator supplying power to UFS.
+ *
+ * Enable this quirk to skip asserting device reset during UFS power
+ * down. This is handled only in shutdown; the device reset will be
+ * asserted as part of the platform shutdown sequence.
+ */
+ UFSHCD_QUIRK_SKIP_DEVICE_RESET = 1 << 29,
};
enum ufshcd_caps {
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH V1 1/2] scsi: ufs: core: Add UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk
2026-05-31 23:50 ` [PATCH V1 1/2] scsi: ufs: core: Add UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk Nitin Rawat
@ 2026-06-08 9:33 ` Konrad Dybcio
0 siblings, 0 replies; 5+ messages in thread
From: Konrad Dybcio @ 2026-06-08 9:33 UTC (permalink / raw)
To: Nitin Rawat, mani, James.Bottomley, alim.akhtar, avri.altman,
bvanassche, martin.petersen
Cc: linux-scsi, linux-kernel, linux-arm-msm
On 6/1/26 1:50 AM, Nitin Rawat wrote:
> Add a new host quirk UFSHCD_QUIRK_SKIP_DEVICE_RESET to allow host
> controller drivers to skip asserting device reset during UFS power
> down.
>
> When RST_N is asserted, the UFS device firmware wakes up and executes
> its internal reset routine. This routine initializes multiple hardware
> blocks and causing the device to draw a large curreny during this time.
> If the power rail transitions to LPM (Low Power Mode) while the device
> is still drawing this elevated current, it may trigger an
> OCP (Over Current Protection) fault in the regulator.
>
> For some UFS devices (e.g., Micron), the elevated current draw persists
> until the reset line is deasserted, making a fixed delay insufficient
> to prevent OCP. This quirk allows such devices to skip device reset
> during UFS power down. The device reset will instead be asserted as
> part of the platform shutdown sequence.
>
> Signed-off-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
> ---
> include/ufs/ufshcd.h | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/include/ufs/ufshcd.h b/include/ufs/ufshcd.h
> index 3eaae082329c..18d634499ce5 100644
> --- a/include/ufs/ufshcd.h
> +++ b/include/ufs/ufshcd.h
> @@ -813,6 +813,20 @@ enum ufshcd_quirks {
> * allowed by M-PHY spec ver 6.0.
> */
> UFSHCD_QUIRK_EXTENDED_TX_EQTR_ADAPT_LENGTH_L0L1L2L3 = 1 << 28,
> +
> + /*
> + * Some UFS devices keep drawing larger current after reset is
> + * asserted until it is deasserted. Asserting device reset
> + * during UFS power down causes the device firmware to wake up and
> + * execute its reset routine, drawing current beyond the permissible
> + * limit for low-power mode (LPM). This may trigger an OCP fault on
Is that UFS-LPM, or Qualcomm-regulator-LPM?
Konrad
> + * the regulator supplying power to UFS.
> + *
> + * Enable this quirk to skip asserting device reset during UFS power
> + * down. This is handled only in shutdown; the device reset will be
> + * asserted as part of the platform shutdown sequence.
> + */
> + UFSHCD_QUIRK_SKIP_DEVICE_RESET = 1 << 29,
> };
>
> enum ufshcd_caps {
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V1 2/2] scsi: ufs: ufs-qcom: Enable SKIP DEVICE RESET Quirk
2026-05-31 23:50 [PATCH V1 0/2] scsi: ufs: ufs-qcom: Fix OCP issue during powerdown Nitin Rawat
2026-05-31 23:50 ` [PATCH V1 1/2] scsi: ufs: core: Add UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk Nitin Rawat
@ 2026-05-31 23:50 ` Nitin Rawat
2026-06-01 16:17 ` Bart Van Assche
1 sibling, 1 reply; 5+ messages in thread
From: Nitin Rawat @ 2026-05-31 23:50 UTC (permalink / raw)
To: mani, James.Bottomley, alim.akhtar, avri.altman, bvanassche,
martin.petersen
Cc: linux-scsi, linux-kernel, linux-arm-msm, Nitin Rawat
A previous fix [1] addressed an OCP (Over Current Protection) issue
during UFS power down (PC=3) by adding a 10ms delay after asserting
HWRST. The delay allows the UFS device to complete its reset routine
before the power rail transitions to LPM (Low Power Mode).
However, this fix is insufficient for certain Micron UFS parts. Unlike
other vendors whose reset routine completes within ~10ms, Micron parts
continue to draw current beyond the LPM threshold for a longer duration
after reset is asserted, specifically until the reset is deasserted
(RST_N goes high). No fixed delay can reliably cover this window since
there is currently no mechanism for the host to query whether the
device reset routine has completed.
Enable the UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk to skip device assert
reset during UFS power down for Micron parts. For all other vendors,
the existing behavior (assert reset + 10ms delay) is preserved.
This quirk is applicable only during shutdown. The device reset
will be asserted as part of the platform shutdown sequences.
[1] commit 5127be409c6c ("scsi: ufs: ufs-qcom: Fix UFS OCP issue during
UFS power down (PC=3)")
Signed-off-by: Nitin Rawat <nitin.rawat@oss.qualcomm.com>
---
drivers/ufs/host/ufs-qcom.c | 27 ++++++++++++++++++++++++---
1 file changed, 24 insertions(+), 3 deletions(-)
diff --git a/drivers/ufs/host/ufs-qcom.c b/drivers/ufs/host/ufs-qcom.c
index 291c43448764..d0ad1e47c31d 100644
--- a/drivers/ufs/host/ufs-qcom.c
+++ b/drivers/ufs/host/ufs-qcom.c
@@ -770,9 +770,17 @@ static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
if (!ufs_qcom_is_link_active(hba))
ufs_qcom_disable_lane_clks(host);
-
- /* reset the connected UFS device during power down */
- if (ufs_qcom_is_link_off(hba) && host->device_reset) {
+ /*
+ * For some UFS vendors, skip asserting device reset here.
+ * These vendor parts keep drawing larger current after reset
+ * is asserted until it is deasserted, and the 10ms delay is
+ * not sufficient to prevent OCP (Over Current Protection)
+ * on the regulator. This is for the powerdown case, so
+ * the device reset can be asserted later as part of the
+ * platform shutdown sequence.
+ */
+ if (ufs_qcom_is_link_off(hba) && host->device_reset &&
+ !(hba->quirks & UFSHCD_QUIRK_SKIP_DEVICE_RESET)) {
ufs_qcom_device_reset_ctrl(hba, true);
/*
* After sending the SSU command, asserting the rst_n
@@ -1288,6 +1296,19 @@ static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
static void ufs_qcom_fixup_dev_quirks(struct ufs_hba *hba)
{
ufshcd_fixup_dev_quirks(hba, ufs_qcom_dev_fixups);
+
+ /*
+ * Some UFS parts keep drawing larger current after reset is asserted
+ * until it is deasserted. The 10ms delay added after asserting HWRST
+ * (as done for other vendors) is not sufficient for these parts.
+ *
+ * Skip asserting device reset during UFS power down for these parts
+ * to prevent OCP (Over Current Protection) fault on the regulator.
+ * This is handled only in shutdown; the device reset will be asserted
+ * as part of the platform shutdown sequence.
+ */
+ if (hba->dev_info.wmanufacturerid == UFS_VENDOR_MICRON)
+ hba->quirks |= UFSHCD_QUIRK_SKIP_DEVICE_RESET;
}
static u32 ufs_qcom_get_ufs_hci_version(struct ufs_hba *hba)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH V1 2/2] scsi: ufs: ufs-qcom: Enable SKIP DEVICE RESET Quirk
2026-05-31 23:50 ` [PATCH V1 2/2] scsi: ufs: ufs-qcom: Enable SKIP DEVICE RESET Quirk Nitin Rawat
@ 2026-06-01 16:17 ` Bart Van Assche
0 siblings, 0 replies; 5+ messages in thread
From: Bart Van Assche @ 2026-06-01 16:17 UTC (permalink / raw)
To: Nitin Rawat, mani, James.Bottomley, alim.akhtar, avri.altman,
martin.petersen
Cc: linux-scsi, linux-kernel, linux-arm-msm
On 5/31/26 4:50 PM, Nitin Rawat wrote:
> -
> - /* reset the connected UFS device during power down */
> - if (ufs_qcom_is_link_off(hba) && host->device_reset) {
> + /*
> + * For some UFS vendors, skip asserting device reset here.
> + * These vendor parts keep drawing larger current after reset
> + * is asserted until it is deasserted, and the 10ms delay is
> + * not sufficient to prevent OCP (Over Current Protection)
> + * on the regulator. This is for the powerdown case, so
> + * the device reset can be asserted later as part of the
> + * platform shutdown sequence.
> + */
> + if (ufs_qcom_is_link_off(hba) && host->device_reset &&
> + !(hba->quirks & UFSHCD_QUIRK_SKIP_DEVICE_RESET)) {
> ufs_qcom_device_reset_ctrl(hba, true);
> /*
> * After sending the SSU command, asserting the rst_n
> @@ -1288,6 +1296,19 @@ static struct ufs_dev_quirk ufs_qcom_dev_fixups[] = {
> static void ufs_qcom_fixup_dev_quirks(struct ufs_hba *hba)
> {
> ufshcd_fixup_dev_quirks(hba, ufs_qcom_dev_fixups);
> +
> + /*
> + * Some UFS parts keep drawing larger current after reset is asserted
> + * until it is deasserted. The 10ms delay added after asserting HWRST
> + * (as done for other vendors) is not sufficient for these parts.
> + *
> + * Skip asserting device reset during UFS power down for these parts
> + * to prevent OCP (Over Current Protection) fault on the regulator.
> + * This is handled only in shutdown; the device reset will be asserted
> + * as part of the platform shutdown sequence.
> + */
> + if (hba->dev_info.wmanufacturerid == UFS_VENDOR_MICRON)
> + hba->quirks |= UFSHCD_QUIRK_SKIP_DEVICE_RESET;
> }
Why has this fix been implemented in the ufs-qcom.c source file? Isn't
this an issue that affects all host controllers?
Thanks,
Bart.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-06-08 9:33 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-31 23:50 [PATCH V1 0/2] scsi: ufs: ufs-qcom: Fix OCP issue during powerdown Nitin Rawat
2026-05-31 23:50 ` [PATCH V1 1/2] scsi: ufs: core: Add UFSHCD_QUIRK_SKIP_DEVICE_RESET quirk Nitin Rawat
2026-06-08 9:33 ` Konrad Dybcio
2026-05-31 23:50 ` [PATCH V1 2/2] scsi: ufs: ufs-qcom: Enable SKIP DEVICE RESET Quirk Nitin Rawat
2026-06-01 16:17 ` Bart Van Assche
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®