* [PATCH 1/3] dt-bindings: mmc: spacemit,sdhci: add reset support
2025-12-21 8:20 [PATCH 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
@ 2025-12-21 8:20 ` Yixun Lan
2025-12-21 15:09 ` Krzysztof Kozlowski
2025-12-21 8:20 ` [PATCH 2/3] mmc: sdhci-of-k1: " Yixun Lan
2025-12-21 8:20 ` [PATCH 3/3] riscv: dts: spacemit: sdhci: " Yixun Lan
2 siblings, 1 reply; 7+ messages in thread
From: Yixun Lan @ 2025-12-21 8:20 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 | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
index 13d9382058fb..322c69b056f4 100644
--- a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
+++ b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
@@ -32,12 +32,24 @@ 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
- interrupts
- clocks
- clock-names
+ - resets
+ - reset-names
unevaluatedProperties: false
@@ -50,4 +62,6 @@ examples:
interrupt-parent = <&plic>;
clocks = <&clk_apmu 10>, <&clk_apmu 13>;
clock-names = "core", "io";
+ resets = <&syscon_apmu 2>, <&syscon_apmu 5>;
+ reset-names = "axi", "sdh";
};
--
2.52.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/3] dt-bindings: mmc: spacemit,sdhci: add reset support
2025-12-21 8:20 ` [PATCH 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
@ 2025-12-21 15:09 ` Krzysztof Kozlowski
2025-12-22 2:12 ` Yixun Lan
0 siblings, 1 reply; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-21 15:09 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 Sun, Dec 21, 2025 at 04:20:26PM +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 | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
> index 13d9382058fb..322c69b056f4 100644
> --- a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
> +++ b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
> @@ -32,12 +32,24 @@ 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
> - interrupts
> - clocks
> - clock-names
> + - resets
> + - reset-names
This is an ABI break without mentioning in commit msg and without any
justification.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mmc: spacemit,sdhci: add reset support
2025-12-21 15:09 ` Krzysztof Kozlowski
@ 2025-12-22 2:12 ` Yixun Lan
2025-12-22 8:16 ` Krzysztof Kozlowski
0 siblings, 1 reply; 7+ messages in thread
From: Yixun Lan @ 2025-12-22 2:12 UTC (permalink / raw)
To: Krzysztof Kozlowski
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
Hi Krzysztof,
On 16:09 Sun 21 Dec , Krzysztof Kozlowski wrote:
> On Sun, Dec 21, 2025 at 04:20:26PM +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 | 14 ++++++++++++++
> > 1 file changed, 14 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
> > index 13d9382058fb..322c69b056f4 100644
> > --- a/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
> > +++ b/Documentation/devicetree/bindings/mmc/spacemit,sdhci.yaml
> > @@ -32,12 +32,24 @@ 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
> > - interrupts
> > - clocks
> > - clock-names
> > + - resets
> > + - reset-names
>
> This is an ABI break without mentioning in commit msg and without any
> justification.
>
Indeed, this will introduce a breakage when combining new kernel + old dtb
Since in current case, the eMMC works fine without reset line operation,
I then would make this property optional (drop it from 'required' section)
and switch to use devm_reset_control_get_optional_xx() API in driver code
Does this looks good to you?
--
Yixun Lan (dlan)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] dt-bindings: mmc: spacemit,sdhci: add reset support
2025-12-22 2:12 ` Yixun Lan
@ 2025-12-22 8:16 ` Krzysztof Kozlowski
0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2025-12-22 8:16 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 22/12/2025 03:12, Yixun Lan wrote:
>>> required:
>>> - compatible
>>> - reg
>>> - interrupts
>>> - clocks
>>> - clock-names
>>> + - resets
>>> + - reset-names
>>
>> This is an ABI break without mentioning in commit msg and without any
>> justification.
>>
> Indeed, this will introduce a breakage when combining new kernel + old dtb
>
> Since in current case, the eMMC works fine without reset line operation,
> I then would make this property optional (drop it from 'required' section)
> and switch to use devm_reset_control_get_optional_xx() API in driver code
>
> Does this looks good to you?
>
Yes
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/3] mmc: sdhci-of-k1: add reset support
2025-12-21 8:20 [PATCH 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
2025-12-21 8:20 ` [PATCH 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
@ 2025-12-21 8:20 ` Yixun Lan
2025-12-21 8:20 ` [PATCH 3/3] riscv: dts: spacemit: sdhci: " Yixun Lan
2 siblings, 0 replies; 7+ messages in thread
From: Yixun Lan @ 2025-12-21 8:20 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.
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..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
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/3] riscv: dts: spacemit: sdhci: add reset support
2025-12-21 8:20 [PATCH 0/3] mmc: sdhci-of-k1: add reset support Yixun Lan
2025-12-21 8:20 ` [PATCH 1/3] dt-bindings: mmc: spacemit,sdhci: " Yixun Lan
2025-12-21 8:20 ` [PATCH 2/3] mmc: sdhci-of-k1: " Yixun Lan
@ 2025-12-21 8:20 ` Yixun Lan
2 siblings, 0 replies; 7+ messages in thread
From: Yixun Lan @ 2025-12-21 8:20 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] 7+ messages in thread