Skip to contentSkip to conversation

ARM: rmobile: Enable board detection when FIT is enabled

PATCH In review Adam Ford 1 participant 8 messages Sep 20, 2021 – Oct 29, 2021

Subsystems (2)
lore
Share & tools
lore

Adam Ford

author
#0 lore raw

PATCH v2 1/6 ARM: rmobile: Enable board detection when FIT is enabled

There are three boards from Beacon, RZ/G2 M/N/H which all use the same board file, but different device trees. Add code to automatically select the proper device tree based on the CPU type.

---
 board/beacon/beacon-rzg2m/beacon-rzg2m.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/beacon/beacon-rzg2m/beacon-rzg2m.c +16 -0
index c12ff77fb2..b3521fcbc1 100644
@@ -36,3 +36,19 @@ void reset_cpu(void)
 {
 	writel(RST_CODE, RST_CA57RESCNT);
 }
+
+#if IS_ENABLED(CONFIG_MULTI_DTB_FIT)
+int board_fit_config_name_match(const char *name)
+{
+	if (!strcmp(rzg_get_cpu_name(), "R8A774A1") && !strcmp(name, "r8a774a1-beacon-rzg2m-kit"))
+		return 0;
+
+	if (!strcmp(rzg_get_cpu_name(), "R8A774B1") && !strcmp(name, "r8a774b1-beacon-rzg2n-kit"))
+		return 0;
+
+	if (!strcmp(rzg_get_cpu_name(), "R8A774E1") && !strcmp(name, "r8a774e1-beacon-rzg2h-kit"))
+		return 0;
+
+	return -1;
+}
+#endif
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH v2 2/6 ARM: rmobile: beacon: Support RZ/G2 [M/N/H] on TARGET_BEACON_RZG2M

The three different boards share the same board file and only differ in terms of which SoC is being used. By enabling FIT on TARGET_BEACON_RZG2M, it can support all three boards and elimate duplicate code.

---
 arch/arm/mach-rmobile/Kconfig.64  | 8 ++++++++
 configs/r8a774a1_beacon_defconfig | 3 +++
 2 files changed, 11 insertions(+)
arch/arm/mach-rmobile/Kconfig.64 +8 -0
index a6dcce180b..2bde898928 100644
@@ -80,8 +80,14 @@ config TARGET_BEACON_RZG2H
 config TARGET_BEACON_RZG2M
 	bool "Beacon EmbeddedWorks RZ/G2M Dev Kit"
 	select R8A774A1
+	select R8A774B1
+	select R8A774E1
 	select RZ_G2
 	select PINCTRL_PFC_R8A774A1
+	select PINCTRL_PFC_R8A774B1
+	select PINCTRL_PFC_R8A774E1
+	imply MULTI_DTB_FIT
+	imply MULTI_DTB_FIT_USER_DEFINED_AREA
 
 config TARGET_BEACON_RZG2N
 	bool "Beacon EmbeddedWorks RZ/G2N Dev Kit"
@@ -177,11 +183,13 @@ source "board/hoperun/hihope-rzg2/Kconfig"
 source "board/silinux/ek874/Kconfig"
 
 config MULTI_DTB_FIT_UNCOMPRESS_SZ
+	default 0x80000 if TARGET_BEACON_RZG2M
 	default 0x80000 if TARGET_HIHOPE_RZG2
 	default 0x80000 if TARGET_SALVATOR_X
 	default 0x80000 if TARGET_ULCB
 
 config MULTI_DTB_FIT_USER_DEF_ADDR
+	default 0x49000000 if TARGET_BEACON_RZG2M
 	default 0x49000000 if TARGET_HIHOPE_RZG2
 	default 0x49000000 if TARGET_SALVATOR_X
 	default 0x49000000 if TARGET_ULCB
configs/r8a774a1_beacon_defconfig +3 -0
index 7ba4ac05f5..11c99d4850 100644
@@ -31,6 +31,9 @@ CONFIG_CMD_EXT4_WRITE=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
 CONFIG_OF_CONTROL=y
+CONFIG_OF_LIST="r8a774a1-beacon-rzg2m-kit r8a774b1-beacon-rzg2n-kit r8a774e1-beacon-rzg2h-kit"
+CONFIG_MULTI_DTB_FIT_LZO=y
+CONFIG_MULTI_DTB_FIT_USER_DEFINED_AREA=y
 CONFIG_ENV_OVERWRITE=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_MMC_ENV_DEV=1
Signature · 1 line
2.25.1
author
#5 lore raw

PATCH v2 6/6 ARM: rmobile: Rename r8a774a1_beacon_defconfig to rzg2_beacon_defconfig

In reply to Adam Ford

Now that the three M/N/H variants can be built from one config, rename the defconfig file to be more generic since it supports multiple RZ/G2.

---
V2: new to series

 configs/{r8a774a1_beacon_defconfig => rzg2_beacon_defconfig} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
configs/rzg2_beacon_defconfig renamed from configs/r8a774a1_beacon_defconfig +0 -0
similarity index 100%
rename from configs/r8a774a1_beacon_defconfig
rename to configs/rzg2_beacon_defconfig
Signature · 1 line
2.25.1
author
#3 lore raw

PATCH v2 4/6 ARM: rmobile: Beacon: Remove dead code

In reply to Adam Ford

There are a few do-nothing functions that can be removed. Remove them.

---
 board/beacon/beacon-rzg2m/beacon-rzg2m.c | 10 ----------
 configs/r8a774a1_beacon_defconfig        |  1 +
 2 files changed, 1 insertion(+), 10 deletions(-)
board/beacon/beacon-rzg2m/beacon-rzg2m.c +0 -10
index b3521fcbc1..df6044a429 100644
@@ -10,16 +10,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-void s_init(void)
-{
-}
-
-/* Kconfig forces this on, so just return 0 */
-int board_early_init_f(void)
-{
-	return 0;
-}
-
 int board_init(void)
 {
 	/* address of boot parameters */
configs/r8a774a1_beacon_defconfig +1 -0
index 11c99d4850..aaea9b4c30 100644
@@ -13,6 +13,7 @@ CONFIG_FIT=y
 CONFIG_SUPPORT_RAW_INITRD=y
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
 CONFIG_DEFAULT_FDT_FILE="r8a774a1-beacon-rzg2m-kit.dtb"
+# CONFIG_BOARD_EARLY_INIT_F is not set
 CONFIG_HUSH_PARSER=y
 CONFIG_CMD_BOOTZ=y
 CONFIG_CMD_GPIO=y
Signature · 1 line
2.25.1
author
#2 lore raw

PATCH v2 3/6 ARM: rmobile: beacon: Remove duplicated for RZ/G2 M/N/H

In reply to Adam Ford

Now that TARGET_BEACON_RZG2M can handle all the work that was done with TARGET_BEACON_RZG2N and TARGET_BEACON_RZG2H, remove them since they just create more duplicate code.

---
V2: Rebase.

 arch/arm/mach-rmobile/Kconfig.64  | 14 +-----
 board/beacon/beacon-rzg2m/Kconfig |  2 +-
 configs/r8a774b1_beacon_defconfig | 73 -------------------------------
 configs/r8a774e1_beacon_defconfig | 73 -------------------------------
 4 files changed, 2 insertions(+), 160 deletions(-)
arch/arm/mach-rmobile/Kconfig.64 +1 -13
index 2bde898928..19fc3cab3a 100644
@@ -71,14 +71,8 @@ choice
 	prompt "Renesas ARM64 SoCs board select"
 	optional
 
-config TARGET_BEACON_RZG2H
-	bool "Beacon EmbeddedWorks RZ/G2H Dev Kit"
-	select R8A774E1
-	select RZ_G2
-	select PINCTRL_PFC_R8A774E1
-
 config TARGET_BEACON_RZG2M
-	bool "Beacon EmbeddedWorks RZ/G2M Dev Kit"
+	bool "Beacon EmbeddedWorks RZ/G2 Dev Kit"
 	select R8A774A1
 	select R8A774B1
 	select R8A774E1
@@ -89,12 +83,6 @@ config TARGET_BEACON_RZG2M
 	imply MULTI_DTB_FIT
 	imply MULTI_DTB_FIT_USER_DEFINED_AREA
 
-config TARGET_BEACON_RZG2N
-	bool "Beacon EmbeddedWorks RZ/G2N Dev Kit"
-	select R8A774B1
-	select RZ_G2
-	select PINCTRL_PFC_R8A774B1
-
 config TARGET_CONDOR
 	bool "Condor board"
 	imply R8A77980
board/beacon/beacon-rzg2m/Kconfig +1 -1
index 99c23a3d14..c03857cf2f 100644
@@ -1,4 +1,4 @@
-if TARGET_BEACON_RZG2H || TARGET_BEACON_RZG2M || TARGET_BEACON_RZG2N
+if TARGET_BEACON_RZG2M
 
 config SYS_SOC
 	default "rmobile"
configs/r8a774b1_beacon_defconfig deleted +0 -73

73 lines not on this page · raw message

configs/r8a774e1_beacon_defconfig deleted +0 -73

73 lines not on this page · raw message

Signature · 1 line
2.25.1
author
#4 lore raw

PATCH v2 5/6 ARM: rmobile: beacon: Enable reference clocks for USB and AVB

In reply to Adam Ford

Both Ethernet and USB drivers get their reference clocks from the versaclock. Enable that driver and the common clock driver by default.

---
 arch/arm/mach-rmobile/Kconfig.64 | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/mach-rmobile/Kconfig.64 +2 -0
index 19fc3cab3a..1ab660cb63 100644
@@ -82,6 +82,8 @@ config TARGET_BEACON_RZG2M
 	select PINCTRL_PFC_R8A774E1
 	imply MULTI_DTB_FIT
 	imply MULTI_DTB_FIT_USER_DEFINED_AREA
+	imply CLK_VERSACLOCK
+	imply CLK_CCF
 
 config TARGET_CONDOR
 	bool "Condor board"
Signature · 1 line
2.25.1
author
#6 lore raw
In reply to Adam Ford
Quoted 7 lines · Adam Ford

There are three boards from Beacon, RZ/G2 M/N/H which all use the same board file, but different device trees. Add code to automatically select the proper device tree based on the CPU type.

Marek,

You previously asked me to remind you after 2 weeks, so it doesn't get too stale. I rebased at the time I did the V2. Can you give feedback?

thank you,

adam

Quoted 31 lines
---
 board/beacon/beacon-rzg2m/beacon-rzg2m.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/beacon/beacon-rzg2m/beacon-rzg2m.c +16 -1
index c12ff77fb2..b3521fcbc1 100644
@@ -36,3 +36,19 @@ void reset_cpu(void)
 {
        writel(RST_CODE, RST_CA57RESCNT);
 }
+
+#if IS_ENABLED(CONFIG_MULTI_DTB_FIT)
+int board_fit_config_name_match(const char *name)
+{
+       if (!strcmp(rzg_get_cpu_name(), "R8A774A1") && !strcmp(name, "r8a774a1-beacon-rzg2m-kit"))
+               return 0;
+
+       if (!strcmp(rzg_get_cpu_name(), "R8A774B1") && !strcmp(name, "r8a774b1-beacon-rzg2n-kit"))
+               return 0;
+
+       if (!strcmp(rzg_get_cpu_name(), "R8A774E1") && !strcmp(name, "r8a774e1-beacon-rzg2h-kit"))
+               return 0;
+
+       return -1;
+}
+#endif
--

2.25.1

author
#7 lore raw
Quoted 8 lines · Adam Ford
Quoted 6 lines · Adam Ford

There are three boards from Beacon, RZ/G2 M/N/H which all use the same board file, but different device trees. Add code to automatically select the proper device tree based on the CPU type.

Quoted 7 lines
Quoted 1 line

Marek,

You previously asked me to remind you after 2 weeks, so it doesn't get too stale. I rebased at the time I did the V2. Can you give feedback?

Marek,

Ping #2. It's been three weeks since my last ping, and I was hoping you might have some feedback and/or be able to apply this.

thank you,

adam

Quoted 35 lines

thank you,

adam

Quoted 31 lines
---
 board/beacon/beacon-rzg2m/beacon-rzg2m.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
board/beacon/beacon-rzg2m/beacon-rzg2m.c +16 -1
index c12ff77fb2..b3521fcbc1 100644
@@ -36,3 +36,19 @@ void reset_cpu(void)
 {
        writel(RST_CODE, RST_CA57RESCNT);
 }
+
+#if IS_ENABLED(CONFIG_MULTI_DTB_FIT)
+int board_fit_config_name_match(const char *name)
+{
+       if (!strcmp(rzg_get_cpu_name(), "R8A774A1") && !strcmp(name, "r8a774a1-beacon-rzg2m-kit"))
+               return 0;
+
+       if (!strcmp(rzg_get_cpu_name(), "R8A774B1") && !strcmp(name, "r8a774b1-beacon-rzg2n-kit"))
+               return 0;
+
+       if (!strcmp(rzg_get_cpu_name(), "R8A774E1") && !strcmp(name, "r8a774e1-beacon-rzg2h-kit"))
+               return 0;
+
+       return -1;
+}
+#endif
--

2.25.1