Skip to content

Commit d570422

Browse files
committed
rpi_pico: Fix DTC warnings concerning the flash
The addresses of the flash and flash controller of the RP2040 SoC were mixed up. There was no clear distinction between the flash and the flash controller, which was unclear but also caused a DTC warning. This commit makes the distinction clearer: The SSI peripheral at 0x18000000 is the flash controller, and the flash itself starts at 0x10000000. The flash driver and rpi_pico.dts were fixed accordingly. Signed-off-by: Yonatan Schachter <[email protected]>
1 parent 3eb7bd5 commit d570422

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

boards/arm/rpi_pico/rpi_pico.dts

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
chosen {
1919
zephyr,sram = &sram0;
2020
zephyr,flash = &flash0;
21-
zephyr,flash-controller = &flash_controller;
21+
zephyr,flash-controller = &ssi;
2222
zephyr,console = &uart0;
2323
zephyr,shell-uart = &uart0;
2424
zephyr,code-partition = &code_partition;

drivers/flash/flash_rpi_pico.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ LOG_MODULE_REGISTER(flash_rpi_pico, CONFIG_FLASH_LOG_LEVEL);
2727
#define DT_DRV_COMPAT raspberrypi_pico_flash_controller
2828

2929
#define PAGE_SIZE 256
30-
#define SECTOR_SIZE DT_PROP(DT_CHILD(DT_NODELABEL(flash_controller), flash_0), erase_block_size)
30+
#define SECTOR_SIZE DT_PROP(DT_CHOSEN(zephyr_flash), erase_block_size)
3131
#define ERASE_VALUE 0xff
3232
#define FLASH_SIZE KB(CONFIG_FLASH_SIZE)
33-
#define FLASH_BASE DT_REG_ADDR(DT_NODELABEL(flash_controller))
33+
#define FLASH_BASE CONFIG_FLASH_BASE_ADDRESS
34+
#define SSI_BASE_ADDRESS DT_REG_ADDR(DT_CHOSEN(zephyr_flash_controller))
3435

3536
static const struct flash_parameters flash_rpi_parameters = {
3637
.write_block_size = 1,
@@ -56,7 +57,7 @@ enum outover {
5657
OUTOVER_HIGH
5758
};
5859

59-
static ssi_hw_t *const ssi = (ssi_hw_t *)XIP_SSI_BASE;
60+
static ssi_hw_t *const ssi = (ssi_hw_t *)SSI_BASE_ADDRESS;
6061
static uint32_t boot2_copyout[BOOT2_SIZE_WORDS];
6162
static bool boot2_copyout_valid;
6263

dts/arm/rpi_pico/rp2040.dtsi

+3-4
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@
3333
reg = <0x20000000 DT_SIZE_K(264)>;
3434
};
3535

36-
flash_controller: flash-controller@10000000 {
36+
ssi: flash-controller@18000000 {
3737
compatible = "raspberrypi,pico-flash-controller";
38-
reg = <0x10000000 DT_SIZE_K(4)>;
39-
interrupts = <15 0>;
38+
reg = <0x18000000 0xfc>;
4039

4140
#address-cells = <1>;
4241
#size-cells = <1>;
4342

44-
flash0: flash@0 {
43+
flash0: flash@10000000 {
4544
compatible = "soc-nv-flash";
4645
write-block-size = <1>;
4746
erase-block-size = <DT_SIZE_K(4)>;

0 commit comments

Comments
 (0)