[PATCH v3 1/2] arm: rmobile: Add RZ/G2M SoC
Biju Das
biju.das.jz at bp.renesas.com
Tue Sep 22 18:03:16 CEST 2020
Add CPU and PRR IDs for R8A774A1(a.k.a RZ/G2M) SoC.
RZ/Gx SoC's are identical to R-Car SoC's apart from some automotive
peripherals and they also share the same PRR CPU ID's.
For example the RZ/G2M SoC has the same PRR ID 0x52 as R-Car M3W SoC.
For RZ/G2 SoC identification compatible string from TFA are matched
against the list of compatible strings in struct tfa_cpuinfo.
Also sorted the header alphabetically.
Signed-off-by: Biju Das <biju.das.jz at bp.renesas.com>
Reviewed-by: Lad Prabhakar <prabhakar.mahadev-lad.rj at bp.renesas.com>
---
v2->v3
* Reworked as per Marek's suggestion
* Added rzg2_get_cpu_type function to get cpu_type by matching TFA compatible string
* Removed SoC family type Enum
---
arch/arm/mach-rmobile/cpu_info.c | 42 ++++++++++++++++++--
arch/arm/mach-rmobile/include/mach/rmobile.h | 4 ++
2 files changed, 42 insertions(+), 4 deletions(-)
diff --git a/arch/arm/mach-rmobile/cpu_info.c b/arch/arm/mach-rmobile/cpu_info.c
index fdbbd72e28..f605215b48 100644
--- a/arch/arm/mach-rmobile/cpu_info.c
+++ b/arch/arm/mach-rmobile/cpu_info.c
@@ -3,12 +3,13 @@
* (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
* (C) Copyright 2012 Renesas Solutions Corp.
*/
-#include <common.h>
-#include <cpu_func.h>
#include <asm/cache.h>
-#include <init.h>
#include <asm/io.h>
+#include <common.h>
+#include <cpu_func.h>
+#include <dm/device.h>
#include <env.h>
+#include <init.h>
#include <linux/ctype.h>
#ifdef CONFIG_ARCH_CPU_INIT
@@ -52,6 +53,37 @@ static u32 __rmobile_get_cpu_rev_fraction(void)
u32 rmobile_get_cpu_rev_fraction(void)
__attribute__((weak, alias("__rmobile_get_cpu_rev_fraction")));
+#if CONFIG_IS_ENABLED(OF_CONTROL)
+static const struct udevice_id tfa_soc_ids[] = {
+ { .compatible = "renesas,r8a774a1", .data = RMOBILE_CPU_TYPE_R8A774A1 },
+ { },
+};
+
+static const u16 rzg2_get_cpu_type(void)
+{
+ const struct udevice_id *of_match = tfa_soc_ids;
+ u32 cpu_type = rmobile_get_cpu_type();
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(tfa_soc_ids); i++) {
+ if (cpu_type == of_match->data &&
+ of_machine_is_compatible(of_match->compatible))
+ return (cpu_type | RZG_CPU_MASK);
+ of_match++;
+ }
+
+ return 0;
+}
+#else
+static const u16 __rzg2_get_cpu_type(void)
+{
+ return 0;
+}
+
+const u16 rzg2_get_cpu_type(void)
+ __attribute__((weak, alias("__rzg2_get_cpu_type")));
+#endif
+
/* CPU infomation table */
static const struct {
u16 cpu_type;
@@ -59,6 +91,7 @@ static const struct {
} rmobile_cpuinfo[] = {
{ RMOBILE_CPU_TYPE_SH73A0, "SH73A0" },
{ RMOBILE_CPU_TYPE_R8A7740, "R8A7740" },
+ { RMOBILE_CPU_TYPE_R8A774A1 | RZG_CPU_MASK, "R8A774A1" },
{ RMOBILE_CPU_TYPE_R8A7790, "R8A7790" },
{ RMOBILE_CPU_TYPE_R8A7791, "R8A7791" },
{ RMOBILE_CPU_TYPE_R8A7792, "R8A7792" },
@@ -77,7 +110,8 @@ static const struct {
static int rmobile_cpuinfo_idx(void)
{
int i = 0;
- u32 cpu_type = rmobile_get_cpu_type();
+ u16 rzg2_cpu_type = rzg2_get_cpu_type();
+ u32 cpu_type = rzg2_cpu_type ? rzg2_cpu_type : rmobile_get_cpu_type();
for (; i < ARRAY_SIZE(rmobile_cpuinfo); i++)
if (rmobile_cpuinfo[i].cpu_type == cpu_type)
diff --git a/arch/arm/mach-rmobile/include/mach/rmobile.h b/arch/arm/mach-rmobile/include/mach/rmobile.h
index a50249dc96..d0a4cfc579 100644
--- a/arch/arm/mach-rmobile/include/mach/rmobile.h
+++ b/arch/arm/mach-rmobile/include/mach/rmobile.h
@@ -27,6 +27,7 @@
/* PRR CPU IDs */
#define RMOBILE_CPU_TYPE_SH73A0 0x37
#define RMOBILE_CPU_TYPE_R8A7740 0x40
+#define RMOBILE_CPU_TYPE_R8A774A1 0x52
#define RMOBILE_CPU_TYPE_R8A7790 0x45
#define RMOBILE_CPU_TYPE_R8A7791 0x47
#define RMOBILE_CPU_TYPE_R8A7792 0x4A
@@ -40,6 +41,9 @@
#define RMOBILE_CPU_TYPE_R8A77990 0x57
#define RMOBILE_CPU_TYPE_R8A77995 0x58
+/* RZ/G CPU Identification Mask */
+#define RZG_CPU_MASK 0x1000
+
#ifndef __ASSEMBLY__
u32 rmobile_get_cpu_type(void);
u32 rmobile_get_cpu_rev_integer(void);
--
2.17.1
More information about the U-Boot
mailing list