1/*
2 * Copyright (c) 2024 Iacopo Moles
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7/dts-v1/;
8
9#include <raspberrypi/rpi_pico/rp2040.dtsi>
10#include "rp2040_zero-pinctrl.dtsi"
11#include <freq.h>
12#include <zephyr/dt-bindings/led/led.h>
13/ {
14	chosen {
15		zephyr,sram = &sram0;
16		zephyr,flash = &flash0;
17		zephyr,flash-controller = &ssi;
18		zephyr,console = &uart0;
19		zephyr,shell-uart = &uart0;
20		zephyr,code-partition = &code_partition;
21	};
22
23	aliases {
24		rtc = &rtc;
25		watchdog0 = &wdt0;
26		led-strip = &ws2812;
27	};
28};
29
30&flash0 {
31	reg = <0x10000000 DT_SIZE_M(16)>;
32
33	partitions {
34		compatible = "fixed-partitions";
35		#address-cells = <1>;
36		#size-cells = <1>;
37
38		/* Reserved memory for the second stage bootloader */
39		second_stage_bootloader: partition@0 {
40			label = "second_stage_bootloader";
41			reg = <0x00000000 0x100>;
42			read-only;
43		};
44
45		/*
46		 * Usable flash. Starts at 0x100, after the bootloader. The partition
47		 * size is 16MB minus the 0x100 bytes taken by the bootloader.
48		 */
49		code_partition: partition@100 {
50			label = "code-partition";
51			reg = <0x100 (DT_SIZE_M(16) - 0x100)>;
52			read-only;
53		};
54	};
55};
56
57&uart0 {
58	status = "okay";
59	current-speed = <115200>;
60	pinctrl-0 = <&uart0_default>;
61	pinctrl-names = "default";
62};
63
64&i2c0 {
65	status = "okay";
66	pinctrl-0 = <&i2c0_default>;
67	pinctrl-names = "default";
68	clock-frequency = <I2C_BITRATE_STANDARD>;
69};
70
71&i2c1 {
72	status = "okay";
73	pinctrl-0 = <&i2c1_default>;
74	pinctrl-names = "default";
75	clock-frequency = <I2C_BITRATE_FAST>;
76};
77
78&spi0 {
79	clock-frequency = <DT_FREQ_M(8)>;
80	status = "okay";
81	pinctrl-0 = <&spi0_default>;
82	pinctrl-names = "default";
83};
84
85&timer {
86	status = "okay";
87};
88
89&wdt0 {
90	status = "okay";
91};
92
93&gpio0 {
94	status = "okay";
95};
96
97&rtc {
98	clocks = <&clocks RPI_PICO_CLKID_CLK_RTC>;
99	status = "okay";
100};
101
102&adc {
103	status = "okay";
104	pinctrl-0 = <&adc_default>;
105	pinctrl-names = "default";
106};
107
108&pio0 {
109	status = "okay";
110
111	pio-ws2812 {
112		compatible = "worldsemi,ws2812-rpi_pico-pio";
113		status = "okay";
114		pinctrl-0 = <&ws2812_pio0_default>;
115		pinctrl-names = "default";
116		bit-waveform = <3>, <3>, <4>;
117
118		ws2812: ws2812 {
119			status = "okay";
120			gpios = <&gpio0 16 GPIO_ACTIVE_HIGH>;
121			chain-length = <1>;
122			color-mapping = <LED_COLOR_ID_GREEN
123					 LED_COLOR_ID_RED
124					 LED_COLOR_ID_BLUE>;
125			reset-delay = <280>;
126			frequency = <800000>;
127		};
128	};
129};
130
131&pio1 {
132	status = "okay";
133};
134
135zephyr_udc0: &usbd {
136	status = "okay";
137};
138
139&vreg {
140	regulator-always-on;
141	regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>;
142};
143
144pico_spi: &spi0 {};
145pico_i2c0: &i2c0 {};
146pico_i2c1: &i2c1 {};
147pico_serial: &uart0 {};
148