155c68261SLad Prabhakar// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
255c68261SLad Prabhakar/*
3f91c4c74SBiju Das * Device Tree Source for the RZ/{G2L,V2L} 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>
9ffd88241SLad Prabhakar#include <dt-bindings/interrupt-controller/irqc-rzg2l.h>
1003f7d78eSLad Prabhakar#include <dt-bindings/pinctrl/rzg2l-pinctrl.h>
1103f7d78eSLad Prabhakar
12a60a311cSBiju Das/* SW1[2] should be at position 2/OFF to enable 64 GB eMMC */
13a60a311cSBiju Das#define EMMC	1
14a60a311cSBiju Das
15a60a311cSBiju Das/*
16a60a311cSBiju Das * To enable uSD card on CN3,
17a60a311cSBiju Das * SW1[2] should be at position 3/ON.
18a60a311cSBiju Das * Disable eMMC by setting "#define EMMC	0" above.
19a60a311cSBiju Das */
20a60a311cSBiju Das#define SDHI	(!EMMC)
21a60a311cSBiju Das
2255c68261SLad Prabhakar/ {
23361b0dcbSBiju Das	aliases {
24361b0dcbSBiju Das		ethernet0 = &eth0;
25361b0dcbSBiju Das		ethernet1 = &eth1;
26361b0dcbSBiju Das	};
27361b0dcbSBiju Das
28361b0dcbSBiju Das	chosen {
29361b0dcbSBiju Das		bootargs = "ignore_loglevel rw root=/dev/nfs ip=on";
30361b0dcbSBiju Das	};
31361b0dcbSBiju Das
3255c68261SLad Prabhakar	memory@48000000 {
3355c68261SLad Prabhakar		device_type = "memory";
3455c68261SLad Prabhakar		/* first 128MB is reserved for secure area. */
3555c68261SLad Prabhakar		reg = <0x0 0x48000000 0x0 0x78000000>;
3655c68261SLad Prabhakar	};
37a60a311cSBiju Das
385cf12ac9SGeert Uytterhoeven	reg_1p8v: regulator-1p8v {
39a60a311cSBiju Das		compatible = "regulator-fixed";
40a60a311cSBiju Das		regulator-name = "fixed-1.8V";
41a60a311cSBiju Das		regulator-min-microvolt = <1800000>;
42a60a311cSBiju Das		regulator-max-microvolt = <1800000>;
43a60a311cSBiju Das		regulator-boot-on;
44a60a311cSBiju Das		regulator-always-on;
45a60a311cSBiju Das	};
46a60a311cSBiju Das
475cf12ac9SGeert Uytterhoeven	reg_3p3v: regulator-3p3v {
48a60a311cSBiju Das		compatible = "regulator-fixed";
49a60a311cSBiju Das		regulator-name = "fixed-3.3V";
50a60a311cSBiju Das		regulator-min-microvolt = <3300000>;
51a60a311cSBiju Das		regulator-max-microvolt = <3300000>;
52a60a311cSBiju Das		regulator-boot-on;
53a60a311cSBiju Das		regulator-always-on;
54a60a311cSBiju Das	};
55a60a311cSBiju Das
56d563f4baSBiju Das	reg_1p1v: regulator-vdd-core {
57d563f4baSBiju Das		compatible = "regulator-fixed";
58d563f4baSBiju Das		regulator-name = "fixed-1.1V";
59d563f4baSBiju Das		regulator-min-microvolt = <1100000>;
60d563f4baSBiju Das		regulator-max-microvolt = <1100000>;
61d563f4baSBiju Das		regulator-boot-on;
62d563f4baSBiju Das		regulator-always-on;
63d563f4baSBiju Das	};
64d563f4baSBiju Das
65a60a311cSBiju Das	vccq_sdhi0: regulator-vccq-sdhi0 {
66a60a311cSBiju Das		compatible = "regulator-gpio";
67a60a311cSBiju Das
68a60a311cSBiju Das		regulator-name = "SDHI0 VccQ";
69a60a311cSBiju Das		regulator-min-microvolt = <1800000>;
70a60a311cSBiju Das		regulator-max-microvolt = <3300000>;
71a60a311cSBiju Das		states = <3300000 1>, <1800000 0>;
72a60a311cSBiju Das		regulator-boot-on;
73a60a311cSBiju Das		gpios = <&pinctrl RZG2L_GPIO(39, 0) GPIO_ACTIVE_HIGH>;
74a60a311cSBiju Das		regulator-always-on;
75a60a311cSBiju Das	};
7655c68261SLad Prabhakar};
7755c68261SLad Prabhakar
7803f7d78eSLad Prabhakar&adc {
7903f7d78eSLad Prabhakar	pinctrl-0 = <&adc_pins>;
8003f7d78eSLad Prabhakar	pinctrl-names = "default";
8103f7d78eSLad Prabhakar	status = "okay";
8203f7d78eSLad Prabhakar
8303f7d78eSLad Prabhakar	/delete-node/ channel@6;
8403f7d78eSLad Prabhakar	/delete-node/ channel@7;
8503f7d78eSLad Prabhakar};
8603f7d78eSLad Prabhakar
87361b0dcbSBiju Das&eth0 {
88361b0dcbSBiju Das	pinctrl-0 = <&eth0_pins>;
89361b0dcbSBiju Das	pinctrl-names = "default";
90361b0dcbSBiju Das	phy-handle = <&phy0>;
91361b0dcbSBiju Das	phy-mode = "rgmii-id";
92361b0dcbSBiju Das	status = "okay";
93361b0dcbSBiju Das
94361b0dcbSBiju Das	phy0: ethernet-phy@7 {
95361b0dcbSBiju Das		compatible = "ethernet-phy-id0022.1640",
96361b0dcbSBiju Das			     "ethernet-phy-ieee802.3-c22";
97361b0dcbSBiju Das		reg = <7>;
98ffd88241SLad Prabhakar		interrupt-parent = <&irqc>;
99ffd88241SLad Prabhakar		interrupts = <RZG2L_IRQ2 IRQ_TYPE_LEVEL_LOW>;
100361b0dcbSBiju Das		rxc-skew-psec = <2400>;
101361b0dcbSBiju Das		txc-skew-psec = <2400>;
102361b0dcbSBiju Das		rxdv-skew-psec = <0>;
103*db673457SChris Paterson		txen-skew-psec = <0>;
104361b0dcbSBiju Das		rxd0-skew-psec = <0>;
105361b0dcbSBiju Das		rxd1-skew-psec = <0>;
106361b0dcbSBiju Das		rxd2-skew-psec = <0>;
107361b0dcbSBiju Das		rxd3-skew-psec = <0>;
108361b0dcbSBiju Das		txd0-skew-psec = <0>;
109361b0dcbSBiju Das		txd1-skew-psec = <0>;
110361b0dcbSBiju Das		txd2-skew-psec = <0>;
111361b0dcbSBiju Das		txd3-skew-psec = <0>;
112361b0dcbSBiju Das	};
113361b0dcbSBiju Das};
114361b0dcbSBiju Das
115361b0dcbSBiju Das&eth1 {
116361b0dcbSBiju Das	pinctrl-0 = <&eth1_pins>;
117361b0dcbSBiju Das	pinctrl-names = "default";
118361b0dcbSBiju Das	phy-handle = <&phy1>;
119361b0dcbSBiju Das	phy-mode = "rgmii-id";
120361b0dcbSBiju Das	status = "okay";
121361b0dcbSBiju Das
122361b0dcbSBiju Das	phy1: ethernet-phy@7 {
123361b0dcbSBiju Das		compatible = "ethernet-phy-id0022.1640",
124361b0dcbSBiju Das			     "ethernet-phy-ieee802.3-c22";
125361b0dcbSBiju Das		reg = <7>;
126ffd88241SLad Prabhakar		interrupt-parent = <&irqc>;
127ffd88241SLad Prabhakar		interrupts = <RZG2L_IRQ3 IRQ_TYPE_LEVEL_LOW>;
128361b0dcbSBiju Das		rxc-skew-psec = <2400>;
129361b0dcbSBiju Das		txc-skew-psec = <2400>;
130361b0dcbSBiju Das		rxdv-skew-psec = <0>;
131*db673457SChris Paterson		txen-skew-psec = <0>;
132361b0dcbSBiju Das		rxd0-skew-psec = <0>;
133361b0dcbSBiju Das		rxd1-skew-psec = <0>;
134361b0dcbSBiju Das		rxd2-skew-psec = <0>;
135361b0dcbSBiju Das		rxd3-skew-psec = <0>;
136361b0dcbSBiju Das		txd0-skew-psec = <0>;
137361b0dcbSBiju Das		txd1-skew-psec = <0>;
138361b0dcbSBiju Das		txd2-skew-psec = <0>;
139361b0dcbSBiju Das		txd3-skew-psec = <0>;
140361b0dcbSBiju Das	};
141361b0dcbSBiju Das};
142361b0dcbSBiju Das
14355c68261SLad Prabhakar&extal_clk {
14455c68261SLad Prabhakar	clock-frequency = <24000000>;
14555c68261SLad Prabhakar};
14603f7d78eSLad Prabhakar
147d563f4baSBiju Das&gpu {
148d563f4baSBiju Das	mali-supply = <&reg_1p1v>;
149d563f4baSBiju Das};
150d563f4baSBiju Das
15100d071e2SBiju Das&ostm1 {
15200d071e2SBiju Das	status = "okay";
15300d071e2SBiju Das};
15400d071e2SBiju Das
15500d071e2SBiju Das&ostm2 {
15600d071e2SBiju Das	status = "okay";
15700d071e2SBiju Das};
15800d071e2SBiju Das
15903f7d78eSLad Prabhakar&pinctrl {
16003f7d78eSLad Prabhakar	adc_pins: adc {
16103f7d78eSLad Prabhakar		pinmux = <RZG2L_PORT_PINMUX(9, 0, 2)>; /* ADC_TRG */
16203f7d78eSLad Prabhakar	};
163a60a311cSBiju Das
164361b0dcbSBiju Das	eth0_pins: eth0 {
165361b0dcbSBiju Das		pinmux = <RZG2L_PORT_PINMUX(28, 1, 1)>, /* ET0_LINKSTA */
166361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(27, 1, 1)>, /* ET0_MDC */
167361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(28, 0, 1)>, /* ET0_MDIO */
168361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(20, 0, 1)>, /* ET0_TXC */
169361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(20, 1, 1)>, /* ET0_TX_CTL */
170361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(20, 2, 1)>, /* ET0_TXD0 */
171361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(21, 0, 1)>, /* ET0_TXD1 */
172361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(21, 1, 1)>, /* ET0_TXD2 */
173361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(22, 0, 1)>, /* ET0_TXD3 */
174361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(24, 0, 1)>, /* ET0_RXC */
175361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(24, 1, 1)>, /* ET0_RX_CTL */
176361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(25, 0, 1)>, /* ET0_RXD0 */
177361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(25, 1, 1)>, /* ET0_RXD1 */
178361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(26, 0, 1)>, /* ET0_RXD2 */
179ffd88241SLad Prabhakar			 <RZG2L_PORT_PINMUX(26, 1, 1)>, /* ET0_RXD3 */
180ffd88241SLad Prabhakar			 <RZG2L_PORT_PINMUX(1, 0, 1)>;  /* IRQ2 */
181361b0dcbSBiju Das	};
182361b0dcbSBiju Das
183361b0dcbSBiju Das	eth1_pins: eth1 {
184361b0dcbSBiju Das		pinmux = <RZG2L_PORT_PINMUX(37, 2, 1)>, /* ET1_LINKSTA */
185361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(37, 0, 1)>, /* ET1_MDC */
186361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(37, 1, 1)>, /* ET1_MDIO */
187361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(29, 0, 1)>, /* ET1_TXC */
188361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(29, 1, 1)>, /* ET1_TX_CTL */
189361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(30, 0, 1)>, /* ET1_TXD0 */
190361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(30, 1, 1)>, /* ET1_TXD1 */
191361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(31, 0, 1)>, /* ET1_TXD2 */
192361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(31, 1, 1)>, /* ET1_TXD3 */
193361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(33, 1, 1)>, /* ET1_RXC */
194361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(34, 0, 1)>, /* ET1_RX_CTL */
195361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(34, 1, 1)>, /* ET1_RXD0 */
196361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(35, 0, 1)>, /* ET1_RXD1 */
197361b0dcbSBiju Das			 <RZG2L_PORT_PINMUX(35, 1, 1)>, /* ET1_RXD2 */
198ffd88241SLad Prabhakar			 <RZG2L_PORT_PINMUX(36, 0, 1)>, /* ET1_RXD3 */
199ffd88241SLad Prabhakar			 <RZG2L_PORT_PINMUX(1, 1, 1)>;  /* IRQ3 */
200361b0dcbSBiju Das	};
201361b0dcbSBiju Das
202a60a311cSBiju Das	gpio-sd0-pwr-en-hog {
203a60a311cSBiju Das		gpio-hog;
204a60a311cSBiju Das		gpios = <RZG2L_GPIO(4, 1) GPIO_ACTIVE_HIGH>;
205a60a311cSBiju Das		output-high;
206a60a311cSBiju Das		line-name = "gpio_sd0_pwr_en";
20703f7d78eSLad Prabhakar	};
208a60a311cSBiju Das
209c81bd70fSLad Prabhakar	qspi0_pins: qspi0 {
210c81bd70fSLad Prabhakar		qspi0-data {
211c81bd70fSLad Prabhakar			pins = "QSPI0_IO0", "QSPI0_IO1", "QSPI0_IO2", "QSPI0_IO3";
212c81bd70fSLad Prabhakar			power-source = <1800>;
213c81bd70fSLad Prabhakar		};
214c81bd70fSLad Prabhakar
215c81bd70fSLad Prabhakar		qspi0-ctrl {
216c81bd70fSLad Prabhakar			pins = "QSPI0_SPCLK", "QSPI0_SSL", "QSPI_RESET#";
217c81bd70fSLad Prabhakar			power-source = <1800>;
218c81bd70fSLad Prabhakar		};
219c81bd70fSLad Prabhakar	};
220c81bd70fSLad Prabhakar
221a60a311cSBiju Das	/*
222a60a311cSBiju Das	 * SD0 device selection is XOR between GPIO_SD0_DEV_SEL and SW1[2]
223a60a311cSBiju Das	 * The below switch logic can be used to select the device between
224a60a311cSBiju Das	 * eMMC and microSD, after setting GPIO_SD0_DEV_SEL to high in DT.
225a60a311cSBiju Das	 * SW1[2] should be at position 2/OFF to enable 64 GB eMMC
226a60a311cSBiju Das	 * SW1[2] should be at position 3/ON to enable uSD card CN3
227a60a311cSBiju Das	 */
228a60a311cSBiju Das	sd0-dev-sel-hog {
229a60a311cSBiju Das		gpio-hog;
230a60a311cSBiju Das		gpios = <RZG2L_GPIO(41, 1) GPIO_ACTIVE_HIGH>;
231a60a311cSBiju Das		output-high;
232a60a311cSBiju Das		line-name = "sd0_dev_sel";
233a60a311cSBiju Das	};
234a60a311cSBiju Das
235a60a311cSBiju Das	sdhi0_emmc_pins: sd0emmc {
236a60a311cSBiju Das		sd0_emmc_data {
237a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3",
238a60a311cSBiju Das			       "SD0_DATA4", "SD0_DATA5", "SD0_DATA6", "SD0_DATA7";
239a60a311cSBiju Das			power-source = <1800>;
240a60a311cSBiju Das		};
241a60a311cSBiju Das
242a60a311cSBiju Das		sd0_emmc_ctrl {
243a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
244a60a311cSBiju Das			power-source = <1800>;
245a60a311cSBiju Das		};
246a60a311cSBiju Das
247a60a311cSBiju Das		sd0_emmc_rst {
248a60a311cSBiju Das			pins = "SD0_RST#";
249a60a311cSBiju Das			power-source = <1800>;
250a60a311cSBiju Das		};
251a60a311cSBiju Das	};
252a60a311cSBiju Das
253a60a311cSBiju Das	sdhi0_pins: sd0 {
254a60a311cSBiju Das		sd0_data {
255a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
256a60a311cSBiju Das			power-source = <3300>;
257a60a311cSBiju Das		};
258a60a311cSBiju Das
259a60a311cSBiju Das		sd0_ctrl {
260a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
261a60a311cSBiju Das			power-source = <3300>;
262a60a311cSBiju Das		};
263a60a311cSBiju Das
264a60a311cSBiju Das		sd0_mux {
265a60a311cSBiju Das			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
266a60a311cSBiju Das		};
267a60a311cSBiju Das	};
268a60a311cSBiju Das
269a60a311cSBiju Das	sdhi0_pins_uhs: sd0_uhs {
270a60a311cSBiju Das		sd0_data_uhs {
271a60a311cSBiju Das			pins = "SD0_DATA0", "SD0_DATA1", "SD0_DATA2", "SD0_DATA3";
272a60a311cSBiju Das			power-source = <1800>;
273a60a311cSBiju Das		};
274a60a311cSBiju Das
275a60a311cSBiju Das		sd0_ctrl_uhs {
276a60a311cSBiju Das			pins = "SD0_CLK", "SD0_CMD";
277a60a311cSBiju Das			power-source = <1800>;
278a60a311cSBiju Das		};
279a60a311cSBiju Das
280a60a311cSBiju Das		sd0_mux_uhs {
281a60a311cSBiju Das			pinmux = <RZG2L_PORT_PINMUX(47, 0, 2)>; /* SD0_CD */
282a60a311cSBiju Das		};
283a60a311cSBiju Das	};
284a60a311cSBiju Das};
285a60a311cSBiju Das
286c81bd70fSLad Prabhakar&sbc {
287c81bd70fSLad Prabhakar	pinctrl-0 = <&qspi0_pins>;
288c81bd70fSLad Prabhakar	pinctrl-names = "default";
289c81bd70fSLad Prabhakar	status = "okay";
290c81bd70fSLad Prabhakar
291c81bd70fSLad Prabhakar	flash@0 {
292c81bd70fSLad Prabhakar		compatible = "micron,mt25qu512a", "jedec,spi-nor";
293c81bd70fSLad Prabhakar		reg = <0>;
294c81bd70fSLad Prabhakar		m25p,fast-read;
295c81bd70fSLad Prabhakar		spi-max-frequency = <50000000>;
296c81bd70fSLad Prabhakar		spi-rx-bus-width = <4>;
297c81bd70fSLad Prabhakar
298c81bd70fSLad Prabhakar		partitions {
299c81bd70fSLad Prabhakar			compatible = "fixed-partitions";
300c81bd70fSLad Prabhakar			#address-cells = <1>;
301c81bd70fSLad Prabhakar			#size-cells = <1>;
302c81bd70fSLad Prabhakar
303c81bd70fSLad Prabhakar			boot@0 {
304c81bd70fSLad Prabhakar				reg = <0x00000000 0x2000000>;
305c81bd70fSLad Prabhakar				read-only;
306c81bd70fSLad Prabhakar			};
307c81bd70fSLad Prabhakar			user@2000000 {
308c81bd70fSLad Prabhakar				reg = <0x2000000 0x2000000>;
309c81bd70fSLad Prabhakar			};
310c81bd70fSLad Prabhakar		};
311c81bd70fSLad Prabhakar	};
312c81bd70fSLad Prabhakar};
313c81bd70fSLad Prabhakar
314a60a311cSBiju Das#if SDHI
315a60a311cSBiju Das&sdhi0 {
316a60a311cSBiju Das	pinctrl-0 = <&sdhi0_pins>;
317a60a311cSBiju Das	pinctrl-1 = <&sdhi0_pins_uhs>;
318a60a311cSBiju Das	pinctrl-names = "default", "state_uhs";
319a60a311cSBiju Das
320a60a311cSBiju Das	vmmc-supply = <&reg_3p3v>;
321a60a311cSBiju Das	vqmmc-supply = <&vccq_sdhi0>;
322a60a311cSBiju Das	bus-width = <4>;
323a60a311cSBiju Das	sd-uhs-sdr50;
324a60a311cSBiju Das	sd-uhs-sdr104;
325a60a311cSBiju Das	status = "okay";
326a60a311cSBiju Das};
327a60a311cSBiju Das#endif
328a60a311cSBiju Das
329a60a311cSBiju Das#if EMMC
330a60a311cSBiju Das&sdhi0 {
331a60a311cSBiju Das	pinctrl-0 = <&sdhi0_emmc_pins>;
332a60a311cSBiju Das	pinctrl-1 = <&sdhi0_emmc_pins>;
333a60a311cSBiju Das	pinctrl-names = "default", "state_uhs";
334a60a311cSBiju Das
335a60a311cSBiju Das	vmmc-supply = <&reg_3p3v>;
336a60a311cSBiju Das	vqmmc-supply = <&reg_1p8v>;
337a60a311cSBiju Das	bus-width = <8>;
338a60a311cSBiju Das	mmc-hs200-1_8v;
339a60a311cSBiju Das	non-removable;
340a60a311cSBiju Das	fixed-emmc-driver-type = <1>;
341a60a311cSBiju Das	status = "okay";
342a60a311cSBiju Das};
343a60a311cSBiju Das#endif
34444c2d2c2SBiju Das
34544c2d2c2SBiju Das&wdt0 {
34644c2d2c2SBiju Das	status = "okay";
34744c2d2c2SBiju Das	timeout-sec = <60>;
34844c2d2c2SBiju Das};
34944c2d2c2SBiju Das
35044c2d2c2SBiju Das&wdt1 {
35144c2d2c2SBiju Das	status = "okay";
35244c2d2c2SBiju Das	timeout-sec = <60>;
35344c2d2c2SBiju Das};
354