xref: /openbmc/u-boot/board/st/stm32mp1/spl.c (revision 4549e789c1d58a8c48e8a20f1b4bdb83e978c954)
1*4549e789STom Rini // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2f8598d98SPatrick Delaunay /*
3f8598d98SPatrick Delaunay  * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
4f8598d98SPatrick Delaunay  */
5f8598d98SPatrick Delaunay 
6f8598d98SPatrick Delaunay #include <config.h>
7f8598d98SPatrick Delaunay #include <common.h>
8f8598d98SPatrick Delaunay #include <spl.h>
9f8598d98SPatrick Delaunay #include <dm.h>
10f8598d98SPatrick Delaunay #include <ram.h>
11f8598d98SPatrick Delaunay #include <asm/io.h>
12f8598d98SPatrick Delaunay #include <post.h>
13f8598d98SPatrick Delaunay #include <power/pmic.h>
14f8598d98SPatrick Delaunay #include <power/stpmu1.h>
15f8598d98SPatrick Delaunay #include <asm/arch/ddr.h>
16f8598d98SPatrick Delaunay 
spl_board_init(void)17f8598d98SPatrick Delaunay void spl_board_init(void)
18f8598d98SPatrick Delaunay {
19f8598d98SPatrick Delaunay 	/* Keep vdd on during the reset cycle */
20f8598d98SPatrick Delaunay #if defined(CONFIG_PMIC_STPMU1) && defined(CONFIG_SPL_POWER_SUPPORT)
21f8598d98SPatrick Delaunay 	struct udevice *dev;
22f8598d98SPatrick Delaunay 	int ret;
23f8598d98SPatrick Delaunay 
24f8598d98SPatrick Delaunay 	ret = uclass_get_device_by_driver(UCLASS_PMIC,
25f8598d98SPatrick Delaunay 					  DM_GET_DRIVER(pmic_stpmu1), &dev);
26f8598d98SPatrick Delaunay 	if (!ret)
27f8598d98SPatrick Delaunay 		pmic_clrsetbits(dev,
28f8598d98SPatrick Delaunay 				STPMU1_MASK_RESET_BUCK,
29f8598d98SPatrick Delaunay 				STPMU1_MASK_RESET_BUCK3,
30f8598d98SPatrick Delaunay 				STPMU1_MASK_RESET_BUCK3);
31f8598d98SPatrick Delaunay #endif
32f8598d98SPatrick Delaunay }
33