3da9955ee7d62fb91554a97a6d852488ad31a40a
[oweals/openwrt.git] / target / linux / at91 / patches-4.9 / 105-ARM-at91-build-dtb-for-sama5d2-ptc-Ek.patch
1 diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
2 index c88e426..cb47e80 100644
3 --- a/arch/arm/boot/dts/Makefile
4 +++ b/arch/arm/boot/dts/Makefile
5 @@ -49,6 +49,7 @@ dtb-$(CONFIG_SOC_AT91SAM9) += \
6         wb45n.dtb
7  dtb-$(CONFIG_SOC_SAM_V7) += \
8         at91-kizbox2.dtb \
9 +       at91-sama5d2_ptc_ek.dtb \
10         at91-sama5d27_som1_ek.dtb \
11         at91-sama5d2_xplained.dtb \
12         at91-sama5d3_xplained.dtb \
13 diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
14 new file mode 100644
15 index 0000000..257eaac
16 --- /dev/null
17 +++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
18 @@ -0,0 +1,422 @@
19 +// SPDX-License-Identifier: (GPL-2.0+ OR X11)
20 +/*
21 + * at91-sama5d2_ptc_ek.dts - Device Tree file for SAMA5D2 PTC EK board
22 + *
23 + *  Copyright (C) 2017 Microchip/Atmel,
24 + *               2017 Wenyou Yang <wenyou.yang@microchip.com>
25 + *               2017 Ludovic Desroches <ludovic.desroches@microchip.com>
26 + */
27 +/dts-v1/;
28 +#include "sama5d2.dtsi"
29 +#include "sama5d2-pinfunc.h"
30 +#include <dt-bindings/mfd/atmel-flexcom.h>
31 +#include <dt-bindings/gpio/gpio.h>
32 +#include <dt-bindings/pinctrl/at91.h>
33 +
34 +/ {
35 +       model = "Atmel SAMA5D2 PTC EK";
36 +       compatible = "atmel,sama5d2-ptc_ek", "atmel,sama5d2", "atmel,sama5";
37 +
38 +       aliases {
39 +               serial0 = &uart0;
40 +               i2c0    = &i2c0;
41 +               i2c1    = &i2c1;
42 +               i2c2    = &i2c2;
43 +       };
44 +
45 +       chosen {
46 +               stdout-path = "serial0:115200n8";
47 +       };
48 +
49 +       memory {
50 +               reg = <0x20000000 0x80000>;
51 +       };
52 +
53 +       clocks {
54 +               slow_xtal {
55 +                       clock-frequency = <32768>;
56 +               };
57 +
58 +               main_xtal {
59 +                       clock-frequency = <24000000>;
60 +               };
61 +       };
62 +
63 +       ahb {
64 +               usb0: gadget@00300000 {
65 +                       atmel,vbus-gpio = <&pioA PIN_PB11 GPIO_ACTIVE_HIGH>;
66 +                       pinctrl-names = "default";
67 +                       pinctrl-0 = <&pinctrl_usba_vbus>;
68 +                       status = "okay";
69 +               };
70 +
71 +               usb1: ohci@00400000 {
72 +                       num-ports = <3>;
73 +                       atmel,vbus-gpio = <0
74 +                                          &pioA PIN_PB12 GPIO_ACTIVE_HIGH
75 +                                          0
76 +                                         >;
77 +                       pinctrl-names = "default";
78 +                       pinctrl-0 = <&pinctrl_usb_default>;
79 +                       status = "okay";
80 +               };
81 +
82 +               usb2: ehci@00500000 {
83 +                       status = "okay";
84 +               };
85 +
86 +               nand0: nand@80000000 {
87 +                       nand-bus-width = <8>;
88 +                       nand-ecc-mode = "hw";
89 +                       nand-on-flash-bbt;
90 +                       atmel,has-pmecc;
91 +                       pinctrl-names = "default";
92 +                       pinctrl-0 = <&pinctrl_nand_default>;
93 +                       status = "okay"; /* conflicts with sdmmc1 and qspi0 */
94 +
95 +                       at91bootstrap@0 {
96 +                               label = "bootstrap";
97 +                               reg = <0x0 0x40000>;
98 +                       };
99 +
100 +                       bootloader@40000 {
101 +                               label = "bootloader";
102 +                               reg = <0x40000 0xc0000>;
103 +                       };
104 +
105 +                       bootloaderenv@0x100000 {
106 +                               label = "bootloader env";
107 +                               reg = <0x100000 0x40000>;
108 +                       };
109 +
110 +                       bootloaderenvred@0x140000 {
111 +                               label = "bootloader env redundant";
112 +                               reg = <0x140000 0x40000>;
113 +                       };
114 +
115 +                       dtb@180000 {
116 +                               label = "device tree";
117 +                               reg = <0x180000 0x80000>;
118 +                       };
119 +
120 +                       kernel@200000 {
121 +                               label = "kernel";
122 +                               reg = <0x200000 0x600000>;
123 +                       };
124 +
125 +                       rootfs@800000 {
126 +                               label = "rootfs";
127 +                               reg = <0x800000 0x1f800000>;
128 +                       };
129 +               };
130 +
131 +               sdmmc0: sdio-host@a0000000 {
132 +                       bus-width = <8>;
133 +                       pinctrl-names = "default";
134 +                       pinctrl-0 = <&pinctrl_sdmmc0_default>;
135 +                       status = "okay";
136 +               };
137 +
138 +               apb {
139 +                       pmc: pmc@f0014000 {
140 +                               pmc_fast_restart {
141 +                                       compatible = "atmel,sama5d2-pmc-fast-startup";
142 +                                       #address-cells = <1>;
143 +                                       #size-cells = <0>;
144 +
145 +                                       atmel,wakeup-rtc-timer;
146 +
147 +                                       wkpin: input@0 {
148 +                                               reg = <0>;
149 +                                       };
150 +
151 +                                       gmac_wol: input@10 {
152 +                                               reg = <10>;
153 +                                               atmel,wakeup-active-high;
154 +                                       };
155 +                               };
156 +                       };
157 +
158 +                       spi0: spi@f8000000 {
159 +                               pinctrl-names = "default";
160 +                               pinctrl-0 = <&pinctrl_spi0_default>;
161 +                               status = "okay";
162 +
163 +                               /*
164 +                               m25p80@0 {
165 +                                       compatible = "atmel,at25df321a";
166 +                                       reg = <0>;
167 +                                       spi-max-frequency = <50000000>;
168 +                               };
169 +                               */
170 +                       };
171 +
172 +                       macb0: ethernet@f8008000 {
173 +                               pinctrl-names = "default";
174 +                               pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
175 +                               phy-mode = "rmii";
176 +                               status = "okay";
177 +
178 +                               ethernet-phy@1 {
179 +                                       reg = <0x1>;
180 +                                       interrupt-parent = <&pioA>;
181 +                                       interrupts = <56 IRQ_TYPE_LEVEL_LOW>;
182 +                               };
183 +                       };
184 +
185 +                       uart0: serial@f801c000 {
186 +                               pinctrl-names = "default";
187 +                               pinctrl-0 = <&pinctrl_uart0_default>;
188 +                               atmel,use-dma-rx;
189 +                               atmel,use-dma-tx;
190 +                               status = "okay";
191 +                       };
192 +
193 +                       uart2: serial@f8024000 {
194 +                               pinctrl-names = "default";
195 +                               pinctrl-0 = <&pinctrl_uart2_default>;
196 +                               atmel,use-dma-rx;
197 +                               atmel,use-dma-tx;
198 +                               status = "okay";
199 +                       };
200 +
201 +                       i2c0: i2c@f8028000 {
202 +                               dmas = <0>, <0>;
203 +                               pinctrl-names = "default";
204 +                               pinctrl-0 = <&pinctrl_i2c0_default>;
205 +                               i2c-sda-hold-time-ns = <350>;
206 +                               status = "okay";
207 +                       };
208 +
209 +                       flx0: flexcom@f8034000 {
210 +                               atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
211 +                               status = "okay";
212 +
213 +                               i2c2: i2c@600 {
214 +                                       compatible = "atmel,sama5d2-i2c";
215 +                                       reg = <0x600 0x200>;
216 +                                       interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>;
217 +                                       dmas = <0>, <0>;
218 +                                       dma-names = "tx", "rx";
219 +                                       #address-cells = <1>;
220 +                                       #size-cells = <0>;
221 +                                       clocks = <&flx0_clk>;
222 +                                       pinctrl-names = "default";
223 +                                       pinctrl-0 = <&pinctrl_flx0_default>;
224 +                                       atmel,fifo-size = <16>;
225 +                                       status = "okay";
226 +                               };
227 +                       };
228 +
229 +                       shdwc@f8048010 {
230 +                               atmel,shdwc-debouncer = <976>;
231 +
232 +                               input@0 {
233 +                                       reg = <0>;
234 +                                       atmel,wakeup-type = "low";
235 +                               };
236 +                       };
237 +
238 +                       watchdog@f8048040 {
239 +                               status = "okay";
240 +                       };
241 +
242 +                       spi1: spi@fc000000 {
243 +                               pinctrl-names = "default";
244 +                               pinctrl-0 = <&pinctrl_spi1_default>;
245 +                               status = "okay";
246 +                       };
247 +
248 +                       i2c1: i2c@fc028000 {
249 +                               dmas = <0>, <0>;
250 +                               pinctrl-names = "default";
251 +                               pinctrl-0 = <&pinctrl_i2c1_default>;
252 +                               status = "okay";
253 +
254 +                               at24@50 {
255 +                                       compatible = "24c02";
256 +                                       reg = <0x50>;
257 +                                       pagesize = <8>;
258 +                               };
259 +                       };
260 +
261 +                       pinctrl@fc038000 {
262 +                               pinctrl_flx0_default: flx0_default {
263 +                                       pinmux = <PIN_PB28__FLEXCOM0_IO0>,
264 +                                                <PIN_PB29__FLEXCOM0_IO1>;
265 +                                       bias-disable;
266 +                               };
267 +
268 +                               pinctrl_i2c0_default: i2c0_default {
269 +                                       pinmux = <PIN_PD21__TWD0>,
270 +                                                <PIN_PD22__TWCK0>;
271 +                                       bias-disable;
272 +                               };
273 +
274 +                               pinctrl_i2c1_default: i2c1_default {
275 +                                       pinmux = <PIN_PC6__TWD1>,
276 +                                                <PIN_PC7__TWCK1>;
277 +                                       bias-disable;
278 +                               };
279 +
280 +                               pinctrl_key_gpio_default: key_gpio_default {
281 +                                       pinmux = <PIN_PA10__GPIO>;
282 +                                       bias-pull-up;
283 +                               };
284 +
285 +                               pinctrl_led_gpio_default: led_gpio_default {
286 +                                       pinmux = <PIN_PB6__GPIO>,
287 +                                                <PIN_PB8__GPIO>,
288 +                                                <PIN_PB10__GPIO>;
289 +                                       bias-pull-up;
290 +                               };
291 +
292 +                               pinctrl_macb0_default: macb0_default {
293 +                                       pinmux = <PIN_PB14__GTXCK>,
294 +                                                <PIN_PB15__GTXEN>,
295 +                                                <PIN_PB16__GRXDV>,
296 +                                                <PIN_PB17__GRXER>,
297 +                                                <PIN_PB18__GRX0>,
298 +                                                <PIN_PB19__GRX1>,
299 +                                                <PIN_PB20__GTX0>,
300 +                                                <PIN_PB21__GTX1>,
301 +                                                <PIN_PB22__GMDC>,
302 +                                                <PIN_PB23__GMDIO>;
303 +                                       bias-disable;
304 +                               };
305 +
306 +                               pinctrl_macb0_phy_irq: macb0_phy_irq {
307 +                                       pinmux = <PIN_PB24__GPIO>;
308 +                                       bias-disable;
309 +                               };
310 +
311 +                               pinctrl_nand_default: nand_default {
312 +                                       re_we_data {
313 +                                               pinmux = <PIN_PA22__D0>,
314 +                                                        <PIN_PA23__D1>,
315 +                                                        <PIN_PA24__D2>,
316 +                                                        <PIN_PA25__D3>,
317 +                                                        <PIN_PA26__D4>,
318 +                                                        <PIN_PA27__D5>,
319 +                                                        <PIN_PA28__D6>,
320 +                                                        <PIN_PA29__D7>,
321 +                                                        <PIN_PA30__NWE_NANDWE>,
322 +                                                        <PIN_PB2__NRD_NANDOE>;
323 +                                               bias-pull-up;
324 +                                               drive-strength = <ATMEL_PIO_DRVSTR_ME>;
325 +                                       };
326 +
327 +                                       ale_cle_rdy_cs {
328 +                                               pinmux = <PIN_PB0__A21_NANDALE>,
329 +                                                        <PIN_PB1__A22_NANDCLE>,
330 +                                                        <PIN_PC8__NANDRDY>,
331 +                                                        <PIN_PA31__NCS3>;
332 +                                               bias-pull-up;
333 +                                       };
334 +                               };
335 +
336 +                               pinctrl_sdmmc0_default: sdmmc0_default {
337 +                                       cmd_data {
338 +                                               pinmux = <PIN_PA1__SDMMC0_CMD>,
339 +                                                        <PIN_PA2__SDMMC0_DAT0>,
340 +                                                        <PIN_PA3__SDMMC0_DAT1>,
341 +                                                        <PIN_PA4__SDMMC0_DAT2>,
342 +                                                        <PIN_PA5__SDMMC0_DAT3>,
343 +                                                        <PIN_PA6__SDMMC0_DAT4>,
344 +                                                        <PIN_PA7__SDMMC0_DAT5>,
345 +                                                        <PIN_PA8__SDMMC0_DAT6>,
346 +                                                        <PIN_PA9__SDMMC0_DAT7>;
347 +                                               bias-pull-up;
348 +                                       };
349 +
350 +                                       ck_cd_vddsel {
351 +                                               pinmux = <PIN_PA0__SDMMC0_CK>,
352 +                                                        <PIN_PA11__SDMMC0_VDDSEL>,
353 +                                                        <PIN_PA13__SDMMC0_CD>;
354 +                                               bias-disable;
355 +                                       };
356 +                               };
357 +
358 +                               pinctrl_spi0_default: spi0_default {
359 +                                       pinmux = <PIN_PA14__SPI0_SPCK>,
360 +                                                <PIN_PA15__SPI0_MOSI>,
361 +                                                <PIN_PA16__SPI0_MISO>,
362 +                                                <PIN_PA17__SPI0_NPCS0>;
363 +                                       bias-disable;
364 +                               };
365 +
366 +                               pinctrl_spi1_default: spi1_default {
367 +                                       pinmux = <PIN_PC1__SPI1_SPCK>,
368 +                                                <PIN_PC2__SPI1_MOSI>,
369 +                                                <PIN_PC3__SPI1_MISO>,
370 +                                                <PIN_PC4__SPI1_NPCS0>;
371 +                                       bias-disable;
372 +                               };
373 +
374 +                               pinctrl_uart0_default: uart0_default {
375 +                                       pinmux = <PIN_PB26__URXD0>,
376 +                                                <PIN_PB27__UTXD0>;
377 +                                       bias-disable;
378 +                               };
379 +
380 +                               pinctrl_uart2_default: uart2_default {
381 +                                       pinmux = <PIN_PD23__URXD2>,
382 +                                                <PIN_PD24__UTXD2>;
383 +                                       bias-disable;
384 +                               };
385 +
386 +                               pinctrl_usb_default: usb_default {
387 +                                       pinmux = <PIN_PB12__GPIO>;
388 +                                       bias-disable;
389 +                               };
390 +
391 +                               pinctrl_usba_vbus: usba_vbus {
392 +                                       pinmux = <PIN_PB11__GPIO>;
393 +                                       bias-disable;
394 +                               };
395 +
396 +                       };
397 +
398 +                       ptc@fc060000 {
399 +                               status = "okay";
400 +                       };
401 +               };
402 +       };
403 +
404 +       gpio_keys {
405 +               compatible = "gpio-keys";
406 +
407 +               pinctrl-names = "default";
408 +               pinctrl-0 = <&pinctrl_key_gpio_default>;
409 +
410 +               bp1 {
411 +                       label = "PB_USER";
412 +                       gpios = <&pioA PIN_PA10 GPIO_ACTIVE_LOW>;
413 +                       linux,code = <0x104>;
414 +                       wakeup-source;
415 +               };
416 +       };
417 +
418 +       leds {
419 +               compatible = "gpio-leds";
420 +               pinctrl-names = "default";
421 +               pinctrl-0 = <&pinctrl_led_gpio_default>;
422 +               status = "okay";
423 +
424 +               red {
425 +                       label = "red";
426 +                       gpios = <&pioA PIN_PB10 GPIO_ACTIVE_HIGH>;
427 +               };
428 +
429 +               green {
430 +                       label = "green";
431 +                       gpios = <&pioA PIN_PB8 GPIO_ACTIVE_HIGH>;
432 +               };
433 +
434 +               blue {
435 +                       label = "blue";
436 +                       gpios = <&pioA PIN_PB6 GPIO_ACTIVE_HIGH>;
437 +                       linux,default-trigger = "heartbeat";
438 +               };
439 +       };
440 +};
441 --
442 2.7.4