diff mbox series

[v2,3/4] board: raspberrypi: Add Pico 2 support

Message ID 20260902211501.127915-4-bhargavdas100@gmail.com
State New
Delegated to: Peter Robinson
Headers show
Series Add initial support for Raspberry Pi Pico 2 (RP2350) | expand

Commit Message

Bhargav Das Sept. 2, 2026, 9:14 p.m. UTC
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 that
evn_set() works post-relocation.

Signed-off-by: Bhargav Das <bhargavdas100@gmail.com>
---
 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.h
diff mbox series

Patch

diff --git a/board/raspberrypi/pico2/Kconfig b/board/raspberrypi/pico2/Kconfig
new file mode 100644
index 00000000000..eb06fe6baeb
--- /dev/null
+++ b/board/raspberrypi/pico2/Kconfig
@@ -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
diff --git a/board/raspberrypi/pico2/MAINTAINERS b/board/raspberrypi/pico2/MAINTAINERS
new file mode 100644
index 00000000000..e081f894e00
--- /dev/null
+++ b/board/raspberrypi/pico2/MAINTAINERS
@@ -0,0 +1,9 @@ 
+RPI PICO2 BOARD
+M:	Bhargav Das <bhargavdas100@gmail.com>
+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
diff --git a/board/raspberrypi/pico2/Makefile b/board/raspberrypi/pico2/Makefile
new file mode 100644
index 00000000000..a2929172d0a
--- /dev/null
+++ b/board/raspberrypi/pico2/Makefile
@@ -0,0 +1,3 @@ 
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y	+= pico2.o
diff --git a/board/raspberrypi/pico2/pico2.c b/board/raspberrypi/pico2/pico2.c
new file mode 100644
index 00000000000..c11e7ea2e55
--- /dev/null
+++ b/board/raspberrypi/pico2/pico2.c
@@ -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;
+}
diff --git a/configs/rpi_pico2_defconfig b/configs/rpi_pico2_defconfig
new file mode 100644
index 00000000000..51e4361fdbd
--- /dev/null
+++ b/configs/rpi_pico2_defconfig
@@ -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
diff --git a/include/configs/rpi_pico2.h b/include/configs/rpi_pico2.h
new file mode 100644
index 00000000000..b5236320344
--- /dev/null
+++ b/include/configs/rpi_pico2.h
@@ -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_ */