1/*
2 * Copyright 2015 Hans de Goede <hdegoede@redhat.com>
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 *     You should have received a copy of the GNU General Public
20 *     License along with this file; if not, write to the Free
21 *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
22 *     MA 02110-1301 USA
23 *
24 * Or, alternatively,
25 *
26 *  b) Permission is hereby granted, free of charge, to any person
27 *     obtaining a copy of this software and associated documentation
28 *     files (the "Software"), to deal in the Software without
29 *     restriction, including without limitation the rights to use,
30 *     copy, modify, merge, publish, distribute, sublicense, and/or
31 *     sell copies of the Software, and to permit persons to whom the
32 *     Software is furnished to do so, subject to the following
33 *     conditions:
34 *
35 *     The above copyright notice and this permission notice shall be
36 *     included in all copies or substantial portions of the Software.
37 *
38 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
39 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
40 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
41 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
42 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
43 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
44 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
45 *     OTHER DEALINGS IN THE SOFTWARE.
46 */
47
48/dts-v1/;
49#include "sun7i-a20.dtsi"
50#include "sunxi-common-regulators.dtsi"
51#include <dt-bindings/gpio/gpio.h>
52#include <dt-bindings/interrupt-controller/arm-gic.h>
53
54/ {
55	model = "LeMaker Banana Pro";
56	compatible = "lemaker,bananapro", "allwinner,sun7i-a20";
57
58	aliases {
59		serial0 = &uart0;
60		serial1 = &uart2;
61		serial2 = &uart7;
62	};
63
64	chosen {
65		stdout-path = "serial0:115200n8";
66	};
67
68	leds {
69		compatible = "gpio-leds";
70		pinctrl-names = "default";
71		pinctrl-0 = <&led_pins_bananapro>;
72
73		blue {
74			label = "bananapro:blue:usr";
75			gpios = <&pio 6 2 GPIO_ACTIVE_HIGH>;
76		};
77
78		green {
79			label = "bananapro:green:usr";
80			gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>;
81		};
82	};
83
84	reg_gmac_3v3: gmac-3v3 {
85		compatible = "regulator-fixed";
86		pinctrl-names = "default";
87		pinctrl-0 = <&gmac_power_pin_bananapro>;
88		regulator-name = "gmac-3v3";
89		regulator-min-microvolt = <3300000>;
90		regulator-max-microvolt = <3300000>;
91		startup-delay-us = <100000>;
92		enable-active-high;
93		gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>;
94	};
95
96	reg_vmmc3: vmmc3 {
97		compatible = "regulator-fixed";
98		pinctrl-names = "default";
99		pinctrl-0 = <&vmmc3_pin_bananapro>;
100		regulator-name = "vmmc3";
101		regulator-min-microvolt = <3300000>;
102		regulator-max-microvolt = <3300000>;
103		enable-active-high;
104		gpio = <&pio 7 22 GPIO_ACTIVE_HIGH>;
105	};
106};
107
108&ahci {
109	status = "okay";
110};
111
112&ehci0 {
113	status = "okay";
114};
115
116&ehci1 {
117	status = "okay";
118};
119
120&gmac {
121	pinctrl-names = "default";
122	pinctrl-0 = <&gmac_pins_rgmii_a>;
123	phy = <&phy1>;
124	phy-mode = "rgmii";
125	phy-supply = <&reg_gmac_3v3>;
126	status = "okay";
127
128	phy1: ethernet-phy@1 {
129		reg = <1>;
130	};
131};
132
133&i2c0 {
134	pinctrl-names = "default";
135	pinctrl-0 = <&i2c0_pins_a>;
136	status = "okay";
137
138	axp209: pmic@34 {
139		compatible = "x-powers,axp209";
140		reg = <0x34>;
141		interrupt-parent = <&nmi_intc>;
142		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
143
144		interrupt-controller;
145		#interrupt-cells = <1>;
146	};
147};
148
149&i2c2 {
150	pinctrl-names = "default";
151	pinctrl-0 = <&i2c2_pins_a>;
152	status = "okay";
153};
154
155&ir0 {
156	pinctrl-names = "default";
157	pinctrl-0 = <&ir0_pins_a>;
158	status = "okay";
159};
160
161&mmc0 {
162	pinctrl-names = "default";
163	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapro>;
164	vmmc-supply = <&reg_vcc3v3>;
165	bus-width = <4>;
166	cd-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
167	cd-inverted;
168	status = "okay";
169};
170
171&mmc3 {
172	pinctrl-names = "default";
173	pinctrl-0 = <&mmc3_pins_a>;
174	vmmc-supply = <&reg_vmmc3>;
175	bus-width = <4>;
176	non-removable;
177	status = "okay";
178};
179
180&ohci0 {
181	status = "okay";
182};
183
184&ohci1 {
185	status = "okay";
186};
187
188&pio {
189	gmac_power_pin_bananapro: gmac_power_pin@0 {
190		allwinner,pins = "PH23";
191		allwinner,function = "gpio_out";
192		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
193		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
194	};
195
196	led_pins_bananapro: led_pins@0 {
197		allwinner,pins = "PH24", "PG2";
198		allwinner,function = "gpio_out";
199		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
200		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
201	};
202
203	mmc0_cd_pin_bananapro: mmc0_cd_pin@0 {
204		allwinner,pins = "PH10";
205		allwinner,function = "gpio_in";
206		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
207		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
208	};
209
210	usb1_vbus_pin_bananapro: usb1_vbus_pin@0 {
211		allwinner,pins = "PH0";
212		allwinner,function = "gpio_out";
213		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
214		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
215	};
216
217	usb2_vbus_pin_bananapro: usb2_vbus_pin@0 {
218		allwinner,pins = "PH1";
219		allwinner,function = "gpio_out";
220		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
221		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
222	};
223
224	vmmc3_pin_bananapro: vmmc3_pin@0 {
225		allwinner,pins = "PH22";
226		allwinner,function = "gpio_out";
227		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
228		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
229	};
230};
231
232&reg_usb1_vbus {
233	pinctrl-0 = <&usb1_vbus_pin_bananapro>;
234	gpio = <&pio 7 0 GPIO_ACTIVE_HIGH>; /* PH0 */
235	status = "okay";
236};
237
238&reg_usb2_vbus {
239	pinctrl-0 = <&usb2_vbus_pin_bananapro>;
240	gpio = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
241	status = "okay";
242};
243
244&spi0 {
245	pinctrl-names = "default";
246	pinctrl-0 = <&spi0_pins_a>;
247	status = "okay";
248};
249
250&uart0 {
251	pinctrl-names = "default";
252	pinctrl-0 = <&uart0_pins_a>;
253	status = "okay";
254};
255
256&uart2 {
257	pinctrl-names = "default";
258	pinctrl-0 = <&uart2_pins_a>;
259	status = "okay";
260};
261
262&uart7 {
263	pinctrl-names = "default";
264	pinctrl-0 = <&uart7_pins_a>;
265	status = "okay";
266};
267
268&usbphy {
269	usb1_vbus-supply = <&reg_usb1_vbus>;
270	usb2_vbus-supply = <&reg_usb2_vbus>;
271	status = "okay";
272};
273