From patchwork Fri Sep 15 06:46:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neha Malcom Francis X-Patchwork-Id: 13386392 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BB171EEB59C for ; Fri, 15 Sep 2023 06:47:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hI38nY8JKosAzYZGcpqEuFc9EOHtX6R/ZciXFSFrPes=; b=xH5MG1S1mMSxr0 DVCH6kmAVntSPEHaFVKPkeU5TozxyhKatRcIFqiV5zY8IJqblfwSyUU2Jx7g5JaDqAkM69wyMH+0G kPJ6iMvgCUGE3lEs1/K67CNcC9FMVteQrHxtSBd1nh0EZgm5psEJLOzrRA+G2bWIs5ku7PWvKG+ln PB6f9DZqrAA5R3ECVvR8KvQV3U5q5C17cEIt8bhSrGdO+MLl+hECZCOLvaSCDVd03+cYz+CJeChT1 ifKv9i2t7avk1y2vODwOHGxFGSTzUKmtKimzBPH4cdJtfCYczXAPxRVnvZf+G0osUdGUtwIgDRc8/ 7Jw1HjWFNTiHNPnZ1I0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qh2bc-009vxv-0p; Fri, 15 Sep 2023 06:47:08 +0000 Received: from lelv0143.ext.ti.com ([198.47.23.248]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qh2bY-009vvS-10 for linux-arm-kernel@lists.infradead.org; Fri, 15 Sep 2023 06:47:05 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by lelv0143.ext.ti.com (8.15.2/8.15.2) with ESMTP id 38F6kugw055862; Fri, 15 Sep 2023 01:46:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1694760416; bh=/RvhdqzvbWlRZowZI1olXzllsSEefhamT5zJVlhk5+E=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=lHUmNT+BzY9mTxRert7GHeNPRrJwDOJStH7RxpuC1O5S0qnOFwcHM4ECLosDgIAY0 Ht663MjBrivfv8qGhyC9+1FBAkcMNG6xrnoPIBgqEoxESGr5oZxMDbse8GEvRyD+ac hnNftydkLkuv02sSGgYm+hHWWuchdv85Kfi8BSPQ= Received: from DLEE112.ent.ti.com (dlee112.ent.ti.com [157.170.170.23]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 38F6kuvv043861 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Sep 2023 01:46:56 -0500 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE112.ent.ti.com (157.170.170.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 15 Sep 2023 01:46:55 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 15 Sep 2023 01:46:55 -0500 Received: from a0497641-HP-Z2-Tower-G9-Workstation-Desktop-PC.dhcp.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 38F6kotb071619; Fri, 15 Sep 2023 01:46:53 -0500 From: Neha Malcom Francis To: , , CC: , , , Subject: [PATCH v2 1/2] soc: ti: k3-socinfo: Revamp driver to accommodate different rev structs Date: Fri, 15 Sep 2023 12:16:49 +0530 Message-ID: <20230915064650.2287638-2-n-francis@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915064650.2287638-1-n-francis@ti.com> References: <20230915064650.2287638-1-n-francis@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230914_234704_429256_13A41435 X-CRM114-Status: GOOD ( 15.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org k3-socinfo.c driver assumes silicon revisions to be 1.0, 2.0 etc. for every platform. However this typical style is not followed by J721E (1.0, 1.1) and need not be followed by upcoming silicon revisions as well. Adapt the driver to be similar to its U-Boot counterpart (drivers/soc/soc_ti_k3.c) that accounts for this difference on the basis of partno/family. Note that we change the order of invocation of k3_chipinfo_partno_to_names before k3_chipinfo_variant_to_sr so we have the family name in case error is returned. Signed-off-by: Thejasvi Konduru Signed-off-by: Neha Malcom Francis --- drivers/soc/ti/k3-socinfo.c | 71 +++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 15 deletions(-) diff --git a/drivers/soc/ti/k3-socinfo.c b/drivers/soc/ti/k3-socinfo.c index 6ea9b8c7d335..6de1e3531af9 100644 --- a/drivers/soc/ti/k3-socinfo.c +++ b/drivers/soc/ti/k3-socinfo.c @@ -33,19 +33,37 @@ #define CTRLMMR_WKUP_JTAGID_MFG_TI 0x17 +#define JTAG_ID_PARTNO_AM65X 0xBB5A +#define JTAG_ID_PARTNO_J721E 0xBB64 +#define JTAG_ID_PARTNO_J7200 0xBB6D +#define JTAG_ID_PARTNO_AM64X 0xBB38 +#define JTAG_ID_PARTNO_J721S2 0xBB75 +#define JTAG_ID_PARTNO_AM62X 0xBB7E +#define JTAG_ID_PARTNO_J784S4 0xBB80 +#define JTAG_ID_PARTNO_AM62AX 0xBB8D +#define JTAG_ID_PARTNO_AM62PX 0xBB9D + static const struct k3_soc_id { unsigned int id; const char *family_name; } k3_soc_ids[] = { - { 0xBB5A, "AM65X" }, - { 0xBB64, "J721E" }, - { 0xBB6D, "J7200" }, - { 0xBB38, "AM64X" }, - { 0xBB75, "J721S2"}, - { 0xBB7E, "AM62X" }, - { 0xBB80, "J784S4" }, - { 0xBB8D, "AM62AX" }, - { 0xBB9D, "AM62PX" }, + { JTAG_ID_PARTNO_AM65X, "AM65X" }, + { JTAG_ID_PARTNO_J721E, "J721E" }, + { JTAG_ID_PARTNO_J7200, "J7200" }, + { JTAG_ID_PARTNO_AM64X, "AM64X" }, + { JTAG_ID_PARTNO_J721S2, "J721S2"}, + { JTAG_ID_PARTNO_AM62X, "AM62X" }, + { JTAG_ID_PARTNO_J784S4, "J784S4" }, + { JTAG_ID_PARTNO_AM62AX, "AM62AX" }, + { JTAG_ID_PARTNO_AM62PX, "AM62PX" }, +}; + +static char *j721e_rev_string_map[] = { + "1.0", "1.1", +}; + +static char *k3_rev_string_map[] = { + "1.0", "2.0", "3.0", }; static int @@ -63,6 +81,29 @@ k3_chipinfo_partno_to_names(unsigned int partno, return -EINVAL; } +static int +k3_chipinfo_variant_to_sr(unsigned int partno, unsigned int variant, + struct soc_device_attribute *soc_dev_attr) +{ + switch (partno) { + case JTAG_ID_PARTNO_J721E: + if (variant >= ARRAY_SIZE(j721e_rev_string_map)) + goto bail; + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%s", + j721e_rev_string_map[variant]); + break; + default: + if (variant >= ARRAY_SIZE(k3_rev_string_map)) + goto bail; + soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%s", + k3_rev_string_map[variant]); + } + return 0; + +bail: + return -EINVAL; +} + static int k3_chipinfo_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; @@ -94,7 +135,6 @@ static int k3_chipinfo_probe(struct platform_device *pdev) variant = (jtag_id & CTRLMMR_WKUP_JTAGID_VARIANT_MASK) >> CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT; - variant++; partno_id = (jtag_id & CTRLMMR_WKUP_JTAGID_PARTNO_MASK) >> CTRLMMR_WKUP_JTAGID_PARTNO_SHIFT; @@ -103,15 +143,16 @@ static int k3_chipinfo_probe(struct platform_device *pdev) if (!soc_dev_attr) return -ENOMEM; - soc_dev_attr->revision = kasprintf(GFP_KERNEL, "SR%x.0", variant); - if (!soc_dev_attr->revision) { - ret = -ENOMEM; + ret = k3_chipinfo_partno_to_names(partno_id, soc_dev_attr); + if (ret) { + dev_err(dev, "Unknown SoC JTAGID[0x%08X]\n", jtag_id); + ret = -ENODEV; goto err; } - ret = k3_chipinfo_partno_to_names(partno_id, soc_dev_attr); + ret = k3_chipinfo_variant_to_sr(partno_id, variant, soc_dev_attr); if (ret) { - dev_err(dev, "Unknown SoC JTAGID[0x%08X]\n", jtag_id); + dev_err(dev, "Unknown revision for %s\n", soc_dev_attr->family); ret = -ENODEV; goto err_free_rev; } From patchwork Fri Sep 15 06:46:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neha Malcom Francis X-Patchwork-Id: 13386391 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33B61EEB596 for ; Fri, 15 Sep 2023 06:47:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HVvO5+lnYWGgN0KGKJuD+2kar9/g8/WdNVFkGdEfV3Q=; b=rppQnsU3JY7pDG FArhIwZGuaS2rfxobrH3ejSv0DBJM0AGnm4AkhYrS7b6aFLT8kFXqapmjMjeJxvisgfVhEM72pVNR PWxEPNb8rVtyCTc3RW/N8Aq1uiHzyHPuCqh9PzOJiBLZtE9yPqw+zZhLHII6s7GlYeffHnrWBFh51 zw+wQDeVlb7tfcMfXlQRdKRoFyb0h2dMWPDOHT0MnQYT1g3e7tYs7jX0mXAA4bs7BFm7y8f8EYj0y fJVJa+hk9C+A9Wi1Iz6Dbk0fagVlvFiPHFkK9Q8wDFUKAx7yrzE/lF34eW+PKUDXxX09yMmhxg2in ULvrLYwmN6yt5RX5anZg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qh2bc-009vyQ-2b; Fri, 15 Sep 2023 06:47:08 +0000 Received: from fllv0016.ext.ti.com ([198.47.19.142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qh2bZ-009vvt-1o for linux-arm-kernel@lists.infradead.org; Fri, 15 Sep 2023 06:47:06 +0000 Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllv0016.ext.ti.com (8.15.2/8.15.2) with ESMTP id 38F6kwPS095809; Fri, 15 Sep 2023 01:46:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1694760418; bh=NzM7G5G1bjd/sTR3D+P4BRwYnN4C590BrMv156UxE9A=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=XUnirBViAoKzGXQ9LFMAITLnV1JMeTrSfdiFqy7iMBPcEimBzy96kq+zE2ZmGgdq6 qu7Z17ZFBDIjYWAENhop3ekkp4LgJtTJc9c9mqeIQgcfph4fLYsQpyNvJlu+ZIgAsT 4205i1CLGylXImbLf5/KdNS8RRjZpOi9msAyPaF0= Received: from DFLE104.ent.ti.com (dfle104.ent.ti.com [10.64.6.25]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 38F6kw0a043988 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 15 Sep 2023 01:46:58 -0500 Received: from DFLE102.ent.ti.com (10.64.6.23) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Fri, 15 Sep 2023 01:46:57 -0500 Received: from fllv0039.itg.ti.com (10.64.41.19) by DFLE102.ent.ti.com (10.64.6.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Fri, 15 Sep 2023 01:46:58 -0500 Received: from a0497641-HP-Z2-Tower-G9-Workstation-Desktop-PC.dhcp.ti.com (ileaxei01-snat2.itg.ti.com [10.180.69.6]) by fllv0039.itg.ti.com (8.15.2/8.15.2) with ESMTP id 38F6kotc071619; Fri, 15 Sep 2023 01:46:56 -0500 From: Neha Malcom Francis To: , , CC: , , , Subject: [PATCH v2 2/2] soc: ti k3-socinfo: Fix typo Date: Fri, 15 Sep 2023 12:16:50 +0530 Message-ID: <20230915064650.2287638-3-n-francis@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230915064650.2287638-1-n-francis@ti.com> References: <20230915064650.2287638-1-n-francis@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230914_234705_674654_FF8C0EA6 X-CRM114-Status: GOOD ( 10.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Fix typo in driver that comments out wrong bit. Signed-off-by: Neha Malcom Francis --- drivers/soc/ti/k3-socinfo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/soc/ti/k3-socinfo.c b/drivers/soc/ti/k3-socinfo.c index 6de1e3531af9..417f3f33cd01 100644 --- a/drivers/soc/ti/k3-socinfo.c +++ b/drivers/soc/ti/k3-socinfo.c @@ -20,7 +20,7 @@ * 31-28 VARIANT Device variant * 27-12 PARTNO Part number * 11-1 MFG Indicates TI as manufacturer (0x17) - * 1 Always 1 + * 0 Always 1 */ #define CTRLMMR_WKUP_JTAGID_VARIANT_SHIFT (28) #define CTRLMMR_WKUP_JTAGID_VARIANT_MASK GENMASK(31, 28)