e5a66d7ebe00e5f562348b1b6c30a22fa0736833
[openwrt/openwrt.git] / package / boot / uboot-sunxi / patches / 003-add-theobroma-a31-pangolin.patch
1 --- a/arch/arm/dts/Makefile
2 +++ b/arch/arm/dts/Makefile
3 @@ -152,6 +152,7 @@ dtb-$(CONFIG_MACH_SUN6I) += \
4 sun6i-a31-m9.dtb \
5 sun6i-a31-mele-a1000g-quad.dtb \
6 sun6i-a31-mixtile-loftq.dtb \
7 + sun6i-a31-pangolin.dtb \
8 sun6i-a31s-cs908.dtb \
9 sun6i-a31s-primo81.dtb \
10 sun6i-a31s-sinovoip-bpi-m2.dtb
11 --- a/arch/arm/dts/sun6i-a31.dtsi
12 +++ b/arch/arm/dts/sun6i-a31.dtsi
13 @@ -643,6 +643,13 @@
14 allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
15 };
16
17 + i2c3_pins_a: i2c3@0 {
18 + allwinner,pins = "PB5", "PB6";
19 + allwinner,function = "i2c3";
20 + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
21 + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
22 + };
23 +
24 mmc0_pins_a: mmc0@0 {
25 allwinner,pins = "PF0", "PF1", "PF2",
26 "PF3", "PF4", "PF5";
27 --- /dev/null
28 +++ b/arch/arm/dts/sun6i-a31-pangolin.dts
29 @@ -0,0 +1,292 @@
30 +/*
31 + * Copyright 2015, Theobroma Systems Design und Consulting GmbH
32 + *
33 + * This file is dual-licensed: you can use it either under the terms
34 + * of the GPL or the X11 license, at your option. Note that this dual
35 + * licensing only applies to this file, and not this project as a
36 + * whole.
37 + *
38 + * a) This file is free software; you can redistribute it and/or
39 + * modify it under the terms of the GNU General Public License as
40 + * published by the Free Software Foundation; either version 2 of the
41 + * License, or (at your option) any later version.
42 + *
43 + * This file is distributed in the hope that it will be useful,
44 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
45 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46 + * GNU General Public License for more details.
47 + *
48 + * Or, alternatively,
49 + *
50 + * b) Permission is hereby granted, free of charge, to any person
51 + * obtaining a copy of this software and associated documentation
52 + * files (the "Software"), to deal in the Software without
53 + * restriction, including without limitation the rights to use,
54 + * copy, modify, merge, publish, distribute, sublicense, and/or
55 + * sell copies of the Software, and to permit persons to whom the
56 + * Software is furnished to do so, subject to the following
57 + * conditions:
58 + *
59 + * The above copyright notice and this permission notice shall be
60 + * included in all copies or substantial portions of the Software.
61 + *
62 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
63 + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
64 + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
65 + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
66 + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
67 + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
68 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
69 + * OTHER DEALINGS IN THE SOFTWARE.
70 + */
71 +
72 +/dts-v1/;
73 +#include "sun6i-a31.dtsi"
74 +#include "sunxi-common-regulators.dtsi"
75 +
76 +#include <dt-bindings/gpio/gpio.h>
77 +#include <dt-bindings/pinctrl/sun4i-a10.h>
78 +
79 +/ {
80 + model = "Theobroma Systems A31 Pangolin";
81 + compatible = "tsd,a31-pangolin", "allwinner,sun6i-a31";
82 +
83 + aliases {
84 + serial0 = &uart0;
85 + serial2 = &uart2;
86 + spi0 = &spi0;
87 + spi1 = &spi1;
88 + spi2 = &spi2;
89 + spi3 = &spi3;
90 + };
91 +
92 + chosen {
93 + stdout-path = "serial2:115200n8";
94 + };
95 +};
96 +
97 +&ehci0 {
98 + status = "okay";
99 +};
100 +
101 +&ohci0 {
102 + status = "okay";
103 +};
104 +
105 +&ehci1 {
106 + status = "okay";
107 +};
108 +
109 +&ohci1 {
110 + status = "okay";
111 +};
112 +
113 +&ohci2 {
114 + status = "okay";
115 +};
116 +
117 +&gmac {
118 + pinctrl-names = "default";
119 + pinctrl-0 = <&gmac_pins_rgmii_a>;
120 + phy = <&phy1>;
121 + phy-mode = "rgmii";
122 + snps,reset-gpio = <&pio 0 7 GPIO_ACTIVE_LOW>;
123 + snps,reset-active-low;
124 + snps,reset-delays-us = <0 10000 30000>;
125 + status = "okay";
126 +
127 + phy1: ethernet-phy@4 {
128 + reg = <4>;
129 + };
130 +};
131 +
132 +&i2c0 {
133 + pinctrl-names = "default";
134 + pinctrl-0 = <&i2c0_pins_a>;
135 + status = "okay";
136 +};
137 +
138 +&i2c1 {
139 + pinctrl-names = "default";
140 + pinctrl-0 = <&i2c1_pins_a>;
141 + status = "okay";
142 +};
143 +
144 +&i2c2 {
145 + pinctrl-names = "default";
146 + pinctrl-0 = <&i2c2_pins_a>;
147 + status = "okay";
148 +};
149 +
150 +&i2c3 {
151 + pinctrl-names = "default";
152 + pinctrl-0 = <&i2c3_pins_a>;
153 + status = "okay";
154 +
155 + rtc_twi: rtc@6f {
156 + compatible = "isil,isl1208";
157 + reg = <0x6f>;
158 + };
159 + fan: fan@18 {
160 + compatible = "ti,amc6821";
161 + reg = <0x18>;
162 + cooling-min-state = <0>;
163 + cooling-max-state = <9>;
164 + #cooling-cells = <2>;
165 + };
166 +};
167 +
168 +&spi0 {
169 + status = "okay";
170 +
171 + flash: flash@0 {
172 + compatible = "spansion,m25p40";
173 + spi-max-frequency = <16000000>;
174 + spi-cpol;
175 + spi-cpha;
176 + };
177 +};
178 +
179 +&spi1 {
180 + status = "okay";
181 +};
182 +
183 +&ir {
184 + pinctrl-names = "default";
185 + pinctrl-0 = <&ir_pins_a>;
186 + status = "okay";
187 +};
188 +
189 +&mmc0 {
190 + pinctrl-names = "default";
191 + pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_pangolin>;
192 + vmmc-supply = <&reg_vcc3v0>;
193 + bus-width = <4>;
194 + cd-gpios = <&pio 2 19 GPIO_ACTIVE_LOW>; /* PC19 */
195 + status = "okay";
196 +};
197 +
198 +&mmc0_pins_a {
199 + /* external pull-ups missing for some pins */
200 + allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
201 +};
202 +
203 +&mmc2 {
204 + pinctrl-names = "default";
205 + pinctrl-0 = <&mmc2_pins_a>;
206 + vmmc-supply = <&reg_vcc3v0>;
207 + bus-width = <8>;
208 + non-removable;
209 + status = "okay";
210 +};
211 +
212 +&pio {
213 + mmc0_cd_pin_pangolin: mmc0_cd_pin@0 {
214 + allwinner,pins = "PC19";
215 + allwinner,function = "gpio_in";
216 + allwinner,drive = <SUN4I_PINCTRL_10_MA>;
217 + allwinner,pull = <SUN4I_PINCTRL_PULL_UP>;
218 + };
219 +
220 + leds_pins_pangolin: led_pins@0 {
221 + allwinner,pins = "PH7", "PC16";
222 + allwinner,function = "gpio_out";
223 + allwinner,drive = <SUN4I_PINCTRL_20_MA>;
224 + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
225 + };
226 +
227 + mmc2_pins_a: mmc2@0 {
228 + allwinner,pins = "PC6","PC7","PC8","PC9","PC10","PC11",
229 + "PC12","PC13","PC14","PC15";
230 + allwinner,function = "mmc2";
231 + allwinner,drive = <SUN4I_PINCTRL_30_MA>;
232 + allwinner,pull = <SUN4I_PINCTRL_NO_PULL>;
233 + };
234 +};
235 +
236 +&p2wi {
237 + status = "okay";
238 +
239 + axp221: pmic@68 {
240 + compatible = "x-powers,axp221";
241 + reg = <0x68>;
242 + interrupt-parent = <&nmi_intc>;
243 + interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
244 + interrupt-controller;
245 + #interrupt-cells = <1>;
246 + dcdc1-supply = <&vcc_3v0>;
247 + dcdc5-supply = <&vcc_dram>;
248 +
249 + regulators {
250 + x-powers,dcdc-freq = <3000>;
251 +
252 + vcc_3v0: dcdc1 {
253 + regulator-always-on;
254 + regulator-min-microvolt = <3000000>;
255 + regulator-max-microvolt = <3000000>;
256 + regulator-name = "vcc-3v0";
257 + };
258 +
259 + vdd_cpu: dcdc2 {
260 + regulator-always-on;
261 + regulator-min-microvolt = <700000>;
262 + regulator-max-microvolt = <1320000>;
263 + regulator-name = "vdd-cpu";
264 + };
265 +
266 + vdd_gpu: dcdc3 {
267 + regulator-always-on;
268 + regulator-min-microvolt = <700000>;
269 + regulator-max-microvolt = <1320000>;
270 + regulator-name = "vdd-gpu";
271 + };
272 +
273 + vdd_sys_dll: dcdc4 {
274 + regulator-always-on;
275 + regulator-min-microvolt = <1100000>;
276 + regulator-max-microvolt = <1100000>;
277 + regulator-name = "vdd-sys-dll";
278 + };
279 +
280 + vcc_dram: dcdc5 {
281 + regulator-always-on;
282 + regulator-min-microvolt = <1500000>;
283 + regulator-max-microvolt = <1500000>;
284 + regulator-name = "vcc-dram";
285 + };
286 +
287 + vcc_wifi: aldo1 {
288 + regulator-min-microvolt = <3300000>;
289 + regulator-max-microvolt = <3300000>;
290 + regulator-name = "vcc_wifi";
291 + };
292 +
293 + avcc: aldo3 {
294 + regulator-always-on;
295 + regulator-min-microvolt = <3000000>;
296 + regulator-max-microvolt = <3000000>;
297 + regulator-name = "avcc";
298 + };
299 + };
300 + };
301 +};
302 +
303 +&uart0 {
304 + pinctrl-names = "default";
305 + pinctrl-0 = <&uart0_pins_a>;
306 + status = "okay";
307 +};
308 +
309 +&usb1_vbus_pin_a {
310 + allwinner,pins = "PD23";
311 +};
312 +
313 +&reg_usb1_vbus {
314 + gpio = <&pio 3 23 GPIO_ACTIVE_HIGH>; /* PD 23 */
315 + status = "okay";
316 +};
317 +
318 +&usbphy {
319 + status = "okay";
320 + usb1_vbus-supply = <&reg_usb1_vbus>;
321 +};
322 --- /dev/null
323 +++ b/configs/pangolin_defconfig
324 @@ -0,0 +1,36 @@
325 +CONFIG_SUNXI_PANGOLIN=y
326 +CONFIG_SPL=y
327 +CONFIG_SYS_EXTRA_OPTIONS="USB_EHCI,SUNXI_GMAC,RGMII"
328 +CONFIG_DEFAULT_DEVICE_TREE="sun6i-a31-pangolin"
329 +CONFIG_VIDEO_VGA_VIA_LCD=y
330 +CONFIG_VIDEO_VGA_EXTERNAL_DAC_EN="PH25"
331 +CONFIG_ARM=y
332 +CONFIG_ARCH_SUNXI=y
333 +CONFIG_MACH_SUN6I=y
334 +CONFIG_DRAM_CHANNELS=1
335 +CONFIG_DRAM_CLK=360
336 +CONFIG_DRAM_ZQ=70
337 +CONFIG_AXP_DCDC1_VOLT=3300
338 +CONFIG_AXP_ALDO1_VOLT=0
339 +CONFIG_AXP_ALDO2_VOLT=1800
340 +CONFIG_AXP_ALDO3_VOLT=3000
341 +CONFIG_AXP_DLDO4_VOLT=3300
342 +CONFIG_AXP_ELDO1_VOLT=1200
343 +CONFIG_AXP_ELDO2_VOLT=2500
344 +CONFIG_AXP_ELDO3_VOLT=3300
345 +CONFIG_MMC_SUNXI_SLOT_EXTRA=2
346 +CONFIG_CONS_INDEX=3
347 +# Vbus gpio for usb1
348 +CONFIG_USB1_VBUS_PIN=""
349 +# No Vbus gpio for usb2
350 +CONFIG_USB2_VBUS_PIN=""
351 +CONFIG_USB=y
352 +CONFIG_DM_USB=y
353 +CONFIG_USB_EHCI=y
354 +CONFIG_USB_KEYBOARD=y
355 +CONFIG_DM_ETH=y
356 +CONFIG_CMD_IMLS=n
357 +CONFIG_ETH_DESIGNWARE=y
358 +CONFIG_DM_SPI=y
359 +CONFIG_DM_SPI_FLASH=y
360 +CONFIG_SUNXI_SPI=y
361 --- a/board/sunxi/Kconfig
362 +++ b/board/sunxi/Kconfig
363 @@ -15,7 +15,6 @@ config SUNXI_GEN_SUN6I
364 separate ahb reset control registers, custom pmic bus, new style
365 watchdog, etc.
366
367 -
368 choice
369 prompt "Sunxi SoC Variant"
370 optional
371 @@ -533,6 +532,14 @@ config VIDEO_LCD_PANEL_I2C_SCL
372 Set the SCL pin for the LCD i2c interface. This takes a string in the
373 format understood by sunxi_name_to_gpio, e.g. PH1 for pin 1 of port H.
374
375 +choice
376 + prompt "Sunxi Board Variant"
377 + optional
378 +
379 +config SUNXI_PANGOLIN
380 + bool "Theobroma A31 uQ7 Board"
381 +
382 +endchoice
383
384 # Note only one of these may be selected at a time! But hidden choices are
385 # not supported by Kconfig