1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Device Tree Source for the RZA2MEVB board
4 *
5 * Copyright (C) 2018 Renesas Electronics
6 *
7 * As upstream Linux does not support XIP, it cannot run in 8 MiB of HyperRAM.
8 * Hence the 64 MiB of SDRAM on the sub-board needs to be enabled, which has
9 * the following ramifications:
10 *   - SCIF4 connected to the on-board USB-serial can no longer be used as the
11 *     serial console,
12 *   - Instead, SCIF2 is used as the serial console, by connecting a 3.3V TTL
13 *     USB-to-Serial adapter to the CMOS camera connector:
14 *       - RXD = CN17-9,
15 *       - TXD = CN17-10,
16 *       - GND = CN17-2 or CN17-17,
17 *   - The first Ethernet channel can no longer be used,
18 *   - USB Channel 1 loses the overcurrent input signal.
19 *
20 * Please make sure your sub-board matches the following switch settings:
21 *
22 *           SW6                SW6-1 set to SDRAM
23 *  ON                          SW6-2 set to Audio
24 * +---------------------+      SW6-3 set to DRP
25 * | =   =   = = =       |      SW6-4 set to CEU
26 * |   =   =             |      SW6-5 set to Ether2
27 * | 1 2 3 4 5 6 7 8 9 0 |      SW6-6 set to VDC6
28 * +---------------------+      SW6-7 set to VDC6
29 */
30
31/dts-v1/;
32#include "r7s9210.dtsi"
33#include <dt-bindings/gpio/gpio.h>
34#include <dt-bindings/input/input.h>
35#include <dt-bindings/pinctrl/r7s9210-pinctrl.h>
36
37/ {
38	model = "RZA2MEVB";
39	compatible = "renesas,rza2mevb", "renesas,r7s9210";
40
41	aliases {
42		serial0 = &scif2;
43		ethernet0 = &ether1;
44	};
45
46	chosen {
47		bootargs = "ignore_loglevel";
48		stdout-path = "serial0:115200n8";
49	};
50
51	keyboard {
52		compatible = "gpio-keys";
53
54		pinctrl-names = "default";
55		pinctrl-0 = <&keyboard_pins>;
56
57		key-3 {
58			interrupt-parent = <&irqc>;
59			interrupts = <0 IRQ_TYPE_EDGE_BOTH>;
60			linux,code = <KEY_3>;
61			label = "SW3";
62			wakeup-source;
63		};
64	};
65
66	lbsc {
67		#address-cells = <1>;
68		#size-cells = <1>;
69	};
70
71	leds {
72		compatible = "gpio-leds";
73
74		red {
75			gpios = <&pinctrl RZA2_PIN(PORT6, 0) GPIO_ACTIVE_HIGH>;
76		};
77		green {
78			gpios = <&pinctrl RZA2_PIN(PORTC, 1) GPIO_ACTIVE_HIGH>;
79		};
80	};
81
82	memory@c000000 {
83		device_type = "memory";
84		reg = <0x0c000000 0x04000000>;	/* SDRAM */
85	};
86};
87
88&ehci0 {
89	status = "okay";
90};
91
92&ehci1 {
93	status = "okay";
94};
95
96&ether1 {
97	pinctrl-names = "default";
98	pinctrl-0 = <&eth1_pins>;
99	status = "okay";
100	renesas,no-ether-link;
101	phy-handle = <&phy1>;
102	phy1: ethernet-phy@1 {
103		reg = <0>;
104	};
105};
106
107/* EXTAL */
108&extal_clk {
109	clock-frequency = <24000000>;	/* 24MHz */
110};
111
112/* High resolution System tick timers */
113&ostm0 {
114	status = "okay";
115};
116
117&ostm1 {
118	status = "okay";
119};
120
121&pinctrl {
122	eth0_pins: eth0 {
123		pinmux = <RZA2_PINMUX(PORTE, 0, 7)>, /* REF50CK0 */
124			 <RZA2_PINMUX(PORT6, 1, 7)>, /* RMMI0_TXDEN */
125			 <RZA2_PINMUX(PORT6, 2, 7)>, /* RMII0_TXD0 */
126			 <RZA2_PINMUX(PORT6, 3, 7)>, /* RMII0_TXD1 */
127			 <RZA2_PINMUX(PORTE, 4, 7)>, /* RMII0_CRSDV */
128			 <RZA2_PINMUX(PORTE, 1, 7)>, /* RMII0_RXD0 */
129			 <RZA2_PINMUX(PORTE, 2, 7)>, /* RMII0_RXD1 */
130			 <RZA2_PINMUX(PORTE, 3, 7)>, /* RMII0_RXER */
131			 <RZA2_PINMUX(PORTE, 5, 1)>, /* ET0_MDC */
132			 <RZA2_PINMUX(PORTE, 6, 1)>, /* ET0_MDIO */
133			 <RZA2_PINMUX(PORTL, 0, 5)>; /* IRQ4 */
134	};
135
136	eth1_pins: eth1 {
137		pinmux = <RZA2_PINMUX(PORTK, 3, 7)>, /* REF50CK1 */
138			 <RZA2_PINMUX(PORTK, 0, 7)>, /* RMMI1_TXDEN */
139			 <RZA2_PINMUX(PORTK, 1, 7)>, /* RMII1_TXD0 */
140			 <RZA2_PINMUX(PORTK, 2, 7)>, /* RMII1_TXD1 */
141			 <RZA2_PINMUX(PORT3, 2, 7)>, /* RMII1_CRSDV */
142			 <RZA2_PINMUX(PORTK, 4, 7)>, /* RMII1_RXD0 */
143			 <RZA2_PINMUX(PORT3, 5, 7)>, /* RMII1_RXD1 */
144			 <RZA2_PINMUX(PORT3, 1, 7)>, /* RMII1_RXER */
145			 <RZA2_PINMUX(PORT3, 3, 1)>, /* ET1_MDC */
146			 <RZA2_PINMUX(PORT3, 4, 1)>, /* ET1_MDIO */
147			 <RZA2_PINMUX(PORTL, 1, 5)>; /* IRQ5 */
148	};
149
150	keyboard_pins: keyboard {
151		pinmux = <RZA2_PINMUX(PORTJ, 1, 6)>;	/* IRQ0 */
152	};
153
154	/* Serial Console */
155	scif2_pins: serial2 {
156		pinmux = <RZA2_PINMUX(PORTE, 2, 3)>,	/* TxD2 */
157			 <RZA2_PINMUX(PORTE, 1, 3)>;	/* RxD2 */
158	};
159
160	sdhi0_pins: sdhi0 {
161		pinmux = <RZA2_PINMUX(PORT5, 0, 3)>,	/* SD0_CD */
162			 <RZA2_PINMUX(PORT5, 1, 3)>;	/* SD0_WP */
163	};
164
165	sdhi1_pins: sdhi1 {
166		pinmux = <RZA2_PINMUX(PORT5, 4, 3)>,	/* SD1_CD */
167			 <RZA2_PINMUX(PORT5, 5, 3)>;	/* SD1_WP */
168	};
169
170	usb0_pins: usb0 {
171		pinmux = <RZA2_PINMUX(PORT5, 2, 3)>,	/* VBUSIN0 */
172			 <RZA2_PINMUX(PORTC, 6, 1)>,	/* VBUSEN0 */
173			 <RZA2_PINMUX(PORTC, 7, 1)>;	/* OVRCUR0 */
174	};
175
176	usb1_pins: usb1 {
177		pinmux = <RZA2_PINMUX(PORTC, 0, 1)>,	/* VBUSIN1 */
178			 <RZA2_PINMUX(PORTC, 5, 1)>;	/* VBUSEN1 */
179	};
180};
181
182/* RTC_X1 */
183&rtc_x1_clk {
184	clock-frequency = <32768>;
185};
186
187/* Serial Console */
188&scif2 {
189	pinctrl-names = "default";
190	pinctrl-0 = <&scif2_pins>;
191
192	status = "okay";
193};
194
195&sdhi0 {
196	pinctrl-names = "default";
197	pinctrl-0 = <&sdhi0_pins>;
198	bus-width = <4>;
199	status = "okay";
200};
201
202&sdhi1 {
203	pinctrl-names = "default";
204	pinctrl-0 = <&sdhi1_pins>;
205	bus-width = <4>;
206	status = "okay";
207};
208
209/* USB-0 as Host */
210&usb2_phy0 {
211	pinctrl-names = "default";
212	pinctrl-0 = <&usb0_pins>;
213	dr_mode = "host";	/* Requires JP3 to be fitted */
214	status = "okay";
215};
216
217/* USB-1 as Host */
218&usb2_phy1 {
219	pinctrl-names = "default";
220	pinctrl-0 = <&usb1_pins>;
221	dr_mode = "host";
222	status = "okay";
223};
224
225/* USB_X1 */
226&usb_x1_clk {
227	clock-frequency = <48000000>;
228};
229