All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Gerlach <d-gerlach@ti.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 9/9] arm: mach-k3: Use SOC driver for device identification
Date: Wed, 15 Jul 2020 23:40:04 -0500	[thread overview]
Message-ID: <20200716044004.6014-10-d-gerlach@ti.com> (raw)
In-Reply-To: <20200716044004.6014-1-d-gerlach@ti.com>

Make use of UCLASS_SOC to find device family and revision for
print_cpuinfo.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
---
 arch/arm/mach-k3/common.c                | 48 ++++++++++--------------
 arch/arm/mach-k3/common.h                |  6 ---
 arch/arm/mach-k3/include/mach/hardware.h |  1 -
 3 files changed, 19 insertions(+), 36 deletions(-)

diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 9695b2236ecd..b88516b8c02b 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -25,6 +25,7 @@
 #include <fs.h>
 #include <env.h>
 #include <elf.h>
+#include <soc.h>
 
 struct ti_sci_handle *get_ti_sci_handle(void)
 {
@@ -308,38 +309,27 @@ void reset_cpu(ulong ignored)
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
-	u32 soc, rev;
-	char *name;
-
-	soc = (readl(CTRLMMR_WKUP_JTAG_ID) &
-		JTAG_ID_PARTNO_MASK) >> JTAG_ID_PARTNO_SHIFT;
-	rev = (readl(CTRLMMR_WKUP_JTAG_ID) &
-		JTAG_ID_VARIANT_MASK) >> JTAG_ID_VARIANT_SHIFT;
+	struct udevice *soc;
+	char name[64];
+	int ret;
 
 	printf("SoC:   ");
-	switch (soc) {
-	case AM65X:
-		name = "AM65x";
-		break;
-	case J721E:
-		name = "J721E";
-		break;
-	default:
-		name = "Unknown Silicon";
-	};
 
-	printf("%s SR ", name);
-	switch (rev) {
-	case REV_PG1_0:
-		name = "1.0";
-		break;
-	case REV_PG2_0:
-		name = "2.0";
-		break;
-	default:
-		name = "Unknown Revision";
-	};
-	printf("%s\n", name);
+	ret = soc_get(&soc);
+	if (ret) {
+		printf("UNKNOWN\n");
+		return 0;
+	}
+
+	ret = soc_get_family(soc, name, 64);
+	if (!ret) {
+		printf("%s ", name);
+	}
+
+	ret = soc_get_revision(soc, name, 64);
+	if (!ret) {
+		printf("%s\n", name);
+	}
 
 	return 0;
 }
diff --git a/arch/arm/mach-k3/common.h b/arch/arm/mach-k3/common.h
index 94cdcb56aded..ba344c5bc9dd 100644
--- a/arch/arm/mach-k3/common.h
+++ b/arch/arm/mach-k3/common.h
@@ -8,12 +8,6 @@
 
 #include <asm/armv7_mpu.h>
 
-#define AM65X	0xbb5a
-#define J721E	0xbb64
-
-#define REV_PG1_0	0
-#define REV_PG2_0	1
-
 struct fwl_data {
 	const char *name;
 	u16 fwl_id;
diff --git a/arch/arm/mach-k3/include/mach/hardware.h b/arch/arm/mach-k3/include/mach/hardware.h
index 0ad761418bb7..f2ca80af1a9b 100644
--- a/arch/arm/mach-k3/include/mach/hardware.h
+++ b/arch/arm/mach-k3/include/mach/hardware.h
@@ -15,7 +15,6 @@
 #endif
 
 /* Assuming these addresses and definitions stay common across K3 devices */
-#define CTRLMMR_WKUP_JTAG_ID	0x43000014
 #define JTAG_ID_VARIANT_SHIFT	28
 #define JTAG_ID_VARIANT_MASK	(0xf << 28)
 #define JTAG_ID_PARTNO_SHIFT	12
-- 
2.20.1

  parent reply	other threads:[~2020-07-16  4:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16  4:39 [PATCH v2 0/9] Introduce UCLASS_SOC Dave Gerlach
2020-07-16  4:39 ` [PATCH v2 1/9] doc: Add new doc for soc ID driver model Dave Gerlach
2020-07-17  1:58   ` Simon Glass
2020-07-16  4:39 ` [PATCH v2 2/9] dm: soc: Introduce UCLASS_SOC for SOC ID and attribute matching Dave Gerlach
2020-07-16  4:39 ` [PATCH v2 3/9] test: Add tests for SOC uclass Dave Gerlach
2020-07-16  4:39 ` [PATCH v2 4/9] dm: soc: Introduce soc_ti_k3 driver for TI K3 SoCs Dave Gerlach
2020-07-16  4:40 ` [PATCH v2 5/9] arm: dts: k3-am65-wakeup: Introduce chipid node Dave Gerlach
2020-07-16  4:40 ` [PATCH v2 6/9] arm: dts: k3-j721e-mcu-wakeup: " Dave Gerlach
2020-07-16  4:40 ` [PATCH v2 7/9] configs: am65x_evm: Enable CONFIG_SOC_DEVICE and CONFIG_SOC_DEVICE_TI_K3 Dave Gerlach
2020-07-16  4:40 ` [PATCH v2 8/9] configs: j721e_evm: " Dave Gerlach
2020-07-16  4:40 ` Dave Gerlach [this message]
2020-07-16 14:54 ` [PATCH v2 0/9] Introduce UCLASS_SOC Grygorii Strashko

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=20200716044004.6014-10-d-gerlach@ti.com \
    --to=d-gerlach@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.