1/*
2 * Copyright 2013 Wills Wang
3 *
4 * Wills Wang <wills.wang.open@gmail.com>
5 *
6 * This file is dual-licensed: you can use it either under the terms
7 * of the GPL or the X11 license, at your option. Note that this dual
8 * licensing only applies to this file, and not this project as a
9 * whole.
10 *
11 *  a) This file is free software; you can redistribute it and/or
12 *     modify it under the terms of the GNU General Public License as
13 *     published by the Free Software Foundation; either version 2 of the
14 *     License, or (at your option) any later version.
15 *
16 *     This file is distributed in the hope that it will be useful,
17 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
18 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 *     GNU General Public License for more details.
20 *
21 *     You should have received a copy of the GNU General Public
22 *     License along with this file; if not, write to the Free
23 *     Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
24 *     MA 02110-1301 USA
25 *
26 * Or, alternatively,
27 *
28 *  b) Permission is hereby granted, free of charge, to any person
29 *     obtaining a copy of this software and associated documentation
30 *     files (the "Software"), to deal in the Software without
31 *     restriction, including without limitation the rights to use,
32 *     copy, modify, merge, publish, distribute, sublicense, and/or
33 *     sell copies of the Software, and to permit persons to whom the
34 *     Software is furnished to do so, subject to the following
35 *     conditions:
36 *
37 *     The above copyright notice and this permission notice shall be
38 *     included in all copies or substantial portions of the Software.
39 *
40 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
41 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
42 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
43 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
44 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
45 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 *     OTHER DEALINGS IN THE SOFTWARE.
48 */
49
50/dts-v1/;
51#include "sun7i-a20.dtsi"
52#include "sunxi-common-regulators.dtsi"
53
54#include <dt-bindings/gpio/gpio.h>
55#include <dt-bindings/interrupt-controller/irq.h>
56#include <dt-bindings/pinctrl/sun4i-a10.h>
57
58/ {
59	model = "Merrii A20 Hummingbird";
60	compatible = "merrii,a20-hummingbird", "allwinner,sun7i-a20";
61
62	aliases {
63		serial0 = &uart0;
64		serial1 = &uart2;
65		serial2 = &uart3;
66		serial3 = &uart4;
67		serial4 = &uart5;
68	};
69
70	chosen {
71		stdout-path = "serial0:115200n8";
72	};
73
74	reg_mmc3_vdd: mmc3_vdd {
75		compatible = "regulator-fixed";
76		pinctrl-names = "default";
77		pinctrl-0 = <&mmc3_vdd_pin_a20_hummingbird>;
78		regulator-name = "mmc3_vdd";
79		regulator-min-microvolt = <3000000>;
80		regulator-max-microvolt = <3000000>;
81		enable-active-high;
82		gpio = <&pio 7 9 GPIO_ACTIVE_HIGH>; /* PH9 */
83	};
84
85	reg_gmac_vdd: gmac_vdd {
86		compatible = "regulator-fixed";
87		pinctrl-names = "default";
88		pinctrl-0 = <&gmac_vdd_pin_a20_hummingbird>;
89		regulator-name = "gmac_vdd";
90		regulator-min-microvolt = <3000000>;
91		regulator-max-microvolt = <3000000>;
92		enable-active-high;
93		gpio = <&pio 7 16 GPIO_ACTIVE_HIGH>; /* PH16 */
94	};
95};
96
97&ahci {
98	target-supply = <&reg_ahci_5v>;
99	status = "okay";
100};
101
102&ehci0 {
103	status = "okay";
104};
105
106&ehci1 {
107	status = "okay";
108};
109
110&gmac {
111	pinctrl-names = "default";
112	pinctrl-0 = <&gmac_pins_rgmii_a>;
113	phy = <&phy1>;
114	phy-mode = "rgmii";
115	phy-supply = <&reg_gmac_vdd>;
116	/* phy reset config */
117	snps,reset-gpio = <&pio 0 17 GPIO_ACTIVE_HIGH>; /* PA17 */
118	snps,reset-active-low;
119	/* wait 1s after reset, otherwise fail to read phy id */
120	snps,reset-delays-us = <0 10000 1000000>;
121	status = "okay";
122
123	phy1: ethernet-phy@1 {
124		reg = <1>;
125	};
126};
127
128&i2c0 {
129	pinctrl-names = "default";
130	pinctrl-0 = <&i2c0_pins_a>;
131	status = "okay";
132
133	axp209: pmic@34 {
134		compatible = "x-powers,axp209";
135		reg = <0x34>;
136		interrupt-parent = <&nmi_intc>;
137		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
138		interrupt-controller;
139		#interrupt-cells = <1>;
140	};
141};
142
143&i2c1 {
144	pinctrl-names = "default";
145	pinctrl-0 = <&i2c1_pins_a>;
146	status = "okay";
147};
148
149&i2c2 {
150	pinctrl-names = "default";
151	pinctrl-0 = <&i2c2_pins_a>;
152	status = "okay";
153};
154
155&i2c3 {
156	pinctrl-names = "default";
157	pinctrl-0 = <&i2c3_pins_a>;
158	status = "okay";
159};
160
161&ir0 {
162	pinctrl-names = "default";
163	pinctrl-0 = <&ir0_pins_a>;
164	status = "okay";
165};
166
167&mmc0 {
168	pinctrl-names = "default";
169	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
170	vmmc-supply = <&reg_vcc3v0>;
171	bus-width = <4>;
172	cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
173	cd-inverted;
174	status = "okay";
175};
176
177&mmc3 {
178	pinctrl-names = "default";
179	pinctrl-0 = <&mmc3_pins_a>;
180	vmmc-supply = <&reg_mmc3_vdd>;
181	bus-width = <4>;
182	non-removable;
183	status = "okay";
184};
185
186&ohci0 {
187	status = "okay";
188};
189
190&ohci1 {
191	status = "okay";
192};
193
194&pio {
195	ahci_pwr_pin_a20_hummingbird: ahci_pwr_pin@0 {
196		allwinner,pins = "PH15";
197		allwinner,function = "gpio_out";
198		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
199		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
200	};
201
202	usb1_vbus_pin_a20_hummingbird: usb1_vbus_pin@0 {
203		allwinner,pins = "PH2";
204		allwinner,function = "gpio_out";
205		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
206		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
207	};
208
209	mmc3_vdd_pin_a20_hummingbird: mmc3_vdd_pin@0 {
210		allwinner,pins = "PH9";
211		allwinner,function = "gpio_out";
212		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
213		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
214	};
215
216	gmac_vdd_pin_a20_hummingbird: gmac_vdd_pin@0 {
217		allwinner,pins = "PH16";
218		allwinner,function = "gpio_out";
219		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
220		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
221	};
222};
223
224&pwm {
225	pinctrl-names = "default";
226	pinctrl-0 = <&pwm0_pins_a>;
227	status = "okay";
228};
229
230&reg_ahci_5v {
231	pinctrl-0 = <&ahci_pwr_pin_a20_hummingbird>;
232	gpio = <&pio 7 15 GPIO_ACTIVE_HIGH>; /* PH15 */
233	status = "okay";
234};
235
236&reg_usb1_vbus {
237	pinctrl-0 = <&usb1_vbus_pin_a20_hummingbird>;
238	gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */
239	status = "okay";
240};
241
242&reg_usb2_vbus {
243	status = "okay";
244};
245
246&spi2 {
247	pinctrl-names = "default";
248	pinctrl-0 = <&spi2_pins_b>;
249	status = "okay";
250};
251
252&uart0 {
253	pinctrl-names = "default";
254	pinctrl-0 = <&uart0_pins_a>;
255	status = "okay";
256};
257
258&uart2 {
259	pinctrl-names = "default";
260	pinctrl-0 = <&uart2_pins_a>;
261	status = "okay";
262};
263
264&uart3 {
265	pinctrl-names = "default";
266	pinctrl-0 = <&uart3_pins_a>;
267	status = "okay";
268};
269
270&uart4 {
271	pinctrl-names = "default";
272	pinctrl-0 = <&uart4_pins_a>;
273	status = "okay";
274};
275
276&uart5 {
277	pinctrl-names = "default";
278	pinctrl-0 = <&uart5_pins_a>;
279	status = "okay";
280};
281
282&usbphy {
283	usb1_vbus-supply = <&reg_usb1_vbus>;
284	usb2_vbus-supply = <&reg_usb2_vbus>;
285	status = "okay";
286};
287