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