1/* 2 * Copyright (c) 2021 Yonatan Schachter 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7#include <freq.h> 8 9#include <raspberrypi/rpi_pico/rp2040.dtsi> 10#include "rpi_pico-pinctrl.dtsi" 11#include <zephyr/dt-bindings/pwm/pwm.h> 12 13#include <zephyr/dt-bindings/i2c/i2c.h> 14 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 rtc = &rtc; 28 watchdog0 = &wdt0; 29 }; 30 31 pico_header: connector { 32 compatible = "raspberrypi,pico-header"; 33 #gpio-cells = <2>; 34 gpio-map-mask = <0xffffffff 0xffffffc0>; 35 gpio-map-pass-thru = <0 0x3f>; 36 gpio-map = <0 0 &gpio0 0 0>, /* GP0 */ 37 <1 0 &gpio0 1 0>, /* GP1 */ 38 <2 0 &gpio0 2 0>, /* GP2 */ 39 <3 0 &gpio0 3 0>, /* GP3 */ 40 <4 0 &gpio0 4 0>, /* GP4 */ 41 <5 0 &gpio0 5 0>, /* GP5 */ 42 <6 0 &gpio0 6 0>, /* GP6 */ 43 <7 0 &gpio0 7 0>, /* GP7 */ 44 <8 0 &gpio0 8 0>, /* GP8 */ 45 <9 0 &gpio0 9 0>, /* GP9 */ 46 <10 0 &gpio0 10 0>, /* GP10 */ 47 <11 0 &gpio0 11 0>, /* GP11 */ 48 <12 0 &gpio0 12 0>, /* GP12 */ 49 <13 0 &gpio0 13 0>, /* GP13 */ 50 <14 0 &gpio0 14 0>, /* GP14 */ 51 <15 0 &gpio0 15 0>, /* GP15 */ 52 <16 0 &gpio0 16 0>, /* GP16 */ 53 <17 0 &gpio0 17 0>, /* GP17 */ 54 <18 0 &gpio0 18 0>, /* GP18 */ 55 <19 0 &gpio0 19 0>, /* GP19 */ 56 <20 0 &gpio0 20 0>, /* GP20 */ 57 <21 0 &gpio0 21 0>, /* GP21 */ 58 <22 0 &gpio0 22 0>, /* GP22 */ 59 <26 0 &gpio0 26 0>, /* GP26 */ 60 <27 0 &gpio0 27 0>, /* GP27 */ 61 <28 0 &gpio0 28 0>; /* GP28 */ 62 }; 63}; 64 65&flash0 { 66 reg = <0x10000000 DT_SIZE_M(2)>; 67 68 partitions { 69 compatible = "fixed-partitions"; 70 #address-cells = <1>; 71 #size-cells = <1>; 72 73 /* Reserved memory for the second stage bootloader */ 74 second_stage_bootloader: partition@0 { 75 label = "second_stage_bootloader"; 76 reg = <0x00000000 0x100>; 77 read-only; 78 }; 79 80 /* 81 * Usable flash. Starts at 0x100, after the bootloader. The partition 82 * size is 2MB minus the 0x100 bytes taken by the bootloader. 83 */ 84 code_partition: partition@100 { 85 label = "code-partition"; 86 reg = <0x100 (DT_SIZE_M(2) - 0x100)>; 87 read-only; 88 }; 89 }; 90}; 91 92&uart0 { 93 current-speed = <115200>; 94 status = "okay"; 95 pinctrl-0 = <&uart0_default>; 96 pinctrl-names = "default"; 97}; 98 99&gpio0 { 100 status = "okay"; 101}; 102 103&i2c0 { 104 clock-frequency = <I2C_BITRATE_STANDARD>; 105 status = "okay"; 106 pinctrl-0 = <&i2c0_default>; 107 pinctrl-names = "default"; 108}; 109 110&i2c1 { 111 pinctrl-0 = <&i2c1_default>; 112 pinctrl-names = "default"; 113 status = "disabled"; 114 clock-frequency = <I2C_BITRATE_FAST>; 115}; 116 117&spi0 { 118 clock-frequency = <DT_FREQ_M(8)>; 119 status = "okay"; 120 pinctrl-0 = <&spi0_default>; 121 pinctrl-names = "default"; 122}; 123 124&timer { 125 status = "okay"; 126}; 127 128&wdt0 { 129 status = "okay"; 130}; 131 132&rtc { 133 clocks = <&clocks RPI_PICO_CLKID_CLK_RTC>; 134 status = "okay"; 135}; 136 137&adc { 138 status = "okay"; 139 pinctrl-0 = <&adc_default>; 140 pinctrl-names = "default"; 141}; 142 143zephyr_udc0: &usbd { 144 status = "okay"; 145}; 146 147&pwm { 148 pinctrl-0 = <&pwm_ch4b_default>; 149 pinctrl-names = "default"; 150}; 151 152&vreg { 153 regulator-always-on; 154 regulator-allowed-modes = <REGULATOR_RPI_PICO_MODE_NORMAL>; 155}; 156 157pico_spi: &spi0 {}; 158pico_i2c0: &i2c0 {}; 159pico_i2c1: &i2c1 {}; 160pico_serial: &uart0 {}; 161