1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2// Copyright (c) 2016 ARM Ltd.
3
4/dts-v1/;
5
6#include "sun50i-a64.dtsi"
7
8#include <dt-bindings/gpio/gpio.h>
9
10/ {
11	model = "BananaPi-M64";
12	compatible = "sinovoip,bananapi-m64", "allwinner,sun50i-a64";
13
14	aliases {
15		ethernet0 = &emac;
16		serial0 = &uart0;
17		serial1 = &uart1;
18	};
19
20	chosen {
21		stdout-path = "serial0:115200n8";
22	};
23
24	hdmi-connector {
25		compatible = "hdmi-connector";
26		type = "a";
27
28		port {
29			hdmi_con_in: endpoint {
30				remote-endpoint = <&hdmi_out_con>;
31			};
32		};
33	};
34
35	leds {
36		compatible = "gpio-leds";
37
38		pwr-led {
39			label = "bananapi-m64:red:pwr";
40			gpios = <&pio 3 24 GPIO_ACTIVE_HIGH>; /* PD24 */
41			default-state = "on";
42		};
43
44		green {
45			label = "bananapi-m64:green:user";
46			gpios = <&pio 4 14 GPIO_ACTIVE_HIGH>; /* PE14 */
47		};
48
49		blue {
50			label = "bananapi-m64:blue:user";
51			gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */
52		};
53	};
54
55	wifi_pwrseq: wifi_pwrseq {
56		compatible = "mmc-pwrseq-simple";
57		reset-gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>; /* PL2 */
58		clocks = <&rtc 1>;
59		clock-names = "ext_clock";
60	};
61};
62
63&codec {
64	status = "okay";
65};
66
67&codec_analog {
68	cpvdd-supply = <&reg_eldo1>;
69	status = "okay";
70};
71
72&dai {
73	status = "okay";
74};
75
76&de {
77	status = "okay";
78};
79
80&ehci0 {
81	status = "okay";
82};
83
84&ehci1 {
85	status = "okay";
86};
87
88&emac {
89	pinctrl-names = "default";
90	pinctrl-0 = <&rgmii_pins>;
91	phy-mode = "rgmii";
92	phy-handle = <&ext_rgmii_phy>;
93	phy-supply = <&reg_dc1sw>;
94	status = "okay";
95};
96
97&hdmi {
98	hvcc-supply = <&reg_dldo1>;
99	status = "okay";
100};
101
102&hdmi_out {
103	hdmi_out_con: endpoint {
104		remote-endpoint = <&hdmi_con_in>;
105	};
106};
107
108&i2c1 {
109	status = "okay";
110};
111
112&i2c1_pins {
113	bias-pull-up;
114};
115
116&mdio {
117	ext_rgmii_phy: ethernet-phy@1 {
118		compatible = "ethernet-phy-ieee802.3-c22";
119		reg = <1>;
120	};
121};
122
123&mmc0 {
124	pinctrl-names = "default";
125	pinctrl-0 = <&mmc0_pins>;
126	vmmc-supply = <&reg_dcdc1>;
127	cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>;
128	disable-wp;
129	bus-width = <4>;
130	status = "okay";
131};
132
133&mmc1 {
134	pinctrl-names = "default";
135	pinctrl-0 = <&mmc1_pins>;
136	vmmc-supply = <&reg_dldo2>;
137	vqmmc-supply = <&reg_dldo4>;
138	mmc-pwrseq = <&wifi_pwrseq>;
139	bus-width = <4>;
140	non-removable;
141	status = "okay";
142
143	brcmf: wifi@1 {
144		reg = <1>;
145		compatible = "brcm,bcm4329-fmac";
146		interrupt-parent = <&r_pio>;
147		interrupts = <0 3 IRQ_TYPE_LEVEL_LOW>; /* PL3 */
148		interrupt-names = "host-wake";
149	};
150};
151
152&mmc2 {
153	pinctrl-names = "default";
154	pinctrl-0 = <&mmc2_pins>, <&mmc2_ds_pin>;
155	vmmc-supply = <&reg_dcdc1>;
156	bus-width = <8>;
157	non-removable;
158	cap-mmc-hw-reset;
159	status = "okay";
160};
161
162&ohci0 {
163	status = "okay";
164};
165
166&ohci1 {
167	status = "okay";
168};
169
170&r_rsb {
171	status = "okay";
172
173	axp803: pmic@3a3 {
174		compatible = "x-powers,axp803";
175		reg = <0x3a3>;
176		interrupt-parent = <&r_intc>;
177		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
178		x-powers,drive-vbus-en; /* set N_VBUSEN as output pin */
179	};
180};
181
182#include "axp803.dtsi"
183
184&ac_power_supply {
185	status = "okay";
186};
187
188&battery_power_supply {
189	status = "okay";
190};
191
192&reg_aldo1 {
193	/*
194	 * This regulator also drives the PE pingroup GPIOs,
195	 * which also controls two LEDs.
196	 */
197	regulator-always-on;
198	regulator-min-microvolt = <2800000>;
199	regulator-max-microvolt = <2800000>;
200	regulator-name = "afvcc-csi";
201};
202
203&reg_aldo2 {
204	regulator-always-on;
205	regulator-min-microvolt = <1800000>;
206	regulator-max-microvolt = <3300000>;
207	regulator-name = "vcc-pl";
208};
209
210&reg_aldo3 {
211	regulator-always-on;
212	regulator-min-microvolt = <3000000>;
213	regulator-max-microvolt = <3000000>;
214	regulator-name = "vcc-pll-avcc";
215};
216
217&reg_dc1sw {
218	/*
219	 * This regulator also indirectly drives the PD pingroup GPIOs,
220	 * which also controls the power LED.
221	 */
222	regulator-always-on;
223	regulator-name = "vcc-phy";
224};
225
226&reg_dcdc1 {
227	regulator-always-on;
228	regulator-min-microvolt = <3300000>;
229	regulator-max-microvolt = <3300000>;
230	regulator-name = "vcc-3v3";
231};
232
233&reg_dcdc2 {
234	regulator-always-on;
235	regulator-min-microvolt = <1040000>;
236	regulator-max-microvolt = <1300000>;
237	regulator-name = "vdd-cpux";
238};
239
240/* DCDC3 is polyphased with DCDC2 */
241
242&reg_dcdc5 {
243	regulator-always-on;
244	regulator-min-microvolt = <1500000>;
245	regulator-max-microvolt = <1500000>;
246	regulator-name = "vcc-dram";
247};
248
249&reg_dcdc6 {
250	regulator-always-on;
251	regulator-min-microvolt = <1100000>;
252	regulator-max-microvolt = <1100000>;
253	regulator-name = "vdd-sys";
254};
255
256&reg_dldo1 {
257	regulator-min-microvolt = <3300000>;
258	regulator-max-microvolt = <3300000>;
259	regulator-name = "vcc-hdmi-dsi";
260};
261
262&reg_dldo2 {
263	regulator-min-microvolt = <3300000>;
264	regulator-max-microvolt = <3300000>;
265	regulator-name = "vcc-wifi";
266};
267
268&reg_dldo4 {
269	regulator-min-microvolt = <1800000>;
270	regulator-max-microvolt = <3300000>;
271	regulator-name = "vcc-wifi-io";
272};
273
274&reg_drivevbus {
275	regulator-name = "usb0-vbus";
276	status = "okay";
277};
278
279&reg_eldo1 {
280	regulator-min-microvolt = <1800000>;
281	regulator-max-microvolt = <1800000>;
282	regulator-name = "cpvdd";
283};
284
285&reg_fldo1 {
286	regulator-min-microvolt = <1200000>;
287	regulator-max-microvolt = <1200000>;
288	regulator-name = "vcc-1v2-hsic";
289};
290
291/*
292 * The A64 chip cannot work without this regulator off, although
293 * it seems to be only driving the AR100 core.
294 * Maybe we don't still know well about CPUs domain.
295 */
296&reg_fldo2 {
297	regulator-always-on;
298	regulator-min-microvolt = <1100000>;
299	regulator-max-microvolt = <1100000>;
300	regulator-name = "vdd-cpus";
301};
302
303&reg_rtc_ldo {
304	regulator-name = "vcc-rtc";
305};
306
307&simplefb_hdmi {
308	vcc-hdmi-supply = <&reg_dldo1>;
309};
310
311&sound {
312	status = "okay";
313	simple-audio-card,widgets = "Headphone", "Headphone Jack",
314				    "Microphone", "Microphone Jack",
315				    "Microphone", "Onboard Microphone";
316	simple-audio-card,routing =
317			"Left DAC", "AIF1 Slot 0 Left",
318			"Right DAC", "AIF1 Slot 0 Right",
319			"AIF1 Slot 0 Left ADC", "Left ADC",
320			"AIF1 Slot 0 Right ADC", "Right ADC",
321			"Headphone Jack", "HP",
322			"MIC2", "Microphone Jack",
323			"Onboard Microphone", "MBIAS",
324			"MIC1", "Onboard Microphone";
325};
326
327&uart0 {
328	pinctrl-names = "default";
329	pinctrl-0 = <&uart0_pb_pins>;
330	status = "okay";
331};
332
333&uart1 {
334	pinctrl-names = "default";
335	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
336	uart-has-rtscts;
337	status = "okay";
338
339	bluetooth {
340		compatible = "brcm,bcm43438-bt";
341		clocks = <&rtc 1>;
342		clock-names = "lpo";
343		vbat-supply = <&reg_dldo2>;
344		vddio-supply = <&reg_dldo4>;
345		device-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
346		host-wakeup-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
347		shutdown-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
348	};
349};
350
351&usb_otg {
352	dr_mode = "otg";
353	status = "okay";
354};
355
356&usb_power_supply {
357	status = "okay";
358};
359
360&usbphy {
361	usb0_id_det-gpios = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
362	usb0_vbus_power-supply = <&usb_power_supply>;
363	usb0_vbus-supply = <&reg_drivevbus>;
364	status = "okay";
365};
366