public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support
@ 2025-12-23  2:24 Yixun Lan
  2025-12-23  2:24 ` [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Yixun Lan @ 2025-12-23  2:24 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Adrian Hunter, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

This series try to add reset support explicitly to SpacemiT SDHCI controller.
Previous it works well for eMMC due to it's already initialized at brom or
bootloader phase.
  The controller has two reset lines, one connect to AXI bus which shared by
all controllers, while another one connect to individual controller separately.

Signed-off-by: Yixun Lan <dlan@gentoo.org>
---
Changes in v2:
- To not break DT ABI, make the reset line request optional
- Use devm_reset_control_get_optional() api
- Link to v1: https://lore.kernel.org/r/20251221-07-k1-sdhci-reset-v1-0-6780af7fa6e7@gentoo.org

---
Yixun Lan (3):
      dt-bindings: mmc: spacemit,sdhci: add reset support
      mmc: sdhci-of-k1: add reset support
      riscv: dts: spacemit: sdhci: add reset support

 .../devicetree/bindings/mmc/spacemit,sdhci.yaml      | 10 ++++++++++
 arch/riscv/boot/dts/spacemit/k1.dtsi                 |  3 +++
 drivers/mmc/host/sdhci-of-k1.c                       | 20 ++++++++++++++++++++
 3 files changed, 33 insertions(+)
---
base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
change-id: 20251221-07-k1-sdhci-reset-1990d1170437

Best regards,
-- 
Yixun Lan


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

* [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: add reset support
  2025-12-23  2:24 [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
@ 2025-12-23  2:24 ` Yixun Lan
  2025-12-23 13:49   ` Krzysztof Kozlowski
  2025-12-29  9:48   ` Javier Martinez Canillas
  2025-12-23  2:24 ` [PATCH v2 2/3] mmc: sdhci-of-k1: " Yixun Lan
                   ` (4 subsequent siblings)
  5 siblings, 2 replies; 11+ messages in thread
From: Yixun Lan @ 2025-12-23  2:24 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Adrian Hunter, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

The SpacemiT SDHCI controller has two reset lines, one connect to AXI bus
which shared by all controllers, while another one connect to individual
controller separately.

Signed-off-by: Yixun Lan <dlan@gentoo.org>
---
 Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
index 13d9382058fb..de4e9efeb666 100644
--- a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
+++ b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
@@ -32,6 +32,16 @@ properties:
       - const: core
       - const: io
 
+  resets:
+    items:
+      - description: axi reset, connect to AXI bus, shared by all controllers
+      - description: sdh reset, connect to individual controller separately
+
+  reset-names:
+    items:
+      - const: axi
+      - const: sdh
+
 required:
   - compatible
   - reg

-- 
2.52.0


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

* [PATCH v2 2/3] mmc: sdhci-of-k1: add reset support
  2025-12-23  2:24 [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
  2025-12-23  2:24 ` [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
@ 2025-12-23  2:24 ` Yixun Lan
  2025-12-29  9:54   ` Javier Martinez Canillas
  2025-12-23  2:24 ` [PATCH v2 3/3] riscv: dts: spacemit: sdhci: " Yixun Lan
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Yixun Lan @ 2025-12-23  2:24 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Adrian Hunter, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

The SDHCI controller of SpacemiT K1 SoC requires two resets, add
support to explicitly request the reset line and deassert during
initialization phase. Still using devm_xx_get_optional() API to
make the request optional.

Signed-off-by: Yixun Lan <dlan@gentoo.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..a160e1d5d9bd 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_optional_shared_deasserted(dev, "axi");
+	if (IS_ERR(rst))
+		return PTR_ERR(rst);
+
+	rst = devm_reset_control_get_optional_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


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

* [PATCH v2 3/3] riscv: dts: spacemit: sdhci: add reset support
  2025-12-23  2:24 [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
  2025-12-23  2:24 ` [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
  2025-12-23  2:24 ` [PATCH v2 2/3] mmc: sdhci-of-k1: " Yixun Lan
@ 2025-12-23  2:24 ` Yixun Lan
  2025-12-29  9:55   ` Javier Martinez Canillas
  2025-12-29  9:51 ` [PATCH v2 0/3] mmc: sdhci-of-k1: " Javier Martinez Canillas
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Yixun Lan @ 2025-12-23  2:24 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Adrian Hunter, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

Request two reset line explicitly for SDHCI controller.

Signed-off-by: Yixun Lan <dlan@gentoo.org>
---
 arch/riscv/boot/dts/spacemit/k1.dtsi | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/riscv/boot/dts/spacemit/k1.dtsi b/arch/riscv/boot/dts/spacemit/k1.dtsi
index 7818ca4979b6..7dd41d6dcb85 100644
--- a/arch/riscv/boot/dts/spacemit/k1.dtsi
+++ b/arch/riscv/boot/dts/spacemit/k1.dtsi
@@ -984,6 +984,9 @@ emmc: mmc@d4281000 {
 				clocks = <&syscon_apmu CLK_SDH_AXI>,
 					 <&syscon_apmu CLK_SDH2>;
 				clock-names = "core", "io";
+				resets = <&syscon_apmu RESET_SDH_AXI>,
+					 <&syscon_apmu RESET_SDH2>;
+				reset-names = "axi", "sdh";
 				interrupts = <101>;
 				status = "disabled";
 			};

-- 
2.52.0


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

* Re: [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: add reset support
  2025-12-23  2:24 ` [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
@ 2025-12-23 13:49   ` Krzysztof Kozlowski
  2025-12-29  9:48   ` Javier Martinez Canillas
  1 sibling, 0 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-23 13:49 UTC (permalink / raw)
  To: Yixun Lan
  Cc: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Adrian Hunter, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Iker Pedrosa, linux-mmc, devicetree,
	linux-riscv, spacemit, linux-kernel

On Tue, Dec 23, 2025 at 10:24:49AM +0800, Yixun Lan wrote:
> The SpacemiT SDHCI controller has two reset lines, one connect to AXI bus
> which shared by all controllers, while another one connect to individual
> controller separately.
> 
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
>  Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml | 10 ++++++++++
>  1 file changed, 10 insertions(+)

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


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

* Re: [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: add reset support
  2025-12-23  2:24 ` [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
  2025-12-23 13:49   ` Krzysztof Kozlowski
@ 2025-12-29  9:48   ` Javier Martinez Canillas
  1 sibling, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2025-12-29  9:48 UTC (permalink / raw)
  To: Yixun Lan, Ulf Hansson, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Adrian Hunter, Philipp Zabel, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

Yixun Lan <dlan@gentoo.org> writes:

> The SpacemiT SDHCI controller has two reset lines, one connect to AXI bus
> which shared by all controllers, while another one connect to individual
> controller separately.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

* Re: [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support
  2025-12-23  2:24 [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
                   ` (2 preceding siblings ...)
  2025-12-23  2:24 ` [PATCH v2 3/3] riscv: dts: spacemit: sdhci: " Yixun Lan
@ 2025-12-29  9:51 ` Javier Martinez Canillas
  2025-12-30 15:33 ` Ulf Hansson
  2026-01-09 11:36 ` (subset) " Yixun Lan
  5 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2025-12-29  9:51 UTC (permalink / raw)
  To: Yixun Lan, Ulf Hansson, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Adrian Hunter, Philipp Zabel, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

Yixun Lan <dlan@gentoo.org> writes:

> This series try to add reset support explicitly to SpacemiT SDHCI controller.
> Previous it works well for eMMC due to it's already initialized at brom or
> bootloader phase.
>   The controller has two reset lines, one connect to AXI bus which shared by
> all controllers, while another one connect to individual controller separately.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

* Re: [PATCH v2 2/3] mmc: sdhci-of-k1: add reset support
  2025-12-23  2:24 ` [PATCH v2 2/3] mmc: sdhci-of-k1: " Yixun Lan
@ 2025-12-29  9:54   ` Javier Martinez Canillas
  0 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2025-12-29  9:54 UTC (permalink / raw)
  To: Yixun Lan, Ulf Hansson, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Adrian Hunter, Philipp Zabel, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

Yixun Lan <dlan@gentoo.org> writes:

> The SDHCI controller of SpacemiT K1 SoC requires two resets, add
> support to explicitly request the reset line and deassert during
> initialization phase. Still using devm_xx_get_optional() API to
> make the request optional.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

* Re: [PATCH v2 3/3] riscv: dts: spacemit: sdhci: add reset support
  2025-12-23  2:24 ` [PATCH v2 3/3] riscv: dts: spacemit: sdhci: " Yixun Lan
@ 2025-12-29  9:55   ` Javier Martinez Canillas
  0 siblings, 0 replies; 11+ messages in thread
From: Javier Martinez Canillas @ 2025-12-29  9:55 UTC (permalink / raw)
  To: Yixun Lan, Ulf Hansson, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Adrian Hunter, Philipp Zabel, Paul Walmsley,
	Palmer Dabbelt, Albert Ou, Alexandre Ghiti
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel, Yixun Lan

Yixun Lan <dlan@gentoo.org> writes:

> Request two reset line explicitly for SDHCI controller.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---

Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>

-- 
Best regards,

Javier Martinez Canillas
Core Platforms
Red Hat


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

* Re: [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support
  2025-12-23  2:24 [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
                   ` (3 preceding siblings ...)
  2025-12-29  9:51 ` [PATCH v2 0/3] mmc: sdhci-of-k1: " Javier Martinez Canillas
@ 2025-12-30 15:33 ` Ulf Hansson
  2026-01-09 11:36 ` (subset) " Yixun Lan
  5 siblings, 0 replies; 11+ messages in thread
From: Ulf Hansson @ 2025-12-30 15:33 UTC (permalink / raw)
  To: Yixun Lan
  Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Adrian Hunter,
	Philipp Zabel, Paul Walmsley, Palmer Dabbelt, Albert Ou,
	Alexandre Ghiti, Iker Pedrosa, linux-mmc, devicetree, linux-riscv,
	spacemit, linux-kernel

On Tue, 23 Dec 2025 at 03:25, Yixun Lan <dlan@gentoo.org> wrote:
>
> This series try to add reset support explicitly to SpacemiT SDHCI controller.
> Previous it works well for eMMC due to it's already initialized at brom or
> bootloader phase.
>   The controller has two reset lines, one connect to AXI bus which shared by
> all controllers, while another one connect to individual controller separately.
>
> Signed-off-by: Yixun Lan <dlan@gentoo.org>
> ---
> Changes in v2:
> - To not break DT ABI, make the reset line request optional
> - Use devm_reset_control_get_optional() api
> - Link to v1: https://lore.kernel.org/r/20251221-07-k1-sdhci-reset-v1-0-6780af7fa6e7@gentoo.org
>
> ---
> Yixun Lan (3):
>       dt-bindings: mmc: spacemit,sdhci: add reset support
>       mmc: sdhci-of-k1: add reset support
>       riscv: dts: spacemit: sdhci: add reset support
>
>  .../devicetree/bindings/mmc/spacemit,sdhci.yaml      | 10 ++++++++++
>  arch/riscv/boot/dts/spacemit/k1.dtsi                 |  3 +++
>  drivers/mmc/host/sdhci-of-k1.c                       | 20 ++++++++++++++++++++
>  3 files changed, 33 insertions(+)
> ---
> base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> change-id: 20251221-07-k1-sdhci-reset-1990d1170437
>
> Best regards,
> --
> Yixun Lan
>

Patch 1->2 applied for next, thanks!

Kind regards
Uffe

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

* Re: (subset) [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support
  2025-12-23  2:24 [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
                   ` (4 preceding siblings ...)
  2025-12-30 15:33 ` Ulf Hansson
@ 2026-01-09 11:36 ` Yixun Lan
  5 siblings, 0 replies; 11+ messages in thread
From: Yixun Lan @ 2026-01-09 11:36 UTC (permalink / raw)
  To: Ulf Hansson, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Adrian Hunter, Philipp Zabel, Paul Walmsley, Palmer Dabbelt,
	Albert Ou, Alexandre Ghiti, Yixun Lan
  Cc: Iker Pedrosa, linux-mmc, devicetree, linux-riscv, spacemit,
	linux-kernel


On Tue, 23 Dec 2025 10:24:48 +0800, Yixun Lan wrote:
> This series try to add reset support explicitly to SpacemiT SDHCI controller.
> Previous it works well for eMMC due to it's already initialized at brom or
> bootloader phase.
>   The controller has two reset lines, one connect to AXI bus which shared by
> all controllers, while another one connect to individual controller separately.
> 
> 
> [...]

Applied, thanks!

[3/3] riscv: dts: spacemit: sdhci: add reset support
      https://github.com/spacemit-com/linux/commit/7c2b0e0b04c42dfa838c35833d2b4be11d0c8351

Best regards,
-- 
Yixun Lan


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

end of thread, other threads:[~2026-01-09 11:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-23  2:24 [PATCH v2 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
2025-12-23  2:24 ` [PATCH v2 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
2025-12-23 13:49   ` Krzysztof Kozlowski
2025-12-29  9:48   ` Javier Martinez Canillas
2025-12-23  2:24 ` [PATCH v2 2/3] mmc: sdhci-of-k1: " Yixun Lan
2025-12-29  9:54   ` Javier Martinez Canillas
2025-12-23  2:24 ` [PATCH v2 3/3] riscv: dts: spacemit: sdhci: " Yixun Lan
2025-12-29  9:55   ` Javier Martinez Canillas
2025-12-29  9:51 ` [PATCH v2 0/3] mmc: sdhci-of-k1: " Javier Martinez Canillas
2025-12-30 15:33 ` Ulf Hansson
2026-01-09 11:36 ` (subset) " Yixun Lan

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