From patchwork Tue Sep 22 16:03:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 1369106 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4BwmM81bljz9sTQ for ; Wed, 23 Sep 2020 02:03:48 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C5EBC823DD; Tue, 22 Sep 2020 18:03:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 9C19D823C2; Tue, 22 Sep 2020 18:03:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,KHOP_HELO_FCRDNS, SPF_HELO_NONE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by phobos.denx.de (Postfix) with ESMTP id 5958482371 for ; Tue, 22 Sep 2020 18:03:27 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=biju.das.jz@bp.renesas.com X-IronPort-AV: E=Sophos;i="5.77,291,1596466800"; d="scan'208";a="57863840" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 23 Sep 2020 01:03:25 +0900 Received: from localhost.localdomain (unknown [172.29.51.95]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id EB1254002C05; Wed, 23 Sep 2020 01:03:23 +0900 (JST) From: Biju Das To: Nobuhiro Iwamatsu , Marek Vasut Cc: Biju Das , u-boot@lists.denx.de, Chris Paterson , Prabhakar Mahadev Lad Subject: [PATCH v3 1/2] arm: rmobile: Add RZ/G2M SoC Date: Tue, 22 Sep 2020 17:03:16 +0100 Message-Id: <20200922160317.16296-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200922160317.16296-1-biju.das.jz@bp.renesas.com> References: <20200922160317.16296-1-biju.das.jz@bp.renesas.com> X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean 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 Reviewed-by: Lad Prabhakar --- 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 * (C) Copyright 2012 Renesas Solutions Corp. */ -#include -#include #include -#include #include +#include +#include +#include #include +#include #include #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);