1/*
2 * Copyright (c) 2021 Yonatan Schachter
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include <arm/armv6-m.dtsi>
8#include <zephyr/dt-bindings/adc/adc.h>
9#include <zephyr/dt-bindings/gpio/gpio.h>
10#include <zephyr/dt-bindings/i2c/i2c.h>
11#include <zephyr/dt-bindings/regulator/rpi_pico.h>
12#include <mem.h>
13
14#include "rpi_pico_common.dtsi"
15
16/ {
17	aliases {
18		die-temp0 = &die_temp;
19	};
20
21	cpus {
22		#address-cells = <1>;
23		#size-cells = <0>;
24
25		cpu0: cpu@0 {
26			compatible = "arm,cortex-m0+";
27			reg = <0>;
28		};
29
30		cpu1: cpu@1 {
31			compatible = "arm,cortex-m0+";
32			reg = <1>;
33		};
34	};
35
36	soc {
37		sram0: memory@20000000 {
38			compatible = "mmio-sram";
39			reg = <0x20000000 DT_SIZE_K(264)>;
40		};
41
42		ssi: flash-controller@18000000 {
43			compatible = "raspberrypi,pico-flash-controller";
44			reg = <0x18000000 0xfc>;
45
46			#address-cells = <1>;
47			#size-cells = <1>;
48
49			flash0: flash@10000000 {
50				compatible = "soc-nv-flash";
51				write-block-size = <1>;
52				erase-block-size = <DT_SIZE_K(4)>;
53			};
54		};
55
56		peripheral_clk: peripheral-clk {
57			compatible = "fixed-clock";
58			clock-frequency = <125000000>;
59			#clock-cells = <0>;
60		};
61
62		system_clk: system-clk {
63			compatible = "fixed-clock";
64			clock-frequency = <125000000>;
65			#clock-cells = <0>;
66		};
67
68		reset: reset-controller@4000c000 {
69			compatible = "raspberrypi,pico-reset";
70			reg = <0x4000c000 DT_SIZE_K(4)>;
71			reg-width = <4>;
72			active-low = <0>;
73			#reset-cells = <1>;
74		};
75
76		gpio0: gpio@40014000 {
77			compatible = "raspberrypi,pico-gpio";
78			reg = <0x40014000 DT_SIZE_K(4)>;
79			interrupts = <13 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
80			gpio-controller;
81			#gpio-cells = <2>;
82			status = "disabled";
83			ngpios = <30>;
84		};
85
86		uart0: uart@40034000 {
87			compatible = "raspberrypi,pico-uart";
88			reg = <0x40034000 DT_SIZE_K(4)>;
89			clocks = <&peripheral_clk>;
90			resets = <&reset RPI_PICO_RESETS_RESET_UART0>;
91			interrupts = <20 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
92			interrupt-names = "uart0";
93			status = "disabled";
94		};
95
96		uart1: uart@40038000 {
97			compatible = "raspberrypi,pico-uart";
98			reg = <0x40038000 DT_SIZE_K(4)>;
99			clocks = <&peripheral_clk>;
100			resets = <&reset RPI_PICO_RESETS_RESET_UART1>;
101			interrupts = <21 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
102			interrupt-names = "uart1";
103			status = "disabled";
104		};
105
106		spi0: spi@4003c000 {
107			compatible = "raspberrypi,pico-spi", "arm,pl022";
108			#address-cells = <1>;
109			#size-cells = <0>;
110			reg = <0x4003c000 DT_SIZE_K(4)>;
111			clocks = <&peripheral_clk>;
112			resets = <&reset RPI_PICO_RESETS_RESET_SPI0>;
113			interrupts = <18 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
114			interrupt-names = "spi0";
115			status = "disabled";
116		};
117
118		spi1: spi@40040000 {
119			compatible = "raspberrypi,pico-spi", "arm,pl022";
120			#address-cells = <1>;
121			#size-cells = <0>;
122			reg = <0x40040000 DT_SIZE_K(4)>;
123			resets = <&reset RPI_PICO_RESETS_RESET_SPI1>;
124			clocks = <&peripheral_clk>;
125			interrupts = <19 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
126			interrupt-names = "spi1";
127			status = "disabled";
128		};
129
130		adc: adc@4004c000 {
131			compatible = "raspberrypi,pico-adc";
132			reg = <0x4004c000 DT_SIZE_K(4)>;
133			resets = <&reset RPI_PICO_RESETS_RESET_ADC>;
134			interrupts = <22 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
135			interrupt-names = "adc0";
136			status = "disabled";
137			#io-channel-cells = <1>;
138		};
139
140		i2c0: i2c@40044000 {
141			compatible = "raspberrypi,pico-i2c", "snps,designware-i2c";
142			#address-cells = <1>;
143			#size-cells = <0>;
144			reg = <0x40044000 DT_SIZE_K(4)>;
145			resets = <&reset RPI_PICO_RESETS_RESET_I2C0>;
146			clocks = <&system_clk>;
147			interrupts = <23 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
148			interrupt-names = "i2c0";
149			status = "disabled";
150		};
151
152		i2c1: i2c@40048000 {
153			compatible = "raspberrypi,pico-i2c", "snps,designware-i2c";
154			#address-cells = <1>;
155			#size-cells = <0>;
156			reg = <0x40048000 DT_SIZE_K(4)>;
157			resets = <&reset RPI_PICO_RESETS_RESET_I2C0>;
158			clocks = <&system_clk>;
159			interrupts = <24 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
160			interrupt-names = "i2c1";
161			status = "disabled";
162		};
163
164		wdt0: watchdog@40058000 {
165			compatible = "raspberrypi,pico-watchdog";
166			reg = <0x40058000 DT_SIZE_K(4)>;
167			clocks = <&xtal_clk>;
168			status = "disabled";
169		};
170
171		usbd: usbd@50100000 {
172			compatible = "raspberrypi,pico-usbd";
173			reg = <0x50100000 0x10000>;
174			resets = <&reset RPI_PICO_RESETS_RESET_USBCTRL>;
175			interrupts = <5 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
176			interrupt-names = "usbctrl";
177			num-bidir-endpoints = <16>;
178			status = "disabled";
179		};
180
181		pwm: pwm@40050000 {
182			compatible = "raspberrypi,pico-pwm";
183			reg = <0x40050000 DT_SIZE_K(4)>;
184			resets = <&reset RPI_PICO_RESETS_RESET_PWM>;
185			clocks = <&system_clk>;
186			interrupts = <4 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
187			interrupt-names = "PWM_IRQ_WRAP";
188			status = "disabled";
189			#pwm-cells = <3>;
190		};
191
192		timer: timer@40054000 {
193			compatible = "raspberrypi,pico-timer";
194			reg = <0x40054000 DT_SIZE_K(4)>;
195			resets = <&reset RPI_PICO_RESETS_RESET_TIMER>;
196			clocks = <&xtal_clk>;
197			interrupts = <0 RPI_PICO_DEFAULT_IRQ_PRIORITY>,
198				     <1 RPI_PICO_DEFAULT_IRQ_PRIORITY>,
199				     <2 RPI_PICO_DEFAULT_IRQ_PRIORITY>,
200				     <3 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
201			interrupt-names = "TIMER_IRQ_0",
202					  "TIMER_IRQ_1",
203					  "TIMER_IRQ_2",
204					  "TIMER_IRQ_3";
205			status = "disabled";
206		};
207
208		dma: dma@50000000 {
209			compatible = "raspberrypi,pico-dma";
210			reg = <0x50000000 DT_SIZE_K(64)>;
211			resets = <&reset RPI_PICO_RESETS_RESET_DMA>;
212			clocks = <&system_clk>;
213			interrupts = <11 RPI_PICO_DEFAULT_IRQ_PRIORITY>,
214				     <12 RPI_PICO_DEFAULT_IRQ_PRIORITY>;
215			interrupt-names = "dma0", "dma1";
216			dma-channels = <12>;
217			status = "disabled";
218			#dma-cells = <3>;
219		};
220
221		vreg: vreg@40064000 {
222			compatible = "raspberrypi,core-supply-regulator";
223			reg = <0x40064000 1>;
224			status = "okay";
225			raspberrypi,brown-out-detection;
226			raspberrypi,brown-out-threshold = <860000>;
227		};
228
229		pio0: pio@50200000 {
230			compatible = "raspberrypi,pico-pio";
231			reg = <0x50200000 DT_SIZE_K(4)>;
232			clocks = <&system_clk>;
233			resets = <&reset RPI_PICO_RESETS_RESET_PIO0>;
234			status = "disabled";
235		};
236
237		pio1: pio@50300000 {
238			compatible = "raspberrypi,pico-pio";
239			reg = <0x50300000 DT_SIZE_K(4)>;
240			clocks = <&system_clk>;
241			resets = <&reset RPI_PICO_RESETS_RESET_PIO1>;
242			status = "disabled";
243		};
244	};
245
246	pinctrl: pin-controller {
247		compatible = "raspberrypi,pico-pinctrl";
248	};
249
250	die_temp: dietemp {
251		compatible = "raspberrypi,pico-temp";
252		io-channels = <&adc 4>;
253		status = "disabled";
254	};
255};
256
257&nvic {
258	arm,num-irq-priority-bits = <3>;
259};
260