2018-05-06 22:27:01 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
|
2018-03-12 09:46:18 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018, STMicroelectronics - All Rights Reserved
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <common.h>
|
|
|
|
#include <spl.h>
|
|
|
|
#include <dm.h>
|
|
|
|
#include <ram.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <power/pmic.h>
|
2019-02-04 10:26:16 +00:00
|
|
|
#include <power/stpmic1.h>
|
2018-03-12 09:46:18 +00:00
|
|
|
#include <asm/arch/ddr.h>
|
|
|
|
|
|
|
|
void spl_board_init(void)
|
|
|
|
{
|
|
|
|
/* Keep vdd on during the reset cycle */
|
2019-02-04 10:26:17 +00:00
|
|
|
#if defined(CONFIG_PMIC_STPMIC1) && defined(CONFIG_SPL_POWER_SUPPORT)
|
2018-03-12 09:46:18 +00:00
|
|
|
struct udevice *dev;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = uclass_get_device_by_driver(UCLASS_PMIC,
|
2019-02-04 10:26:17 +00:00
|
|
|
DM_GET_DRIVER(pmic_stpmic1), &dev);
|
2018-03-12 09:46:18 +00:00
|
|
|
if (!ret)
|
|
|
|
pmic_clrsetbits(dev,
|
2019-02-04 10:26:18 +00:00
|
|
|
STPMIC1_BUCKS_MRST_CR,
|
|
|
|
STPMIC1_MRST_BUCK(STPMIC1_BUCK3),
|
|
|
|
STPMIC1_MRST_BUCK(STPMIC1_BUCK3));
|
2019-07-30 17:16:20 +00:00
|
|
|
|
|
|
|
/* 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);
|
|
|
|
}
|
2018-03-12 09:46:18 +00:00
|
|
|
#endif
|
|
|
|
}
|