1/*
2 * Copyright (c) 2022 Kamil Serwus
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <atmel/samc21.dtsi>
10#include <atmel/samx2xx18.dtsi>
11#include "samc21n_xpro-pinctrl.dtsi"
12#include <zephyr/dt-bindings/input/input-event-codes.h>
13
14/ {
15	model = "SAM C21N Xplained Pro";
16	compatible = "samc21n,xpro", "atmel,samc21n18a", "atmel,samc21";
17
18	chosen {
19		zephyr,console = &sercom4;
20		zephyr,shell-uart = &sercom4;
21		zephyr,sram = &sram0;
22		zephyr,flash = &flash0;
23		zephyr,canbus = &can0;
24	};
25
26	/* These aliases are provided for compatibility with samples */
27	aliases {
28		led0 = &led0;
29		pwm-led0 = &pwm_led0;
30		sw0 = &user_button;
31		i2c-0 = &sercom1;
32	};
33
34	leds {
35		compatible = "gpio-leds";
36		led0: led_0 {
37			gpios = <&portc 05 GPIO_ACTIVE_LOW>;
38			label = "Yellow LED";
39		};
40	};
41
42	pwmleds {
43		compatible = "pwm-leds";
44		pwm_led0: pwm_led_0 {
45			pwms = <&tcc2 1 PWM_MSEC(20)>;
46		};
47	};
48
49	buttons {
50		compatible = "gpio-keys";
51		user_button: button_0 {
52			gpios = <&portb 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
53			label = "User Button";
54			zephyr,code = <INPUT_KEY_0>;
55		};
56	};
57
58};
59
60&cpu0 {
61	clock-frequency = <48000000>;
62};
63
64&adc0 {
65	status = "okay";
66	pinctrl-0 = <&adc0_default>;
67	pinctrl-names = "default";
68};
69
70&adc1 {
71	pinctrl-0 = <&adc1_default>;
72	pinctrl-names = "default";
73};
74
75&tcc2 {
76	status = "okay";
77	compatible = "atmel,sam0-tcc-pwm";
78	prescaler = <256>;
79	#pwm-cells = <2>;
80
81	pinctrl-0 = <&pwm_default>;
82	pinctrl-names = "default";
83};
84
85&sercom0 {
86	status = "okay";
87	compatible = "atmel,sam0-uart";
88	current-speed = <9600>;
89	rxpo = <1>;
90	txpo = <0>;
91
92	pinctrl-0 = <&sercom0_uart_default>;
93	pinctrl-names = "default";
94};
95
96&sercom1 {
97	status = "okay";
98	compatible = "atmel,sam0-i2c";
99	clock-frequency = <I2C_BITRATE_FAST>;
100	#address-cells = <1>;
101	#size-cells = <0>;
102
103	pinctrl-0 = <&sercom1_i2c_default>;
104	pinctrl-names = "default";
105};
106
107&sercom2 {
108	status = "okay";
109	compatible = "atmel,sam0-uart";
110	current-speed = <115200>;
111	rxpo = <1>;
112	txpo = <0>;
113
114	pinctrl-0 = <&sercom2_uart_default>;
115	pinctrl-names = "default";
116};
117
118&sercom4 {
119	status = "okay";
120	compatible = "atmel,sam0-uart";
121	current-speed = <115200>;
122	rxpo = <3>;
123	txpo = <1>;
124
125	pinctrl-0 = <&sercom4_uart_default>;
126	pinctrl-names = "default";
127};
128
129&sercom5 {
130	status = "okay";
131	compatible = "atmel,sam0-spi";
132	dipo = <0>;
133	dopo = <2>;
134	#address-cells = <1>;
135	#size-cells = <0>;
136
137	pinctrl-0 = <&sercom5_spi_default>;
138	pinctrl-names = "default";
139};
140
141&flash0 {
142	partitions {
143		compatible = "fixed-partitions";
144		#address-cells = <1>;
145		#size-cells = <1>;
146
147		/*
148		 * The final 16 KiB is reserved for the application.
149		 * Storage partition will be used by FCB/LittleFS/NVS
150		 * if enabled.
151		 */
152		storage_partition: partition@3c000 {
153			label = "storage";
154			reg = <0x0003c000 0x00004000>;
155		};
156	};
157};
158
159&can0 {
160	status = "okay";
161
162	pinctrl-0 = <&can0_default>;
163	pinctrl-names = "default";
164
165	can-transceiver {
166		max-bitrate = <5000000>;
167	};
168};
169
170&can1 {
171	pinctrl-0 = <&can1_default>;
172	pinctrl-names = "default";
173
174	can-transceiver {
175		max-bitrate = <5000000>;
176	};
177};
178