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