#include <mach/gpio.h>
#include <mach/iomux.h>
#include <mach/fiq.h>
+#include <mach/pmu.h>
+#include <mach/loader.h>
static void __init rk30_cpu_axi_init(void)
{
#endif
}
+static int boot_mode;
+static void __init rk30_boot_mode_init(void)
+{
+ u32 boot_flag = readl_relaxed(RK30_PMU_BASE + PMU_SYS_REG0);
+ u32 boot_mode = readl_relaxed(RK30_PMU_BASE + PMU_SYS_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);
+}
+
+int board_boot_mode(void)
+{
+ return boot_mode;
+}
+EXPORT_SYMBOL(board_boot_mode);
void __init rk30_init_irq(void)
{
board_clock_init();
rk30_l2_cache_init();
rk30_iomux_init();
+ rk30_boot_mode_init();
}
void __init rk30_fixup(struct machine_desc *desc, struct tag *tags,
#include <mach/cru.h>
#include <mach/iomux.h>
#include <mach/loader.h>
+#include <mach/board.h>
+#include <mach/pmu.h>
static void rk30_arch_reset(char mode, const char *cmd)
{
- unsigned int reason = 0;
+ u32 boot_flag = 0;
+ u32 boot_mode = BOOT_MODE_REBOOT;
- if(cmd) {
+ if (cmd) {
if (!strcmp(cmd, "loader") || !strcmp(cmd, "bootloader"))
- reason = SYS_LOADER_REBOOT_FLAG + BOOT_LOADER;
+ boot_flag = SYS_LOADER_REBOOT_FLAG + BOOT_LOADER;
else if(!strcmp(cmd, "recovery"))
- reason = SYS_LOADER_REBOOT_FLAG + BOOT_RECOVER;
+ 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(reason, RK30_PMU_PHYS + 0x40); //PMU_OS_REG0
+ writel_relaxed(boot_flag, RK30_PMU_BASE + PMU_SYS_REG0); // for loader
+ writel_relaxed(boot_mode, RK30_PMU_BASE + PMU_SYS_REG1); // for linux
dsb();
/* disable remap */
writel_relaxed(1 << (12 + 16), RK30_GRF_BASE + GRF_SOC_CON0);