[PATCH] scsi: ufs: core: Use ufshcd_query_attr_retry() for RTC update
Larisa Ileana Grigore
larisa.grigore at oss.nxp.com
Mon Nov 16 06:38:29 PST 2026
On 11/16/2026 3:39 PM, Enric Balletbo i Serra wrote:
> ufshcd_update_rtc() uses ufshcd_query_attr() directly to write the
> bSecondsPassed attribute, making it the only query attribute caller in
> the UFS core that does not use the retry variant. All other callers use
> ufshcd_query_attr_retry(), which retries up to three times on transient
> failures before escalating to dev_err.
>
> This causes spurious error messages during boot on some platforms when
> the write-attribute command hits a transient OCS_INVALID_COMMAND_STATUS
> error:
>
> ufs-s32n7 4ac80000.ufs: ufshcd_query_attr: opcode 0x04 for idn 15 failed, index 0, err = 15
> ufs-s32n7 4ac80000.ufs: ufshcd_update_rtc: Failed to update rtc 15
>
> Switch to ufshcd_query_attr_retry() to handle transient failures
> gracefully, consistent with every other attribute query in the driver.
>
> Fixes: 6bf999e0eb41 ("scsi: ufs: core: Add UFS RTC support")
> Signed-off-by: Enric Balletbo i Serra <eballetb at redhat.com>
> ---
> drivers/ufs/core/ufshcd.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
> index 3c28bc67c65f..1cd32b7cc967 100644
> --- a/drivers/ufs/core/ufshcd.c
> +++ b/drivers/ufs/core/ufshcd.c
> @@ -8821,8 +8821,8 @@ static void ufshcd_update_rtc(struct ufs_hba *hba)
> if (ufshcd_rpm_get_if_active(hba) <= 0)
> return;
>
> - err = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_WRITE_ATTR, QUERY_ATTR_IDN_SECONDS_PASSED,
> - 0, 0, &val);
> + err = ufshcd_query_attr_retry(hba, UPIU_QUERY_OPCODE_WRITE_ATTR,
> + QUERY_ATTR_IDN_SECONDS_PASSED, 0, 0, &val);
> ufshcd_rpm_put(hba);
>
> if (err)
>
> ---
> base-commit: aebb7274476403040d582c61478df8f4a7bf9cd3
> change-id: 20261116-ufs-rtc-query-retry-3f27084f878f
>
> Best regards,
Hello Enric,
Regarding the OCS_INVALID_COMMAND_STATUS seen on S32N79RDB, this
behavior is related to known errata that will be documented in the
future. I plan to submit a separate patch series to address these errata.
For this issue, OCS values 0xf and 0x3 are expected.
Best regards,
Larisa
More information about the linux-arm-kernel
mailing list