Skip to contentSkip to conversation

board: rockchip: Add Radxa ROCK 4D

PATCH In review Jonas Karlman 2 participants 11 messages Oct 19, 2025 – Oct 26, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v4 cover board: rockchip: Add Radxa ROCK 4D

This series add initial support for the Raxda ROCK 4D board, running from SPI flash, booting OS from SD-card and using Ethernet has been tested.

It also adds a helper function to read and translate the new bootsource ids reported by the BootROM of RK3576 to help support booting from SPI flash.

Kconfig options for PCIe, NVMe and USB has been enabled and is now working with the picked DT commits from the v6.17-rc1-dts tag.

Changes in v4:
- Rebase on top of master with v6.17-dts tag merged

Changes in v3:
- Implement read_brom_bootsource_id() for RK3528
- Add a short code comment about the re-mapping of bootsource id
- Add fspi1m1 pinctrl bootph- props to SoC u-boot.dtsi
- Drop the incomplete support for FSPI1_M0
- Pick related DT changes that now have landed in v6.17-rc1-dts tag
- Drop the now unneeded reset-gpios prop rename workaround
- Rebase on top of u-boot-rockchip-20250831 tag

Change in v2:
- Add comment about the reset-gpios prop rename in board u-boot.dtsi

Jon Lin (1):
spi: rockchip_sfc: Support sclk_x2 version

Jonas Karlman (4):
rockchip: spl: Add a read_brom_bootsource_id() helper
rockchip: rk3528: Implement read_brom_bootsource_id()
rockchip: rk3576: Add SPI Flash boot support
board: rockchip: Add Radxa ROCK 4D

 arch/arm/dts/rk3576-rock-4d-u-boot.dtsi      | 10 +++
 arch/arm/dts/rk3576-u-boot.dtsi              | 46 +++++++++++++
 arch/arm/include/asm/arch-rockchip/bootrom.h |  2 +
 arch/arm/mach-rockchip/rk3528/rk3528.c       | 15 +++++
 arch/arm/mach-rockchip/rk3576/MAINTAINERS    |  6 ++
 arch/arm/mach-rockchip/rk3576/rk3576.c       | 25 +++++++
 arch/arm/mach-rockchip/spl.c                 |  7 +-
 configs/rock-4d-rk3576_defconfig             | 68 ++++++++++++++++++++
 doc/board/rockchip/rockchip.rst              |  1 +
 drivers/spi/rockchip_sfc.c                   | 13 +++-
 10 files changed, 191 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/dts/rk3576-rock-4d-u-boot.dtsi
 create mode 100644 configs/rock-4d-rk3576_defconfig
Signature · 1 line
2.51.0
#1 lore raw

PATCH v4 1/5 spi: rockchip_sfc: Support sclk_x2 version

From: Jon Lin <[email protected]>

SFC after version 8 supports dtr mode, so the IO is the binary output of the controller clock.

---
v4: No change
v3: No change
v2: No change

---
 drivers/spi/rockchip_sfc.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/spi/rockchip_sfc.c +12 -1
index 73738ab26d33..60e74117057a 100644
@@ -108,6 +108,7 @@
 #define  SFC_VER_3			0x3
 #define  SFC_VER_4			0x4
 #define  SFC_VER_5			0x5
+#define  SFC_VER_8			0x8
 
 /* Delay line controller resiter */
 #define SFC_DLL_CTRL0			0x3C
@@ -589,6 +590,16 @@ static int rockchip_sfc_adjust_op_size(struct spi_slave *mem, struct spi_mem_op
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(CLK)
+static int rockchip_sfc_clk_set_rate(struct rockchip_sfc *sfc, uint speed)
+{
+	if (sfc->version >= SFC_VER_8)
+		return clk_set_rate(&sfc->clk, speed * 2);
+	else
+		return clk_set_rate(&sfc->clk, speed);
+}
+#endif
+
 static int rockchip_sfc_set_speed(struct udevice *bus, uint speed)
 {
 	struct rockchip_sfc *sfc = dev_get_plat(bus);
@@ -600,7 +611,7 @@ static int rockchip_sfc_set_speed(struct udevice *bus, uint speed)
 		return 0;
 
 #if CONFIG_IS_ENABLED(CLK)
-	int ret = clk_set_rate(&sfc->clk, speed);
+	int ret = rockchip_sfc_clk_set_rate(sfc, speed);
 
 	if (ret < 0) {
 		dev_err(sfc->dev, "set_freq=%dHz fail, check if it's the cru support level\n",
Signature · 1 line
2.51.0
Reviewed-by on v4 1/5
#2 lore raw

Re: [PATCH v4 1/5] spi: rockchip_sfc: Support sclk_x2 version

Quoted 7 lines · Jonas Karlman

From: Jon Lin <[email protected]>

SFC after version 8 supports dtr mode, so the IO is the binary output of the controller clock.

Thanks,
- Kever

Quoted 46 lines

---
v4: No change
v3: No change
v2: No change

---
  drivers/spi/rockchip_sfc.c | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)
drivers/spi/rockchip_sfc.c +12 -1
index 73738ab26d33..60e74117057a 100644
@@ -108,6 +108,7 @@
  #define  SFC_VER_3			0x3
  #define  SFC_VER_4			0x4
  #define  SFC_VER_5			0x5
+#define  SFC_VER_8			0x8
 
  /* Delay line controller resiter */
  #define SFC_DLL_CTRL0			0x3C
@@ -589,6 +590,16 @@ static int rockchip_sfc_adjust_op_size(struct spi_slave *mem, struct spi_mem_op
  	return 0;
  }
 
+#if CONFIG_IS_ENABLED(CLK)
+static int rockchip_sfc_clk_set_rate(struct rockchip_sfc *sfc, uint speed)
+{
+	if (sfc->version >= SFC_VER_8)
+		return clk_set_rate(&sfc->clk, speed * 2);
+	else
+		return clk_set_rate(&sfc->clk, speed);
+}
+#endif
+
  static int rockchip_sfc_set_speed(struct udevice *bus, uint speed)
  {
  	struct rockchip_sfc *sfc = dev_get_plat(bus);
@@ -600,7 +611,7 @@ static int rockchip_sfc_set_speed(struct udevice *bus, uint speed)
  		return 0;
 
  #if CONFIG_IS_ENABLED(CLK)
-	int ret = clk_set_rate(&sfc->clk, speed);
+	int ret = rockchip_sfc_clk_set_rate(sfc, speed);
 
  	if (ret < 0) {
  		dev_err(sfc->dev, "set_freq=%dHz fail, check if it's the cru support level\n",
Signature · 7 lines
Thanks & Best regards,
  Kever Yang
**************************************************************************************************
杨凯  市场部             Kever Yang      Marketing Department
瑞芯微电子股份有限公司                Rockchip Electronics Co.,Ltd。
地址:福建省福州市铜盘路软件大道89号软件园A区18号楼 (350003)
Addr : No.18 Building,A District,No.89,Fuzhou Software Boulevard,Fuzhou,Fujian,PRC
#3 lore raw

PATCH v4 2/5 rockchip: spl: Add a read_brom_bootsource_id() helper

In reply to Jonas Karlman

The bootsource ids reported by BootROM of RK3528 and RK3576 for e.g. SPI NOR and USB differs slightly compared to prior SoCs:

- Booting from sfc0 (ROCK 4D) report the normal bootsource id 0x3.
- Booting from sfc1 M1 (NanoPi M5) report a new bootsource id 0x23.
- Booting from sfc1 M0 has not been tested (no board using this config).
- Booting from USB report a new bootsource id 0x81 on RK3528 and RK3576.

Add a helper function to read the bootsource id. This helper function will be used to translate the new values to the common BROM_BOOTSOURCE enum values on RK3528 and RK3576.

---
v4: No change
v3: Mention RK3528 in commit message
v2: No change

---
 arch/arm/include/asm/arch-rockchip/bootrom.h | 2 ++
 arch/arm/mach-rockchip/spl.c                 | 7 ++++++-
 2 files changed, 8 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-rockchip/bootrom.h +2 -0
index e736772fda75..b15938c021d6 100644
@@ -64,4 +64,6 @@ extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1];
  */
 #define BROM_BOOTSOURCE_ID_ADDR   (CFG_IRAM_BASE + 0x10)
 
+u32 read_brom_bootsource_id(void);
+
 #endif
arch/arm/mach-rockchip/spl.c +6 -1
index f4d29bbdd17e..1ce3a3b05547 100644
@@ -31,6 +31,11 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 __weak const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
 };
 
+__weak u32 read_brom_bootsource_id(void)
+{
+	return readl(BROM_BOOTSOURCE_ID_ADDR);
+}
+
 const char *board_spl_was_booted_from(void)
 {
 	static u32 brom_bootsource_id_cache = BROM_BOOTSOURCE_UNKNOWN;
@@ -40,7 +45,7 @@ const char *board_spl_was_booted_from(void)
 	if (brom_bootsource_id_cache != BROM_BOOTSOURCE_UNKNOWN)
 		bootdevice_brom_id = brom_bootsource_id_cache;
 	else
-		bootdevice_brom_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+		bootdevice_brom_id = read_brom_bootsource_id();
 
 	if (bootdevice_brom_id < ARRAY_SIZE(boot_devices))
 		bootdevice_ofpath = boot_devices[bootdevice_brom_id];
Signature · 1 line
2.51.0
Reviewed-by on v4 2/5
#4 lore raw

Re: [PATCH v4 2/5] rockchip: spl: Add a read_brom_bootsource_id() helper

Quoted 8 lines · Jonas Karlman

The bootsource ids reported by BootROM of RK3528 and RK3576 for e.g. SPI NOR and USB differs slightly compared to prior SoCs:

- Booting from sfc0 (ROCK 4D) report the normal bootsource id 0x3.
- Booting from sfc1 M1 (NanoPi M5) report a new bootsource id 0x23.
- Booting from sfc1 M0 has not been tested (no board using this config).
- Booting from USB report a new bootsource id 0x81 on RK3528 and RK3576.

Quoted 5 lines

Add a helper function to read the bootsource id. This helper function will be used to translate the new values to the common BROM_BOOTSOURCE enum values on RK3528 and RK3576.

Thanks,
- Kever

Quoted 45 lines

---
v4: No change
v3: Mention RK3528 in commit message
v2: No change

---
  arch/arm/include/asm/arch-rockchip/bootrom.h | 2 ++
  arch/arm/mach-rockchip/spl.c                 | 7 ++++++-
  2 files changed, 8 insertions(+), 1 deletion(-)
arch/arm/include/asm/arch-rockchip/bootrom.h +2 -0
index e736772fda75..b15938c021d6 100644
@@ -64,4 +64,6 @@ extern const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1];
   */
  #define BROM_BOOTSOURCE_ID_ADDR   (CFG_IRAM_BASE + 0x10)
 
+u32 read_brom_bootsource_id(void);
+
  #endif
arch/arm/mach-rockchip/spl.c +6 -1
index f4d29bbdd17e..1ce3a3b05547 100644
@@ -31,6 +31,11 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
  __weak const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
  };
 
+__weak u32 read_brom_bootsource_id(void)
+{
+	return readl(BROM_BOOTSOURCE_ID_ADDR);
+}
+
  const char *board_spl_was_booted_from(void)
  {
  	static u32 brom_bootsource_id_cache = BROM_BOOTSOURCE_UNKNOWN;
@@ -40,7 +45,7 @@ const char *board_spl_was_booted_from(void)
  	if (brom_bootsource_id_cache != BROM_BOOTSOURCE_UNKNOWN)
  		bootdevice_brom_id = brom_bootsource_id_cache;
  	else
-		bootdevice_brom_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+		bootdevice_brom_id = read_brom_bootsource_id();
 
  	if (bootdevice_brom_id < ARRAY_SIZE(boot_devices))
  		bootdevice_ofpath = boot_devices[bootdevice_brom_id];
Signature · 7 lines
Thanks & Best regards,
  Kever Yang
**************************************************************************************************
杨凯  市场部             Kever Yang      Marketing Department
瑞芯微电子股份有限公司                Rockchip Electronics Co.,Ltd。
地址:福建省福州市铜盘路软件大道89号软件园A区18号楼 (350003)
Addr : No.18 Building,A District,No.89,Fuzhou Software Boulevard,Fuzhou,Fujian,PRC
#5 lore raw

PATCH v4 3/5 rockchip: rk3528: Implement read_brom_bootsource_id()

In reply to Jonas Karlman

The bootsource ids reported by BootROM of RK3528 for e.g. USB differs compared to prior SoCs:

- Booting from USB report a new bootsource id 0x81.

Add a RK3528 specific read_brom_bootsource_id() function to help decode this new bootsource id value to help support booting from USB on RK3528.

---
v4: No change
v3: New patch to map USB bootsource id on RK3528

---
 arch/arm/mach-rockchip/rk3528/rk3528.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
arch/arm/mach-rockchip/rk3528/rk3528.c +15 -0
index f9bfc445b857..57ead0006f1f 100644
@@ -49,6 +49,21 @@ void board_debug_uart_init(void)
 {
 }
 
+u32 read_brom_bootsource_id(void)
+{
+	u32 bootsource_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+
+	/* Re-map the raw value read from reg to an existing BROM_BOOTSOURCE
+	 * enum value to avoid having to create a larger boot_devices table.
+	 */
+	if (bootsource_id == 0x81)
+		return BROM_BOOTSOURCE_USB;
+	else if (bootsource_id > BROM_LAST_BOOTSOURCE)
+		log_debug("Unknown bootsource %x\n", bootsource_id);
+
+	return bootsource_id;
+}
+
 int arch_cpu_init(void)
 {
 	u32 val;
Signature · 1 line
2.51.0
Reviewed-by on v4 3/5
#6 lore raw

Re: [PATCH v4 3/5] rockchip: rk3528: Implement read_brom_bootsource_id()

Quoted 9 lines · Jonas Karlman

The bootsource ids reported by BootROM of RK3528 for e.g. USB differs compared to prior SoCs:

- Booting from USB report a new bootsource id 0x81.

Add a RK3528 specific read_brom_bootsource_id() function to help decode this new bootsource id value to help support booting from USB on RK3528.

Thanks,
- Kever

Quoted 33 lines

---
v4: No change
v3: New patch to map USB bootsource id on RK3528

---
  arch/arm/mach-rockchip/rk3528/rk3528.c | 15 +++++++++++++++
  1 file changed, 15 insertions(+)
arch/arm/mach-rockchip/rk3528/rk3528.c +15 -0
index f9bfc445b857..57ead0006f1f 100644
@@ -49,6 +49,21 @@ void board_debug_uart_init(void)
  {
  }
 
+u32 read_brom_bootsource_id(void)
+{
+	u32 bootsource_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+
+	/* Re-map the raw value read from reg to an existing BROM_BOOTSOURCE
+	 * enum value to avoid having to create a larger boot_devices table.
+	 */
+	if (bootsource_id == 0x81)
+		return BROM_BOOTSOURCE_USB;
+	else if (bootsource_id > BROM_LAST_BOOTSOURCE)
+		log_debug("Unknown bootsource %x\n", bootsource_id);
+
+	return bootsource_id;
+}
+
  int arch_cpu_init(void)
  {
  	u32 val;
Signature · 7 lines
Thanks & Best regards,
  Kever Yang
**************************************************************************************************
杨凯  市场部             Kever Yang      Marketing Department
瑞芯微电子股份有限公司                Rockchip Electronics Co.,Ltd。
地址:福建省福州市铜盘路软件大道89号软件园A区18号楼 (350003)
Addr : No.18 Building,A District,No.89,Fuzhou Software Boulevard,Fuzhou,Fujian,PRC
#7 lore raw

PATCH v4 4/5 rockchip: rk3576: Add SPI Flash boot support

In reply to Jonas Karlman

The bootsource ids reported by BootROM of RK3576 for SPI NOR and USB differs slightly compared to prior SoCs:

- Booting from sfc0 (ROCK 4D) report the normal bootsource id 0x3.
- Booting from sfc1 M1 (NanoPi M5) report a new bootsource id 0x23.
- Booting from sfc1 M0 has not been tested (no board using this config).
- Booting from USB report a new bootsource id 0x81.

Add a RK3576 specific read_brom_bootsource_id() function to help decode the new bootsource id values and the required boot_devices mapping of sfc0 and sfc1 to help support booting from SPI flash on RK3576.

---
v4: No change

Changes in v3:
- Add fspi1m1 pinctrl bootph- props to SoC u-boot.dtsi
- Drop the incomplete support for FSPI1_M0
- Add a short code comment about the re-mapping of bootsource id

v2: No change

---
 arch/arm/dts/rk3576-u-boot.dtsi        | 46 ++++++++++++++++++++++++++
 arch/arm/mach-rockchip/rk3576/rk3576.c | 25 ++++++++++++++
 2 files changed, 71 insertions(+)
arch/arm/dts/rk3576-u-boot.dtsi +46 -0
index fb5a107f47d9..dc3771b556a3 100644
@@ -6,6 +6,11 @@
 #include "rockchip-u-boot.dtsi"
 
 / {
+	aliases {
+		spi5 = &sfc0;
+		spi6 = &sfc1;
+	};
+
 	chosen {
 		u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
 	};
@@ -16,6 +21,17 @@
 	};
 };
 
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+&binman {
+	simple-bin-spi {
+		mkimage {
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+			offset = <0x8000>;
+		};
+	};
+};
+#endif
+
 &cru {
 	bootph-all;
 };
@@ -45,6 +61,26 @@
 	bootph-some-ram;
 };
 
+&fspi0_csn0 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&fspi0_pins {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&fspi1m1_csn0 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&fspi1m1_pins {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
 &ioc_grf {
 	bootph-all;
 };
@@ -116,6 +152,16 @@
 	bootph-some-ram;
 };
 
+&sfc0 {
+	bootph-some-ram;
+	u-boot,spl-sfc-no-dma;
+};
+
+&sfc1 {
+	bootph-some-ram;
+	u-boot,spl-sfc-no-dma;
+};
+
 &sys_grf {
 	bootph-all;
 };
arch/arm/mach-rockchip/rk3576/rk3576.c +25 -0
index a6c2fbdc4840..a1e8a7572fa4 100644
@@ -36,8 +36,15 @@
 #define USB_GRF_BASE		0x2601E000
 #define USB3OTG0_CON1		0x0030
 
+enum {
+	BROM_BOOTSOURCE_FSPI0 = 3,
+	BROM_BOOTSOURCE_FSPI1_M1 = 6,
+};
+
 const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
 	[BROM_BOOTSOURCE_EMMC] = "/soc/mmc@2a330000",
+	[BROM_BOOTSOURCE_FSPI0] = "/soc/spi@2a340000/flash@0",
+	[BROM_BOOTSOURCE_FSPI1_M1] = "/soc/spi@2a300000/flash@0",
 	[BROM_BOOTSOURCE_SD] = "/soc/mmc@2a310000",
 };
 
@@ -85,6 +92,24 @@ void board_debug_uart_init(void)
 {
 }
 
+u32 read_brom_bootsource_id(void)
+{
+	u32 bootsource_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+
+	/* Re-map the raw value read from reg to a redefined or existing
+	 * BROM_BOOTSOURCE enum value to avoid having to create a larger
+	 * boot_devices table.
+	 */
+	if (bootsource_id == 0x23)
+		return BROM_BOOTSOURCE_FSPI1_M1;
+	else if (bootsource_id == 0x81)
+		return BROM_BOOTSOURCE_USB;
+	else if (bootsource_id > BROM_LAST_BOOTSOURCE)
+		log_debug("Unknown bootsource %x\n", bootsource_id);
+
+	return bootsource_id;
+}
+
 #define HP_TIMER_BASE			CONFIG_ROCKCHIP_STIMER_BASE
 #define HP_CTRL_REG			0x04
 #define TIMER_EN			BIT(0)
Signature · 1 line
2.51.0
Reviewed-by on v4 4/5
#8 lore raw

Re: [PATCH v4 4/5] rockchip: rk3576: Add SPI Flash boot support

Quoted 8 lines · Jonas Karlman

The bootsource ids reported by BootROM of RK3576 for SPI NOR and USB differs slightly compared to prior SoCs:

- Booting from sfc0 (ROCK 4D) report the normal bootsource id 0x3.
- Booting from sfc1 M1 (NanoPi M5) report a new bootsource id 0x23.
- Booting from sfc1 M0 has not been tested (no board using this config).
- Booting from USB report a new bootsource id 0x81.

Quoted 5 lines

Add a RK3576 specific read_brom_bootsource_id() function to help decode the new bootsource id values and the required boot_devices mapping of sfc0 and sfc1 to help support booting from SPI flash on RK3576.

Thanks,
- Kever

Quoted 137 lines

---
v4: No change

Changes in v3:
- Add fspi1m1 pinctrl bootph- props to SoC u-boot.dtsi
- Drop the incomplete support for FSPI1_M0
- Add a short code comment about the re-mapping of bootsource id

v2: No change

---
  arch/arm/dts/rk3576-u-boot.dtsi        | 46 ++++++++++++++++++++++++++
  arch/arm/mach-rockchip/rk3576/rk3576.c | 25 ++++++++++++++
  2 files changed, 71 insertions(+)
arch/arm/dts/rk3576-u-boot.dtsi +46 -0
index fb5a107f47d9..dc3771b556a3 100644
@@ -6,6 +6,11 @@
  #include "rockchip-u-boot.dtsi"
 
  / {
+	aliases {
+		spi5 = &sfc0;
+		spi6 = &sfc1;
+	};
+
  	chosen {
  		u-boot,spl-boot-order = "same-as-spl", &sdmmc, &sdhci;
  	};
@@ -16,6 +21,17 @@
  	};
  };
 
+#ifdef CONFIG_ROCKCHIP_SPI_IMAGE
+&binman {
+	simple-bin-spi {
+		mkimage {
+			args = "-n", CONFIG_SYS_SOC, "-T", "rksd";
+			offset = <0x8000>;
+		};
+	};
+};
+#endif
+
  &cru {
  	bootph-all;
  };
@@ -45,6 +61,26 @@
  	bootph-some-ram;
  };
 
+&fspi0_csn0 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&fspi0_pins {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&fspi1m1_csn0 {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
+&fspi1m1_pins {
+	bootph-pre-ram;
+	bootph-some-ram;
+};
+
  &ioc_grf {
  	bootph-all;
  };
@@ -116,6 +152,16 @@
  	bootph-some-ram;
  };
 
+&sfc0 {
+	bootph-some-ram;
+	u-boot,spl-sfc-no-dma;
+};
+
+&sfc1 {
+	bootph-some-ram;
+	u-boot,spl-sfc-no-dma;
+};
+
  &sys_grf {
  	bootph-all;
  };
arch/arm/mach-rockchip/rk3576/rk3576.c +25 -0
index a6c2fbdc4840..a1e8a7572fa4 100644
@@ -36,8 +36,15 @@
  #define USB_GRF_BASE		0x2601E000
  #define USB3OTG0_CON1		0x0030
 
+enum {
+	BROM_BOOTSOURCE_FSPI0 = 3,
+	BROM_BOOTSOURCE_FSPI1_M1 = 6,
+};
+
  const char * const boot_devices[BROM_LAST_BOOTSOURCE + 1] = {
  	[BROM_BOOTSOURCE_EMMC] = "/soc/mmc@2a330000",
+	[BROM_BOOTSOURCE_FSPI0] = "/soc/spi@2a340000/flash@0",
+	[BROM_BOOTSOURCE_FSPI1_M1] = "/soc/spi@2a300000/flash@0",
  	[BROM_BOOTSOURCE_SD] = "/soc/mmc@2a310000",
  };
 
@@ -85,6 +92,24 @@ void board_debug_uart_init(void)
  {
  }
 
+u32 read_brom_bootsource_id(void)
+{
+	u32 bootsource_id = readl(BROM_BOOTSOURCE_ID_ADDR);
+
+	/* Re-map the raw value read from reg to a redefined or existing
+	 * BROM_BOOTSOURCE enum value to avoid having to create a larger
+	 * boot_devices table.
+	 */
+	if (bootsource_id == 0x23)
+		return BROM_BOOTSOURCE_FSPI1_M1;
+	else if (bootsource_id == 0x81)
+		return BROM_BOOTSOURCE_USB;
+	else if (bootsource_id > BROM_LAST_BOOTSOURCE)
+		log_debug("Unknown bootsource %x\n", bootsource_id);
+
+	return bootsource_id;
+}
+
  #define HP_TIMER_BASE			CONFIG_ROCKCHIP_STIMER_BASE
  #define HP_CTRL_REG			0x04
  #define TIMER_EN			BIT(0)
Signature · 7 lines
Thanks & Best regards,
  Kever Yang
**************************************************************************************************
杨凯  市场部             Kever Yang      Marketing Department
瑞芯微电子股份有限公司                Rockchip Electronics Co.,Ltd。
地址:福建省福州市铜盘路软件大道89号软件园A区18号楼 (350003)
Addr : No.18 Building,A District,No.89,Fuzhou Software Boulevard,Fuzhou,Fujian,PRC
#9 lore raw

PATCH v4 5/5 board: rockchip: Add Radxa ROCK 4D

In reply to Jonas Karlman

The Radxa ROCK 4D is a compact single-board computer (SBC) featuring numerous top-tier functions, features, and expansion options.

Equipped with the Rockchip RK3576 or RK3576J SoC, the ROCK 4D boasts an octa-core CPU (4x Cortex-A72 + 4x Cortex-A53), Mali-G52 GPU, and a powerful 6 TOPS NPU, making it ideal for AI and multimedia tasks.

Features tested on a Radxa ROCK 4D v1.112:
- SPI Flash boot
- Ethernet
- PCIe/NVMe
- USB host

ROCK 4D boards with SPI Flash is configured to boot from FSPI0->UFS->USB, or directly from USB when the MASKROM button is pressed, booting directly from SD-card is not possible on these boards.

---
v4: No change
v3: Drop the reset-gpios prop rename
v2: Add comment about the reset-gpios prop rename

---
 arch/arm/dts/rk3576-rock-4d-u-boot.dtsi   | 10 ++++
 arch/arm/mach-rockchip/rk3576/MAINTAINERS |  6 ++
 configs/rock-4d-rk3576_defconfig          | 68 +++++++++++++++++++++++
 doc/board/rockchip/rockchip.rst           |  1 +
 4 files changed, 85 insertions(+)
 create mode 100644 arch/arm/dts/rk3576-rock-4d-u-boot.dtsi
 create mode 100644 configs/rock-4d-rk3576_defconfig
arch/arm/dts/rk3576-rock-4d-u-boot.dtsi new file +10 -0
new file mode 100644
index 000000000000..db46553b66a4
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3576-u-boot.dtsi"
+
+&sfc0 {
+	flash@0 {
+		bootph-pre-ram;
+		bootph-some-ram;
+	};
+};
arch/arm/mach-rockchip/rk3576/MAINTAINERS +6 -0
index 94ef74d429f9..54c75f451f0f 100644
@@ -4,6 +4,12 @@ S:	Maintained
 F:	arch/arm/dts/rk3576-generic*
 F:	configs/generic-rk3576_defconfig
 
+ROCK-4D-RK3576
+M:	Jonas Karlman <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/rk3576-rock-4d*
+F:	configs/rock-4d-rk3576_defconfig
+
 SIGE5-RK3576
 M:	Jonas Karlman <[email protected]>
 S:	Maintained
configs/rock-4d-rk3576_defconfig new file +68 -0

68 lines not on this page · raw message

doc/board/rockchip/rockchip.rst +1 -0
index de3aa79cb5c9..0ec56c8d068a 100644
@@ -137,6 +137,7 @@ List of mainline supported Rockchip boards:
      - ArmSoM Sige5 (sige5-rk3576)
      - Firefly ROC-RK3576-PC (roc-pc-rk3576)
      - Generic RK3576 (generic-rk3576)
+     - Radxa ROCK 4D (rock-4d-rk3576)
 
 * rk3588
      - ArmSoM Sige7 (sige7-rk3588)
Signature · 1 line
2.51.0
Reviewed-by on v4 5/5
#10 lore raw
Quoted 13 lines · Jonas Karlman

The Radxa ROCK 4D is a compact single-board computer (SBC) featuring numerous top-tier functions, features, and expansion options.

Equipped with the Rockchip RK3576 or RK3576J SoC, the ROCK 4D boasts an octa-core CPU (4x Cortex-A72 + 4x Cortex-A53), Mali-G52 GPU, and a powerful 6 TOPS NPU, making it ideal for AI and multimedia tasks.

Features tested on a Radxa ROCK 4D v1.112:
- SPI Flash boot
- Ethernet
- PCIe/NVMe
- USB host

Quoted 5 lines

ROCK 4D boards with SPI Flash is configured to boot from FSPI0->UFS->USB, or directly from USB when the MASKROM button is pressed, booting directly from SD-card is not possible on these boards.

Thanks,
- Kever

Quoted 132 lines

---
v4: No change
v3: Drop the reset-gpios prop rename
v2: Add comment about the reset-gpios prop rename

---
  arch/arm/dts/rk3576-rock-4d-u-boot.dtsi   | 10 ++++
  arch/arm/mach-rockchip/rk3576/MAINTAINERS |  6 ++
  configs/rock-4d-rk3576_defconfig          | 68 +++++++++++++++++++++++
  doc/board/rockchip/rockchip.rst           |  1 +
  4 files changed, 85 insertions(+)

create mode 100644 arch/arm/dts/rk3576-rock-4d-u-boot.dtsi create mode 100644 configs/rock-4d-rk3576_defconfig

arch/arm/dts/rk3576-rock-4d-u-boot.dtsi new file +10 -0
new file mode 100644
index 000000000000..db46553b66a4
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+
+#include "rk3576-u-boot.dtsi"
+
+&sfc0 {
+	flash@0 {
+		bootph-pre-ram;
+		bootph-some-ram;
+	};
+};
arch/arm/mach-rockchip/rk3576/MAINTAINERS +6 -0
index 94ef74d429f9..54c75f451f0f 100644
@@ -4,6 +4,12 @@ S:	Maintained
  F:	arch/arm/dts/rk3576-generic*
  F:	configs/generic-rk3576_defconfig
 
+ROCK-4D-RK3576
+M:	Jonas Karlman <[email protected]>
+S:	Maintained
+F:	arch/arm/dts/rk3576-rock-4d*
+F:	configs/rock-4d-rk3576_defconfig
+
  SIGE5-RK3576
  M:	Jonas Karlman <[email protected]>
  S:	Maintained
configs/rock-4d-rk3576_defconfig new file +68 -0
new file mode 100644
index 000000000000..140a3e0ccd84
@@ -0,0 +1,68 @@
+CONFIG_ARM=y
+CONFIG_SKIP_LOWLEVEL_INIT=y
+CONFIG_COUNTER_FREQUENCY=24000000
+CONFIG_ARCH_ROCKCHIP=y
+CONFIG_SF_DEFAULT_SPEED=50000000
+CONFIG_SF_DEFAULT_MODE=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="rockchip/rk3576-rock-4d"
+CONFIG_ROCKCHIP_RK3576=y
+CONFIG_ROCKCHIP_SPI_IMAGE=y
+CONFIG_SYS_LOAD_ADDR=0x40c00800
+CONFIG_SF_DEFAULT_BUS=5
+CONFIG_DEBUG_UART_BASE=0x2AD40000
+CONFIG_DEBUG_UART_CLOCK=24000000
+CONFIG_SPL_SPI_FLASH_SUPPORT=y
+CONFIG_SPL_SPI=y
+CONFIG_PCI=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEFAULT_FDT_FILE="rockchip/rk3576-rock-4d.dtb"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_SPL_MAX_SIZE=0x40000
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_SPL_SPI_LOAD=y
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x60000
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_MEMINFO_MAP=y
+CONFIG_CMD_ADC=y
+CONFIG_CMD_GPIO=y
+CONFIG_CMD_GPT=y
+CONFIG_CMD_I2C=y
+CONFIG_CMD_MISC=y
+CONFIG_CMD_MMC=y
+CONFIG_CMD_PCI=y
+CONFIG_CMD_USB=y
+# CONFIG_CMD_SETEXPR is not set
+CONFIG_CMD_RNG=y
+CONFIG_CMD_REGULATOR=y
+# CONFIG_SPL_DOS_PARTITION is not set
+CONFIG_OF_SPL_REMOVE_PROPS="clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
+CONFIG_ROCKCHIP_GPIO=y
+CONFIG_SYS_I2C_ROCKCHIP=y
+CONFIG_LED=y
+CONFIG_LED_GPIO=y
+CONFIG_SUPPORT_EMMC_RPMB=y
+CONFIG_MMC_DW=y
+CONFIG_MMC_DW_ROCKCHIP=y
+CONFIG_SPI_FLASH_SFDP_SUPPORT=y
+CONFIG_SPI_FLASH_MACRONIX=y
+CONFIG_PHY_REALTEK=y
+CONFIG_DWC_ETH_QOS=y
+CONFIG_DWC_ETH_QOS_ROCKCHIP=y
+CONFIG_NVME_PCI=y
+CONFIG_PCIE_DW_ROCKCHIP=y
+CONFIG_PHY_ROCKCHIP_INNO_USB2=y
+CONFIG_PHY_ROCKCHIP_NANENG_COMBOPHY=y
+CONFIG_PHY_ROCKCHIP_USBDP=y
+CONFIG_DM_PMIC=y
+CONFIG_PMIC_RK8XX=y
+CONFIG_REGULATOR_RK8XX=y
+CONFIG_BAUDRATE=1500000
+CONFIG_DEBUG_UART_SHIFT=2
+CONFIG_SYS_NS16550_MEM32=y
+CONFIG_ROCKCHIP_SFC=y
+CONFIG_SYSRESET_PSCI=y
+CONFIG_USB=y
+CONFIG_USB_XHCI_HCD=y
+CONFIG_USB_DWC3=y
+CONFIG_USB_DWC3_GENERIC=y
+CONFIG_ERRNO_STR=y
doc/board/rockchip/rockchip.rst +1 -0
index de3aa79cb5c9..0ec56c8d068a 100644
@@ -137,6 +137,7 @@ List of mainline supported Rockchip boards:
       - ArmSoM Sige5 (sige5-rk3576)
       - Firefly ROC-RK3576-PC (roc-pc-rk3576)
       - Generic RK3576 (generic-rk3576)
+     - Radxa ROCK 4D (rock-4d-rk3576)
 
  * rk3588
       - ArmSoM Sige7 (sige7-rk3588)
Signature · 7 lines
Thanks & Best regards,
  Kever Yang
**************************************************************************************************
杨凯  市场部             Kever Yang      Marketing Department
瑞芯微电子股份有限公司                Rockchip Electronics Co.,Ltd。
地址:福建省福州市铜盘路软件大道89号软件园A区18号楼 (350003)
Addr : No.18 Building,A District,No.89,Fuzhou Software Boulevard,Fuzhou,Fujian,PRC