rk2928: add reset support

This commit is contained in:
黄涛
2012-08-08 18:20:43 +08:00
parent 845f7cc0bd
commit 776fea4daf
2 changed files with 26 additions and 12 deletions

View File

@@ -11,7 +11,7 @@
#include <plat/sram.h>
#include <mach/board.h>
#include <mach/gpio.h>
//#include <mach/iomux.h>
#include <mach/iomux.h>
#include <mach/fiq.h>
//#include <mach/loader.h>
//#include <mach/ddr.h>
@@ -86,18 +86,11 @@ static void __init rk2928_l2_cache_init(void)
static int boot_mode;
static void __init rk2928_boot_mode_init(void)
{
#if 0
u32 boot_flag = readl_relaxed(RK2928_PMU_BASE + PMU_SYS_REG0);
boot_mode = readl_relaxed(RK2928_PMU_BASE + PMU_SYS_REG1);
u32 boot_flag = 0;
boot_mode = readl_relaxed(RK2928_GRF_BASE + GRF_OS_REG1);
if (boot_flag == (SYS_KERNRL_REBOOT_FLAG | BOOT_RECOVER)) {
boot_mode = BOOT_MODE_RECOVERY;
} else if (strstr(boot_command_line, "(parameter)")) {
boot_mode = BOOT_MODE_RECOVERY;
}
if (boot_mode || boot_flag)
printk("Boot mode: %d flag: 0x%08x\n", boot_mode, boot_flag);
#endif
}
int board_boot_mode(void)

View File

@@ -1,11 +1,32 @@
#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>
static void rk2928_arch_reset(char mode, const char *cmd)
{
while (1);
u32 boot_flag = 0;
u32 boot_mode = BOOT_MODE_REBOOT;
if (cmd) {
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
dsb();
/* disable remap */
writel_relaxed(1 << (12 + 16), RK2928_GRF_BASE + GRF_SOC_CON0);
/* pll enter slow mode */
writel_relaxed(PLL_MODE_SLOW(APLL_ID) | PLL_MODE_SLOW(CPLL_ID) | PLL_MODE_SLOW(GPLL_ID), RK2928_CRU_BASE + CRU_MODE_CON);
dsb();
writel_relaxed(0xeca8, RK2928_CRU_BASE + CRU_GLB_SRST_SND);
dsb();
}
void (*arch_reset)(char, const char *) = rk2928_arch_reset;