rockchip: board/spl: implement board_init_f_boot_flags()

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I6510f53c1a2713358ba6b5a40485c9e1aeee98dc
This commit is contained in:
Joseph Chen 2020-09-24 17:01:39 +08:00
parent 6a1649e26d
commit 93586e70e1
2 changed files with 68 additions and 12 deletions

View File

@ -341,7 +341,8 @@ static void early_download(void)
static void board_debug_init(void) static void board_debug_init(void)
{ {
if (!gd->serial.using_pre_serial) if (!gd->serial.using_pre_serial &&
!(gd->flags & GD_FLG_DISABLE_CONSOLE))
debug_uart_init(); debug_uart_init();
if (tstc()) { if (tstc()) {
@ -560,28 +561,44 @@ void cpu_secondary_init_r(void)
} }
#endif #endif
int board_init_f_boot_flags(void)
{
int boot_flags = 0;
/* pre-loader serial */
#if defined(CONFIG_ROCKCHIP_PRELOADER_SERIAL) && \ #if defined(CONFIG_ROCKCHIP_PRELOADER_SERIAL) && \
defined(CONFIG_ROCKCHIP_PRELOADER_ATAGS) defined(CONFIG_ROCKCHIP_PRELOADER_ATAGS)
int board_init_f_init_serial(void) struct tag *t;
{
struct tag *t = atags_get_tag(ATAG_SERIAL);
t = atags_get_tag(ATAG_SERIAL);
if (t) { if (t) {
gd->serial.using_pre_serial = t->u.serial.enable; gd->serial.using_pre_serial = 1;
gd->serial.enable = t->u.serial.enable;
gd->serial.baudrate = t->u.serial.baudrate; gd->serial.baudrate = t->u.serial.baudrate;
gd->serial.addr = t->u.serial.addr; gd->serial.addr = t->u.serial.addr;
gd->serial.id = t->u.serial.id; gd->serial.id = t->u.serial.id;
gd->baudrate = CONFIG_BAUDRATE;
debug("%s: enable=%d, addr=0x%lx, baudrate=%d, id=%d\n", if (!t->u.serial.enable)
__func__, gd->serial.using_pre_serial, boot_flags |= GD_FLG_DISABLE_CONSOLE;
gd->serial.addr, gd->serial.baudrate, debug("preloader: enable=%d, addr=0x%lx, baudrate=%d, id=%d\n",
gd->serial.id); gd->serial.enable, gd->serial.addr,
gd->serial.baudrate, gd->serial.id);
} else
#endif
{
gd->baudrate = CONFIG_BAUDRATE;
gd->serial.baudrate = CONFIG_BAUDRATE;
gd->serial.addr = CONFIG_DEBUG_UART_BASE;
} }
return 0; /* The highest priority to turn off (override) console */
} #if defined(CONFIG_DISABLE_CONSOLE)
boot_flags |= GD_FLG_DISABLE_CONSOLE;
#endif #endif
return boot_flags;
}
#if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG) #if defined(CONFIG_USB_GADGET) && defined(CONFIG_USB_GADGET_DWC2_OTG)
#include <fdt_support.h> #include <fdt_support.h>
#include <usb.h> #include <usb.h>

View File

@ -209,6 +209,45 @@ int board_fit_config_name_match(const char *name)
} }
#endif #endif
int board_init_f_boot_flags(void)
{
int boot_flags = 0;
/* pre-loader serial */
#if defined(CONFIG_ROCKCHIP_PRELOADER_SERIAL) && \
defined(CONFIG_ROCKCHIP_PRELOADER_ATAGS)
struct tag *t;
t = atags_get_tag(ATAG_SERIAL);
if (t) {
gd->serial.using_pre_serial = 1;
gd->serial.enable = t->u.serial.enable;
gd->serial.baudrate = t->u.serial.baudrate;
gd->serial.addr = t->u.serial.addr;
gd->serial.id = t->u.serial.id;
gd->baudrate = t->u.serial.baudrate;
if (!t->u.serial.enable)
boot_flags |= GD_FLG_DISABLE_CONSOLE;
debug("preloader: enable=%d, addr=0x%x, baudrate=%d, id=%d\n",
t->u.serial.enable, (u32)t->u.serial.addr,
t->u.serial.baudrate, t->u.serial.id);
} else
#endif
{
gd->baudrate = CONFIG_BAUDRATE;
gd->serial.baudrate = CONFIG_BAUDRATE;
gd->serial.addr = CONFIG_DEBUG_UART_BASE;
}
/* The highest priority to turn off (override) console */
#if defined(CONFIG_DISABLE_CONSOLE)
boot_flags |= GD_FLG_DISABLE_CONSOLE;
#endif
return boot_flags;
}
#ifdef CONFIG_SPL_BOARD_INIT #ifdef CONFIG_SPL_BOARD_INIT
__weak int rk_spl_board_init(void) __weak int rk_spl_board_init(void)
{ {