1/*
2 * Copyright (c) 2018 Google LLC.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8#include <atmel/samd21.dtsi>
9#include <atmel/samx2xx18.dtsi>
10#include "adafruit_trinket_m0-pinctrl.dtsi"
11#include <zephyr/dt-bindings/led/led.h>
12
13/ {
14	model = "Adafruit Trinket M0";
15	compatible = "adafruit,trinket-m0", "atmel,samd21e18a", "atmel,samd21";
16
17	chosen {
18		zephyr,console = &sercom0;
19		zephyr,shell-uart = &sercom0;
20		zephyr,sram = &sram0;
21		zephyr,flash = &flash0;
22		zephyr,code-partition = &code_partition;
23	};
24
25	/* These aliases are provided for compatibility with samples */
26	aliases {
27		led0 = &led0;
28		pwm-led0 = &pwm_led0;
29		led-strip = &led1;
30	};
31
32	leds {
33		compatible = "gpio-leds";
34		led0: led_0 {
35			gpios = <&porta 10 0>;
36			label = "LED";
37		};
38	};
39
40	pwmleds {
41		compatible = "pwm-leds";
42
43		pwm_led0: pwm_led_0 {
44			pwms = <&tcc0 2 PWM_MSEC(20)>;
45		};
46	};
47};
48
49&cpu0 {
50	clock-frequency = <48000000>;
51};
52
53&sercom0 {
54	status = "okay";
55	compatible = "atmel,sam0-uart";
56	current-speed = <115200>;
57	rxpo = <3>;
58	txpo = <1>;
59
60	pinctrl-0 = <&sercom0_uart_default>;
61	pinctrl-names = "default";
62};
63
64&sercom2 {
65	status = "okay";
66	compatible = "atmel,sam0-uart";
67	current-speed = <115200>;
68	rxpo = <1>;
69	txpo = <0>;
70
71	pinctrl-0 = <&sercom2_uart_default>;
72	pinctrl-names = "default";
73};
74
75/* Drives the on-board DotStar LED */
76&sercom1 {
77	status = "okay";
78	compatible = "atmel,sam0-spi";
79	dipo = <2>;
80	dopo = <0>;
81	#address-cells = <1>;
82	#size-cells = <0>;
83
84	pinctrl-0 = <&sercom1_spi_default>;
85	pinctrl-names = "default";
86
87	led1: apa102@0 {
88		compatible = "apa,apa102";
89		reg = <0>;
90		spi-max-frequency = <24000000>;
91		chain-length = <1>;
92		color-mapping = <LED_COLOR_ID_BLUE
93				 LED_COLOR_ID_GREEN
94				 LED_COLOR_ID_RED>;
95	};
96};
97
98&tcc0 {
99	status = "okay";
100	compatible = "atmel,sam0-tcc-pwm";
101	/* Gives a maximum period of 1.4 s */
102	prescaler = <4>;
103	#pwm-cells = <2>;
104
105	pinctrl-0 = <&pwm_default>;
106	pinctrl-names = "default";
107};
108
109&flash0 {
110	partitions {
111		compatible = "fixed-partitions";
112		#address-cells = <1>;
113		#size-cells = <1>;
114
115		boot_partition: partition@0 {
116			label = "uf2";
117			reg = <0x00000000 0x2000>;
118			read-only;
119		};
120
121		code_partition: partition@2000 {
122			label = "code";
123			reg = <0x2000 0x3A000>;
124			read-only;
125		};
126
127		/*
128		 * The final 16 KiB is reserved for the application.
129		 * Storage partition will be used by FCB/LittleFS/NVS
130		 * if enabled.
131		 */
132		storage_partition: partition@3c000 {
133			label = "storage";
134			reg = <0x0003c000 0x00004000>;
135		};
136	};
137};
138
139zephyr_udc0: &usb0 {
140	status = "okay";
141
142	pinctrl-0 = <&usb_dc_default>;
143	pinctrl-names = "default";
144};
145