From patchwork Wed Jan 26 22:07:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bryan Brattlof X-Patchwork-Id: 1584719 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.a=rsa-sha256 header.s=ti-com-17Q1 header.b=CCUfMfKA; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JkfwH2QlHz9tT8 for ; Thu, 27 Jan 2022 10:25:35 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 063B9837C9; Thu, 27 Jan 2022 00:24:23 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="CCUfMfKA"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 541BC82133; Wed, 26 Jan 2022 23:08:31 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from fllv0015.ext.ti.com (fllv0015.ext.ti.com [198.47.19.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 77AD581E02 for ; Wed, 26 Jan 2022 23:08:28 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=bb@ti.com Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllv0015.ext.ti.com (8.15.2/8.15.2) with ESMTP id 20QM8Qpq066378 for ; Wed, 26 Jan 2022 16:08:26 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1643234906; bh=fSPIspbhDs3BOvv+3j+FJwWgYhmkJshY9dojACaLk4I=; h=From:To:CC:Subject:Date; b=CCUfMfKAoIk7ccXphzj7M01b47Cfm4rJ0w5O1xv5ddvy3yH4h1HzmONCYmhJlEb8X YM573uaA1IQtZ7m/+IrD0gUDwHreWCPQE3fhIf+xQnjSd5JaG8gYRxZwX40q6mKscF /2ZSm9FmKZFbE9JxlocoJCCwMBu49BZS8OMbja0g= Received: from DLEE104.ent.ti.com (dlee104.ent.ti.com [157.170.170.34]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 20QM8QcO048094 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 26 Jan 2022 16:08:26 -0600 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE104.ent.ti.com (157.170.170.34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14; Wed, 26 Jan 2022 16:08:19 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.14 via Frontend Transport; Wed, 26 Jan 2022 16:08:19 -0600 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 20QM8JXN077398; Wed, 26 Jan 2022 16:08:19 -0600 From: Bryan Brattlof To: CC: Bryan Brattlof , Dave Gerlach Subject: [PATCH] soc: soc_ti_k3: update j721e revision numbering Date: Wed, 26 Jan 2022 16:07:33 -0600 Message-ID: <20220126220733.6356-1-bb@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Mailman-Approved-At: Thu, 27 Jan 2022 00:24:06 +0100 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.103.5 at phobos.denx.de X-Virus-Status: Clean There is a 4 bit VARIANT number inside the JTAGID register that TI increments any time a new variant for a chip is produced. Each family of TI's SoCs uses a different versioning scheme based off that VARIANT number. CC: Dave Gerlach Signed-off-by: Bryan Brattlof --- drivers/soc/soc_ti_k3.c | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c index 9abed7d490a2c..7a126857cd709 100644 --- a/drivers/soc/soc_ti_k3.c +++ b/drivers/soc/soc_ti_k3.c @@ -15,9 +15,6 @@ #define J7200 0xbb6d #define AM64X 0xbb38 -#define REV_SR1_0 0 -#define REV_SR2_0 1 - #define JTAG_ID_VARIANT_SHIFT 28 #define JTAG_ID_VARIANT_MASK (0xf << 28) #define JTAG_ID_PARTNO_SHIFT 12 @@ -55,25 +52,42 @@ static const char *get_family_string(u32 idreg) return family; } +static char *j721e_rev_string_map[] = { + "1.0", "1.1", +}; + +static char *am65x_rev_string_map[] = { + "1.0", "2.0", +}; + static const char *get_rev_string(u32 idreg) { - const char *revision; u32 rev; + u32 soc; rev = (idreg & JTAG_ID_VARIANT_MASK) >> JTAG_ID_VARIANT_SHIFT; + soc = (idreg & JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT; - switch (rev) { - case REV_SR1_0: - revision = "1.0"; - break; - case REV_SR2_0: - revision = "2.0"; - break; + switch (soc) { + case J721E: + if (rev > ARRAY_SIZE(j721e_rev_string_map)) + goto bail; + return j721e_rev_string_map[rev]; + + case AM65X: + if (rev > ARRAY_SIZE(am65x_rev_string_map)) + goto bail; + return am65x_rev_string_map[rev]; + + case AM64X: + case J7200: default: - revision = "Unknown Revision"; + if (!rev) + return "1.0"; }; - return revision; +bail: + return "Unknown Revision"; } static int soc_ti_k3_get_family(struct udevice *dev, char *buf, int size)