Skip to contentSkip to conversation

ARM: dts: renesas: genmai: enable SDHI and MMCIF

PATCH In review Wolfram Sang 2 participants 11 messages Sep 28, 2024 – Oct 7, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

v2 cover ARM: dts: renesas: genmai: enable SDHI and MMCIF

Here are the improved patches to enable SDHI and MMCIF for the Genmai board.

Changes since v1 (all in patch 3):
* renamed regulator to match schematics
* added "boot-on" property to regulator node
* added vqmmc-property to mmc node

A branch with all my Genmai-related patches can be found here:

git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git renesas/genmai-upstreaming

Thanks and happy hacking!

Wolfram Sang (3):
ARM: dts: renesas: genmai: enable SDHI0
ARM: dts: renesas: r7s72100: 'bus-width' is a board property
ARM: dts: renesas: genmai: enable MMCIF

 arch/arm/boot/dts/renesas/r7s72100-genmai.dts | 57 ++++++++++++++++++-
 arch/arm/boot/dts/renesas/r7s72100.dtsi       |  1 -
 2 files changed, 56 insertions(+), 2 deletions(-)
Signature · 1 line
2.45.2
#1 lore raw

PATCH v2 1/3 ARM: dts: renesas: genmai: enable SDHI0

For this to work, User LEDs must be disabled because they share their pins with SD data lines.

---
 arch/arm/boot/dts/renesas/r7s72100-genmai.dts | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +22 -1
index 2d72daa4fac2..e93f444b2442 100644
@@ -76,7 +76,8 @@ key-1 {
 	};
 
 	leds {
-		status = "okay";
+		/* Needs SDHI0 to be disabled */
+		status = "disabled";
 		compatible = "gpio-leds";
 
 		led1 {
@@ -227,6 +228,18 @@ scif2_pins: serial2 {
 		/* P3_0 as TxD2; P3_2 as RxD2 */
 		pinmux = <RZA1_PINMUX(3, 0, 6)>, <RZA1_PINMUX(3, 2, 4)>;
 	};
+
+	sdhi0_pins: sdhi0 {
+		/* SDHI0: P4_8 up to P4_15 */
+		pinmux = <RZA1_PINMUX(4, 8, 3)>,	/* SD_CD_0 */
+			 <RZA1_PINMUX(4, 9, 3)>,	/* SD_WP_0 */
+			 <RZA1_PINMUX(4, 10, 3)>,	/* SD_D1_0 */
+			 <RZA1_PINMUX(4, 11, 3)>,	/* SD_D0_0 */
+			 <RZA1_PINMUX(4, 12, 3)>,	/* SD_CLK_0 */
+			 <RZA1_PINMUX(4, 13, 3)>,	/* SD_CMD_0 */
+			 <RZA1_PINMUX(4, 14, 3)>,	/* SD_D3_0 */
+			 <RZA1_PINMUX(4, 15, 3)>;	/* SD_D2_0 */
+	};
 };
 
 &rtc_x1_clk {
@@ -244,6 +257,14 @@ &scif2 {
 	status = "okay";
 };
 
+&sdhi0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&sdhi0_pins>;
+
+	bus-width = <4>;
+	status = "okay";
+};
+
 &spi4 {
 	status = "okay";
 
Signature · 1 line
2.45.2
#2 lore raw

Re: [PATCH v2 1/3] ARM: dts: renesas: genmai: enable SDHI0

Hi Wolfram,

Quoted 4 lines · Wolfram Sang

For this to work, User LEDs must be disabled because they share their pins with SD data lines.

Thanks for your patch!

arch/arm/boot/dts/renesas/r7s72100-genmai.dts &scif2 { · line 265

Quoted 12 lines
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +6 -0
@@ -244,6 +257,14 @@ &scif2 {
        status = "okay";
 };
 
+&sdhi0 {
+       pinctrl-names = "default";
+       pinctrl-0 = <&sdhi0_pins>;
+
+       bus-width = <4>;
+       status = "okay";

Any specific reason you left out the regulator for SDHI (CVCC1), but did add the regulator for MMC (CVCC2) in PATCH 2/3?

arch/arm/boot/dts/renesas/r7s72100-genmai.dts &scif2 { · line 269

Quoted 4 lines
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +2 -0
+};
+
 &spi4 {
        status = "okay";

The rest LGTM.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#3 lore raw

Re: [PATCH v2 1/3] ARM: dts: renesas: genmai: enable SDHI0

Quoted 3 lines

Any specific reason you left out the regulator for SDHI (CVCC1), but did add the regulator for MMC (CVCC2) in PATCH 2/3?

Yes, the MMCIF driver didn't work otherwise because it needs to negotiate with the card. It does not seem needed for SD cards without SDR modes. I assume that, didn't investigate further.

Reviewed-by
#4 lore raw

Re: [PATCH v2 1/3] ARM: dts: renesas: genmai: enable SDHI0

Quoted 6 lines · Wolfram Sang
Quoted 2 lines

Any specific reason you left out the regulator for SDHI (CVCC1), but did add the regulator for MMC (CVCC2) in PATCH 2/3?

Yes, the MMCIF driver didn't work otherwise because it needs to negotiate with the card. It does not seem needed for SD cards without SDR modes. I assume that, didn't investigate further.

OK.

i.e. will queue in renesas-devel for v6.13.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#5 lore raw

PATCH v2 2/3 ARM: dts: renesas: r7s72100: 'bus-width' is a board property

In reply to Wolfram Sang

Do not set 'bus-width' in the SoC-include DTSI. It must be set in the board DTS file. No regressions because MMCIF was not enabled yet for this SoC.

---
 arch/arm/boot/dts/renesas/r7s72100.dtsi | 1 -
 1 file changed, 1 deletion(-)
arch/arm/boot/dts/renesas/r7s72100.dtsi +0 -1
index fa26e4a39fd7..39999468c28b 100644
@@ -333,7 +333,6 @@ mmcif: mmc@e804c800 {
 				     <GIC_SPI 267 IRQ_TYPE_LEVEL_HIGH>;
 			clocks = <&mstp8_clks R7S72100_CLK_MMCIF>;
 			power-domains = <&cpg_clocks>;
-			bus-width = <8>;
 			status = "disabled";
 		};
 
Signature · 1 line
2.45.2
Reviewed-by on v2 2/3
#6 lore raw

Re: [PATCH v2 2/3] ARM: dts: renesas: r7s72100: 'bus-width' is a board property

Quoted 5 lines · Wolfram Sang

Do not set 'bus-width' in the SoC-include DTSI. It must be set in the board DTS file. No regressions because MMCIF was not enabled yet for this SoC.

i.e. will queue in renesas-devel for v6.13.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#7 lore raw

PATCH v2 3/3 ARM: dts: renesas: genmai: enable MMCIF

In reply to Wolfram Sang

Luckily, I still had an MMC card lying around. Works fine.

---
 arch/arm/boot/dts/renesas/r7s72100-genmai.dts | 34 +++++++++++++++++++
 1 file changed, 34 insertions(+)
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +34 -0
index e93f444b2442..2403e21f2676 100644
@@ -88,6 +88,15 @@ led2 {
 			gpios = <&port4 11 GPIO_ACTIVE_LOW>;
 		};
 	};
+
+	cvcc2: regulator-mmc {
+		compatible = "regulator-fixed";
+		regulator-name = "CVcc2";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
 };
 
 &bsc {
@@ -179,6 +188,17 @@ eeprom@50 {
 	};
 };
 
+&mmcif {
+	pinctrl-0 = <&mmcif_pins>;
+	pinctrl-names = "default";
+	cd-gpios = <&port3 8 GPIO_ACTIVE_LOW>;
+
+	vmmc-supply = <&cvcc2>;
+	vqmmc-supply = <&cvcc2>;
+	bus-width = <8>;
+	status = "okay";
+};
+
 &mtu2 {
 	status = "okay";
 };
@@ -224,6 +244,20 @@ keyboard_pins: keyboard {
 		pinmux = <RZA1_PINMUX(3, 1, 3)>;
 	};
 
+	mmcif_pins: mmcif {
+		/* MMCIF: P3_8 is CD_GPIO, P3_10 up to P3_15, P4_0 up to P4_3 */
+		pinmux = <RZA1_PINMUX(3, 10, 8)>,	/* MMC_D1 */
+			 <RZA1_PINMUX(3, 11, 8)>,	/* MMC_D0 */
+			 <RZA1_PINMUX(3, 12, 8)>,	/* MMC_CLK */
+			 <RZA1_PINMUX(3, 13, 8)>,	/* MMC_CMD */
+			 <RZA1_PINMUX(3, 14, 8)>,	/* MMC_D3 */
+			 <RZA1_PINMUX(3, 15, 8)>,	/* MMC_D2 */
+			 <RZA1_PINMUX(4, 0, 8)>,	/* MMC_D4 */
+			 <RZA1_PINMUX(4, 1, 8)>,	/* MMC_D5 */
+			 <RZA1_PINMUX(4, 2, 8)>,	/* MMC_D6 */
+			 <RZA1_PINMUX(4, 3, 8)>;	/* MMC_D7 */
+	};
+
 	scif2_pins: serial2 {
 		/* P3_0 as TxD2; P3_2 as RxD2 */
 		pinmux = <RZA1_PINMUX(3, 0, 6)>, <RZA1_PINMUX(3, 2, 4)>;
Signature · 1 line
2.45.2
#8 lore raw

Re: [PATCH v2 3/3] ARM: dts: renesas: genmai: enable MMCIF

Hi Wolfram,

Quoted 3 lines · Wolfram Sang

Luckily, I still had an MMC card lying around. Works fine.

Thanks for your patch!

arch/arm/boot/dts/renesas/r7s72100-genmai.dts led2 { · line 94

Quoted 10 lines
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +4 -0
@@ -88,6 +88,15 @@ led2 {
                        gpios = <&port4 11 GPIO_ACTIVE_LOW>;
                };
        };
+
+       cvcc2: regulator-mmc {
+               compatible = "regulator-fixed";
+               regulator-name = "CVcc2";

Odd case. "Cvcc2"?

arch/arm/boot/dts/renesas/r7s72100-genmai.dts led2 { · line 98

Quoted 4 lines
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +4 -0
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;

The regulator is not always-on, but controlled through the MMC CD signal.

arch/arm/boot/dts/renesas/r7s72100-genmai.dts led2 { · line 100

Quoted 2 lines
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +1 -0
+       };
 };

The rest LGTM.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#9 lore raw

Re: [PATCH v2 3/3] ARM: dts: renesas: genmai: enable MMCIF

Quoted 4 lines
Quoted 2 lines

+ regulator-name = "CVcc2";

Odd case. "Cvcc2"?

Fine with me.

Quoted 7 lines

arch/arm/boot/dts/renesas/r7s72100-genmai.dts led2 { · line 98

Quoted 4 lines
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +4 -0
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;

The regulator is not always-on, but controlled through the MMC CD signal.

Hmm, okay, but how do I model this in the DT? Can I say that a GPIO is input-only? I can't find this in the bindings doc.

Reviewed-by
#10 lore raw

Re: [PATCH v2 3/3] ARM: dts: renesas: genmai: enable MMCIF

Hi Wolfram,

Quoted 5 lines · Wolfram Sang
Quoted 3 lines
Quoted 1 line

+ regulator-name = "CVcc2";

Odd case. "Cvcc2"?

Fine with me.

OK, will fix while applying.

Quoted 10 lines
Quoted 7 lines

arch/arm/boot/dts/renesas/r7s72100-genmai.dts led2 { · line 98

Quoted 4 lines
arch/arm/boot/dts/renesas/r7s72100-genmai.dts +4 -0
+               regulator-min-microvolt = <3300000>;
+               regulator-max-microvolt = <3300000>;
+               regulator-boot-on;
+               regulator-always-on;

The regulator is not always-on, but controlled through the MMC CD signal.

Hmm, okay, but how do I model this in the DT? Can I say that a GPIO is input-only? I can't find this in the bindings doc.

Right, there is no such thing as "regulator-auto-on" ;-) From the software's point of view it is always enabled, so "regulator-always-on" makes sense.

i.e. will queue in renesas-devel for v6.13.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds