1/*
2 * Copyright (c) 2016 ARM Ltd.
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 library 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 library 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
45#include "sun50i-a64.dtsi"
46
47#include <dt-bindings/gpio/gpio.h>
48
49/ {
50	model = "Pine64";
51	compatible = "pine64,pine64", "allwinner,sun50i-a64";
52
53	aliases {
54		serial0 = &uart0;
55		serial1 = &uart1;
56		serial2 = &uart2;
57		serial3 = &uart3;
58		serial4 = &uart4;
59	};
60
61	chosen {
62		stdout-path = "serial0:115200n8";
63	};
64
65	reg_vcc3v3: vcc3v3 {
66		compatible = "regulator-fixed";
67		regulator-name = "vcc3v3";
68		regulator-min-microvolt = <3300000>;
69		regulator-max-microvolt = <3300000>;
70	};
71};
72
73&ehci0 {
74	status = "okay";
75};
76
77&ehci1 {
78	status = "okay";
79};
80
81&emac {
82	pinctrl-names = "default";
83	pinctrl-0 = <&rmii_pins>;
84	phy-mode = "rmii";
85	phy-handle = <&ext_rmii_phy1>;
86	phy-supply = <&reg_dc1sw>;
87	status = "okay";
88
89};
90
91&i2c1 {
92	pinctrl-names = "default";
93	pinctrl-0 = <&i2c1_pins>;
94	status = "okay";
95};
96
97&i2c1_pins {
98	bias-pull-up;
99};
100
101&mdio {
102	ext_rmii_phy1: ethernet-phy@1 {
103		compatible = "ethernet-phy-ieee802.3-c22";
104		reg = <1>;
105	};
106};
107
108&mmc0 {
109	pinctrl-names = "default";
110	pinctrl-0 = <&mmc0_pins>;
111	vmmc-supply = <&reg_vcc3v3>;
112	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
113	cd-inverted;
114	disable-wp;
115	bus-width = <4>;
116	status = "okay";
117};
118
119&ohci0 {
120	status = "okay";
121};
122
123&ohci1 {
124	status = "okay";
125};
126
127&r_rsb {
128	status = "okay";
129
130	axp803: pmic@3a3 {
131		compatible = "x-powers,axp803";
132		reg = <0x3a3>;
133		interrupt-parent = <&r_intc>;
134		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
135	};
136};
137
138#include "axp803.dtsi"
139
140&reg_aldo2 {
141	regulator-always-on;
142	regulator-min-microvolt = <1800000>;
143	regulator-max-microvolt = <3300000>;
144	regulator-name = "vcc-pl";
145};
146
147&reg_aldo3 {
148	regulator-always-on;
149	regulator-min-microvolt = <3000000>;
150	regulator-max-microvolt = <3000000>;
151	regulator-name = "vcc-pll-avcc";
152};
153
154&reg_dc1sw {
155	regulator-name = "vcc-phy";
156};
157
158&reg_dcdc1 {
159	regulator-always-on;
160	regulator-min-microvolt = <3300000>;
161	regulator-max-microvolt = <3300000>;
162	regulator-name = "vcc-3v3";
163};
164
165&reg_dcdc2 {
166	regulator-always-on;
167	regulator-min-microvolt = <1040000>;
168	regulator-max-microvolt = <1300000>;
169	regulator-name = "vdd-cpux";
170};
171
172/* DCDC3 is polyphased with DCDC2 */
173
174/*
175 * The DRAM chips used by Pine64 boards are DDR3L-compatible, so they can
176 * work at 1.35V with less power consumption.
177 * As AXP803 DCDC5 cannot reach 1.35V accurately, use 1.36V instead.
178 */
179&reg_dcdc5 {
180	regulator-always-on;
181	regulator-min-microvolt = <1360000>;
182	regulator-max-microvolt = <1360000>;
183	regulator-name = "vcc-dram";
184};
185
186&reg_dcdc6 {
187	regulator-always-on;
188	regulator-min-microvolt = <1100000>;
189	regulator-max-microvolt = <1100000>;
190	regulator-name = "vdd-sys";
191};
192
193&reg_dldo1 {
194	regulator-min-microvolt = <3300000>;
195	regulator-max-microvolt = <3300000>;
196	regulator-name = "vcc-hdmi";
197};
198
199&reg_dldo2 {
200	regulator-min-microvolt = <3300000>;
201	regulator-max-microvolt = <3300000>;
202	regulator-name = "vcc-mipi";
203};
204
205&reg_dldo4 {
206	regulator-min-microvolt = <3300000>;
207	regulator-max-microvolt = <3300000>;
208	regulator-name = "vcc-wifi";
209};
210
211&reg_eldo1 {
212	regulator-min-microvolt = <1800000>;
213	regulator-max-microvolt = <1800000>;
214	regulator-name = "cpvdd";
215};
216
217&reg_fldo1 {
218	regulator-min-microvolt = <1200000>;
219	regulator-max-microvolt = <1200000>;
220	regulator-name = "vcc-1v2-hsic";
221};
222
223/*
224 * The A64 chip cannot work without this regulator off, although
225 * it seems to be only driving the AR100 core.
226 * Maybe we don't still know well about CPUs domain.
227 */
228&reg_fldo2 {
229	regulator-always-on;
230	regulator-min-microvolt = <1100000>;
231	regulator-max-microvolt = <1100000>;
232	regulator-name = "vdd-cpus";
233};
234
235&reg_rtc_ldo {
236	regulator-name = "vcc-rtc";
237};
238
239/* On Exp and Euler connectors */
240&uart0 {
241	pinctrl-names = "default";
242	pinctrl-0 = <&uart0_pins_a>;
243	status = "okay";
244};
245
246/* On Wifi/BT connector, with RTS/CTS */
247&uart1 {
248	pinctrl-names = "default";
249	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
250	status = "disabled";
251};
252
253/* On Pi-2 connector */
254&uart2 {
255	pinctrl-names = "default";
256	pinctrl-0 = <&uart2_pins>;
257	status = "disabled";
258};
259
260/* On Euler connector */
261&uart3 {
262	pinctrl-names = "default";
263	pinctrl-0 = <&uart3_pins>;
264	status = "disabled";
265};
266
267/* On Euler connector, RTS/CTS optional */
268&uart4 {
269	pinctrl-names = "default";
270	pinctrl-0 = <&uart4_pins>;
271	status = "disabled";
272};
273
274&usb_otg {
275	dr_mode = "host";
276	status = "okay";
277};
278
279&usbphy {
280	status = "okay";
281};
282