add reboot cmd save in grf os reg.

This commit is contained in:
Zhaoyifeng
2012-08-10 14:06:55 +08:00
parent b1be4be2e6
commit cc865eecde
3 changed files with 15 additions and 4 deletions

0
arch/arm/mach-rk29/include/mach/loader.h Normal file → Executable file
View File

View File

@@ -448,6 +448,10 @@
#define GRF_OS_REG1 0x01cc
#define GRF_OS_REG2 0x01d0
#define GRF_OS_REG3 0x01d4
#define GRF_OS_REG4 0x01d8
#define GRF_OS_REG5 0x01dc
#define GRF_OS_REG6 0x01e0
#define GRF_OS_REG7 0x01e4
#define MUX_CFG(desc,reg,off,interl,mux_mode,bflags) \
{ \

15
arch/arm/mach-rk2928/reset.c Normal file → Executable file
View File

@@ -1,10 +1,11 @@
#include <linux/io.h>
#include <linux/kernel.h>
#include <mach/system.h>
#include <linux/string.h>
#include <mach/board.h>
#include <mach/cru.h>
#include <mach/iomux.h>
#include <mach/system.h>
#include <mach/loader.h>
#include <mach/board.h>
static void rk2928_arch_reset(char mode, const char *cmd)
{
@@ -12,13 +13,19 @@ static void rk2928_arch_reset(char mode, const char *cmd)
u32 boot_mode = BOOT_MODE_REBOOT;
if (cmd) {
if (!strcmp(cmd, "charge"))
if (!strcmp(cmd, "loader") || !strcmp(cmd, "bootloader"))
boot_flag = SYS_LOADER_REBOOT_FLAG + BOOT_LOADER;
else if(!strcmp(cmd, "recovery"))
boot_flag = SYS_LOADER_REBOOT_FLAG + BOOT_RECOVER;
else if (!strcmp(cmd, "charge"))
boot_mode = BOOT_MODE_CHARGE;
} else {
if (system_state != SYSTEM_RESTART)
boot_mode = BOOT_MODE_PANIC;
}
writel_relaxed(0xffff0000 | boot_mode, RK2928_GRF_BASE + GRF_OS_REG1); // for linux
writel_relaxed(0xffff0000 | (boot_flag&0xFFFFuL), RK2928_GRF_BASE + GRF_OS_REG4); // for loader
writel_relaxed(0xffff0000 | ((boot_flag>>16)&0xFFFFuL), RK2928_GRF_BASE + GRF_OS_REG5); // for loader
writel_relaxed(0xffff0000 | boot_mode, RK2928_GRF_BASE + GRF_OS_REG6); // for linux
dsb();
/* disable remap */
writel_relaxed(1 << (12 + 16), RK2928_GRF_BASE + GRF_SOC_CON0);