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 = "BananaPi-M64";
51	compatible = "sinovoip,bananapi-m64", "allwinner,sun50i-a64";
52
53	aliases {
54		serial0 = &uart0;
55		serial1 = &uart1;
56	};
57
58	chosen {
59		stdout-path = "serial0:115200n8";
60	};
61};
62
63&ehci1 {
64	status = "okay";
65};
66
67&emac {
68	pinctrl-names = "default";
69	pinctrl-0 = <&rgmii_pins>;
70	phy-mode = "rgmii";
71	phy-handle = <&ext_rgmii_phy>;
72	phy-supply = <&reg_dc1sw>;
73	status = "okay";
74};
75
76&i2c1 {
77	pinctrl-names = "default";
78	pinctrl-0 = <&i2c1_pins>;
79	status = "okay";
80};
81
82&i2c1_pins {
83	bias-pull-up;
84};
85
86&mdio {
87	ext_rgmii_phy: ethernet-phy@1 {
88		compatible = "ethernet-phy-ieee802.3-c22";
89		reg = <1>;
90	};
91};
92
93&mmc0 {
94	pinctrl-names = "default";
95	pinctrl-0 = <&mmc0_pins>;
96	vmmc-supply = <&reg_dcdc1>;
97	cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>;
98	cd-inverted;
99	disable-wp;
100	bus-width = <4>;
101	status = "okay";
102};
103
104&mmc1 {
105	pinctrl-names = "default";
106	pinctrl-0 = <&mmc1_pins>;
107	vmmc-supply = <&reg_dldo2>;
108	vqmmc-supply = <&reg_dldo4>;
109	bus-width = <4>;
110	non-removable;
111	status = "okay";
112};
113
114&mmc2 {
115	pinctrl-names = "default";
116	pinctrl-0 = <&mmc2_pins>;
117	vmmc-supply = <&reg_dcdc1>;
118	bus-width = <8>;
119	non-removable;
120	cap-mmc-hw-reset;
121	status = "okay";
122};
123
124&ohci1 {
125	status = "okay";
126};
127
128&r_rsb {
129	status = "okay";
130
131	axp803: pmic@3a3 {
132		compatible = "x-powers,axp803";
133		reg = <0x3a3>;
134		interrupt-parent = <&r_intc>;
135		interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
136	};
137};
138
139#include "axp803.dtsi"
140
141&reg_aldo2 {
142	regulator-always-on;
143	regulator-min-microvolt = <1800000>;
144	regulator-max-microvolt = <3300000>;
145	regulator-name = "vcc-pl";
146};
147
148&reg_aldo3 {
149	regulator-always-on;
150	regulator-min-microvolt = <3000000>;
151	regulator-max-microvolt = <3000000>;
152	regulator-name = "vcc-pll-avcc";
153};
154
155&reg_dc1sw {
156	regulator-name = "vcc-phy";
157};
158
159&reg_dcdc1 {
160	regulator-always-on;
161	regulator-min-microvolt = <3300000>;
162	regulator-max-microvolt = <3300000>;
163	regulator-name = "vcc-3v3";
164};
165
166&reg_dcdc2 {
167	regulator-always-on;
168	regulator-min-microvolt = <1040000>;
169	regulator-max-microvolt = <1300000>;
170	regulator-name = "vdd-cpux";
171};
172
173/* DCDC3 is polyphased with DCDC2 */
174
175&reg_dcdc5 {
176	regulator-always-on;
177	regulator-min-microvolt = <1500000>;
178	regulator-max-microvolt = <1500000>;
179	regulator-name = "vcc-dram";
180};
181
182&reg_dcdc6 {
183	regulator-always-on;
184	regulator-min-microvolt = <1100000>;
185	regulator-max-microvolt = <1100000>;
186	regulator-name = "vdd-sys";
187};
188
189&reg_dldo1 {
190	regulator-min-microvolt = <3300000>;
191	regulator-max-microvolt = <3300000>;
192	regulator-name = "vcc-hdmi-dsi";
193};
194
195&reg_dldo2 {
196	regulator-min-microvolt = <3300000>;
197	regulator-max-microvolt = <3300000>;
198	regulator-name = "vcc-wifi";
199};
200
201&reg_dldo4 {
202	regulator-min-microvolt = <1800000>;
203	regulator-max-microvolt = <3300000>;
204	regulator-name = "vcc-wifi-io";
205};
206
207&reg_eldo1 {
208	regulator-min-microvolt = <1800000>;
209	regulator-max-microvolt = <1800000>;
210	regulator-name = "cpvdd";
211};
212
213&reg_fldo1 {
214	regulator-min-microvolt = <1200000>;
215	regulator-max-microvolt = <1200000>;
216	regulator-name = "vcc-1v2-hsic";
217};
218
219/*
220 * The A64 chip cannot work without this regulator off, although
221 * it seems to be only driving the AR100 core.
222 * Maybe we don't still know well about CPUs domain.
223 */
224&reg_fldo2 {
225	regulator-always-on;
226	regulator-min-microvolt = <1100000>;
227	regulator-max-microvolt = <1100000>;
228	regulator-name = "vdd-cpus";
229};
230
231&reg_rtc_ldo {
232	regulator-name = "vcc-rtc";
233};
234
235&uart0 {
236	pinctrl-names = "default";
237	pinctrl-0 = <&uart0_pins_a>;
238	status = "okay";
239};
240
241&uart1 {
242	pinctrl-names = "default";
243	pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
244	status = "okay";
245};
246
247&usbphy {
248	status = "okay";
249};
250