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