Re: [PATCH] UFS: Make TM command timeout configurable from host side

From: Peter Wang (王信友)

Date: Tue Nov 11 2025 - 04:09:15 EST


On Tue, 2025-11-11 at 17:44 +0900, Seunghui Lee wrote:
>
>
> Thank you for your kind opinion.
> As you know, it's not easy to modify default value.
> Because it effects all devices.
>
> Should I read the tm_cmd_timeout from dt property?
> What do you think?
>
> * drivers/ufs/host/ufhcd-pltfrm.c
>
> static void ufshcd_init_tm_cmd_timeout(struct ufs_hba *hba)
> {
>         struct device *dev = hba->dev;
>         int ret;
>
>         ret = of_property_read_u32(dev->of_node, "tm_cmd_timeout",
>                         &hba->tm_cmd_timeout);
>         if (ret) {
>                 dev_dbg(hba->dev,
>                                 "%s: failed to read tm_cmd_timeout,
> ret=%d\n",
>                                 __func__, ret);
>                 hba->tm_cmd_timeout = TM_CMD_TIMEOUT;
>         }
> }
>
> Thanks,
> Seunghui Lee.
>

Hi Seunghui,

It seems that there is no node in the DTS to describe the
UFS device. The UFS host node is not suitable, because the
timeout value depends on the UFS device itself.

Since you found that some devices may have TM command
times exceeding 100ms, why not add a device quirk and change
the timeout value only for those devices?

Alternatively, you could consider using a module parameter,
similar to uic_cmd_timeout and dev_cmd_timeout.

Thanks.
Peter