1*724ba675SRob Herring/*
2*724ba675SRob Herring * Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
3*724ba675SRob Herring * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
4*724ba675SRob Herring *
5*724ba675SRob Herring * This file is dual-licensed: you can use it either under the terms
6*724ba675SRob Herring * of the GPL or the X11 license, at your option. Note that this dual
7*724ba675SRob Herring * licensing only applies to this file, and not this project as a
8*724ba675SRob Herring * whole.
9*724ba675SRob Herring *
10*724ba675SRob Herring *  a) This file is free software; you can redistribute it and/or
11*724ba675SRob Herring *     modify it under the terms of the GNU General Public License as
12*724ba675SRob Herring *     published by the Free Software Foundation; either version 2 of the
13*724ba675SRob Herring *     License, or (at your option) any later version.
14*724ba675SRob Herring *
15*724ba675SRob Herring *     This file is distributed in the hope that it will be useful,
16*724ba675SRob Herring *     but WITHOUT ANY WARRANTY; without even the implied warranty of
17*724ba675SRob Herring *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*724ba675SRob Herring *     GNU General Public License for more details.
19*724ba675SRob Herring *
20*724ba675SRob Herring * Or, alternatively,
21*724ba675SRob Herring *
22*724ba675SRob Herring *  b) Permission is hereby granted, free of charge, to any person
23*724ba675SRob Herring *     obtaining a copy of this software and associated documentation
24*724ba675SRob Herring *     files (the "Software"), to deal in the Software without
25*724ba675SRob Herring *     restriction, including without limitation the rights to use,
26*724ba675SRob Herring *     copy, modify, merge, publish, distribute, sublicense, and/or
27*724ba675SRob Herring *     sell copies of the Software, and to permit persons to whom the
28*724ba675SRob Herring *     Software is furnished to do so, subject to the following
29*724ba675SRob Herring *     conditions:
30*724ba675SRob Herring *
31*724ba675SRob Herring *     The above copyright notice and this permission notice shall be
32*724ba675SRob Herring *     included in all copies or substantial portions of the Software.
33*724ba675SRob Herring *
34*724ba675SRob Herring *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35*724ba675SRob Herring *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
36*724ba675SRob Herring *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37*724ba675SRob Herring *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
38*724ba675SRob Herring *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
39*724ba675SRob Herring *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40*724ba675SRob Herring *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
41*724ba675SRob Herring *     OTHER DEALINGS IN THE SOFTWARE.
42*724ba675SRob Herring */
43*724ba675SRob Herring
44*724ba675SRob Herring/dts-v1/;
45*724ba675SRob Herring#include "sun8i-r40.dtsi"
46*724ba675SRob Herring#include "sun8i-r40-cpu-opp.dtsi"
47*724ba675SRob Herring
48*724ba675SRob Herring#include <dt-bindings/gpio/gpio.h>
49*724ba675SRob Herring
50*724ba675SRob Herring/ {
51*724ba675SRob Herring	model = "Banana Pi BPI-M2-Ultra";
52*724ba675SRob Herring	compatible = "sinovoip,bpi-m2-ultra", "allwinner,sun8i-r40";
53*724ba675SRob Herring
54*724ba675SRob Herring	aliases {
55*724ba675SRob Herring		ethernet0 = &gmac;
56*724ba675SRob Herring		serial0 = &uart0;
57*724ba675SRob Herring	};
58*724ba675SRob Herring
59*724ba675SRob Herring	chosen {
60*724ba675SRob Herring		stdout-path = "serial0:115200n8";
61*724ba675SRob Herring	};
62*724ba675SRob Herring
63*724ba675SRob Herring	connector {
64*724ba675SRob Herring		compatible = "hdmi-connector";
65*724ba675SRob Herring		type = "a";
66*724ba675SRob Herring
67*724ba675SRob Herring		port {
68*724ba675SRob Herring			hdmi_con_in: endpoint {
69*724ba675SRob Herring				remote-endpoint = <&hdmi_out_con>;
70*724ba675SRob Herring			};
71*724ba675SRob Herring		};
72*724ba675SRob Herring	};
73*724ba675SRob Herring
74*724ba675SRob Herring	leds {
75*724ba675SRob Herring		compatible = "gpio-leds";
76*724ba675SRob Herring
77*724ba675SRob Herring		pwr-led {
78*724ba675SRob Herring			label = "bananapi:red:pwr";
79*724ba675SRob Herring			gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
80*724ba675SRob Herring			default-state = "on";
81*724ba675SRob Herring		};
82*724ba675SRob Herring
83*724ba675SRob Herring		user-led-green {
84*724ba675SRob Herring			label = "bananapi:green:user";
85*724ba675SRob Herring			gpios = <&pio 7 21 GPIO_ACTIVE_HIGH>;
86*724ba675SRob Herring		};
87*724ba675SRob Herring
88*724ba675SRob Herring		user-led-blue {
89*724ba675SRob Herring			label = "bananapi:blue:user";
90*724ba675SRob Herring			gpios = <&pio 7 22 GPIO_ACTIVE_HIGH>;
91*724ba675SRob Herring		};
92*724ba675SRob Herring	};
93*724ba675SRob Herring
94*724ba675SRob Herring	reg_vcc5v0: vcc5v0 {
95*724ba675SRob Herring		compatible = "regulator-fixed";
96*724ba675SRob Herring		regulator-name = "vcc5v0";
97*724ba675SRob Herring		regulator-min-microvolt = <5000000>;
98*724ba675SRob Herring		regulator-max-microvolt = <5000000>;
99*724ba675SRob Herring		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
100*724ba675SRob Herring		enable-active-high;
101*724ba675SRob Herring	};
102*724ba675SRob Herring
103*724ba675SRob Herring	wifi_pwrseq: wifi_pwrseq {
104*724ba675SRob Herring		compatible = "mmc-pwrseq-simple";
105*724ba675SRob Herring		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
106*724ba675SRob Herring		clocks = <&ccu CLK_OUTA>;
107*724ba675SRob Herring		clock-names = "ext_clock";
108*724ba675SRob Herring	};
109*724ba675SRob Herring};
110*724ba675SRob Herring
111*724ba675SRob Herring&ahci {
112*724ba675SRob Herring	ahci-supply = <&reg_dldo4>;
113*724ba675SRob Herring	phy-supply = <&reg_eldo3>;
114*724ba675SRob Herring	status = "okay";
115*724ba675SRob Herring};
116*724ba675SRob Herring
117*724ba675SRob Herring&cpu0 {
118*724ba675SRob Herring	cpu-supply = <&reg_dcdc2>;
119*724ba675SRob Herring};
120*724ba675SRob Herring
121*724ba675SRob Herring&de {
122*724ba675SRob Herring	status = "okay";
123*724ba675SRob Herring};
124*724ba675SRob Herring
125*724ba675SRob Herring&ehci1 {
126*724ba675SRob Herring	status = "okay";
127*724ba675SRob Herring};
128*724ba675SRob Herring
129*724ba675SRob Herring&ehci2 {
130*724ba675SRob Herring	status = "okay";
131*724ba675SRob Herring};
132*724ba675SRob Herring
133*724ba675SRob Herring&gmac {
134*724ba675SRob Herring	pinctrl-names = "default";
135*724ba675SRob Herring	pinctrl-0 = <&gmac_rgmii_pins>;
136*724ba675SRob Herring	phy-handle = <&phy1>;
137*724ba675SRob Herring	phy-mode = "rgmii-id";
138*724ba675SRob Herring	phy-supply = <&reg_dc1sw>;
139*724ba675SRob Herring	status = "okay";
140*724ba675SRob Herring};
141*724ba675SRob Herring
142*724ba675SRob Herring&gmac_mdio {
143*724ba675SRob Herring	phy1: ethernet-phy@1 {
144*724ba675SRob Herring		compatible = "ethernet-phy-ieee802.3-c22";
145*724ba675SRob Herring		reg = <1>;
146*724ba675SRob Herring	};
147*724ba675SRob Herring};
148*724ba675SRob Herring
149*724ba675SRob Herring&hdmi {
150*724ba675SRob Herring	status = "okay";
151*724ba675SRob Herring};
152*724ba675SRob Herring
153*724ba675SRob Herring&hdmi_out {
154*724ba675SRob Herring	hdmi_out_con: endpoint {
155*724ba675SRob Herring		remote-endpoint = <&hdmi_con_in>;
156*724ba675SRob Herring	};
157*724ba675SRob Herring};
158*724ba675SRob Herring
159*724ba675SRob Herring&i2c0 {
160*724ba675SRob Herring	status = "okay";
161*724ba675SRob Herring
162*724ba675SRob Herring	axp22x: pmic@34 {
163*724ba675SRob Herring		compatible = "x-powers,axp221";
164*724ba675SRob Herring		reg = <0x34>;
165*724ba675SRob Herring		interrupt-parent = <&nmi_intc>;
166*724ba675SRob Herring		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
167*724ba675SRob Herring	};
168*724ba675SRob Herring};
169*724ba675SRob Herring
170*724ba675SRob Herring#include "axp22x.dtsi"
171*724ba675SRob Herring
172*724ba675SRob Herring&ir0 {
173*724ba675SRob Herring	status = "okay";
174*724ba675SRob Herring};
175*724ba675SRob Herring
176*724ba675SRob Herring&mmc0 {
177*724ba675SRob Herring	vmmc-supply = <&reg_dcdc1>;
178*724ba675SRob Herring	bus-width = <4>;
179*724ba675SRob Herring	cd-gpios = <&pio 7 13 GPIO_ACTIVE_LOW>; /* PH13 */
180*724ba675SRob Herring	status = "okay";
181*724ba675SRob Herring};
182*724ba675SRob Herring
183*724ba675SRob Herring&mmc1 {
184*724ba675SRob Herring	pinctrl-names = "default";
185*724ba675SRob Herring	pinctrl-0 = <&mmc1_pg_pins>;
186*724ba675SRob Herring	vmmc-supply = <&reg_dldo2>;
187*724ba675SRob Herring	vqmmc-supply = <&reg_dldo1>;
188*724ba675SRob Herring	mmc-pwrseq = <&wifi_pwrseq>;
189*724ba675SRob Herring	bus-width = <4>;
190*724ba675SRob Herring	non-removable;
191*724ba675SRob Herring	status = "okay";
192*724ba675SRob Herring};
193*724ba675SRob Herring
194*724ba675SRob Herring&mmc2 {
195*724ba675SRob Herring	vmmc-supply = <&reg_dcdc1>;
196*724ba675SRob Herring	vqmmc-supply = <&reg_dcdc1>;
197*724ba675SRob Herring	bus-width = <8>;
198*724ba675SRob Herring	non-removable;
199*724ba675SRob Herring	status = "okay";
200*724ba675SRob Herring};
201*724ba675SRob Herring
202*724ba675SRob Herring&ohci1 {
203*724ba675SRob Herring	status = "okay";
204*724ba675SRob Herring};
205*724ba675SRob Herring
206*724ba675SRob Herring&ohci2 {
207*724ba675SRob Herring	status = "okay";
208*724ba675SRob Herring};
209*724ba675SRob Herring
210*724ba675SRob Herring&pio {
211*724ba675SRob Herring	pinctrl-names = "default";
212*724ba675SRob Herring	pinctrl-0 = <&clk_out_a_pin>;
213*724ba675SRob Herring	vcc-pa-supply = <&reg_aldo2>;
214*724ba675SRob Herring	vcc-pc-supply = <&reg_dcdc1>;
215*724ba675SRob Herring	vcc-pd-supply = <&reg_dcdc1>;
216*724ba675SRob Herring	vcc-pe-supply = <&reg_eldo1>;
217*724ba675SRob Herring	vcc-pf-supply = <&reg_dcdc1>;
218*724ba675SRob Herring	vcc-pg-supply = <&reg_dldo1>;
219*724ba675SRob Herring};
220*724ba675SRob Herring
221*724ba675SRob Herring&reg_aldo2 {
222*724ba675SRob Herring	regulator-min-microvolt = <2500000>;
223*724ba675SRob Herring	regulator-max-microvolt = <2500000>;
224*724ba675SRob Herring	regulator-name = "vcc-pa";
225*724ba675SRob Herring};
226*724ba675SRob Herring
227*724ba675SRob Herring&reg_aldo3 {
228*724ba675SRob Herring	regulator-always-on;
229*724ba675SRob Herring	regulator-min-microvolt = <2700000>;
230*724ba675SRob Herring	regulator-max-microvolt = <3300000>;
231*724ba675SRob Herring	regulator-name = "avcc";
232*724ba675SRob Herring};
233*724ba675SRob Herring
234*724ba675SRob Herring&reg_dc1sw {
235*724ba675SRob Herring	regulator-min-microvolt = <3300000>;
236*724ba675SRob Herring	regulator-max-microvolt = <3300000>;
237*724ba675SRob Herring	regulator-name = "vcc-gmac-phy";
238*724ba675SRob Herring};
239*724ba675SRob Herring
240*724ba675SRob Herring&reg_dcdc1 {
241*724ba675SRob Herring	regulator-always-on;
242*724ba675SRob Herring	regulator-min-microvolt = <3300000>;
243*724ba675SRob Herring	regulator-max-microvolt = <3300000>;
244*724ba675SRob Herring	regulator-name = "vcc-3v3";
245*724ba675SRob Herring};
246*724ba675SRob Herring
247*724ba675SRob Herring&reg_dcdc2 {
248*724ba675SRob Herring	regulator-always-on;
249*724ba675SRob Herring	regulator-min-microvolt = <1000000>;
250*724ba675SRob Herring	regulator-max-microvolt = <1300000>;
251*724ba675SRob Herring	regulator-name = "vdd-cpu";
252*724ba675SRob Herring};
253*724ba675SRob Herring
254*724ba675SRob Herring&reg_dcdc3 {
255*724ba675SRob Herring	regulator-always-on;
256*724ba675SRob Herring	regulator-min-microvolt = <1000000>;
257*724ba675SRob Herring	regulator-max-microvolt = <1300000>;
258*724ba675SRob Herring	regulator-name = "vdd-sys";
259*724ba675SRob Herring};
260*724ba675SRob Herring
261*724ba675SRob Herring&reg_dcdc5 {
262*724ba675SRob Herring	regulator-always-on;
263*724ba675SRob Herring	regulator-min-microvolt = <1500000>;
264*724ba675SRob Herring	regulator-max-microvolt = <1500000>;
265*724ba675SRob Herring	regulator-name = "vcc-dram";
266*724ba675SRob Herring};
267*724ba675SRob Herring
268*724ba675SRob Herring&reg_dldo1 {
269*724ba675SRob Herring	regulator-min-microvolt = <1800000>;
270*724ba675SRob Herring	regulator-max-microvolt = <3300000>;
271*724ba675SRob Herring	regulator-name = "vcc-wifi-io";
272*724ba675SRob Herring};
273*724ba675SRob Herring
274*724ba675SRob Herring/*
275*724ba675SRob Herring * Our WiFi chip needs both DLDO2 and DLDO3 to be powered at the same
276*724ba675SRob Herring * time, with the two being in sync, to be able to meet maximum power
277*724ba675SRob Herring * consumption during transmits. Since this is not really supported
278*724ba675SRob Herring * right now, just use the two as always on, and we will fix it later.
279*724ba675SRob Herring */
280*724ba675SRob Herring
281*724ba675SRob Herring&reg_dldo2 {
282*724ba675SRob Herring	regulator-always-on;
283*724ba675SRob Herring	regulator-min-microvolt = <3300000>;
284*724ba675SRob Herring	regulator-max-microvolt = <3300000>;
285*724ba675SRob Herring	regulator-name = "vcc-wifi";
286*724ba675SRob Herring};
287*724ba675SRob Herring
288*724ba675SRob Herring&reg_dldo3 {
289*724ba675SRob Herring	regulator-always-on;
290*724ba675SRob Herring	regulator-min-microvolt = <3300000>;
291*724ba675SRob Herring	regulator-max-microvolt = <3300000>;
292*724ba675SRob Herring	regulator-name = "vcc-wifi-2";
293*724ba675SRob Herring};
294*724ba675SRob Herring
295*724ba675SRob Herring&reg_dldo4 {
296*724ba675SRob Herring	regulator-min-microvolt = <2500000>;
297*724ba675SRob Herring	regulator-max-microvolt = <2500000>;
298*724ba675SRob Herring	regulator-name = "vdd2v5-sata";
299*724ba675SRob Herring};
300*724ba675SRob Herring
301*724ba675SRob Herring&reg_eldo3 {
302*724ba675SRob Herring	regulator-min-microvolt = <1200000>;
303*724ba675SRob Herring	regulator-max-microvolt = <1200000>;
304*724ba675SRob Herring	regulator-name = "vdd1v2-sata";
305*724ba675SRob Herring};
306*724ba675SRob Herring
307*724ba675SRob Herring&tcon_tv0 {
308*724ba675SRob Herring	status = "okay";
309*724ba675SRob Herring};
310*724ba675SRob Herring
311*724ba675SRob Herring&uart0 {
312*724ba675SRob Herring	pinctrl-names = "default";
313*724ba675SRob Herring	pinctrl-0 = <&uart0_pb_pins>;
314*724ba675SRob Herring	status = "okay";
315*724ba675SRob Herring};
316*724ba675SRob Herring
317*724ba675SRob Herring&uart3 {
318*724ba675SRob Herring	pinctrl-names = "default";
319*724ba675SRob Herring	pinctrl-0 = <&uart3_pg_pins>, <&uart3_rts_cts_pg_pins>;
320*724ba675SRob Herring	uart-has-rtscts;
321*724ba675SRob Herring	status = "okay";
322*724ba675SRob Herring
323*724ba675SRob Herring	bluetooth {
324*724ba675SRob Herring		compatible = "brcm,bcm43438-bt";
325*724ba675SRob Herring		clocks = <&ccu CLK_OUTA>;
326*724ba675SRob Herring		clock-names = "lpo";
327*724ba675SRob Herring		vbat-supply = <&reg_dldo2>;
328*724ba675SRob Herring		vddio-supply = <&reg_dldo1>;
329*724ba675SRob Herring		device-wakeup-gpios = <&pio 6 11 GPIO_ACTIVE_HIGH>; /* PG11 */
330*724ba675SRob Herring		/* TODO host wake line connected to PMIC GPIO pins */
331*724ba675SRob Herring		shutdown-gpios = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */
332*724ba675SRob Herring		max-speed = <1500000>;
333*724ba675SRob Herring	};
334*724ba675SRob Herring};
335*724ba675SRob Herring
336*724ba675SRob Herring&usbphy {
337*724ba675SRob Herring	usb1_vbus-supply = <&reg_vcc5v0>;
338*724ba675SRob Herring	usb2_vbus-supply = <&reg_vcc5v0>;
339*724ba675SRob Herring	status = "okay";
340*724ba675SRob Herring};
341