summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-09-30 13:19:40 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2022-09-30 14:23:45 +0200
commitc7428c02d72d1c74295226e7c9483e0f62f6a2aa (patch)
treefdbf1375895ff063b5c5a6e5956eebff18c182fc
parent4e3b5b02235d19e5bf535a5a6a4af40a3700b0e3 (diff)
downloadbarebox-c7428c02d72d1c74295226e7c9483e0f62f6a2aa.tar.gz
barebox-c7428c02d72d1c74295226e7c9483e0f62f6a2aa.tar.xz
mci: bcm2835: reset host controller on barebox shutdown
We don't usually disable MMC controllers on barebox shutdown, because they don't DMA on their own, unlike e.g. network controllers. Booting Linux v5.17.0 on a Raspberry Pi 4 in 32-bit mode still has the MMC host controller driver complain: [ 22.464887] mmc1: Got data interrupt 0x00000002 even though no data operation was in progress. Fix this by resetting the SDHCI once barebox is done with it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220930111940.1323140-1-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mci/mci-bcm2835.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/mci/mci-bcm2835.c b/drivers/mci/mci-bcm2835.c
index f092156f9a..c5b226ba03 100644
--- a/drivers/mci/mci-bcm2835.c
+++ b/drivers/mci/mci-bcm2835.c
@@ -385,6 +385,8 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
host->sdhci.read32 = bcm2835_sdhci_read32;
host->sdhci.write32 = bcm2835_sdhci_write32;
+ hw_dev->priv = host;
+
mci_of_parse(&host->mci);
iores = dev_request_mem_resource(hw_dev, 0);
@@ -420,6 +422,15 @@ static int bcm2835_mci_probe(struct device_d *hw_dev)
return mci_register(&host->mci);
}
+static void bcm2835_mci_remove(struct device_d *dev)
+{
+ struct bcm2835_mci_host *host = dev->priv;
+
+ sdhci_write32(&host->sdhci,
+ SDHCI_CLOCK_CONTROL__TIMEOUT_CONTROL__SOFTWARE_RESET,
+ 0x00);
+}
+
static __maybe_unused struct of_device_id bcm2835_mci_compatible[] = {
{
.compatible = "brcm,bcm2835-sdhci",
@@ -433,6 +444,7 @@ static __maybe_unused struct of_device_id bcm2835_mci_compatible[] = {
static struct driver_d bcm2835_mci_driver = {
.name = "bcm2835_mci",
.probe = bcm2835_mci_probe,
+ .remove = bcm2835_mci_remove,
.of_compatible = DRV_OF_COMPAT(bcm2835_mci_compatible),
};