dceaea884b05a6eda32cc0912b1b2bbf5895a01d
[openwrt/openwrt.git] / target / linux / sunxi / patches-4.4 / 200-dt-sun7i-add-lamobo-r1.patch
1 From 46662c86b453d7098ff22d6112d0481f07d523a1 Mon Sep 17 00:00:00 2001
2 From: Jelle de Jong <jelledejong@powercraft.nl>
3 Date: Sun, 18 Oct 2015 16:34:39 +0200
4 Subject: [PATCH] ARM: dts: sun7i: Add dts file for the lamobo-r1 board
5
6 The lamobo-r1 board, sometimes called the BPI-R1 but not labelled as such
7 on the PCB, is meant as a A20 based router board. As such the board comes
8 with a built-in switch chip giving it 5 gigabit ethernet boards, and it
9 has a large empty area on the pcb with mounting holes which will fit a
10 2.5 inch harddisk. To complete its networking features it has a
11 Realtek RTL8192CU for WiFi 802.11 b/g/n.
12
13 Signed-off-by: Jelle de Jong <jelledejong@powercraft.nl>
14 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
15 ---
16 arch/arm/boot/dts/Makefile | 1 +
17 arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts | 297 ++++++++++++++++++++++++++++++
18 2 files changed, 298 insertions(+)
19 create mode 100644 arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
20
21 diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
22 index cc7309b..6f8deac 100644
23 --- a/arch/arm/boot/dts/Makefile
24 +++ b/arch/arm/boot/dts/Makefile
25 @@ -639,6 +639,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \
26 sun7i-a20-cubietruck.dtb \
27 sun7i-a20-hummingbird.dtb \
28 sun7i-a20-i12-tvbox.dtb \
29 + sun7i-a20-lamobo-r1.dtb \
30 sun7i-a20-m3.dtb \
31 sun7i-a20-mk808c.dtb \
32 sun7i-a20-olimex-som-evb.dtb \
33 diff --git a/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
34 new file mode 100644
35 index 0000000..975b0b2
36 --- /dev/null
37 +++ b/arch/arm/boot/dts/sun7i-a20-lamobo-r1.dts
38 @@ -0,0 +1,297 @@
39 +/*
40 + * Copyright 2015 Jelle de Jong <jelledejong@powercraft.nl>
41 + *
42 + * This file is dual-licensed: you can use it either under the terms
43 + * of the GPL or the X11 license, at your option. Note that this dual
44 + * licensing only applies to this file, and not this project as a
45 + * whole.
46 + *
47 + * a) This file is free software; you can redistribute it and/or
48 + * modify it under the terms of the GNU General Public License as
49 + * published by the Free Software Foundation; either version 2 of the
50 + * License, or (at your option) any later version.
51 + *
52 + * This file is distributed in the hope that it will be useful,
53 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
54 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
55 + * GNU General Public License for more details.
56 + *
57 + * Or, alternatively,
58 + *
59 + * b) Permission is hereby granted, free of charge, to any person
60 + * obtaining a copy of this software and associated documentation
61 + * files (the "Software"), to deal in the Software without
62 + * restriction, including without limitation the rights to use,
63 + * copy, modify, merge, publish, distribute, sublicense, and/or
64 + * sell copies of the Software, and to permit persons to whom the
65 + * Software is furnished to do so, subject to the following
66 + * conditions:
67 + *
68 + * The above copyright notice and this permission notice shall be
69 + * included in all copies or substantial portions of the Software.
70 + *
71 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
72 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
73 + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
74 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
75 + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
76 + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
77 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
78 + * OTHER DEALINGS IN THE SOFTWARE.
79 + */
80 +
81 +/dts-v1/;
82 +#include "sun7i-a20.dtsi"
83 +#include "sunxi-common-regulators.dtsi"
84 +
85 +#include <dt-bindings/gpio/gpio.h>
86 +#include <dt-bindings/interrupt-controller/irq.h>
87 +#include <dt-bindings/pinctrl/sun4i-a10.h>
88 +
89 +/ {
90 + model = "Lamobo R1";
91 + compatible = "lamobo,lamobo-r1", "allwinner,sun7i-a20";
92 +
93 + aliases {
94 + serial0 = &uart0;
95 + serial1 = &uart3;
96 + serial2 = &uart7;
97 + };
98 +
99 + chosen {
100 + stdout-path = "serial0:115200n8";
101 + };
102 +
103 + leds {
104 + compatible = "gpio-leds";
105 + pinctrl-names = "default";
106 + pinctrl-0 = <&led_pins_lamobo_r1>;
107 +
108 + green {
109 + label = "lamobo_r1:green:usr";
110 + gpios = <&pio 7 24 GPIO_ACTIVE_HIGH>;
111 + };
112 + };
113 +
114 + reg_gmac_3v3: gmac-3v3 {
115 + compatible = "regulator-fixed";
116 + pinctrl-names = "default";
117 + pinctrl-0 = <&gmac_power_pin_lamobo_r1>;
118 + regulator-name = "gmac-3v3";
119 + regulator-min-microvolt = <3300000>;
120 + regulator-max-microvolt = <3300000>;
121 + startup-delay-us = <100000>;
122 + enable-active-high;
123 + gpio = <&pio 7 23 GPIO_ACTIVE_HIGH>; /* PH23 */
124 + };
125 +};
126 +
127 +&ahci_pwr_pin_a {
128 + allwinner,pins = "PB3";
129 +};
130 +
131 +&ahci {
132 + target-supply = <&reg_ahci_5v>;
133 + status = "okay";
134 +};
135 +
136 +&cpu0 {
137 + cpu-supply = <&reg_dcdc2>;
138 + operating-points = <
139 + /* kHz uV */
140 + 960000 1400000
141 + 912000 1400000
142 + 864000 1350000
143 + 720000 1250000
144 + 528000 1150000
145 + 312000 1100000
146 + 144000 1050000
147 + >;
148 +};
149 +
150 +&ehci0 {
151 + status = "okay";
152 +};
153 +
154 +&ehci1 {
155 + status = "okay";
156 +};
157 +
158 +&gmac {
159 + pinctrl-names = "default";
160 + pinctrl-0 = <&gmac_pins_rgmii_a>;
161 + phy = <&phy1>;
162 + phy-mode = "rgmii";
163 + phy-supply = <&reg_gmac_3v3>;
164 + status = "okay";
165 +
166 + phy1: ethernet-phy@1 {
167 + reg = <1>;
168 + };
169 +};
170 +
171 +&i2c0 {
172 + pinctrl-names = "default";
173 + pinctrl-0 = <&i2c0_pins_a>;
174 + status = "okay";
175 +
176 + axp209: pmic@34 {
177 + reg = <0x34>;
178 + interrupt-parent = <&nmi_intc>;
179 + interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
180 + };
181 +};
182 +
183 +&i2c2 {
184 + pinctrl-names = "default";
185 + pinctrl-0 = <&i2c2_pins_a>;
186 + status = "okay";
187 +};
188 +
189 +&ir0 {
190 + pinctrl-names = "default";
191 + pinctrl-0 = <&ir0_rx_pins_a>;
192 + status = "okay";
193 +};
194 +
195 +&mmc0 {
196 + pinctrl-names = "default";
197 + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_lamobo_r1>;
198 + vmmc-supply = <&reg_vcc3v3>;
199 + bus-width = <4>;
200 + cd-gpios = <&pio 7 10 GPIO_ACTIVE_HIGH>; /* PH10 */
201 + cd-inverted;
202 + status = "okay";
203 +};
204 +
205 +&ohci0 {
206 + status = "okay";
207 +};
208 +
209 +&ohci1 {
210 + status = "okay";
211 +};
212 +
213 +&otg_sram {
214 + status = "okay";
215 +};
216 +
217 +&pio {
218 + usb0_id_detect_pin: usb0_id_detect_pin@0 {
219 + allwinner,pins = "PH4";
220 + allwinner,function = "gpio_in";
221 + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
222 + allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
223 + };
224 +
225 + mmc0_cd_pin_lamobo_r1: mmc0_cd_pin@0 {
226 + allwinner,pins = "PH10";
227 + allwinner,function = "gpio_in";
228 + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
229 + allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
230 + };
231 +
232 + gmac_power_pin_lamobo_r1: gmac_power_pin@0 {
233 + allwinner,pins = "PH23";
234 + allwinner,function = "gpio_out";
235 + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
236 + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
237 + };
238 +
239 + led_pins_lamobo_r1: led_pins@0 {
240 + allwinner,pins = "PH24";
241 + allwinner,function = "gpio_out";
242 + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
243 + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
244 + };
245 +};
246 +
247 +#include "axp209.dtsi"
248 +
249 +&reg_ahci_5v {
250 + gpio = <&pio 1 3 0>; /* PB3 */
251 + status = "okay";
252 +};
253 +
254 +&reg_dcdc2 {
255 + regulator-always-on;
256 + regulator-min-microvolt = <1000000>;
257 + regulator-max-microvolt = <1400000>;
258 + regulator-name = "vdd-cpu";
259 +};
260 +
261 +&reg_dcdc3 {
262 + regulator-always-on;
263 + regulator-min-microvolt = <1000000>;
264 + regulator-max-microvolt = <1400000>;
265 + regulator-name = "vdd-int-dll";
266 +};
267 +
268 +&reg_ldo1 {
269 + regulator-name = "vdd-rtc";
270 +};
271 +
272 +&reg_ldo2 {
273 + regulator-always-on;
274 + regulator-min-microvolt = <3000000>;
275 + regulator-max-microvolt = <3000000>;
276 + regulator-name = "avcc";
277 +};
278 +
279 +&reg_usb0_vbus {
280 + status = "okay";
281 +};
282 +
283 +&reg_usb1_vbus {
284 + status = "okay";
285 +};
286 +
287 +&reg_usb2_vbus {
288 + status = "okay";
289 +};
290 +
291 +&spi0 {
292 + pinctrl-names = "default";
293 + pinctrl-0 = <&spi0_pins_a>,
294 + <&spi0_cs0_pins_a>,
295 + <&spi0_cs1_pins_a>;
296 + status = "okay";
297 +};
298 +
299 +&uart0 {
300 + pinctrl-names = "default";
301 + pinctrl-0 = <&uart0_pins_a>;
302 + status = "okay";
303 +};
304 +
305 +&uart3 {
306 + pinctrl-names = "default";
307 + pinctrl-0 = <&uart3_pins_b>;
308 + status = "okay";
309 +};
310 +
311 +&uart7 {
312 + pinctrl-names = "default";
313 + pinctrl-0 = <&uart7_pins_a>;
314 + status = "okay";
315 +};
316 +
317 +&usb_otg {
318 + dr_mode = "otg";
319 + status = "okay";
320 +};
321 +
322 +&usb_power_supply {
323 + status = "okay";
324 +};
325 +
326 +&usbphy {
327 + pinctrl-names = "default";
328 + pinctrl-0 = <&usb0_id_detect_pin>;
329 + usb0_id_det-gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
330 + usb0_vbus_power-supply = <&usb_power_supply>;
331 + usb0_vbus-supply = <&reg_usb0_vbus>;
332 + usb1_vbus-supply = <&reg_usb1_vbus>;
333 + usb2_vbus-supply = <&reg_usb2_vbus>;
334 + status = "okay";
335 +};