Skip to content

Commit b712f23

Browse files
nitinrawat123gregkh
authored andcommitted
scsi: ufs: ufs-qcom: Fix UFS OCP issue during UFS power down (PC=3)
[ Upstream commit 5127be409c6c3815c4a7d8f6d88043e44f9b9543 ] According to UFS specifications, the power-off sequence for a UFS device includes: - Sending an SSU command with Power_Condition=3 and await a response. - Asserting RST_N low. - Turning off REF_CLK. - Turning off VCC. - Turning off VCCQ/VCCQ2. As part of ufs shutdown, after the SSU command completion, asserting hardware reset (HWRST) triggers the device firmware to wake up and execute its reset routine. This routine initializes hardware blocks and takes a few milliseconds to complete. During this time, the ICCQ draws a large current. This large ICCQ current may cause issues for the regulator which is supplying power to UFS, because the turn off request from UFS driver to the regulator framework will be immediately followed by low power mode(LPM) request by regulator framework. This is done by framework because UFS which is the only client is requesting for disable. So if the rail is still in the process of shutting down while ICCQ exceeds LPM current thresholds, and LPM mode is activated in hardware during this state, it may trigger an overcurrent protection (OCP) fault in the regulator. To prevent this, a 10ms delay is added after asserting HWRST. This allows the reset operation to complete while power rails remain active and in high-power mode. Currently there is no way for Host to query whether the reset is completed or not and hence this the delay is based on experiments with Qualcomm UFS controllers across multiple UFS vendors. Signed-off-by: Nitin Rawat <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Martin K. Petersen <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent fdc4d94 commit b712f23

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

drivers/ufs/host/ufs-qcom.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,8 +744,21 @@ static int ufs_qcom_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op,
744744

745745

746746
/* reset the connected UFS device during power down */
747-
if (ufs_qcom_is_link_off(hba) && host->device_reset)
747+
if (ufs_qcom_is_link_off(hba) && host->device_reset) {
748748
ufs_qcom_device_reset_ctrl(hba, true);
749+
/*
750+
* After sending the SSU command, asserting the rst_n
751+
* line causes the device firmware to wake up and
752+
* execute its reset routine.
753+
*
754+
* During this process, the device may draw current
755+
* beyond the permissible limit for low-power mode (LPM).
756+
* A 10ms delay, based on experimental observations,
757+
* allows the UFS device to complete its hardware reset
758+
* before transitioning the power rail to LPM.
759+
*/
760+
usleep_range(10000, 11000);
761+
}
749762

750763
return ufs_qcom_ice_suspend(host);
751764
}

0 commit comments

Comments
 (0)