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 "sun5i-a13.dtsi"
50#include "sunxi-common-regulators.dtsi"
51#include <dt-bindings/gpio/gpio.h>
52#include <dt-bindings/input/input.h>
53#include <dt-bindings/pinctrl/sun4i-a10.h>
54
55/ {
56	model = "Utoo P66";
57	compatible = "utoo,p66", "allwinner,sun5i-a13";
58
59	aliases {
60		serial0 = &uart1;
61	};
62
63	chosen {
64		stdout-path = "serial0:115200n8";
65	};
66
67	i2c_lcd: i2c@0 {
68		/* The lcd panel i2c interface is hooked up via gpios */
69		compatible = "i2c-gpio";
70		pinctrl-names = "default";
71		pinctrl-0 = <&i2c_lcd_pins>;
72		gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>, /* PG12, sda */
73			<&pio 6 10 GPIO_ACTIVE_HIGH>; /* PG10, scl */
74		i2c-gpio,delay-us = <5>;
75	};
76};
77
78&cpu0 {
79	cpu-supply = <&reg_dcdc2>;
80};
81
82&ehci0 {
83	status = "okay";
84};
85
86&i2c0 {
87	pinctrl-names = "default";
88	pinctrl-0 = <&i2c0_pins_a>;
89	status = "okay";
90
91	axp209: pmic@34 {
92		reg = <0x34>;
93		interrupts = <0>;
94	};
95};
96
97#include "axp209.dtsi"
98
99&i2c1 {
100	pinctrl-names = "default";
101	pinctrl-0 = <&i2c1_pins_a>;
102	status = "okay";
103
104	pcf8563: rtc@51 {
105		compatible = "nxp,pcf8563";
106		reg = <0x51>;
107	};
108};
109
110&lradc {
111	vref-supply = <&reg_ldo2>;
112	status = "okay";
113
114	button@200 {
115		label = "Volume Up";
116		linux,code = <KEY_VOLUMEUP>;
117		channel = <0>;
118		voltage = <200000>;
119	};
120
121	button@400 {
122		label = "Volume Down";
123		linux,code = <KEY_VOLUMEDOWN>;
124		channel = <0>;
125		voltage = <400000>;
126	};
127};
128
129&mmc0 {
130	pinctrl-names = "default";
131	pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_p66>;
132	vmmc-supply = <&reg_vcc3v3>;
133	bus-width = <4>;
134	cd-gpios = <&pio 6 0 GPIO_ACTIVE_HIGH>; /* PG0 */
135	cd-inverted;
136	status = "okay";
137};
138
139&mmc2 {
140	pinctrl-names = "default";
141	pinctrl-0 = <&mmc2_pins_a>;
142	vmmc-supply = <&reg_vcc3v3>;
143	bus-width = <8>;
144	non-removable;
145	status = "okay";
146
147	mmccard: mmccard@0 {
148		reg = <0>;
149		compatible = "mmc-card";
150		broken-hpi;
151	};
152};
153
154&pio {
155	mmc0_cd_pin_p66: mmc0_cd_pin@0 {
156		allwinner,pins = "PG0";
157		allwinner,function = "gpio_in";
158		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
159		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
160	};
161
162	i2c_lcd_pins: i2c_lcd_pin@0 {
163		allwinner,pins = "PG10", "PG12";
164		allwinner,function = "gpio_out";
165		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
166		allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
167	};
168
169	usb0_vbus_pin_a: usb0_vbus_pin@0 {
170		allwinner,pins = "PB4";
171		allwinner,function = "gpio_out";
172		allwinner,drive = <SUN4I_PINCTRL_10_MA>;
173		allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
174	};
175};
176
177&reg_dcdc2 {
178	regulator-always-on;
179	regulator-min-microvolt = <1000000>;
180	regulator-max-microvolt = <1500000>;
181	regulator-name = "vdd-cpu";
182};
183
184&reg_dcdc3 {
185	regulator-always-on;
186	regulator-min-microvolt = <1000000>;
187	regulator-max-microvolt = <1400000>;
188	regulator-name = "vdd-int-pll";
189};
190
191&reg_ldo1 {
192	regulator-name = "vdd-rtc";
193};
194
195&reg_ldo2 {
196	regulator-always-on;
197	regulator-min-microvolt = <3000000>;
198	regulator-max-microvolt = <3000000>;
199	regulator-name = "avcc";
200};
201
202&reg_ldo3 {
203	regulator-min-microvolt = <3300000>;
204	regulator-max-microvolt = <3300000>;
205	regulator-name = "vcc-wifi";
206};
207
208&reg_usb0_vbus {
209	gpio = <&pio 1 4 GPIO_ACTIVE_HIGH>; /* PB4 */
210	status = "okay";
211};
212
213&uart1 {
214	pinctrl-names = "default";
215	pinctrl-0 = <&uart1_pins_b>;
216	status = "okay";
217};
218
219&usbphy {
220	usb0_vbus-supply = <&reg_usb0_vbus>;
221	usb1_vbus-supply = <&reg_ldo3>;
222	status = "okay";
223};
224