setup_boot_mode function use the same logic but different mode register address across all the rockchip platforms, so it's better to make this function reused across all the platforms, and let the mode register address setting from the config file. Signed-off-by: Andy Yan <andy.yan@rock-chips.com> Reviewed-by: Simon Glass <sjg@chromium.org> Acked-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>master
parent
11f12c17d7
commit
e3067793c3
@ -0,0 +1,33 @@ |
||||
/*
|
||||
* (C) Copyright 2016 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/io.h> |
||||
#include <asm/arch/boot_mode.h> |
||||
|
||||
int setup_boot_mode(void) |
||||
{ |
||||
void *reg = (void *)CONFIG_ROCKCHIP_BOOT_MODE_REG; |
||||
int boot_mode = readl(reg); |
||||
|
||||
debug("boot mode %x.\n", boot_mode); |
||||
|
||||
/* Clear boot mode */ |
||||
writel(BOOT_NORMAL, reg); |
||||
|
||||
switch (boot_mode) { |
||||
case BOOT_FASTBOOT: |
||||
printf("enter fastboot!\n"); |
||||
env_set("preboot", "setenv preboot; fastboot usb0"); |
||||
break; |
||||
case BOOT_UMS: |
||||
printf("enter UMS!\n"); |
||||
env_set("preboot", "setenv preboot; ums mmc 0"); |
||||
break; |
||||
} |
||||
|
||||
return 0; |
||||
} |
@ -0,0 +1,14 @@ |
||||
/*
|
||||
* Copyright (c) 2017 Rockchip Electronics Co., Ltd |
||||
* |
||||
* SPDX-License-Identifier: GPL-2.0+ |
||||
*/ |
||||
|
||||
#include <common.h> |
||||
#include <asm/arch/boot_mode.h> |
||||
|
||||
int board_late_init(void) |
||||
{ |
||||
setup_boot_mode(); |
||||
return 0; |
||||
} |
Loading…
Reference in new issue