Re: [PATCH v1 1/2] scsi: ufs: core: Remove UFS_DEVICE_QUIRK_DELAY_AFTER_LPM quirk

From: Bao D. Nguyen

Date: Fri Oct 03 2025 - 17:12:10 EST


On 10/2/2025 8:10 PM, Peter Wang (王信友) wrote:
On Thu, 2025-10-02 at 11:48 -0700, Bao D. Nguyen wrote:


Hi Peter,

The current Mediatek platform driver applies this quirk to all ufs
vendors which is consistent with what we would like to do in the
Qualcomm platform driver per the vendor's requests.

I do see that, about 5 years ago, Mediatek merged a patch to keep the
device vcc always on, probably to workaround some HW issues. Since

Hi Bao,

Yes, some UFS devices may have issues when turning off VCC.

this
is a very old patch and the impact of this change on a broken
hardware
is minimal, I would like weight the benefit of cleaning up the ufs
core
driver by removing the unnecessary quirk
UFS_DEVICE_QUIRK_DELAY_AFTER_LPM vs the inconvenience of a 5ms
(potentially reduce to 2ms) delay impact it may cause on an old
broken
HW in the suspend/shutdown path.

I believe removing the UFS_DEVICE_QUIRK_DELAY_AFTER_LPM quirk in the
ufs
core driver as well as all the platform drivers yields positive net
benefits in this case.

Thanks, Bao



I think you misunderstood my point.
I am okay with removing this flag, but this patch will cause
devices with VCC always on to unnecessarily wait for the
delay, resulting in wasted time.

Are you referring to the always_on flag in the struct ufs_vreg? I believe currently the ufs_vreg's always_on flag isn't used in determining whether the delay is applied or not.

How about we add the check for the Vcc's always_on as shown below?
The Mediatek's workaround can avoid the extra delay by setting the always_on flag as it already did, without using the UFS_DEVICE_QUIRK_DELAY_AFTER_LPM.

if (vcc_off && hba->vreg_info.vcc && !hba->vreg_info.vcc->always_on)
usleep_range(5000, 5100);

Thanks, Bao


Thanks
Peter