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
13300d071e2SBiju Das&ostm1 {
13400d071e2SBiju Das	status = "okay";
13500d071e2SBiju Das};
13600d071e2SBiju Das
13700d071e2SBiju Das&ostm2 {
13800d071e2SBiju Das	status = "okay";
13900d071e2SBiju Das};
14000d071e2SBiju 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
189*c81bd70fSLad Prabhakar	qspi0_pins: qspi0 {
190*c81bd70fSLad Prabhakar		qspi0-data {
191*c81bd70fSLad Prabhakar			pins = "QSPI0_IO0", "QSPI0_IO1", "QSPI0_IO2", "QSPI0_IO3";
192*c81bd70fSLad Prabhakar			power-source = <1800>;
193*c81bd70fSLad Prabhakar		};
194*c81bd70fSLad Prabhakar
195*c81bd70fSLad Prabhakar		qspi0-ctrl {
196*c81bd70fSLad Prabhakar			pins = "QSPI0_SPCLK", "QSPI0_SSL", "QSPI_RESET#";
197*c81bd70fSLad Prabhakar			power-source = <1800>;
198*c81bd70fSLad Prabhakar		};
199*c81bd70fSLad Prabhakar	};
200*c81bd70fSLad Prabhakar
201a60a311cSBiju Das	/*
202a60a311cSBiju Das	 * SD0 device selection is XOR between GPIO_SD0_DEV_SEL and SW1[2]
203a60a311cSBiju Das	 * The below switch logic can be used to select the device between
204a60a311cSBiju Das	 * eMMC and microSD, after setting GPIO_SD0_DEV_SEL to high in DT.
205a60a311cSBiju Das	 * SW1[2] should be at position 2/OFF to enable 64 GB eMMC
206a60a311cSBiju Das	 * SW1[2] should be at position 3/ON to enable uSD card CN3
207a60a311cSBiju Das	 */
208a60a311cSBiju Das	sd0-dev-sel-hog {
209a60a311cSBiju Das		gpio-hog;
210a60a311cSBiju Das		gpios = <RZG2L_GPIO(41, 1) GPIO_ACTIVE_HIGH>;
211a60a311cSBiju Das		output-high;
212a60a311cSBiju Das		line-name = "sd0_dev_sel";
213a60a311cSBiju Das	};
214a60a311cSBiju Das
215a60a311cSBiju Das	sdhi0_emmc_pins: sd0emmc {
216a60a311cSBiju Das		sd0_emmc_data {
217a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3",
218a60a311cSBiju Das			       "SD0_DATA4", "SD0_DATA5", "SD0_DATA6", "SD0_DATA7";
219a60a311cSBiju Das			power-source = <1800>;
220a60a311cSBiju Das		};
221a60a311cSBiju Das
222a60a311cSBiju Das		sd0_emmc_ctrl {
223a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
224a60a311cSBiju Das			power-source = <1800>;
225a60a311cSBiju Das		};
226a60a311cSBiju Das
227a60a311cSBiju Das		sd0_emmc_rst {
228a60a311cSBiju Das			pins = "SD0_RST#";
229a60a311cSBiju Das			power-source = <1800>;
230a60a311cSBiju Das		};
231a60a311cSBiju Das	};
232a60a311cSBiju Das
233a60a311cSBiju Das	sdhi0_pins: sd0 {
234a60a311cSBiju Das		sd0_data {
235a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
236a60a311cSBiju Das			power-source = <3300>;
237a60a311cSBiju Das		};
238a60a311cSBiju Das
239a60a311cSBiju Das		sd0_ctrl {
240a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
241a60a311cSBiju Das			power-source = <3300>;
242a60a311cSBiju Das		};
243a60a311cSBiju Das
244a60a311cSBiju Das		sd0_mux {
245a60a311cSBiju Das			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
246a60a311cSBiju Das		};
247a60a311cSBiju Das	};
248a60a311cSBiju Das
249a60a311cSBiju Das	sdhi0_pins_uhs: sd0_uhs {
250a60a311cSBiju Das		sd0_data_uhs {
251a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
252a60a311cSBiju Das			power-source = <1800>;
253a60a311cSBiju Das		};
254a60a311cSBiju Das
255a60a311cSBiju Das		sd0_ctrl_uhs {
256a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
257a60a311cSBiju Das			power-source = <1800>;
258a60a311cSBiju Das		};
259a60a311cSBiju Das
260a60a311cSBiju Das		sd0_mux_uhs {
261a60a311cSBiju Das			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
262a60a311cSBiju Das		};
263a60a311cSBiju Das	};
264a60a311cSBiju Das};
265a60a311cSBiju Das
266*c81bd70fSLad Prabhakar&sbc {
267*c81bd70fSLad Prabhakar	pinctrl-0 = <&qspi0_pins>;
268*c81bd70fSLad Prabhakar	pinctrl-names = "default";
269*c81bd70fSLad Prabhakar	status = "okay";
270*c81bd70fSLad Prabhakar
271*c81bd70fSLad Prabhakar	flash@0 {
272*c81bd70fSLad Prabhakar		compatible = "micron,mt25qu512a", "jedec,spi-nor";
273*c81bd70fSLad Prabhakar		reg = <0>;
274*c81bd70fSLad Prabhakar		m25p,fast-read;
275*c81bd70fSLad Prabhakar		spi-max-frequency = <50000000>;
276*c81bd70fSLad Prabhakar		spi-rx-bus-width = <4>;
277*c81bd70fSLad Prabhakar
278*c81bd70fSLad Prabhakar		partitions {
279*c81bd70fSLad Prabhakar			compatible = "fixed-partitions";
280*c81bd70fSLad Prabhakar			#address-cells = <1>;
281*c81bd70fSLad Prabhakar			#size-cells = <1>;
282*c81bd70fSLad Prabhakar
283*c81bd70fSLad Prabhakar			boot@0 {
284*c81bd70fSLad Prabhakar				reg = <0x00000000 0x2000000>;
285*c81bd70fSLad Prabhakar				read-only;
286*c81bd70fSLad Prabhakar			};
287*c81bd70fSLad Prabhakar			user@2000000 {
288*c81bd70fSLad Prabhakar				reg = <0x2000000 0x2000000>;
289*c81bd70fSLad Prabhakar			};
290*c81bd70fSLad Prabhakar		};
291*c81bd70fSLad Prabhakar	};
292*c81bd70fSLad Prabhakar};
293*c81bd70fSLad Prabhakar
294a60a311cSBiju Das#if SDHI
295a60a311cSBiju Das&sdhi0 {
296a60a311cSBiju Das	pinctrl-0 = <&sdhi0_pins>;
297a60a311cSBiju Das	pinctrl-1 = <&sdhi0_pins_uhs>;
298a60a311cSBiju Das	pinctrl-names = "default", "state_uhs";
299a60a311cSBiju Das
300a60a311cSBiju Das	vmmc-supply = <&reg_3p3v>;
301a60a311cSBiju Das	vqmmc-supply = <&vccq_sdhi0>;
302a60a311cSBiju Das	bus-width = <4>;
303a60a311cSBiju Das	sd-uhs-sdr50;
304a60a311cSBiju Das	sd-uhs-sdr104;
305a60a311cSBiju Das	status = "okay";
306a60a311cSBiju Das};
307a60a311cSBiju Das#endif
308a60a311cSBiju Das
309a60a311cSBiju Das#if EMMC
310a60a311cSBiju Das&sdhi0 {
311a60a311cSBiju Das	pinctrl-0 = <&sdhi0_emmc_pins>;
312a60a311cSBiju Das	pinctrl-1 = <&sdhi0_emmc_pins>;
313a60a311cSBiju Das	pinctrl-names = "default", "state_uhs";
314a60a311cSBiju Das
315a60a311cSBiju Das	vmmc-supply = <&reg_3p3v>;
316a60a311cSBiju Das	vqmmc-supply = <&reg_1p8v>;
317a60a311cSBiju Das	bus-width = <8>;
318a60a311cSBiju Das	mmc-hs200-1_8v;
319a60a311cSBiju Das	non-removable;
320a60a311cSBiju Das	fixed-emmc-driver-type = <1>;
321a60a311cSBiju Das	status = "okay";
322a60a311cSBiju Das};
323a60a311cSBiju Das#endif
324