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	leds {
67		compatible = "gpio-leds";
68
69		led-red {
70			gpios = <&pinctrl RZA2_PIN(PORT6, 0) GPIO_ACTIVE_HIGH>;
71		};
72		led-green {
73			gpios = <&pinctrl RZA2_PIN(PORTC, 1) GPIO_ACTIVE_HIGH>;
74		};
75	};
76
77	memory@c000000 {
78		device_type = "memory";
79		reg = <0x0c000000 0x04000000>;	/* SDRAM */
80	};
81};
82
83&ehci0 {
84	status = "okay";
85};
86
87&ehci1 {
88	status = "okay";
89};
90
91&ether1 {
92	pinctrl-names = "default";
93	pinctrl-0 = <&eth1_pins>;
94	status = "okay";
95	renesas,no-ether-link;
96	phy-handle = <&phy1>;
97	phy1: ethernet-phy@1 {
98		compatible = "ethernet-phy-id001c.c816",
99			     "ethernet-phy-ieee802.3-c22";
100		reg = <0>;
101	};
102};
103
104/* EXTAL */
105&extal_clk {
106	clock-frequency = <24000000>;	/* 24MHz */
107};
108
109&i2c3 {
110	status = "okay";
111	clock-frequency = <400000>;
112
113	pinctrl-names = "default";
114	pinctrl-0 = <&i2c3_pins>;
115
116	eeprom@50 {
117		compatible = "renesas,r1ex24128", "atmel,24c128";
118		reg = <0x50>;
119		pagesize = <64>;
120	};
121};
122
123/* High resolution System tick timers */
124&ostm0 {
125	status = "okay";
126};
127
128&ostm1 {
129	status = "okay";
130};
131
132&pinctrl {
133	eth0_pins: eth0 {
134		pinmux = <RZA2_PINMUX(PORTE, 0, 7)>, /* REF50CK0 */
135			 <RZA2_PINMUX(PORT6, 1, 7)>, /* RMMI0_TXDEN */
136			 <RZA2_PINMUX(PORT6, 2, 7)>, /* RMII0_TXD0 */
137			 <RZA2_PINMUX(PORT6, 3, 7)>, /* RMII0_TXD1 */
138			 <RZA2_PINMUX(PORTE, 4, 7)>, /* RMII0_CRSDV */
139			 <RZA2_PINMUX(PORTE, 1, 7)>, /* RMII0_RXD0 */
140			 <RZA2_PINMUX(PORTE, 2, 7)>, /* RMII0_RXD1 */
141			 <RZA2_PINMUX(PORTE, 3, 7)>, /* RMII0_RXER */
142			 <RZA2_PINMUX(PORTE, 5, 1)>, /* ET0_MDC */
143			 <RZA2_PINMUX(PORTE, 6, 1)>, /* ET0_MDIO */
144			 <RZA2_PINMUX(PORTL, 0, 5)>; /* IRQ4 */
145	};
146
147	eth1_pins: eth1 {
148		pinmux = <RZA2_PINMUX(PORTK, 3, 7)>, /* REF50CK1 */
149			 <RZA2_PINMUX(PORTK, 0, 7)>, /* RMMI1_TXDEN */
150			 <RZA2_PINMUX(PORTK, 1, 7)>, /* RMII1_TXD0 */
151			 <RZA2_PINMUX(PORTK, 2, 7)>, /* RMII1_TXD1 */
152			 <RZA2_PINMUX(PORT3, 2, 7)>, /* RMII1_CRSDV */
153			 <RZA2_PINMUX(PORTK, 4, 7)>, /* RMII1_RXD0 */
154			 <RZA2_PINMUX(PORT3, 5, 7)>, /* RMII1_RXD1 */
155			 <RZA2_PINMUX(PORT3, 1, 7)>, /* RMII1_RXER */
156			 <RZA2_PINMUX(PORT3, 3, 1)>, /* ET1_MDC */
157			 <RZA2_PINMUX(PORT3, 4, 1)>, /* ET1_MDIO */
158			 <RZA2_PINMUX(PORTL, 1, 5)>; /* IRQ5 */
159	};
160
161	i2c3_pins: i2c3 {
162		pinmux = <RZA2_PINMUX(PORTD, 6, 1)>,	/* RIIC3SCL */
163			 <RZA2_PINMUX(PORTD, 7, 1)>;	/* RIIC3SDA */
164	};
165
166	keyboard_pins: keyboard {
167		pinmux = <RZA2_PINMUX(PORTJ, 1, 6)>;	/* IRQ0 */
168	};
169
170	/* Serial Console */
171	scif2_pins: serial2 {
172		pinmux = <RZA2_PINMUX(PORTE, 2, 3)>,	/* TxD2 */
173			 <RZA2_PINMUX(PORTE, 1, 3)>;	/* RxD2 */
174	};
175
176	sdhi0_pins: sdhi0 {
177		pinmux = <RZA2_PINMUX(PORT5, 0, 3)>,	/* SD0_CD */
178			 <RZA2_PINMUX(PORT5, 1, 3)>;	/* SD0_WP */
179	};
180
181	sdhi1_pins: sdhi1 {
182		pinmux = <RZA2_PINMUX(PORT5, 4, 3)>,	/* SD1_CD */
183			 <RZA2_PINMUX(PORT5, 5, 3)>;	/* SD1_WP */
184	};
185
186	usb0_pins: usb0 {
187		pinmux = <RZA2_PINMUX(PORT5, 2, 3)>,	/* VBUSIN0 */
188			 <RZA2_PINMUX(PORTC, 6, 1)>,	/* VBUSEN0 */
189			 <RZA2_PINMUX(PORTC, 7, 1)>;	/* OVRCUR0 */
190	};
191
192	usb1_pins: usb1 {
193		pinmux = <RZA2_PINMUX(PORTC, 0, 1)>,	/* VBUSIN1 */
194			 <RZA2_PINMUX(PORTC, 5, 1)>;	/* VBUSEN1 */
195	};
196};
197
198/* RTC_X1 */
199&rtc_x1_clk {
200	clock-frequency = <32768>;
201};
202
203/* Serial Console */
204&scif2 {
205	pinctrl-names = "default";
206	pinctrl-0 = <&scif2_pins>;
207
208	status = "okay";
209};
210
211&sdhi0 {
212	pinctrl-names = "default";
213	pinctrl-0 = <&sdhi0_pins>;
214	bus-width = <4>;
215	status = "okay";
216};
217
218&sdhi1 {
219	pinctrl-names = "default";
220	pinctrl-0 = <&sdhi1_pins>;
221	bus-width = <4>;
222	status = "okay";
223};
224
225/* USB-0 as Host */
226&usb2_phy0 {
227	pinctrl-names = "default";
228	pinctrl-0 = <&usb0_pins>;
229	dr_mode = "host";	/* Requires JP3 to be fitted */
230	status = "okay";
231};
232
233/* USB-1 as Host */
234&usb2_phy1 {
235	pinctrl-names = "default";
236	pinctrl-0 = <&usb1_pins>;
237	dr_mode = "host";
238	status = "okay";
239};
240
241/* USB_X1 */
242&usb_x1_clk {
243	clock-frequency = <48000000>;
244};
245