RE: [PATCH RFT v2 1/3] mmc: tmio: set max_busy_timeout

Yoshihiro Shimoda
2020-11-24T12:41:43Z

Hi Wolfram-san,

Thank you for the patch!

> From: Wolfram Sang, Sent: Saturday, November 21, 2020 12:07 AM
>
> Set max_busy_timeouts for variants known to support the TOPxx bits in
> the SD_OPTION register. The timeout mechanism was running in the
> background but not yet properly handled in the driver. So, let the MMC
> core know when to not use R1B to avoid unhandled timeouts.
>
> My datasheets for older variants (tmio_mmc.c) suggest that they support
> it, too. However, actual bit descriptions are lacking, so I chose an
> opt-in approach.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
<snip>
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index 7f4a28125010..4727fcfdf95f 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -887,6 +887,18 @@ static void tmio_mmc_set_bus_width(struct tmio_mmc_host *host,
> sd_ctrl_write16(host, CTL_SD_MEM_CARD_OPT, reg);
> }
>
> +static void tmio_mmc_max_busy_timeout(struct tmio_mmc_host *host)
> +{
> + u16 val = sd_ctrl_read16(host, CTL_SD_MEM_CARD_OPT);
> + unsigned int clk_rate = host->mmc->actual_clock ?: host->mmc->f_max;
> + unsigned int cycles;
> +
> + val = (val & CARD_OPT_TOP_MASK) >> CARD_OPT_TOP_SHIFT;
> + cycles = 1 << (13 + val);

nit: we can remove double-spaces like (13 + val).

Best regards,
Yoshihiro Shimoda