blob: 3aa738b3faa7921a55d572e1b80cb32d4a91fb18 [file] [log] [blame]
Jagan Teki30edf402021-03-16 21:52:03 +05301// SPDX-License-Identifier: GPL-2.0+ OR BSD-3-Clause
2/*
3 * Copyright (C) 2018, STMicroelectronics - All Rights Reserved
4 * Copyright (C) 2020 Engicam S.r.l.
5 * Copyright (C) 2020 Amarula Solutions(India)
6 */
7
8#include <common.h>
9#include <asm/io.h>
10
11/* board early initialisation in board_f: need to use global variable */
12static u32 opp_voltage_mv __section(".data");
13
14void board_vddcore_init(u32 voltage_mv)
15{
Simon Glass933b2f02021-07-10 21:14:24 -060016 if (IS_ENABLED(CONFIG_PMIC_STPMIC1) && CONFIG_IS_ENABLED(POWER))
Jagan Teki30edf402021-03-16 21:52:03 +053017 opp_voltage_mv = voltage_mv;
18}
19
20int board_early_init_f(void)
21{
22 return 0;
23}
24
25#ifdef CONFIG_DEBUG_UART_BOARD_INIT
26void board_debug_uart_init(void)
27{
28#if (CONFIG_DEBUG_UART_BASE == STM32_UART4_BASE)
29
30#define RCC_MP_APB1ENSETR (STM32_RCC_BASE + 0x0A00)
31#define RCC_MP_AHB4ENSETR (STM32_RCC_BASE + 0x0A28)
32
33 /* UART4 clock enable */
34 setbits_le32(RCC_MP_APB1ENSETR, BIT(16));
35
36#define GPIOG_BASE 0x50008000
37 /* GPIOG clock enable */
38 writel(BIT(6), RCC_MP_AHB4ENSETR);
39 /* GPIO configuration for ST boards: Uart4 TX = G11 */
40 writel(0xffbfffff, GPIOG_BASE + 0x00);
41 writel(0x00006000, GPIOG_BASE + 0x24);
42#else
43
44#error("CONFIG_DEBUG_UART_BASE: not supported value")
45
46#endif
47}
48#endif