blob: 9a83da8fd30c6914e6071ab76c5eb21d62d6b530 [file] [log] [blame]
Tom Rini4549e782018-05-06 18:27:01 -04001// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
Patrick Delaunayf8598d92018-03-12 10:46:18 +01002/*
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
Patrick Delaunayf8598d92018-03-12 10:46:18 +01004 */
5
6#include <config.h>
7#include <common.h>
Patrick Delaunayd1a4b092020-05-25 12:19:46 +02008#include <init.h>
9#include <asm/arch/sys_proto.h>
10#include "../common/stpmic1.h"
Patrick Delaunayf8598d92018-03-12 10:46:18 +010011
Patrick Delaunay2f238322020-05-25 12:19:47 +020012/* board early initialisation in board_f: need to use global variable */
13static u32 opp_voltage_mv __section(".data");
14
15void board_vddcore_init(u32 voltage_mv)
16{
17 if (IS_ENABLED(CONFIG_PMIC_STPMIC1) && CONFIG_IS_ENABLED(POWER_SUPPORT))
18 opp_voltage_mv = voltage_mv;
19}
20
Patrick Delaunayd1a4b092020-05-25 12:19:46 +020021int board_early_init_f(void)
Patrick Delaunayf8598d92018-03-12 10:46:18 +010022{
Patrick Delaunayd1a4b092020-05-25 12:19:46 +020023 if (IS_ENABLED(CONFIG_PMIC_STPMIC1) && CONFIG_IS_ENABLED(POWER_SUPPORT))
Patrick Delaunay2f238322020-05-25 12:19:47 +020024 stpmic1_init(opp_voltage_mv);
Patrick Delaunayf8598d92018-03-12 10:46:18 +010025
Patrick Delaunayd1a4b092020-05-25 12:19:46 +020026 return 0;
Patrick Delaunayf8598d92018-03-12 10:46:18 +010027}