rockchip: bootrom: update support for back to brom via boot_mode reg
We should clear that the purpose is enter maskrom and get into USB boot: 1. set the bootmode reg to bootrom mode in U-Boot/Kernel by cmd or Tool; 2. Get back to bootrom with non-zero return value if not boot from USB; 3. Clean the tag if already enter USB boot. Change-Id: I1127357c3b2f499519387880830b2b382f46af10 Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
This commit is contained in:
parent
2daa9732c0
commit
ca0ddd934d
|
|
@ -31,28 +31,31 @@ void back_to_bootrom(enum rockchip_bootrom_cmd brom_cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* we back to bootrom download mode if get a
|
* We back to bootrom download mode if get a
|
||||||
* BOOT_BROM_DOWNLOAD flag in boot mode register
|
* BOOT_BROM_DOWNLOAD flag in boot mode register
|
||||||
*
|
*
|
||||||
* note: the boot mode register is configured by
|
* The bootrom never check this register, so we need
|
||||||
* application(next stage bootloader, kernel, etc),
|
|
||||||
* and the bootrom never check this register, so we need
|
|
||||||
* to check it and back to bootrom at very early bootstage(before
|
* to check it and back to bootrom at very early bootstage(before
|
||||||
* some basic configurations(such as interrupts) been
|
* some basic configurations(such as interrupts) been
|
||||||
* changed by TPL/SPL, as the bootrom download operation
|
* changed by TPL/SPL, as the bootrom download operation
|
||||||
* relys on many default settings(such as interrupts) by
|
* relys on many default settings(such as interrupts) by
|
||||||
* it's self.
|
* it's self.
|
||||||
|
* Note: the boot mode register is configured by
|
||||||
|
* application(next stage bootloader, kernel, etc) via command or PC Tool,
|
||||||
|
* cleared by USB download(bootrom mode) or loader(other mode) after the
|
||||||
|
* tag has work.
|
||||||
*/
|
*/
|
||||||
static bool check_back_to_brom_dnl_flag(void)
|
static bool check_back_to_brom_dnl_flag(void)
|
||||||
{
|
{
|
||||||
u32 boot_mode;
|
u32 boot_mode, boot_id;
|
||||||
|
|
||||||
if (CONFIG_ROCKCHIP_BOOT_MODE_REG) {
|
if (CONFIG_ROCKCHIP_BOOT_MODE_REG && BROM_BOOTSOURCE_ID_ADDR) {
|
||||||
boot_mode = readl(CONFIG_ROCKCHIP_BOOT_MODE_REG);
|
boot_mode = readl(CONFIG_ROCKCHIP_BOOT_MODE_REG);
|
||||||
if (boot_mode == BOOT_BROM_DOWNLOAD) {
|
boot_id = readl(BROM_BOOTSOURCE_ID_ADDR);
|
||||||
|
if (boot_id == BROM_BOOTSOURCE_USB)
|
||||||
writel(0, CONFIG_ROCKCHIP_BOOT_MODE_REG);
|
writel(0, CONFIG_ROCKCHIP_BOOT_MODE_REG);
|
||||||
|
else if (boot_mode == BOOT_BROM_DOWNLOAD)
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue