1// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
2/*
3 * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
4 *
5 * Based on sun8i-h3-bananapi-m2-plus.dts, which is:
6 *   Copyright (C) 2016 Chen-Yu Tsai <wens@csie.org>
7 */
8
9/dts-v1/;
10#include "sun8i-h3.dtsi"
11#include "sunxi-common-regulators.dtsi"
12
13#include <dt-bindings/gpio/gpio.h>
14#include <dt-bindings/input/input.h>
15
16/ {
17	model = "Banana Pi BPI-M2-Zero";
18	compatible = "sinovoip,bpi-m2-zero", "allwinner,sun8i-h2-plus";
19
20	aliases {
21		serial0 = &uart0;
22		serial1 = &uart1;
23	};
24
25	chosen {
26		stdout-path = "serial0:115200n8";
27	};
28
29	leds {
30		compatible = "gpio-leds";
31		pinctrl-names = "default";
32
33		pwr_led {
34			label = "bananapi-m2-zero:red:pwr";
35			gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
36			default-state = "on";
37		};
38	};
39
40	gpio_keys {
41		compatible = "gpio-keys";
42		pinctrl-names = "default";
43
44		sw4 {
45			label = "power";
46			linux,code = <BTN_0>;
47			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
48		};
49	};
50
51	reg_vdd_cpux: vdd-cpux-regulator {
52		compatible = "regulator-gpio";
53		regulator-name = "vdd-cpux";
54		regulator-type = "voltage";
55		regulator-boot-on;
56		regulator-always-on;
57		regulator-min-microvolt = <1100000>;
58		regulator-max-microvolt = <1300000>;
59		regulator-ramp-delay = <50>; /* 4ms */
60
61		gpios = <&r_pio 0 1 GPIO_ACTIVE_HIGH>; /* PL1 */
62		enable-active-high;
63		gpios-states = <0x1>;
64		states = <1100000 0x0
65			  1300000 0x1>;
66	};
67
68	wifi_pwrseq: wifi_pwrseq {
69		compatible = "mmc-pwrseq-simple";
70		pinctrl-names = "default";
71		reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */
72	};
73};
74
75&cpu0 {
76	cpu-supply = <&reg_vdd_cpux>;
77};
78
79&ehci0 {
80	status = "okay";
81};
82
83&mmc0 {
84	vmmc-supply = <&reg_vcc3v3>;
85	bus-width = <4>;
86	/*
87	 * On the production batch of this board the card detect GPIO is
88	 * high active (card inserted), although on the early samples it's
89	 * low active.
90	 */
91	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
92	status = "okay";
93};
94
95&mmc1 {
96	vmmc-supply = <&reg_vcc3v3>;
97	vqmmc-supply = <&reg_vcc3v3>;
98	mmc-pwrseq = <&wifi_pwrseq>;
99	bus-width = <4>;
100	non-removable;
101	status = "okay";
102
103	brcmf: wifi@1 {
104		reg = <1>;
105		compatible = "brcm,bcm4329-fmac";
106		interrupt-parent = <&pio>;
107		interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */
108		interrupt-names = "host-wake";
109	};
110};
111
112&ohci0 {
113	status = "okay";
114};
115
116&uart0 {
117	pinctrl-names = "default";
118	pinctrl-0 = <&uart0_pins_a>;
119	status = "okay";
120};
121
122&uart1 {
123	pinctrl-names = "default";
124	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
125	status = "okay";
126};
127
128&usb_otg {
129	dr_mode = "otg";
130	status = "okay";
131};
132
133&usbphy {
134	usb0_id_det-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
135	/*
136	 * There're two micro-USB connectors, one is power-only and another is
137	 * OTG. The Vbus of these two connectors are connected together, so
138	 * the external USB device will be powered just by the power input
139	 * from the power-only USB port.
140	 */
141	status = "okay";
142};
143