1/*
2 * at91-sama5d2_xplained.dts - Device Tree file for SAMA5D2 Xplained board
3 *
4 *  Copyright (C) 2015 Atmel,
5 *                2015 Nicolas Ferre <nicolas.ferre@atmel.com>
6 *
7 * This file is dual-licensed: you can use it either under the terms
8 * of the GPL or the X11 license, at your option. Note that this dual
9 * licensing only applies to this file, and not this project as a
10 * whole.
11 *
12 *  a) This file is free software; you can redistribute it and/or
13 *     modify it under the terms of the GNU General Public License as
14 *     published by the Free Software Foundation; either version 2 of the
15 *     License, or (at your option) any later version.
16 *
17 *     This file is distributed in the hope that it will be useful,
18 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
19 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20 *     GNU General Public License for more details.
21 *
22 * Or, alternatively,
23 *
24 *  b) Permission is hereby granted, free of charge, to any person
25 *     obtaining a copy of this software and associated documentation
26 *     files (the "Software"), to deal in the Software without
27 *     restriction, including without limitation the rights to use,
28 *     copy, modify, merge, publish, distribute, sublicense, and/or
29 *     sell copies of the Software, and to permit persons to whom the
30 *     Software is furnished to do so, subject to the following
31 *     conditions:
32 *
33 *     The above copyright notice and this permission notice shall be
34 *     included in all copies or substantial portions of the Software.
35 *
36 *     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
37 *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
38 *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
39 *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
40 *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
41 *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
42 *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
43 *     OTHER DEALINGS IN THE SOFTWARE.
44 */
45/dts-v1/;
46#include "sama5d2.dtsi"
47#include "sama5d2-pinfunc.h"
48#include <dt-bindings/mfd/atmel-flexcom.h>
49#include <dt-bindings/gpio/gpio.h>
50
51/ {
52	model = "Atmel SAMA5D2 Xplained";
53	compatible = "atmel,sama5d2-xplained", "atmel,sama5d2", "atmel,sama5";
54
55	chosen {
56		stdout-path = "serial0:115200n8";
57	};
58
59	clocks {
60		slow_xtal {
61			clock-frequency = <32768>;
62		};
63
64		main_xtal {
65			clock-frequency = <12000000>;
66		};
67	};
68
69	ahb {
70		usb0: gadget@300000 {
71			atmel,vbus-gpio = <&pioA PIN_PA31 GPIO_ACTIVE_HIGH>;
72			pinctrl-names = "default";
73			pinctrl-0 = <&pinctrl_usba_vbus>;
74			status = "okay";
75		};
76
77		usb1: ohci@400000 {
78			num-ports = <3>;
79			atmel,vbus-gpio = <0 /* &pioA PIN_PB9 GPIO_ACTIVE_HIGH */
80					   &pioA PIN_PB10 GPIO_ACTIVE_HIGH
81					   0
82					  >;
83			pinctrl-names = "default";
84			pinctrl-0 = <&pinctrl_usb_default>;
85			status = "okay";
86		};
87
88		usb2: ehci@500000 {
89			status = "okay";
90		};
91
92		sdmmc0: sdio-host@a0000000 {
93			bus-width = <8>;
94			pinctrl-names = "default";
95			pinctrl-0 = <&pinctrl_sdmmc0_default>;
96			non-removable;
97			mmc-ddr-1_8v;
98			status = "okay";
99		};
100
101		sdmmc1: sdio-host@b0000000 {
102			bus-width = <4>;
103			pinctrl-names = "default";
104			pinctrl-0 = <&pinctrl_sdmmc1_default>;
105			status = "okay"; /* conflict with qspi0 */
106			vqmmc-supply = <&vdd_3v3_reg>;
107			vmmc-supply = <&vdd_3v3_reg>;
108		};
109
110		apb {
111			spi0: spi@f8000000 {
112				pinctrl-names = "default";
113				pinctrl-0 = <&pinctrl_spi0_default>;
114				status = "okay";
115
116				m25p80@0 {
117					compatible = "atmel,at25df321a";
118					reg = <0>;
119					spi-max-frequency = <50000000>;
120				};
121			};
122
123			macb0: ethernet@f8008000 {
124				pinctrl-names = "default";
125				pinctrl-0 = <&pinctrl_macb0_default &pinctrl_macb0_phy_irq>;
126				phy-mode = "rmii";
127				status = "okay";
128
129				ethernet-phy@1 {
130					reg = <0x1>;
131					interrupt-parent = <&pioA>;
132					interrupts = <PIN_PC9 IRQ_TYPE_LEVEL_LOW>;
133				};
134			};
135
136			tcb0: timer@f800c000 {
137				timer0: timer@0 {
138					compatible = "atmel,tcb-timer";
139					reg = <0>;
140				};
141
142				timer1: timer@1 {
143					compatible = "atmel,tcb-timer";
144					reg = <1>;
145				};
146			};
147
148			pdmic@f8018000 {
149				pinctrl-names = "default";
150				pinctrl-0 = <&pinctrl_pdmic_default>;
151				atmel,model = "PDMIC @ sama5d2_xplained";
152				atmel,mic-min-freq = <1000000>;
153				atmel,mic-max-freq = <3246000>;
154				atmel,mic-offset = <0x0>;
155				status = "okay";
156			};
157
158			uart1: serial@f8020000 {
159				pinctrl-names = "default";
160				pinctrl-0 = <&pinctrl_uart1_default>;
161				atmel,use-dma-rx;
162				atmel,use-dma-tx;
163				status = "okay";
164			};
165
166			i2c0: i2c@f8028000 {
167				dmas = <0>, <0>;
168				pinctrl-names = "default";
169				pinctrl-0 = <&pinctrl_i2c0_default>;
170				i2c-sda-hold-time-ns = <350>;
171				status = "okay";
172
173				pmic@5b {
174					compatible = "active-semi,act8945a";
175					reg = <0x5b>;
176					active-semi,vsel-high;
177					status = "okay";
178
179					regulators {
180						vdd_1v35_reg: REG_DCDC1 {
181							regulator-name = "VDD_1V35";
182							regulator-min-microvolt = <1350000>;
183							regulator-max-microvolt = <1350000>;
184							regulator-always-on;
185						};
186
187						vdd_1v2_reg: REG_DCDC2 {
188							regulator-name = "VDD_1V2";
189							regulator-min-microvolt = <1100000>;
190							regulator-max-microvolt = <1300000>;
191							regulator-always-on;
192						};
193
194						vdd_3v3_reg: REG_DCDC3 {
195							regulator-name = "VDD_3V3";
196							regulator-min-microvolt = <3300000>;
197							regulator-max-microvolt = <3300000>;
198							regulator-always-on;
199						};
200
201						vdd_fuse_reg: REG_LDO1 {
202							regulator-name = "VDD_FUSE";
203							regulator-min-microvolt = <2500000>;
204							regulator-max-microvolt = <2500000>;
205							regulator-always-on;
206						};
207
208						vdd_3v3_lp_reg: REG_LDO2 {
209							regulator-name = "VDD_3V3_LP";
210							regulator-min-microvolt = <3300000>;
211							regulator-max-microvolt = <3300000>;
212							regulator-always-on;
213						};
214
215						vdd_led_reg: REG_LDO3 {
216							regulator-name = "VDD_LED";
217							regulator-min-microvolt = <3300000>;
218							regulator-max-microvolt = <3300000>;
219							regulator-always-on;
220						};
221
222						vdd_sdhc_1v8_reg: REG_LDO4 {
223							regulator-name = "VDD_SDHC_1V8";
224							regulator-min-microvolt = <1800000>;
225							regulator-max-microvolt = <1800000>;
226							regulator-always-on;
227						};
228					};
229
230					charger {
231						compatible = "active-semi,act8945a-charger";
232						pinctrl-names = "default";
233						pinctrl-0 = <&pinctrl_charger_chglev &pinctrl_charger_lbo &pinctrl_charger_irq>;
234						interrupt-parent = <&pioA>;
235						interrupts = <PIN_PB13 IRQ_TYPE_EDGE_RISING>;
236
237						active-semi,chglev-gpios = <&pioA PIN_PA12 GPIO_ACTIVE_HIGH>;
238						active-semi,lbo-gpios = <&pioA PIN_PC8 GPIO_ACTIVE_LOW>;
239						active-semi,input-voltage-threshold-microvolt = <6600>;
240						active-semi,precondition-timeout = <40>;
241						active-semi,total-timeout = <3>;
242						status = "okay";
243					};
244				};
245			};
246
247			pwm0: pwm@f802c000 {
248				pinctrl-names = "default";
249				pinctrl-0 = <&pinctrl_pwm0_pwm2_default>;
250				status = "disabled"; /* conflict with leds */
251			};
252
253			flx0: flexcom@f8034000 {
254				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
255				status = "disabled"; /* conflict with ISC_D2 & ISC_D3 data pins */
256
257				uart5: serial@200 {
258					compatible = "atmel,at91sam9260-usart";
259					reg = <0x200 0x200>;
260					interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>;
261					clocks = <&flx0_clk>;
262					clock-names = "usart";
263					pinctrl-names = "default";
264					pinctrl-0 = <&pinctrl_flx0_default>;
265					atmel,fifo-size = <32>;
266					status = "okay";
267				};
268			};
269
270			shdwc@f8048010 {
271				atmel,shdwc-debouncer = <976>;
272				atmel,wakeup-rtc-timer;
273
274				input@0 {
275					reg = <0>;
276					atmel,wakeup-type = "low";
277				};
278			};
279
280			watchdog@f8048040 {
281				status = "okay";
282			};
283
284			can0: can@f8054000 {
285				pinctrl-names = "default";
286				pinctrl-0 = <&pinctrl_can0_default>;
287				status = "okay";
288			};
289
290			uart3: serial@fc008000 {
291				atmel,use-dma-rx;
292				atmel,use-dma-tx;
293				pinctrl-names = "default";
294				pinctrl-0 = <&pinctrl_uart3_default>;
295				status = "okay";
296			};
297
298			flx4: flexcom@fc018000 {
299				atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
300				status = "okay";
301
302				i2c2: i2c@600 {
303					compatible = "atmel,sama5d2-i2c";
304					reg = <0x600 0x200>;
305					interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>;
306					dmas = <0>, <0>;
307					dma-names = "tx", "rx";
308					#address-cells = <1>;
309					#size-cells = <0>;
310					clocks = <&flx4_clk>;
311					pinctrl-names = "default";
312					pinctrl-0 = <&pinctrl_flx4_default>;
313					atmel,fifo-size = <16>;
314					status = "okay";
315				};
316			};
317
318			i2c1: i2c@fc028000 {
319				dmas = <0>, <0>;
320				pinctrl-names = "default";
321				pinctrl-0 = <&pinctrl_i2c1_default>;
322				status = "okay";
323
324				at24@54 {
325					compatible = "atmel,24c02";
326					reg = <0x54>;
327					pagesize = <16>;
328				};
329			};
330
331			adc: adc@fc030000 {
332				vddana-supply = <&vdd_3v3_lp_reg>;
333				vref-supply = <&vdd_3v3_lp_reg>;
334				pinctrl-names = "default";
335				pinctrl-0 = <&pinctrl_adc_default &pinctrl_adtrg_default>;
336				status = "okay";
337			};
338
339			pinctrl@fc038000 {
340				/*
341				 * There is no real pinmux for ADC, if the pin
342				 * is not requested by another peripheral then
343				 * the muxing is done when channel is enabled.
344				 * Requesting pins for ADC is GPIO is
345				 * encouraged to prevent conflicts and to
346				 * disable bias in order to be in the same
347				 * state when the pin is not muxed to the adc.
348				 */
349				pinctrl_adc_default: adc_default {
350					pinmux = <PIN_PD23__GPIO>;
351					bias-disable;
352				};
353
354				pinctrl_can0_default: can0_default {
355					pinmux = <PIN_PC10__CANTX0>,
356						 <PIN_PC11__CANRX0>;
357					bias-disable;
358				};
359
360				pinctrl_can1_default: can1_default {
361					pinmux = <PIN_PC26__CANTX1>,
362						 <PIN_PC27__CANRX1>;
363					bias-disable;
364				};
365
366				/*
367				 * The ADTRG pin can work on any edge type.
368				 * In here it's being pulled up, so need to
369				 * connect it to ground to get an edge e.g.
370				 * Trigger can be configured on falling, rise
371				 * or any edge, and the pull-up can be changed
372				 * to pull-down or left floating according to
373				 * needs.
374				 */
375				pinctrl_adtrg_default: adtrg_default {
376					pinmux = <PIN_PD31__ADTRG>;
377					bias-pull-up;
378				};
379
380				pinctrl_charger_chglev: charger_chglev {
381					pinmux = <PIN_PA12__GPIO>;
382					bias-disable;
383				};
384
385				pinctrl_charger_irq: charger_irq {
386					pinmux = <PIN_PB13__GPIO>;
387					bias-disable;
388				};
389
390				pinctrl_charger_lbo: charger_lbo {
391					pinmux = <PIN_PC8__GPIO>;
392					bias-pull-up;
393				};
394
395				pinctrl_classd_default: classd_default {
396					pinmux = <PIN_PB1__CLASSD_R0>,
397						 <PIN_PB2__CLASSD_R1>,
398						 <PIN_PB3__CLASSD_R2>,
399						 <PIN_PB4__CLASSD_R3>;
400					bias-pull-up;
401				};
402
403				pinctrl_flx0_default: flx0_default {
404					pinmux = <PIN_PB28__FLEXCOM0_IO0>,
405						 <PIN_PB29__FLEXCOM0_IO1>;
406					bias-disable;
407				};
408
409				pinctrl_flx4_default: flx4_default {
410					pinmux = <PIN_PD12__FLEXCOM4_IO0>,
411						 <PIN_PD13__FLEXCOM4_IO1>;
412					bias-disable;
413				};
414
415				pinctrl_i2c0_default: i2c0_default {
416					pinmux = <PIN_PD21__TWD0>,
417						 <PIN_PD22__TWCK0>;
418					bias-disable;
419				};
420
421				pinctrl_i2c1_default: i2c1_default {
422					pinmux = <PIN_PD4__TWD1>,
423						 <PIN_PD5__TWCK1>;
424					bias-disable;
425				};
426
427				pinctrl_key_gpio_default: key_gpio_default {
428					pinmux = <PIN_PB9__GPIO>;
429					bias-pull-up;
430				};
431
432				pinctrl_led_gpio_default: led_gpio_default {
433					pinmux = <PIN_PB0__GPIO>,
434						 <PIN_PB5__GPIO>,
435						 <PIN_PB6__GPIO>;
436					bias-pull-up;
437				};
438
439				pinctrl_macb0_default: macb0_default {
440					pinmux = <PIN_PB14__GTXCK>,
441						 <PIN_PB15__GTXEN>,
442						 <PIN_PB16__GRXDV>,
443						 <PIN_PB17__GRXER>,
444						 <PIN_PB18__GRX0>,
445						 <PIN_PB19__GRX1>,
446						 <PIN_PB20__GTX0>,
447						 <PIN_PB21__GTX1>,
448						 <PIN_PB22__GMDC>,
449						 <PIN_PB23__GMDIO>;
450					bias-disable;
451				};
452
453				pinctrl_macb0_phy_irq: macb0_phy_irq {
454					pinmux = <PIN_PC9__GPIO>;
455					bias-disable;
456				};
457
458				pinctrl_pdmic_default: pdmic_default {
459					pinmux = <PIN_PB26__PDMIC_DAT>,
460						<PIN_PB27__PDMIC_CLK>;
461					bias-disable;
462				};
463
464				pinctrl_sdmmc0_default: sdmmc0_default {
465					cmd_data {
466						pinmux = <PIN_PA1__SDMMC0_CMD>,
467							 <PIN_PA2__SDMMC0_DAT0>,
468							 <PIN_PA3__SDMMC0_DAT1>,
469							 <PIN_PA4__SDMMC0_DAT2>,
470							 <PIN_PA5__SDMMC0_DAT3>,
471							 <PIN_PA6__SDMMC0_DAT4>,
472							 <PIN_PA7__SDMMC0_DAT5>,
473							 <PIN_PA8__SDMMC0_DAT6>,
474							 <PIN_PA9__SDMMC0_DAT7>;
475						bias-disable;
476					};
477
478					ck_cd_rstn_vddsel {
479						pinmux = <PIN_PA0__SDMMC0_CK>,
480							 <PIN_PA10__SDMMC0_RSTN>,
481							 <PIN_PA11__SDMMC0_VDDSEL>,
482							 <PIN_PA13__SDMMC0_CD>;
483						bias-disable;
484					};
485				};
486
487				pinctrl_sdmmc1_default: sdmmc1_default {
488					cmd_data {
489						pinmux = <PIN_PA28__SDMMC1_CMD>,
490							 <PIN_PA18__SDMMC1_DAT0>,
491							 <PIN_PA19__SDMMC1_DAT1>,
492							 <PIN_PA20__SDMMC1_DAT2>,
493							 <PIN_PA21__SDMMC1_DAT3>;
494						bias-disable;
495					};
496
497					conf-ck_cd {
498						pinmux = <PIN_PA22__SDMMC1_CK>,
499							 <PIN_PA30__SDMMC1_CD>;
500						bias-disable;
501					};
502				};
503
504				pinctrl_spi0_default: spi0_default {
505					pinmux = <PIN_PA14__SPI0_SPCK>,
506						 <PIN_PA15__SPI0_MOSI>,
507						 <PIN_PA16__SPI0_MISO>,
508						 <PIN_PA17__SPI0_NPCS0>;
509					bias-disable;
510				};
511
512				pinctrl_uart1_default: uart1_default {
513					pinmux = <PIN_PD2__URXD1>,
514						 <PIN_PD3__UTXD1>;
515					bias-disable;
516				};
517
518				pinctrl_uart3_default: uart3_default {
519					pinmux = <PIN_PB11__URXD3>,
520						 <PIN_PB12__UTXD3>;
521					bias-disable;
522				};
523
524				pinctrl_usb_default: usb_default {
525					pinmux = <PIN_PB10__GPIO>;
526					bias-disable;
527				};
528
529				pinctrl_usba_vbus: usba_vbus {
530					pinmux = <PIN_PA31__GPIO>;
531					bias-disable;
532				};
533
534				pinctrl_pwm0_pwm2_default: pwm0_pwm2_default {
535					pinmux = <PIN_PB5__PWMH2>,
536						 <PIN_PB6__PWML2>;
537					bias-pull-up;
538				};
539			};
540
541			classd: classd@fc048000 {
542				pinctrl-names = "default";
543				pinctrl-0 = <&pinctrl_classd_default>;
544				atmel,pwm-type = "diff";
545				atmel,non-overlap-time = <10>;
546				status = "okay";
547			};
548
549			can1: can@fc050000 {
550				pinctrl-names = "default";
551				pinctrl-0 = <&pinctrl_can1_default>;
552				status = "okay";
553			};
554		};
555	};
556
557	gpio_keys {
558		compatible = "gpio-keys";
559
560		pinctrl-names = "default";
561		pinctrl-0 = <&pinctrl_key_gpio_default>;
562
563		bp1 {
564			label = "PB_USER";
565			gpios = <&pioA PIN_PB9 GPIO_ACTIVE_LOW>;
566			linux,code = <0x104>;
567			wakeup-source;
568		};
569	};
570
571	leds {
572		compatible = "gpio-leds";
573		pinctrl-names = "default";
574		pinctrl-0 = <&pinctrl_led_gpio_default>;
575		status = "okay"; /* conflict with pwm0 */
576
577		red {
578			label = "red";
579			gpios = <&pioA PIN_PB6 GPIO_ACTIVE_LOW>;
580		};
581
582
583		green {
584			label = "green";
585			gpios = <&pioA PIN_PB5 GPIO_ACTIVE_LOW>;
586		};
587
588		blue {
589			label = "blue";
590			gpios = <&pioA PIN_PB0 GPIO_ACTIVE_LOW>;
591			linux,default-trigger = "heartbeat";
592		};
593	};
594};
595