Skip to contentSkip to conversation

arm: mach-rmobile: Add CPU info support for RZ/G2

PATCH New Biju Das 2 participants 2 messages Mar 17, 2021 – Apr 14, 2021

Subsystems (2)
lore
Share & tools
lore

Biju Das

author
#0 lore raw

PATCH v2 1/1 arm: mach-rmobile: Add CPU info support for RZ/G2

Add CPU info support for RZ/G2 SoC's.

---
V1-->V2
* Added support to make CPU info based on tfa is available only when CONFIG_RZ_G2 is enabled.

---
 arch/arm/mach-rmobile/Kconfig.64             |  5 +++
 arch/arm/mach-rmobile/Makefile               |  1 +
 arch/arm/mach-rmobile/cpu_info-rzg.c         | 41 ++++++++++++++++++++
 arch/arm/mach-rmobile/cpu_info.c             | 21 ++++++++--
 arch/arm/mach-rmobile/include/mach/rmobile.h |  1 +
 5 files changed, 65 insertions(+), 4 deletions(-)
 create mode 100644 arch/arm/mach-rmobile/cpu_info-rzg.c
arch/arm/mach-rmobile/Kconfig.64 +5 -0
index 8127d33f2d..3f7ec05379 100644
@@ -57,6 +57,9 @@ config R8A77995
 	imply CLK_R8A77995
 	imply PINCTRL_PFC_R8A77995
 
+config RZ_G2
+	bool "Renesas ARM SoCs RZ/G2 (64bit)"
+
 endmenu
 
 choice
@@ -107,6 +110,7 @@ config TARGET_HIHOPE_RZG2
 	imply R8A774A1
 	imply R8A774B1
 	imply R8A774E1
+	imply RZ_G2
 	imply SYS_MALLOC_F
 	imply MULTI_DTB_FIT
 	imply MULTI_DTB_FIT_USER_DEFINED_AREA
@@ -116,6 +120,7 @@ config TARGET_HIHOPE_RZG2
 config TARGET_SILINUX_EK874
 	bool "Silicon Linux EK874 board"
 	imply R8A774C0
+	imply RZ_G2
 	help
           Support for Silicon Linux EK874 platform
 
arch/arm/mach-rmobile/Makefile +1 -0
index 9f56af465e..81a0dedb41 100644
@@ -13,6 +13,7 @@ obj-$(CONFIG_SH73A0) += lowlevel_init.o cpu_info-sh73a0.o pfc-sh73a0.o
 obj-$(CONFIG_R8A7740) += lowlevel_init.o cpu_info-r8a7740.o pfc-r8a7740.o
 obj-$(CONFIG_RCAR_GEN2) += lowlevel_init_ca15.o cpu_info-rcar.o
 obj-$(CONFIG_RCAR_GEN3) += lowlevel_init_gen3.o cpu_info-rcar.o memmap-gen3.o
+obj-$(CONFIG_RZ_G2) += cpu_info-rzg.o
 
 OBJCOPYFLAGS_u-boot-spl.srec := -O srec
 quiet_cmd_objcopy = OBJCOPY $@
arch/arm/mach-rmobile/cpu_info-rzg.c new file +41 -0

41 lines not on this page · raw message

arch/arm/mach-rmobile/cpu_info.c +17 -4
index fdbbd72e28..9ec622bdb5 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
  * (C) Copyright 2012 Nobuhiro Iwamatsu <[email protected]>
- * (C) Copyright 2012 Renesas Solutions Corp.
+ * (C) Copyright 2012-2021 Renesas Solutions Corp.
  */
 #include <common.h>
 #include <cpu_func.h>
@@ -31,6 +31,11 @@ void enable_caches(void)
 
 #ifdef CONFIG_DISPLAY_CPUINFO
 #ifndef CONFIG_RZA1
+__weak const u8 *rzg_get_cpu_name(void)
+{
+	return 0;
+}
+
 static u32 __rmobile_get_cpu_type(void)
 {
 	return 0x0;
@@ -52,7 +57,7 @@ static u32 __rmobile_get_cpu_rev_fraction(void)
 u32 rmobile_get_cpu_rev_fraction(void)
 		__attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
 
-/* CPU infomation table */
+/* CPU information table */
 static const struct {
 	u16 cpu_type;
 	u8 cpu_name[10];
@@ -86,14 +91,22 @@ static int rmobile_cpuinfo_idx(void)
 	return i;
 }
 
+static const u8 *get_cpu_name(int idx)
+{
+	const  u8 *cpu_name = rzg_get_cpu_name();
+
+	return cpu_name ? cpu_name : rmobile_cpuinfo[idx].cpu_name;
+}
+
 #ifdef CONFIG_ARCH_MISC_INIT
 int arch_misc_init(void)
 {
 	int i, idx = rmobile_cpuinfo_idx();
+	const u8 *cpu_name = get_cpu_name(idx);
 	char cpu[10] = { 0 };
 
 	for (i = 0; i < sizeof(cpu); i++)
-		cpu[i] = tolower(rmobile_cpuinfo[idx].cpu_name[i]);
+		cpu[i] = tolower(cpu_name[i]);
 
 	env_set("platform", cpu);
 
@@ -106,7 +119,7 @@ int print_cpuinfo(void)
 	int i = rmobile_cpuinfo_idx();
 
 	printf("CPU: Renesas Electronics %s rev %d.%d\n",
-		rmobile_cpuinfo[i].cpu_name, rmobile_get_cpu_rev_integer(),
+		get_cpu_name(i), rmobile_get_cpu_rev_integer(),
 		rmobile_get_cpu_rev_fraction());
 
 	return 0;
arch/arm/mach-rmobile/include/mach/rmobile.h +1 -0
index a50249dc96..a688636141 100644
@@ -41,6 +41,7 @@
 #define RMOBILE_CPU_TYPE_R8A77995	0x58
 
 #ifndef __ASSEMBLY__
+const u8 *rzg_get_cpu_name(void);
 u32 rmobile_get_cpu_type(void);
 u32 rmobile_get_cpu_rev_integer(void);
 u32 rmobile_get_cpu_rev_fraction(void);
Signature · 1 line
2.17.1
Applied
#1 lore raw

PATCH v2 1/1 arm: mach-rmobile: Add CPU info support for RZ/G2

Quoted 1 line · Biju Das

Add CPU info support for RZ/G2 SoC's.

Applied, thanks