1// SPDX-License-Identifier: GPL-2.0
2/*
3 * at91-kizbox3.dts - Device Tree Include file for Overkiz Kizbox 3
4 * family SoC boards
5 *
6 * Copyright (C) 2018 Overkiz SAS
7 *
8 * Authors: Dorian Rocipon <d.rocipon@overkiz.com>
9 *          Kevin Carli <k.carli@overkiz.com>
10 *          Mickael Gardet <m.gardet@overkiz.com>
11 */
12/dts-v1/;
13#include "sama5d2.dtsi"
14#include "sama5d2-pinfunc.h"
15#include <dt-bindings/gpio/gpio.h>
16#include <dt-bindings/mfd/atmel-flexcom.h>
17#include <dt-bindings/pinctrl/at91.h>
18#include <dt-bindings/pwm/pwm.h>
19
20/ {
21	model = "Overkiz Kizbox3";
22	compatible = "overkiz,kizbox3", "atmel,sama5d2", "atmel,sama5";
23
24	aliases {
25		serial0 = &uart0;
26		serial1 = &uart1;
27		serial2 = &uart2;
28		serial3 = &uart3;
29		serial4 = &uart4;
30		serial5 = &uart5;
31		serial6 = &uart8;
32	};
33
34	chosen {
35		bootargs = "ubi.mtd=ubi";
36		stdout-path = "serial1:115200n8";
37	};
38
39	clocks {
40		slow_xtal {
41			clock-frequency = <32768>;
42		};
43
44		main_xtal {
45			clock-frequency = <12000000>;
46		};
47	};
48
49	vdd_adc_vddana: supply_3v3_ana {
50		compatible = "regulator-fixed";
51		regulator-name = "adc-vddana";
52		regulator-min-microvolt = <3300000>;
53		regulator-max-microvolt = <3300000>;
54		regulator-always-on;
55	};
56
57	vdd_adc_vref: supply_3v3_ref {
58		compatible = "regulator-fixed";
59		regulator-name = "adc-vref";
60		regulator-min-microvolt = <3300000>;
61		regulator-max-microvolt = <3300000>;
62		regulator-always-on;
63	};
64
65	led-controller-1 {
66		compatible = "pwm-leds";
67		pinctrl-names = "default";
68		pinctrl-0 = <&pinctrl_pwm0_pwm_h0
69			     &pinctrl_pwm0_pwm_h1
70			     &pinctrl_pwm0_pwm_h2
71			     &pinctrl_pwm0_pwm_h3>;
72		status = "disabled";
73
74		led-1 {
75			label = "pwm:red:user";
76			pwms = <&pwm0 0 10000000 0>;
77			max-brightness = <255>;
78			linux,default-trigger = "default-on";
79			status = "disabled";
80		};
81
82		led-2 {
83			label = "pwm:green:user";
84			pwms = <&pwm0 1 10000000 0>;
85			max-brightness = <255>;
86			linux,default-trigger = "default-on";
87			status = "disabled";
88		};
89
90		led-3 {
91			label = "pwm:blue:user";
92			pwms = <&pwm0 2 10000000 0>;
93			max-brightness = <255>;
94			status = "disabled";
95		};
96
97		led-4 {
98			label = "pwm:white:user";
99			pwms = <&pwm0 3 10000000 0>;
100			max-brightness = <255>;
101			status = "disabled";
102		};
103	};
104};
105
106&ebi {
107	status = "okay";
108};
109
110&nand_controller {
111	status = "okay";
112
113	nand@3 {
114		pinctrl-0 = <&pinctrl_ebi_nand_addr>;
115		pinctrl-names = "default";
116		reg = <0x3 0x0 0x800000>;
117
118		atmel,rb = <0>;
119		nand-bus-width = <8>;
120		nand-ecc-mode = "hw";
121		nand-ecc-strength = <4>;
122		nand-ecc-step-size = <512>;
123		nand-on-flash-bbt;
124		label = "atmel_nand";
125
126		partitions {
127			compatible = "fixed-partitions";
128			#address-cells = <1>;
129			#size-cells = <1>;
130
131			bootstrap@0 {
132				label = "bootstrap";
133				reg = <0x0 0x20000>;
134			};
135
136			u-boot@20000 {
137				label = "u-boot";
138				reg = <0x20000 0x140000>;
139			};
140
141			u-boot-factory@160000 {
142				label = "u-boot-factory";
143				reg = <0x160000 0x140000>;
144			};
145
146			ubi@2A0000 {
147				label = "ubi";
148				reg = <0x2A0000 0x7D60000>;
149			};
150		};
151
152	};
153};
154
155&rtc {
156	status = "okay";
157};
158
159&pioA {
160	pinctrl_ebi_nand_addr: ebi-addr-1 {
161		pinmux = <PIN_PA0__D0>,
162			<PIN_PA1__D1>,
163			<PIN_PA2__D2>,
164			<PIN_PA3__D3>,
165			<PIN_PA4__D4>,
166			<PIN_PA5__D5>,
167			<PIN_PA6__D6>,
168			<PIN_PA7__D7>,
169			<PIN_PA8__NWE_NANDWE>,
170			<PIN_PA9__NCS3>,
171			<PIN_PA10__A21_NANDALE>,
172			<PIN_PA11__A22_NANDCLE>,
173			<PIN_PA21__NANDRDY>;
174		bias-disable;
175	};
176
177	pinctrl_usart {
178		pinctrl_usart_0: usart0-0 {
179			pinmux = < PIN_PB26__URXD0>, <PIN_PB27__UTXD0>;
180			bias-disable;
181		};
182		pinctrl_usart_1: usart1-0 {
183			pinmux = < PIN_PD2__URXD1>, <PIN_PD3__UTXD1>;
184			bias-disable;
185		};
186		pinctrl_usart_2: usart2-0 {
187			pinmux = < PIN_PD4__URXD2>, <PIN_PD5__UTXD2>;
188			bias-disable;
189		};
190		pinctrl_usart_3: usart3-0 {
191			pinmux = < PIN_PC12__URXD3>, <PIN_PC13__UTXD3>;
192			bias-disable;
193		};
194		pinctrl_usart_4: usart4-0 {
195			pinmux = < PIN_PB3__URXD4>, <PIN_PB4__UTXD4>;
196			bias-disable;
197		};
198		pinctrl_flx0_default: flx0_usart_default {
199			pinmux = <PIN_PB28__FLEXCOM0_IO0>, //TX
200			<PIN_PB29__FLEXCOM0_IO1>; //RX
201			bias-disable;
202		};
203		pinctrl_flx3_default: flx3_usart_default {
204			pinmux = <PIN_PB22__FLEXCOM3_IO1>, //RX
205			<PIN_PB23__FLEXCOM3_IO0>; //TX
206			bias-disable;
207		};
208	};
209
210	pinctrl_flx4_default: flx4_i2c6_default {
211		pinmux = <PIN_PD12__FLEXCOM4_IO0>, //DATA
212		<PIN_PD13__FLEXCOM4_IO1>; //CLK
213		bias-disable;
214		drive-open-drain = <1>;
215	};
216
217	pinctrl_pwm0 {
218		pinctrl_pwm0_pwm_h0: pwm0_pwm_h0 {
219			pinmux = <PIN_PA30__PWMH0>;
220			bias-disable;
221		};
222		pinctrl_pwm0_pwm_h1: pwm0_pwmh1 {
223			pinmux = <PIN_PB0__PWMH1>;
224			bias-disable;
225		};
226		pinctrl_pwm0_pwm_h2: pwm0_pwm_h2 {
227			pinmux = <PIN_PB5__PWMH2>;
228			bias-disable;
229		};
230		pinctrl_pwm0_pwm_h3: pwm0_pwm_h3 {
231			pinmux = <PIN_PB7__PWMH3>;
232			bias-disable;
233		};
234	};
235
236	pinctrl_adc {
237		pinctrl_adc2: adc2 {
238			pinmux = <PIN_PD21__GPIO>;
239			bias-disable;
240		};
241		pinctrl_adc3: adc3 {
242			pinmux = <PIN_PD22__GPIO>;
243			bias-disable;
244		};
245		pinctrl_adc4: adc4 {
246			pinmux = <PIN_PD23__GPIO>;
247			bias-disable;
248		};
249		pinctrl_adc5: adc5 {
250			pinmux = <PIN_PD24__GPIO>;
251			bias-disable;
252		};
253	};
254};
255
256&uart0 {
257	pinctrl-names = "default";
258	pinctrl-0 = <&pinctrl_usart_0>;
259	atmel,use-dma-rx;
260	atmel,use-dma-tx;
261	status = "disabled";
262};
263
264/* debug uart */
265&uart1 {
266	pinctrl-names = "default";
267	pinctrl-0 = <&pinctrl_usart_1>;
268	atmel,use-dma-rx;
269	atmel,use-dma-tx;
270	status = "disabled";
271};
272
273&uart2 {
274	pinctrl-names = "default";
275	pinctrl-0 = <&pinctrl_usart_2>;
276	atmel,use-dma-rx;
277	atmel,use-dma-tx;
278	status = "disabled";
279};
280
281&uart3 {
282	pinctrl-names = "default";
283	pinctrl-0 = <&pinctrl_usart_3>;
284	atmel,use-dma-rx;
285	atmel,use-dma-tx;
286	status = "disabled";
287};
288
289&uart4 {
290	pinctrl-names = "default";
291	pinctrl-0 = <&pinctrl_usart_4>;
292	atmel,use-dma-rx;
293	atmel,use-dma-tx;
294	status = "disabled";
295};
296
297&flx0 {
298	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
299	status = "disabled";
300
301	uart5: serial@200  {
302		pinctrl-names = "default";
303		pinctrl-0 = <&pinctrl_flx0_default>;
304		atmel,use-dma-rx;
305		atmel,use-dma-tx;
306		status = "disabled";
307	};
308};
309
310&flx3 {
311	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_USART>;
312	status = "disabled";
313
314	uart8: serial@200 {
315		pinctrl-names = "default";
316		pinctrl-0 = <&pinctrl_flx3_default>;
317		atmel,use-dma-rx;
318		atmel,use-dma-tx;
319		status = "disabled";
320	};
321};
322
323&flx4 {
324	atmel,flexcom-mode = <ATMEL_FLEXCOM_MODE_TWI>;
325	status = "disabled";
326
327	i2c6: i2c@600 {
328		pinctrl-names = "default";
329		pinctrl-0 = <&pinctrl_flx4_default>;
330		status = "disabled";
331	};
332};
333
334&pwm0 {
335	status = "okay";
336};
337
338&shutdown_controller {
339	atmel,shdwc-debouncer = <976>;
340	atmel,wakeup-rtc-timer;
341
342	input@0 {
343		reg = <0>;
344	};
345};
346
347&watchdog {
348	status = "okay";
349};
350
351&adc {
352	pinctrl-names = "default";
353	pinctrl-0 = <&pinctrl_adc2
354		     &pinctrl_adc3
355		     &pinctrl_adc4
356		     &pinctrl_adc5>;
357
358	vddana-supply = <&vdd_adc_vddana>;
359	vref-supply = <&vdd_adc_vref>;
360	status = "disabled";
361};
362
363&securam {
364	export;
365
366	/* export overkiz u-boot mode/version and factory */
367	uboot@1400 {
368		reg = <0x1400 0x20>;
369		export;
370	};
371};
372