summaryrefslogtreecommitdiff
path: root/board/st/stm32mp1/spl.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-05-25 12:19:46 +0200
committerPatrick Delaunay <patrick.delaunay@st.com>2020-07-07 16:01:23 +0200
commitd1a4b09de6431fbc2f6a9dc53efe8d84cdd31134 (patch)
tree5ef7a6a3cdf9564eedcdca03a1f4c67ae0ce8e28 /board/st/stm32mp1/spl.c
parent4e62642aef59ef89e00fe05ef1c27f263d80bcf6 (diff)
downloadu-boot-d1a4b09de6431fbc2f6a9dc53efe8d84cdd31134.tar.gz
board: st: stpmic1: add function stpmic1_init
Add 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. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
Diffstat (limited to 'board/st/stm32mp1/spl.c')
-rw-r--r--board/st/stm32mp1/spl.c41
1 files changed, 7 insertions, 34 deletions
diff --git a/board/st/stm32mp1/spl.c b/board/st/stm32mp1/spl.c
index e65ff288ea..fa25cefd28 100644
--- a/board/st/stm32mp1/spl.c
+++ b/board/st/stm32mp1/spl.c
@@ -5,41 +5,14 @@
#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 <init.h>
+#include <asm/arch/sys_proto.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;
}