blob: e5adef3c91adc8557f8a6926dc0f060cd0f0f960 [file] [log] [blame]
From 5f21aa8b8e9c5d454e0e134c2acfb5627fa08635 Mon Sep 17 00:00:00 2001
From: Cool Lee <cool_lee@aspeedtech.com>
Date: Mon, 5 Dec 2022 11:34:52 +0800
Subject: [PATCH 4/4] mmc: aspeed: fix sdhci software reset can't be cleared
issue.
Replace sdhci software reset by top reset.
Patch Tracking Bug: b/278582907
Upstream info: Aspeed will submit this change upstream. Currently, the
commit is located here: https://github.com/AspeedTech-BMC/linux/commit/5a41e235d75c60e6dbea158905b4c4b74ce64a70
Upstream-Status: Pending
Justification: Aspeed will submit this change upstream.
Signed-off-by: Cool Lee <cool_lee@aspeedtech.com>
Change-Id: Ic931e243e9b2b62ef7a30b1d2da78c1c204620a5
---
drivers/mmc/host/sdhci-of-aspeed.c | 39 +++++++++++++++++++++++++++++-
1 file changed, 38 insertions(+), 1 deletion(-)
diff --git a/drivers/mmc/host/sdhci-of-aspeed.c b/drivers/mmc/host/sdhci-of-aspeed.c
index fd9e3c3f9bad..47ec145c1025 100644
--- a/drivers/mmc/host/sdhci-of-aspeed.c
+++ b/drivers/mmc/host/sdhci-of-aspeed.c
@@ -382,13 +382,50 @@ static u32 aspeed_sdhci_readl(struct sdhci_host *host, int reg)
return val;
}
+static void aspeed_sdhci_reset(struct sdhci_host *host, u8 mask)
+{
+ struct sdhci_pltfm_host *pltfm_priv;
+ struct aspeed_sdhci *aspeed_sdhci;
+ struct aspeed_sdc *aspeed_sdc;
+ uint32_t save_array[7];
+ uint32_t reg_array[] = {SDHCI_DMA_ADDRESS,
+ SDHCI_BLOCK_SIZE,
+ SDHCI_ARGUMENT,
+ SDHCI_HOST_CONTROL,
+ SDHCI_CLOCK_CONTROL,
+ SDHCI_INT_ENABLE,
+ SDHCI_SIGNAL_ENABLE};
+ int i;
+
+ pltfm_priv = sdhci_priv(host);
+ aspeed_sdhci = sdhci_pltfm_priv(pltfm_priv);
+ aspeed_sdc = aspeed_sdhci->parent;
+
+ if (!IS_ERR(aspeed_sdc->rst)) {
+ for (i = 0; i < ARRAY_SIZE(reg_array); i++)
+ save_array[i] = sdhci_readl(host, reg_array[i]);
+
+ reset_control_assert(aspeed_sdc->rst);
+ mdelay(1);
+ reset_control_deassert(aspeed_sdc->rst);
+ mdelay(1);
+
+ for (i = 0; i < ARRAY_SIZE(reg_array); i++)
+ sdhci_writel(host, save_array[i], reg_array[i]);
+
+ aspeed_sdhci_set_clock(host, host->clock);
+ }
+
+ sdhci_reset(host, mask);
+}
+
static const struct sdhci_ops aspeed_sdhci_ops = {
.read_l = aspeed_sdhci_readl,
.set_clock = aspeed_sdhci_set_clock,
.get_max_clock = aspeed_sdhci_get_max_clock,
.set_bus_width = aspeed_sdhci_set_bus_width,
.get_timeout_clock = sdhci_pltfm_clk_get_max_clock,
- .reset = sdhci_reset,
+ .reset = aspeed_sdhci_reset,
.set_uhs_signaling = sdhci_set_uhs_signaling,
};
--
2.40.0.634.g4ca3ef3211-goog