xref: /freebsd-src/sys/contrib/device-tree/src/arm/allwinner/sun8i-r16-bananapi-m2m.dts (revision 7d0873ebb83b19ba1e8a89e679470d885efe12e3)
1f126890aSEmmanuel Vadot/*
2f126890aSEmmanuel Vadot * Copyright (c) 2017 Free Electrons <maxime.ripard@free-electrons.com>
3f126890aSEmmanuel Vadot *
4f126890aSEmmanuel Vadot * This file is dual-licensed: you can use it either under the terms
5f126890aSEmmanuel Vadot * of the GPL or the X11 license, at your option. Note that this dual
6f126890aSEmmanuel Vadot * licensing only applies to this file, and not this project as a
7f126890aSEmmanuel Vadot * whole.
8f126890aSEmmanuel Vadot *
9f126890aSEmmanuel Vadot *  a) This file is free software; you can redistribute it and/or
10f126890aSEmmanuel Vadot *     modify it under the terms of the GNU General Public License as
11f126890aSEmmanuel Vadot *     published by the Free Software Foundation; either version 2 of the
12f126890aSEmmanuel Vadot *     License, or (at your option) any later version.
13f126890aSEmmanuel Vadot *
14f126890aSEmmanuel Vadot *     This file is distributed in the hope that it will be useful,
15f126890aSEmmanuel Vadot *     but WITHOUT ANY WARRANTY; without even the implied warranty of
16f126890aSEmmanuel Vadot *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17f126890aSEmmanuel Vadot *     GNU General Public License for more details.
18f126890aSEmmanuel Vadot *
19f126890aSEmmanuel Vadot * Or, alternatively,
20f126890aSEmmanuel Vadot *
21f126890aSEmmanuel Vadot *  b) Permission is hereby granted, free of charge, to any person
22f126890aSEmmanuel Vadot *     obtaining a copy of this software and associated documentation
23f126890aSEmmanuel Vadot *     files (the "Software"), to deal in the Software without
24f126890aSEmmanuel Vadot *     restriction, including without limitation the rights to use,
25f126890aSEmmanuel Vadot *     copy, modify, merge, publish, distribute, sublicense, and/or
26f126890aSEmmanuel Vadot *     sell copies of the Software, and to permit persons to whom the
27f126890aSEmmanuel Vadot *     Software is furnished to do so, subject to the following
28f126890aSEmmanuel Vadot *     conditions:
29f126890aSEmmanuel Vadot *
30f126890aSEmmanuel Vadot *     The above copyright notice and this permission notice shall be
31f126890aSEmmanuel Vadot *     included in all copies or substantial portions of the Software.
32f126890aSEmmanuel Vadot *
33f126890aSEmmanuel Vadot *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34f126890aSEmmanuel Vadot *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
35f126890aSEmmanuel Vadot *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
36f126890aSEmmanuel Vadot *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
37f126890aSEmmanuel Vadot *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
38f126890aSEmmanuel Vadot *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
39f126890aSEmmanuel Vadot *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
40f126890aSEmmanuel Vadot *     OTHER DEALINGS IN THE SOFTWARE.
41f126890aSEmmanuel Vadot */
42f126890aSEmmanuel Vadot
43f126890aSEmmanuel Vadot/dts-v1/;
44f126890aSEmmanuel Vadot#include "sun8i-a33.dtsi"
45f126890aSEmmanuel Vadot
46f126890aSEmmanuel Vadot#include <dt-bindings/gpio/gpio.h>
47f126890aSEmmanuel Vadot
48f126890aSEmmanuel Vadot/ {
49f126890aSEmmanuel Vadot	model = "BananaPi M2 Magic";
50f126890aSEmmanuel Vadot	compatible = "sinovoip,bananapi-m2m", "allwinner,sun8i-a33";
51f126890aSEmmanuel Vadot
52f126890aSEmmanuel Vadot	aliases {
53f126890aSEmmanuel Vadot		i2c0 = &i2c0;
54f126890aSEmmanuel Vadot		i2c1 = &i2c1;
55f126890aSEmmanuel Vadot		i2c2 = &i2c2;
56f126890aSEmmanuel Vadot		serial0 = &uart0;
57f126890aSEmmanuel Vadot		serial1 = &uart1;
58f126890aSEmmanuel Vadot	};
59f126890aSEmmanuel Vadot
60f126890aSEmmanuel Vadot	chosen {
61f126890aSEmmanuel Vadot		stdout-path = "serial0:115200n8";
62f126890aSEmmanuel Vadot	};
63f126890aSEmmanuel Vadot
64f126890aSEmmanuel Vadot	leds {
65f126890aSEmmanuel Vadot		compatible = "gpio-leds";
66f126890aSEmmanuel Vadot
67f126890aSEmmanuel Vadot		led-0 {
68f126890aSEmmanuel Vadot			label = "bpi-m2m:blue:usr";
69f126890aSEmmanuel Vadot			gpios = <&pio 2 7 GPIO_ACTIVE_LOW>;
70f126890aSEmmanuel Vadot		};
71f126890aSEmmanuel Vadot
72f126890aSEmmanuel Vadot		led-1 {
73f126890aSEmmanuel Vadot			label = "bpi-m2m:green:usr";
74f126890aSEmmanuel Vadot			gpios = <&r_pio 0 2 GPIO_ACTIVE_LOW>;
75f126890aSEmmanuel Vadot		};
76f126890aSEmmanuel Vadot
77f126890aSEmmanuel Vadot		led-2 {
78f126890aSEmmanuel Vadot			label = "bpi-m2m:red:power";
79f126890aSEmmanuel Vadot			gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>;
80f126890aSEmmanuel Vadot			default-state = "on";
81f126890aSEmmanuel Vadot		};
82f126890aSEmmanuel Vadot	};
83f126890aSEmmanuel Vadot
84f126890aSEmmanuel Vadot	reg_vcc5v0: vcc5v0 {
85f126890aSEmmanuel Vadot		compatible = "regulator-fixed";
86f126890aSEmmanuel Vadot		regulator-name = "vcc5v0";
87f126890aSEmmanuel Vadot		regulator-min-microvolt = <5000000>;
88f126890aSEmmanuel Vadot		regulator-max-microvolt = <5000000>;
89f126890aSEmmanuel Vadot	};
90f126890aSEmmanuel Vadot
91*7d0873ebSEmmanuel Vadot	wifi_pwrseq: pwrseq {
92f126890aSEmmanuel Vadot		compatible = "mmc-pwrseq-simple";
93f126890aSEmmanuel Vadot		reset-gpios = <&r_pio 0 6 GPIO_ACTIVE_LOW>; /* PL06 */
94f126890aSEmmanuel Vadot		clocks = <&rtc CLK_OSC32K_FANOUT>;
95f126890aSEmmanuel Vadot		clock-names = "ext_clock";
96f126890aSEmmanuel Vadot	};
97f126890aSEmmanuel Vadot};
98f126890aSEmmanuel Vadot
99f126890aSEmmanuel Vadot&codec {
100f126890aSEmmanuel Vadot	status = "okay";
101f126890aSEmmanuel Vadot};
102f126890aSEmmanuel Vadot
103f126890aSEmmanuel Vadot&cpu0 {
104f126890aSEmmanuel Vadot	cpu-supply = <&reg_dcdc3>;
105f126890aSEmmanuel Vadot};
106f126890aSEmmanuel Vadot
107f126890aSEmmanuel Vadot&cpu0_opp_table {
108f126890aSEmmanuel Vadot	opp-1104000000 {
109f126890aSEmmanuel Vadot		opp-hz = /bits/ 64 <1104000000>;
110f126890aSEmmanuel Vadot		opp-microvolt = <1320000>;
111f126890aSEmmanuel Vadot		clock-latency-ns = <244144>; /* 8 32k periods */
112f126890aSEmmanuel Vadot	};
113f126890aSEmmanuel Vadot
114f126890aSEmmanuel Vadot	opp-1200000000 {
115f126890aSEmmanuel Vadot		opp-hz = /bits/ 64 <1200000000>;
116f126890aSEmmanuel Vadot		opp-microvolt = <1320000>;
117f126890aSEmmanuel Vadot		clock-latency-ns = <244144>; /* 8 32k periods */
118f126890aSEmmanuel Vadot	};
119f126890aSEmmanuel Vadot};
120f126890aSEmmanuel Vadot
121f126890aSEmmanuel Vadot&dai {
122f126890aSEmmanuel Vadot	status = "okay";
123f126890aSEmmanuel Vadot};
124f126890aSEmmanuel Vadot
125f126890aSEmmanuel Vadot&ehci0 {
126f126890aSEmmanuel Vadot	status = "okay";
127f126890aSEmmanuel Vadot};
128f126890aSEmmanuel Vadot
129f126890aSEmmanuel Vadot&mmc0 {
130f126890aSEmmanuel Vadot	vmmc-supply = <&reg_dcdc1>;
131f126890aSEmmanuel Vadot	bus-width = <4>;
132f126890aSEmmanuel Vadot	cd-gpios = <&pio 1 4 GPIO_ACTIVE_LOW>; /* PB4 */
133f126890aSEmmanuel Vadot	status = "okay";
134f126890aSEmmanuel Vadot};
135f126890aSEmmanuel Vadot
136f126890aSEmmanuel Vadot&mmc1 {
137f126890aSEmmanuel Vadot	pinctrl-names = "default";
138f126890aSEmmanuel Vadot	pinctrl-0 = <&mmc1_pg_pins>;
139f126890aSEmmanuel Vadot	vmmc-supply = <&reg_aldo1>;
140f126890aSEmmanuel Vadot	mmc-pwrseq = <&wifi_pwrseq>;
141f126890aSEmmanuel Vadot	bus-width = <4>;
142f126890aSEmmanuel Vadot	non-removable;
143f126890aSEmmanuel Vadot	status = "okay";
144f126890aSEmmanuel Vadot};
145f126890aSEmmanuel Vadot
146f126890aSEmmanuel Vadot&mmc2 {
147f126890aSEmmanuel Vadot	pinctrl-names = "default";
148f126890aSEmmanuel Vadot	pinctrl-0 = <&mmc2_8bit_pins>;
149f126890aSEmmanuel Vadot	vmmc-supply = <&reg_dcdc1>;
150f126890aSEmmanuel Vadot	bus-width = <8>;
151f126890aSEmmanuel Vadot	non-removable;
152f126890aSEmmanuel Vadot	cap-mmc-hw-reset;
153f126890aSEmmanuel Vadot	status = "okay";
154f126890aSEmmanuel Vadot};
155f126890aSEmmanuel Vadot
156f126890aSEmmanuel Vadot&ohci0 {
157f126890aSEmmanuel Vadot	status = "okay";
158f126890aSEmmanuel Vadot};
159f126890aSEmmanuel Vadot
160f126890aSEmmanuel Vadot&r_rsb {
161f126890aSEmmanuel Vadot	status = "okay";
162f126890aSEmmanuel Vadot
163f126890aSEmmanuel Vadot	axp22x: pmic@3a3 {
164f126890aSEmmanuel Vadot		compatible = "x-powers,axp223";
165f126890aSEmmanuel Vadot		reg = <0x3a3>;
166f126890aSEmmanuel Vadot		interrupt-parent = <&r_intc>;
167f126890aSEmmanuel Vadot		interrupts = <GIC_SPI 32 IRQ_TYPE_LEVEL_LOW>;
168f126890aSEmmanuel Vadot		eldoin-supply = <&reg_dcdc1>;
169f126890aSEmmanuel Vadot		x-powers,drive-vbus-en;
170f126890aSEmmanuel Vadot	};
171f126890aSEmmanuel Vadot};
172f126890aSEmmanuel Vadot
173f126890aSEmmanuel Vadot#include "axp223.dtsi"
174f126890aSEmmanuel Vadot
175f126890aSEmmanuel Vadot&ac_power_supply {
176f126890aSEmmanuel Vadot	status = "okay";
177f126890aSEmmanuel Vadot};
178f126890aSEmmanuel Vadot
179f126890aSEmmanuel Vadot&reg_aldo1 {
180f126890aSEmmanuel Vadot	regulator-always-on;
181f126890aSEmmanuel Vadot	regulator-min-microvolt = <3000000>;
182f126890aSEmmanuel Vadot	regulator-max-microvolt = <3000000>;
183f126890aSEmmanuel Vadot	regulator-name = "vcc-io";
184f126890aSEmmanuel Vadot};
185f126890aSEmmanuel Vadot
186f126890aSEmmanuel Vadot&reg_aldo2 {
187f126890aSEmmanuel Vadot	regulator-always-on;
188f126890aSEmmanuel Vadot	regulator-min-microvolt = <2500000>;
189f126890aSEmmanuel Vadot	regulator-max-microvolt = <2500000>;
190f126890aSEmmanuel Vadot	regulator-name = "vdd-dll";
191f126890aSEmmanuel Vadot};
192f126890aSEmmanuel Vadot
193f126890aSEmmanuel Vadot&reg_aldo3 {
194f126890aSEmmanuel Vadot	regulator-always-on;
195f126890aSEmmanuel Vadot	regulator-min-microvolt = <3000000>;
196f126890aSEmmanuel Vadot	regulator-max-microvolt = <3000000>;
197f126890aSEmmanuel Vadot	regulator-name = "avcc";
198f126890aSEmmanuel Vadot};
199f126890aSEmmanuel Vadot
200f126890aSEmmanuel Vadot&reg_dc1sw {
201f126890aSEmmanuel Vadot	regulator-name = "vcc-lcd";
202f126890aSEmmanuel Vadot};
203f126890aSEmmanuel Vadot
204f126890aSEmmanuel Vadot&reg_dc5ldo {
205f126890aSEmmanuel Vadot	regulator-always-on;
206f126890aSEmmanuel Vadot	regulator-min-microvolt = <900000>;
207f126890aSEmmanuel Vadot	regulator-max-microvolt = <1400000>;
208f126890aSEmmanuel Vadot	regulator-name = "vdd-cpus";
209f126890aSEmmanuel Vadot};
210f126890aSEmmanuel Vadot
211f126890aSEmmanuel Vadot&reg_dcdc1 {
212f126890aSEmmanuel Vadot	regulator-always-on;
213f126890aSEmmanuel Vadot	regulator-min-microvolt = <3000000>;
214f126890aSEmmanuel Vadot	regulator-max-microvolt = <3000000>;
215f126890aSEmmanuel Vadot	regulator-name = "vcc-3v0";
216f126890aSEmmanuel Vadot};
217f126890aSEmmanuel Vadot
218f126890aSEmmanuel Vadot&reg_dcdc2 {
219f126890aSEmmanuel Vadot	regulator-always-on;
220f126890aSEmmanuel Vadot	regulator-min-microvolt = <900000>;
221f126890aSEmmanuel Vadot	regulator-max-microvolt = <1400000>;
222f126890aSEmmanuel Vadot	regulator-name = "vdd-sys";
223f126890aSEmmanuel Vadot};
224f126890aSEmmanuel Vadot
225f126890aSEmmanuel Vadot&reg_dcdc3 {
226f126890aSEmmanuel Vadot	regulator-always-on;
227f126890aSEmmanuel Vadot	regulator-min-microvolt = <900000>;
228f126890aSEmmanuel Vadot	regulator-max-microvolt = <1400000>;
229f126890aSEmmanuel Vadot	regulator-name = "vdd-cpu";
230f126890aSEmmanuel Vadot};
231f126890aSEmmanuel Vadot
232f126890aSEmmanuel Vadot&reg_dcdc5 {
233f126890aSEmmanuel Vadot	regulator-always-on;
234f126890aSEmmanuel Vadot	regulator-min-microvolt = <1500000>;
235f126890aSEmmanuel Vadot	regulator-max-microvolt = <1500000>;
236f126890aSEmmanuel Vadot	regulator-name = "vcc-dram";
237f126890aSEmmanuel Vadot};
238f126890aSEmmanuel Vadot
239f126890aSEmmanuel Vadot/*
240f126890aSEmmanuel Vadot * Our WiFi chip needs both DLDO1 and DLDO2 to be powered at the same
241f126890aSEmmanuel Vadot * time, with the two being in sync. Since this is not really
242f126890aSEmmanuel Vadot * supported right now, just use the two as always on, and we will fix
243f126890aSEmmanuel Vadot * it later.
244f126890aSEmmanuel Vadot */
245f126890aSEmmanuel Vadot&reg_dldo1 {
246f126890aSEmmanuel Vadot	regulator-always-on;
247f126890aSEmmanuel Vadot	regulator-min-microvolt = <3300000>;
248f126890aSEmmanuel Vadot	regulator-max-microvolt = <3300000>;
249f126890aSEmmanuel Vadot	regulator-name = "vcc-wifi0";
250f126890aSEmmanuel Vadot};
251f126890aSEmmanuel Vadot
252f126890aSEmmanuel Vadot&reg_dldo2 {
253f126890aSEmmanuel Vadot	regulator-always-on;
254f126890aSEmmanuel Vadot	regulator-min-microvolt = <3300000>;
255f126890aSEmmanuel Vadot	regulator-max-microvolt = <3300000>;
256f126890aSEmmanuel Vadot	regulator-name = "vcc-wifi1";
257f126890aSEmmanuel Vadot};
258f126890aSEmmanuel Vadot
259f126890aSEmmanuel Vadot&reg_drivevbus {
260f126890aSEmmanuel Vadot	regulator-name = "usb0-vbus";
261f126890aSEmmanuel Vadot	status = "okay";
262f126890aSEmmanuel Vadot};
263f126890aSEmmanuel Vadot
264f126890aSEmmanuel Vadot&reg_rtc_ldo {
265f126890aSEmmanuel Vadot	regulator-name = "vcc-rtc";
266f126890aSEmmanuel Vadot};
267f126890aSEmmanuel Vadot
268f126890aSEmmanuel Vadot&sound {
269f126890aSEmmanuel Vadot	status = "okay";
270f126890aSEmmanuel Vadot};
271f126890aSEmmanuel Vadot
272f126890aSEmmanuel Vadot&uart0 {
273f126890aSEmmanuel Vadot	pinctrl-names = "default";
274f126890aSEmmanuel Vadot	pinctrl-0 = <&uart0_pb_pins>;
275f126890aSEmmanuel Vadot	status = "okay";
276f126890aSEmmanuel Vadot};
277f126890aSEmmanuel Vadot
278f126890aSEmmanuel Vadot&uart1 {
279f126890aSEmmanuel Vadot	pinctrl-names = "default";
280f126890aSEmmanuel Vadot	pinctrl-0 = <&uart1_pg_pins>, <&uart1_cts_rts_pg_pins>;
281f126890aSEmmanuel Vadot	uart-has-rtscts;
282f126890aSEmmanuel Vadot	status = "okay";
283f126890aSEmmanuel Vadot
284f126890aSEmmanuel Vadot	bluetooth {
285f126890aSEmmanuel Vadot		compatible = "brcm,bcm43438-bt";
286f126890aSEmmanuel Vadot		clocks = <&rtc CLK_OSC32K_FANOUT>;
287f126890aSEmmanuel Vadot		clock-names = "lpo";
288f126890aSEmmanuel Vadot		vbat-supply = <&reg_dldo1>;
289f126890aSEmmanuel Vadot		vddio-supply = <&reg_aldo3>;
290f126890aSEmmanuel Vadot		device-wakeup-gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
291f126890aSEmmanuel Vadot		host-wakeup-gpios = <&r_pio 0 9 GPIO_ACTIVE_HIGH>; /* PL9 */
292f126890aSEmmanuel Vadot		shutdown-gpios = <&r_pio 0 8 GPIO_ACTIVE_HIGH>; /* PL8 */
293f126890aSEmmanuel Vadot	};
294f126890aSEmmanuel Vadot};
295f126890aSEmmanuel Vadot
296f126890aSEmmanuel Vadot&usb_otg {
297f126890aSEmmanuel Vadot	dr_mode = "otg";
298f126890aSEmmanuel Vadot	status = "okay";
299f126890aSEmmanuel Vadot};
300f126890aSEmmanuel Vadot
301f126890aSEmmanuel Vadot&usb_power_supply {
302f126890aSEmmanuel Vadot	status = "okay";
303f126890aSEmmanuel Vadot};
304f126890aSEmmanuel Vadot
305f126890aSEmmanuel Vadot&usbphy {
306f126890aSEmmanuel Vadot	usb0_id_det-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */
307f126890aSEmmanuel Vadot	usb0_vbus_power-supply = <&usb_power_supply>;
308f126890aSEmmanuel Vadot	usb0_vbus-supply = <&reg_drivevbus>;
309f126890aSEmmanuel Vadot	usb1_vbus-supply = <&reg_vcc5v0>;
310f126890aSEmmanuel Vadot	status = "okay";
311f126890aSEmmanuel Vadot};
312