diff mbox series

mmc renesas_sdhi: workaround a regression when reinserting SD cards

Message ID 20201008092533.76588-1-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series mmc renesas_sdhi: workaround a regression when reinserting SD cards | expand

Commit Message

Wolfram Sang Oct. 8, 2020, 9:25 a.m. UTC
After the conversions of the reset routines, re-inserting SD cards
didn't work anymore. Apply this temporary workaround to have working SD
cards during the merge window. The issue will be fixed properly until
the final release.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

Hi Ulf, this regression only shows up in mmc/next, so this is *not* for
the current release. Anyhow, I'll be away for two weeks, and can't work
on it. So, I hope we can have this patch for a while to have a working
state.

 drivers/mmc/host/renesas_sdhi_core.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Ulf Hansson Oct. 8, 2020, 9:38 a.m. UTC | #1
On Thu, 8 Oct 2020 at 11:25, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> After the conversions of the reset routines, re-inserting SD cards
> didn't work anymore. Apply this temporary workaround to have working SD
> cards during the merge window. The issue will be fixed properly until
> the final release.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied for next, thanks!

> ---
>
> Hi Ulf, this regression only shows up in mmc/next, so this is *not* for
> the current release. Anyhow, I'll be away for two weeks, and can't work
> on it. So, I hope we can have this patch for a while to have a working
> state.

Okay. I am a little worried that the below could cause other issues
though, but let's look at this when you are back.

>
>  drivers/mmc/host/renesas_sdhi_core.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
> index 20e5eb63caf8..414314151d0a 100644
> --- a/drivers/mmc/host/renesas_sdhi_core.c
> +++ b/drivers/mmc/host/renesas_sdhi_core.c
> @@ -572,6 +572,17 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host)
>                                              TMIO_MASK_INIT_RCAR2);
>  }
>
> +/*
> + * This is a temporary workaround! This driver used 'hw_reset' wrongly and the
> + * fix for that showed a regression. So, we mimic the old behaviour until the
> + * proper solution is found.
> + */
> +static void renesas_sdhi_hw_reset(struct mmc_host *mmc)
> +{
> +       struct tmio_mmc_host *host = mmc_priv(mmc);
> +       renesas_sdhi_reset(host);

I wonder why you aren't using the ->set_ios() callback to do this instead?

In principle you should be able to look at host->ios.power_mode and
check if it's MMC_POWER_UP|OFF|ON to understand when a reset of the
host controller is needed. No?

> +}
> +
>  #define SH_MOBILE_SDHI_MIN_TAP_ROW 3
>
>  static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
> @@ -1009,6 +1020,8 @@ int renesas_sdhi_probe(struct platform_device *pdev,
>                 if (of_data && of_data->scc_offset) {
>                         priv->scc_ctl = host->ctl + of_data->scc_offset;
>                         host->reset = renesas_sdhi_reset;
> +                       host->ops.hw_reset = renesas_sdhi_hw_reset;
> +                       host->mmc->caps |= MMC_CAP_HW_RESET;
>                 }
>         }
>
> --
> 2.28.0
>

Kind regards
Uffe
diff mbox series

Patch

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 20e5eb63caf8..414314151d0a 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -572,6 +572,17 @@  static void renesas_sdhi_reset(struct tmio_mmc_host *host)
 					     TMIO_MASK_INIT_RCAR2);
 }
 
+/*
+ * This is a temporary workaround! This driver used 'hw_reset' wrongly and the
+ * fix for that showed a regression. So, we mimic the old behaviour until the
+ * proper solution is found.
+ */
+static void renesas_sdhi_hw_reset(struct mmc_host *mmc)
+{
+	struct tmio_mmc_host *host = mmc_priv(mmc);
+	renesas_sdhi_reset(host);
+}
+
 #define SH_MOBILE_SDHI_MIN_TAP_ROW 3
 
 static int renesas_sdhi_select_tuning(struct tmio_mmc_host *host)
@@ -1009,6 +1020,8 @@  int renesas_sdhi_probe(struct platform_device *pdev,
 		if (of_data && of_data->scc_offset) {
 			priv->scc_ctl = host->ctl + of_data->scc_offset;
 			host->reset = renesas_sdhi_reset;
+			host->ops.hw_reset = renesas_sdhi_hw_reset;
+			host->mmc->caps |= MMC_CAP_HW_RESET;
 		}
 	}