diff mbox series

mmc: tmio: reinit card irqs in reset routine

Message ID 20211103122646.64422-1-wsa+renesas@sang-engineering.com (mailing list archive)
State New, archived
Headers show
Series mmc: tmio: reinit card irqs in reset routine | expand

Commit Message

Wolfram Sang Nov. 3, 2021, 12:26 p.m. UTC
From: Biju Das <biju.das.jz@bp.renesas.com>

Refactor the code so that card detect irqs are always reenabled after a
reset. This avoids doing it manually all over the code or forgetting to
do this in the future.

Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
[wsa: added a comment when 'native_hotplug' has to be set]
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/mmc/host/tmio_mmc_core.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Comments

Ulf Hansson Nov. 15, 2021, 10:56 a.m. UTC | #1
On Wed, 3 Nov 2021 at 13:26, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
>
> From: Biju Das <biju.das.jz@bp.renesas.com>
>
> Refactor the code so that card detect irqs are always reenabled after a
> reset. This avoids doing it manually all over the code or forgetting to
> do this in the future.
>
> Reported-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> [wsa: added a comment when 'native_hotplug' has to be set]
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/host/tmio_mmc_core.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
> index e2affa52ef46..a5850d83908b 100644
> --- a/drivers/mmc/host/tmio_mmc_core.c
> +++ b/drivers/mmc/host/tmio_mmc_core.c
> @@ -960,14 +960,8 @@ static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>         case MMC_POWER_OFF:
>                 tmio_mmc_power_off(host);
>                 /* For R-Car Gen2+, we need to reset SDHI specific SCC */
> -               if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) {
> -                       host->reset(host);
> -
> -                       if (host->native_hotplug)
> -                               tmio_mmc_enable_mmc_irqs(host,
> -                                               TMIO_STAT_CARD_REMOVE |
> -                                               TMIO_STAT_CARD_INSERT);
> -               }
> +               if (host->pdata->flags & TMIO_MMC_MIN_RCAR2)
> +                       tmio_mmc_reset(host);
>
>                 host->set_clock(host, 0);
>                 break;
> @@ -1175,6 +1169,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
>         if (mmc_can_gpio_cd(mmc))
>                 _host->ops.get_cd = mmc_gpio_get_cd;
>
> +       /* must be set before tmio_mmc_reset() */
>         _host->native_hotplug = !(mmc_can_gpio_cd(mmc) ||
>                                   mmc->caps & MMC_CAP_NEEDS_POLL ||
>                                   !mmc_card_is_removable(mmc));
> @@ -1295,10 +1290,6 @@ int tmio_mmc_host_runtime_resume(struct device *dev)
>         if (host->clk_cache)
>                 host->set_clock(host, host->clk_cache);
>
> -       if (host->native_hotplug)
> -               tmio_mmc_enable_mmc_irqs(host,
> -                               TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT);
> -
>         tmio_mmc_enable_dma(host, true);
>
>         return 0;
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index e2affa52ef46..a5850d83908b 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -960,14 +960,8 @@  static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 	case MMC_POWER_OFF:
 		tmio_mmc_power_off(host);
 		/* For R-Car Gen2+, we need to reset SDHI specific SCC */
-		if (host->pdata->flags & TMIO_MMC_MIN_RCAR2) {
-			host->reset(host);
-
-			if (host->native_hotplug)
-				tmio_mmc_enable_mmc_irqs(host,
-						TMIO_STAT_CARD_REMOVE |
-						TMIO_STAT_CARD_INSERT);
-		}
+		if (host->pdata->flags & TMIO_MMC_MIN_RCAR2)
+			tmio_mmc_reset(host);
 
 		host->set_clock(host, 0);
 		break;
@@ -1175,6 +1169,7 @@  int tmio_mmc_host_probe(struct tmio_mmc_host *_host)
 	if (mmc_can_gpio_cd(mmc))
 		_host->ops.get_cd = mmc_gpio_get_cd;
 
+	/* must be set before tmio_mmc_reset() */
 	_host->native_hotplug = !(mmc_can_gpio_cd(mmc) ||
 				  mmc->caps & MMC_CAP_NEEDS_POLL ||
 				  !mmc_card_is_removable(mmc));
@@ -1295,10 +1290,6 @@  int tmio_mmc_host_runtime_resume(struct device *dev)
 	if (host->clk_cache)
 		host->set_clock(host, host->clk_cache);
 
-	if (host->native_hotplug)
-		tmio_mmc_enable_mmc_irqs(host,
-				TMIO_STAT_CARD_REMOVE | TMIO_STAT_CARD_INSERT);
-
 	tmio_mmc_enable_dma(host, true);
 
 	return 0;