155c68261SLad Prabhakar// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
255c68261SLad Prabhakar/*
355c68261SLad Prabhakar * Device Tree Source for the RZ/G2L SMARC SOM common parts
455c68261SLad Prabhakar *
555c68261SLad Prabhakar * Copyright (C) 2021 Renesas Electronics Corp.
655c68261SLad Prabhakar */
755c68261SLad Prabhakar
8a60a311cSBiju Das#include <dt-bindings/gpio/gpio.h>
903f7d78eSLad Prabhakar#include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
1003f7d78eSLad Prabhakar
11a60a311cSBiju Das/* SW1[2] should be at position 2/OFF to enable 64 GB eMMC */
12a60a311cSBiju Das#define EMMC	1
13a60a311cSBiju Das
14a60a311cSBiju Das/*
15a60a311cSBiju Das * To enable uSD card on CN3,
16a60a311cSBiju Das * SW1[2] should be at position 3/ON.
17a60a311cSBiju Das * Disable eMMC by setting "#define EMMC	0" above.
18a60a311cSBiju Das */
19a60a311cSBiju Das#define SDHI	(!EMMC)
20a60a311cSBiju Das
2155c68261SLad Prabhakar/ {
22361b0dcbSBiju Das	aliases {
23361b0dcbSBiju Das		ethernet0 = &eth0;
24361b0dcbSBiju Das		ethernet1 = &eth1;
25361b0dcbSBiju Das	};
26361b0dcbSBiju Das
27361b0dcbSBiju Das	chosen {
28361b0dcbSBiju Das		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
29361b0dcbSBiju Das	};
30361b0dcbSBiju Das
3155c68261SLad Prabhakar	memory@48000000 {
3255c68261SLad Prabhakar		device_type = "memory";
3355c68261SLad Prabhakar		/* first 128MB is reserved for secure area. */
3455c68261SLad Prabhakar		reg = <0x0 0x48000000 0x0 0x78000000>;
3555c68261SLad Prabhakar	};
36a60a311cSBiju Das
37a60a311cSBiju Das	reg_1p8v: regulator0 {
38a60a311cSBiju Das		compatible = "regulator-fixed";
39a60a311cSBiju Das		regulator-name = "fixed-1.8V";
40a60a311cSBiju Das		regulator-min-microvolt = <1800000>;
41a60a311cSBiju Das		regulator-max-microvolt = <1800000>;
42a60a311cSBiju Das		regulator-boot-on;
43a60a311cSBiju Das		regulator-always-on;
44a60a311cSBiju Das	};
45a60a311cSBiju Das
46a60a311cSBiju Das	reg_3p3v: regulator1 {
47a60a311cSBiju Das		compatible = "regulator-fixed";
48a60a311cSBiju Das		regulator-name = "fixed-3.3V";
49a60a311cSBiju Das		regulator-min-microvolt = <3300000>;
50a60a311cSBiju Das		regulator-max-microvolt = <3300000>;
51a60a311cSBiju Das		regulator-boot-on;
52a60a311cSBiju Das		regulator-always-on;
53a60a311cSBiju Das	};
54a60a311cSBiju Das
55a60a311cSBiju Das	vccq_sdhi0: regulator-vccq-sdhi0 {
56a60a311cSBiju Das		compatible = "regulator-gpio";
57a60a311cSBiju Das
58a60a311cSBiju Das		regulator-name = "SDHI0 VccQ";
59a60a311cSBiju Das		regulator-min-microvolt = <1800000>;
60a60a311cSBiju Das		regulator-max-microvolt = <3300000>;
61a60a311cSBiju Das		states = <3300000 1>, <1800000 0>;
62a60a311cSBiju Das		regulator-boot-on;
63a60a311cSBiju Das		gpios = <&pinctrl RZG2L_GPIO(39, 0) GPIO_ACTIVE_HIGH>;
64a60a311cSBiju Das		regulator-always-on;
65a60a311cSBiju Das	};
6655c68261SLad Prabhakar};
6755c68261SLad Prabhakar
6803f7d78eSLad Prabhakar&adc {
6903f7d78eSLad Prabhakar	pinctrl-0 = <&adc_pins>;
7003f7d78eSLad Prabhakar	pinctrl-names = "default";
7103f7d78eSLad Prabhakar	status = "okay";
7203f7d78eSLad Prabhakar
7303f7d78eSLad Prabhakar	/delete-node/ channel@6;
7403f7d78eSLad Prabhakar	/delete-node/ channel@7;
7503f7d78eSLad Prabhakar};
7603f7d78eSLad Prabhakar
77361b0dcbSBiju Das&eth0 {
78361b0dcbSBiju Das	pinctrl-0 = <&eth0_pins>;
79361b0dcbSBiju Das	pinctrl-names = "default";
80361b0dcbSBiju Das	phy-handle = <&phy0>;
81361b0dcbSBiju Das	phy-mode = "rgmii-id";
82361b0dcbSBiju Das	status = "okay";
83361b0dcbSBiju Das
84361b0dcbSBiju Das	phy0: ethernet-phy@7 {
85361b0dcbSBiju Das		compatible = "ethernet-phy-id0022.1640",
86361b0dcbSBiju Das			     "ethernet-phy-ieee802.3-c22";
87361b0dcbSBiju Das		reg = <7>;
88361b0dcbSBiju Das		rxc-skew-psec = <2400>;
89361b0dcbSBiju Das		txc-skew-psec = <2400>;
90361b0dcbSBiju Das		rxdv-skew-psec = <0>;
91361b0dcbSBiju Das		txdv-skew-psec = <0>;
92361b0dcbSBiju Das		rxd0-skew-psec = <0>;
93361b0dcbSBiju Das		rxd1-skew-psec = <0>;
94361b0dcbSBiju Das		rxd2-skew-psec = <0>;
95361b0dcbSBiju Das		rxd3-skew-psec = <0>;
96361b0dcbSBiju Das		txd0-skew-psec = <0>;
97361b0dcbSBiju Das		txd1-skew-psec = <0>;
98361b0dcbSBiju Das		txd2-skew-psec = <0>;
99361b0dcbSBiju Das		txd3-skew-psec = <0>;
100361b0dcbSBiju Das	};
101361b0dcbSBiju Das};
102361b0dcbSBiju Das
103361b0dcbSBiju Das&eth1 {
104361b0dcbSBiju Das	pinctrl-0 = <&eth1_pins>;
105361b0dcbSBiju Das	pinctrl-names = "default";
106361b0dcbSBiju Das	phy-handle = <&phy1>;
107361b0dcbSBiju Das	phy-mode = "rgmii-id";
108361b0dcbSBiju Das	status = "okay";
109361b0dcbSBiju Das
110361b0dcbSBiju Das	phy1: ethernet-phy@7 {
111361b0dcbSBiju Das		compatible = "ethernet-phy-id0022.1640",
112361b0dcbSBiju Das			     "ethernet-phy-ieee802.3-c22";
113361b0dcbSBiju Das		reg = <7>;
114361b0dcbSBiju Das		rxc-skew-psec = <2400>;
115361b0dcbSBiju Das		txc-skew-psec = <2400>;
116361b0dcbSBiju Das		rxdv-skew-psec = <0>;
117361b0dcbSBiju Das		txdv-skew-psec = <0>;
118361b0dcbSBiju Das		rxd0-skew-psec = <0>;
119361b0dcbSBiju Das		rxd1-skew-psec = <0>;
120361b0dcbSBiju Das		rxd2-skew-psec = <0>;
121361b0dcbSBiju Das		rxd3-skew-psec = <0>;
122361b0dcbSBiju Das		txd0-skew-psec = <0>;
123361b0dcbSBiju Das		txd1-skew-psec = <0>;
124361b0dcbSBiju Das		txd2-skew-psec = <0>;
125361b0dcbSBiju Das		txd3-skew-psec = <0>;
126361b0dcbSBiju Das	};
127361b0dcbSBiju Das};
128361b0dcbSBiju Das
12955c68261SLad Prabhakar&extal_clk {
13055c68261SLad Prabhakar	clock-frequency = <24000000>;
13155c68261SLad Prabhakar};
13203f7d78eSLad Prabhakar
133*00d071e2SBiju Das&ostm1 {
134*00d071e2SBiju Das	status = "okay";
135*00d071e2SBiju Das};
136*00d071e2SBiju Das
137*00d071e2SBiju Das&ostm2 {
138*00d071e2SBiju Das	status = "okay";
139*00d071e2SBiju Das};
140*00d071e2SBiju Das
14103f7d78eSLad Prabhakar&pinctrl {
14203f7d78eSLad Prabhakar	adc_pins: adc {
14303f7d78eSLad Prabhakar		pinmux = <RZG2L_PORT_PINMUX(9, 0, 2)>; /* ADC_TRG */
14403f7d78eSLad Prabhakar	};
145a60a311cSBiju Das
146361b0dcbSBiju Das	eth0_pins: eth0 {
147361b0dcbSBiju Das		pinmux = <RZG2L_PORT_PINMUX(28, 1, 1)>, /* ET0_LINKSTA */
148361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(27, 1, 1)>, /* ET0_MDC */
149361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(28, 0, 1)>, /* ET0_MDIO */
150361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(20, 0, 1)>, /* ET0_TXC */
151361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(20, 1, 1)>, /* ET0_TX_CTL */
152361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(20, 2, 1)>, /* ET0_TXD0 */
153361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(21, 0, 1)>, /* ET0_TXD1 */
154361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(21, 1, 1)>, /* ET0_TXD2 */
155361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(22, 0, 1)>, /* ET0_TXD3 */
156361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(24, 0, 1)>, /* ET0_RXC */
157361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(24, 1, 1)>, /* ET0_RX_CTL */
158361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(25, 0, 1)>, /* ET0_RXD0 */
159361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(25, 1, 1)>, /* ET0_RXD1 */
160361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(26, 0, 1)>, /* ET0_RXD2 */
161361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(26, 1, 1)>; /* ET0_RXD3 */
162361b0dcbSBiju Das	};
163361b0dcbSBiju Das
164361b0dcbSBiju Das	eth1_pins: eth1 {
165361b0dcbSBiju Das		pinmux = <RZG2L_PORT_PINMUX(37, 2, 1)>, /* ET1_LINKSTA */
166361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(37, 0, 1)>, /* ET1_MDC */
167361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(37, 1, 1)>, /* ET1_MDIO */
168361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(29, 0, 1)>, /* ET1_TXC */
169361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(29, 1, 1)>, /* ET1_TX_CTL */
170361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(30, 0, 1)>, /* ET1_TXD0 */
171361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(30, 1, 1)>, /* ET1_TXD1 */
172361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(31, 0, 1)>, /* ET1_TXD2 */
173361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(31, 1, 1)>, /* ET1_TXD3 */
174361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(33, 1, 1)>, /* ET1_RXC */
175361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(34, 0, 1)>, /* ET1_RX_CTL */
176361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(34, 1, 1)>, /* ET1_RXD0 */
177361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(35, 0, 1)>, /* ET1_RXD1 */
178361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(35, 1, 1)>, /* ET1_RXD2 */
179361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(36, 0, 1)>; /* ET1_RXD3 */
180361b0dcbSBiju Das	};
181361b0dcbSBiju Das
182a60a311cSBiju Das	gpio-sd0-pwr-en-hog {
183a60a311cSBiju Das		gpio-hog;
184a60a311cSBiju Das		gpios = <RZG2L_GPIO(4, 1) GPIO_ACTIVE_HIGH>;
185a60a311cSBiju Das		output-high;
186a60a311cSBiju Das		line-name = "gpio_sd0_pwr_en";
18703f7d78eSLad Prabhakar	};
188a60a311cSBiju Das
189a60a311cSBiju Das	/*
190a60a311cSBiju Das	 * SD0 device selection is XOR between GPIO_SD0_DEV_SEL and SW1[2]
191a60a311cSBiju Das	 * The below switch logic can be used to select the device between
192a60a311cSBiju Das	 * eMMC and microSD, after setting GPIO_SD0_DEV_SEL to high in DT.
193a60a311cSBiju Das	 * SW1[2] should be at position 2/OFF to enable 64 GB eMMC
194a60a311cSBiju Das	 * SW1[2] should be at position 3/ON to enable uSD card CN3
195a60a311cSBiju Das	 */
196a60a311cSBiju Das	sd0-dev-sel-hog {
197a60a311cSBiju Das		gpio-hog;
198a60a311cSBiju Das		gpios = <RZG2L_GPIO(41, 1) GPIO_ACTIVE_HIGH>;
199a60a311cSBiju Das		output-high;
200a60a311cSBiju Das		line-name = "sd0_dev_sel";
201a60a311cSBiju Das	};
202a60a311cSBiju Das
203a60a311cSBiju Das	sdhi0_emmc_pins: sd0emmc {
204a60a311cSBiju Das		sd0_emmc_data {
205a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3",
206a60a311cSBiju Das			       "SD0_DATA4", "SD0_DATA5", "SD0_DATA6", "SD0_DATA7";
207a60a311cSBiju Das			power-source = <1800>;
208a60a311cSBiju Das		};
209a60a311cSBiju Das
210a60a311cSBiju Das		sd0_emmc_ctrl {
211a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
212a60a311cSBiju Das			power-source = <1800>;
213a60a311cSBiju Das		};
214a60a311cSBiju Das
215a60a311cSBiju Das		sd0_emmc_rst {
216a60a311cSBiju Das			pins = "SD0_RST#";
217a60a311cSBiju Das			power-source = <1800>;
218a60a311cSBiju Das		};
219a60a311cSBiju Das	};
220a60a311cSBiju Das
221a60a311cSBiju Das	sdhi0_pins: sd0 {
222a60a311cSBiju Das		sd0_data {
223a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
224a60a311cSBiju Das			power-source = <3300>;
225a60a311cSBiju Das		};
226a60a311cSBiju Das
227a60a311cSBiju Das		sd0_ctrl {
228a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
229a60a311cSBiju Das			power-source = <3300>;
230a60a311cSBiju Das		};
231a60a311cSBiju Das
232a60a311cSBiju Das		sd0_mux {
233a60a311cSBiju Das			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
234a60a311cSBiju Das		};
235a60a311cSBiju Das	};
236a60a311cSBiju Das
237a60a311cSBiju Das	sdhi0_pins_uhs: sd0_uhs {
238a60a311cSBiju Das		sd0_data_uhs {
239a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
240a60a311cSBiju Das			power-source = <1800>;
241a60a311cSBiju Das		};
242a60a311cSBiju Das
243a60a311cSBiju Das		sd0_ctrl_uhs {
244a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
245a60a311cSBiju Das			power-source = <1800>;
246a60a311cSBiju Das		};
247a60a311cSBiju Das
248a60a311cSBiju Das		sd0_mux_uhs {
249a60a311cSBiju Das			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
250a60a311cSBiju Das		};
251a60a311cSBiju Das	};
252a60a311cSBiju Das};
253a60a311cSBiju Das
254a60a311cSBiju Das#if SDHI
255a60a311cSBiju Das&sdhi0 {
256a60a311cSBiju Das	pinctrl-0 = <&sdhi0_pins>;
257a60a311cSBiju Das	pinctrl-1 = <&sdhi0_pins_uhs>;
258a60a311cSBiju Das	pinctrl-names = "default", "state_uhs";
259a60a311cSBiju Das
260a60a311cSBiju Das	vmmc-supply = <&reg_3p3v>;
261a60a311cSBiju Das	vqmmc-supply = <&vccq_sdhi0>;
262a60a311cSBiju Das	bus-width = <4>;
263a60a311cSBiju Das	sd-uhs-sdr50;
264a60a311cSBiju Das	sd-uhs-sdr104;
265a60a311cSBiju Das	status = "okay";
266a60a311cSBiju Das};
267a60a311cSBiju Das#endif
268a60a311cSBiju Das
269a60a311cSBiju Das#if EMMC
270a60a311cSBiju Das&sdhi0 {
271a60a311cSBiju Das	pinctrl-0 = <&sdhi0_emmc_pins>;
272a60a311cSBiju Das	pinctrl-1 = <&sdhi0_emmc_pins>;
273a60a311cSBiju Das	pinctrl-names = "default", "state_uhs";
274a60a311cSBiju Das
275a60a311cSBiju Das	vmmc-supply = <&reg_3p3v>;
276a60a311cSBiju Das	vqmmc-supply = <&reg_1p8v>;
277a60a311cSBiju Das	bus-width = <8>;
278a60a311cSBiju Das	mmc-hs200-1_8v;
279a60a311cSBiju Das	non-removable;
280a60a311cSBiju Das	fixed-emmc-driver-type = <1>;
281a60a311cSBiju Das	status = "okay";
282a60a311cSBiju Das};
283a60a311cSBiju Das#endif
284