@@ -3,12 +3,13 @@
* (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@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)
@@ -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);