1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Device Tree Source for A20-SOM204-EVB Board
4 *
5 * Copyright (C) 2018 Olimex Ltd.
6 *   Author: Stefan Mavrodiev <stefan@olimex.com>
7 */
8
9/dts-v1/;
10#include "sun7i-a20.dtsi"
11#include "sunxi-common-regulators.dtsi"
12
13
14#include <dt-bindings/gpio/gpio.h>
15#include <dt-bindings/interrupt-controller/irq.h>
16#include <dt-bindings/pwm/pwm.h>
17
18/ {
19	model = "Olimex A20-SOM204-EVB";
20	compatible = "olimex,a20-olimex-som204-evb", "allwinner,sun7i-a20";
21
22	aliases {
23		serial0 = &uart0;
24		serial1 = &uart4;
25		serial2 = &uart7;
26		spi0 = &spi1;
27		spi1 = &spi2;
28		ethernet1 = &rtl8723bs;
29	};
30
31	chosen {
32		stdout-path = "serial0:115200n8";
33	};
34
35	leds {
36		compatible = "gpio-leds";
37
38		stat {
39			label = "a20-som204-evb:green:stat";
40			gpios = <&pio 8 0 GPIO_ACTIVE_HIGH>;
41			default-state = "on";
42		};
43
44		led1 {
45			label = "a20-som204-evb:green:led1";
46			gpios = <&pio 8 10 GPIO_ACTIVE_HIGH>;
47			default-state = "on";
48		};
49
50		led2 {
51			label = "a20-som204-evb:yellow:led2";
52			gpios = <&pio 8 11 GPIO_ACTIVE_HIGH>;
53			default-state = "on";
54		};
55	};
56
57	rtl_pwrseq: rtl_pwrseq {
58		compatible = "mmc-pwrseq-simple";
59		reset-gpios = <&pio 6 9 GPIO_ACTIVE_LOW>;
60	};
61};
62
63&ahci {
64	target-supply = <&reg_ahci_5v>;
65	status = "okay";
66};
67
68&codec {
69	status = "okay";
70};
71
72&cpu0 {
73	cpu-supply = <&reg_dcdc2>;
74};
75
76&ehci0 {
77	status = "okay";
78};
79
80&ehci1 {
81	status = "okay";
82};
83
84&gmac {
85	pinctrl-names = "default";
86	pinctrl-0 = <&gmac_pins_rgmii_a>;
87	phy = <&phy3>;
88	phy-mode = "rgmii";
89	phy-supply = <&reg_vcc3v3>;
90
91	snps,reset-gpio = <&pio 0 17 GPIO_ACTIVE_HIGH>;
92	snps,reset-active-low;
93	snps,reset-delays-us = <0 10000 1000000>;
94	status = "okay";
95
96	phy3: ethernet-phy@3 {
97		reg = <3>;
98	};
99};
100
101&i2c0 {
102	pinctrl-names = "default";
103	pinctrl-0 = <&i2c0_pins_a>;
104	status = "okay";
105
106	axp209: pmic@34 {
107		reg = <0x34>;
108		interrupt-parent = <&nmi_intc>;
109		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
110	};
111};
112
113/* Exposed to UEXT1 */
114&i2c1 {
115	pinctrl-names = "default";
116	pinctrl-0 = <&i2c1_pins_a>;
117	status = "okay";
118
119	eeprom: eeprom@50 {
120		compatible = "atmel,24c16";
121		reg = <0x50>;
122		pagesize = <16>;
123	};
124};
125
126/* Exposed to UEXT2 */
127&i2c2 {
128	pinctrl-names = "default";
129	pinctrl-0 = <&i2c2_pins_a>;
130	status = "okay";
131};
132
133&ir0 {
134	pinctrl-names = "default";
135	pinctrl-0 = <&ir0_rx_pins_a>;
136	status = "okay";
137};
138
139&mmc0 {
140	pinctrl-names = "default";
141	pinctrl-0 = <&mmc0_pins_a>;
142	vmmc-supply = <&reg_vcc3v3>;
143	bus-width = <4>;
144	cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>;
145	cd-inverted;
146	status = "okay";
147};
148
149&mmc3 {
150	pinctrl-names = "default";
151	pinctrl-0 = <&mmc3_pins_a>;
152	vmmc-supply = <&reg_vcc3v3>;
153	mmc-pwrseq = <&rtl_pwrseq>;
154	bus-width = <4>;
155	non-removable;
156	status = "okay";
157
158	rtl8723bs: sdio_wifi@1 {
159		reg = <1>;
160	};
161};
162
163&ohci0 {
164	status = "okay";
165};
166
167&ohci1 {
168	status = "okay";
169};
170
171&otg_sram {
172	status = "okay";
173};
174
175&pio {
176	bt_uart_pins: bt_uart_pins@0 {
177		pins = "PG6", "PG7", "PG8";
178		function = "uart3";
179	};
180};
181
182#include "axp209.dtsi"
183
184&reg_ahci_5v {
185	gpio = <&pio 2 3 GPIO_ACTIVE_HIGH>;
186	status = "okay";
187};
188
189&reg_dcdc2 {
190	regulator-always-on;
191	regulator-min-microvolt = <1000000>;
192	regulator-max-microvolt = <1400000>;
193	regulator-name = "vdd-cpu";
194};
195
196&reg_dcdc3 {
197	regulator-always-on;
198	regulator-min-microvolt = <1000000>;
199	regulator-max-microvolt = <1400000>;
200	regulator-name = "vdd-int-dll";
201};
202
203&reg_ldo1 {
204	regulator-always-on;
205	regulator-min-microvolt = <1300000>;
206	regulator-max-microvolt = <1300000>;
207	regulator-name = "vdd-rtc";
208};
209
210&reg_ldo2 {
211	regulator-always-on;
212	regulator-min-microvolt = <3000000>;
213	regulator-max-microvolt = <3000000>;
214	regulator-name = "avcc";
215};
216
217&reg_ldo4 {
218	regulator-min-microvolt = <3300000>;
219	regulator-max-microvolt = <3300000>;
220	regulator-name = "vcc-pg";
221};
222
223&reg_usb0_vbus {
224	gpio = <&pio 2 17 GPIO_ACTIVE_HIGH>;
225	status = "okay";
226};
227
228&reg_usb1_vbus {
229	status = "okay";
230};
231
232&reg_usb2_vbus {
233	status = "okay";
234};
235
236/* Exposed to UEXT1 */
237&spi1 {
238	pinctrl-names = "default";
239	pinctrl-0 = <&spi1_pins_a>,
240		    <&spi1_cs0_pins_a>;
241	status = "okay";
242};
243
244/* Exposed to UEXT2 */
245&spi2 {
246	pinctrl-names = "default";
247	pinctrl-0 = <&spi2_pins_a>,
248		    <&spi2_cs0_pins_a>;
249	status = "okay";
250};
251
252&uart0 {
253	pinctrl-names = "default";
254	pinctrl-0 = <&uart0_pins_a>;
255	status = "okay";
256};
257
258/* Used for RTL8723BS bluetooth */
259&uart3 {
260	pinctrl-names = "default";
261	pinctrl-0 = <&bt_uart_pins>;
262	status = "okay";
263};
264
265/* Exposed to UEXT1 */
266&uart4 {
267	pinctrl-names = "default";
268	pinctrl-0 = <&uart4_pins_a>;
269	status = "okay";
270};
271
272/* Exposed to UEXT2 */
273&uart7 {
274	pinctrl-names = "default";
275	pinctrl-0 = <&uart7_pins_a>;
276	status = "okay";
277};
278
279&usb_otg {
280	dr_mode = "otg";
281	status = "okay";
282};
283
284&usb_power_supply {
285	status = "okay";
286};
287
288&usbphy {
289	usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
290	usb0_vbus_det-gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
291	usb0_vbus_power-supply = <&usb_power_supply>;
292	usb0_vbus-supply = <&reg_usb0_vbus>;
293	usb1_vbus-supply = <&reg_usb1_vbus>;
294	usb2_vbus-supply = <&reg_usb2_vbus>;
295	status = "okay";
296};
297