Merge tag 'mmc-2019-7-15' of https://gitlab.denx.de/u-boot/custodians/u-boot-mmc
[platform/kernel/u-boot.git] / board / st / stm32mp1 / spl.c
1 // SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2 /*
3  * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
4  */
5
6 #include <config.h>
7 #include <common.h>
8 #include <spl.h>
9 #include <dm.h>
10 #include <ram.h>
11 #include <asm/io.h>
12 #include <power/pmic.h>
13 #include <power/stpmic1.h>
14 #include <asm/arch/ddr.h>
15
16 void spl_board_init(void)
17 {
18         /* Keep vdd on during the reset cycle */
19 #if defined(CONFIG_PMIC_STPMIC1) && defined(CONFIG_SPL_POWER_SUPPORT)
20         struct udevice *dev;
21         int ret;
22
23         ret = uclass_get_device_by_driver(UCLASS_PMIC,
24                                           DM_GET_DRIVER(pmic_stpmic1), &dev);
25         if (!ret)
26                 pmic_clrsetbits(dev,
27                                 STPMIC1_BUCKS_MRST_CR,
28                                 STPMIC1_MRST_BUCK(STPMIC1_BUCK3),
29                                 STPMIC1_MRST_BUCK(STPMIC1_BUCK3));
30 #endif
31 }