1/* 2 * Copyright (c) 2021 Seagate Technology LLC 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7/dts-v1/; 8#include <st/f0/stm32f070Xb.dtsi> 9#include <st/f0/stm32f070cbtx-pinctrl.dtsi> 10#include <zephyr/dt-bindings/led/led.h> 11#include <zephyr/dt-bindings/led/seagate_legend_b1414.h> 12#include <zephyr/dt-bindings/input/input-event-codes.h> 13 14/ { 15 chosen { 16 zephyr,console = &usart1; 17 zephyr,shell-uart = &usart1; 18 zephyr,sram = &sram0; 19 zephyr,flash = &flash0; 20 }; 21 22 aliases { 23 watchdog0 = &iwdg; 24 led-strip = &led_strip_spi; 25 }; 26 27 board_id: brd-id { 28 compatible = "gpio-keys"; 29 brd_id0: brd_id_0 { 30 label = "BRD_ID_0"; 31 gpios = <&gpioc 13 0>; 32 zephyr,code = <INPUT_KEY_0>; 33 }; 34 brd_id1: brd_id_1 { 35 label = "BRD_ID_1"; 36 gpios = <&gpioc 14 0>; 37 zephyr,code = <INPUT_KEY_1>; 38 }; 39 brd_id2: brd_id_2 { 40 label = "BRD_ID_2"; 41 gpios = <&gpioc 15 0>; 42 zephyr,code = <INPUT_KEY_2>; 43 }; 44 }; 45 46}; 47 48&usart1 { 49 pinctrl-0 = <&usart1_tx_pa9 &usart1_rx_pa10>; 50 pinctrl-names = "default"; 51 current-speed = <115200>; 52 status = "okay"; 53}; 54 55&i2c1 { 56 pinctrl-0 = <&i2c1_scl_pb6 &i2c1_sda_pb7>; 57 pinctrl-names = "default"; 58 clock-frequency = <I2C_BITRATE_STANDARD>; 59 status = "okay"; 60}; 61 62&spi1 { 63 pinctrl-0 = <&spi1_sck_pa5 &spi1_miso_pa6 &spi1_mosi_pa7>; 64 pinctrl-names = "default"; 65 dmas = <&dma1 3 0x20440>, <&dma1 2 0x20480>; 66 dma-names = "tx", "rx"; 67 status = "okay"; 68 69 led_strip_spi: b1414@0 { 70 compatible = "everlight,b1414", "worldsemi,ws2812-spi"; 71 72 /* SPI */ 73 reg = <0>; /* ignored, but necessary for SPI bindings */ 74 spi-max-frequency = <SPI_FREQ>; 75 76 /* B1414 */ 77 spi-one-frame = <ONE_FRAME>; 78 spi-zero-frame = <ZERO_FRAME>; 79 color-mapping = <LED_COLOR_ID_RED>, 80 <LED_COLOR_ID_GREEN>, 81 <LED_COLOR_ID_BLUE>; 82 reset-delay = <250>; 83 }; 84}; 85 86&spi2 { 87 pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>; 88 pinctrl-names = "default"; 89 cs-gpios = <&gpiob 12 GPIO_ACTIVE_LOW>; 90 status = "okay"; 91 92 spi_nor: spi_nor@0 { 93 status = "okay"; 94 compatible = "jedec,spi-nor"; 95 reg = <0>; 96 spi-max-frequency = <8000000>; 97 size = <1048576>; 98 /* 99 * Main flash source 100 * 101 * Vendor : Puya 102 * Model : P25Q21H 103 * Total size : 256 KB 104 * Erase size : whole chip, 64 and 32 KB blocks, 4 KB sectors, 105 * 256 B pages 106 * Write size : up to 256 B (page size) 107 * Lifetime : 100K erase/program cycles on each sector/block 108 */ 109 jedec-id = [85 40 12]; 110 /* 111 * Alternate flash source 112 * 113 * Vendor : Fudan 114 * Model : FM25F01B 115 * Total size : 128 KB 116 * Erase size : whole chip, 64 and 32 KB blocks, 4 KB sectors 117 * Write size : up to 256 B (page size) 118 * Lifetime : 100K erase/program cycles on each sector/block 119 * 120 * jedec-id = [a1 31 11]; 121 * 122 * Model only found in first Jordan (2"5) EVT revision 123 * 124 * Vendor : Fudan 125 * Model : FM25F005 126 * Total size : 64 KB 127 * Erase size : whole chip, 64 and 32 KB blocks, 4 KB sectors 128 * 129 * jedec-id = [a1 31 10]; 130 */ 131 partitions { 132 compatible = "fixed-partitions"; 133 #address-cells = <1>; 134 #size-cells = <1>; 135 136 product_info: partition@0 { 137 label = "product-info"; 138 reg = <0x00000000 DT_SIZE_K(4)>; 139 }; 140 led_das: partition@1000 { 141 label = "led-das"; 142 reg = <0x00001000 DT_SIZE_K(60)>; 143 }; 144 }; 145 }; 146}; 147 148&spi_nor { 149 status = "okay"; 150}; 151 152&dma1 { 153 status = "okay"; 154}; 155 156&timers3 { 157 /* 158 * The maximum period needed on Legend devices for activity LED 159 * hardware blinking is 250ms (i.e. "error" fast blink at 4 Hz). 160 * 161 * We can use the following equation to compute the 162 * corresponding prescaler value: 163 * 164 * period_max = counter_size / cycles_per_second 165 * 166 * With: 167 * 168 * cycles_per_second = 48 MHz / (prescaler + 1) 169 * counter_size = 2^16 170 * period_max = 0.25 171 * 172 * Which gives: 173 * 174 * prescaler = 48 MHz * 0.25 / 2^16 + 1 = 182 175 * 176 * So any prescaler value above 182 is good for a 4 Hz hardware 177 * blinking. In addition the PWM frequency must be as high as 178 * possible to fool eyes and cameras with steady brightness 179 * levels. 180 */ 181 st,prescaler = <200>; 182 183 pwm3: pwm { 184 pinctrl-0 = <&tim3_ch3_pb0>; 185 pinctrl-names = "default"; 186 status = "disabled"; 187 }; 188}; 189 190&gpiod { 191 status = "disabled"; 192}; 193 194&gpiof { 195 status = "disabled"; 196}; 197 198&iwdg { 199 status = "okay"; 200}; 201