Skip to contentSkip to conversation

rockchip: modify devicetree at runtime for Radxa ROCK Pi E v3.0

PATCH In review FUKAUMI Naoki 2 participants 3 messages Aug 27, 2024 – Sep 10, 2024

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

PATCH 1/1 rockchip: modify devicetree at runtime for Radxa ROCK Pi E v3.0

since Radxa ROCK Pi E v3.0 is different to ROCK Pi E, "model" and "compatible" in DT need to be different.
(specifically, sysupgrade[1] in OpenWrt)

also, "mmc0" and "mmc1" aliases need to be swapped to align with other Radxa's boards.

modify them after loading DT for kernel.

[1] https://openwrt.org/docs/techref/sysupgrade#how_it_works

---
 arch/arm/mach-rockchip/rk3328/Kconfig       |  6 ++++++
 board/radxa/rockpie-rk3328/Kconfig          | 12 +++++++++++
 board/radxa/rockpie-rk3328/MAINTAINERS      |  6 ++++++
 board/radxa/rockpie-rk3328/Makefile         |  3 +++
 board/radxa/rockpie-rk3328/rockpie-rk3328.c | 22 +++++++++++++++++++++
 configs/rock-pi-e-v3-rk3328_defconfig       |  2 ++
 6 files changed, 51 insertions(+)
 create mode 100644 board/radxa/rockpie-rk3328/Kconfig
 create mode 100644 board/radxa/rockpie-rk3328/MAINTAINERS
 create mode 100644 board/radxa/rockpie-rk3328/Makefile
 create mode 100644 board/radxa/rockpie-rk3328/rockpie-rk3328.c
arch/arm/mach-rockchip/rk3328/Kconfig +6 -0
index 70770da5fdf..654377672fe 100644
@@ -10,6 +10,11 @@ config TARGET_EVB_RK3328
 	  with full function and phisical connectors support like
 	  usb2.0 host ports, LVDS, JTAG, MAC, SDcard, HDMI, USB-2-serial...
 
+config TARGET_ROCK_PI_E_V3_RK3328
+	bool "Radxa ROCK Pi E v3.0"
+	help
+	  Radxa ROCK Pi E v3.0 single board computers with a RK3328 SoC.
+
 endchoice
 
 config ROCKCHIP_BOOT_MODE_REG
@@ -37,5 +42,6 @@ config TPL_SYS_MALLOC_F_LEN
 	default 0x800
 
 source "board/rockchip/evb_rk3328/Kconfig"
+source "board/radxa/rockpie-rk3328/Kconfig"
 
 endif
board/radxa/rockpie-rk3328/Kconfig new file +12 -0
new file mode 100644
index 00000000000..73485d93513
@@ -0,0 +1,12 @@
+if TARGET_ROCK_PI_E_V3_RK3328
+
+config SYS_BOARD
+	default "rockpie-rk3328"
+
+config SYS_VENDOR
+	default "radxa"
+
+config SYS_CONFIG_NAME
+	default "evb_rk3328"
+
+endif
board/radxa/rockpie-rk3328/MAINTAINERS new file +6 -0
new file mode 100644
index 00000000000..f98ddce4e58
@@ -0,0 +1,6 @@
+ROCK-PI-E-V3-RK3328
+M:	FUKAUMI Naoki <[email protected]>
+S:	Maintained
+F:	board/radxa/rockpie-rk3328
+F:	configs/rock-pi-e-v3-rk3328_defconfig
+F:	arch/arm/dts/rk3328-rock-pi-e*
board/radxa/rockpie-rk3328/Makefile new file +3 -0
new file mode 100644
index 00000000000..cede3b2605d
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y += rockpie-rk3328.o
board/radxa/rockpie-rk3328/rockpie-rk3328.c new file +22 -0
new file mode 100644
index 00000000000..3178af3e472
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <fdt_support.h>
+
+#define MODEL		"Radxa ROCK Pi E v3.0"
+#define COMPATIBLE1	"radxa,rockpi-e-v3"
+#define COMPATIBLE2	"rockchip,rk3328"
+
+#define MMC0		"mmc@ff520000"
+#define MMC1		"mmc@ff500000"
+
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	fdt_setprop_string(blob, 0, "model", MODEL);
+	fdt_setprop_string(blob, 0, "compatible", COMPATIBLE1);
+	fdt_appendprop_string(blob, 0, "compatible", COMPATIBLE2);
+
+	fdt_find_and_setprop(blob, "/aliases", "mmc0", MMC0, 13, 1);
+	fdt_find_and_setprop(blob, "/aliases", "mmc1", MMC1, 13, 1);
+
+	return 0;
+}
configs/rock-pi-e-v3-rk3328_defconfig +2 -0
index 4c6cc634bd6..15036d01a40 100644
@@ -9,6 +9,7 @@ CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_DEFAULT_DEVICE_TREE="rk3328-rock-pi-e-v3"
 CONFIG_DM_RESET=y
 CONFIG_ROCKCHIP_RK3328=y
+CONFIG_TARGET_ROCK_PI_E_V3_RK3328=y
 CONFIG_DEBUG_UART_BASE=0xFF130000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_SYS_LOAD_ADDR=0x800800
@@ -18,6 +19,7 @@ CONFIG_FIT_VERBOSE=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
 CONFIG_LEGACY_IMAGE_FORMAT=y
+CONFIG_OF_BOARD_SETUP=y
 CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock-pi-e.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
Signature · 1 line
2.43.0
#1 lore raw

Hi Naoki,

Quoted 102 lines · FUKAUMI Naoki

since Radxa ROCK Pi E v3.0 is different to ROCK Pi E, "model" and "compatible" in DT need to be different.
(specifically, sysupgrade[1] in OpenWrt)

also, "mmc0" and "mmc1" aliases need to be swapped to align with other Radxa's boards.

modify them after loading DT for kernel.

[1] https://openwrt.org/docs/techref/sysupgrade#how_it_works

---
  arch/arm/mach-rockchip/rk3328/Kconfig       |  6 ++++++
  board/radxa/rockpie-rk3328/Kconfig          | 12 +++++++++++
  board/radxa/rockpie-rk3328/MAINTAINERS      |  6 ++++++
  board/radxa/rockpie-rk3328/Makefile         |  3 +++
  board/radxa/rockpie-rk3328/rockpie-rk3328.c | 22 +++++++++++++++++++++
  configs/rock-pi-e-v3-rk3328_defconfig       |  2 ++
  6 files changed, 51 insertions(+)

create mode 100644 board/radxa/rockpie-rk3328/Kconfig create mode 100644 board/radxa/rockpie-rk3328/MAINTAINERS create mode 100644 board/radxa/rockpie-rk3328/Makefile create mode 100644 board/radxa/rockpie-rk3328/rockpie-rk3328.c

arch/arm/mach-rockchip/rk3328/Kconfig +6 -0
index 70770da5fdf..654377672fe 100644
@@ -10,6 +10,11 @@ config TARGET_EVB_RK3328
  	  with full function and phisical connectors support like
  	  usb2.0 host ports, LVDS, JTAG, MAC, SDcard, HDMI, USB-2-serial...
 
+config TARGET_ROCK_PI_E_V3_RK3328
+	bool "Radxa ROCK Pi E v3.0"
+	help
+	  Radxa ROCK Pi E v3.0 single board computers with a RK3328 SoC.
+
  endchoice
 
  config ROCKCHIP_BOOT_MODE_REG
@@ -37,5 +42,6 @@ config TPL_SYS_MALLOC_F_LEN
  	default 0x800
 
  source "board/rockchip/evb_rk3328/Kconfig"
+source "board/radxa/rockpie-rk3328/Kconfig"
 
  endif
board/radxa/rockpie-rk3328/Kconfig new file +12 -0
new file mode 100644
index 00000000000..73485d93513
@@ -0,0 +1,12 @@
+if TARGET_ROCK_PI_E_V3_RK3328
+
+config SYS_BOARD
+	default "rockpie-rk3328"
+
+config SYS_VENDOR
+	default "radxa"
+
+config SYS_CONFIG_NAME
+	default "evb_rk3328"
+
+endif
board/radxa/rockpie-rk3328/MAINTAINERS new file +6 -0
new file mode 100644
index 00000000000..f98ddce4e58
@@ -0,0 +1,6 @@
+ROCK-PI-E-V3-RK3328
+M:	FUKAUMI Naoki <[email protected]>
+S:	Maintained
+F:	board/radxa/rockpie-rk3328
+F:	configs/rock-pi-e-v3-rk3328_defconfig
+F:	arch/arm/dts/rk3328-rock-pi-e*
board/radxa/rockpie-rk3328/Makefile new file +3 -0
new file mode 100644
index 00000000000..cede3b2605d
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y += rockpie-rk3328.o
board/radxa/rockpie-rk3328/rockpie-rk3328.c new file +9 -0
new file mode 100644
index 00000000000..3178af3e472
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <fdt_support.h>
+
+#define MODEL		"Radxa ROCK Pi E v3.0"
+#define COMPATIBLE1	"radxa,rockpi-e-v3"
+#define COMPATIBLE2	"rockchip,rk3328"
+
+#define MMC0		"mmc@ff520000"

board/radxa/rockpie-rk3328/rockpie-rk3328.c line 19

Quoted 10 lines
board/radxa/rockpie-rk3328/rockpie-rk3328.c new file +10 -0
+#define MMC1		"mmc@ff500000"
+
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+	fdt_setprop_string(blob, 0, "model", MODEL);
+	fdt_setprop_string(blob, 0, "compatible", COMPATIBLE1);
+	fdt_appendprop_string(blob, 0, "compatible", COMPATIBLE2);
+
+	fdt_find_and_setprop(blob, "/aliases", "mmc0", MMC0, 13, 1);
+	fdt_find_and_setprop(blob, "/aliases", "mmc1", MMC1, 13, 1);

There is already  available dts arch/arm/dts/rk3328-rock-pi-e-v3.dts,

so this change should go to to dts instead.

Does arch/arm/dts/rk3328-rock-pi-e-v3.dts also go to mainline kernel?

Thanks,

- Kever

Quoted 23 lines
board/radxa/rockpie-rk3328/rockpie-rk3328.c new file +3 -0
+
+	return 0;
+}
configs/rock-pi-e-v3-rk3328_defconfig +2 -0
index 4c6cc634bd6..15036d01a40 100644
@@ -9,6 +9,7 @@ CONFIG_ENV_OFFSET=0x3F8000
  CONFIG_DEFAULT_DEVICE_TREE="rk3328-rock-pi-e-v3"
  CONFIG_DM_RESET=y
  CONFIG_ROCKCHIP_RK3328=y
+CONFIG_TARGET_ROCK_PI_E_V3_RK3328=y
  CONFIG_DEBUG_UART_BASE=0xFF130000
  CONFIG_DEBUG_UART_CLOCK=24000000
  CONFIG_SYS_LOAD_ADDR=0x800800
@@ -18,6 +19,7 @@ CONFIG_FIT_VERBOSE=y
  CONFIG_SPL_FIT_SIGNATURE=y
  CONFIG_SPL_LOAD_FIT=y
  CONFIG_LEGACY_IMAGE_FORMAT=y
+CONFIG_OF_BOARD_SETUP=y
  CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock-pi-e.dtb"
  # CONFIG_DISPLAY_CPUINFO is not set
  CONFIG_DISPLAY_BOARDINFO_LATE=y
#2 lore raw

hi,

Quoted 114 lines · Kever Yang

Hi Naoki,

Quoted 98 lines · FUKAUMI Naoki

since Radxa ROCK Pi E v3.0 is different to ROCK Pi E, "model" and "compatible" in DT need to be different.
(specifically, sysupgrade[1] in OpenWrt)

also, "mmc0" and "mmc1" aliases need to be swapped to align with other Radxa's boards.

modify them after loading DT for kernel.

[1] https://openwrt.org/docs/techref/sysupgrade#how_it_works

---
  arch/arm/mach-rockchip/rk3328/Kconfig       |  6 ++++++ board/radxa/rockpie-rk3328/Kconfig          | 12 +++++++++++ board/radxa/rockpie-rk3328/MAINTAINERS      |  6 ++++++ board/radxa/rockpie-rk3328/Makefile         |  3 +++ board/radxa/rockpie-rk3328/rockpie-rk3328.c | 22 +++++++++++++++++++++ configs/rock-pi-e-v3-rk3328_defconfig       |  2 ++

  6 files changed, 51 insertions(+)

  create mode 100644 board/radxa/rockpie-rk3328/Kconfig create mode 100644 board/radxa/rockpie-rk3328/MAINTAINERS create mode 100644 board/radxa/rockpie-rk3328/Makefile create mode 100644 board/radxa/rockpie-rk3328/rockpie-rk3328.c

arch/arm/mach-rockchip/rk3328/Kconfig +0 -0
index 70770da5fdf..654377672fe 100644
@@ -10,6 +10,11 @@ config TARGET_EVB_RK3328

        with full function and phisical connectors support like usb2.0 host ports, LVDS, JTAG, MAC, SDcard, HDMI, USB-2-serial...

arch/arm/mach-rockchip/rk3328/Kconfig +5 -0
+config TARGET_ROCK_PI_E_V3_RK3328
+    bool "Radxa ROCK Pi E v3.0"
+    help
+      Radxa ROCK Pi E v3.0 single board computers with a RK3328 SoC.
+

  endchoice
  config ROCKCHIP_BOOT_MODE_REG

arch/arm/mach-rockchip/rk3328/Kconfig +0 -0
@@ -37,5 +42,6 @@ config TPL_SYS_MALLOC_F_LEN

      default 0x800
  source "board/rockchip/evb_rk3328/Kconfig"
+source "board/radxa/rockpie-rk3328/Kconfig"
  endif

board/radxa/rockpie-rk3328/Kconfig new file +12 -0
new file mode 100644
index 00000000000..73485d93513
@@ -0,0 +1,12 @@
+if TARGET_ROCK_PI_E_V3_RK3328
+
+config SYS_BOARD
+    default "rockpie-rk3328"
+
+config SYS_VENDOR
+    default "radxa"
+
+config SYS_CONFIG_NAME
+    default "evb_rk3328"
+
+endif
board/radxa/rockpie-rk3328/MAINTAINERS new file +6 -0
new file mode 100644
index 00000000000..f98ddce4e58
@@ -0,0 +1,6 @@
+ROCK-PI-E-V3-RK3328
+M:    FUKAUMI Naoki <[email protected]>
+S:    Maintained
+F:    board/radxa/rockpie-rk3328
+F:    configs/rock-pi-e-v3-rk3328_defconfig
+F:    arch/arm/dts/rk3328-rock-pi-e*
board/radxa/rockpie-rk3328/Makefile new file +3 -0
new file mode 100644
index 00000000000..cede3b2605d
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0+
+
+obj-y += rockpie-rk3328.o
board/radxa/rockpie-rk3328/rockpie-rk3328.c new file +9 -0
new file mode 100644
index 00000000000..3178af3e472
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+
+#include <fdt_support.h>
+
+#define MODEL        "Radxa ROCK Pi E v3.0"
+#define COMPATIBLE1    "radxa,rockpi-e-v3"
+#define COMPATIBLE2    "rockchip,rk3328"
+
+#define MMC0        "mmc@ff520000"

board/radxa/rockpie-rk3328/rockpie-rk3328.c line 19

Quoted 10 lines
board/radxa/rockpie-rk3328/rockpie-rk3328.c new file +10 -0
+#define MMC1        "mmc@ff500000"
+
+int ft_board_setup(void *blob, struct bd_info *bd)
+{
+    fdt_setprop_string(blob, 0, "model", MODEL);
+    fdt_setprop_string(blob, 0, "compatible", COMPATIBLE1);
+    fdt_appendprop_string(blob, 0, "compatible", COMPATIBLE2);
+
+    fdt_find_and_setprop(blob, "/aliases", "mmc0", MMC0, 13, 1);
+    fdt_find_and_setprop(blob, "/aliases", "mmc1", MMC1, 13, 1);

There is already  available dts arch/arm/dts/rk3328-rock-pi-e-v3.dts,

Quoted 3 lines

so this change should go to to dts instead.

Does arch/arm/dts/rk3328-rock-pi-e-v3.dts also go to mainline kernel?

https://lore.kernel.org/linux-rockchip/[email protected]/t/#u

adding new dts for v3.0 will not be accepted for mainline kernel.
I need new compatible for v3.0 in DT for kernel, but I have no good idea to handle this issue...

Best regards,

--
FUKAUMI Naoki
Radxa Computer (Shenzhen) Co., Ltd.

Quoted 28 lines

Thanks,

- Kever

Quoted 23 lines
board/radxa/rockpie-rk3328/rockpie-rk3328.c new file +3 -0
+
+    return 0;
+}
configs/rock-pi-e-v3-rk3328_defconfig +0 -0
index 4c6cc634bd6..15036d01a40 100644
@@ -9,6 +9,7 @@ CONFIG_ENV_OFFSET=0x3F8000

  CONFIG_DEFAULT_DEVICE_TREE="rk3328-rock-pi-e-v3" CONFIG_DM_RESET=y CONFIG_ROCKCHIP_RK3328=y +CONFIG_TARGET_ROCK_PI_E_V3_RK3328=y CONFIG_DEBUG_UART_BASE=0xFF130000 CONFIG_DEBUG_UART_CLOCK=24000000 CONFIG_SYS_LOAD_ADDR=0x800800

configs/rock-pi-e-v3-rk3328_defconfig +0 -0
@@ -18,6 +19,7 @@ CONFIG_FIT_VERBOSE=y

  CONFIG_SPL_FIT_SIGNATURE=y CONFIG_SPL_LOAD_FIT=y CONFIG_LEGACY_IMAGE_FORMAT=y +CONFIG_OF_BOARD_SETUP=y CONFIG_DEFAULT_FDT_FILE="rockchip/rk3328-rock-pi-e.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y