fc1e05da27b0c7a4396daf21874f76ac75cc4e37
[openwrt/openwrt.git] / package / boot / uboot-sunxi / patches / 300-sunxi-add-device-tree-for-Orange-Pi-R1-board.patch
1 From 1f92596cc520f760589289059a5aa739366dd19c Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Tue, 26 Sep 2017 22:16:59 +0200
4 Subject: sunxi: add device tree for Orange Pi R1 board
5
6 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
7 ---
8 arch/arm/dts/Makefile | 1 +
9 arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts | 157 +++++++++++++++++++++++++++++
10 2 files changed, 158 insertions(+)
11 create mode 100644 arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts
12
13 --- a/arch/arm/dts/Makefile
14 +++ b/arch/arm/dts/Makefile
15 @@ -318,6 +318,7 @@ dtb-$(CONFIG_MACH_SUN8I_A83T) += \
16 sun8i-a83t-bananapi-m3.dtb \
17 sun8i-a83t-cubietruck-plus.dtb
18 dtb-$(CONFIG_MACH_SUN8I_H3) += \
19 + sun8i-h2-plus-orangepi-r1.dtb \
20 sun8i-h2-plus-orangepi-zero.dtb \
21 sun8i-h3-bananapi-m2-plus.dtb \
22 sun8i-h3-orangepi-2.dtb \
23 --- /dev/null
24 +++ b/arch/arm/dts/sun8i-h2-plus-orangepi-r1.dts
25 @@ -0,0 +1,157 @@
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 + ethernet1 = &xr819;
90 + };
91 +
92 + chosen {
93 + stdout-path = "serial0:115200n8";
94 + };
95 +
96 + leds {
97 + compatible = "gpio-leds";
98 +
99 + pwr_led {
100 + label = "orangepi:green:pwr";
101 + gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>;
102 + default-state = "on";
103 + };
104 +
105 + status_led {
106 + label = "orangepi:red:status";
107 + gpios = <&pio 0 17 GPIO_ACTIVE_HIGH>;
108 + };
109 + };
110 +
111 + reg_vcc_wifi: reg_vcc_wifi {
112 + compatible = "regulator-fixed";
113 + regulator-min-microvolt = <3300000>;
114 + regulator-max-microvolt = <3300000>;
115 + regulator-name = "vcc-wifi";
116 + enable-active-high;
117 + gpio = <&pio 0 20 GPIO_ACTIVE_HIGH>;
118 + };
119 +
120 + wifi_pwrseq: wifi_pwrseq {
121 + compatible = "mmc-pwrseq-simple";
122 + reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>;
123 + };
124 +};
125 +
126 +&ehci1 {
127 + status = "okay";
128 +};
129 +
130 +&emac {
131 + phy = <&phy1>;
132 + phy-mode = "mii";
133 + allwinner,use-internal-phy;
134 + allwinner,leds-active-low;
135 + status = "okay";
136 + phy1: ethernet-phy@1 {
137 + reg = <1>;
138 + };
139 +};
140 +
141 +&mmc0 {
142 + pinctrl-names = "default";
143 + pinctrl-0 = <&mmc0_pins_a>;
144 + vmmc-supply = <&reg_vcc3v3>;
145 + bus-width = <4>;
146 + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; /* PF6 */
147 + cd-inverted;
148 + status = "okay";
149 +};
150 +
151 +&mmc1 {
152 + pinctrl-names = "default";
153 + pinctrl-0 = <&mmc1_pins_a>;
154 + vmmc-supply = <&reg_vcc_wifi>;
155 + mmc-pwrseq = <&wifi_pwrseq>;
156 + bus-width = <4>;
157 + non-removable;
158 + status = "okay";
159 +
160 + /*
161 + * Explicitly define the sdio device, so that we can add an ethernet
162 + * alias for it (which e.g. makes u-boot set a mac-address).
163 + */
164 + xr819: sdio_wifi@1 {
165 + reg = <1>;
166 + };
167 +};
168 +
169 +&ohci1 {
170 + status = "okay";
171 +};
172 +
173 +&uart0 {
174 + pinctrl-names = "default";
175 + pinctrl-0 = <&uart0_pins_a>;
176 + status = "okay";
177 +};
178 +
179 +&usbphy {
180 + /* USB VBUS is always on */
181 + status = "okay";
182 +};