From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Johannes Krottmayer <johannes@krotti42.com>, <u-boot@lists.denx.de>
Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
Subject: Re: [PATCH 01/10] arm: mach-stm32: stm32h7: add initial lowlevel early function
Date: Tue, 27 May 2025 14:59:57 +0200 [thread overview]
Message-ID: <f7c0c3ca-dd2b-4af6-a4c9-e03aaa6ca208@foss.st.com> (raw)
In-Reply-To: <20250508212058.640483-2-johannes@krotti42.com>
On 5/8/25 23:23, Johannes Krottmayer wrote:
> Add new assembly function 'arch_very_early_init'
>
> This functions setups the power supply for STM32H7 SoC's to
> direct SMPS mode, which is required for some boards like
> the STM32H747I-DISCO in the default configuration.
>
> If this isn't done in an early stage it cause a deadlock and
> also the SoC is running in a limited mode according to the
> TRM from the SoC.
>
> Signed-off-by: Johannes Krottmayer <johannes@krotti42.com>
> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com>
> Cc: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
> arch/arm/mach-stm32/stm32h7/lowlevel.S | 45 ++++++++++++++++++++++++++
> 1 file changed, 45 insertions(+)
> create mode 100644 arch/arm/mach-stm32/stm32h7/lowlevel.S
>
> diff --git a/arch/arm/mach-stm32/stm32h7/lowlevel.S b/arch/arm/mach-stm32/stm32h7/lowlevel.S
> new file mode 100644
> index 00000000000..97f4e383e3b
> --- /dev/null
> +++ b/arch/arm/mach-stm32/stm32h7/lowlevel.S
> @@ -0,0 +1,45 @@
> +/* SPDX-License-Identifier: GPL-2.0+ */
> +/*
> + * Copyright (C) 2025, Johannes Krottmayer <johannes@krotti42.com>
> + */
> +
> +#include <linux/linkage.h>
> +
> +/*
> + * STM32H7 PWR registers
> + */
> +#define PWR_CR3 0x5802480C
> +#define PWR_CR3_LDOEN 1
> +
> +#define PWR_CSR1 0x58024804
> +#define PWR_CSR1_ACTVOSRDY 13
> +
> +ENTRY(arch_very_early_init)
> + /*
> + * Setup power supply for STM32H7 to direct SMPS mode.
> + * This is the default configuration from some boards
> + * like the SMT32H747i-DISCO.
> + *
> + * If these steps will not be done, this cause a deadlock.
> + */
> + ldr r6, =PWR_CR3
> + /* Disable LDO */
> + movs r0, #1
> + lsl r1, r0, #PWR_CR3_LDOEN
> + mvn r2, r1
> + ldr r3, [r6]
> + and r3, r2
> + str r3, [r6]
> + lsl r1, r0, #PWR_CSR1_ACTVOSRDY
> +
> + /* Loop until ACTVOSRDY is valid */
> +1:
> + ldr r6, =PWR_CSR1
> + ldr r3, [r6]
> + and r3, r1
> + cmp r3, r1
> + bne 1b
> +
> + /* Jump back to C runtime setup */
> + bx lr
> +ENDPROC(arch_very_early_init)
Hi Johannes
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
Thanks
Patrice
next prev parent reply other threads:[~2025-05-27 13:01 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-08 13:27 U-Boot STM32H747i-DISCO support Johannes Krottmayer
2025-05-08 21:23 ` [PATCH 00/10] add STM32H747 discovery board Johannes Krottmayer
2025-05-27 13:51 ` Patrice CHOTARD
2025-05-08 21:23 ` [PATCH 01/10] arm: mach-stm32: stm32h7: add initial lowlevel early function Johannes Krottmayer
2025-05-27 12:59 ` Patrice CHOTARD [this message]
2025-05-08 21:23 ` [PATCH 02/10] arm: mach-stm32: stm32h7: add initial Makefile Johannes Krottmayer
2025-05-27 13:00 ` Patrice CHOTARD
2025-05-08 21:23 ` [PATCH 03/10] arm: mach-stm32: stm32h7: add STM32H747-DISCO board Johannes Krottmayer
2025-05-27 13:01 ` Patrice CHOTARD
2025-05-08 21:24 ` [PATCH 04/10] arm: mach-stm32: add stm32h7 subdirectory Johannes Krottmayer
2025-05-27 13:07 ` Patrice CHOTARD
2025-05-08 21:24 ` [PATCH 05/10] board: st: add STM32H747 discovery board Johannes Krottmayer
2025-05-27 13:11 ` Patrice CHOTARD
2025-05-08 21:24 ` [PATCH 06/10] configs: " Johannes Krottmayer
2025-05-27 13:12 ` Patrice CHOTARD
2025-05-08 21:24 ` [PATCH 07/10] include: " Johannes Krottmayer
2025-05-27 13:13 ` Patrice CHOTARD
2025-05-08 21:24 ` [PATCH 08/10] arm: dts: " Johannes Krottmayer
2025-05-27 13:23 ` Patrice CHOTARD
2025-05-08 21:24 ` [PATCH 09/10] dts: upstream: arm: st: " Johannes Krottmayer
2025-05-09 11:23 ` Quentin Schulz
2025-05-09 16:32 ` Johannes Krottmayer
2025-05-08 21:24 ` [PATCH 10/10] dts: upstream: arm: st: stm32h7-pinctrl: change pins for USART1 Johannes Krottmayer
2025-05-27 13:26 ` 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=f7c0c3ca-dd2b-4af6-a4c9-e03aaa6ca208@foss.st.com \
--to=patrice.chotard@foss.st.com \
--cc=johannes@krotti42.com \
--cc=patrick.delaunay@foss.st.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.