stm32mp1: use OPP information for PLL1 settings in SPL
Subsystems (5)
v2 cover stm32mp1: use OPP information for PLL1 settings in SPL
This serie allows to switch the CPU frequency to the max frequency supported in OPP device tree nodes and supported by STM32MP SOC (800MHz is supported by STM32MP15xD and STM32MP15xF).
Board also increases the VDDCore voltage to support this new operation point.
This V2 version of [1] is rebased on top of custodian stm32 and solve issue with dh_stm32mp1 (because spl.c was shared between stm32mp1 and dh_stm32mp1).
[1] http://patchwork.ozlabs.org/project/uboot/list/?series=171767&state=*
Changes in v2:
- add stpmic1_init function, called in board_early_init_f for dh_stm32mp1 board support (and no more use spl.c from stm32mp1)
- remove CONFIG_SPL_BOARD_INIT
- stmpic_buck1_set is a static function called in stpmic1_init (with new parameter for vddcore value)
- update also dh_stm32mp1 board
- update stm32mp15xx-dhcor and dhcom device tree
- NEW: merge spl.c and board.c to avoid a file with only one function
Patrick Delaunay (9):
arm: stm32mp: spl: add bsec driver in SPL
ARM: dts: stm32: add cpufreq support on stm32mp15x
board: st: create common file stpmic1.c
stm32mp1: clk: configure pll1 with OPP
arm: stm32mp: add weak function to save vddcore
board: st: stpmic1: add function stpmic1_init
board: stm32mp1: update vddcore in SPL
ARM: dts: stm32mp1: use OPP information for PLL1 settings in SPL
board: stm32mp1: move the function board_debug_uart_init in spl.c
arch/arm/dts/stm32mp15-u-boot.dtsi | 12 +-
arch/arm/dts/stm32mp151.dtsi | 21 ++
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 9 -
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 9 -
arch/arm/dts/stm32mp157c-ed1.dts | 8 +
arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 9 -
arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 9 -
arch/arm/dts/stm32mp15xx-dkx.dtsi | 8 +
arch/arm/mach-stm32mp/Kconfig | 1 -
arch/arm/mach-stm32mp/Makefile | 2 +-
arch/arm/mach-stm32mp/bsec.c | 11 +-
.../arm/mach-stm32mp/include/mach/sys_proto.h | 3 +
board/dhelectronics/dh_stm32mp1/Makefile | 6 +-
board/dhelectronics/dh_stm32mp1/board.c | 10 +
board/st/common/Makefile | 1 +
.../st/{stm32mp1/board.c => common/stpmic1.c} | 82 +++--
board/st/common/stpmic1.h | 6 +
board/st/stm32mp1/Makefile | 2 -
board/st/stm32mp1/spl.c | 72 +++--
board/st/stm32mp1/stm32mp1.c | 6 +
configs/stm32mp15_basic_defconfig | 1 +
.../clock/st,stm32mp1.txt | 4 +
drivers/clk/clk_stm32mp1.c | 295 ++++++++++++++++--
23 files changed, 445 insertions(+), 142 deletions(-)
rename board/st/{stm32mp1/board.c => common/stpmic1.c} (74%)
create mode 100644 board/st/common/stpmic1.hSignature · 1 line
2.17.1
PATCH v2 1/9 arm: stm32mp: spl: add bsec driver in SPL
Add the bsec driver in SPL, as it is needed by SOC part number detection to found the supported OPP.
---
Changes in v2: None
arch/arm/dts/stm32mp15-u-boot.dtsi | 2 +- arch/arm/mach-stm32mp/Makefile | 2 +- arch/arm/mach-stm32mp/bsec.c | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-)
arch/arm/dts/stm32mp15-u-boot.dtsi +1 -1
@@ -65,7 +65,7 @@ }; &bsec { - u-boot,dm-pre-proper; + u-boot,dm-pre-reloc; }; &clk_csi {
arch/arm/mach-stm32mp/Makefile +1 -1
@@ -6,12 +6,12 @@ obj-y += cpu.o obj-y += dram_init.o obj-y += syscon.o +obj-y += bsec.o ifdef CONFIG_SPL_BUILD obj-y += spl.o else obj-$(CONFIG_CMD_STM32PROG) += cmd_stm32prog/ -obj-y += bsec.o obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o obj-$(CONFIG_ARMV7_PSCI) += psci.o obj-$(CONFIG_TFABOOT) += boot_params.o
arch/arm/mach-stm32mp/bsec.c +6 -5
@@ -473,20 +473,23 @@ static int stm32mp_bsec_ofdata_to_platdata(struct udevice *dev)return 0 ; } -#ifndef CONFIG_TFABOOT static int stm32mp_bsec_probe (struct udevice *dev) { +#if !defined(CONFIG_TFABOOT ) && !defined(CONFIG_SPL_BUILD )int otp;struct stm32mp_bsec_platdata *plat =dev_get_platdata (dev); -/* update unlocked shadow for OTP cleared by the rom code */ +/* +* update unlocked shadow for OTP cleared by the rom code +* only executed in U-Boot proper when TF-A is not used +*/ for (otp =57 ; otp <=BSEC_OTP_MAX_VALUE ; otp++)if (!bsec_read_SR_lock (plat->base, otp))bsec_shadow_register (plat->base, otp); +#endif return 0 ; } -#endif static const struct udevice_id stm32mp_bsec_ids[] = { { .compatible ="st,stm32mp15-bsec" },
@@ -500,7 +503,5 @@ U_BOOT_DRIVER(stm32mp_bsec) = { .ofdata_to_platdata = stm32mp_bsec_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct stm32mp_bsec_platdata), .ops = &stm32mp_bsec_ops, -#ifndef CONFIG_TFABOOT .probe = stm32mp_bsec_probe, -#endif };
Signature · 1 line
2.17.1
PATCH v2 1/9 arm: stm32mp: spl: add bsec driver in SPL
HI Patrick
Quoted 77 lines · Patrick Delaunay
Add the bsec driver in SPL, as it is needed by SOC part number detection to found the supported OPP.
Signed-off-by Patrick Delaunay <[email protected]>Reviewed-by Patrice Chotard <[email protected]>---
Changes in v2: None
arch/arm/dts/stm32mp15-u-boot.dtsi | 2 +- arch/arm/mach-stm32mp/Makefile | 2 +- arch/arm/mach-stm32mp/bsec.c | 11 ++++++----- 3 files changed, 8 insertions(+), 7 deletions(-)arch/arm/dts/stm32mp15-u-boot.dtsi +1
-1@@ -65,7 +65,7 @@ }; &bsec { - u-boot,dm-pre-proper; + u-boot,dm-pre-reloc; }; &clk_csi {arch/arm/mach-stm32mp/Makefile +1
-1@@ -6,12 +6,12 @@ obj-y += cpu.o obj-y += dram_init.o obj-y += syscon.o +obj-y += bsec.o ifdef CONFIG_SPL_BUILD obj-y += spl.o else obj-$(CONFIG_CMD_STM32PROG) += cmd_stm32prog/ -obj-y += bsec.o obj-$(CONFIG_CMD_STM32KEY) += cmd_stm32key.o obj-$(CONFIG_ARMV7_PSCI) += psci.o obj-$(CONFIG_TFABOOT) += boot_params.oarch/arm/mach-stm32mp/bsec.c +6
-3@@ -473,20 +473,23 @@ static int stm32mp_bsec_ofdata_to_platdata(struct udevice *dev)return 0 ; } -#ifndef CONFIG_TFABOOT static int stm32mp_bsec_probe (struct udevice *dev) { +#if !defined(CONFIG_TFABOOT ) && !defined(CONFIG_SPL_BUILD )int otp;struct stm32mp_bsec_platdata *plat =dev_get_platdata (dev); -/* update unlocked shadow for OTP cleared by the rom code */ +/* +* update unlocked shadow for OTP cleared by the rom code +* only executed in U-Boot proper when TF-A is not used +*/ for (otp =57 ; otp <=BSEC_OTP_MAX_VALUE ; otp++)if (!bsec_read_SR_lock (plat->base, otp))bsec_shadow_register (plat->base, otp); +#endif return 0 ; } -#endif static const struct udevice_id stm32mp_bsec_ids[] = { { .compatible ="st,stm32mp15-bsec" },
arch/arm/mach-stm32mp/bsec.c U_BOOT_DRIVER(stm32mp_bsec) = { · line 507
Quoted 7 lines
arch/arm/mach-stm32mp/bsec.c +0
-2@@ -500,7 +503,5 @@ U_BOOT_DRIVER(stm32mp_bsec) = { .ofdata_to_platdata = stm32mp_bsec_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct stm32mp_bsec_platdata), .ops = &stm32mp_bsec_ops, -#ifndef CONFIG_TFABOOT .probe = stm32mp_bsec_probe, -#endif };
Thanks
PATCH v2 2/9 ARM: dts: stm32: add cpufreq support on stm32mp15x
In reply to Patrick DelaunayThis commit adds cpufreq support on stm32mp15x SOC. STM32 cpufreq uses operating points V2 bindings (no legacy). Nvmem cells have to be used to know the chip version and then which OPPs are available. Note that STM32 cpufreq driver is mainly based on "cpufreq-dt" driver.
---
Changes in v2: None
arch/arm/dts/stm32mp151.dtsi | 21 +++++++++++++++++++++ arch/arm/dts/stm32mp157c-ed1.dts | 8 ++++++++ arch/arm/dts/stm32mp15xx-dkx.dtsi | 8 ++++++++ 3 files changed, 37 insertions(+)
arch/arm/dts/stm32mp151.dtsi +21 -0
@@ -20,6 +20,24 @@ clock-frequency = <650000000>; device_type = "cpu"; reg = <0>; + operating-points-v2 = <&cpu0_opp_table>; + nvmem-cells = <&part_number_otp>; + nvmem-cell-names = "part_number"; + }; + }; + + cpu0_opp_table: cpu0-opp-table { + compatible = "operating-points-v2"; + opp-shared; + opp-650000000 { + opp-hz = /bits/ 64 <650000000>; + opp-microvolt = <1200000>; + opp-supported-hw = <0x1>; + }; + opp-800000000 { + opp-hz = /bits/ 64 <800000000>; + opp-microvolt = <1350000>; + opp-supported-hw = <0x2>; }; };
@@ -1522,6 +1540,9 @@ reg = <0x5c005000 0x400>; #address-cells = <1>; #size-cells = <1>; + part_number_otp: part_number_otp at 4 { + reg = <0x4 0x1>; + }; ts_cal1: calib at 5c { reg = <0x5c 0x2>; };
arch/arm/dts/stm32mp157c-ed1.dts +8 -0
@@ -112,6 +112,14 @@ }; }; +&cpu0{ + cpu-supply = <&vddcore>; +}; + +&cpu1{ + cpu-supply = <&vddcore>; +}; + &dac { pinctrl-names = "default"; pinctrl-0 = <&dac_ch1_pins_a &dac_ch2_pins_a>;
arch/arm/dts/stm32mp15xx-dkx.dtsi +8 -0
@@ -121,6 +121,14 @@ status = "okay"; }; +&cpu0{ + cpu-supply = <&vddcore>; +}; + +&cpu1{ + cpu-supply = <&vddcore>; +}; + ðernet0 { status = "okay"; pinctrl-0 = <ðernet0_rgmii_pins_a>;
Signature · 1 line
2.17.1
PATCH v2 3/9 board: st: create common file stpmic1.c
In reply to Patrick DelaunayMove function board_ddr_power_init() in a new file stpmic1 in board/st/common to avoid duplicated code in each board using stpmic1
---
Changes in v2: None
board/dhelectronics/dh_stm32mp1/Makefile | 2 +- board/st/common/Makefile | 1 + board/st/common/stpmic1.c | 162 +++++++++++++++++++++++ board/st/stm32mp1/board.c | 158 ---------------------- 4 files changed, 164 insertions(+), 159 deletions(-) create mode 100644 board/st/common/stpmic1.c
board/dhelectronics/dh_stm32mp1/Makefile +1 -1
@@ -7,7 +7,7 @@ ifdef CONFIG_SPL_BUILD obj-y += ../../st/stm32mp1/spl.o endif -obj-y += ../../st/stm32mp1/board.o board.o +obj-y += ../../st/common/stpmic1.o board.o obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += ../../st/common/stm32mp_mtdparts.o obj-$(CONFIG_SET_DFU_ALT_INFO) += ../../st/common/stm32mp_dfu.o
board/st/common/Makefile +1 -0
@@ -4,6 +4,7 @@ # obj-$(CONFIG_CMD_STBOARD) += cmd_stboard.o +obj-$(CONFIG_PMIC_STPMIC1) += stpmic1.o ifeq ($(CONFIG_ARCH_STM32MP),y) obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += stm32mp_mtdparts.o
board/st/common/stpmic1.c new file +162 -0
162 lines not on this page · raw message
board/st/stm32mp1/board.c +0 -158
168 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 4/9 stm32mp1: clk: configure pll1 with OPP
In reply to Patrick DelaunayThe PLL1 node (st,pll1) is optional in device tree, the max supported frequency define in OPP node is used when the node is absent.
---
Changes in v2: None
.../clock/st,stm32mp1.txt | 4 + drivers/clk/clk_stm32mp1.c | 290 ++++++++++++++++-- 2 files changed, 266 insertions(+), 28 deletions(-)
doc/device-tree-bindings/clock/st,stm32mp1.txt +4 -0
@@ -87,6 +87,10 @@ Optional Properties: are listed with associated reg 0 to 3. PLLx is off when the associated node is absent or deactivated. + For PLL1, when the node is absent, the frequency of the OPP node is used + to compute the PLL setting (see compatible "operating-points-v2" in + opp/opp.txt for details). + Here are the available properties for each PLL node: - compatible: should be "st,stm32mp1-pll"
drivers/clk/clk_stm32mp1.c +262 -28
342 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH v2 5/9 arm: stm32mp: add weak function to save vddcore
In reply to Patrick DelaunayAdd a weak functions to save the vddcore voltage value provided in the OPP node when the clock tree is initialized.
---
Changes in v2: None
arch/arm/mach-stm32mp/include/mach/sys_proto.h | 3 +++ drivers/clk/clk_stm32mp1.c | 5 +++++ 2 files changed, 8 insertions(+)
arch/arm/mach-stm32mp/include/mach/sys_proto.h +3 -0
@@ -48,3 +48,6 @@ void get_soc_name(char name[SOC_NAME_SIZE]);u32 get_bootmode (void );int setup_mac_address (void ); + +/* board power management : configure vddcore according OPP */ +void board_vddcore_init (u32 voltage_mv);
drivers/clk/clk_stm32mp1.c +5 -0
@@ -1226,6 +1226,10 @@ bool stm32mp1_supports_opp(u32 opp_id, u32 cpu_type) } } +__weak void board_vddcore_init (u32 voltage_mv) +{ +} +/* * gets OPP parameters (frequency in KHz and voltage in mV) from * an OPP table subnode. Platform HW support capabilities are also checked.
@@ -1303,6 +1307,7 @@ int stm32mp1_get_max_opp_freq(struct stm32mp1_clk_priv *priv, u64 *freq_hz)return -FDT_ERR_NOTFOUND ; *freq_hz = (u64 )1000U * freq; +board_vddcore_init (voltage);return 0 ; }
Signature · 1 line
2.17.1
PATCH v2 6/9 board: st: stpmic1: add function stpmic1_init
In reply to Patrick DelaunayAdd a function stmpic_init to early initialize the PMIC STPMIC1
- keep vdd on during the reset cycle (to avoid issue when backup battery is absent)
- Check if debug is enabled to program PMIC according to the bit
This patch allows to remove the compilation of spl.c file from stm32mp1 board in dh_stm32mp1.
CONFIG_SPL_BOARD_INIT is removed as the new function is called earlier in SPL, in the function board_early_init_f.
---
Changes in v2:
- add stpmic1_init function, called in board_early_init_f for dh_stm32mp1 board support (and no more use spl.c from stm32mp1)
- remove CONFIG_SPL_BOARD_INIT
arch/arm/mach-stm32mp/Kconfig | 1 - board/dhelectronics/dh_stm32mp1/Makefile | 4 --- board/dhelectronics/dh_stm32mp1/board.c | 3 ++ board/st/common/stpmic1.c | 31 +++++++++++++++++++ board/st/common/stpmic1.h | 6 ++++ board/st/stm32mp1/spl.c | 39 +++--------------------- board/st/stm32mp1/stm32mp1.c | 6 ++++ configs/stm32mp15_basic_defconfig | 1 + 8 files changed, 52 insertions(+), 39 deletions(-) create mode 100644 board/st/common/stpmic1.h
arch/arm/mach-stm32mp/Kconfig +0 -1
@@ -1,7 +1,6 @@ if ARCH_STM32MP config SPL - select SPL_BOARD_INIT select SPL_CLK select SPL_DM select SPL_DM_SEQ_ALIAS
board/dhelectronics/dh_stm32mp1/Makefile +0 -4
@@ -3,10 +3,6 @@ # Copyright (C) 2018, STMicroelectronics - All Rights Reserved # -ifdef CONFIG_SPL_BUILD -obj-y += ../../st/stm32mp1/spl.o -endif - obj-y += ../../st/common/stpmic1.o board.o obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += ../../st/common/stm32mp_mtdparts.o
board/dhelectronics/dh_stm32mp1/board.c +3 -0
@@ -37,6 +37,7 @@#include <usb.h> #include <usb/dwc2_udc.h> #include <watchdog.h> +#include "../../st/common/stpmic1.h" /* SYSCFG registers */ #define SYSCFG_BOOTR 0x00
@@ -194,6 +195,8 @@ int board_stm32mp1_ddr_config_name_match(struct udevice *dev,int board_early_init_f (void ) { +if (IS_ENABLED (CONFIG_SPL_BUILD )) +stpmic1_init ();board_get_coding_straps ();return 0 ;
board/st/common/stpmic1.c +31 -0
@@ -5,6 +5,7 @@#include <common.h> #include <dm.h> +#include <asm/io.h> #include <asm/arch/ddr.h> #include <power/pmic.h> #include <power/stpmic1.h>
@@ -160,3 +161,33 @@ int board_ddr_power_init(enum ddr_type ddr_type)return 0 ; } + +/* early init of PMIC */ +void stpmic1_init (void ) +{ +struct udevice *dev; + +if (uclass_get_device_by_driver (UCLASS_PMIC , +DM_GET_DRIVER (pmic_stpmic1), &dev)) +return ; + +/* Keep vdd on during the reset cycle */ +pmic_clrsetbits (dev, +STPMIC1_BUCKS_MRST_CR , +STPMIC1_MRST_BUCK (STPMIC1_BUCK3 ), +STPMIC1_MRST_BUCK (STPMIC1_BUCK3 )); + +/* Check if debug is enabled to program PMIC according to the bit */ +if (readl (TAMP_BOOT_CONTEXT ) &TAMP_BOOT_DEBUG_ON ) { +printf ("Keep debug unit ON\n" ); + +pmic_clrsetbits (dev,STPMIC1_BUCKS_MRST_CR , +STPMIC1_MRST_BUCK_DEBUG , +STPMIC1_MRST_BUCK_DEBUG ); + +if (STPMIC1_MRST_LDO_DEBUG ) +pmic_clrsetbits (dev,STPMIC1_LDOS_MRST_CR , +STPMIC1_MRST_LDO_DEBUG , +STPMIC1_MRST_LDO_DEBUG ); + } +}
board/st/common/stpmic1.h new file +6 -0
@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ +/* +* Copyright (C) 2020, STMicroelectronics - All Rights Reserved +*/ + +void stpmic1_init (void );
board/st/stm32mp1/spl.c +5 -34
@@ -5,41 +5,12 @@#include <config.h> #include <common.h> -#include <spl.h> -#include <dm.h> -#include <ram.h> -#include <asm/io.h> -#include <power/pmic.h> -#include <power/stpmic1.h> -#include <asm/arch/ddr.h> +#include "../common/stpmic1.h" -void spl_board_init (void ) +int board_early_init_f (void ) { -/* Keep vdd on during the reset cycle */ -#if defined(CONFIG_PMIC_STPMIC1 ) && defined(CONFIG_SPL_POWER_SUPPORT ) -struct udevice *dev; -int ret; +if (IS_ENABLED (CONFIG_PMIC_STPMIC1 ) &&CONFIG_IS_ENABLED (POWER_SUPPORT )) +stpmic1_init (); - ret =uclass_get_device_by_driver (UCLASS_PMIC , -DM_GET_DRIVER (pmic_stpmic1), &dev); -if (!ret) -pmic_clrsetbits (dev, -STPMIC1_BUCKS_MRST_CR , -STPMIC1_MRST_BUCK (STPMIC1_BUCK3 ), -STPMIC1_MRST_BUCK (STPMIC1_BUCK3 )); - -/* Check if debug is enabled to program PMIC according to the bit */ -if ((readl (TAMP_BOOT_CONTEXT ) &TAMP_BOOT_DEBUG_ON ) && !ret) { -printf ("Keep debug unit ON\n" ); - -pmic_clrsetbits (dev,STPMIC1_BUCKS_MRST_CR , -STPMIC1_MRST_BUCK_DEBUG , -STPMIC1_MRST_BUCK_DEBUG ); - -if (STPMIC1_MRST_LDO_DEBUG ) -pmic_clrsetbits (dev,STPMIC1_LDOS_MRST_CR , -STPMIC1_MRST_LDO_DEBUG , -STPMIC1_MRST_LDO_DEBUG ); - } -#endif +return 0 ; }
board/st/stm32mp1/stm32mp1.c +6 -0
@@ -79,6 +79,12 @@ DECLARE_GLOBAL_DATA_PTR;#define USB_START_LOW_THRESHOLD_UV 1230000#define USB_START_HIGH_THRESHOLD_UV 2150000 +int board_early_init_f (void ) +{ +/* nothing to do, only used in SPL */ +return 0 ; +} +int checkboard (void ) {int ret;
configs/stm32mp15_basic_defconfig +1 -0
@@ -16,6 +16,7 @@ CONFIG_SPL_TEXT_BASE=0x2FFC2500 CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" +CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3 CONFIG_SPL_I2C_SUPPORT=y
Signature · 1 line
2.17.1
PATCH v2 6/9 board: st: stpmic1: add function stpmic1_init
Hi Patrick
Quoted 209 lines · Patrick Delaunay
Add a function
stmpic_initto early initialize the PMIC STPMIC1
- keep vdd on during the reset cycle (to avoid issue when backup battery is absent)
- Check if debug is enabled to program PMIC according to the bitThis patch allows to remove the compilation of
spl.cfile from stm32mp1 board indh_stm32mp1.
CONFIG_SPL_BOARD_INITis removed as the new function is called earlier in SPL, in the functionboard_early_init_f.Signed-off-by Patrick Delaunay <[email protected]>---
Changes in v2:
- addstpmic1_initfunction, called inboard_early_init_ffordh_stm32mp1board support (and no more usespl.cfrom stm32mp1)
- removeCONFIG_SPL_BOARD_INITarch/arm/mach-stm32mp/Kconfig | 1 - board/dhelectronics/dh_stm32mp1/Makefile | 4 --- board/dhelectronics/dh_stm32mp1/board.c | 3 ++ board/st/common/stpmic1.c | 31 +++++++++++++++++++ board/st/common/stpmic1.h | 6 ++++ board/st/stm32mp1/spl.c | 39 +++--------------------- board/st/stm32mp1/stm32mp1.c | 6 ++++ configs/stm32mp15_basic_defconfig | 1 + 8 files changed, 52 insertions(+), 39 deletions(-) create mode 100644 board/st/common/stpmic1.harch/arm/mach-stm32mp/Kconfig +0
-1@@ -1,7 +1,6 @@ if ARCH_STM32MP config SPL - select SPL_BOARD_INIT select SPL_CLK select SPL_DM select SPL_DM_SEQ_ALIASboard/dhelectronics/dh_stm32mp1/Makefile +0
-4@@ -3,10 +3,6 @@ # Copyright (C) 2018, STMicroelectronics - All Rights Reserved # -ifdef CONFIG_SPL_BUILD -obj-y += ../../st/stm32mp1/spl.o -endif - obj-y += ../../st/common/stpmic1.o board.o obj-$(CONFIG_SYS_MTDPARTS_RUNTIME) += ../../st/common/stm32mp_mtdparts.oboard/dhelectronics/dh_stm32mp1/board.c +3
-0@@ -37,6 +37,7 @@#include <usb.h> #include <usb/dwc2_udc.h> #include <watchdog.h> +#include "../../st/common/stpmic1.h" /* SYSCFG registers */ #define SYSCFG_BOOTR 0x00@@ -194,6 +195,8 @@ int board_stm32mp1_ddr_config_name_match(struct udevice *dev,int board_early_init_f (void ) { +if (IS_ENABLED (CONFIG_SPL_BUILD )) +stpmic1_init ();board_get_coding_straps ();return 0 ;board/st/common/stpmic1.c +31
-0@@ -5,6 +5,7 @@#include <common.h> #include <dm.h> +#include <asm/io.h> #include <asm/arch/ddr.h> #include <power/pmic.h> #include <power/stpmic1.h> @@ -160,3 +161,33 @@ int board_ddr_power_init(enum ddr_type ddr_type)return 0 ; } + +/* early init of PMIC */ +void stpmic1_init (void ) +{ +struct udevice *dev; + +if (uclass_get_device_by_driver (UCLASS_PMIC , +DM_GET_DRIVER (pmic_stpmic1), &dev)) +return ; + +/* Keep vdd on during the reset cycle */ +pmic_clrsetbits (dev, +STPMIC1_BUCKS_MRST_CR , +STPMIC1_MRST_BUCK (STPMIC1_BUCK3 ), +STPMIC1_MRST_BUCK (STPMIC1_BUCK3 )); + +/* Check if debug is enabled to program PMIC according to the bit */ +if (readl (TAMP_BOOT_CONTEXT ) &TAMP_BOOT_DEBUG_ON ) { +printf ("Keep debug unit ON\n" ); + +pmic_clrsetbits (dev,STPMIC1_BUCKS_MRST_CR , +STPMIC1_MRST_BUCK_DEBUG , +STPMIC1_MRST_BUCK_DEBUG ); + +if (STPMIC1_MRST_LDO_DEBUG ) +pmic_clrsetbits (dev,STPMIC1_LDOS_MRST_CR , +STPMIC1_MRST_LDO_DEBUG , +STPMIC1_MRST_LDO_DEBUG ); + } +}board/st/common/stpmic1.h new file +6
-0@@ -0,0 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause */ +/* +* Copyright (C) 2020, STMicroelectronics - All Rights Reserved +*/ + +void stpmic1_init (void );board/st/stm32mp1/spl.c +5
-34@@ -5,41 +5,12 @@#include <config.h> #include <common.h> -#include <spl.h> -#include <dm.h> -#include <ram.h> -#include <asm/io.h> -#include <power/pmic.h> -#include <power/stpmic1.h> -#include <asm/arch/ddr.h> +#include "../common/stpmic1.h" -void spl_board_init (void ) +int board_early_init_f (void ) { -/* Keep vdd on during the reset cycle */ -#if defined(CONFIG_PMIC_STPMIC1 ) && defined(CONFIG_SPL_POWER_SUPPORT ) -struct udevice *dev; -int ret; +if (IS_ENABLED (CONFIG_PMIC_STPMIC1 ) &&CONFIG_IS_ENABLED (POWER_SUPPORT )) +stpmic1_init (); - ret =uclass_get_device_by_driver (UCLASS_PMIC , -DM_GET_DRIVER (pmic_stpmic1), &dev); -if (!ret) -pmic_clrsetbits (dev, -STPMIC1_BUCKS_MRST_CR , -STPMIC1_MRST_BUCK (STPMIC1_BUCK3 ), -STPMIC1_MRST_BUCK (STPMIC1_BUCK3 )); - -/* Check if debug is enabled to program PMIC according to the bit */ -if ((readl (TAMP_BOOT_CONTEXT ) &TAMP_BOOT_DEBUG_ON ) && !ret) { -printf ("Keep debug unit ON\n" ); - -pmic_clrsetbits (dev,STPMIC1_BUCKS_MRST_CR , -STPMIC1_MRST_BUCK_DEBUG , -STPMIC1_MRST_BUCK_DEBUG ); - -if (STPMIC1_MRST_LDO_DEBUG ) -pmic_clrsetbits (dev,STPMIC1_LDOS_MRST_CR , -STPMIC1_MRST_LDO_DEBUG , -STPMIC1_MRST_LDO_DEBUG ); - } -#endif +return 0 ; }board/st/stm32mp1/stm32mp1.c +6
-0@@ -79,6 +79,12 @@ DECLARE_GLOBAL_DATA_PTR;#define USB_START_LOW_THRESHOLD_UV 1230000#define USB_START_HIGH_THRESHOLD_UV 2150000 +int board_early_init_f (void ) +{ +/* nothing to do, only used in SPL */ +return 0 ; +} +int checkboard (void ) {int ret;configs/stm32mp15_basic_defconfig +0
-0
configs/stm32mp15_basic_defconfig CONFIG_SPL_TEXT_BASE=0x2FFC2500 · line 22
Quoted 7 lines
configs/stm32mp15_basic_defconfig +1
-0@@ -16,6 +16,7 @@ CONFIG_SPL_TEXT_BASE=0x2FFC2500 CONFIG_DISTRO_DEFAULTS=y CONFIG_FIT=y CONFIG_BOOTCOMMAND="run bootcmd_stm32mp" +CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION=y CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION=3 CONFIG_SPL_I2C_SUPPORT=y
Thanks
PATCH v2 7/9 board: stm32mp1: update vddcore in SPL
In reply to Patrick DelaunayFor board using STPMIC1, the vddcore is provided by BUCK1 of STPMIC1 and need to be updated for 800MHz support and only after the clock tree initialization.
The VDDCORE voltage value is provided by clock driver, saved in global variable opp_voltage_mv and udpated in SPL board_early_init_f(), just after clock tree initialization.
---
Changes in v2:
- stmpic_buck1_set is a static function called in stpmic1_init (with new parameter for vddcore value)
- update also dh_stm32mp1 board
board/dhelectronics/dh_stm32mp1/board.c | 9 ++++++++- board/st/common/stpmic1.c | 23 ++++++++++++++++++++++- board/st/common/stpmic1.h | 2 +- board/st/stm32mp1/spl.c | 11 ++++++++++- 4 files changed, 41 insertions(+), 4 deletions(-)
board/dhelectronics/dh_stm32mp1/board.c +8 -1
@@ -136,6 +136,7 @@ int checkboard(void) static u8 brdcode __section("data"); static u8 ddr3code __section("data"); static u8 somcode __section("data"); +static u32 opp_voltage_mv __section(".data");static void board_get_coding_straps (void ) {
@@ -193,10 +194,16 @@ int board_stm32mp1_ddr_config_name_match(struct udevice *dev,return -EINVAL ; } +void board_vddcore_init (u32 voltage_mv) +{ +if (IS_ENABLED (CONFIG_SPL_BUILD )) + opp_voltage_mv = voltage_mv; +} +int board_early_init_f (void ) {if (IS_ENABLED (CONFIG_SPL_BUILD )) -stpmic1_init (); +stpmic1_init (opp_voltage_mv);board_get_coding_straps ();return 0 ;
board/st/common/stpmic1.c +22 -1
@@ -162,8 +162,25 @@ int board_ddr_power_init(enum ddr_type ddr_type)return 0 ; } +static int stmpic_buck1_set (struct udevice *dev,u32 voltage_mv) +{ +u32 value; + +/* VDDCORE= STMPCI1 BUCK1 ramp=+25mV, 5 => 725mV, 36 => 1500mV */ + value = ((voltage_mv -725 ) /25 ) +5 ; +if (value <5 ) + value =5 ; +if (value >36 ) + value =36 ; + +return pmic_clrsetbits (dev, +STPMIC1_BUCKX_MAIN_CR (STPMIC1_BUCK1 ), +STPMIC1_BUCK_VOUT_MASK , +STPMIC1_BUCK_VOUT (value)); +} +/* early init of PMIC */ -void stpmic1_init (void ) +void stpmic1_init (u32 voltage_mv) {struct udevice *dev;
@@ -171,6 +188,10 @@ void stpmic1_init(void) DM_GET_DRIVER(pmic_stpmic1), &dev))return ; +/* update VDDCORE = BUCK1 */ +if (voltage_mv) +stmpic_buck1_set (dev, voltage_mv); +/* Keep vdd on during the reset cycle */ pmic_clrsetbits(dev, STPMIC1_BUCKS_MRST_CR,
board/st/common/stpmic1.h +1 -1
@@ -3,4 +3,4 @@* Copyright (C) 2020, STMicroelectronics - All Rights Reserved */ -void stpmic1_init (void ); +void stpmic1_init (u32 voltage_mv);
board/st/stm32mp1/spl.c +10 -1
@@ -7,10 +7,19 @@#include <common.h> #include "../common/stpmic1.h" +/* board early initialisation in board_f: need to use global variable */ +static u32 opp_voltage_mv __section(".data"); + +void board_vddcore_init (u32 voltage_mv) +{ +if (IS_ENABLED (CONFIG_PMIC_STPMIC1 ) &&CONFIG_IS_ENABLED (POWER_SUPPORT )) + opp_voltage_mv = voltage_mv; +} +int board_early_init_f (void ) {if (IS_ENABLED (CONFIG_PMIC_STPMIC1 ) &&CONFIG_IS_ENABLED (POWER_SUPPORT )) -stpmic1_init (); +stpmic1_init (opp_voltage_mv);return 0 ; }
Signature · 1 line
2.17.1
PATCH v2 7/9 board: stm32mp1: update vddcore in SPL
Hi Patrick
Quoted 119 lines · Patrick Delaunay
For board using STPMIC1, the vddcore is provided by BUCK1 of STPMIC1 and need to be updated for 800MHz support and only after the clock tree initialization.
The VDDCORE voltage value is provided by clock driver, saved in global variable
opp_voltage_mvand udpated in SPLboard_early_init_f(), just after clock tree initialization.Signed-off-by Patrick Delaunay <[email protected]>---
Changes in v2:
-stmpic_buck1_setis a static function called instpmic1_init(with new parameter for vddcore value)
- update alsodh_stm32mp1boardboard/dhelectronics/dh_stm32mp1/board.c | 9 ++++++++- board/st/common/stpmic1.c | 23 ++++++++++++++++++++++- board/st/common/stpmic1.h | 2 +- board/st/stm32mp1/spl.c | 11 ++++++++++- 4 files changed, 41 insertions(+), 4 deletions(-)board/dhelectronics/dh_stm32mp1/board.c +8
-1@@ -136,6 +136,7 @@ int checkboard(void) static u8 brdcode __section("data"); static u8 ddr3code __section("data"); static u8 somcode __section("data"); +static u32 opp_voltage_mv __section(".data");static void board_get_coding_straps (void ) {@@ -193,10 +194,16 @@ int board_stm32mp1_ddr_config_name_match(struct udevice *dev,return -EINVAL ; } +void board_vddcore_init (u32 voltage_mv) +{ +if (IS_ENABLED (CONFIG_SPL_BUILD )) + opp_voltage_mv = voltage_mv; +} +int board_early_init_f (void ) {if (IS_ENABLED (CONFIG_SPL_BUILD )) -stpmic1_init (); +stpmic1_init (opp_voltage_mv);board_get_coding_straps ();return 0 ;board/st/common/stpmic1.c +22
-1@@ -162,8 +162,25 @@ int board_ddr_power_init(enum ddr_type ddr_type)return 0 ; } +static int stmpic_buck1_set (struct udevice *dev,u32 voltage_mv) +{ +u32 value; + +/* VDDCORE= STMPCI1 BUCK1 ramp=+25mV, 5 => 725mV, 36 => 1500mV */ + value = ((voltage_mv -725 ) /25 ) +5 ; +if (value <5 ) + value =5 ; +if (value >36 ) + value =36 ; + +return pmic_clrsetbits (dev, +STPMIC1_BUCKX_MAIN_CR (STPMIC1_BUCK1 ), +STPMIC1_BUCK_VOUT_MASK , +STPMIC1_BUCK_VOUT (value)); +} +/* early init of PMIC */ -void stpmic1_init (void ) +void stpmic1_init (u32 voltage_mv) {struct udevice *dev;@@ -171,6 +188,10 @@ void stpmic1_init(void) DM_GET_DRIVER(pmic_stpmic1), &dev))return ; +/* update VDDCORE = BUCK1 */ +if (voltage_mv) +stmpic_buck1_set (dev, voltage_mv); +/* Keep vdd on during the reset cycle */ pmic_clrsetbits(dev, STPMIC1_BUCKS_MRST_CR,board/st/common/stpmic1.h +1
-1@@ -3,4 +3,4 @@* Copyright (C) 2020, STMicroelectronics - All Rights Reserved */ -void stpmic1_init (void ); +void stpmic1_init (u32 voltage_mv);board/st/stm32mp1/spl.c +7
-0@@ -7,10 +7,19 @@#include <common.h> #include "../common/stpmic1.h" +/* board early initialisation in board_f: need to use global variable */ +static u32 opp_voltage_mv __section(".data"); + +void board_vddcore_init (u32 voltage_mv) +{ +if (IS_ENABLED (CONFIG_PMIC_STPMIC1 ) &&CONFIG_IS_ENABLED (POWER_SUPPORT )) + opp_voltage_mv = voltage_mv;
board/st/stm32mp1/spl.c line 25
Quoted 10 lines
board/st/stm32mp1/spl.c +3
-1+} +int board_early_init_f (void ) {if (IS_ENABLED (CONFIG_PMIC_STPMIC1 ) &&CONFIG_IS_ENABLED (POWER_SUPPORT )) -stpmic1_init (); +stpmic1_init (opp_voltage_mv);return 0 ; }
Thanks
PATCH v2 8/9 ARM: dts: stm32mp1: use OPP information for PLL1 settings in SPL
In reply to Patrick DelaunayThis patch allows to switch the CPU frequency to 800MHz on the ST Microelectronics board (DK1/DK2 and EV1) or dh electronics SOM using the STM32MP15x SOC and when it is supported by the HW (for STM32MP15xD and STM32MP15xF).
---
Changes in v2:
- update stm32mp15xx-dhcor and dhcom device tree
arch/arm/dts/stm32mp15-u-boot.dtsi | 10 ++++++++++ arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 9 --------- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 9 --------- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 9 --------- arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 9 --------- 5 files changed, 10 insertions(+), 36 deletions(-)
arch/arm/dts/stm32mp15-u-boot.dtsi +10 -0
@@ -88,6 +88,16 @@ u-boot,dm-pre-reloc; }; +&cpu0_opp_table { + u-boot,dm-spl; + opp-650000000 { + u-boot,dm-spl; + }; + opp-800000000 { + u-boot,dm-spl; + }; +}; + &gpioa { u-boot,dm-pre-reloc; };
arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +0 -9
@@ -118,15 +118,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 { - compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";
arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +0 -9
@@ -115,15 +115,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 { - compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";
arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +0 -9
@@ -235,15 +235,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 { - compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";
arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi +0 -9
@@ -105,15 +105,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 { - compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";
Signature · 1 line
2.17.1
PATCH v2 8/9 ARM: dts: stm32mp1: use OPP information for PLL1 settings in SPL
HI Patrick
Quoted 109 lines · Patrick Delaunay
This patch allows to switch the CPU frequency to 800MHz on the ST Microelectronics board (DK1/DK2 and EV1) or dh electronics SOM using the STM32MP15x SOC and when it is supported by the HW (for STM32MP15xD and STM32MP15xF).
Signed-off-by Patrick Delaunay <[email protected]>---
Changes in v2:
- update stm32mp15xx-dhcor and dhcom device treearch/arm/dts/stm32mp15-u-boot.dtsi | 10 ++++++++++ arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi | 9 --------- arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi | 9 --------- arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi | 9 --------- arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi | 9 --------- 5 files changed, 10 insertions(+), 36 deletions(-)arch/arm/dts/stm32mp15-u-boot.dtsi +10
-0@@ -88,6 +88,16 @@ u-boot,dm-pre-reloc; }; +&cpu0_opp_table { + u-boot,dm-spl; + opp-650000000 { + u-boot,dm-spl; + }; + opp-800000000 { + u-boot,dm-spl; + }; +}; + &gpioa { u-boot,dm-pre-reloc; };arch/arm/dts/stm32mp157a-dk1-u-boot.dtsi +0
-9@@ -118,15 +118,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 { - compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";arch/arm/dts/stm32mp157c-ed1-u-boot.dtsi +0
-9@@ -115,15 +115,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 { - compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";arch/arm/dts/stm32mp15xx-dhcom-u-boot.dtsi +0
-9@@ -235,15 +235,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 { - compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi +0
-2@@ -105,15 +105,6 @@ CLK_LPTIM45_LSE >; - /* VCO = 1300.0 MHz => P = 650 (CPU) */ - pll1: st,pll at 0 {
arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi line 110
Quoted 10 lines
arch/arm/dts/stm32mp15xx-dhcor-u-boot.dtsi +0
-7- compatible = "st,stm32mp1-pll"; - reg = <0>; - cfg = < 2 80 0 0 0 PQR(1,0,0) >; - frac = < 0x800 >; - u-boot,dm-pre-reloc; - }; - /* VCO = 1066.0 MHz => P = 266 (AXI), Q = 533 (GPU), R = 533 (DDR) */ pll2: st,pll at 1 { compatible = "st,stm32mp1-pll";
Thanks
PATCH v2 9/9 board: stm32mp1: move the function board_debug_uart_init in spl.c
In reply to Patrick DelaunayMove the debug function board_debug_uart_init in spl.c as the debug_uart_init() function is called in arch_cpu_init() only for SPL and remove the board.c file.
For TFABOOT, the UART TX pin configuration is done in TF-A.
---
Changes in v2:
- NEW: merge spl.c and board.c to avoid a file with only one function
board/st/stm32mp1/Makefile | 2 -- board/st/stm32mp1/board.c | 34 ---------------------------------- board/st/stm32mp1/spl.c | 26 ++++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 board/st/stm32mp1/board.c
board/st/stm32mp1/Makefile +0 -2
@@ -8,5 +8,3 @@ obj-y += spl.o else obj-y += stm32mp1.o endif - -obj-y += board.o
board/st/stm32mp1/board.c deleted +0 -34
@@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause -/* -* Copyright (C) 2018, STMicroelectronics - All Rights Reserved -*/ - -#include <common.h> -#include <asm/io.h> - -#ifdef CONFIG_DEBUG_UART_BOARD_INIT -void board_debug_uart_init (void ) -{ -#if (CONFIG_DEBUG_UART_BASE ==STM32_UART4_BASE ) - -#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00) -#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28) - -/* UART4 clock enable */ -setbits_le32 (RCC_MP_APB1ENSETR ,BIT (16 )); - -#define GPIOG_BASE 0x50008000 -/* GPIOG clock enable */ -writel (BIT (6 ),RCC_MP_AHB4ENSETR ); -/* GPIO configuration for EVAL board -* => Uart4 TX = G11 -*/ -writel (0xffbfffff ,GPIOG_BASE +0x00 ); -writel (0x00006000 ,GPIOG_BASE +0x24 ); -#else - -#error ("CONFIG_DEBUG_UART_BASE: not supported value") - -#endif -} -#endif
board/st/stm32mp1/spl.c +26 -0
@@ -5,6 +5,7 @@#include <config.h> #include <common.h> +#include <asm/io.h> #include "../common/stpmic1.h" /* board early initialisation in board_f: need to use global variable */
@@ -23,3 +24,28 @@ int board_early_init_f(void)return 0 ; } + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init (void ) +{ +#if (CONFIG_DEBUG_UART_BASE ==STM32_UART4_BASE ) + +#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00) +#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28) + +/* UART4 clock enable */ +setbits_le32 (RCC_MP_APB1ENSETR ,BIT (16 )); + +#define GPIOG_BASE 0x50008000 +/* GPIOG clock enable */ +writel (BIT (6 ),RCC_MP_AHB4ENSETR ); +/* GPIO configuration for ST boards: Uart4 TX = G11 */ +writel (0xffbfffff ,GPIOG_BASE +0x00 ); +writel (0x00006000 ,GPIOG_BASE +0x24 ); +#else + +#error ("CONFIG_DEBUG_UART_BASE: not supported value") + +#endif +} +#endif
Signature · 1 line
2.17.1
PATCH v2 9/9 board: stm32mp1: move the function board_debug_uart_init in spl.c
Hi Patrick
Quoted 99 lines · Patrick Delaunay
Move the debug function
board_debug_uart_initinspl.cas thedebug_uart_init()function is called inarch_cpu_init()only for SPL and remove theboard.cfile.For TFABOOT, the UART TX pin configuration is done in TF-A.
Signed-off-by Patrick Delaunay <[email protected]>---
Changes in v2:
- NEW: mergespl.candboard.cto avoid a file with only one functionboard/st/stm32mp1/Makefile | 2 -- board/st/stm32mp1/board.c | 34 ---------------------------------- board/st/stm32mp1/spl.c | 26 ++++++++++++++++++++++++++ 3 files changed, 26 insertions(+), 36 deletions(-) delete mode 100644 board/st/stm32mp1/board.cboard/st/stm32mp1/Makefile +0
-2@@ -8,5 +8,3 @@ obj-y += spl.o else obj-y += stm32mp1.o endif - -obj-y += board.oboard/st/stm32mp1/board.c deleted +0
-34@@ -1,34 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause -/* -* Copyright (C) 2018, STMicroelectronics - All Rights Reserved -*/ - -#include <common.h> -#include <asm/io.h> - -#ifdef CONFIG_DEBUG_UART_BOARD_INIT -void board_debug_uart_init (void ) -{ -#if (CONFIG_DEBUG_UART_BASE ==STM32_UART4_BASE ) - -#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00) -#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28) - -/* UART4 clock enable */ -setbits_le32 (RCC_MP_APB1ENSETR ,BIT (16 )); - -#define GPIOG_BASE 0x50008000 -/* GPIOG clock enable */ -writel (BIT (6 ),RCC_MP_AHB4ENSETR ); -/* GPIO configuration for EVAL board -* => Uart4 TX = G11 -*/ -writel (0xffbfffff ,GPIOG_BASE +0x00 ); -writel (0x00006000 ,GPIOG_BASE +0x24 ); -#else - -#error ("CONFIG_DEBUG_UART_BASE: not supported value") - -#endif -} -#endif board/st/stm32mp1/spl.c +16
-0@@ -5,6 +5,7 @@#include <config.h> #include <common.h> +#include <asm/io.h> #include "../common/stpmic1.h" /* board early initialisation in board_f: need to use global variable */ @@ -23,3 +24,28 @@ int board_early_init_f(void)return 0 ; } + +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init (void ) +{ +#if (CONFIG_DEBUG_UART_BASE ==STM32_UART4_BASE ) + +#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00) +#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28) + +/* UART4 clock enable */ +setbits_le32 (RCC_MP_APB1ENSETR ,BIT (16 )); + +#define GPIOG_BASE 0x50008000 +/* GPIOG clock enable */ +writel (BIT (6 ),RCC_MP_AHB4ENSETR );
board/st/stm32mp1/spl.c int board_early_init_f(void) · line 51
Quoted 10 lines
board/st/stm32mp1/spl.c +10
-0+/* GPIO configuration for ST boards: Uart4 TX = G11 */ +writel (0xffbfffff ,GPIOG_BASE +0x00 ); +writel (0x00006000 ,GPIOG_BASE +0x24 ); +#else + +#error ("CONFIG_DEBUG_UART_BASE: not supported value") + +#endif +} +#endif
Thanks