1/*
2 * Copyright 2015 Adam Sampson <ats@offog.org>
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 = "LinkSprite pcDuino3 Nano";
56	compatible = "linksprite,pcduino3-nano", "allwinner,sun7i-a20";
57
58	aliases {
59		serial0 = &uart0;
60	};
61
62	chosen {
63		stdout-path = "serial0:115200n8";
64	};
65
66	leds {
67		compatible = "gpio-leds";
68		pinctrl-names = "default";
69		pinctrl-0 = <&led_pins_pcduino3_nano>;
70
71		/* Marked "LED3" on the PCB. */
72		usr1 {
73			label = "pcduino3-nano:green:usr1";
74			gpios = <&pio 7 16 GPIO_ACTIVE_LOW>; /* PH16 */
75		};
76
77		/* Marked "LED4" on the PCB. */
78		usr2 {
79			label = "pcduino3-nano:green:usr2";
80			gpios = <&pio 7 15 GPIO_ACTIVE_LOW>; /* PH15 */
81		};
82	};
83};
84
85&ahci {
86	target-supply = <&reg_ahci_5v>;
87	status = "okay";
88};
89
90&ehci0 {
91	status = "okay";
92};
93
94&ehci1 {
95	status = "okay";
96};
97
98&gmac {
99	pinctrl-names = "default";
100	pinctrl-0 = <&gmac_pins_rgmii_a>;
101	phy = <&phy1>;
102	phy-mode = "rgmii";
103	status = "okay";
104
105	phy1: ethernet-phy@1 {
106		reg = <1>;
107	};
108};
109
110&i2c0 {
111	pinctrl-names = "default";
112	pinctrl-0 = <&i2c0_pins_a>;
113	status = "okay";
114
115	axp209: pmic@34 {
116		compatible = "x-powers,axp209";
117		reg = <0x34>;
118		interrupt-parent = <&nmi_intc>;
119		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
120
121		interrupt-controller;
122		#interrupt-cells = <1>;
123	};
124};
125
126&ir0 {
127	pinctrl-names = "default";
128	pinctrl-0 = <&ir0_pins_a>;
129	status = "okay";
130};
131
132&mmc0 {
133	pinctrl-names = "default";
134	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_reference_design>;
135	vmmc-supply = <&reg_vcc3v3>;
136	bus-width = <4>;
137	cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
138	cd-inverted;
139	status = "okay";
140};
141
142&ohci0 {
143	status = "okay";
144};
145
146&ohci1 {
147	status = "okay";
148};
149
150&pio {
151	ahci_pwr_pin_pcduino3_nano: ahci_pwr_pin@0 {
152		allwinner,pins = "PH2";
153		allwinner,function = "gpio_out";
154		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
155		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
156	};
157
158	led_pins_pcduino3_nano: led_pins@0 {
159		allwinner,pins = "PH16", "PH15";
160		allwinner,function = "gpio_out";
161		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
162		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
163	};
164
165	usb1_vbus_pin_pcduino3_nano: usb1_vbus_pin@0 {
166		allwinner,pins = "PH11";
167		allwinner,function = "gpio_out";
168		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
169		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
170	};
171};
172
173&reg_ahci_5v {
174	pinctrl-0 = <&ahci_pwr_pin_pcduino3_nano>;
175	gpio = <&pio 7 2 GPIO_ACTIVE_HIGH>; /* PH2 */
176	status = "okay";
177};
178
179&reg_usb1_vbus {
180	pinctrl-0 = <&usb1_vbus_pin_pcduino3_nano>;
181	gpio = <&pio 7 11 GPIO_ACTIVE_HIGH>; /* PH11 */
182	status = "okay";
183};
184
185&reg_usb2_vbus {
186	status = "okay";
187};
188
189&uart0 {
190	pinctrl-names = "default";
191	pinctrl-0 = <&uart0_pins_a>;
192	status = "okay";
193};
194
195&usbphy {
196	usb1_vbus-supply = <&reg_usb1_vbus>;
197	usb2_vbus-supply = <&reg_usb2_vbus>;
198	status = "okay";
199};
200