1/*
2 * Copyright (c) 2021 Yonatan Schachter
3 * Copyright (c) 2022 Peter Johanson
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8/dts-v1/;
9
10#include <raspberrypi/rpi_pico/rp2040.dtsi>
11#include "adafruit_qt_py_rp2040-pinctrl.dtsi"
12#include "seeed_xiao_connector.dtsi"
13#include <freq.h>
14#include <zephyr/dt-bindings/led/led.h>
15
16/ {
17	chosen {
18		zephyr,sram = &sram0;
19		zephyr,flash = &flash0;
20		zephyr,flash-controller = &ssi;
21		zephyr,console = &uart1;
22		zephyr,shell-uart = &uart1;
23		zephyr,code-partition = &code_partition;
24	};
25
26	aliases {
27		watchdog0 = &wdt0;
28		led-strip = &ws2812;
29	};
30};
31
32&flash0 {
33	reg = <0x10000000 DT_SIZE_M(8)>;
34
35	partitions {
36		compatible = "fixed-partitions";
37		#address-cells = <1>;
38		#size-cells = <1>;
39
40		/* Reserved memory for the second stage bootloader */
41		second_stage_bootloader: partition@0 {
42			label = "second_stage_bootloader";
43			reg = <0x00000000 0x100>;
44			read-only;
45		};
46
47		/*
48		 * Usable flash. Starts at 0x100, after the bootloader. The partition
49		 * size is 8MB minus the 0x100 bytes taken by the bootloader.
50		 */
51		code_partition: partition@100 {
52			label = "code-partition";
53			reg = <0x100 (DT_SIZE_M(8) - 0x100)>;
54			read-only;
55		};
56	};
57};
58
59&uart1 {
60	current-speed = <115200>;
61	status = "okay";
62	pinctrl-0 = <&uart1_default>;
63	pinctrl-names = "default";
64};
65
66&gpio0 {
67	status = "okay";
68
69	/*
70	 * Unlike some of the other Adafruit boards, the neopixel on this board has
71	 * its positive side hooked up to a GPIO pin rather than a positive voltage
72	 * rail to save on power. This will enable the LED on board initialization.
73	 */
74	neopixel-power-enable {
75		gpio-hog;
76		gpios = <11 GPIO_ACTIVE_HIGH>;
77		output-high;
78	};
79};
80
81&i2c0 {
82	clock-frequency = <I2C_BITRATE_FAST>;
83	status = "okay";
84	pinctrl-0 = <&i2c0_default>;
85	pinctrl-names = "default";
86};
87
88&i2c1 {
89	pinctrl-0 = <&i2c1_default>;
90	pinctrl-names = "default";
91	status = "okay";
92	clock-frequency = <I2C_BITRATE_FAST>;
93};
94
95&spi0 {
96	clock-frequency = <DT_FREQ_M(8)>;
97	status = "okay";
98	pinctrl-0 = <&spi0_default>;
99	pinctrl-names = "default";
100};
101
102&timer {
103	status = "okay";
104};
105
106&wdt0 {
107	status = "okay";
108};
109
110&adc {
111	status = "okay";
112	pinctrl-0 = <&adc_default>;
113	pinctrl-names = "default";
114};
115
116&pio0 {
117	status = "okay";
118};
119
120&pio1 {
121	status = "okay";
122
123	/*
124	 * Need to put this on PIO1 as having this on PIO0 causes the GPIO hog to
125	 * not work.
126	 */
127	pio-ws2812 {
128		compatible = "worldsemi,ws2812-rpi_pico-pio";
129		status = "okay";
130		pinctrl-0 = <&ws2812_pio1_default>;
131		pinctrl-names = "default";
132		bit-waveform = <3>, <3>, <4>;
133
134		ws2812: ws2812 {
135			status = "okay";
136			gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
137			chain-length = <1>;
138			color-mapping = <LED_COLOR_ID_GREEN
139					 LED_COLOR_ID_RED
140					 LED_COLOR_ID_BLUE>;
141			reset-delay = <280>;
142			frequency = <800000>;
143		};
144	};
145};
146
147zephyr_udc0: &usbd {
148	status = "okay";
149};
150
151&vreg {
152	regulator-always-on;
153	regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>;
154};
155
156&xosc {
157	startup-delay-multiplier = <64>;
158};
159