public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andrew Davis <afd@ti.com>
To: Simon Glass <sjg@chromium.org>, Tom Rini <trini@konsulko.com>,
	<u-boot@lists.denx.de>
Cc: Andrew Davis <afd@ti.com>
Subject: [PATCH 03/12] soc: soc_ti_k3: Use hardware.h to remove definition duplication
Date: Thu, 30 Mar 2023 15:28:48 -0500	[thread overview]
Message-ID: <20230330202857.8216-3-afd@ti.com> (raw)
In-Reply-To: <20230330202857.8216-1-afd@ti.com>

The K3 JTAG and SoC ID information is already stored in the K3 arch
hardware file, include that and use its definitions here.

Signed-off-by: Andrew Davis <afd@ti.com>
---
 drivers/soc/Kconfig     |  2 +-
 drivers/soc/soc_ti_k3.c | 30 +++++++++---------------------
 2 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/drivers/soc/Kconfig b/drivers/soc/Kconfig
index acf555baaec..85dac9de78a 100644
--- a/drivers/soc/Kconfig
+++ b/drivers/soc/Kconfig
@@ -10,7 +10,7 @@ config SOC_DEVICE
 	  specific device variant in use.
 
 config SOC_DEVICE_TI_K3
-	depends on SOC_DEVICE
+	depends on SOC_DEVICE && ARCH_K3
 	bool "Enable SoC Device ID driver for TI K3 SoCs"
 	help
 	  This allows Texas Instruments Keystone 3 SoCs to identify
diff --git a/drivers/soc/soc_ti_k3.c b/drivers/soc/soc_ti_k3.c
index 8af0ac70519..42430d79a7a 100644
--- a/drivers/soc/soc_ti_k3.c
+++ b/drivers/soc/soc_ti_k3.c
@@ -8,21 +8,9 @@
 #include <dm.h>
 #include <soc.h>
 
+#include <asm/arch/hardware.h>
 #include <asm/io.h>
 
-#define AM65X			0xbb5a
-#define J721E			0xbb64
-#define J7200			0xbb6d
-#define AM64X			0xbb38
-#define J721S2			0xbb75
-#define AM62X			0xbb7e
-#define AM62AX			0xbb8d
-
-#define JTAG_ID_VARIANT_SHIFT	28
-#define JTAG_ID_VARIANT_MASK	(0xf << 28)
-#define JTAG_ID_PARTNO_SHIFT	12
-#define JTAG_ID_PARTNO_MASK	(0xffff << 12)
-
 struct soc_ti_k3_plat {
 	const char *family;
 	const char *revision;
@@ -36,25 +24,25 @@ static const char *get_family_string(u32 idreg)
 	soc = (idreg & JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
 
 	switch (soc) {
-	case AM65X:
+	case JTAG_ID_PARTNO_AM65X:
 		family = "AM65X";
 		break;
-	case J721E:
+	case JTAG_ID_PARTNO_J721E:
 		family = "J721E";
 		break;
-	case J7200:
+	case JTAG_ID_PARTNO_J7200:
 		family = "J7200";
 		break;
-	case AM64X:
+	case JTAG_ID_PARTNO_AM64X:
 		family = "AM64X";
 		break;
-	case J721S2:
+	case JTAG_ID_PARTNO_J721S2:
 		family = "J721S2";
 		break;
-	case AM62X:
+	case JTAG_ID_PARTNO_AM62X:
 		family = "AM62X";
 		break;
-	case AM62AX:
+	case JTAG_ID_PARTNO_AM62AX:
 		family = "AM62AX";
 		break;
 	default:
@@ -81,7 +69,7 @@ static const char *get_rev_string(u32 idreg)
 	soc = (idreg & JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
 
 	switch (soc) {
-	case J721E:
+	case JTAG_ID_PARTNO_J721E:
 		if (rev > ARRAY_SIZE(j721e_rev_string_map))
 			goto bail;
 		return j721e_rev_string_map[rev];
-- 
2.39.2


  parent reply	other threads:[~2023-03-30 20:30 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 20:28 [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Andrew Davis
2023-03-30 20:28 ` [PATCH 02/12] arm: mach-k3: Move J721e SoC detection out of common section Andrew Davis
2023-03-30 20:28 ` Andrew Davis [this message]
2023-03-30 20:28 ` [PATCH 04/12] configs: j721x_evm.h: Remove unneeded check for SYS_K3_SPL_ATF Andrew Davis
2023-03-30 20:28 ` [PATCH 05/12] configs: j721s2_evm.h: Remove refrences to J7200 EVM Andrew Davis
2023-03-30 20:28 ` [PATCH 06/12] arm: mach-k3: Make release_resources_for_core_shutdown() common Andrew Davis
2023-03-30 20:28 ` [PATCH 07/12] arm: mach-k3: Move sysfw-loader.h out of mach includes Andrew Davis
2023-03-30 20:28 ` [PATCH 08/12] arm: mach-k3: Add weak do_board_detect() to common file Andrew Davis
2023-04-02 10:44   ` Christian Gmeiner
2023-04-05 14:42     ` Andrew Davis
2023-03-30 20:28 ` [PATCH 09/12] arm: mach-k3: Remove unused fdt_disable_node() Andrew Davis
2023-03-30 20:28 ` [PATCH 10/12] arm: mach-k3: Move sdelay() and wait_on_value() declaration Andrew Davis
2023-03-30 20:28 ` [PATCH 11/12] arm: mach-k3: Move J721s2 SPL init functions to mach-k3 Andrew Davis
2023-03-30 20:28 ` [PATCH 12/12] arm: mach-k3: Remove empty sys_proto.h include Andrew Davis
2023-04-02 10:47 ` [PATCH 01/12] arm: mach-k3: Move MSMC fixup to SoC level Christian Gmeiner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330202857.8216-3-afd@ti.com \
    --to=afd@ti.com \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox