[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251221-07-k1-sdhci-reset-v1-2-6780af7fa6e7@gentoo.org>
Date: Sun, 21 Dec 2025 16:20:27 +0800
From: Yixun Lan <dlan@...too.org>
To: Ulf Hansson <ulf.hansson@...aro.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>, Adrian Hunter <adrian.hunter@...el.com>,
Philipp Zabel <p.zabel@...gutronix.de>, Paul Walmsley <pjw@...nel.org>,
Palmer Dabbelt <palmer@...belt.com>, Albert Ou <aou@...s.berkeley.edu>,
Alexandre Ghiti <alex@...ti.fr>
Cc: Iker Pedrosa <ikerpedrosam@...il.com>, linux-mmc@...r.kernel.org,
devicetree@...r.kernel.org, linux-riscv@...ts.infradead.org,
spacemit@...ts.linux.dev, linux-kernel@...r.kernel.org,
Yixun Lan <dlan@...too.org>
Subject: [PATCH 2/3] mmc: sdhci-of-k1: add reset support
The SDHCI controller of SpacemiT K1 SoC requires two resets, add
support to explicitly request the reset line and deassert during
initialization phase.
Signed-off-by: Yixun Lan <dlan@...too.org>
---
drivers/mmc/host/sdhci-of-k1.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/mmc/host/sdhci-of-k1.c b/drivers/mmc/host/sdhci-of-k1.c
index 0cc97e23a2f9..f8330cff5b2a 100644
--- a/drivers/mmc/host/sdhci-of-k1.c
+++ b/drivers/mmc/host/sdhci-of-k1.c
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_device.h>
+#include <linux/reset.h>
#include <linux/platform_device.h>
#include "sdhci.h"
@@ -223,6 +224,21 @@ static inline int spacemit_sdhci_get_clocks(struct device *dev,
return 0;
}
+static inline int spacemit_sdhci_get_resets(struct device *dev)
+{
+ struct reset_control *rst;
+
+ rst = devm_reset_control_get_shared_deasserted(dev, "axi");
+ if (IS_ERR(rst))
+ return PTR_ERR(rst);
+
+ rst = devm_reset_control_get_exclusive_deasserted(dev, "sdh");
+ if (IS_ERR(rst))
+ return PTR_ERR(rst);
+
+ return 0;
+}
+
static const struct sdhci_ops spacemit_sdhci_ops = {
.get_max_clock = spacemit_sdhci_clk_get_max_clock,
.reset = spacemit_sdhci_reset,
@@ -284,6 +300,10 @@ static int spacemit_sdhci_probe(struct platform_device *pdev)
if (ret)
goto err_pltfm;
+ ret = spacemit_sdhci_get_resets(dev);
+ if (ret)
+ goto err_pltfm;
+
ret = sdhci_add_host(host);
if (ret)
goto err_pltfm;
--
2.52.0
Powered by blists - more mailing lists