]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
scsi: ufs: core: Fix bRefClkFreq write failure in HS-LSS mode
authorWang Shuaiwei <wangshuaiwei1@xiaomi.com>
Tue, 14 Apr 2026 03:37:18 +0000 (11:37 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 22 Apr 2026 00:58:06 +0000 (20:58 -0400)
commitb06cf63d83d3b3744d3aefdd2f3ced25e99d7ec1
tree6afcb57cb4c671cd78a5e559d2d099e5c650a158
parent47e66bec3edaebd7c52d8ee981065a4c83b3072f
scsi: ufs: core: Fix bRefClkFreq write failure in HS-LSS mode

According to the UFS spec, the bRefClkFreq attribute can only be written
when both sub-links are in LS-MODE. However, in HS LSS mode with
resetmode = HS_MODE, if the UFS device's default bRefClkFreq value
differs from the host controller's dev_ref_clk_freq setting, the write
operation will fail.

To fix this issue, introduce ufshcd_get_op_mode() function to detect the
current link operational mode. Call ufshcd_set_dev_ref_clk() only when
both sub-links are in LS-MODE to ensure the attribute can be written
successfully.

Signed-off-by: Wang Shuaiwei <wangshuaiwei1@xiaomi.com>
Link: https://patch.msgid.link/20260414033718.1459540-1-wangshuaiwei1@xiaomi.com
Reviewed-by: Peter Wang <peter.wang@mediatek.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/ufs/core/ufshcd.c
include/ufs/unipro.h