u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@foss.st.com>
To: <u-boot@lists.denx.de>
Cc: Alexandru Gagniuc <mr.nuke.me@gmail.com>,
	Marek Vasut <marex@denx.de>,
	Patrick Delaunay <patrick.delaunay@foss.st.com>,
	Patrice Chotard <patrice.chotard@foss.st.com>,
	Tom Rini <trini@konsulko.com>,
	U-Boot STM32 <uboot-stm32@st-md-mailman.stormreply.com>
Subject: [PATCH 1/4] arm: stm32mp: bsec: Update OTP shadow registers in SPL
Date: Mon, 11 Oct 2021 09:52:48 +0200	[thread overview]
Message-ID: <20211011075244.1.Icb805e47dd8102559236013264342b52c187813f@changeid> (raw)

Currently the upper OTP (after 57) are shadowed in U-Boot proper,
when TFABOOT is not used.

This choice cause an issue when U-Boot is not executed after SPL,
so this BSEC initialization is moved in SPL and no more executed in U-Boot,
so it is still executed only one time.

After this patch this BSEC initialization is done in FSBL: SPL or TF-A.

To force this initialization in all the case, the probe of the BSEC
driver is forced in SPL in the arch st32mp function: spl_board_init().

Even if today BSEC driver is already probed in STM32MP15x clock driver
clk_stm32mp1.c because get_cpu_type() is called in
stm32mp1_get_max_opp_freq() function.

Reported-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
---
It is updated version of proposed Alexandru patch:

[v2,06/11] arm: stm32mp: bsec: Update OTP shadow registers in SPL
http://patchwork.ozlabs.org/project/uboot/patch/20210907235933.2798330-7-mr.nuke.me@gmail.com/


 arch/arm/mach-stm32mp/bsec.c | 5 ++---
 arch/arm/mach-stm32mp/cpu.c  | 8 ++++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
index fe39bd80cf..e517acdd01 100644
--- a/arch/arm/mach-stm32mp/bsec.c
+++ b/arch/arm/mach-stm32mp/bsec.c
@@ -503,10 +503,9 @@ static int stm32mp_bsec_probe(struct udevice *dev)
 
 	/*
 	 * update unlocked shadow for OTP cleared by the rom code
-	 * only executed in U-Boot proper when TF-A is not used
+	 * only executed in SPL, it is done in TF-A for TFABOOT
 	 */
-
-	if (!IS_ENABLED(CONFIG_TFABOOT) && !IS_ENABLED(CONFIG_SPL_BUILD)) {
+	if (IS_ENABLED(CONFIG_SPL_BUILD)) {
 		plat = dev_get_plat(dev);
 
 		for (otp = 57; otp <= BSEC_OTP_MAX_VALUE; otp++)
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index eb79f3ffd2..0263ffe96a 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -174,7 +174,15 @@ static void dbgmcu_init(void)
 
 void spl_board_init(void)
 {
+	struct udevice *dev;
+	int ret;
+
 	dbgmcu_init();
+
+	/* force probe of BSEC driver to shadow the upper OTP */
+	ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(stm32mp_bsec), &dev);
+	if (ret)
+		log_warning("BSEC probe failed: %d\n", ret);
 }
 #endif /* !defined(CONFIG_SPL) || defined(CONFIG_SPL_BUILD) */
 
-- 
2.25.1


             reply	other threads:[~2021-10-11  7:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-11  7:52 Patrick Delaunay [this message]
2021-10-11  7:52 ` [PATCH 2/4] stm32mp15: remove configs dependency on CONFIG_TFABOOT Patrick Delaunay
2021-11-22  8:09   ` Patrice CHOTARD
2021-11-22  9:32     ` Ilias Apalodimas
2021-10-11  7:52 ` [PATCH 3/4] stm32mp15: replace CONFIG_TFABOOT when it is possible Patrick Delaunay
2021-11-22  8:42   ` Patrice CHOTARD
2021-10-11  7:52 ` [PATCH 4/4] stm32mp15: tidy up #ifdefs in cpu.c Patrick Delaunay
2021-11-22  8:45   ` Patrice CHOTARD
2021-11-22  7:58 ` [PATCH 1/4] arm: stm32mp: bsec: Update OTP shadow registers in SPL Patrice CHOTARD

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=20211011075244.1.Icb805e47dd8102559236013264342b52c187813f@changeid \
    --to=patrick.delaunay@foss.st.com \
    --cc=marex@denx.de \
    --cc=mr.nuke.me@gmail.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=uboot-stm32@st-md-mailman.stormreply.com \
    /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;
as well as URLs for NNTP newsgroup(s).