1/*
2 * Copyright (c) 2025 Pete Johanson
3 * Copyright (c) 2025 Silicon Laboratories Inc.
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9#include <silabs/xg24/mgm240sd22vna.dtsi>
10#include <zephyr/dt-bindings/input/input-event-codes.h>
11#include <zephyr/dt-bindings/pwm/pwm.h>
12#include "arduino_nano_matter-pinctrl.dtsi"
13#include "arduino_nano_matter_connector.dtsi"
14
15/ {
16	model = "Arduino Nano Matter";
17	compatible = "arduino,arduino_nano_matter", "silabs,mgm240sd22vna";
18
19	chosen {
20		zephyr,bt-hci = &bt_hci_silabs;
21		zephyr,code-partition = &slot0_partition;
22		zephyr,console = &usart0;
23		zephyr,flash = &flash0;
24		zephyr,shell-uart = &usart0;
25		zephyr,sram = &sram0;
26		zephyr,uart-pipe = &usart0;
27	};
28
29	/* These aliases are provided for compatibility with samples */
30	aliases {
31		led0 = &led0;
32		led1 = &led1;
33		led2 = &led2;
34		pwm-led0 = &red_pwm_led;
35		pwm-led1 = &green_pwm_led;
36		pwm-led2 = &blue_pwm_led;
37		sw0 = &button0;
38		watchdog0 = &wdog0;
39	};
40
41	leds {
42		compatible = "gpio-leds";
43
44		led0: led_0 {
45			gpios = <&gpioc 1 GPIO_ACTIVE_LOW>;
46			label = "LED 0";
47		};
48
49		led1: led_1 {
50			gpios = <&gpioc 2 GPIO_ACTIVE_LOW>;
51			label = "LED 1";
52		};
53
54		led2: led_2 {
55			gpios = <&gpioc 3 GPIO_ACTIVE_LOW>;
56			label = "LED 2";
57		};
58	};
59
60	pwmleds {
61		compatible = "pwm-leds";
62
63		red_pwm_led: pwm_led_0 {
64			pwms = <&timer0_pwm 0 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
65			label = "red";
66		};
67
68		green_pwm_led: pwm_led_1 {
69			pwms = <&timer0_pwm 1 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
70			label = "green";
71		};
72
73		blue_pwm_led: pwm_led_2 {
74			pwms = <&timer0_pwm 2 PWM_MSEC(20) PWM_POLARITY_INVERTED>;
75			label = "blue";
76		};
77	};
78
79	buttons {
80		compatible = "gpio-keys";
81
82		button0: button_0 {
83			gpios = <&gpioa 0 GPIO_ACTIVE_LOW>;
84			zephyr,code = <INPUT_KEY_0>;
85		};
86	};
87};
88
89&timer0 {
90	status = "okay";
91
92	timer0_pwm: pwm {
93		pinctrl-0 = <&timer0_default>;
94		pinctrl-names = "default";
95		status = "okay";
96	};
97};
98
99&cpu0 {
100	clock-frequency = <78000000>;
101};
102
103&hfxo {
104	ctune = <95>;
105	precision = <50>;
106	status = "okay";
107};
108
109&lfxo {
110	ctune = <44>;
111	precision = <50>;
112	status = "okay";
113};
114
115&hfrcodpll {
116	clock-frequency = <DT_FREQ_M(78)>;
117	clocks = <&hfxo>;
118	dpll-autorecover;
119	dpll-edge = "fall";
120	dpll-lock = "phase";
121	dpll-m = <1919>;
122	dpll-n = <3839>;
123};
124
125&em23grpaclk {
126	clocks = <&lfxo>;
127};
128
129&em4grpaclk {
130	clocks = <&lfxo>;
131};
132
133&sysrtcclk {
134	clocks = <&lfxo>;
135};
136
137&wdog0clk {
138	clocks = <&lfxo>;
139};
140
141&wdog1clk {
142	clocks = <&lfxo>;
143};
144
145&usart0 {
146	current-speed = <115200>;
147	pinctrl-0 = <&usart0_default>;
148	pinctrl-names = "default";
149	status = "okay";
150};
151
152&eusart0 {
153	compatible = "silabs,eusart-uart";
154	current-speed = <115200>;
155	pinctrl-0 = <&eusart0_default>;
156	pinctrl-names = "default";
157};
158
159&eusart1 {
160	compatible = "silabs,eusart-spi";
161	#address-cells = <1>;
162	#size-cells = <0>;
163	clock-frequency = <4000000>;
164	cs-gpios = <&gpioc 7 GPIO_ACTIVE_LOW>;
165	pinctrl-0 = <&eusart1_default>;
166	pinctrl-names = "default";
167};
168
169&i2c0 {
170	pinctrl-0 = <&i2c0_default>;
171	pinctrl-names = "default";
172};
173
174&gpio {
175	status = "okay";
176};
177
178&gpioa {
179	status = "okay";
180};
181
182&gpiob {
183	status = "okay";
184};
185
186&gpioc {
187	status = "okay";
188};
189
190&gpiod {
191	status = "okay";
192};
193
194&wdog0 {
195	status = "okay";
196};
197
198&sysrtc0 {
199	status = "okay";
200};
201
202&se {
203	status = "okay";
204};
205
206&flash0 {
207	partitions {
208		compatible = "fixed-partitions";
209		#address-cells = <1>;
210		#size-cells = <1>;
211
212		/* Reserve 48 kB for the bootloader */
213		boot_partition: partition@0 {
214			reg = <0x0 DT_SIZE_K(48)>;
215			label = "mcuboot";
216			read-only;
217		};
218
219		/* Reserve 736 kB for the application in slot 0 */
220		slot0_partition: partition@c000 {
221			reg = <0x0000c000 0x000B8000>;
222			label = "image-0";
223		};
224
225		/* Reserve 736 kB for the application in slot 1 */
226		slot1_partition: partition@C4000 {
227			reg = <0x000C4000 0x000B8000>;
228			label = "image-1";
229		};
230
231		/* Set 16 kB of storage at the end of the 1536 kB of flash */
232		storage_partition: partition@17c000 {
233			reg = <0x0017c000 DT_SIZE_K(16)>;
234			label = "storage";
235		};
236	};
237};
238
239&bt_hci_silabs {
240	status = "okay";
241};
242