1/*
2 * Copyright (c) 2018 Bryan O'Donoghue
3 * Copyright (c) 2024 Gerson Fernando Budke <nandojve@gmail.com>
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9#include <freq.h>
10#include <atmel/samd21.dtsi>
11#include <atmel/samx2xx18.dtsi>
12#include "samd21_xpro-pinctrl.dtsi"
13#include <zephyr/dt-bindings/input/input-event-codes.h>
14
15/ {
16	model = "SAM D21 Xplained Pro";
17	compatible = "samd21,xpro", "atmel,samd21j18a", "atmel,samd21";
18
19	chosen {
20		zephyr,console = &sercom3;
21		zephyr,shell-uart = &sercom3;
22		zephyr,sram = &sram0;
23		zephyr,flash = &flash0;
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 = &sercom2;
32	};
33
34	leds {
35		compatible = "gpio-leds";
36		led0: led_0 {
37			gpios = <&portb 30 GPIO_ACTIVE_LOW>;
38			label = "Yellow LED";
39		};
40	};
41
42	pwmleds {
43		compatible = "pwm-leds";
44		pwm_led0: pwm_led_0 {
45			pwms = <&tcc0 0 PWM_MSEC(20)>;
46		};
47	};
48
49	buttons {
50		compatible = "gpio-keys";
51		user_button: button_0 {
52			gpios = <&porta 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
53			label = "SW0";
54			zephyr,code = <INPUT_KEY_0>;
55		};
56	};
57};
58
59&cpu0 {
60	clock-frequency = <DT_FREQ_M(48)>;
61};
62
63&tcc0 {
64	status = "okay";
65	compatible = "atmel,sam0-tcc-pwm";
66	/* Gives a maximum period of 1.4s */
67	prescaler = <4>;
68	#pwm-cells = <2>;
69
70	pinctrl-0 = <&pwm_default>;
71	pinctrl-names = "default";
72};
73
74&sercom0 {
75	status = "okay";
76	compatible = "atmel,sam0-uart";
77	current-speed = <9600>;
78	rxpo = <3>;
79	txpo = <1>;
80
81	pinctrl-0 = <&sercom0_uart_default>;
82	pinctrl-names = "default";
83};
84
85&sercom1 {
86	status = "okay";
87	compatible = "atmel,sam0-uart";
88	current-speed = <115200>;
89	rxpo = <3>;
90	txpo = <0>;
91
92	pinctrl-0 = <&sercom1_uart_default>;
93	pinctrl-names = "default";
94};
95
96&sercom2 {
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 = <&sercom2_i2c_default>;
104	pinctrl-names = "default";
105};
106
107&sercom3 {
108	status = "okay";
109	compatible = "atmel,sam0-uart";
110	current-speed = <115200>;
111	rxpo = <1>;
112	txpo = <0>;
113
114	pinctrl-0 = <&sercom3_uart_default>;
115	pinctrl-names = "default";
116};
117
118&sercom5 {
119	status = "okay";
120	compatible = "atmel,sam0-spi";
121	dipo = <0>;
122	dopo = <2>;
123	#address-cells = <1>;
124	#size-cells = <0>;
125
126	pinctrl-0 = <&sercom5_spi_default>;
127	pinctrl-names = "default";
128};
129
130zephyr_udc0: &usb0 {
131	status = "okay";
132
133	pinctrl-0 = <&usb_dc_default>;
134	pinctrl-names = "default";
135};
136