sunxi: add Orange Pi R1 support
[openwrt/openwrt.git] / target / linux / sunxi / patches-4.9 / 200-ARM-dts-sunxi-add-support-for-Orange-Pi-R1-board.patch
1 From daf75255fb67bf44db178e4c95a803b7972ed670 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Tue, 26 Sep 2017 22:29:06 +0200
4 Subject: ARM: dts: sunxi: add support for Orange Pi R1 board
5
6 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 ---
8 arch/arm/boot/dts/Makefile | 1 +
9 arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts | 171 ++++++++++++++++++++++++
10 2 files changed, 172 insertions(+)
11 create mode 100644 arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
12
13 --- a/arch/arm/boot/dts/Makefile
14 +++ b/arch/arm/boot/dts/Makefile
15 @@ -819,6 +819,7 @@ dtb-$(CONFIG_MACH_SUN8I) += \
16 sun8i-a33-sinlinx-sina33.dtb \
17 sun8i-a83t-allwinner-h8homlet-v2.dtb \
18 sun8i-a83t-cubietruck-plus.dtb \
19 + sun8i-h2-plus-orangepi-r1.dtb \
20 sun8i-h3-bananapi-m2-plus.dtb \
21 sun8i-h3-nanopi-neo.dtb \
22 sun8i-h3-orangepi-2.dtb \
23 --- /dev/null
24 +++ b/arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts
25 @@ -0,0 +1,171 @@
26 +/*
27 + * Copyright (C) 2017 Hauke Mehrtens <hauke@hauke-m.de>
28 + *
29 + * Based on sun8i-h2-plus-orangepi-zero.dts, which is:
30 + * Copyright (C) 2016 Icenowy Zheng <icenowy@aosc.xyz>
31 + *
32 + * Based on sun8i-h3-orangepi-one.dts, which is:
33 + * Copyright (C) 2016 Hans de Goede <hdegoede@redhat.com>
34 + *
35 + * This file is dual-licensed: you can use it either under the terms
36 + * of the GPL or the X11 license, at your option. Note that this dual
37 + * licensing only applies to this file, and not this project as a
38 + * whole.
39 + *
40 + * a) This file is free software; you can redistribute it and/or
41 + * modify it under the terms of the GNU General Public License as
42 + * published by the Free Software Foundation; either version 2 of the
43 + * License, or (at your option) any later version.
44 + *
45 + * This file is distributed in the hope that it will be useful,
46 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
47 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
48 + * GNU General Public License for more details.
49 + *
50 + * Or, alternatively,
51 + *
52 + * b) Permission is hereby granted, free of charge, to any person
53 + * obtaining a copy of this software and associated documentation
54 + * files (the "Software"), to deal in the Software without
55 + * restriction, including without limitation the rights to use,
56 + * copy, modify, merge, publish, distribute, sublicense, and/or
57 + * sell copies of the Software, and to permit persons to whom the
58 + * Software is furnished to do so, subject to the following
59 + * conditions:
60 + *
61 + * The above copyright notice and this permission notice shall be
62 + * included in all copies or substantial portions of the Software.
63 + *
64 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
65 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
66 + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
67 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
68 + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
69 + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
70 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
71 + * OTHER DEALINGS IN THE SOFTWARE.
72 + */
73 +
74 +/dts-v1/;
75 +#include "sun8i-h3.dtsi"
76 +#include "sunxi-common-regulators.dtsi"
77 +
78 +#include <dt-bindings/gpio/gpio.h>
79 +#include <dt-bindings/input/input.h>
80 +#include <dt-bindings/pinctrl/sun4i-a10.h>
81 +
82 +/ {
83 + model = "Xunlong Orange Pi R1";
84 + compatible = "xunlong,orangepi-r1", "allwinner,sun8i-h2-plus";
85 +
86 + aliases {
87 + serial0 = &uart0;
88 + /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
89 + ethernet0 = &emac;
90 + ethernet1 = &xr819;
91 + };
92 +
93 + chosen {
94 + stdout-path = "serial0:115200n8";
95 + };
96 +
97 + leds {
98 + compatible = "gpio-leds";
99 +
100 + pwr_led {
101 + label = "orangepi:green:pwr";
102 + gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
103 + default-state = "on";
104 + };
105 +
106 + status_led {
107 + label = "orangepi:red:status";
108 + gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
109 + };
110 + };
111 +
112 + reg_vcc_wifi: reg_vcc_wifi {
113 + compatible = "regulator-fixed";
114 + regulator-min-microvolt = <3300000>;
115 + regulator-max-microvolt = <3300000>;
116 + regulator-name = "vcc-wifi";
117 + enable-active-high;
118 + gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
119 + };
120 +
121 + wifi_pwrseq: wifi_pwrseq {
122 + compatible = "mmc-pwrseq-simple";
123 + reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
124 + post-power-on-delay-ms = <200>;
125 + };
126 +};
127 +
128 +&ehci1 {
129 + status = "okay";
130 +};
131 +
132 +&emac {
133 + phy-handle = <&int_mii_phy>;
134 + phy-mode = "mii";
135 + allwinner,leds-active-low;
136 + status = "okay";
137 +};
138 +
139 +&mmc0 {
140 + pinctrl-names = "default";
141 + pinctrl-0 = <&mmc0_pins_a>;
142 + vmmc-supply = <&reg_vcc3v3>;
143 + bus-width = <4>;
144 + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
145 + cd-inverted;
146 + status = "okay";
147 +};
148 +
149 +&mmc1 {
150 + pinctrl-names = "default";
151 + pinctrl-0 = <&mmc1_pins_a>;
152 + vmmc-supply = <&reg_vcc_wifi>;
153 + mmc-pwrseq = <&wifi_pwrseq>;
154 + bus-width = <4>;
155 + non-removable;
156 + status = "okay";
157 +
158 + /*
159 + * Explicitly define the sdio device, so that we can add an ethernet
160 + * alias for it (which e.g. makes u-boot set a mac-address).
161 + */
162 + xr819: sdio_wifi@1 {
163 + reg = <1>;
164 + };
165 +};
166 +
167 +&mmc1_pins_a {
168 + bias-pull-up;
169 +};
170 +
171 +&ohci1 {
172 + status = "okay";
173 +};
174 +
175 +&uart0 {
176 + pinctrl-names = "default";
177 + pinctrl-0 = <&uart0_pins_a>;
178 + status = "okay";
179 +};
180 +
181 +&uart1 {
182 + pinctrl-names = "default";
183 + pinctrl-0 = <&uart1_pins>;
184 + status = "disabled";
185 +};
186 +
187 +&uart2 {
188 + pinctrl-names = "default";
189 + pinctrl-0 = <&uart2_pins>;
190 + status = "disabled";
191 +};
192 +
193 +&usbphy {
194 + /* USB VBUS is always on */
195 + status = "okay";
196 +};