1/*
2 * Copyright 2017-2018 Sean Wang <sean.wang@mediatek.com>
3 *
4 * SPDX-License-Identifier: (GPL-2.0+ OR MIT)
5 */
6
7/dts-v1/;
8#include <dt-bindings/input/input.h>
9#include "mt7623n.dtsi"
10#include "mt6323.dtsi"
11
12/ {
13	model = "Bananapi BPI-R2";
14	compatible = "bananapi,bpi-r2", "mediatek,mt7623";
15
16	aliases {
17		serial2 = &uart2;
18	};
19
20	chosen {
21		stdout-path = "serial2:115200n8";
22	};
23
24	connector {
25		compatible = "hdmi-connector";
26		label = "hdmi";
27		type = "d";
28		ddc-i2c-bus = <&hdmiddc0>;
29
30		port {
31			hdmi_connector_in: endpoint {
32				remote-endpoint = <&hdmi0_out>;
33			};
34		};
35	};
36
37	cpus {
38		cpu@0 {
39			proc-supply = <&mt6323_vproc_reg>;
40		};
41
42		cpu@1 {
43			proc-supply = <&mt6323_vproc_reg>;
44		};
45
46		cpu@2 {
47			proc-supply = <&mt6323_vproc_reg>;
48		};
49
50		cpu@3 {
51			proc-supply = <&mt6323_vproc_reg>;
52		};
53	};
54
55	reg_1p8v: regulator-1p8v {
56		compatible = "regulator-fixed";
57		regulator-name = "fixed-1.8V";
58		regulator-min-microvolt = <1800000>;
59		regulator-max-microvolt = <1800000>;
60		regulator-boot-on;
61		regulator-always-on;
62	};
63
64	reg_3p3v: regulator-3p3v {
65		compatible = "regulator-fixed";
66		regulator-name = "fixed-3.3V";
67		regulator-min-microvolt = <3300000>;
68		regulator-max-microvolt = <3300000>;
69		regulator-boot-on;
70		regulator-always-on;
71	};
72
73	reg_5v: regulator-5v {
74		compatible = "regulator-fixed";
75		regulator-name = "fixed-5V";
76		regulator-min-microvolt = <5000000>;
77		regulator-max-microvolt = <5000000>;
78		regulator-boot-on;
79		regulator-always-on;
80	};
81
82	reg_vgpu: fixedregulator@0 {
83		compatible = "regulator-fixed";
84		regulator-name = "vdd_fixed_vgpu";
85		regulator-min-microvolt = <1150000>;
86		regulator-max-microvolt = <1150000>;
87	};
88
89	gpio-keys {
90		compatible = "gpio-keys";
91		pinctrl-names = "default";
92		pinctrl-0 = <&key_pins_a>;
93
94		button-factory {
95			label = "factory";
96			linux,code = <BTN_0>;
97			gpios = <&pio 256 GPIO_ACTIVE_LOW>;
98		};
99
100		button-wps {
101			label = "wps";
102			linux,code = <KEY_WPS_BUTTON>;
103			gpios = <&pio 257 GPIO_ACTIVE_HIGH>;
104		};
105	};
106
107	leds {
108		compatible = "gpio-leds";
109		pinctrl-names = "default";
110		pinctrl-0 = <&led_pins_a>;
111
112		blue {
113			label = "bpi-r2:pio:blue";
114			gpios = <&pio 240 GPIO_ACTIVE_LOW>;
115			default-state = "off";
116		};
117
118		green {
119			label = "bpi-r2:pio:green";
120			gpios = <&pio 241 GPIO_ACTIVE_LOW>;
121			default-state = "off";
122		};
123
124		red {
125			label = "bpi-r2:pio:red";
126			gpios = <&pio 239 GPIO_ACTIVE_LOW>;
127			default-state = "off";
128		};
129	};
130
131	memory@80000000 {
132		device_type = "memory";
133		reg = <0 0x80000000 0 0x80000000>;
134	};
135};
136
137&bls {
138	status = "okay";
139};
140
141&btif {
142	status = "okay";
143};
144
145&cec {
146	status = "okay";
147};
148
149&cir {
150	pinctrl-names = "default";
151	pinctrl-0 = <&cir_pins_a>;
152	status = "okay";
153};
154
155&crypto {
156	status = "okay";
157};
158
159&dpi0 {
160	status = "okay";
161
162	ports {
163		#address-cells = <1>;
164		#size-cells = <0>;
165		port@0 {
166			reg = <0>;
167			dpi0_out: endpoint {
168				remote-endpoint = <&hdmi0_in>;
169			};
170		};
171	};
172};
173
174&gmac0 {
175	status = "okay";
176	phy-mode = "trgmii";
177
178	fixed-link {
179		speed = <1000>;
180		full-duplex;
181		pause;
182	};
183};
184
185&gmac1 {
186	status = "okay";
187	phy-mode = "rgmii";
188
189	fixed-link {
190		speed = <1000>;
191		full-duplex;
192		pause;
193	};
194};
195
196&eth {
197	status = "okay";
198
199	mdio-bus {
200		#address-cells = <1>;
201		#size-cells = <0>;
202
203		switch@1f {
204			compatible = "mediatek,mt7530";
205			reg = <0x1f>;
206			reset-gpios = <&pio 33 0>;
207			core-supply = <&mt6323_vpa_reg>;
208			io-supply = <&mt6323_vemc3v3_reg>;
209
210			ports {
211				#address-cells = <1>;
212				#size-cells = <0>;
213
214				port@0 {
215					reg = <0>;
216					label = "wan";
217				};
218
219				port@1 {
220					reg = <1>;
221					label = "lan0";
222				};
223
224				port@2 {
225					reg = <2>;
226					label = "lan1";
227				};
228
229				port@3 {
230					reg = <3>;
231					label = "lan2";
232				};
233
234				port@4 {
235					reg = <4>;
236					label = "lan3";
237				};
238
239				port@5 {
240					reg = <5>;
241					label = "cpu";
242					ethernet = <&gmac1>;
243					phy-mode = "rgmii";
244
245					fixed-link {
246						speed = <1000>;
247						full-duplex;
248						pause;
249					};
250				};
251
252				port@6 {
253					reg = <6>;
254					label = "cpu";
255					ethernet = <&gmac0>;
256					phy-mode = "trgmii";
257
258					fixed-link {
259						speed = <1000>;
260						full-duplex;
261						pause;
262					};
263				};
264			};
265		};
266	};
267};
268
269&hdmi0 {
270	pinctrl-names = "default";
271	pinctrl-0 = <&hdmi_pins_a>;
272	status = "okay";
273
274	ports {
275		#address-cells = <1>;
276		#size-cells = <0>;
277		port@0 {
278			reg = <0>;
279			hdmi0_in: endpoint {
280				remote-endpoint = <&dpi0_out>;
281			};
282		};
283
284		port@1 {
285			reg = <1>;
286			hdmi0_out: endpoint {
287				remote-endpoint = <&hdmi_connector_in>;
288			};
289		};
290	};
291};
292
293&hdmiddc0 {
294	pinctrl-names = "default";
295	pinctrl-0 = <&hdmi_ddc_pins_a>;
296	status = "okay";
297};
298
299&hdmi_phy {
300	mediatek,ibias = <0xa>;
301	mediatek,ibias_up = <0x1c>;
302	status = "okay";
303};
304
305&i2c0 {
306	pinctrl-names = "default";
307	pinctrl-0 = <&i2c0_pins_a>;
308	status = "okay";
309};
310
311&i2c1 {
312	pinctrl-names = "default";
313	pinctrl-0 = <&i2c1_pins_a>;
314	status = "okay";
315};
316
317&mali {
318	mali-supply = <&reg_vgpu>;
319	status = "okay";
320};
321
322&mmc0 {
323	pinctrl-names = "default", "state_uhs";
324	pinctrl-0 = <&mmc0_pins_default>;
325	pinctrl-1 = <&mmc0_pins_uhs>;
326	status = "okay";
327	bus-width = <8>;
328	max-frequency = <50000000>;
329	cap-mmc-highspeed;
330	vmmc-supply = <&reg_3p3v>;
331	vqmmc-supply = <&reg_1p8v>;
332	non-removable;
333};
334
335&mmc1 {
336	pinctrl-names = "default", "state_uhs";
337	pinctrl-0 = <&mmc1_pins_default>;
338	pinctrl-1 = <&mmc1_pins_uhs>;
339	status = "okay";
340	bus-width = <4>;
341	max-frequency = <50000000>;
342	cap-sd-highspeed;
343	cd-gpios = <&pio 261 GPIO_ACTIVE_LOW>;
344	vmmc-supply = <&reg_3p3v>;
345	vqmmc-supply = <&reg_3p3v>;
346};
347
348&mt6323keys {
349	home {
350		status = "disabled";
351	};
352};
353
354&mt6323_leds {
355	status = "okay";
356
357	led@0 {
358		reg = <0>;
359		label = "bpi-r2:isink:green";
360		default-state = "off";
361	};
362
363	led@1 {
364		reg = <1>;
365		label = "bpi-r2:isink:red";
366		default-state = "off";
367	};
368
369	led@2 {
370		reg = <2>;
371		label = "bpi-r2:isink:blue";
372		default-state = "off";
373	};
374};
375
376&pcie {
377	pinctrl-names = "default";
378	pinctrl-0 = <&pcie_default>;
379	status = "okay";
380
381	pcie@0,0 {
382		status = "okay";
383	};
384
385	pcie@1,0 {
386		status = "okay";
387	};
388};
389
390&pcie0_phy {
391	status = "okay";
392};
393
394&pcie1_phy {
395	status = "okay";
396};
397
398&pio {
399	musb_pins: musb {
400		pins-musb {
401			pinmux = <MT7623_PIN_237_EXT_SDIO2_FUNC_DRV_VBUS>;
402		};
403	};
404};
405
406&pwm {
407	pinctrl-names = "default";
408	pinctrl-0 = <&pwm_pins_a>;
409	status = "okay";
410};
411
412&spi0 {
413	pinctrl-names = "default";
414	pinctrl-0 = <&spi0_pins_a>;
415	status = "okay";
416};
417
418&uart0 {
419	pinctrl-names = "default";
420	pinctrl-0 = <&uart0_pins_a>;
421	status = "okay";
422};
423
424&uart1 {
425	pinctrl-names = "default";
426	pinctrl-0 = <&uart1_pins_a>;
427	status = "okay";
428};
429
430&uart2 {
431	pinctrl-names = "default";
432	pinctrl-0 = <&uart2_pins_a>;
433	status = "okay";
434};
435
436&usb0 {
437	pinctrl-names = "default";
438	pinctrl-0 = <&musb_pins>;
439	status = "okay";
440	usb-role-switch;
441
442	connector {
443		compatible = "gpio-usb-b-connector", "usb-b-connector";
444		type = "micro";
445		id-gpios = <&pio 44 GPIO_ACTIVE_HIGH>;
446	};
447};
448
449&usb1 {
450	vusb33-supply = <&reg_3p3v>;
451	vbus-supply = <&reg_5v>;
452	status = "okay";
453};
454
455&usb2 {
456	vusb33-supply = <&reg_3p3v>;
457	vbus-supply = <&reg_5v>;
458	status = "okay";
459};
460
461&u2phy1 {
462	status = "okay";
463};
464
465&u3phy1 {
466	status = "okay";
467};
468
469&u3phy2 {
470	status = "okay";
471};
472