Linux MultiMedia Card development
 help / color / mirror / Atom feed
* [PATCH RFT] mmc: renesas_sdhi: register irqs before registering controller
@ 2023-07-10 14:08 Wolfram Sang
  2023-07-10 14:35 ` Biju Das
  2023-07-10 14:54 ` Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfram Sang @ 2023-07-10 14:08 UTC (permalink / raw)
  To: linux-renesas-soc, linux-mmc; +Cc: Wolfram Sang, Ulf Hansson, linux-kernel

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@sang-engineering.com>
---

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.

 drivers/mmc/host/renesas_sdhi_core.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 345934e4f59e..499d043f034f 100644
--- 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;
+
 	/* 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;
@@ -1100,9 +1101,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 		host->ops.hs400_complete = renesas_sdhi_hs400_complete;
 	}
 
-	ret = tmio_mmc_host_probe(host);
-	if (ret < 0)
-		goto edisclk;
+	sd_ctrl_write32_as_16_and_16(host, CTL_IRQ_MASK, host->sdcard_irq_mask_all);
 
 	num_irqs = platform_irq_count(pdev);
 	if (num_irqs < 0) {
@@ -1129,6 +1128,10 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 			goto eirq;
 	}
 
+	ret = tmio_mmc_host_probe(host);
+	if (ret < 0)
+		goto edisclk;
+
 	dev_info(&pdev->dev, "%s base at %pa, max clock rate %u MHz\n",
 		 mmc_hostname(host->mmc), &res->start, host->mmc->f_max / 1000000);
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-07-12 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-10 14:08 [PATCH RFT] mmc: renesas_sdhi: register irqs before registering controller Wolfram Sang
2023-07-10 14:35 ` Biju Das
2023-07-10 14:54 ` Geert Uytterhoeven
2023-07-11 20:00   ` Geert Uytterhoeven
2023-07-12 12:26     ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox