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