Re: [PATCH RFT] mmc: renesas_sdhi: register irqs before registering controller

From: Geert Uytterhoeven
Date: Tue Jul 11 2023 - 16:00:54 EST


Hi Wolfram,

On Mon, Jul 10, 2023 at 4:54 PM Geert Uytterhoeven <geert@xxxxxxxxxxxxxx> wrote:
> On Mon, Jul 10, 2023 at 4:10 PM Wolfram Sang
> <wsa+renesas@xxxxxxxxxxxxxxxxxxxx> wrote:
> > IRQs should be ready to serve when we call mmc_add_host() via
> > tmio_mmc_host_probe(). To achieve that, ensure that all irqs are masked
> > before registering the handlers.
> >
> > Signed-off-by: Wolfram Sang <wsa+renesas@xxxxxxxxxxxxxxxxxxxx>
>
> Thanks for your patch!
>
> > Based on 6.5-rc1 with bf54dec9e953 ("Revert "mmc: Revert "mmc: core:
> > Allow mmc_start_host() synchronously detect a card") reverted. That base
> > alone shows the regression. This patch works fine on a Salvator-X with a
> > M3-W. I'll test more boards. Yet, I send it out so people can tests with
> > boards I don't have.
>
> I guess bf54dec9e953 is your local commit that reverts commit
> fa700d73494abbd3 ("mmc: Revert "mmc: core: Allow mmc_start_host()
> synchronously detect a card"") in v6.5-rc1?
>
> > --- a/drivers/mmc/host/renesas_sdhi_core.c
> > +++ b/drivers/mmc/host/renesas_sdhi_core.c
> > @@ -1004,10 +1004,11 @@ int renesas_sdhi_probe(struct platform_device *pdev,
> > host->ops.start_signal_voltage_switch =
> > renesas_sdhi_start_signal_voltage_switch;
> > host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27;
> > - host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2;
> > host->reset = renesas_sdhi_reset;
> > }
> >
> > + host->sdcard_irq_mask_all = TMIO_MMC_MIN_RCAR2 ? TMIO_MASK_ALL_RCAR2 : TMIO_MASK_ALL;
>
> The condition above is always true. I assume you wanted to test
> "mmc_data->flags & TMIO_MMC_MIN_RCAR2" instead?

No issues seen after reverting fa700d73494abbd3 and applying your patch
(plus the fix below) on top of today's renesas-drivers release.

--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1004,11 +1004,12 @@ int renesas_sdhi_probe(struct platform_device *pdev,
host->ops.start_signal_voltage_switch =
renesas_sdhi_start_signal_voltage_switch;
host->sdcard_irq_setbit_mask = TMIO_STAT_ALWAYS_SET_27;
+ host->sdcard_irq_mask_all = TMIO_MASK_ALL_RCAR2;
host->reset = renesas_sdhi_reset;
+ } else {
+ host->sdcard_irq_mask_all = TMIO_MASK_ALL;
}

- host->sdcard_irq_mask_all = TMIO_MMC_MIN_RCAR2 ?
TMIO_MASK_ALL_RCAR2 : TMIO_MASK_ALL;
-
/* Orginally registers were 16 bit apart, could be 32 or 64 nowadays */
if (!host->bus_shift && resource_size(res) > 0x100) /* old way
to determine the shift */
host->bus_shift = 1;

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