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