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	leds {
63		compatible = "gpio-leds";
64
65		pwr-led {
66			label = "bananapi:red:pwr";
67			gpios = <&pio 7 20 GPIO_ACTIVE_HIGH>;
68			default-state = "on";
69		};
70
71		user-led-green {
72			label = "bananapi:green:user";
73			gpios = <&pio 7 21 GPIO_ACTIVE_HIGH>;
74		};
75
76		user-led-blue {
77			label = "bananapi:blue:user";
78			gpios = <&pio 7 22 GPIO_ACTIVE_HIGH>;
79		};
80	};
81
82	reg_vcc5v0: vcc5v0 {
83		compatible = "regulator-fixed";
84		regulator-name = "vcc5v0";
85		regulator-min-microvolt = <5000000>;
86		regulator-max-microvolt = <5000000>;
87		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
88		enable-active-high;
89	};
90
91	wifi_pwrseq: wifi_pwrseq {
92		compatible = "mmc-pwrseq-simple";
93		reset-gpios = <&pio 6 10 GPIO_ACTIVE_LOW>; /* PG10 WIFI_EN */
94	};
95};
96
97&ehci1 {
98	status = "okay";
99};
100
101&ehci2 {
102	status = "okay";
103};
104
105&gmac {
106	pinctrl-names = "default";
107	pinctrl-0 = <&gmac_rgmii_pins>;
108	phy-handle = <&phy1>;
109	phy-mode = "rgmii";
110	phy-supply = <&reg_dc1sw>;
111	status = "okay";
112};
113
114&gmac_mdio {
115	phy1: ethernet-phy@1 {
116		compatible = "ethernet-phy-ieee802.3-c22";
117		reg = <1>;
118	};
119};
120
121&i2c0 {
122	status = "okay";
123
124	axp22x: pmic@34 {
125		compatible = "x-powers,axp221";
126		reg = <0x34>;
127		interrupt-parent = <&nmi_intc>;
128		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
129	};
130};
131
132#include "axp22x.dtsi"
133
134&mmc0 {
135	vmmc-supply = <&reg_dcdc1>;
136	bus-width = <4>;
137	cd-gpios = <&pio 7 13 GPIO_ACTIVE_HIGH>; /* PH13 */
138	cd-inverted;
139	status = "okay";
140};
141
142&mmc1 {
143	pinctrl-names = "default";
144	pinctrl-0 = <&mmc1_pg_pins>;
145	vmmc-supply = <&reg_dldo2>;
146	vqmmc-supply = <&reg_dldo1>;
147	mmc-pwrseq = <&wifi_pwrseq>;
148	bus-width = <4>;
149	non-removable;
150	status = "okay";
151};
152
153&mmc2 {
154	vmmc-supply = <&reg_dcdc1>;
155	vqmmc-supply = <&reg_dcdc1>;
156	bus-width = <8>;
157	non-removable;
158	status = "okay";
159};
160
161&ohci1 {
162	status = "okay";
163};
164
165&ohci2 {
166	status = "okay";
167};
168
169&reg_aldo2 {
170	regulator-always-on;
171	regulator-min-microvolt = <2500000>;
172	regulator-max-microvolt = <2500000>;
173	regulator-name = "vcc-pa";
174};
175
176&reg_aldo3 {
177	regulator-always-on;
178	regulator-min-microvolt = <2700000>;
179	regulator-max-microvolt = <3300000>;
180	regulator-name = "avcc";
181};
182
183&reg_dc1sw {
184	regulator-min-microvolt = <3000000>;
185	regulator-max-microvolt = <3000000>;
186	regulator-name = "vcc-gmac-phy";
187};
188
189&reg_dcdc1 {
190	regulator-always-on;
191	regulator-min-microvolt = <3000000>;
192	regulator-max-microvolt = <3000000>;
193	regulator-name = "vcc-3v0";
194};
195
196&reg_dcdc2 {
197	regulator-always-on;
198	regulator-min-microvolt = <1000000>;
199	regulator-max-microvolt = <1300000>;
200	regulator-name = "vdd-cpu";
201};
202
203&reg_dcdc3 {
204	regulator-always-on;
205	regulator-min-microvolt = <1000000>;
206	regulator-max-microvolt = <1300000>;
207	regulator-name = "vdd-sys";
208};
209
210&reg_dcdc5 {
211	regulator-always-on;
212	regulator-min-microvolt = <1500000>;
213	regulator-max-microvolt = <1500000>;
214	regulator-name = "vcc-dram";
215};
216
217&reg_dldo1 {
218	regulator-min-microvolt = <1800000>;
219	regulator-max-microvolt = <3300000>;
220	regulator-name = "vcc-wifi-io";
221};
222
223&reg_dldo2 {
224	regulator-min-microvolt = <3300000>;
225	regulator-max-microvolt = <3300000>;
226	regulator-name = "vcc-wifi";
227};
228
229&uart0 {
230	pinctrl-names = "default";
231	pinctrl-0 = <&uart0_pb_pins>;
232	status = "okay";
233};
234
235&usbphy {
236	usb1_vbus-supply = <&reg_vcc5v0>;
237	usb2_vbus-supply = <&reg_vcc5v0>;
238	status = "okay";
239};
240