All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
To: cip-dev@lists.cip-project.org,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Pavel Machek <pavel@denx.de>
Cc: Biju Das <biju.das.jz@bp.renesas.com>
Subject: [RESEND PATCH 5.10.y-cip 39/40] arm64: dts: renesas: rzg2l-smarc-som: Enable eMMC on SMARC platform
Date: Fri,  1 Apr 2022 20:42:33 +0100	[thread overview]
Message-ID: <20220401194234.14057-40-prabhakar.mahadev-lad.rj@bp.renesas.com> (raw)
In-Reply-To: <20220401194234.14057-1-prabhakar.mahadev-lad.rj@bp.renesas.com>

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

commit a60a311cb8d0cddaaeb1eee22bfd76138e6b5ad6 upstream.

RZ/G2L SoM has both 64 GB eMMC and microSD connected to SDHI0.

Both these interfaces are mutually exclusive and the SD0 device
selection is based on the XOR between GPIO_SD0_DEV_SEL and SW1[2]
switch position.

This patch sets GPIO_SD0_DEV_SEL to high in DT. Use the below switch
setting logic for device selection between eMMC and microSD slot
connected to SDHI0.

Set SW1[2] to position 2/OFF for selecting eMMC
Set SW1[2] to position 3/ON for selecting microSD

This patch enables eMMC on RZ/G2L SMARC platform by default.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20211010142520.21976-2-biju.das.jz@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
[PL: Manually applied the changes]
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 .../boot/dts/renesas/rzg2l-smarc-som.dtsi     | 143 ++++++++++++++++++
 1 file changed, 143 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi b/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
index 9804ca0fd528..c496c3bf212b 100644
--- a/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
+++ b/arch/arm64/boot/dts/renesas/rzg2l-smarc-som.dtsi
@@ -5,8 +5,19 @@
  * Copyright (C) 2021 Renesas Electronics Corp.
  */
 
+#include <dt-bindings/gpio/gpio.h>
 #include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
 
+/* SW1[2] should be at position 2/OFF to enable 64 GB eMMC */
+#define EMMC	1
+
+/*
+ * To enable uSD card on CN3,
+ * SW1[2] should be at position 3/ON.
+ * Disable eMMC by setting "#define EMMC	0" above.
+ */
+#define SDHI	(!EMMC)
+
 / {
 	aliases {
 		ethernet0 = &eth0;
@@ -22,6 +33,36 @@
 		/* first 128MB is reserved for secure area. */
 		reg = <0x0 0x48000000 0x0 0x78000000>;
 	};
+
+	reg_1p8v: regulator0 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	reg_3p3v: regulator1 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	vccq_sdhi0: regulator-vccq-sdhi0 {
+		compatible = "regulator-gpio";
+
+		regulator-name = "SDHI0 VccQ";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <3300000>;
+		states = <3300000 1>, <1800000 0>;
+		regulator-boot-on;
+		gpios = <&pinctrl RZG2L_GPIO(39, 0) GPIO_ACTIVE_HIGH>;
+		regulator-always-on;
+	};
 };
 
 &adc {
@@ -130,6 +171,13 @@
 			 <RZG2L_PORT_PINMUX(36, 0, 1)>; /* ET1_RXD3 */
 	};
 
+	gpio-sd0-pwr-en-hog {
+		gpio-hog;
+		gpios = <RZG2L_GPIO(4, 1) GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "gpio_sd0_pwr_en";
+	};
+
 	qspi0_pins: qspi0 {
 		qspi0-data {
 			pins = "QSPI0_IO0", "QSPI0_IO1", "QSPI0_IO2", "QSPI0_IO3";
@@ -141,6 +189,70 @@
 			power-source = <1800>;
 		};
 	};
+
+	/*
+	 * SD0 device selection is XOR between GPIO_SD0_DEV_SEL and SW1[2]
+	 * The below switch logic can be used to select the device between
+	 * eMMC and microSD, after setting GPIO_SD0_DEV_SEL to high in DT.
+	 * SW1[2] should be at position 2/OFF to enable 64 GB eMMC
+	 * SW1[2] should be at position 3/ON to enable uSD card CN3
+	 */
+	sd0-dev-sel-hog {
+		gpio-hog;
+		gpios = <RZG2L_GPIO(41, 1) GPIO_ACTIVE_HIGH>;
+		output-high;
+		line-name = "sd0_dev_sel";
+	};
+
+	sdhi0_emmc_pins: sd0emmc {
+		sd0_emmc_data {
+			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3",
+			       "SD0_DATA4", "SD0_DATA5", "SD0_DATA6", "SD0_DATA7";
+			power-source = <1800>;
+		};
+
+		sd0_emmc_ctrl {
+			pins = "SD0_CLK", "SD0_CMD";
+			power-source = <1800>;
+		};
+
+		sd0_emmc_rst {
+			pins = "SD0_RST#";
+			power-source = <1800>;
+		};
+	};
+
+	sdhi0_pins: sd0 {
+		sd0_data {
+			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
+			power-source = <3300>;
+		};
+
+		sd0_ctrl {
+			pins = "SD0_CLK", "SD0_CMD";
+			power-source = <3300>;
+		};
+
+		sd0_mux {
+			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
+		};
+	};
+
+	sdhi0_pins_uhs: sd0_uhs {
+		sd0_data_uhs {
+			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
+			power-source = <1800>;
+		};
+
+		sd0_ctrl_uhs {
+			pins = "SD0_CLK", "SD0_CMD";
+			power-source = <1800>;
+		};
+
+		sd0_mux_uhs {
+			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
+		};
+	};
 };
 
 &sbc {
@@ -170,3 +282,34 @@
 		};
 	};
 };
+
+#if SDHI
+&sdhi0 {
+	pinctrl-0 = <&sdhi0_pins>;
+	pinctrl-1 = <&sdhi0_pins_uhs>;
+	pinctrl-names = "default", "state_uhs";
+
+	vmmc-supply = <&reg_3p3v>;
+	vqmmc-supply = <&vccq_sdhi0>;
+	bus-width = <4>;
+	sd-uhs-sdr50;
+	sd-uhs-sdr104;
+	status = "okay";
+};
+#endif
+
+#if EMMC
+&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";
+};
+#endif
-- 
2.17.1



  parent reply	other threads:[~2022-04-04 18:46 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 19:41 [RESEND PATCH 5.10.y-cip 00/40] Add SD/eMMC support for Renesas RZ/G2L SoC Lad Prabhakar
2022-04-01 19:41 ` [RESEND PATCH 5.10.y-cip 01/40] mmc: renesas_sdhi: only reset SCC when its pointer is populated Lad Prabhakar
2022-04-01 19:41 ` [RESEND PATCH 5.10.y-cip 02/40] mmc: renesas_sdhi: probe into TMIO after SCC parameters have been setup Lad Prabhakar
2022-04-01 19:41 ` [RESEND PATCH 5.10.y-cip 03/40] mmc: renesas_sdhi: populate SCC pointer at the proper place Lad Prabhakar
2022-04-01 19:41 ` [RESEND PATCH 5.10.y-cip 04/40] mmc: renesas_sdhi: simplify reset routine a little Lad Prabhakar
2022-04-01 19:41 ` [RESEND PATCH 5.10.y-cip 05/40] mmc: renesas_sdhi: clear TAPEN when resetting, too Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 06/40] mmc: renesas_sdhi: merge the SCC reset functions Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 07/40] mmc: renesas_sdhi: remove superfluous SCLKEN Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 08/40] mmc: renesas_sdhi: improve HOST_MODE usage Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 09/40] mmc: renesas_sdhi: don't hardcode SDIF values Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 10/40] mmc: renesas_sdhi: sort includes Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 11/40] mmc: tmio: set max_busy_timeout Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 12/40] mmc: tmio: add hook for custom busy_wait calculation Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 13/40] mmc: renesas_sdhi: populate hook for longer busy_wait Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 14/40] mmc: renesas_internal_dmac: add pre_req and post_req support Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 15/40] mmc: tmio: Add data timeout error detection Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 16/40] mmc: renesas_sdhi: Add a condition of cmd/data timeout for retune Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 17/40] mmc: tmio: support custom irq masks Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 18/40] mmc: renesas_sdhi: use custom mask for TMIO_MASK_ALL Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 19/40] mmc: tmio: abort DMA before reset Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 20/40] mmc: tmio: restore bus width when resetting Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 21/40] mmc: renesas_sdhi: break SCC reset into own function Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 22/40] mmc: renesas_sdhi: do hard reset if possible Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 23/40] mmc: tmio: always flag retune when resetting and a card is present Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 24/40] mmc: tmio: always restore irq register Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 25/40] mmc: tmio: reenable card irqs after the reset callback Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 26/40] mmc: tmio: reinit card irqs in reset routine Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 27/40] clk: renesas: rzg2l: Add SDHI clk mux support Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 28/40] clk: renesas: rzg2l: Add missing kerneldoc for resets Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 29/40] clk: renesas: rzg2l: Check return value of pm_genpd_init() Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 30/40] clk: renesas: rzg2l: propagate return value of_genpd_add_provider_simple() Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 31/40] clk: renesas: r9a07g044: Add SDHI clock and reset entries Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 32/40] dt-bindings: Fix errors in 'if' schemas Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 33/40] dt-bindings: Drop redundant minItems/maxItems Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 34/40] dt-bindings: mmc: renesas,sdhi: Fix dtbs-check warning Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 35/40] dt-bindings: mmc: renesas,sdhi: Document RZ/G2L bindings Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 36/40] dt-bindings: mmc: renesas,sdhi: Add optional SDnH clock Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 37/40] dt-bindings: mmc: renesas,sdhi: Rename RZ/G2L clocks Lad Prabhakar
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 38/40] arm64: dts: renesas: r9a07g044: Add SDHI nodes Lad Prabhakar
2022-04-01 19:42 ` Lad Prabhakar [this message]
2022-04-01 19:42 ` [RESEND PATCH 5.10.y-cip 40/40] arm64: dts: renesas: rzg2l-smarc: Enable microSD on SMARC platform Lad Prabhakar
2022-04-01 21:33 ` [RESEND PATCH 5.10.y-cip 00/40] Add SD/eMMC support for Renesas RZ/G2L SoC Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220401194234.14057-40-prabhakar.mahadev-lad.rj@bp.renesas.com \
    --to=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=biju.das.jz@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.