public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
* [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI
@ 2025-06-23 14:48 Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 01/10] clk: renesas: r9a09g047: Add SDHI clocks/resets Tommaso Merciai
                   ` (10 more replies)
  0 siblings, 11 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

Hi All,

This patch series aims to add SDHI support for the Renesas RZ/G3E SoCs
into the linux-6.12.y-cip kernel.

The SD/MMC block on the RZ/G3E ("R9A09G047") SoC is similar to that
of the RZ/V2H, but the SD0 channel has only dedicated pins, so we must
use SD_STATUS register to control voltage and power enable (internal
regulator).

For SD1 and SD2 channel we can either use gpio regulator or internal
regulator (using SD_STATUS register) for voltage switching.

This patchset applies on top of [1]

[1] https://patchwork.kernel.org/project/cip-dev/list/?series=974772

Thanks & Regards,
Tommaso

Biju Das (10):
  clk: renesas: r9a09g047: Add SDHI clocks/resets
  dt-bindings: mmc: renesas,sdhi: Document RZ/G3E support
  of: base: Add of_get_available_child_by_name()
  mmc: renesas_sdhi: Add support for RZ/G3E SoC
  mmc: renesas_sdhi: Use of_get_available_child_by_name()
  arm64: dts: renesas: r9a09g047: Add SDHI0-SDHI2 nodes
  arm64: dts: renesas: r9a09g057: Add support for enabling SDHI internal
    regulator
  arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
  arm64: dts: renesas: rzg3e-smarc-som: Add support to enable SD on
    SDHI0
  arm64: dts: renesas: r9a09g047e57-smarc: Enable SDHI1

 .../devicetree/bindings/mmc/renesas,sdhi.yaml |  16 ++
 arch/arm64/boot/dts/renesas/r9a09g047.dtsi    |  60 +++++++
 .../boot/dts/renesas/r9a09g047e57-smarc.dts   |  49 ++++++
 arch/arm64/boot/dts/renesas/r9a09g057.dtsi    |  21 +++
 .../boot/dts/renesas/renesas-smarc2.dtsi      |  18 ++
 .../boot/dts/renesas/rzg3e-smarc-som.dtsi     | 154 ++++++++++++++++++
 drivers/clk/renesas/r9a09g047-cpg.c           |  31 ++++
 drivers/mmc/host/Kconfig                      |   2 +-
 drivers/mmc/host/renesas_sdhi.h               |   1 +
 drivers/mmc/host/renesas_sdhi_core.c          | 126 ++++++++++++++
 drivers/mmc/host/tmio_mmc.h                   |  10 ++
 drivers/of/base.c                             |  27 +++
 include/linux/of.h                            |   9 +
 13 files changed, 523 insertions(+), 1 deletion(-)

-- 
2.43.0



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

* [PATCH 6.12.y-cip 01/10] clk: renesas: r9a09g047: Add SDHI clocks/resets
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 02/10] dt-bindings: mmc: renesas,sdhi: Document RZ/G3E support Tommaso Merciai
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 922c892834689939953c74bd34d01788b17feb7e upstream.

Add SDHI[0-2] clock and reset entries.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250126134616.37334-3-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 drivers/clk/renesas/r9a09g047-cpg.c | 31 +++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/drivers/clk/renesas/r9a09g047-cpg.c b/drivers/clk/renesas/r9a09g047-cpg.c
index 1886eab9ef9e..133582317490 100644
--- a/drivers/clk/renesas/r9a09g047-cpg.c
+++ b/drivers/clk/renesas/r9a09g047-cpg.c
@@ -31,6 +31,8 @@ enum clk_ids {
 
 	/* Internal Core Clocks */
 	CLK_PLLCM33_DIV16,
+	CLK_PLLCLN_DIV2,
+	CLK_PLLCLN_DIV8,
 	CLK_PLLCLN_DIV16,
 	CLK_PLLDTY_ACPU,
 	CLK_PLLDTY_ACPU_DIV4,
@@ -71,6 +73,8 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
 	/* Internal Core Clocks */
 	DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
 
+	DEF_FIXED(".pllcln_div2", CLK_PLLCLN_DIV2, CLK_PLLCLN, 1, 2),
+	DEF_FIXED(".pllcln_div8", CLK_PLLCLN_DIV8, CLK_PLLCLN, 1, 8),
 	DEF_FIXED(".pllcln_div16", CLK_PLLCLN_DIV16, CLK_PLLCLN, 1, 16),
 
 	DEF_DDIV(".plldty_acpu", CLK_PLLDTY_ACPU, CLK_PLLDTY, CDDIV0_DIVCTL2, dtable_2_64),
@@ -124,6 +128,30 @@ static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
 						BUS_MSTOP(1, BIT(7))),
 	DEF_MOD("riic_7_ckm",			CLK_PLLCLN_DIV16, 9, 11, 4, 27,
 						BUS_MSTOP(1, BIT(8))),
+	DEF_MOD("sdhi_0_imclk",			CLK_PLLCLN_DIV8, 10, 3, 5, 3,
+						BUS_MSTOP(8, BIT(2))),
+	DEF_MOD("sdhi_0_imclk2",		CLK_PLLCLN_DIV8, 10, 4, 5, 4,
+						BUS_MSTOP(8, BIT(2))),
+	DEF_MOD("sdhi_0_clk_hs",		CLK_PLLCLN_DIV2, 10, 5, 5, 5,
+						BUS_MSTOP(8, BIT(2))),
+	DEF_MOD("sdhi_0_aclk",			CLK_PLLDTY_ACPU_DIV4, 10, 6, 5, 6,
+						BUS_MSTOP(8, BIT(2))),
+	DEF_MOD("sdhi_1_imclk",			CLK_PLLCLN_DIV8, 10, 7, 5, 7,
+						BUS_MSTOP(8, BIT(3))),
+	DEF_MOD("sdhi_1_imclk2",		CLK_PLLCLN_DIV8, 10, 8, 5, 8,
+						BUS_MSTOP(8, BIT(3))),
+	DEF_MOD("sdhi_1_clk_hs",		CLK_PLLCLN_DIV2, 10, 9, 5, 9,
+						BUS_MSTOP(8, BIT(3))),
+	DEF_MOD("sdhi_1_aclk",			CLK_PLLDTY_ACPU_DIV4, 10, 10, 5, 10,
+						BUS_MSTOP(8, BIT(3))),
+	DEF_MOD("sdhi_2_imclk",			CLK_PLLCLN_DIV8, 10, 11, 5, 11,
+						BUS_MSTOP(8, BIT(4))),
+	DEF_MOD("sdhi_2_imclk2",		CLK_PLLCLN_DIV8, 10, 12, 5, 12,
+						BUS_MSTOP(8, BIT(4))),
+	DEF_MOD("sdhi_2_clk_hs",		CLK_PLLCLN_DIV2, 10, 13, 5, 13,
+						BUS_MSTOP(8, BIT(4))),
+	DEF_MOD("sdhi_2_aclk",			CLK_PLLDTY_ACPU_DIV4, 10, 14, 5, 14,
+						BUS_MSTOP(8, BIT(4))),
 };
 
 static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
@@ -143,6 +171,9 @@ static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
 	DEF_RST(9, 14, 4, 15),		/* RIIC_6_MRST */
 	DEF_RST(9, 15, 4, 16),		/* RIIC_7_MRST */
 	DEF_RST(10, 0, 4, 17),		/* RIIC_8_MRST */
+	DEF_RST(10, 7, 4, 24),		/* SDHI_0_IXRST */
+	DEF_RST(10, 8, 4, 25),		/* SDHI_1_IXRST */
+	DEF_RST(10, 9, 4, 26),		/* SDHI_2_IXRST */
 };
 
 const struct rzv2h_cpg_info r9a09g047_cpg_info __initconst = {
-- 
2.43.0



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

* [PATCH 6.12.y-cip 02/10] dt-bindings: mmc: renesas,sdhi: Document RZ/G3E support
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 01/10] clk: renesas: r9a09g047: Add SDHI clocks/resets Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 03/10] of: base: Add of_get_available_child_by_name() Tommaso Merciai
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 93745285ad9ba11ef68922787e0f46da408ab0b7 upstream.

The SD/MMC block on the RZ/G3E ("R9A09G047") SoC is similar to that
of the RZ/V2H, but the SD0 channel has only dedicated pins, so we must
use SD_STATUS register to control voltage and power enable (internal
regulator), for non-fixed voltage (SD) MMC interface. However, it is
optional for fixed voltage MMC interface (eMMC).

For SD1 and SD2 channels, we can either use gpio regulator or internal
regulator (using SD_STATUS register) for voltage switching.

Document RZ/G3E SDHI IP support with optional internal regulator for
both RZ/G3E and RZ/V2H SoC.

Acked-by: Conor Dooley <conor.dooley@microchip.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250305092958.21865-2-biju.das.jz@bp.renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 .../devicetree/bindings/mmc/renesas,sdhi.yaml    | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
index af378b9ff3f4..773baa6c2656 100644
--- a/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
+++ b/Documentation/devicetree/bindings/mmc/renesas,sdhi.yaml
@@ -68,6 +68,9 @@ properties:
               - renesas,sdhi-r9a08g045 # RZ/G3S
               - renesas,sdhi-r9a09g011 # RZ/V2M
           - const: renesas,rzg2l-sdhi
+      - items:
+          - const: renesas,sdhi-r9a09g047 # RZ/G3E
+          - const: renesas,sdhi-r9a09g057 # RZ/V2H(P)
 
   reg:
     maxItems: 1
@@ -211,6 +214,19 @@ allOf:
         sectioned off to be run by a separate second clock source to allow
         the main core clock to be turned off to save power.
 
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: renesas,sdhi-r9a09g057
+    then:
+      properties:
+        vqmmc-regulator:
+          type: object
+          description: VQMMC SD regulator
+          $ref: /schemas/regulator/regulator.yaml#
+          unevaluatedProperties: false
+
 required:
   - compatible
   - reg
-- 
2.43.0



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

* [PATCH 6.12.y-cip 03/10] of: base: Add of_get_available_child_by_name()
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 01/10] clk: renesas: r9a09g047: Add SDHI clocks/resets Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 02/10] dt-bindings: mmc: renesas,sdhi: Document RZ/G3E support Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 04/10] mmc: renesas_sdhi: Add support for RZ/G3E SoC Tommaso Merciai
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 8d3bbe4355aded32961b9009b31de6d41b7352e9 upstream.

There are lot of drivers using of_get_child_by_name() followed by
of_device_is_available() to find the available child node by name for a
given parent. Provide a helper for these users to simplify the code.

Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 drivers/of/base.c  | 27 +++++++++++++++++++++++++++
 include/linux/of.h |  9 +++++++++
 2 files changed, 36 insertions(+)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 4bb87e0cbaf1..c2ecd77325a3 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -771,6 +771,33 @@ struct device_node *of_get_child_by_name(const struct device_node *node,
 }
 EXPORT_SYMBOL(of_get_child_by_name);
 
+/**
+ * of_get_available_child_by_name - Find the available child node by name for a given parent
+ * @node:	parent node
+ * @name:	child name to look for.
+ *
+ * This function looks for child node for given matching name and checks the
+ * device's availability for use.
+ *
+ * Return: A node pointer if found, with refcount incremented, use
+ * of_node_put() on it when done.
+ * Returns NULL if node is not found.
+ */
+struct device_node *of_get_available_child_by_name(const struct device_node *node,
+						   const char *name)
+{
+	struct device_node *child;
+
+	child = of_get_child_by_name(node, name);
+	if (child && !of_device_is_available(child)) {
+		of_node_put(child);
+		return NULL;
+	}
+
+	return child;
+}
+EXPORT_SYMBOL(of_get_available_child_by_name);
+
 struct device_node *__of_find_node_by_path(struct device_node *parent,
 						const char *path)
 {
diff --git a/include/linux/of.h b/include/linux/of.h
index 85b60ac9eec5..4232d1c43929 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -298,6 +298,8 @@ extern struct device_node *of_get_compatible_child(const struct device_node *par
 					const char *compatible);
 extern struct device_node *of_get_child_by_name(const struct device_node *node,
 					const char *name);
+extern struct device_node *of_get_available_child_by_name(const struct device_node *node,
+							  const char *name);
 
 /* cache lookup */
 extern struct device_node *of_find_next_cache_node(const struct device_node *);
@@ -575,6 +577,13 @@ static inline struct device_node *of_get_child_by_name(
 	return NULL;
 }
 
+static inline struct device_node *of_get_available_child_by_name(
+					const struct device_node *node,
+					const char *name)
+{
+	return NULL;
+}
+
 static inline int of_device_is_compatible(const struct device_node *device,
 					  const char *name)
 {
-- 
2.43.0



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

* [PATCH 6.12.y-cip 04/10] mmc: renesas_sdhi: Add support for RZ/G3E SoC
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (2 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 03/10] of: base: Add of_get_available_child_by_name() Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 05/10] mmc: renesas_sdhi: Use of_get_available_child_by_name() Tommaso Merciai
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit fae80a99dc0320be854aa789cbe7ed0e1e574c61 upstream.

The SDHI/eMMC IPs in the RZ/G3E SoC are similar to those in R-Car Gen3.
However, the RZ/G3E SD0 channel has Voltage level control and PWEN pin
support via SD_STATUS register.

internal regulator support is added to control the voltage levels of
the SD pins via sd_iovs/sd_pwen bits in SD_STATUS register by populating
vqmmc-regulator child node.

SD1 and SD2 channels have gpio regulator support and internal regulator
support. Selection of the regulator is based on the regulator phandle.
Similar case for SD0 fixed voltage (eMMC) that uses fixed regulator and
SD0 non-fixed voltage (SD0) that uses internal regulator.

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20250305092958.21865-3-biju.das.jz@bp.renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[tommaso: Squashed the commits ede057759b83("mmc: renesas_sdhi: fix
	  error code in renesas_sdhi_probe()") and
	  77183db6b8db("mmc: renesas_sdhi: disable clocks if registering
	  regulator failed") and
	  9078f01fec12("mmc: renesas_sdhi: add regulator dependency")]
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 drivers/mmc/host/Kconfig             |   2 +-
 drivers/mmc/host/renesas_sdhi.h      |   1 +
 drivers/mmc/host/renesas_sdhi_core.c | 131 +++++++++++++++++++++++++++
 drivers/mmc/host/tmio_mmc.h          |  10 ++
 4 files changed, 143 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 7199cb0bd0b9..c5a169395162 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -681,8 +681,8 @@ config MMC_TMIO_CORE
 config MMC_SDHI
 	tristate "Renesas SDHI SD/SDIO controller support"
 	depends on SUPERH || ARCH_RENESAS || COMPILE_TEST
+	depends on (RESET_CONTROLLER && REGULATOR) || !OF
 	select MMC_TMIO_CORE
-	select RESET_CONTROLLER if ARCH_RENESAS
 	help
 	  This provides support for the SDHI SD/SDIO controller found in
 	  Renesas SuperH, ARM and ARM64 based SoCs
diff --git a/drivers/mmc/host/renesas_sdhi.h b/drivers/mmc/host/renesas_sdhi.h
index f12a87442338..291ddb4ad9be 100644
--- a/drivers/mmc/host/renesas_sdhi.h
+++ b/drivers/mmc/host/renesas_sdhi.h
@@ -95,6 +95,7 @@ struct renesas_sdhi {
 
 	struct reset_control *rstc;
 	struct tmio_mmc_host *host;
+	struct regulator_dev *rdev;
 };
 
 #define host_to_priv(host) \
diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 6ebb3d1eeb4d..8c83e203c516 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -32,6 +32,8 @@
 #include <linux/platform_device.h>
 #include <linux/pm_domain.h>
 #include <linux/regulator/consumer.h>
+#include <linux/regulator/driver.h>
+#include <linux/regulator/of_regulator.h>
 #include <linux/reset.h>
 #include <linux/sh_dma.h>
 #include <linux/slab.h>
@@ -581,12 +583,24 @@ static void renesas_sdhi_reset(struct tmio_mmc_host *host, bool preserve)
 
 	if (!preserve) {
 		if (priv->rstc) {
+			u32 sd_status;
+			/*
+			 * HW reset might have toggled the regulator state in
+			 * HW which regulator core might be unaware of so save
+			 * and restore the regulator state during HW reset.
+			 */
+			if (priv->rdev)
+				sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
+
 			reset_control_reset(priv->rstc);
 			/* Unknown why but without polling reset status, it will hang */
 			read_poll_timeout(reset_control_status, ret, ret == 0, 1, 100,
 					  false, priv->rstc);
 			/* At least SDHI_VER_GEN2_SDR50 needs manual release of reset */
 			sd_ctrl_write16(host, CTL_RESET_SD, 0x0001);
+			if (priv->rdev)
+				sd_ctrl_write32(host, CTL_SD_STATUS, sd_status);
+
 			priv->needs_adjust_hs400 = false;
 			renesas_sdhi_set_clock(host, host->clk_cache);
 
@@ -904,6 +918,102 @@ static void renesas_sdhi_enable_dma(struct tmio_mmc_host *host, bool enable)
 	renesas_sdhi_sdbuf_width(host, enable ? width : 16);
 }
 
+static const unsigned int renesas_sdhi_vqmmc_voltages[] = {
+	3300000, 1800000
+};
+
+static int renesas_sdhi_regulator_disable(struct regulator_dev *rdev)
+{
+	struct tmio_mmc_host *host = rdev_get_drvdata(rdev);
+	u32 sd_status;
+
+	sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
+	sd_status &= ~SD_STATUS_PWEN;
+	sd_ctrl_write32(host, CTL_SD_STATUS, sd_status);
+
+	return 0;
+}
+
+static int renesas_sdhi_regulator_enable(struct regulator_dev *rdev)
+{
+	struct tmio_mmc_host *host = rdev_get_drvdata(rdev);
+	u32 sd_status;
+
+	sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
+	sd_status |= SD_STATUS_PWEN;
+	sd_ctrl_write32(host, CTL_SD_STATUS, sd_status);
+
+	return 0;
+}
+
+static int renesas_sdhi_regulator_is_enabled(struct regulator_dev *rdev)
+{
+	struct tmio_mmc_host *host = rdev_get_drvdata(rdev);
+	u32 sd_status;
+
+	sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
+
+	return (sd_status & SD_STATUS_PWEN) ? 1 : 0;
+}
+
+static int renesas_sdhi_regulator_get_voltage(struct regulator_dev *rdev)
+{
+	struct tmio_mmc_host *host = rdev_get_drvdata(rdev);
+	u32 sd_status;
+
+	sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
+
+	return (sd_status & SD_STATUS_IOVS) ? 1800000 : 3300000;
+}
+
+static int renesas_sdhi_regulator_set_voltage(struct regulator_dev *rdev,
+					      int min_uV, int max_uV,
+					      unsigned int *selector)
+{
+	struct tmio_mmc_host *host = rdev_get_drvdata(rdev);
+	u32 sd_status;
+
+	sd_status = sd_ctrl_read32(host, CTL_SD_STATUS);
+	if (min_uV >= 1700000 && max_uV <= 1950000) {
+		sd_status |= SD_STATUS_IOVS;
+		*selector = 1;
+	} else {
+		sd_status &= ~SD_STATUS_IOVS;
+		*selector = 0;
+	}
+	sd_ctrl_write32(host, CTL_SD_STATUS, sd_status);
+
+	return 0;
+}
+
+static int renesas_sdhi_regulator_list_voltage(struct regulator_dev *rdev,
+					       unsigned int selector)
+{
+	if (selector >= ARRAY_SIZE(renesas_sdhi_vqmmc_voltages))
+		return -EINVAL;
+
+	return renesas_sdhi_vqmmc_voltages[selector];
+}
+
+static const struct regulator_ops renesas_sdhi_regulator_voltage_ops = {
+	.enable = renesas_sdhi_regulator_enable,
+	.disable = renesas_sdhi_regulator_disable,
+	.is_enabled = renesas_sdhi_regulator_is_enabled,
+	.list_voltage = renesas_sdhi_regulator_list_voltage,
+	.get_voltage = renesas_sdhi_regulator_get_voltage,
+	.set_voltage = renesas_sdhi_regulator_set_voltage,
+};
+
+static const struct regulator_desc renesas_sdhi_vqmmc_regulator = {
+	.name = "sdhi-vqmmc-regulator",
+	.of_match = of_match_ptr("vqmmc-regulator"),
+	.type = REGULATOR_VOLTAGE,
+	.owner = THIS_MODULE,
+	.ops = &renesas_sdhi_regulator_voltage_ops,
+	.volt_table = renesas_sdhi_vqmmc_voltages,
+	.n_voltages = ARRAY_SIZE(renesas_sdhi_vqmmc_voltages),
+};
+
 int renesas_sdhi_probe(struct platform_device *pdev,
 		       const struct tmio_mmc_dma_ops *dma_ops,
 		       const struct renesas_sdhi_of_data *of_data,
@@ -911,7 +1021,10 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 {
 	struct tmio_mmc_data *mmd = pdev->dev.platform_data;
 	struct tmio_mmc_data *mmc_data;
+	struct regulator_config rcfg = { .dev = &pdev->dev, };
+	struct regulator_dev *rdev;
 	struct renesas_sdhi_dma *dma_priv;
+	struct device *dev = &pdev->dev;
 	struct tmio_mmc_host *host;
 	struct renesas_sdhi *priv;
 	int num_irqs, irq, ret, i;
@@ -1053,6 +1166,24 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 	if (ret)
 		goto efree;
 
+	rcfg.of_node = of_get_child_by_name(dev->of_node, "vqmmc-regulator");
+	if (!of_device_is_available(rcfg.of_node)) {
+		of_node_put(rcfg.of_node);
+		rcfg.of_node = NULL;
+	}
+
+	if (rcfg.of_node) {
+		rcfg.driver_data = priv->host;
+		rdev = devm_regulator_register(dev, &renesas_sdhi_vqmmc_regulator, &rcfg);
+		of_node_put(rcfg.of_node);
+		if (IS_ERR(rdev)) {
+			dev_err(dev, "regulator register failed err=%ld", PTR_ERR(rdev));
+			ret = PTR_ERR(rdev);
+			goto edisclk;
+		}
+		priv->rdev = rdev;
+	}
+
 	ver = sd_ctrl_read16(host, CTL_VERSION);
 	/* GEN2_SDR104 is first known SDHI to use 32bit block count */
 	if (ver < SDHI_VER_GEN2_SDR104 && mmc_data->max_blk_count > U16_MAX)
diff --git a/drivers/mmc/host/tmio_mmc.h b/drivers/mmc/host/tmio_mmc.h
index a75755f31d31..41787ea77a13 100644
--- a/drivers/mmc/host/tmio_mmc.h
+++ b/drivers/mmc/host/tmio_mmc.h
@@ -44,6 +44,7 @@
 #define CTL_RESET_SD 0xe0
 #define CTL_VERSION 0xe2
 #define CTL_SDIF_MODE 0xe6 /* only known on R-Car 2+ */
+#define CTL_SD_STATUS 0xf2 /* only known on RZ/{G2L,G3E,V2H} */
 
 /* Definitions for values the CTL_STOP_INTERNAL_ACTION register can take */
 #define TMIO_STOP_STP		BIT(0)
@@ -103,6 +104,10 @@
 /* Definitions for values the CTL_SDIF_MODE register can take */
 #define SDIF_MODE_HS400		BIT(0) /* only known on R-Car 2+ */
 
+/* Definitions for values the CTL_SD_STATUS register can take */
+#define SD_STATUS_PWEN		BIT(0) /* only known on RZ/{G3E,V2H} */
+#define SD_STATUS_IOVS		BIT(16) /* only known on RZ/{G3E,V2H} */
+
 /* Define some IRQ masks */
 /* This is the mask used at reset by the chip */
 #define TMIO_MASK_ALL           0x837f031d
@@ -226,6 +231,11 @@ static inline u32 sd_ctrl_read16_and_16_as_32(struct tmio_mmc_host *host,
 	       ioread16(host->ctl + ((addr + 2) << host->bus_shift)) << 16;
 }
 
+static inline u32 sd_ctrl_read32(struct tmio_mmc_host *host, int addr)
+{
+	return ioread32(host->ctl + (addr << host->bus_shift));
+}
+
 static inline void sd_ctrl_read32_rep(struct tmio_mmc_host *host, int addr,
 				      u32 *buf, int count)
 {
-- 
2.43.0



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

* [PATCH 6.12.y-cip 05/10] mmc: renesas_sdhi: Use of_get_available_child_by_name()
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (3 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 04/10] mmc: renesas_sdhi: Add support for RZ/G3E SoC Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 06/10] arm64: dts: renesas: r9a09g047: Add SDHI0-SDHI2 nodes Tommaso Merciai
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 18da3ecdbaf6f140eb45818fd848b85d2c414db6 upstream.

Use the helper of_get_available_child_by_name() to simplify
renesas_sdhi_probe().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/r/20250407092144.35268-1-biju.das.jz@bp.renesas.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 drivers/mmc/host/renesas_sdhi_core.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c
index 8c83e203c516..862c279be4b3 100644
--- a/drivers/mmc/host/renesas_sdhi_core.c
+++ b/drivers/mmc/host/renesas_sdhi_core.c
@@ -1166,12 +1166,7 @@ int renesas_sdhi_probe(struct platform_device *pdev,
 	if (ret)
 		goto efree;
 
-	rcfg.of_node = of_get_child_by_name(dev->of_node, "vqmmc-regulator");
-	if (!of_device_is_available(rcfg.of_node)) {
-		of_node_put(rcfg.of_node);
-		rcfg.of_node = NULL;
-	}
-
+	rcfg.of_node = of_get_available_child_by_name(dev->of_node, "vqmmc-regulator");
 	if (rcfg.of_node) {
 		rcfg.driver_data = priv->host;
 		rdev = devm_regulator_register(dev, &renesas_sdhi_vqmmc_regulator, &rcfg);
-- 
2.43.0



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

* [PATCH 6.12.y-cip 06/10] arm64: dts: renesas: r9a09g047: Add SDHI0-SDHI2 nodes
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (4 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 05/10] mmc: renesas_sdhi: Use of_get_available_child_by_name() Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 07/10] arm64: dts: renesas: r9a09g057: Add support for enabling SDHI internal regulator Tommaso Merciai
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit c4e4e22870acae3a3fe3fe0638f85175976dc906 upstream.

Add SDHI0-SDHI2 nodes to RZ/G3E ("R9A09G047") SoC DTSI.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/20250206134047.67866-5-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 60 ++++++++++++++++++++++
 1 file changed, 60 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
index 133aa3272d3a..928757b52b4a 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
@@ -403,6 +403,66 @@ gic: interrupt-controller@14900000 {
 			interrupt-controller;
 			interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_LOW>;
 		};
+
+		sdhi0: mmc@15c00000  {
+			compatible = "renesas,sdhi-r9a09g047", "renesas,sdhi-r9a09g057";
+			reg = <0x0 0x15c00000 0 0x10000>;
+			interrupts = <GIC_SPI 735 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 736 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 0xa3>, <&cpg CPG_MOD 0xa5>,
+				 <&cpg CPG_MOD 0xa4>, <&cpg CPG_MOD 0xa6>;
+			clock-names = "core", "clkh", "cd", "aclk";
+			resets = <&cpg 0xa7>;
+			power-domains = <&cpg>;
+			status = "disabled";
+
+			sdhi0_vqmmc: vqmmc-regulator {
+				regulator-name = "SDHI0-VQMMC";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				status = "disabled";
+			};
+		};
+
+		sdhi1: mmc@15c10000 {
+			compatible = "renesas,sdhi-r9a09g047", "renesas,sdhi-r9a09g057";
+			reg = <0x0 0x15c10000 0 0x10000>;
+			interrupts = <GIC_SPI 737 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 738 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 0xa7>, <&cpg CPG_MOD 0xa9>,
+				 <&cpg CPG_MOD 0xa8>, <&cpg CPG_MOD 0xaa>;
+			clock-names = "core", "clkh", "cd", "aclk";
+			resets = <&cpg 0xa8>;
+			power-domains = <&cpg>;
+			status = "disabled";
+
+			sdhi1_vqmmc: vqmmc-regulator {
+				regulator-name = "SDHI1-VQMMC";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				status = "disabled";
+			};
+		};
+
+		sdhi2: mmc@15c20000 {
+			compatible = "renesas,sdhi-r9a09g047", "renesas,sdhi-r9a09g057";
+			reg = <0x0 0x15c20000 0 0x10000>;
+			interrupts = <GIC_SPI 739 IRQ_TYPE_LEVEL_HIGH>,
+				     <GIC_SPI 740 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&cpg CPG_MOD 0xab>, <&cpg CPG_MOD 0xad>,
+				 <&cpg CPG_MOD 0xac>, <&cpg CPG_MOD 0xae>;
+			clock-names = "core", "clkh", "cd", "aclk";
+			resets = <&cpg 0xa9>;
+			power-domains = <&cpg>;
+			status = "disabled";
+
+			sdhi2_vqmmc: vqmmc-regulator {
+				regulator-name = "SDHI2-VQMMC";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				status = "disabled";
+			};
+		};
 	};
 
 	timer {
-- 
2.43.0



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

* [PATCH 6.12.y-cip 07/10] arm64: dts: renesas: r9a09g057: Add support for enabling SDHI internal regulator
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (5 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 06/10] arm64: dts: renesas: r9a09g047: Add SDHI0-SDHI2 nodes Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2} Tommaso Merciai
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 674080a22768dd4c30f2272acbe03fe94c7387cf upstream.

Add support for enabling SDHI internal regulator, by overriding the
status on the board DTS, when needed.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Link: https://lore.kernel.org/20250206134047.67866-6-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 arch/arm64/boot/dts/renesas/r9a09g057.dtsi | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g057.dtsi b/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
index 3a433f1e940c..0f8a769f1cbc 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g057.dtsi
@@ -512,6 +512,13 @@ sdhi0: mmc@15c00000  {
 			resets = <&cpg 0xa7>;
 			power-domains = <&cpg>;
 			status = "disabled";
+
+			sdhi0_vqmmc: vqmmc-regulator {
+				regulator-name = "SDHI0-VQMMC";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				status = "disabled";
+			};
 		};
 
 		sdhi1: mmc@15c10000 {
@@ -525,6 +532,13 @@ sdhi1: mmc@15c10000 {
 			resets = <&cpg 0xa8>;
 			power-domains = <&cpg>;
 			status = "disabled";
+
+			sdhi1_vqmmc: vqmmc-regulator {
+				regulator-name = "SDHI1-VQMMC";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				status = "disabled";
+			};
 		};
 
 		sdhi2: mmc@15c20000 {
@@ -538,6 +552,13 @@ sdhi2: mmc@15c20000 {
 			resets = <&cpg 0xa9>;
 			power-domains = <&cpg>;
 			status = "disabled";
+
+			sdhi2_vqmmc: vqmmc-regulator {
+				regulator-name = "SDHI2-VQMMC";
+				regulator-min-microvolt = <1800000>;
+				regulator-max-microvolt = <3300000>;
+				status = "disabled";
+			};
 		};
 	};
 
-- 
2.43.0



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

* [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (6 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 07/10] arm64: dts: renesas: r9a09g057: Add support for enabling SDHI internal regulator Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 23:25   ` nobuhiro1.iwamatsu
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 09/10] arm64: dts: renesas: rzg3e-smarc-som: Add support to enable SD on SDHI0 Tommaso Merciai
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 16bce534a391487c56aa266dff2ac5733b207f5c upstream.

Enable eMMC on SDHI0 and SD on SDHI2 on RZ/G3E SMARC SoM.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250206134047.67866-7-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 .../boot/dts/renesas/rzg3e-smarc-som.dtsi     | 100 ++++++++++++++++++
 1 file changed, 100 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
index f4ba050beb0d..fcbabe2cb003 100644
--- a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
@@ -8,17 +8,86 @@
 / {
 	compatible = "renesas,rzg3e-smarcm", "renesas,r9a09g047e57", "renesas,r9a09g047";
 
+	aliases {
+		mmc0 = &sdhi0;
+		mmc2 = &sdhi2;
+	};
+
 	memory@48000000 {
 		device_type = "memory";
 		/* First 128MB is reserved for secure area. */
 		reg = <0x0 0x48000000 0x0 0xf8000000>;
 	};
+
+	reg_1p8v: regulator-1p8v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator-3p3v {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
 };
 
 &audio_extal_clk {
 	clock-frequency = <48000000>;
 };
 
+&pinctrl {
+	sdhi0_emmc_pins: sd0-emmc {
+		sd0-ctrl {
+			pins = "SD0CLK", "SD0CMD";
+			renesas,output-impedance = <3>;
+		};
+
+		sd0-data {
+			pins = "SD0DAT0", "SD0DAT1", "SD0DAT2", "SD0DAT3",
+			       "SD0DAT4", "SD0DAT5", "SD0DAT6", "SD0DAT7";
+			renesas,output-impedance = <3>;
+		};
+
+		sd0-rst {
+			pins = "SD0RSTN";
+			renesas,output-impedance = <3>;
+		};
+	};
+
+	sdhi2_pins: sd2 {
+		sd2-cd {
+			pinmux = <RZG3E_PORT_PINMUX(K, 0, 1)>; /* SD2CD */
+		};
+
+		sd2-ctrl {
+			pinmux = <RZG3E_PORT_PINMUX(H, 0, 1)>, /* SD2CLK */
+				 <RZG3E_PORT_PINMUX(H, 1, 1)>; /* SD2CMD */
+		};
+
+		sd2-data {
+			pinmux = <RZG3E_PORT_PINMUX(H, 2, 1)>, /* SD2DAT0 */
+				 <RZG3E_PORT_PINMUX(H, 3, 1)>, /* SD2DAT1 */
+				 <RZG3E_PORT_PINMUX(H, 4, 1)>, /* SD2DAT2 */
+				 <RZG3E_PORT_PINMUX(H, 5, 1)>; /* SD2DAT3 */
+		};
+
+		sd2-iovs {
+			pinmux = <RZG3E_PORT_PINMUX(K, 1, 1)>; /* SD2IOVS */
+		};
+
+		sd2-pwen {
+			pinmux = <RZG3E_PORT_PINMUX(K, 2, 1)>; /* SD2PWEN */
+		};
+	};
+};
+
 &qextal_clk {
 	clock-frequency = <24000000>;
 };
@@ -27,6 +96,37 @@ &rtxin_clk {
 	clock-frequency = <32768>;
 };
 
+&sdhi0 {
+	pinctrl-0 = <&sdhi0_emmc_pins>;
+	pinctrl-1 = <&sdhi0_emmc_pins>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&reg_1p8v>;
+	bus-width = <8>;
+	mmc-hs200-1_8v;
+	non-removable;
+	fixed-emmc-driver-type = <1>;
+	status = "okay";
+};
+
+&sdhi2 {
+	pinctrl-0 = <&sdhi2_pins>;
+	pinctrl-1 = <&sdhi2_pins>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&sdhi2_vqmmc>;
+	bus-width = <4>;
+	sd-uhs-sdr50;
+	sd-uhs-sdr104;
+	status = "okay";
+};
+
+&sdhi2_vqmmc {
+	status = "okay";
+};
+
 &wdt1 {
 	status = "okay";
 };
-- 
2.43.0



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

* [PATCH 6.12.y-cip 09/10] arm64: dts: renesas: rzg3e-smarc-som: Add support to enable SD on SDHI0
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (7 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2} Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 10/10] arm64: dts: renesas: r9a09g047e57-smarc: Enable SDHI1 Tommaso Merciai
  2025-06-24  7:18 ` [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI nobuhiro1.iwamatsu
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit 4c85281bed1732693f2f2e32cf60e0e30722d06e upstream.

Add support for enabling SD on SDHI0 on RZ/G3E SMARC SoM. It is enabled
by setting the macro SW_SD0_DEV_SEL to 1 in board DTS and setting the
switch SYS.1 to ON position on the SoM.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250206134047.67866-8-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 .../boot/dts/renesas/r9a09g047e57-smarc.dts   |  3 ++
 .../boot/dts/renesas/rzg3e-smarc-som.dtsi     | 54 +++++++++++++++++++
 2 files changed, 57 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
index c063d47e2952..152a00aa354b 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
+++ b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
@@ -7,6 +7,9 @@
 
 /dts-v1/;
 
+/* Switch selection settings */
+#define SW_SD0_DEV_SEL		0
+
 #include <dt-bindings/pinctrl/renesas,r9a09g047-pinctrl.h>
 #include "r9a09g047e57.dtsi"
 #include "rzg3e-smarc-som.dtsi"
diff --git a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
index fcbabe2cb003..72b42a81bcf3 100644
--- a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
@@ -5,6 +5,15 @@
  * Copyright (C) 2024 Renesas Electronics Corp.
  */
 
+/*
+ * Please set the switch position SYS.1 on the SoM and the corresponding macro
+ * SW_SD0_DEV_SEL on the board DTS:
+ *
+ * SW_SD0_DEV_SEL:
+ *      0 - SD0 is connected to eMMC (default)
+ *      1 - SD0 is connected to uSD0 card
+ */
+
 / {
 	compatible = "renesas,rzg3e-smarcm", "renesas,r9a09g047e57", "renesas,r9a09g047";
 
@@ -61,6 +70,32 @@ sd0-rst {
 		};
 	};
 
+	sdhi0_usd_pins: sd0-usd {
+		sd0-cd {
+			pinmux = <RZG3E_PORT_PINMUX(5, 0, 8)>;
+		};
+
+		sd0-ctrl {
+			pins = "SD0CLK", "SD0CMD";
+			renesas,output-impedance = <3>;
+		};
+
+		sd0-data {
+			pins = "SD0DAT0", "SD0DAT1", "SD0DAT2", "SD0DAT3";
+			renesas,output-impedance = <3>;
+		};
+
+		sd0-iovs {
+			pins = "SD0IOVS";
+			renesas,output-impedance = <3>;
+		};
+
+		sd0-pwen {
+			pins = "SD0PWEN";
+			renesas,output-impedance = <3>;
+		};
+	};
+
 	sdhi2_pins: sd2 {
 		sd2-cd {
 			pinmux = <RZG3E_PORT_PINMUX(K, 0, 1)>; /* SD2CD */
@@ -96,6 +131,24 @@ &rtxin_clk {
 	clock-frequency = <32768>;
 };
 
+#if (SW_SD0_DEV_SEL)
+&sdhi0 {
+	pinctrl-0 = <&sdhi0_usd_pins>;
+	pinctrl-1 = <&sdhi0_usd_pins>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&sdhi0_vqmmc>;
+	bus-width = <4>;
+	sd-uhs-sdr50;
+	sd-uhs-sdr104;
+	status = "okay";
+};
+
+&sdhi0_vqmmc {
+	status = "okay";
+};
+#else
 &sdhi0 {
 	pinctrl-0 = <&sdhi0_emmc_pins>;
 	pinctrl-1 = <&sdhi0_emmc_pins>;
@@ -109,6 +162,7 @@ &sdhi0 {
 	fixed-emmc-driver-type = <1>;
 	status = "okay";
 };
+#endif
 
 &sdhi2 {
 	pinctrl-0 = <&sdhi2_pins>;
-- 
2.43.0



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

* [PATCH 6.12.y-cip 10/10] arm64: dts: renesas: r9a09g047e57-smarc: Enable SDHI1
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (8 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 09/10] arm64: dts: renesas: rzg3e-smarc-som: Add support to enable SD on SDHI0 Tommaso Merciai
@ 2025-06-23 14:48 ` Tommaso Merciai
  2025-06-24  7:18 ` [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI nobuhiro1.iwamatsu
  10 siblings, 0 replies; 15+ messages in thread
From: Tommaso Merciai @ 2025-06-23 14:48 UTC (permalink / raw)
  To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
  Cc: Biju Das, Lad Prabhakar, tomm.merciai

From: Biju Das <biju.das.jz@bp.renesas.com>

commit ae9edcbc712249832beb3f5457cb03cc809f72c4 upstream.

Enable SDHI1 on the RZ/G3E SMARC EVK platform using gpio regulator for
voltage switching.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://lore.kernel.org/20250206134047.67866-9-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 .../boot/dts/renesas/r9a09g047e57-smarc.dts   | 46 +++++++++++++++++++
 .../boot/dts/renesas/renesas-smarc2.dtsi      | 18 ++++++++
 2 files changed, 64 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
index 152a00aa354b..5d7983812c70 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
+++ b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
@@ -9,7 +9,9 @@
 
 /* Switch selection settings */
 #define SW_SD0_DEV_SEL		0
+#define SW_SDIO_M2E		0
 
+#include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/renesas,r9a09g047-pinctrl.h>
 #include "r9a09g047e57.dtsi"
 #include "rzg3e-smarc-som.dtsi"
@@ -19,6 +21,16 @@ / {
 	model = "Renesas SMARC EVK version 2 based on r9a09g047e57";
 	compatible = "renesas,smarc2-evk", "renesas,rzg3e-smarcm",
 		     "renesas,r9a09g047e57", "renesas,r9a09g047";
+
+	vqmmc_sd1_pvdd: regulator-vqmmc-sd1-pvdd {
+		compatible = "regulator-gpio";
+		regulator-name = "SD1_PVDD";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+		gpios = <&pinctrl RZG3E_GPIO(1, 5) GPIO_ACTIVE_HIGH>;
+		gpios-states = <0>;
+		states = <3300000 0>, <1800000 1>;
+	};
 };
 
 &pinctrl {
@@ -26,9 +38,43 @@ scif_pins: scif {
 		pins = "SCIF_TXD", "SCIF_RXD";
 		renesas,output-impedance = <1>;
 	};
+
+	sd1-pwr-en-hog {
+		gpio-hog;
+		gpios = <RZG3E_GPIO(1, 6) GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "sd1_pwr_en";
+	};
+
+	sdhi1_pins: sd1 {
+		sd1-cd {
+			pinmux = <RZG3E_PORT_PINMUX(1, 4, 8)>; /* SD1CD */
+		};
+
+		sd1-ctrl {
+			pinmux = <RZG3E_PORT_PINMUX(G, 0, 1)>, /* SD1CLK */
+				 <RZG3E_PORT_PINMUX(G, 1, 1)>; /* SD1CMD */
+		};
+
+		sd1-data {
+			pinmux = <RZG3E_PORT_PINMUX(G, 2, 1)>, /* SD1DAT0 */
+				 <RZG3E_PORT_PINMUX(G, 3, 1)>, /* SD1DAT1 */
+				 <RZG3E_PORT_PINMUX(G, 4, 1)>, /* SD1DAT2 */
+				 <RZG3E_PORT_PINMUX(G, 5, 1)>; /* SD1DAT3 */
+		};
+	};
 };
 
 &scif0 {
 	pinctrl-0 = <&scif_pins>;
 	pinctrl-names = "default";
 };
+
+&sdhi1 {
+	pinctrl-0 = <&sdhi1_pins>;
+	pinctrl-1 = <&sdhi1_pins>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&vqmmc_sd1_pvdd>;
+};
diff --git a/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi b/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
index e378d55e6e9b..fd82df8adc1e 100644
--- a/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
+++ b/arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
@@ -5,6 +5,15 @@
  * Copyright (C) 2024 Renesas Electronics Corp.
  */
 
+/*
+ * Please set the switch position SW_OPT_MUX.1 on the carrier board and the
+ * corresponding macro SW_SDIO_M2E on the board DTS:
+ *
+ * SW_SDIO_M2E:
+ *     0 - SMARC SDIO signal is connected to uSD1
+ *     1 - SMARC SDIO signal is connected to M.2 Key E connector
+ */
+
 / {
 	model = "Renesas RZ SMARC Carrier-II Board";
 	compatible = "renesas,smarc2-evk";
@@ -16,9 +25,18 @@ chosen {
 
 	aliases {
 		serial3 = &scif0;
+		mmc1 = &sdhi1;
 	};
 };
 
 &scif0 {
 	status = "okay";
 };
+
+&sdhi1 {
+	bus-width = <4>;
+	sd-uhs-sdr50;
+	sd-uhs-sdr104;
+
+	status = "okay";
+};
-- 
2.43.0



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

* RE: [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2} Tommaso Merciai
@ 2025-06-23 23:25   ` nobuhiro1.iwamatsu
  2025-06-23 23:30     ` nobuhiro1.iwamatsu
  0 siblings, 1 reply; 15+ messages in thread
From: nobuhiro1.iwamatsu @ 2025-06-23 23:25 UTC (permalink / raw)
  To: tommaso.merciai.xr, cip-dev, pavel
  Cc: biju.das.jz, prabhakar.mahadev-lad.rj, tomm.merciai

Hi Tommaso,

This patch cannot be applied in my environment.
Could you please check it again in your environment?

```
Applying: arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
error: patch failed: arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi:27
error: arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi: patch does not apply
Patch failed at 0008 arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
hint: Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
```

Best regards,
  Nobuhiro

> -----Original Message-----
> From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> Sent: Monday, June 23, 2025 11:48 PM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □DITC○
> CPT) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com>; tomm.merciai@gmail.com
> Subject: [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som:
> Enable SDHI{0,2}
> 
> From: Biju Das <biju.das.jz@bp.renesas.com>
> 
> commit 16bce534a391487c56aa266dff2ac5733b207f5c upstream.
> 
> Enable eMMC on SDHI0 and SD on SDHI2 on RZ/G3E SMARC SoM.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Link:
> https://lore.kernel.org/20250206134047.67866-7-biju.das.jz@bp.renesas.com
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> ---
>  .../boot/dts/renesas/rzg3e-smarc-som.dtsi     | 100
> ++++++++++++++++++
>  1 file changed, 100 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> index f4ba050beb0d..fcbabe2cb003 100644
> --- a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> +++ b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> @@ -8,17 +8,86 @@
>  / {
>  	compatible = "renesas,rzg3e-smarcm", "renesas,r9a09g047e57",
> "renesas,r9a09g047";
> 
> +	aliases {
> +		mmc0 = &sdhi0;
> +		mmc2 = &sdhi2;
> +	};
> +
>  	memory@48000000 {
>  		device_type = "memory";
>  		/* First 128MB is reserved for secure area. */
>  		reg = <0x0 0x48000000 0x0 0xf8000000>;
>  	};
> +
> +	reg_1p8v: regulator-1p8v {
> +		compatible = "regulator-fixed";
> +		regulator-name = "fixed-1.8V";
> +		regulator-min-microvolt = <1800000>;
> +		regulator-max-microvolt = <1800000>;
> +		regulator-boot-on;
> +		regulator-always-on;
> +	};
> +
> +	reg_3p3v: regulator-3p3v {
> +		compatible = "regulator-fixed";
> +		regulator-name = "fixed-3.3V";
> +		regulator-min-microvolt = <3300000>;
> +		regulator-max-microvolt = <3300000>;
> +		regulator-boot-on;
> +		regulator-always-on;
> +	};
>  };
> 
>  &audio_extal_clk {
>  	clock-frequency = <48000000>;
>  };
> 
> +&pinctrl {
> +	sdhi0_emmc_pins: sd0-emmc {
> +		sd0-ctrl {
> +			pins = "SD0CLK", "SD0CMD";
> +			renesas,output-impedance = <3>;
> +		};
> +
> +		sd0-data {
> +			pins = "SD0DAT0", "SD0DAT1", "SD0DAT2",
> "SD0DAT3",
> +			       "SD0DAT4", "SD0DAT5", "SD0DAT6",
> "SD0DAT7";
> +			renesas,output-impedance = <3>;
> +		};
> +
> +		sd0-rst {
> +			pins = "SD0RSTN";
> +			renesas,output-impedance = <3>;
> +		};
> +	};
> +
> +	sdhi2_pins: sd2 {
> +		sd2-cd {
> +			pinmux = <RZG3E_PORT_PINMUX(K, 0, 1)>; /*
> SD2CD */
> +		};
> +
> +		sd2-ctrl {
> +			pinmux = <RZG3E_PORT_PINMUX(H, 0, 1)>, /*
> SD2CLK */
> +				 <RZG3E_PORT_PINMUX(H, 1, 1)>; /*
> SD2CMD */
> +		};
> +
> +		sd2-data {
> +			pinmux = <RZG3E_PORT_PINMUX(H, 2, 1)>, /*
> SD2DAT0 */
> +				 <RZG3E_PORT_PINMUX(H, 3, 1)>, /*
> SD2DAT1 */
> +				 <RZG3E_PORT_PINMUX(H, 4, 1)>, /*
> SD2DAT2 */
> +				 <RZG3E_PORT_PINMUX(H, 5, 1)>; /*
> SD2DAT3 */
> +		};
> +
> +		sd2-iovs {
> +			pinmux = <RZG3E_PORT_PINMUX(K, 1, 1)>; /*
> SD2IOVS */
> +		};
> +
> +		sd2-pwen {
> +			pinmux = <RZG3E_PORT_PINMUX(K, 2, 1)>; /*
> SD2PWEN */
> +		};
> +	};
> +};
> +
>  &qextal_clk {
>  	clock-frequency = <24000000>;
>  };
> @@ -27,6 +96,37 @@ &rtxin_clk {
>  	clock-frequency = <32768>;
>  };
> 
> +&sdhi0 {
> +	pinctrl-0 = <&sdhi0_emmc_pins>;
> +	pinctrl-1 = <&sdhi0_emmc_pins>;
> +	pinctrl-names = "default", "state_uhs";
> +
> +	vmmc-supply = <&reg_3p3v>;
> +	vqmmc-supply = <&reg_1p8v>;
> +	bus-width = <8>;
> +	mmc-hs200-1_8v;
> +	non-removable;
> +	fixed-emmc-driver-type = <1>;
> +	status = "okay";
> +};
> +
> +&sdhi2 {
> +	pinctrl-0 = <&sdhi2_pins>;
> +	pinctrl-1 = <&sdhi2_pins>;
> +	pinctrl-names = "default", "state_uhs";
> +
> +	vmmc-supply = <&reg_3p3v>;
> +	vqmmc-supply = <&sdhi2_vqmmc>;
> +	bus-width = <4>;
> +	sd-uhs-sdr50;
> +	sd-uhs-sdr104;
> +	status = "okay";
> +};
> +
> +&sdhi2_vqmmc {
> +	status = "okay";
> +};
> +
>  &wdt1 {
>  	status = "okay";
>  };
> --
> 2.43.0



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

* RE: [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
  2025-06-23 23:25   ` nobuhiro1.iwamatsu
@ 2025-06-23 23:30     ` nobuhiro1.iwamatsu
  0 siblings, 0 replies; 15+ messages in thread
From: nobuhiro1.iwamatsu @ 2025-06-23 23:30 UTC (permalink / raw)
  To: tommaso.merciai.xr, cip-dev, pavel
  Cc: biju.das.jz, prabhakar.mahadev-lad.rj, tomm.merciai

Hi Tommaso,

> This patch cannot be applied in my environment.
> Could you please check it again in your environment?
>

I did not apply ' Add support for RZ/G3E WDT' series.
Sorry for the trouble.

Best regards,
  Nobuhiro

> -----Original Message-----
> From: iwamatsu nobuhiro(岩松 信洋 □DITC○CPT)
> Sent: Tuesday, June 24, 2025 8:26 AM
> To: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>;
> cip-dev@lists.cip-project.org; Pavel Machek <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com>; tomm.merciai@gmail.com
> Subject: RE: [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som:
> Enable SDHI{0,2}
> 
> Hi Tommaso,
> 
> This patch cannot be applied in my environment.
> Could you please check it again in your environment?
> 
> ```
> Applying: arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
> error: patch failed: arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi:27
> error: arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi: patch does not
> apply Patch failed at 0008 arm64: dts: renesas: rzg3e-smarc-som: Enable
> SDHI{0,2}
> hint: Use 'git am --show-current-patch' to see the failed patch When you have
> resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".
> ```
> 
> Best regards,
>   Nobuhiro
> 
> > -----Original Message-----
> > From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > Sent: Monday, June 23, 2025 11:48 PM
> > To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □DITC○
> > CPT) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> > Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lad Prabhakar
> > <prabhakar.mahadev-lad.rj@bp.renesas.com>; tomm.merciai@gmail.com
> > Subject: [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som:
> > Enable SDHI{0,2}
> >
> > From: Biju Das <biju.das.jz@bp.renesas.com>
> >
> > commit 16bce534a391487c56aa266dff2ac5733b207f5c upstream.
> >
> > Enable eMMC on SDHI0 and SD on SDHI2 on RZ/G3E SMARC SoM.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Link:
> > https://lore.kernel.org/20250206134047.67866-7-biju.das.jz@bp.renesas.
> > com
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> > ---
> >  .../boot/dts/renesas/rzg3e-smarc-som.dtsi     | 100
> > ++++++++++++++++++
> >  1 file changed, 100 insertions(+)
> >
> > diff --git a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> > b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> > index f4ba050beb0d..fcbabe2cb003 100644
> > --- a/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
> > @@ -8,17 +8,86 @@
> >  / {
> >  	compatible = "renesas,rzg3e-smarcm", "renesas,r9a09g047e57",
> > "renesas,r9a09g047";
> >
> > +	aliases {
> > +		mmc0 = &sdhi0;
> > +		mmc2 = &sdhi2;
> > +	};
> > +
> >  	memory@48000000 {
> >  		device_type = "memory";
> >  		/* First 128MB is reserved for secure area. */
> >  		reg = <0x0 0x48000000 0x0 0xf8000000>;
> >  	};
> > +
> > +	reg_1p8v: regulator-1p8v {
> > +		compatible = "regulator-fixed";
> > +		regulator-name = "fixed-1.8V";
> > +		regulator-min-microvolt = <1800000>;
> > +		regulator-max-microvolt = <1800000>;
> > +		regulator-boot-on;
> > +		regulator-always-on;
> > +	};
> > +
> > +	reg_3p3v: regulator-3p3v {
> > +		compatible = "regulator-fixed";
> > +		regulator-name = "fixed-3.3V";
> > +		regulator-min-microvolt = <3300000>;
> > +		regulator-max-microvolt = <3300000>;
> > +		regulator-boot-on;
> > +		regulator-always-on;
> > +	};
> >  };
> >
> >  &audio_extal_clk {
> >  	clock-frequency = <48000000>;
> >  };
> >
> > +&pinctrl {
> > +	sdhi0_emmc_pins: sd0-emmc {
> > +		sd0-ctrl {
> > +			pins = "SD0CLK", "SD0CMD";
> > +			renesas,output-impedance = <3>;
> > +		};
> > +
> > +		sd0-data {
> > +			pins = "SD0DAT0", "SD0DAT1", "SD0DAT2",
> > "SD0DAT3",
> > +			       "SD0DAT4", "SD0DAT5", "SD0DAT6",
> > "SD0DAT7";
> > +			renesas,output-impedance = <3>;
> > +		};
> > +
> > +		sd0-rst {
> > +			pins = "SD0RSTN";
> > +			renesas,output-impedance = <3>;
> > +		};
> > +	};
> > +
> > +	sdhi2_pins: sd2 {
> > +		sd2-cd {
> > +			pinmux = <RZG3E_PORT_PINMUX(K, 0, 1)>; /*
> > SD2CD */
> > +		};
> > +
> > +		sd2-ctrl {
> > +			pinmux = <RZG3E_PORT_PINMUX(H, 0, 1)>, /*
> > SD2CLK */
> > +				 <RZG3E_PORT_PINMUX(H, 1, 1)>; /*
> > SD2CMD */
> > +		};
> > +
> > +		sd2-data {
> > +			pinmux = <RZG3E_PORT_PINMUX(H, 2, 1)>, /*
> > SD2DAT0 */
> > +				 <RZG3E_PORT_PINMUX(H, 3, 1)>, /*
> > SD2DAT1 */
> > +				 <RZG3E_PORT_PINMUX(H, 4, 1)>, /*
> > SD2DAT2 */
> > +				 <RZG3E_PORT_PINMUX(H, 5, 1)>; /*
> > SD2DAT3 */
> > +		};
> > +
> > +		sd2-iovs {
> > +			pinmux = <RZG3E_PORT_PINMUX(K, 1, 1)>; /*
> > SD2IOVS */
> > +		};
> > +
> > +		sd2-pwen {
> > +			pinmux = <RZG3E_PORT_PINMUX(K, 2, 1)>; /*
> > SD2PWEN */
> > +		};
> > +	};
> > +};
> > +
> >  &qextal_clk {
> >  	clock-frequency = <24000000>;
> >  };
> > @@ -27,6 +96,37 @@ &rtxin_clk {
> >  	clock-frequency = <32768>;
> >  };
> >
> > +&sdhi0 {
> > +	pinctrl-0 = <&sdhi0_emmc_pins>;
> > +	pinctrl-1 = <&sdhi0_emmc_pins>;
> > +	pinctrl-names = "default", "state_uhs";
> > +
> > +	vmmc-supply = <&reg_3p3v>;
> > +	vqmmc-supply = <&reg_1p8v>;
> > +	bus-width = <8>;
> > +	mmc-hs200-1_8v;
> > +	non-removable;
> > +	fixed-emmc-driver-type = <1>;
> > +	status = "okay";
> > +};
> > +
> > +&sdhi2 {
> > +	pinctrl-0 = <&sdhi2_pins>;
> > +	pinctrl-1 = <&sdhi2_pins>;
> > +	pinctrl-names = "default", "state_uhs";
> > +
> > +	vmmc-supply = <&reg_3p3v>;
> > +	vqmmc-supply = <&sdhi2_vqmmc>;
> > +	bus-width = <4>;
> > +	sd-uhs-sdr50;
> > +	sd-uhs-sdr104;
> > +	status = "okay";
> > +};
> > +
> > +&sdhi2_vqmmc {
> > +	status = "okay";
> > +};
> > +
> >  &wdt1 {
> >  	status = "okay";
> >  };
> > --
> > 2.43.0



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

* RE: [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI
  2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
                   ` (9 preceding siblings ...)
  2025-06-23 14:48 ` [PATCH 6.12.y-cip 10/10] arm64: dts: renesas: r9a09g047e57-smarc: Enable SDHI1 Tommaso Merciai
@ 2025-06-24  7:18 ` nobuhiro1.iwamatsu
  2025-06-24  9:04   ` Pavel Machek
  10 siblings, 1 reply; 15+ messages in thread
From: nobuhiro1.iwamatsu @ 2025-06-24  7:18 UTC (permalink / raw)
  To: tommaso.merciai.xr, cip-dev, pavel
  Cc: biju.das.jz, prabhakar.mahadev-lad.rj, tomm.merciai

Hi all,

> -----Original Message-----
> From: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
> Sent: Monday, June 23, 2025 11:48 PM
> To: cip-dev@lists.cip-project.org; iwamatsu nobuhiro(岩松 信洋 □DITC○
> CPT) <nobuhiro1.iwamatsu@toshiba.co.jp>; Pavel Machek
> <pavel@denx.de>
> Cc: Biju Das <biju.das.jz@bp.renesas.com>; Lad Prabhakar
> <prabhakar.mahadev-lad.rj@bp.renesas.com>; tomm.merciai@gmail.com
> Subject: [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI
> 
> Hi All,
> 
> This patch series aims to add SDHI support for the Renesas RZ/G3E SoCs into
> the linux-6.12.y-cip kernel.
> 
> The SD/MMC block on the RZ/G3E ("R9A09G047") SoC is similar to that of the
> RZ/V2H, but the SD0 channel has only dedicated pins, so we must use
> SD_STATUS register to control voltage and power enable (internal regulator).
> 
> For SD1 and SD2 channel we can either use gpio regulator or internal regulator
> (using SD_STATUS register) for voltage switching.
> 
> This patchset applies on top of [1]
> 
> [1] https://patchwork.kernel.org/project/cip-dev/list/?series=974772
> 
> Thanks & Regards,
> Tommaso
> 
> Biju Das (10):
>   clk: renesas: r9a09g047: Add SDHI clocks/resets
>   dt-bindings: mmc: renesas,sdhi: Document RZ/G3E support
>   of: base: Add of_get_available_child_by_name()
>   mmc: renesas_sdhi: Add support for RZ/G3E SoC
>   mmc: renesas_sdhi: Use of_get_available_child_by_name()
>   arm64: dts: renesas: r9a09g047: Add SDHI0-SDHI2 nodes
>   arm64: dts: renesas: r9a09g057: Add support for enabling SDHI internal
>     regulator
>   arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2}
>   arm64: dts: renesas: rzg3e-smarc-som: Add support to enable SD on
>     SDHI0
>   arm64: dts: renesas: r9a09g047e57-smarc: Enable SDHI1
> 
>  .../devicetree/bindings/mmc/renesas,sdhi.yaml |  16 ++
>  arch/arm64/boot/dts/renesas/r9a09g047.dtsi    |  60 +++++++
>  .../boot/dts/renesas/r9a09g047e57-smarc.dts   |  49 ++++++
>  arch/arm64/boot/dts/renesas/r9a09g057.dtsi    |  21 +++
>  .../boot/dts/renesas/renesas-smarc2.dtsi      |  18 ++
>  .../boot/dts/renesas/rzg3e-smarc-som.dtsi     | 154
> ++++++++++++++++++
>  drivers/clk/renesas/r9a09g047-cpg.c           |  31 ++++
>  drivers/mmc/host/Kconfig                      |   2 +-
>  drivers/mmc/host/renesas_sdhi.h               |   1 +
>  drivers/mmc/host/renesas_sdhi_core.c          | 126
> ++++++++++++++
>  drivers/mmc/host/tmio_mmc.h                   |  10 ++
>  drivers/of/base.c                             |  27 +++
>  include/linux/of.h                            |   9 +
>  13 files changed, 523 insertions(+), 1 deletion(-)


I reviewed this series, looks good to me. I can apply, if there are no other comments.
Test: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/1885935233

Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

Best regards,
  Nobuhiro



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

* Re: [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI
  2025-06-24  7:18 ` [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI nobuhiro1.iwamatsu
@ 2025-06-24  9:04   ` Pavel Machek
  0 siblings, 0 replies; 15+ messages in thread
From: Pavel Machek @ 2025-06-24  9:04 UTC (permalink / raw)
  To: nobuhiro1.iwamatsu
  Cc: tommaso.merciai.xr, cip-dev, biju.das.jz,
	prabhakar.mahadev-lad.rj, tomm.merciai

[-- Attachment #1: Type: text/plain, Size: 768 bytes --]

Hi!

> > ++++++++++++++
> >  drivers/mmc/host/tmio_mmc.h                   |  10 ++
> >  drivers/of/base.c                             |  27 +++
> >  include/linux/of.h                            |   9 +
> >  13 files changed, 523 insertions(+), 1 deletion(-)
> 
> 
> I reviewed this series, looks good to me. I can apply, if there are no other comments.
> Test: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/pipelines/1885935233
> 
> Reviewed-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>

Thank you, I added your Reviewed-by tag and applied the series.

Best regards,
								Pavel
-- 
DENX Software Engineering GmbH,        Managing Director: Erika Unter
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2025-06-24  9:04 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-23 14:48 [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 01/10] clk: renesas: r9a09g047: Add SDHI clocks/resets Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 02/10] dt-bindings: mmc: renesas,sdhi: Document RZ/G3E support Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 03/10] of: base: Add of_get_available_child_by_name() Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 04/10] mmc: renesas_sdhi: Add support for RZ/G3E SoC Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 05/10] mmc: renesas_sdhi: Use of_get_available_child_by_name() Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 06/10] arm64: dts: renesas: r9a09g047: Add SDHI0-SDHI2 nodes Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 07/10] arm64: dts: renesas: r9a09g057: Add support for enabling SDHI internal regulator Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 08/10] arm64: dts: renesas: rzg3e-smarc-som: Enable SDHI{0,2} Tommaso Merciai
2025-06-23 23:25   ` nobuhiro1.iwamatsu
2025-06-23 23:30     ` nobuhiro1.iwamatsu
2025-06-23 14:48 ` [PATCH 6.12.y-cip 09/10] arm64: dts: renesas: rzg3e-smarc-som: Add support to enable SD on SDHI0 Tommaso Merciai
2025-06-23 14:48 ` [PATCH 6.12.y-cip 10/10] arm64: dts: renesas: r9a09g047e57-smarc: Enable SDHI1 Tommaso Merciai
2025-06-24  7:18 ` [PATCH 6.12.y-cip 00/10] Add support for RZ/G3E SDHI nobuhiro1.iwamatsu
2025-06-24  9:04   ` Pavel Machek

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