mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <ahmad@a3f.at>
To: barebox@lists.infradead.org
Subject: [PATCH 7/8] ARM: stm32mp: init: don't query package type
Date: Mon, 30 Mar 2020 16:39:14 +0200	[thread overview]
Message-ID: <20200330143915.663705-7-ahmad@a3f.at> (raw)
In-Reply-To: <20200330143915.663705-1-ahmad@a3f.at>

Now that we have a nvmem cell describing the package, we don't need to
provide a stm32mp_package() function for querying it. Displaying the
package type on every boot is also not that useful, especially when some
SoCs don't even have the bsec field populated.

As the code has now become duplicate (it's used in the stm32-pinctrl
driver), remove it.

Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
---
 arch/arm/mach-stm32mp/include/mach/revision.h |  1 -
 arch/arm/mach-stm32mp/init.c                  | 60 ++-----------------
 2 files changed, 4 insertions(+), 57 deletions(-)

diff --git a/arch/arm/mach-stm32mp/include/mach/revision.h b/arch/arm/mach-stm32mp/include/mach/revision.h
index 2eb4d44b3368..d930bfe836a7 100644
--- a/arch/arm/mach-stm32mp/include/mach/revision.h
+++ b/arch/arm/mach-stm32mp/include/mach/revision.h
@@ -36,7 +36,6 @@
 
 int stm32mp_silicon_revision(void);
 int stm32mp_cputype(void);
-int stm32mp_package(void);
 
 #define cpu_is_stm32mp157c() (stm32mp_cputype() == CPU_STM32MP157Cxx)
 #define cpu_is_stm32mp157a() (stm32mp_cputype() == CPU_STM32MP157Axx)
diff --git a/arch/arm/mach-stm32mp/init.c b/arch/arm/mach-stm32mp/init.c
index d687e44af1ff..3e22490190ec 100644
--- a/arch/arm/mach-stm32mp/init.c
+++ b/arch/arm/mach-stm32mp/init.c
@@ -28,27 +28,11 @@
 
 /* BSEC OTP index */
 #define BSEC_OTP_RPN	1
-#define BSEC_OTP_PKG	16
 
 /* Device Part Number (RPN) = OTP_DATA1 lower 8 bits */
 #define RPN_SHIFT	0
 #define RPN_MASK	GENMASK(7, 0)
 
-/* Package = bit 27:29 of OTP16
- * - 100: LBGA448  (FFI) => AA = LFBGA 18x18mm 448 balls p. 0.8mm
- * - 011: LBGA354  (LCI) => AB = LFBGA 16x16mm 359 balls p. 0.8mm
- * - 010: TFBGA361 (FFC) => AC = TFBGA 12x12mm 361 balls p. 0.5mm
- * - 001: TFBGA257 (LCC) => AD = TFBGA 10x10mm 257 balls p. 0.5mm
- * - others: Reserved
- */
-#define PKG_SHIFT	27
-#define PKG_MASK	GENMASK(2, 0)
-
-#define PKG_AA_LBGA448	4
-#define PKG_AB_LBGA354	3
-#define PKG_AC_TFBGA361	2
-#define PKG_AD_TFBGA257	1
-
 /*
  * enumerated for boot interface from Bootrom, used in TAMP_BOOT_CONTEXT
  * - boot device = bit 8:4
@@ -145,12 +129,6 @@ int stm32mp_silicon_revision(void)
 	return __stm32mp_silicon_revision;
 }
 
-static int __stm32mp_package;
-int stm32mp_package(void)
-{
-	return __stm32mp_package;
-}
-
 static inline u32 read_idc(void)
 {
 	setbits_le32(RCC_DBGCFGR, RCC_DBGCFGR_DBGCKEN);
@@ -185,16 +163,6 @@ static int get_cpu_type(u32 *type)
 	return 0;
 }
 
-static int get_cpu_package(u32 *pkg)
-{
-	int ret = bsec_read_field(BSEC_OTP_PKG, pkg);
-	if (ret)
-		return ret;
-
-	*pkg = (*pkg >> PKG_SHIFT) & PKG_MASK;
-	return 0;
-}
-
 static int stm32mp15_fixup_cpus(struct device_node *root, void *_ctx)
 {
 	unsigned long ctx = (unsigned long)_ctx;
@@ -223,9 +191,8 @@ static int stm32mp15_fixup_cpus(struct device_node *root, void *_ctx)
 
 static int setup_cpu_type(void)
 {
-	const char *cputypestr, *cpupkgstr, *cpurevstr;
+	const char *cputypestr, *cpurevstr;
 	unsigned long fixupctx = 0;
-	u32 pkg;
 
 	get_cpu_type(&__stm32mp_cputype);
 	switch (__stm32mp_cputype) {
@@ -282,25 +249,6 @@ static int setup_cpu_type(void)
 		break;
 	}
 
-	get_cpu_package(&__stm32mp_package );
-	switch (__stm32mp_package) {
-	case PKG_AA_LBGA448:
-		cpupkgstr = "AA";
-		break;
-	case PKG_AB_LBGA354:
-		cpupkgstr = "AB";
-		break;
-	case PKG_AC_TFBGA361:
-		cpupkgstr = "AC";
-		break;
-	case PKG_AD_TFBGA257:
-		cpupkgstr = "AD";
-		break;
-	default:
-		cpupkgstr = "??";
-		break;
-	}
-
 	__stm32mp_silicon_revision = get_cpu_revision();
 	switch (__stm32mp_silicon_revision) {
 	case CPU_REV_A:
@@ -316,9 +264,9 @@ static int setup_cpu_type(void)
 		cpurevstr = "?";
 	}
 
-	pr_debug("cputype = 0x%x, package = 0x%x, revision = 0x%x\n",
-		 __stm32mp_cputype, pkg, __stm32mp_silicon_revision);
-	pr_info("detected STM32MP%s%s Rev.%s\n", cputypestr, cpupkgstr, cpurevstr);
+	pr_debug("cputype = 0x%x, revision = 0x%x\n",
+		 __stm32mp_cputype, __stm32mp_silicon_revision);
+	pr_info("detected STM32MP%s Rev.%s\n", cputypestr, cpurevstr);
 
 	if (fixupctx)
 		return of_register_fixup(stm32mp15_fixup_cpus, (void*)fixupctx);
-- 
2.20.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2020-03-30 14:39 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30 14:39 [PATCH 1/8] ARM: stm32mp: init: don't cast signed error to unsigned Ahmad Fatoum
2020-03-30 14:39 ` [PATCH 2/8] ARM: stm32mp: init: detect Revision Z and 800 MHz profiles Ahmad Fatoum
2020-03-30 14:39 ` [PATCH 3/8] ARM: stm32mp: init: fix up CPU device tree nodes Ahmad Fatoum
2020-03-30 14:39 ` [PATCH 4/8] nvmem: bsec: allow reads at unaligned offsets Ahmad Fatoum
2020-03-30 14:39 ` [PATCH 5/8] nvmem: bsec: remove wrongly named bsec_field type Ahmad Fatoum
2020-05-08 12:53   ` Sascha Hauer
2020-03-30 14:39 ` [PATCH 6/8] pinctrl: stm32: fix up st,package into stm32mp nodes Ahmad Fatoum
2020-03-31  5:45   ` Sascha Hauer
2020-03-31  5:50     ` Ahmad Fatoum
2020-03-31  6:55       ` Sascha Hauer
2020-03-31  7:03         ` Ahmad Fatoum
2020-04-15  9:38     ` Ahmad Fatoum
2020-05-08  6:43       ` Ahmad Fatoum
2020-03-30 14:39 ` Ahmad Fatoum [this message]
2020-03-30 14:39 ` [PATCH 8/8] ARM: stm32mp: add support for STM32MP157-EV1 board Ahmad Fatoum

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=20200330143915.663705-7-ahmad@a3f.at \
    --to=ahmad@a3f.at \
    --cc=barebox@lists.infradead.org \
    /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