1/*
2 * Copyright (C) 2017 Chen-Yu Tsai <wens@csie.org>
3 * Copyright (C) 2017 Icenowy Zheng <icenowy@aosc.io>
4 *
5 * This file is dual-licensed: you can use it either under the terms
6 * of the GPL or the X11 license, at your option. Note that this dual
7 * licensing only applies to this file, and not this project as a
8 * whole.
9 *
10 *  a) This file is free software; you can redistribute it and/or
11 *     modify it under the terms of the GNU General Public License as
12 *     published by the Free Software Foundation; either version 2 of the
13 *     License, or (at your option) any later version.
14 *
15 *     This file is distributed in the hope that it will be useful,
16 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
17 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 *     GNU General Public License for more details.
19 *
20 * Or, alternatively,
21 *
22 *  b) Permission is hereby granted, free of charge, to any person
23 *     obtaining a copy of this software and associated documentation
24 *     files (the "Software"), to deal in the Software without
25 *     restriction, including without limitation the rights to use,
26 *     copy, modify, merge, publish, distribute, sublicense, and/or
27 *     sell copies of the Software, and to permit persons to whom the
28 *     Software is furnished to do so, subject to the following
29 *     conditions:
30 *
31 *     The above copyright notice and this permission notice shall be
32 *     included in all copies or substantial portions of the Software.
33 *
34 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
35 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
36 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
37 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
38 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
39 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
41 *     OTHER DEALINGS IN THE SOFTWARE.
42 */
43
44/dts-v1/;
45#include "sun8i-r40.dtsi"
46
47#include <dt-bindings/gpio/gpio.h>
48
49/ {
50	model = "Banana Pi BPI-M2-Ultra";
51	compatible = "sinovoip,bpi-m2-ultra", "allwinner,sun8i-r40";
52
53	aliases {
54		ethernet0 = &gmac;
55		serial0 = &uart0;
56	};
57
58	chosen {
59		stdout-path = "serial0:115200n8";
60	};
61
62	connector {
63		compatible = "hdmi-connector";
64		type = "a";
65
66		port {
67			hdmi_con_in: endpoint {
68				remote-endpoint = <&hdmi_out_con>;
69			};
70		};
71	};
72
73	leds {
74		compatible = "gpio-leds";
75
76		pwr-led {
77			label = "bananapi:red:pwr";
78			gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
79			default-state = "on";
80		};
81
82		user-led-green {
83			label = "bananapi:green:user";
84			gpios = <&pio 7 21 GPIO_ACTIVE_HIGH>;
85		};
86
87		user-led-blue {
88			label = "bananapi:blue:user";
89			gpios = <&pio 7 22 GPIO_ACTIVE_HIGH>;
90		};
91	};
92
93	reg_vcc5v0: vcc5v0 {
94		compatible = "regulator-fixed";
95		regulator-name = "vcc5v0";
96		regulator-min-microvolt = <5000000>;
97		regulator-max-microvolt = <5000000>;
98		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
99		enable-active-high;
100	};
101
102	wifi_pwrseq: wifi_pwrseq {
103		compatible = "mmc-pwrseq-simple";
104		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
105	};
106};
107
108&de {
109	status = "okay";
110};
111
112&ehci1 {
113	status = "okay";
114};
115
116&ehci2 {
117	status = "okay";
118};
119
120&gmac {
121	pinctrl-names = "default";
122	pinctrl-0 = <&gmac_rgmii_pins>;
123	phy-handle = <&phy1>;
124	phy-mode = "rgmii";
125	phy-supply = <&reg_dc1sw>;
126	status = "okay";
127};
128
129&gmac_mdio {
130	phy1: ethernet-phy@1 {
131		compatible = "ethernet-phy-ieee802.3-c22";
132		reg = <1>;
133	};
134};
135
136&hdmi {
137	status = "okay";
138};
139
140&hdmi_out {
141	hdmi_out_con: endpoint {
142		remote-endpoint = <&hdmi_con_in>;
143	};
144};
145
146&i2c0 {
147	status = "okay";
148
149	axp22x: pmic@34 {
150		compatible = "x-powers,axp221";
151		reg = <0x34>;
152		interrupt-parent = <&nmi_intc>;
153		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
154	};
155};
156
157#include "axp22x.dtsi"
158
159&mmc0 {
160	vmmc-supply = <&reg_dcdc1>;
161	bus-width = <4>;
162	cd-gpios = <&pio 7 13 GPIO_ACTIVE_HIGH>; /* PH13 */
163	cd-inverted;
164	status = "okay";
165};
166
167&mmc1 {
168	pinctrl-names = "default";
169	pinctrl-0 = <&mmc1_pg_pins>;
170	vmmc-supply = <&reg_dldo2>;
171	vqmmc-supply = <&reg_dldo1>;
172	mmc-pwrseq = <&wifi_pwrseq>;
173	bus-width = <4>;
174	non-removable;
175	status = "okay";
176};
177
178&mmc2 {
179	vmmc-supply = <&reg_dcdc1>;
180	vqmmc-supply = <&reg_dcdc1>;
181	bus-width = <8>;
182	non-removable;
183	status = "okay";
184};
185
186&ohci1 {
187	status = "okay";
188};
189
190&ohci2 {
191	status = "okay";
192};
193
194&reg_aldo2 {
195	regulator-always-on;
196	regulator-min-microvolt = <2500000>;
197	regulator-max-microvolt = <2500000>;
198	regulator-name = "vcc-pa";
199};
200
201&reg_aldo3 {
202	regulator-always-on;
203	regulator-min-microvolt = <2700000>;
204	regulator-max-microvolt = <3300000>;
205	regulator-name = "avcc";
206};
207
208&reg_dc1sw {
209	regulator-min-microvolt = <3000000>;
210	regulator-max-microvolt = <3000000>;
211	regulator-name = "vcc-gmac-phy";
212};
213
214&reg_dcdc1 {
215	regulator-always-on;
216	regulator-min-microvolt = <3000000>;
217	regulator-max-microvolt = <3000000>;
218	regulator-name = "vcc-3v0";
219};
220
221&reg_dcdc2 {
222	regulator-always-on;
223	regulator-min-microvolt = <1000000>;
224	regulator-max-microvolt = <1300000>;
225	regulator-name = "vdd-cpu";
226};
227
228&reg_dcdc3 {
229	regulator-always-on;
230	regulator-min-microvolt = <1000000>;
231	regulator-max-microvolt = <1300000>;
232	regulator-name = "vdd-sys";
233};
234
235&reg_dcdc5 {
236	regulator-always-on;
237	regulator-min-microvolt = <1500000>;
238	regulator-max-microvolt = <1500000>;
239	regulator-name = "vcc-dram";
240};
241
242&reg_dldo1 {
243	regulator-min-microvolt = <1800000>;
244	regulator-max-microvolt = <3300000>;
245	regulator-name = "vcc-wifi-io";
246};
247
248&reg_dldo2 {
249	regulator-min-microvolt = <3300000>;
250	regulator-max-microvolt = <3300000>;
251	regulator-name = "vcc-wifi";
252};
253
254&tcon_tv0 {
255	status = "okay";
256};
257
258&uart0 {
259	pinctrl-names = "default";
260	pinctrl-0 = <&uart0_pb_pins>;
261	status = "okay";
262};
263
264&usbphy {
265	usb1_vbus-supply = <&reg_vcc5v0>;
266	usb2_vbus-supply = <&reg_vcc5v0>;
267	status = "okay";
268};
269