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_kb2040-pinctrl.dtsi"
12#include "sparkfun_pro_micro_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 = &uart0;
22		zephyr,shell-uart = &uart0;
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";
53			reg = <0x100 (DT_SIZE_M(8) - 0x100)>;
54			read-only;
55		};
56	};
57};
58
59&uart0 {
60	current-speed = <115200>;
61	status = "okay";
62	pinctrl-0 = <&uart0_default>;
63	pinctrl-names = "default";
64};
65
66&spi0 {
67	status = "okay";
68	pinctrl-0 = <&spi0_default>;
69	pinctrl-names = "default";
70	clock-frequency = <DT_FREQ_M(8)>;
71};
72
73&i2c1 {
74	status = "okay";
75	pinctrl-0 = <&i2c1_default>;
76	pinctrl-names = "default";
77	clock-frequency = <I2C_BITRATE_FAST>;
78};
79
80&gpio0 {
81	status = "okay";
82};
83
84&wdt0 {
85	status = "okay";
86};
87
88&adc {
89	status = "okay";
90	pinctrl-0 = <&adc_default>;
91	pinctrl-names = "default";
92};
93
94&pio0 {
95	status = "okay";
96
97	pio-ws2812 {
98		compatible = "worldsemi,ws2812-rpi_pico-pio";
99		status = "okay";
100		pinctrl-0 = <&ws2812_pio0_default>;
101		pinctrl-names = "default";
102		bit-waveform = <3>, <3>, <4>;
103
104		ws2812: ws2812 {
105			status = "okay";
106			gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
107			chain-length = <1>;
108			color-mapping = <LED_COLOR_ID_GREEN
109					 LED_COLOR_ID_RED
110					 LED_COLOR_ID_BLUE>;
111			reset-delay = <280>;
112			frequency = <800000>;
113		};
114	};
115};
116
117zephyr_udc0: &usbd {
118	status = "okay";
119};
120
121&vreg {
122	regulator-always-on;
123	regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>;
124};
125
126&xosc {
127	startup-delay-multiplier = <64>;
128};
129