Re: [RFC PATCH v2 2/2] mmc: renesas_sdhi: do hard reset if possible

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Wolfram,

On Mon, Feb 22, 2021 at 12:41 PM Wolfram Sang
<wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> Some SDHI instances can be reset via the reset controller. If one is
> found, use it instead of the custom reset.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>

Thanks for your patch!

> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c

> @@ -561,9 +563,16 @@ static int renesas_sdhi_prepare_hs400_tuning(struct mmc_host *mmc, struct mmc_io
>  static void renesas_sdhi_reset(struct tmio_mmc_host *host)
>  {
>         struct renesas_sdhi *priv = host_to_priv(host);
> +       int ret;
>         u16 val;
>
> -       if (priv->scc_ctl) {
> +       if (!IS_ERR(priv->rstc)) {

"if (priv->rstc)" if the reset is made optional.

> +               reset_control_reset(priv->rstc);
> +               /* Unknown why but without polling reset status, it will hang */
> +               read_poll_timeout(reset_control_status, ret, ret == 0, 1, 100,
> +                                 false, priv->rstc);
> +               priv->needs_adjust_hs400 = false;
> +       } else if (priv->scc_ctl) {
>                 renesas_sdhi_disable_scc(host->mmc);
>                 renesas_sdhi_reset_hs400_mode(host, priv);
>                 priv->needs_adjust_hs400 = false;
> @@ -1076,6 +1085,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>         if (ret)
>                 goto efree;
>
> +       priv->rstc = devm_reset_control_get_exclusive(&pdev->dev, NULL);

devm_reset_control_get_optional_exclusive()?
+ missing error handling (real errors and -EPROBE_DEFER).

Perhaps you want to add a "select RESET_CONTROLLER" to "config
MMC_SDHI"?

> +
>         ver = sd_ctrl_read16(host, CTL_VERSION);
>         /* GEN2_SDR104 is first known SDHI to use 32bit block count */
>         if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds



[Index of Archives]     [Linux Memonry Technology]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux