|
| 1 | +/* |
| 2 | + * Copyright (c) 2024 TOKITA Hiroshi |
| 3 | + * |
| 4 | + * SPDX-License-Identifier: Apache-2.0 |
| 5 | + */ |
| 6 | + |
| 7 | +#include <freq.h> |
| 8 | + |
| 9 | +#include <zephyr/dt-bindings/i2c/i2c.h> |
| 10 | +#include <zephyr/dt-bindings/pwm/pwm.h> |
| 11 | +#include <zephyr/dt-bindings/input/input-event-codes.h> |
| 12 | + |
| 13 | +#include "pico_plus2-pinctrl.dtsi" |
| 14 | + |
| 15 | +/ { |
| 16 | + chosen { |
| 17 | + zephyr,sram = &sram0; |
| 18 | + zephyr,flash = &flash0; |
| 19 | + zephyr,console = &uart0; |
| 20 | + zephyr,shell-uart = &uart0; |
| 21 | + zephyr,code-partition = &code_partition; |
| 22 | + }; |
| 23 | + |
| 24 | + aliases { |
| 25 | + watchdog0 = &wdt0; |
| 26 | + led0 = &led0; |
| 27 | + pwm-led0 = &pwm_led0; |
| 28 | + sw0 = &user_sw; |
| 29 | + }; |
| 30 | + |
| 31 | + leds { |
| 32 | + compatible = "gpio-leds"; |
| 33 | + |
| 34 | + led0: led_0 { |
| 35 | + gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>; |
| 36 | + label = "LED"; |
| 37 | + }; |
| 38 | + }; |
| 39 | + |
| 40 | + pwm_leds { |
| 41 | + compatible = "pwm-leds"; |
| 42 | + status = "disabled"; |
| 43 | + |
| 44 | + pwm_led0: pwm_led_0 { |
| 45 | + pwms = <&pwm 9 PWM_MSEC(20) PWM_POLARITY_NORMAL>; |
| 46 | + label = "PWM_LED"; |
| 47 | + }; |
| 48 | + }; |
| 49 | + |
| 50 | + buttons { |
| 51 | + compatible = "gpio-keys"; |
| 52 | + |
| 53 | + user_sw: user_sw { |
| 54 | + gpios = <&gpio0_hi 13 (GPIO_ACTIVE_LOW)>; |
| 55 | + zephyr,code = <INPUT_KEY_0>; |
| 56 | + }; |
| 57 | + }; |
| 58 | + |
| 59 | + pico_header: connector { |
| 60 | + compatible = "raspberrypi,pico-header"; |
| 61 | + #gpio-cells = <2>; |
| 62 | + gpio-map-mask = <0xffffffff 0xffffffc0>; |
| 63 | + gpio-map-pass-thru = <0 0x3f>; |
| 64 | + gpio-map = <0 0 &gpio0 0 0>, /* GP0 */ |
| 65 | + <1 0 &gpio0 1 0>, /* GP1 */ |
| 66 | + <2 0 &gpio0 2 0>, /* GP2 */ |
| 67 | + <3 0 &gpio0 3 0>, /* GP3 */ |
| 68 | + <4 0 &gpio0 4 0>, /* GP4 */ |
| 69 | + <5 0 &gpio0 5 0>, /* GP5 */ |
| 70 | + <6 0 &gpio0 6 0>, /* GP6 */ |
| 71 | + <7 0 &gpio0 7 0>, /* GP7 */ |
| 72 | + <8 0 &gpio0 8 0>, /* GP8 */ |
| 73 | + <9 0 &gpio0 9 0>, /* GP9 */ |
| 74 | + <10 0 &gpio0 10 0>, /* GP10 */ |
| 75 | + <11 0 &gpio0 11 0>, /* GP11 */ |
| 76 | + <12 0 &gpio0 12 0>, /* GP12 */ |
| 77 | + <13 0 &gpio0 13 0>, /* GP13 */ |
| 78 | + <14 0 &gpio0 14 0>, /* GP14 */ |
| 79 | + <15 0 &gpio0 15 0>, /* GP15 */ |
| 80 | + <16 0 &gpio0 16 0>, /* GP16 */ |
| 81 | + <17 0 &gpio0 17 0>, /* GP17 */ |
| 82 | + <18 0 &gpio0 18 0>, /* GP18 */ |
| 83 | + <19 0 &gpio0 19 0>, /* GP19 */ |
| 84 | + <20 0 &gpio0 20 0>, /* GP20 */ |
| 85 | + <21 0 &gpio0 21 0>, /* GP21 */ |
| 86 | + <22 0 &gpio0 22 0>, /* GP22 */ |
| 87 | + <26 0 &gpio0 26 0>, /* GP26 */ |
| 88 | + <27 0 &gpio0 27 0>, /* GP27 */ |
| 89 | + <28 0 &gpio0 28 0>; /* GP28 */ |
| 90 | + }; |
| 91 | +}; |
| 92 | + |
| 93 | +&flash0 { |
| 94 | + reg = <0x10000000 DT_SIZE_M(16)>; |
| 95 | + |
| 96 | + partitions { |
| 97 | + compatible = "fixed-partitions"; |
| 98 | + #address-cells = <1>; |
| 99 | + #size-cells = <1>; |
| 100 | + |
| 101 | + /* Reserved memory for an image definition block. The block is much |
| 102 | + * smaller than 256 bytes, but in practice the linker places the vector |
| 103 | + * table at a much larger alignment offset. |
| 104 | + */ |
| 105 | + image_def: partition@0 { |
| 106 | + label = "image_def"; |
| 107 | + reg = <0x00000000 0x100>; |
| 108 | + read-only; |
| 109 | + }; |
| 110 | + |
| 111 | + /* |
| 112 | + * Usable flash. Starts at 0x100, after the image definition block. |
| 113 | + * The partition size is 16MB minus the 0x100 bytes taken by the |
| 114 | + * image definition. |
| 115 | + */ |
| 116 | + code_partition: partition@100 { |
| 117 | + label = "code-partition"; |
| 118 | + reg = <0x100 (DT_SIZE_M(16) - 0x100)>; |
| 119 | + read-only; |
| 120 | + }; |
| 121 | + }; |
| 122 | +}; |
| 123 | + |
| 124 | +&uart0 { |
| 125 | + current-speed = <115200>; |
| 126 | + status = "okay"; |
| 127 | + pinctrl-0 = <&uart0_default>; |
| 128 | + pinctrl-names = "default"; |
| 129 | +}; |
| 130 | + |
| 131 | +gpio0_lo: &gpio0 { |
| 132 | + status = "okay"; |
| 133 | +}; |
| 134 | + |
| 135 | +&gpio0_hi { |
| 136 | + status = "okay"; |
| 137 | +}; |
| 138 | + |
| 139 | +&spi0 { |
| 140 | + clock-frequency = <DT_FREQ_M(8)>; |
| 141 | + pinctrl-0 = <&spi0_default>; |
| 142 | + pinctrl-names = "default"; |
| 143 | + status = "okay"; |
| 144 | +}; |
| 145 | + |
| 146 | +&i2c0 { |
| 147 | + clock-frequency = <I2C_BITRATE_STANDARD>; |
| 148 | + pinctrl-0 = <&i2c0_default>; |
| 149 | + pinctrl-names = "default"; |
| 150 | + status = "okay"; |
| 151 | +}; |
| 152 | + |
| 153 | +&adc { |
| 154 | + pinctrl-0 = <&adc_default>; |
| 155 | + pinctrl-names = "default"; |
| 156 | + status = "okay"; |
| 157 | +}; |
| 158 | + |
| 159 | +&pwm { |
| 160 | + pinctrl-0 = <&pwm_ch4b_default>; |
| 161 | + pinctrl-names = "default"; |
| 162 | + divider-int-0 = <255>; |
| 163 | +}; |
| 164 | + |
| 165 | +&timer0 { |
| 166 | + status = "okay"; |
| 167 | +}; |
| 168 | + |
| 169 | +zephyr_udc0: &usbd { |
| 170 | + status = "okay"; |
| 171 | +}; |
| 172 | + |
| 173 | + |
| 174 | +pico_spi: &spi0 {}; |
| 175 | +pico_i2c0: &i2c0 {}; |
| 176 | +pico_i2c1: &i2c1 {}; |
| 177 | +pico_serial: &uart0 {}; |
| 178 | +stemma_qt_i2c: &i2c0 {}; |
0 commit comments