Add initial Raspberry Pi Pico 2 / RP2350 support
cover Add initial Raspberry Pi Pico 2 / RP2350 support
This series adds initial U-Boot support for the Raspberry Pi Pico 2 board and its RP2350 SoC, only the dual-core Cortex-M33 support is added.
Sent as an RFC to get feedback on the overall approach before polishing further.
Status as of this RFC:
- UART1 console works; UART0 is not usable yet. Need to investigate.
- Boot-tested on both Pico 2 and Pico 2 W boards.
- make sandbox_defconfig passes with patches applied.
- This series selects CPU_V7M for RP2350. RP2350's Cortex-M33 core is Armv8-M since there is no CPU_V8M support in U-Boot yet. Is CPU_V7M acceptable as a starting point with CPU_V8M as a later follow-up?
- RP2350 has no device tree in mainline Linux yet, so patch 2 hand-writes rp2350.dtsi / rp2350-pico2.dts locally, and rpi_pico2_defconfig uses CONFIG_OF_EMBED rather than CONFIG_OF_UPSTREAM.
- board/raspberrypi/pico2/ is added alongside the existing, unrelated BCM283x Raspberry Pi boards under board/raspberrypi/. Is this directory placement acceptable given the SoC is unrelated, or should it live elsewhere?
- Some functions and structures such as struct rp2350_clocks_regs is defined but not yet used.
- misc_init_r() sets a fixed value for the "serial#" environment variable. This runs after relocation, so a successful env_set() here confirms env works post-relocation.
Flashing procedure used for testing:
picotool uf2 convert u-boot.bin u-boot.uf2 --family rp2350-arm-s --offset 0x10000000 picotool load u-boot.uf2 -v -x
Bootlog:
U-Boot 2026.04-rc3-00070-gbabf6d42fec7-dirty (Jun 23 2026 - 01:55:20 +0530)
CPU: Raspberry Pi RP2350
Model: Raspberry Pi Pico 2
DRAM: 520 KiB
Core: 5 devices, 5 uclasses, devicetree: embed
MMC:
Loading Environment from nowhere... OK
In: serial@40078000
Out: serial@40078000
Err: serial@40078000
RP2350>Bhargav Das (3):
arm: Add RP2350 architecture support
arm: dts: Add RP2350 device tree
board: raspberrypi: Add Pico 2 support
arch/arm/Kconfig | 7 + arch/arm/Makefile | 2 + arch/arm/dts/Makefile | 1 + arch/arm/dts/rp2350-pico2.dts | 30 +++ arch/arm/dts/rp2350.dtsi | 32 +++ arch/arm/include/asm/arch-rp2xxx/rp2350.h | 307 ++++++++++++++++++++++ arch/arm/mach-rp2xxx/Kconfig | 58 ++++ arch/arm/mach-rp2xxx/Makefile | 4 + arch/arm/mach-rp2xxx/image_def.S | 23 ++ arch/arm/mach-rp2xxx/rp2350.c | 261 ++++++++++++++++++ arch/arm/mach-rp2xxx/u-boot.lds | 94 +++++++ board/raspberrypi/pico2/Kconfig | 15 ++ board/raspberrypi/pico2/MAINTAINERS | 9 + board/raspberrypi/pico2/Makefile | 3 + board/raspberrypi/pico2/pico2.c | 83 ++++++ configs/rpi_pico2_defconfig | 29 ++ include/configs/rpi_pico2.h | 48 ++++ 17 files changed, 1006 insertions(+) create mode 100644 arch/arm/dts/rp2350-pico2.dts create mode 100644 arch/arm/dts/rp2350.dtsi create mode 100644 arch/arm/include/asm/arch-rp2xxx/rp2350.h create mode 100644 arch/arm/mach-rp2xxx/Kconfig create mode 100644 arch/arm/mach-rp2xxx/Makefile create mode 100644 arch/arm/mach-rp2xxx/image_def.S create mode 100644 arch/arm/mach-rp2xxx/rp2350.c create mode 100644 arch/arm/mach-rp2xxx/u-boot.lds create mode 100644 board/raspberrypi/pico2/Kconfig create mode 100644 board/raspberrypi/pico2/MAINTAINERS create mode 100644 board/raspberrypi/pico2/Makefile create mode 100644 board/raspberrypi/pico2/pico2.c create mode 100644 configs/rpi_pico2_defconfig create mode 100644 include/configs/rpi_pico2.h
Signature · 1 line
2.43.0
RFC PATCH 1/3 arm: Add RP2350 architecture support
Add initial U-Boot architecture support for the RP2350 SoC.
RP2350 specs:
- CPU: Dual-core Arm Cortex-M33 or dual-core RISC-V Hazard3 @ 150MHz.
- Memory: 520 KB on-chip SRAM, 4 MB on-board QSPI flash.
Only Arm core support is added here.
The architecture is added under arch/arm/mach-rp2xxx/.
This patch implements early SoC bring-up:
- XOSC (12MHz crystal) startup
- PLL_SYS configuration to 150MHz
- CLK_REF/CLK_SYS/CLK_PERI clock switching
- UART1 early console init (115200 8N1)
Cortex-M33 is an Armv8-M core, but U-Boot does not yet have a CPU_V8M architecture variant. CPU_V7M's startup and exception handling are close enough to Armv8-M Baseline/Mainline that the existing CPU_V7M code path is reused for RP2350 in this series.
--- arch/arm/Kconfig | 7 + arch/arm/Makefile | 2 + arch/arm/include/asm/arch-rp2xxx/rp2350.h | 307 ++++++++++++++++++++++ arch/arm/mach-rp2xxx/Kconfig | 58 ++++ arch/arm/mach-rp2xxx/Makefile | 4 + arch/arm/mach-rp2xxx/image_def.S | 23 ++ arch/arm/mach-rp2xxx/rp2350.c | 261 ++++++++++++++++++ arch/arm/mach-rp2xxx/u-boot.lds | 94 +++++++ 8 files changed, 756 insertions(+) create mode 100644 arch/arm/include/asm/arch-rp2xxx/rp2350.h create mode 100644 arch/arm/mach-rp2xxx/Kconfig create mode 100644 arch/arm/mach-rp2xxx/Makefile create mode 100644 arch/arm/mach-rp2xxx/image_def.S create mode 100644 arch/arm/mach-rp2xxx/rp2350.c create mode 100644 arch/arm/mach-rp2xxx/u-boot.lds
arch/arm/Kconfig +7 -0
@@ -2018,6 +2018,10 @@ config ARCH_STM32 select DM_SERIAL imply CMD_DM +config ARCH_RP2XXX + bool "Raspberry Pi RP2xxx SoCs" + select CPU_V7M + config ARCH_STI bool "Support STMicroelectronics SoCs" select CPU_V7A
@@ -2272,6 +2276,9 @@ config SYS_KWD_CONFIG Path within the source directory to the kwbimage.cfg file to use when packaging the U-Boot image for use. + +source "arch/arm/mach-rp2xxx/Kconfig" + source "arch/arm/mach-airoha/Kconfig" source "arch/arm/mach-apple/Kconfig"
arch/arm/Makefile +2 -0
@@ -99,6 +99,8 @@ machine-$(CONFIG_ARCH_ZYNQMP_R5) += zynqmp-r5 machine-$(CONFIG_MACH_IMX) += imx +machine-$(CONFIG_ARCH_RP2XXX) += rp2xxx + machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y)) PLATFORM_CPPFLAGS += $(patsubst %,-I$(srctree)/%include,$(machdirs))
arch/arm/include/asm/arch-rp2xxx/rp2350.h new file +307 -0
307 lines not on this page · raw message
arch/arm/mach-rp2xxx/Kconfig new file +58 -0
58 lines not on this page · raw message
arch/arm/mach-rp2xxx/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += rp2350.o +obj-y += image_def.o
arch/arm/mach-rp2xxx/image_def.S new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* RP2350 PICOBIN metadata block - placed after the stored vector table */ + + .section .image_def, "a" + .align 4 + .global rp2350_image_def + +rp2350_image_def: + .word 0xffffded3 /* PICOBIN_BLOCK_MARKER_START */ + + /* IMAGE_TYPE: EXE | Secure | Arm | RP2350. */ + .byte 0x42 + .byte 0x01 + .hword 0x1021 + +rp2350_image_def_end_items: + .byte 0xff /* PICOBIN_BLOCK_ITEM_2BS_LAST */ + .hword (rp2350_image_def_end - rp2350_image_def - 16) / 4 + .byte 0x00 + + .word 0x00000000 /* Relative pointer to next block: self-loop */ + .word 0xab123579 /* PICOBIN_BLOCK_MARKER_END */ +rp2350_image_def_end:
arch/arm/mach-rp2xxx/rp2350.c new file +261 -0
261 lines not on this page · raw message
arch/arm/mach-rp2xxx/u-boot.lds new file +94 -0
94 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [RFC PATCH 1/3] arm: Add RP2350 architecture support
Hi Bhargav,
Quoted 34 lines · Bhargav Das
arm: Add RP2350 architecture support
Add initial U-Boot architecture support for the RP2350 SoC.
RP2350 specs:
- CPU: Dual-core Arm Cortex-M33 or dual-core RISC-V Hazard3 @ 150MHz.
- Memory: 520 KB on-chip SRAM, 4 MB on-board QSPI flash.Only Arm core support is added here.
The architecture is added under
arch/arm/mach-rp2xxx/.This patch implements early SoC bring-up:
- XOSC (12MHz crystal) startup
-PLL_SYSconfiguration to 150MHz
- CLK_REF/CLK_SYS/CLK_PERI clock switching
- UART1 early console init (115200 8N1)Cortex-M33 is an Armv8-M core, but U-Boot does not yet have a
CPU_V8Marchitecture variant. CPU_V7M's startup and exception handling are close [...]
arch/arm/Kconfig| 7 +arch/arm/Makefile | 2 + arch/arm/include/asm/arch-rp2xxx/rp2350.h | 307 ++++++++++++++++++++++++++++++ arch/arm/mach-rp2xxx/Kconfig | 58 ++++++ arch/arm/mach-rp2xxx/Makefile | 4 + arch/arm/mach-rp2xxx/image_def.S | 23 +++ arch/arm/mach-rp2xxx/rp2350.c | 261 +++++++++++++++++++++++++ arch/arm/mach-rp2xxx/u-boot.lds | 94 +++++++++ 8 files changed, 756 insertions(+)
arch/arm/mach-rp2xxx/rp2350.c line 6
Quoted 6 lines
arch/arm/mach-rp2xxx/rp2350.c +6
-0@@ -0,0 +1,261 @@ +disable_mpu (); + +for (i =0 ; i <ARRAY_SIZE (rp2350_mpu_config); i++) +mpu_config (&rp2350_mpu_config[i]); + +enable_mpu ();
This calls into arch/arm/cpu/armv7m/mpu.c, which programs the PMSAv7
MPU: it writes the region size and attributes into MPU_RASR.
The Cortex-M33 is Armv8-M and uses the PMSAv8 MPU, which as I understand it has no RASR - regions are described with a base in MPU_RBAR and a limit in MPU_RLAR, with attributes indexed through MPU_MAIR0/1. So these writes do not configure the MPU as the comment describes; I suspect the region setup is silently ineffective and the board boots only because the default memory map is already usable. The commit message argues CPU_V7M's startup and exception handling are close enough, but that reasoning does not extend to the MPU register model. Please can you either drop the MPU setup for now, or note clearly that it is a no-op pending real Armv8-M support. What do you think?
arch/arm/mach-rp2xxx/rp2350.c line 6
Quoted 8 lines
arch/arm/mach-rp2xxx/rp2350.c +6
-0@@ -0,0 +1,261 @@ +* Region 0: XIP Flash 0x10000000 - executable, read-only, cacheable +* Region 1: SRAM 0x20000000 - read/write, cacheable +* Region 2: Peripherals 0x40000000 - read/write, device (non-cacheable) +*/ + +int print_cpuinfo (void )
he comment documents three regions, but rp2350_mpu_config[] only sets up two (a single 512MB region covering ROM/flash/SRAM, and one for peripherals) - please update the comment to match.
Also this block is the header for arch_cpu_init(), yet print_cpuinfo() sits between it and the function it describes. Please move print_cpuinfo() out so the comment sits directly above arch_cpu_init().
arch/arm/mach-rp2xxx/rp2350.c line 2
Quoted 4 lines
arch/arm/mach-rp2xxx/rp2350.c +2
-0@@ -0,0 +1,261 @@ +writel (0 , &pll->pwr);/* Power everything on */ +writel (PLL_PWR_POSTDIVPD |PLL_PWR_DSMPD , &pll->pwr);/* Keep post dividers and DSM powered down for now, only VCO on */
Does the first write actually do something useful? The second line is also well over 80 columns - please move the comment above the statement.
arch/arm/mach-rp2xxx/rp2350.c line 3
Quoted 5 lines
arch/arm/mach-rp2xxx/rp2350.c +3
-0@@ -0,0 +1,261 @@ +clrsetbits_le32 (clk_base +0x30 ,0x3 ,CLK_REF_SRC_XOSC ); +while (!(readl (clk_base +0x38 ) &BIT (CLK_REF_SRC_XOSC ))) + ;
The clocks code pokes bare offsets (0x30, 0x38, 0x3c, 0x44, 0x48) with magic bit positions inline, which is hard to verify against the datasheet. The cover letter notes struct rp2350_clocks_regs is defined but unused; as it stands it does not even contain the CLK_REF/CLK_SYS/CLK_PERI registers used here. Please can you extend that struct to cover these and access them by name, or at least add named offset/field defines in rp2350.h, rather than open-coding the offsets?
I don't have one of these boards in my lab but I'm looking forward to it!
Regards,
Simon
RFC PATCH 2/3 arm: dts: Add RP2350 device tree
In reply to Bhargav DasAdd device tree for the RP2350 SoC (rp2350.dtsi) and the Raspberry Pi Pico 2 board (rp2350-pico2.dts).
rpi_pico2_defconfig selects CONFIG_OF_EMBED, building the dtb from u-boot's source rather than CONFIG_OF_UPSTREAM.
--- arch/arm/dts/Makefile | 1 + arch/arm/dts/rp2350-pico2.dts | 30 ++++++++++++++++++++++++++++++ arch/arm/dts/rp2350.dtsi | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 arch/arm/dts/rp2350-pico2.dts create mode 100644 arch/arm/dts/rp2350.dtsi
arch/arm/dts/Makefile +1 -0
@@ -1196,6 +1196,7 @@ dtb-$(CONFIG_TARGET_SC594_SOM_EZKIT) += sc594-som-ezkit.dtb dtb-$(CONFIG_TARGET_SC594_SOM_EZLITE) += sc594-som-ezlite.dtb dtb-$(CONFIG_TARGET_SC598_SOM_EZKIT) += sc598-som-ezkit.dtb dtb-$(CONFIG_TARGET_SC598_SOM_EZLITE) += sc598-som-ezlite.dtb +dtb-$(CONFIG_TARGET_RPI_PICO2) += rp2350-pico2.dtb ifneq ($(CONFIG_TARGET_IMX8MP_RSB3720A1_4G)$(CONFIG_TARGET_IMX8MP_RSB3720A1_6G),) dtb-y += imx8mp-rsb3720-a1.dtb
arch/arm/dts/rp2350-pico2.dts new file +30 -0
@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Device Tree for Raspberry Pi Pico 2 (RP2350) + */ + +/dts-v1/; + +#include "rp2350.dtsi" + +/ { + model = "Raspberry Pi Pico 2"; + compatible = "raspberrypi,pico2", "raspberrypi,rp2350"; + + aliases { + serial0 = &uart1; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + memory@20000000 { + device_type = "memory"; + reg = <0x20000000 0x00082000>; /* 520 KB SRAM */ + }; +}; + +&uart1 { + status = "okay"; +};
arch/arm/dts/rp2350.dtsi new file +32 -0
@@ -0,0 +1,32 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Device Tree Include file for Raspberry Pi RP2350 SoC + */ + +/ { + #address-cells = <1>; + #size-cells = <1>; + + compatible = "raspberrypi,rp2350"; + + soc { + #address-cells = <1>; + #size-cells = <1>; + compatible = "simple-bus"; + ranges; + + uart0: serial@40070000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x40070000 0x1000>; + clock = <150000000>; /* CLK_PERI = clk_sys 150MHz */ + status = "disabled"; + }; + + uart1: serial@40078000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x40078000 0x1000>; + clock = <150000000>; /* CLK_PERI = clk_sys 150MHz */ + status = "disabled"; + }; + }; +};
Signature · 1 line
2.43.0
Re: [RFC PATCH 2/3] arm: dts: Add RP2350 device tree
Hi Bhargav,
Quoted 17 lines · Bhargav Das
arm: dts: Add RP2350 device tree
Add device tree for the RP2350 SoC (
rp2350.dtsi) and the Raspberry Pi Pico 2 board (rp2350-pico2.dts).
rpi_pico2_defconfigselectsCONFIG_OF_EMBED, building the dtb from u-boot's source rather thanCONFIG_OF_UPSTREAM.Signed-off-by Bhargav Das <[email protected]>
arch/arm/dts/Makefile| 1 +arch/arm/dts/rp2350-pico2.dts | 30 ++++++++++++++++++++++++++++++ arch/arm/dts/rp2350.dtsi | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+)
arch/arm/dts/rp2350-pico2.dts line 1
Quoted 1 line
arch/arm/dts/rp2350-pico2.dts +1
-0@@ -0,0 +1,30 @@ +// SPDX-License-Identifier: GPL-2.0+
Since the aim is to align with a mainline Linux device tree (assuming they would accept a file for something that cannot boot Linux!), please use the dual 'GPL-2.0-only OR MIT' licence that new Linux DT files use. It saves a relicensing step later, and most new DTs in arch/arm/dts already do this. Same applies to rp2350.dtsi
arch/arm/dts/rp2350-pico2.dts line 4
Quoted 6 lines
arch/arm/dts/rp2350-pico2.dts +4
-0@@ -0,0 +1,30 @@ + memory@20000000 { + device_type = "memory"; + reg = <0x20000000 0x00082000>; /* 520 KB SRAM */ + };
The 520KB SRAM is a fixed feature of the RP2350 itself and identical on every board using this SoC, so this memory node belongs in rp2350.dtsi rather than the board .dts. Only genuinely board-specific things (aliases, chosen, which UART is enabled) belong here.
arch/arm/dts/rp2350.dtsi line 6
Quoted 8 lines
arch/arm/dts/rp2350.dtsi +6
-0@@ -0,0 +1,32 @@ + uart0: serial@40070000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x40070000 0x1000>; + clock = <150000000>; /* CLK_PERI = clk_sys 150MHz */ + status = "disabled"; + };
The 'clock' property is a U-Boot-specific fallback that the pl011 driver reads via dev_read_u32_default() - the standard pl011 binding uses a 'clocks' phandle plus 'clock-names'. It works for now since there is no clock driver, but it will diverge from whatever eventually goes upstream to Linux. Just flagging it so it is not forgotten once a clock uclass driver appears - a comment in the commit message noting this is a temporary shortcut would help.
Regards,
Simon
RFC PATCH 3/3 board: raspberrypi: Add Pico 2 support
In reply to Bhargav DasAdd board support for the Raspberry Pi Pico 2.
UART1 console is functional as of now.
misc_init_r() sets a fixed value for the "serial#" environment variable. This runs after relocation, so a successful env_set() here confirms env works post-relocation.
--- board/raspberrypi/pico2/Kconfig | 15 ++++++ board/raspberrypi/pico2/MAINTAINERS | 9 ++++ board/raspberrypi/pico2/Makefile | 3 ++ board/raspberrypi/pico2/pico2.c | 83 +++++++++++++++++++++++++++++ configs/rpi_pico2_defconfig | 29 ++++++++++ include/configs/rpi_pico2.h | 48 +++++++++++++++++ 6 files changed, 187 insertions(+) create mode 100644 board/raspberrypi/pico2/Kconfig create mode 100644 board/raspberrypi/pico2/MAINTAINERS create mode 100644 board/raspberrypi/pico2/Makefile create mode 100644 board/raspberrypi/pico2/pico2.c create mode 100644 configs/rpi_pico2_defconfig create mode 100644 include/configs/rpi_pico2.h
board/raspberrypi/pico2/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +if TARGET_RPI_PICO2 + +config SYS_SOC + default "rp2xxx" + +config SYS_BOARD + default "pico2" + +config SYS_VENDOR + default "raspberrypi" + +config SYS_CONFIG_NAME + default "rpi_pico2" + +endif
board/raspberrypi/pico2/MAINTAINERS new file +9 -0
@@ -0,0 +1,9 @@ +RPI PICO2 BOARD +M: Bhargav Das <[email protected]> +S: Maintained +F: arch/arm/dts/rp2350* +F: arch/arm/include/asm/arch-rp2xxx/ +F: arch/arm/mach-rp2xxx/ +F: board/raspberrypi/pico2/ +F: configs/rpi_pico2_defconfig +F: include/configs/rpi_pico2.h
board/raspberrypi/pico2/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += pico2.o
board/raspberrypi/pico2/pico2.c new file +83 -0
83 lines not on this page · raw message
configs/rpi_pico2_defconfig new file +29 -0
@@ -0,0 +1,29 @@ +CONFIG_ARM=y +CONFIG_SYS_ICACHE_OFF=y +CONFIG_SYS_DCACHE_OFF=y +CONFIG_ARCH_RP2XXX=y +CONFIG_RP2350=y +CONFIG_TARGET_RPI_PICO2=y +CONFIG_TEXT_BASE=0x10000000 +CONFIG_SYS_MALLOC_LEN=0x8000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20082000 +CONFIG_ENV_SIZE=0x1000 +CONFIG_DEFAULT_DEVICE_TREE="rp2350-pico2" +CONFIG_SYS_LOAD_ADDR=0x20010000 +CONFIG_SYS_CUSTOM_LDSCRIPT=y +CONFIG_SYS_LDSCRIPT="arch/arm/mach-rp2xxx/u-boot.lds" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_MISC_INIT_R=y +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="RP2350> " +CONFIG_CMD_TIMER=y +CONFIG_OF_CONTROL=y +# CONFIG_OF_UPSTREAM is not set +CONFIG_OF_EMBED=y +CONFIG_NO_NET=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_PL01X_SERIAL=y +CONFIG_TIMER=y
include/configs/rpi_pico2.h new file +48 -0
48 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [RFC PATCH 3/3] board: raspberrypi: Add Pico 2 support
Hi Bhargav,
Quoted 22 lines · Bhargav Das
board: raspberrypi: Add Pico 2 support
Add board support for the Raspberry Pi Pico 2.
UART1 console is functional as of now.
misc_init_r()sets a fixed value for the "serial#" environment variable. This runs after relocation, so a successfulenv_set()here confirms env works post-relocation.Signed-off-by Bhargav Das <[email protected]>board/raspberrypi/pico2/Kconfig | 15 +++++++
board/raspberrypi/pico2/MAINTAINERS | 9 ++++ board/raspberrypi/pico2/Makefile | 3 ++ board/raspberrypi/pico2/pico2.c | 83 +++++++++++++++++++++++++++++++++++++ configs/rpi_pico2_defconfig | 29 +++++++++++++ include/configs/rpi_pico2.h | 48 +++++++++++++++++++++ 6 files changed, 187 insertions(+)
configs/rpi_pico2_defconfig line 9
Quoted 9 lines
configs/rpi_pico2_defconfig +9
-0@@ -0,0 +1,29 @@ +CONFIG_CMD_TIMER=y +CONFIG_OF_CONTROL=y +# CONFIG_OF_UPSTREAM is not set +CONFIG_OF_EMBED=y +CONFIG_NO_NET=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_PL01X_SERIAL=y +CONFIG_TIMER=y
This enables CONFIG_TIMER (the DM timer framework) and CONFIG_CMD_TIMER, but there is no timer node in the device tree (patch
2) and no DM timer driver selected here. The armv7m SysTick driver in arch/arm/cpu/armv7m/systick-timer.c is gated on CONFIG_SYS_ARCH_TIMER, not CONFIG_TIMER, so it is not built either. Just to check - how does get_timer() work at runtime? I suspect you want CONFIG_SYS_ARCH_TIMER for the SysTick, or a proper DM timer with a matching DT node. As it stands the timer config looks inconsistent.
include/configs/rpi_pico2.h line 11
Quoted 13 lines
include/configs/rpi_pico2.h +11
-0@@ -0,0 +1,48 @@ +/* +* Serial / Console +* RP2350 UART1 is PL011 compatible +* GPIO4 = TX, GPIO5 = RX +* Clock: XOSC 12MHz +*/ +#ifdef CONFIG_PL01X_SERIAL +#define CFG_PL011_CLOCK 12000000 +#define CFG_SYS_SERIAL0 RP2350_UART1_BASE +#define CFG_PL01x_PORTS {(void *)CFG_SYS_SERIAL0} +#endif
This is inconsistent with the rest of the series. The early UART runs CLK_PERI at 150MHz (patch 1 uses IBRD=81/FBRD=24 for that), and the DT gives clock = <150000000>. Since you use DM_SERIAL with OF_CONTROL, the pl01x driver reads plat->clock from the DT 'clock' property, so CFG_PL011_CLOCK is only the fallback and the 12MHz value here is never used - and the "Clock: XOSC 12MHz" comment is wrong. CFG_SYS_SERIAL0 and CFG_PL01x_PORTS are for the non-DM platdata path, which you do not use. Please drop these, or at least fix the clock value so it does not mislead.
board/raspberrypi/pico2/pico2.c line 10
Quoted 12 lines
board/raspberrypi/pico2/pico2.c +10
-0@@ -0,0 +1,83 @@ +#ifdef CONFIG_MISC_INIT_R +int misc_init_r (void ) +{ +/* Set a default serial number, rpi pico 2 part no */ +if (!env_get ("serial#" )) +env_set ("serial#" ,"SC1631" ); + +return 0 ; +} +#endif
misc_init_r() is only called when CONFIG_MISC_INIT_R is set, so the #ifdef guard is redundant - please drop it. BTW the commit message says the chip has "a unique chip ID we can use as serial number", but this writes a fixed string; that reads as a contradiction. Since it is a placeholder, I would say so in the commit message.
Regards,
Simon
Hi Bhargav,
Quoted 2 lines
This series adds initial U-Boot support for the Raspberry Pi Pico 2 board and its RP2350 SoC, only the dual-core Cortex-M33 support is added.
It would be useful to give a bigger overview of *why* this is happening? Is it used to boot Linux, some other OS? How can I test the wider ecosystem that this functionality provides?
Quoted 5 lines
Sent as an RFC to get feedback on the overall approach before polishing further.
Status as of this RFC:
Quoted 10 lines
- UART1 console works; UART0 is not usable yet. Need to investigate.
- Boot-tested on both Pico 2 and Pico 2 W boards.
-make sandbox_defconfigpasses with patches applied.
- This series selectsCPU_V7Mfor RP2350. RP2350's Cortex-M33 core is Armv8-M since there is noCPU_V8Msupport in U-Boot yet. IsCPU_V7Macceptable as a starting point withCPU_V8Mas a later follow-up?
- RP2350 has no device tree in mainline Linux yet, so patch 2 hand-writesrp2350.dtsi/rp2350-pico2.dtslocally, andrpi_pico2_defconfigusesCONFIG_OF_EMBEDrather thanCONFIG_OF_UPSTREAM.
Has it been sent to a list upstream for review? Is there a timeline for that to happen?
Quoted 4 lines
- board/raspberrypi/pico2/ is added alongside the existing, unrelated BCM283x Raspberry Pi boards under board/raspberrypi/. Is this directory placement acceptable given the SoC is unrelated, or should it live elsewhere?
It doesn't matter the relationship between SoCs, they're related because of the vendor. EG toradex is a board vendor that uses SoCs from a number of vendors.
Quoted 67 lines
- Some functions and structures such as
struct rp2350_clocks_regsis defined but not yet used.
-misc_init_r()sets a fixed value for the "serial#" environment variable. This runs after relocation, so a successfulenv_set()here confirms env works post-relocation.Flashing procedure used for testing:
picotool uf2 convert u-boot.bin u-boot.uf2 --family rp2350-arm-s --offset
0x10000000picotool load u-boot.uf2 -v -xBootlog:
U-Boot 2026.04-rc3-00070-gbabf6d42fec7-dirty (Jun 23 2026 - 01:55:20 +0530) CPU: Raspberry Pi RP2350 Model: Raspberry Pi Pico 2 DRAM: 520 KiB Core: 5 devices, 5 uclasses, devicetree: embed MMC: Loading Environment from nowhere... OK In: serial@40078000 Out: serial@40078000 Err: serial@40078000 RP2350>Bhargav Das (3):
arm: Add RP2350 architecture support
arm: dts: Add RP2350 device tree
board: raspberrypi: Add Pico 2 supportarch/arm/Kconfig | 7 + arch/arm/Makefile | 2 + arch/arm/dts/Makefile | 1 + arch/arm/dts/rp2350-pico2.dts | 30 +++ arch/arm/dts/rp2350.dtsi | 32 +++ arch/arm/include/asm/arch-rp2xxx/rp2350.h | 307 ++++++++++++++++++++++ arch/arm/mach-rp2xxx/Kconfig | 58 ++++ arch/arm/mach-rp2xxx/Makefile | 4 + arch/arm/mach-rp2xxx/image_def.S | 23 ++ arch/arm/mach-rp2xxx/rp2350.c | 261 ++++++++++++++++++ arch/arm/mach-rp2xxx/u-boot.lds | 94 +++++++ board/raspberrypi/pico2/Kconfig | 15 ++ board/raspberrypi/pico2/MAINTAINERS | 9 + board/raspberrypi/pico2/Makefile | 3 + board/raspberrypi/pico2/pico2.c | 83 ++++++ configs/rpi_pico2_defconfig | 29 ++ include/configs/rpi_pico2.h | 48 ++++ 17 files changed, 1006 insertions(+) create mode 100644 arch/arm/dts/rp2350-pico2.dts create mode 100644 arch/arm/dts/rp2350.dtsi create mode 100644 arch/arm/include/asm/arch-rp2xxx/rp2350.h create mode 100644 arch/arm/mach-rp2xxx/Kconfig create mode 100644 arch/arm/mach-rp2xxx/Makefile create mode 100644 arch/arm/mach-rp2xxx/image_def.S create mode 100644 arch/arm/mach-rp2xxx/rp2350.c create mode 100644 arch/arm/mach-rp2xxx/u-boot.lds create mode 100644 board/raspberrypi/pico2/Kconfig create mode 100644 board/raspberrypi/pico2/MAINTAINERS create mode 100644 board/raspberrypi/pico2/Makefile create mode 100644 board/raspberrypi/pico2/pico2.c create mode 100644 configs/rpi_pico2_defconfig create mode 100644 include/configs/rpi_pico2.h--
2.43.0
Hi Peter,
Quoted 10 lines
Hi Bhargav,
Quoted 2 lines
This series adds initial U-Boot support for the Raspberry Pi Pico 2 board and its RP2350 SoC, only the dual-core Cortex-M33 support is added.
It would be useful to give a bigger overview of *why* this is happening? Is it used to boot Linux, some other OS? How can I test the wider ecosystem that this functionality provides?
In this hardware booting Linux would be close to impossible without making hardware changes.
I was thinking maybe booting RTOSs from here, maybe freertos or zephyr.
I took this initially as PoC for porting U-Boot to a NO MMU environment using a modern hardware.
I will share some workflow for the above in v2 but that might be while before I port/write drivers for
some of the devices eg, timer , watchdog.
Quoted 16 lines
Quoted 5 lines
Sent as an RFC to get feedback on the overall approach before polishing further.
Status as of this RFC:
Quoted 10 lines
- UART1 console works; UART0 is not usable yet. Need to investigate.
- Boot-tested on both Pico 2 and Pico 2 W boards.
-make sandbox_defconfigpasses with patches applied.
- This series selectsCPU_V7Mfor RP2350. RP2350's Cortex-M33 core is Armv8-M since there is noCPU_V8Msupport in U-Boot yet. IsCPU_V7Macceptable as a starting point withCPU_V8Mas a later follow-up?
- RP2350 has no device tree in mainline Linux yet, so patch 2 hand-writesrp2350.dtsi/rp2350-pico2.dtslocally, andrpi_pico2_defconfigusesCONFIG_OF_EMBEDrather thanCONFIG_OF_UPSTREAM.
Quoted 3 lines
Has it been sent to a list upstream for review? Is there a timeline for that to happen?
No, it hasn't been sent. Also since it is almost impossible to boot linux here, shall I send it ?
Quoted 9 lines
Quoted 4 lines
- board/raspberrypi/pico2/ is added alongside the existing, unrelated BCM283x Raspberry Pi boards under board/raspberrypi/. Is this directory placement acceptable given the SoC is unrelated, or should it live elsewhere?
It doesn't matter the relationship between SoCs, they're related because of the vendor. EG toradex is a board vendor that uses SoCs from a number of vendors.
Thanks for the clarifications.
Quoted 67 lines
Quoted 67 lines
- Some functions and structures such as
struct rp2350_clocks_regsis defined but not yet used.
-misc_init_r()sets a fixed value for the "serial#" environment variable. This runs after relocation, so a successfulenv_set()here confirms env works post-relocation.Flashing procedure used for testing:
picotool uf2 convert u-boot.bin u-boot.uf2 --family rp2350-arm-s --offset
0x10000000picotool load u-boot.uf2 -v -xBootlog:
U-Boot 2026.04-rc3-00070-gbabf6d42fec7-dirty (Jun 23 2026 - 01:55:20 +0530) CPU: Raspberry Pi RP2350 Model: Raspberry Pi Pico 2 DRAM: 520 KiB Core: 5 devices, 5 uclasses, devicetree: embed MMC: Loading Environment from nowhere... OK In: serial@40078000 Out: serial@40078000 Err: serial@40078000 RP2350>Bhargav Das (3):
arm: Add RP2350 architecture support
arm: dts: Add RP2350 device tree
board: raspberrypi: Add Pico 2 supportarch/arm/Kconfig | 7 + arch/arm/Makefile | 2 + arch/arm/dts/Makefile | 1 + arch/arm/dts/rp2350-pico2.dts | 30 +++ arch/arm/dts/rp2350.dtsi | 32 +++ arch/arm/include/asm/arch-rp2xxx/rp2350.h | 307 ++++++++++++++++++++++ arch/arm/mach-rp2xxx/Kconfig | 58 ++++ arch/arm/mach-rp2xxx/Makefile | 4 + arch/arm/mach-rp2xxx/image_def.S | 23 ++ arch/arm/mach-rp2xxx/rp2350.c | 261 ++++++++++++++++++ arch/arm/mach-rp2xxx/u-boot.lds | 94 +++++++ board/raspberrypi/pico2/Kconfig | 15 ++ board/raspberrypi/pico2/MAINTAINERS | 9 + board/raspberrypi/pico2/Makefile | 3 + board/raspberrypi/pico2/pico2.c | 83 ++++++ configs/rpi_pico2_defconfig | 29 ++ include/configs/rpi_pico2.h | 48 ++++ 17 files changed, 1006 insertions(+) create mode 100644 arch/arm/dts/rp2350-pico2.dts create mode 100644 arch/arm/dts/rp2350.dtsi create mode 100644 arch/arm/include/asm/arch-rp2xxx/rp2350.h create mode 100644 arch/arm/mach-rp2xxx/Kconfig create mode 100644 arch/arm/mach-rp2xxx/Makefile create mode 100644 arch/arm/mach-rp2xxx/image_def.S create mode 100644 arch/arm/mach-rp2xxx/rp2350.c create mode 100644 arch/arm/mach-rp2xxx/u-boot.lds create mode 100644 board/raspberrypi/pico2/Kconfig create mode 100644 board/raspberrypi/pico2/MAINTAINERS create mode 100644 board/raspberrypi/pico2/Makefile create mode 100644 board/raspberrypi/pico2/pico2.c create mode 100644 configs/rpi_pico2_defconfig create mode 100644 include/configs/rpi_pico2.h--
2.43.0
Hi Bhargav,
Quoted 2 lines · Bhargav Das
Sent as an RFC to get feedback on the overall approach before polishing further.
Could you also add some docs under doc/board/raspberrypi/ describing the SoC, what works, and the flashing/boot procedure. You already have most of that material in this cover letter (the picotool steps and the bootlog), so it should be easy to turn into a doc patch. It is also the natural place to explain the 'why' that Peter asked about.
Quoted 3 lines
This series selects
CPU_V7Mfor RP2350. RP2350's Cortex-M33 core is Armv8-M since there is noCPU_V8Msupport in U-Boot yet. IsCPU_V7Macceptable as a starting point withCPU_V8Mas a later follow-up?
Reusing CPU_V7M as a starting point seems reasonable - but a proper CPU_V8M variant may be better down the road (you could mention that in your docs).
Regards,
Simon
Hi Simon,
Quoted 5 lines · Simon Glass
Hi Bhargav,
On 2026-07-26T11:56:45, Bhargav Das <[email protected]> wrote:
Quoted 9 lines
Quoted 2 lines
Sent as an RFC to get feedback on the overall approach before polishing further.
Could you also add some docs under doc/board/raspberrypi/ describing the SoC, what works, and the flashing/boot procedure. You already have most of that material in this cover letter (the picotool steps and the bootlog), so it should be easy to turn into a doc patch. It is also the natural place to explain the 'why' that Peter asked about.
Thanks for pointing out the issues and your valuable comments in the patch series.
I am away from my setup for next few weeks so please expect delays from my end.
Quoted 10 lines
Quoted 3 lines
This series selects
CPU_V7Mfor RP2350. RP2350's Cortex-M33 core is Armv8-M since there is noCPU_V8Msupport in U-Boot yet. IsCPU_V7Macceptable as a starting point withCPU_V8Mas a later follow-up?Reusing
CPU_V7Mas a starting point seems reasonable - but a properCPU_V8Mvariant may be better down the road (you could mention that in your docs).Regards,
Simon
Hi
Quoted 7 lines
This series adds initial U-Boot support for the Raspberry Pi Pico 2 board and its RP2350 SoC, only the dual-core Cortex-M33 support is added.
Sent as an RFC to get feedback on the overall approach before polishing further.
Just out of curiosity, what's the purpose of adding support for boards like this? This will never run Linux and there are obviously better alternatives, designed specifically for these tiny, little boards.
Best regards
Patryk
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 0/4] Add initial support for Raspberry Pi Pico 2 (RP2350)
Hi Bhargav,
Quoted 5 lines · Bhargav Das
Bhargav Das (4):
arm: Add RP2350 architecture support
arm: dts: Add RP2350 device tree
board: raspberrypi: Add Pico 2 support
arm: rp2350: Add driver for RP2350 hardware timers
The series isn't bisectable as ordered (see my comments on patches 1 and 3). I suggest this order: the SoC code and the timer driver first, then the devicetree, then a board patch that adds the target, its Kconfig and the defconfig together. That way each step builds and runs.
Quoted 2 lines
Flashing Procedure:
-------------------
Please can you add a doc/board/raspberrypi/ page, with an index entry, covering the picotool conversion and flashing steps, the UART1 pins and the current limitations? The Zephyr example could go there too. Otherwise this information only exists in a cover letter, which won't be in the tree.
The MAINTAINERS entry should also cover the new timer driver in drivers/timer, which patch 4 doesn't add.
Quoted 2 lines
Changes v1 -> v2:
- Addressed various community review comments regarding code architecture.
Please put the change log in each patch, so reviewers can see what changed where. Patman's Series-changes tags do this for you. Also, 'various community review comments' doesn't tell anyone what was done.
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 1/4] arm: Add RP2350 architecture support
Hi Bhargav,
Quoted 18 lines · Bhargav Das
arm: Add RP2350 architecture support
Add initial U-Boot architecture support for the RP2350 SoC.
RP2350 specs:
- CPU: Dual-core Arm Cortex-M33 or dual-core RISC-V Hazard3 @ 150MHz.
- Memory: 520 KB on-chip SRAM, 4 MB on-board QSPI flash.Only Arm core support is added here.
The architecture is added under
arch/arm/mach-rp2xxx/.This patch implements early SoC bring-up:
- XOSC (12MHz crystal) startup
-PLL_SYSconfiguration to 150MHz
- CLK_REF/CLK_SYS/CLK_PERI clock switching
- UART1 early console init (115200 8N1)
Quoted 3 lines
Cortex-M33 is an Armv8-M core, but U-Boot does not yet have a
CPU_V8Marchitecture variant. Currently there is noarch_cpu_init()setup for this architecture.
U-Boot already has CPU_V8M, and the Renesas RSIP port (RCAR_64_RSIP) uses it. It selects CPU_V7M_V8M, builds with -march=armv8-m.main and reuses the armv7m CPU directory. Please can you select it instead of CPU_V7M and update the commit message? That gives the compiler the correct architecture, and the PMSAv8 MPU work can go on top later.
Quoted 14 lines
[...]
arch/arm/Kconfig | 7 + arch/arm/Makefile | 2 + arch/arm/include/asm/arch-rp2xxx/rp2350.h | 352 ++++++++++++++++++++++++++++++ arch/arm/mach-rp2xxx/Kconfig | 58 +++++ arch/arm/mach-rp2xxx/Makefile | 4 + arch/arm/mach-rp2xxx/image_def.S | 23 ++ arch/arm/mach-rp2xxx/rp2350.c | 213 ++++++++++++++++++ arch/arm/mach-rp2xxx/u-boot.lds | 94 ++++++++ 8 files changed, 753 insertions(+)
arch/arm/Kconfig config ARCH_STM32 · line 2078
Quoted 3 lines
arch/arm/Kconfig +3
-0@@ -2076,6 +2076,10 @@ config ARCH_STM32 +config ARCH_RP2XXX + bool "Raspberry Pi RP2xxx SoCs" + select CPU_V7M
It would also be worth selecting DM, DM_SERIAL and OF_CONTROL here, as ARCH_STM32 does, rather than relying on the defconfig.
arch/arm/Kconfig config SYS_KWD_CONFIG · line 2342
Quoted 5 lines
arch/arm/Kconfig +3
-0@@ -2336,6 +2340,9 @@ config SYS_KWD_CONFIG + +source "arch/arm/mach-rp2xxx/Kconfig" +
Please drop the extra blank line and put this in alphabetical order with the other mach-* sources. The same applies to the machine- line in arch/arm/Makefile: the comment above that list asks for it to be sorted by CONFIG name, and the other entries use tabs.
arch/arm/mach-rp2xxx/Kconfig line 6
Quoted 8 lines
arch/arm/mach-rp2xxx/Kconfig +6
-0@@ -0,0 +1,58 @@ +config TARGET_RPI_PICO2 + bool "Raspberry Pi Pico 2" + help + Raspberry Pi Pico 2 board based on RP2350 SoC. + +source "board/raspberrypi/pico2/Kconfig"
board/raspberrypi/pico2/Kconfig only arrives in patch 3, so Kconfig fails for every board at this commit. Please can you move TARGET_RPI_PICO2 and this source line into patch 3?
arch/arm/mach-rp2xxx/Kconfig line 4
Quoted 6 lines
arch/arm/mach-rp2xxx/Kconfig +4
-0@@ -0,0 +1,58 @@ + help + Raspberry Pi RP2350 SoC. + Dual-core ARM Cortex-M33 with TrustZone, + 520KB SRAM, supports up to 16MB XIP QSPI flash.
This says 16MB but rp2350.h says the XIP window is 32MB. Which is right?
arch/arm/mach-rp2xxx/Kconfig line 3
Quoted 5 lines
arch/arm/mach-rp2xxx/Kconfig +3
-0@@ -0,0 +1,58 @@ +config RP2350_EARLY_UART + bool "Enable early UART init for RP2350" + default y
If this is disabled, the build fails: CONFIG_RP2350_EARLY_UART_TX_GPIO and friends are not defined, but rp2350.c uses them unconditionally and rp2350_soc_init() always calls rp2350_uart_early_init().
More generally, U-Boot already has CONFIG_DEBUG_UART_PL011 for this, with board_debug_uart_init() doing the pinmux and reset. That would remove the private PL011 register struct, the baud-rate constants and these Kconfig options, and the DM pl01x driver takes over once it probes. What do you think?
arch/arm/mach-rp2xxx/Kconfig line 4
Quoted 6 lines
arch/arm/mach-rp2xxx/Kconfig +4
-0@@ -0,0 +1,58 @@ + help + Select which UART peripheral to use for early debug output. + 0 = UART0 (default; TX=GPIO0, RX=GPIO1) + 1 = UART1 (TX=GPIO4, RX=GPIO5)
The default is actually 1.
arch/arm/mach-rp2xxx/rp2350.c line 1
Quoted 3 lines
arch/arm/mach-rp2xxx/rp2350.c +1
-0@@ -0,0 +1,213 @@ +#include <asm/armv7_mpu.h>
The MPU code has gone, so this include is not needed.
Quoted 4 lines
arch/arm/mach-rp2xxx/rp2350.c +2
-0@@ -0,0 +1,213 @@ +/* Reset PLL */ +rp2350_reg_set (&resets->reset,RESETS_RESET_PLL_SYS );
arch/arm/mach-rp2xxx/rp2350.c line 12
Quoted 10 lines
arch/arm/mach-rp2xxx/rp2350.c +10
-0+rp2350_reg_clr (&resets->reset,RESETS_RESET_PLL_SYS ); +rp2350_wait_reset_done (RESETS_RESET_PLL_SYS ); + +/* Configure: REFDIV=1 */ +writel (1 , &pll->cs); + +/* Power up only VCO and set feedback divisor */ +writel (PLL_PWR_POSTDIVPD |PLL_PWR_DSMPD , &pll->pwr); + +writel (125 , &pll->fbdiv_int);/* VCO = 12 * 125 = 1500MHz */
One thing I'd like to check here. This resets PLL_SYS without first moving clk_sys off it. That is fine from a cold boot, but if U-Boot starts with clk_sys already on the PLL (e.g. chain-loaded from an SDK application), the CPU loses its clock. The SDK's clocks_init() first switches clk_sys and clk_ref to their non-aux sources and waits for SELECTED before touching the PLLs. That would also avoid changing the clk_sys AUXSRC later while the glitchless mux may still be on aux.
Also, the SDK writes FBDIV_INT before powering up the VCO, and the datasheet asks for the same order. Here it is the other way round.
arch/arm/mach-rp2xxx/rp2350.c line 7
Quoted 9 lines
arch/arm/mach-rp2xxx/rp2350.c +7
-0@@ -0,0 +1,213 @@ +/* set AUXSRC = PLL_SYS, leave SRC unchanged */ +clrsetbits_le32 (&clocks->clk_sys_ctrl, (0x7 <<5 ), + (CLK_SYS_SRC_PLL_SYS <<5 )); + +/* switch glitchless mux to aux */ +clrsetbits_le32 (&clocks->clk_sys_ctrl,0x3 ,0x1 ); +clrsetbits_le32 (&clocks->clk_sys_ctrl,0x3 ,CLK_SYS_SRC_AUX );
The second and third writes do the same thing, since CLK_SYS_SRC_AUX is 0x1. Please can you add defines for the SRC/AUXSRC masks and shifts, ENABLE and the SELECTED bits, and use them here and for clk_ref and clk_peri, instead of 0x3, 0x7 << 5, BIT(1) and BIT(11)?
The XOSC and PLL-lock loops have no timeout, unlike rp2350_wait_reset_done(). It would be worth making them consistent.
arch/arm/mach-rp2xxx/u-boot.lds line 6
Quoted 8 lines
arch/arm/mach-rp2xxx/u-boot.lds +6
-0@@ -0,0 +1,94 @@ + .text : + { + *(.vectors) /* Cortex-M33 vector table at image start */ + KEEP(*(.image_def)) /* RP2350 IMAGE_DEF block loop */ + arch/arm/cpu/armv7m/start.o (.text*) + }
Apart from the .image_def line, this is a copy of arch/arm/cpu/u-boot.lds, so it will drift as the common script changes. Could you add KEEP(*(.image_def)) (or a more generic section name) after *(.vectors) in the common script and drop this file?
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 3/4] board: raspberrypi: Add Pico 2 support
Hi Bhargav,
Quoted 9 lines · Bhargav Das
board: raspberrypi: Add Pico 2 support
Add board support for the Raspberry Pi Pico 2.
UART1 console is functional as of now.
misc_init_r()sets a fixed value for the "serial#" environment variable. This fixed value is hardcoded as just a placeholder to confirm thatevn_set()works post-relocation.
Please can you drop this, along with CONFIG_MISC_INIT_R? 'serial#' is meant to be unique to the board, and 'SC1631' is the part number, so every Pico 2 would report the same serial number. Setting it from OTP can come later. (BTW 'evn_set' should be env_set() )
Quoted 13 lines
Signed-off-by Bhargav Das <[email protected]>board/raspberrypi/pico2/Kconfig | 15 +++++++ board/raspberrypi/pico2/MAINTAINERS | 9 +++++ board/raspberrypi/pico2/Makefile | 3 ++ board/raspberrypi/pico2/pico2.c | 81 +++++++++++++++++++++++++++++++++++++ configs/rpi_pico2_defconfig | 29 +++++++++++++ include/configs/rpi_pico2.h | 36 +++++++++++++++++ 6 files changed, 173 insertions(+)
board/raspberrypi/pico2/pico2.c line 9
Quoted 9 lines
board/raspberrypi/pico2/pico2.c +9
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include <dm.h> +#include <env.h> +#include <init.h> +#include <log.h> +#include <asm/global_data.h> +#include <asm/io.h> +#include <asm/arch/rp2350.h> +#include <dm/platform_data/serial_pl01x.h>
As far as I can tell, dm.h, log.h, asm/io.h and serial_pl01x.h are not used. Please can you drop them?
board/raspberrypi/pico2/pico2.c line 7
Quoted 9 lines
board/raspberrypi/pico2/pico2.c +7
-0@@ -0,0 +1,81 @@ +int dram_init (void ) +{ + gd->ram_base =RP2350_SRAM_BASE ; + gd->ram_size =RP2350_SRAM_SIZE ; + +return 0 ; +}
Patch 2 puts the memory node in rp2350.dtsi but nothing reads it. Please can you use fdtdec_setup_mem_size_base() here and fdtdec_setup_memory_banksize() in dram_init_banksize(), as the stm32 boards do, so the size is only defined in the devicetree?
board/raspberrypi/pico2/pico2.c line 6
Quoted 8 lines
board/raspberrypi/pico2/pico2.c +6
-0@@ -0,0 +1,81 @@ +int board_early_init_f (void ) +{ +rp2350_soc_init (); + +return 0 ; +}
The XOSC/PLL/clock setup is the same for any RP2350 board, so I'd expect it to live in mach-rp2xxx (e.g. arch_cpu_init(), which only needs the clock setup, not the MPU code) rather than in each board file. Then any other board using the SoC gets it automatically. What do you think?
board/raspberrypi/pico2/pico2.c line 5
Quoted 7 lines
board/raspberrypi/pico2/pico2.c +5
-0@@ -0,0 +1,81 @@ +int board_init (void ) +{ +/* Nothing special needed post-relocation for basic shell */ +return 0 ; +}
If there is nothing to do, you can drop this function and disable CONFIG_BOARD_INIT in the defconfig.
configs/rpi_pico2_defconfig line 9
Quoted 11 lines
configs/rpi_pico2_defconfig +9
-0@@ -0,0 +1,29 @@ +CONFIG_CMD_TIMER=y +CONFIG_OF_CONTROL=y +# CONFIG_OF_UPSTREAM is not set +CONFIG_OF_EMBED=y +CONFIG_NO_NET=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_PL01X_SERIAL=y +CONFIG_TIMER=y
Patch 4 says that with CONFIG_TIMER enabled but no driver, the 'timer' command and any udelay() crash. Please can you enable CONFIG_TIMER and CONFIG_CMD_TIMER in the timer patch instead, or put the timer patch first, so this commit doesn't produce a board that crashes?
With DM_SERIAL and stdout-path in the devicetree, CONFIG_SPECIFY_CONSOLE_INDEX should not be needed.
include/configs/rpi_pico2.h line 4
Quoted 6 lines
include/configs/rpi_pico2.h +4
-0@@ -0,0 +1,36 @@ +* Flash (XIP): 0x10000000 - 0x103FFFFF (4MB on Pico 2) +* 0x10000000 Second stage bootloader (256 bytes - handled by ROM) +* 0x10000100 U-Boot image starts here +* 0x100F0000 Environment storage
This looks like the RP2040 layout. The RP2350 has no boot2, CONFIG_TEXT_BASE is 0x10000000 and the environment is not stored in flash, so the comment doesn't match the code. Please can you fix or drop it?
Quoted 7 lines
include/configs/rpi_pico2.h +5
-0@@ -0,0 +1,36 @@ +/* Flash geometry */ +#define CFG_SYS_FLASH_BASE RP2350_FLASH_XIP_BASE +#define CFG_SYS_MAX_FLASH_BANKS 1 +#define CFG_SYS_MAX_FLASH_SECT 64 +
include/configs/rpi_pico2.h line 15
Quoted 10 lines
include/configs/rpi_pico2.h +10
-0+/* SRAM */ +#define CFG_SYS_SDRAM_BASE RP2350_SRAM_BASE +#define CFG_SYS_SDRAM_SIZE RP2350_SRAM_SIZE + +/* +* Stack / Malloc +* Stack at top of SRAM, grows downward +* Malloc heap immediately below stack +*/ +#define CFG_SYS_INIT_SP_ADDR RP2350_SRAM_TOP
Most of these are unused. The flash ones only matter with CONFIG_MTD_NOR_FLASH, nothing uses CFG_SYS_SDRAM_SIZE, and CFG_SYS_INIT_SP_ADDR is ignored because the defconfig sets CONFIG_CUSTOM_SYS_INIT_SP_ADDR. As far as I can tell only CFG_SYS_SDRAM_BASE has an effect, so please can you cut this down to just that?
Regards,
Simon
Re: [PATCH v2 3/4] board: raspberrypi: Add Pico 2 support
In reply to a message not in the archivePlease don't reply/thread to old versions of patches/series.
Quoted 237 lines · Bhargav Das
Add board support for the Raspberry Pi Pico 2.
UART1 console is functional as of now.
misc_init_r()sets a fixed value for the "serial#" environment variable. This fixed value is hardcoded as just a placeholder to confirm thatevn_set()works post-relocation.Signed-off-by Bhargav Das <[email protected]>--- board/raspberrypi/pico2/Kconfig | 15 ++++++ board/raspberrypi/pico2/MAINTAINERS | 9 ++++ board/raspberrypi/pico2/Makefile | 3 ++ board/raspberrypi/pico2/pico2.c | 81 +++++++++++++++++++++++++++++ configs/rpi_pico2_defconfig | 29 +++++++++++ include/configs/rpi_pico2.h | 36 +++++++++++++ 6 files changed, 173 insertions(+) create mode 100644 board/raspberrypi/pico2/Kconfig create mode 100644 board/raspberrypi/pico2/MAINTAINERS create mode 100644 board/raspberrypi/pico2/Makefile create mode 100644 board/raspberrypi/pico2/pico2.c create mode 100644 configs/rpi_pico2_defconfig create mode 100644 include/configs/rpi_pico2.hboard/raspberrypi/pico2/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_RPI_PICO2 + +config SYS_SOC + default "rp2xxx" + +config SYS_BOARD + default "pico2" + +config SYS_VENDOR + default "raspberrypi" + +config SYS_CONFIG_NAME + default "rpi_pico2" + +endifboard/raspberrypi/pico2/MAINTAINERS new file +9
-0@@ -0,0 +1,9 @@ +RPI PICO2 BOARD +M: Bhargav Das <[email protected]> +S: Maintained +F: arch/arm/dts/rp2350* +F: arch/arm/include/asm/arch-rp2xxx/ +F: arch/arm/mach-rp2xxx/ +F: board/raspberrypi/pico2/ +F: configs/rpi_pico2_defconfig +F: include/configs/rpi_pico2.hboard/raspberrypi/pico2/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += pico2.oboard/raspberrypi/pico2/pico2.c new file +81
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include <dm.h> +#include <env.h> +#include <init.h> +#include <log.h> +#include <asm/global_data.h> +#include <asm/io.h> +#include <asm/arch/rp2350.h> +#include <dm/platform_data/serial_pl01x.h> + +DECLARE_GLOBAL_DATA_PTR ; + +/* +* dram_init() - Report SRAM size to U-Boot +* +* RP2350 has 520KB of on-chip SRAM. There is no external DRAM. +* U-Boot's "DRAM" in this context is the on-chip SRAM. +* We set the base and size so U-Boot can place its stack, +* heap, and loaded images correctly. +*/ +int dram_init (void ) +{ + gd->ram_base =RP2350_SRAM_BASE ; + gd->ram_size =RP2350_SRAM_SIZE ; + +return 0 ; +} + +/* +* dram_init_banksize() - Set up memory bank info +* +* Single contiguous SRAM bank on RP2350. +*/ +int dram_init_banksize (void ) +{ + gd->dram[0 ].start =RP2350_SRAM_BASE ; + gd->dram[0 ].size =RP2350_SRAM_SIZE ; + +return 0 ; +} + +/* +* board_early_init_f() - Very early board init (before relocation) +* +* Initialize clocks and UART so we have a console early. +* This is called from initcall_run_list() in board_init_f(). +*/ +int board_early_init_f (void ) +{ +rp2350_soc_init (); + +return 0 ; +} + +/* +* board_init() - Post-relocation board init +* +* Called after U-Boot has relocated itself to SRAM. +* Set up anything that needs to happen after relocation. +*/ +int board_init (void ) +{ +/* Nothing special needed post-relocation for basic shell */ +return 0 ; +} + +/* +* misc_init_r() - Miscellaneous late init +* +* Set board-specific environment variables. +* RP2350 has a unique chip ID we can use as serial number. +* (Full OTP reading requires more setup - placeholder for now) +*/ +int misc_init_r (void ) +{ +/* Set a default serial number, rpi pico 2 part no */ +if (!env_get ("serial#" )) +env_set ("serial#" ,"SC1631" ); + +return 0 ; +}configs/rpi_pico2_defconfig new file +29
-0@@ -0,0 +1,29 @@ +CONFIG_ARM=y +CONFIG_SYS_ICACHE_OFF=y +CONFIG_SYS_DCACHE_OFF=y +CONFIG_ARCH_RP2XXX=y +CONFIG_RP2350=y +CONFIG_TARGET_RPI_PICO2=y +CONFIG_TEXT_BASE=0x10000000 +CONFIG_SYS_MALLOC_LEN=0x8000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20082000 +CONFIG_ENV_SIZE=0x1000 +CONFIG_DEFAULT_DEVICE_TREE="rp2350-pico2" +CONFIG_SYS_LOAD_ADDR=0x20010000 +CONFIG_SYS_CUSTOM_LDSCRIPT=y +CONFIG_SYS_LDSCRIPT="arch/arm/mach-rp2xxx/u-boot.lds" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_MISC_INIT_R=y +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="RP2350> " +CONFIG_CMD_TIMER=y +CONFIG_OF_CONTROL=y +# CONFIG_OF_UPSTREAM is not set +CONFIG_OF_EMBED=y +CONFIG_NO_NET=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_PL01X_SERIAL=y +CONFIG_TIMER=yinclude/configs/rpi_pico2.h new file +36
-1@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _RPI_PICO2_H_ +#define _RPI_PICO2_H_ + +#include <asm/arch/rp2350.h> +/* +* Memory layout +* +* Flash (XIP): 0x10000000 - 0x103FFFFF (4MB on Pico 2) +* 0x10000000 Second stage bootloader (256 bytes - handled by ROM) +* 0x10000100 U-Boot image starts here +* 0x100F0000 Environment storage +* +* SRAM: 0x20000000 - 0x20081FFF (520KB) +* U-Boot relocates itself here at runtime +* Stack grows down from top of SRAM +*/ + +/* Flash geometry */ +#define CFG_SYS_FLASH_BASE RP2350_FLASH_XIP_BASE +#define CFG_SYS_MAX_FLASH_BANKS 1 +#define CFG_SYS_MAX_FLASH_SECT 64 + +/* SRAM */ +#define CFG_SYS_SDRAM_BASE RP2350_SRAM_BASE +#define CFG_SYS_SDRAM_SIZE RP2350_SRAM_SIZE + +/* +* Stack / Malloc +* Stack at top of SRAM, grows downward +* Malloc heap immediately below stack +*/ +#define CFG_SYS_INIT_SP_ADDR RP2350_SRAM_TOP + +#endif /* _RPI_PICO2_H_ */ --2.43.0
Re: [PATCH v2 3/4] board: raspberrypi: Add Pico 2 support
Hmm I already reviewed v2, but haven't seen it go in so I went hunting and found the wrong thing.
Quoted 241 lines · Peter Robinson
Please don't reply/thread to old versions of patches/series.
Quoted 237 lines · Bhargav Das
Add board support for the Raspberry Pi Pico 2.
UART1 console is functional as of now.
misc_init_r()sets a fixed value for the "serial#" environment variable. This fixed value is hardcoded as just a placeholder to confirm thatevn_set()works post-relocation.Signed-off-by Bhargav Das <[email protected]>--- board/raspberrypi/pico2/Kconfig | 15 ++++++ board/raspberrypi/pico2/MAINTAINERS | 9 ++++ board/raspberrypi/pico2/Makefile | 3 ++ board/raspberrypi/pico2/pico2.c | 81 +++++++++++++++++++++++++++++ configs/rpi_pico2_defconfig | 29 +++++++++++ include/configs/rpi_pico2.h | 36 +++++++++++++ 6 files changed, 173 insertions(+) create mode 100644 board/raspberrypi/pico2/Kconfig create mode 100644 board/raspberrypi/pico2/MAINTAINERS create mode 100644 board/raspberrypi/pico2/Makefile create mode 100644 board/raspberrypi/pico2/pico2.c create mode 100644 configs/rpi_pico2_defconfig create mode 100644 include/configs/rpi_pico2.hboard/raspberrypi/pico2/Kconfig new file +15
-0@@ -0,0 +1,15 @@ +if TARGET_RPI_PICO2 + +config SYS_SOC + default "rp2xxx" + +config SYS_BOARD + default "pico2" + +config SYS_VENDOR + default "raspberrypi" + +config SYS_CONFIG_NAME + default "rpi_pico2" + +endifboard/raspberrypi/pico2/MAINTAINERS new file +9
-0@@ -0,0 +1,9 @@ +RPI PICO2 BOARD +M: Bhargav Das <[email protected]> +S: Maintained +F: arch/arm/dts/rp2350* +F: arch/arm/include/asm/arch-rp2xxx/ +F: arch/arm/mach-rp2xxx/ +F: board/raspberrypi/pico2/ +F: configs/rpi_pico2_defconfig +F: include/configs/rpi_pico2.hboard/raspberrypi/pico2/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-y += pico2.oboard/raspberrypi/pico2/pico2.c new file +81
-0@@ -0,0 +1,81 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include <dm.h> +#include <env.h> +#include <init.h> +#include <log.h> +#include <asm/global_data.h> +#include <asm/io.h> +#include <asm/arch/rp2350.h> +#include <dm/platform_data/serial_pl01x.h> + +DECLARE_GLOBAL_DATA_PTR ; + +/* +* dram_init() - Report SRAM size to U-Boot +* +* RP2350 has 520KB of on-chip SRAM. There is no external DRAM. +* U-Boot's "DRAM" in this context is the on-chip SRAM. +* We set the base and size so U-Boot can place its stack, +* heap, and loaded images correctly. +*/ +int dram_init (void ) +{ + gd->ram_base =RP2350_SRAM_BASE ; + gd->ram_size =RP2350_SRAM_SIZE ; + +return 0 ; +} + +/* +* dram_init_banksize() - Set up memory bank info +* +* Single contiguous SRAM bank on RP2350. +*/ +int dram_init_banksize (void ) +{ + gd->dram[0 ].start =RP2350_SRAM_BASE ; + gd->dram[0 ].size =RP2350_SRAM_SIZE ; + +return 0 ; +} + +/* +* board_early_init_f() - Very early board init (before relocation) +* +* Initialize clocks and UART so we have a console early. +* This is called from initcall_run_list() in board_init_f(). +*/ +int board_early_init_f (void ) +{ +rp2350_soc_init (); + +return 0 ; +} + +/* +* board_init() - Post-relocation board init +* +* Called after U-Boot has relocated itself to SRAM. +* Set up anything that needs to happen after relocation. +*/ +int board_init (void ) +{ +/* Nothing special needed post-relocation for basic shell */ +return 0 ; +} + +/* +* misc_init_r() - Miscellaneous late init +* +* Set board-specific environment variables. +* RP2350 has a unique chip ID we can use as serial number. +* (Full OTP reading requires more setup - placeholder for now) +*/ +int misc_init_r (void ) +{ +/* Set a default serial number, rpi pico 2 part no */ +if (!env_get ("serial#" )) +env_set ("serial#" ,"SC1631" ); + +return 0 ; +}configs/rpi_pico2_defconfig new file +29
-0@@ -0,0 +1,29 @@ +CONFIG_ARM=y +CONFIG_SYS_ICACHE_OFF=y +CONFIG_SYS_DCACHE_OFF=y +CONFIG_ARCH_RP2XXX=y +CONFIG_RP2350=y +CONFIG_TARGET_RPI_PICO2=y +CONFIG_TEXT_BASE=0x10000000 +CONFIG_SYS_MALLOC_LEN=0x8000 +CONFIG_NR_DRAM_BANKS=1 +CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y +CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x20082000 +CONFIG_ENV_SIZE=0x1000 +CONFIG_DEFAULT_DEVICE_TREE="rp2350-pico2" +CONFIG_SYS_LOAD_ADDR=0x20010000 +CONFIG_SYS_CUSTOM_LDSCRIPT=y +CONFIG_SYS_LDSCRIPT="arch/arm/mach-rp2xxx/u-boot.lds" +CONFIG_BOARD_EARLY_INIT_F=y +CONFIG_MISC_INIT_R=y +CONFIG_HUSH_PARSER=y +CONFIG_SYS_PROMPT="RP2350> " +CONFIG_CMD_TIMER=y +CONFIG_OF_CONTROL=y +# CONFIG_OF_UPSTREAM is not set +CONFIG_OF_EMBED=y +CONFIG_NO_NET=y +CONFIG_SPECIFY_CONSOLE_INDEX=y +CONFIG_DM_SERIAL=y +CONFIG_PL01X_SERIAL=y +CONFIG_TIMER=yinclude/configs/rpi_pico2.h new file +36
-1@@ -0,0 +1,36 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ + +#ifndef _RPI_PICO2_H_ +#define _RPI_PICO2_H_ + +#include <asm/arch/rp2350.h> +/* +* Memory layout +* +* Flash (XIP): 0x10000000 - 0x103FFFFF (4MB on Pico 2) +* 0x10000000 Second stage bootloader (256 bytes - handled by ROM) +* 0x10000100 U-Boot image starts here +* 0x100F0000 Environment storage +* +* SRAM: 0x20000000 - 0x20081FFF (520KB) +* U-Boot relocates itself here at runtime +* Stack grows down from top of SRAM +*/ + +/* Flash geometry */ +#define CFG_SYS_FLASH_BASE RP2350_FLASH_XIP_BASE +#define CFG_SYS_MAX_FLASH_BANKS 1 +#define CFG_SYS_MAX_FLASH_SECT 64 + +/* SRAM */ +#define CFG_SYS_SDRAM_BASE RP2350_SRAM_BASE +#define CFG_SYS_SDRAM_SIZE RP2350_SRAM_SIZE + +/* +* Stack / Malloc +* Stack at top of SRAM, grows downward +* Malloc heap immediately below stack +*/ +#define CFG_SYS_INIT_SP_ADDR RP2350_SRAM_TOP + +#endif /* _RPI_PICO2_H_ */ --2.43.0
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 2/4] arm: dts: Add RP2350 device tree
Hi Bhargav,
Quoted 7 lines · Bhargav Das
arm: dts: Add RP2350 device tree
Add device tree for the RP2350 SoC (
rp2350.dtsi) and the Raspberry Pi Pico 2 board (rp2350-pico2.dts).
rpi_pico2_defconfigselectsCONFIG_OF_EMBED, building the dtb from u-boot's source rather thanCONFIG_OF_UPSTREAM.
These are two separate choices. OF_UPSTREAM is off because Linux has no RP2350 devicetree, so please say that here. OF_EMBED is different:
its Kconfig help says "Boards in the mainline U-Boot tree should not use it". OF_SEPARATE should work fine, since the dtb is just appended to u-boot.bin and picotool can still convert and load the result. Please can you switch the defconfig in patch 3 and drop this paragraph?
Quoted 14 lines
Currently for the uart nodes 'clock' property is used instead of 'clocks' as there is no dm based clock driver. This will be updated once a clk driver is introduced.
Signed-off-by Bhargav Das <[email protected]>arch/arm/dts/Makefile | 1 + arch/arm/dts/rp2350-pico2.dts | 25 +++++++++++++++++++++++++ arch/arm/dts/rp2350.dtsi | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+)
arch/arm/dts/rp2350-pico2.dts line 1
Quoted 1 line
arch/arm/dts/rp2350-pico2.dts +1
-0@@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0+
The .dtsi is '(GPL-2.0-only OR MIT)' but the board .dts is GPL-2.0+. Please can you use the same licence for both? The dual licence is normal for devicetree files.
arch/arm/dts/rp2350.dtsi line 6
Quoted 8 lines
arch/arm/dts/rp2350.dtsi +6
-0@@ -0,0 +1,37 @@ + uart1: serial@40078000 { + compatible = "arm,pl011", "arm,primecell"; + reg = <0x40078000 0x1000>; + clock = <150000000>; /* CLK_PERI = clk_sys 150MHz */ + status = "disabled"; + };
You don't need a real clock driver to use 'clocks'. You could add a 'fixed-clock' node for clk_peri with clock-frequency = <150000000> and point the UARTs at it with 'clocks = <&clk_peri>'. pl01x_serial_of_to_plat() already handles this through clk_get_by_index(), so you would just need CONFIG_CLK and CONFIG_CLK_FIXED_RATE, plus bootph-all on the clock node so it is available before relocation. That gives a standard binding now, and when the clock driver arrives only the phandle needs to change. What do you think?
Regards,
Simon
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH v2 4/4] arm: rp2350: Add driver for RP2350 hardware timers
Hi Bhargav,
Quoted 4 lines · Bhargav Das
arm: rp2350: Add driver for RP2350 hardware timers
Implement a Driver Model (DM) timer driver for the RP2350 SoC.
Quoted 8 lines
Previously,
CONFIG_TIMERwas enabled purely to satisfy compilation and linker requirements. Because the platform relied on generic fallback definitions, invoking thetimercommand or any timing-related operation (such as delays or timeouts) caused the system to crash.The early system tick generation is initialized in
mach-rp2xxx/rp2350.cbefore the main driver probes. Both timer0 and timer1 have been verified to work correctly. Enabled timer0 by default in the device tree.
Please use the imperative ('Enable timer0...') and drop the backticks.
Quoted 19 lines
The early system tick generation is initialized in
mach-rp2xxx/rp2350.cbefore the main driver probes. Both timer0 and timer1 have been verified to work correctly. Enabled timer0 by default in the device tree.Signed-off-by Bhargav Das <[email protected]>arch/arm/dts/rp2350-pico2.dts | 4 ++ arch/arm/dts/rp2350.dtsi | 14 +++++++ arch/arm/include/asm/arch-rp2xxx/rp2350.h | 17 ++++++++- arch/arm/mach-rp2xxx/rp2350.c | 31 ++++++++++++++++ configs/rpi_pico2_defconfig | 1 + drivers/timer/Kconfig | 8 ++++ drivers/timer/Makefile | 1 + drivers/timer/rp2350_timer.c | 62 +++++++++++++++++++++++++++++++ 8 files changed, 137 insertions(+), 1 deletion(-)
arch/arm/dts/rp2350.dtsi line 38
Quoted 6 lines
arch/arm/dts/rp2350.dtsi +6
-0@@ -33,5 +33,19 @@ + timer0: timer@400b0000 { + compatible = "raspberrypi,rp2350-timer"; + reg = <0x400b0000 0x1000>; + clock-frequency = <1000000>; /* 1MHz microsecond tick */ + status = "disabled"; + };
Without bootph-all the timer is not bound before relocation, so if anything calls udelay() or get_timer() in board_init_f(), dm_timer_init() fails and get_ticks() panics. It may be fine today, but it is easy to trip over, so it would be worth adding bootph-all (or bootph-pre-ram).
Quoted 12 lines
arch/arm/mach-rp2xxx/rp2350.c +10
-0@@ -190,6 +190,35 @@ void rp2350_uart_early_init(void) +void rp2350_timer_init (void ) +{ +struct rp2350_resets_regs *resets =RP2350_RESETS ; + +/* Release TIMER0 from reset */ +rp2350_reg_clr (&resets->reset,RESETS_RESET_TIMER0 ); +rp2350_wait_reset_done (RESETS_RESET_TIMER0 ); + +/* Release TIMER1 from reset */ +rp2350_reg_clr (&resets->reset,RESETS_RESET_TIMER1 );
arch/arm/mach-rp2xxx/rp2350.c void rp2350_uart_early_init(void) · line 209
Quoted 10 lines
arch/arm/mach-rp2xxx/rp2350.c +10
-0+rp2350_wait_reset_done (RESETS_RESET_TIMER1 ); + +/* Start the TIMER0 tick generator at 1MHz */ +writel (RP2350_XOSC_HZ /1000000 ,RP2350_TICKS_BASE +RP2350_TICKS_TIMER0_CYCLES ); +writel (TICKS_CTRL_ENABLE ,RP2350_TICKS_BASE +RP2350_TICKS_TIMER0_CTRL ); + +/* Start the TIMER1 tick generator at 1MHz */ +writel (RP2350_XOSC_HZ /1000000 ,RP2350_TICKS_BASE +RP2350_TICKS_TIMER1_CYCLES ); +writel (TICKS_CTRL_ENABLE ,RP2350_TICKS_BASE +RP2350_TICKS_TIMER1_CTRL ); +}
This starts both timers and both tick generators unconditionally, though only timer0 is enabled in the DT. The 1MHz rate is also hard-coded twice, here and in the clock-frequency property, so neither can change without the other. I suggest doing this in rp2350_timer_probe() for the timer being probed only, computing CYCLES from the uclass clock_rate (which the uclass already reads from clock-frequency). Then rp2350_timer_init() and its call in rp2350_soc_init() can go. What do you think?
arch/arm/mach-rp2xxx/rp2350.c void rp2350_soc_init(void) · line 240
Quoted 4 lines
arch/arm/mach-rp2xxx/rp2350.c +2
-0@@ -210,4 +239,6 @@ void rp2350_soc_init(void) +/* Start the 1MHz microsecond timer (TIMER0) */ +rp2350_timer_init ();
The comment says TIMER0, but this starts both timers.
drivers/timer/rp2350_timer.c line 3
Quoted 5 lines
drivers/timer/rp2350_timer.c +3
-0@@ -0,0 +1,62 @@ + priv->base =dev_read_addr_ptr (dev); +if (!priv->base) +return -EINVAL ;
Once the reset and tick set-up moves here, the reset bit and TICKS offsets need to come from somewhere other than the hard-coded TIMER0/TIMER1 macros. The driver data in rp2350_timer_ids[] or a resets/ticks index in the DT would do it.
Regards,
Simon