rk30: reboot: parameter(loader,recovery)
authorkfx <kfx@rock-chips.com>
Wed, 28 Mar 2012 09:10:04 +0000 (17:10 +0800)
committerkfx <kfx@rock-chips.com>
Wed, 28 Mar 2012 09:10:04 +0000 (17:10 +0800)
arch/arm/mach-rk30/include/mach/loader.h [new file with mode: 0644]
arch/arm/mach-rk30/reset.c

diff --git a/arch/arm/mach-rk30/include/mach/loader.h b/arch/arm/mach-rk30/include/mach/loader.h
new file mode 100644 (file)
index 0000000..f0006b9
--- /dev/null
@@ -0,0 +1,35 @@
+/* arch/arm/mach-rk29/include/mach/loader.h
+ *
+ * Copyright (C) 2011 ROCKCHIP, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+#ifndef __ASM_ARCH_RK30_LOADER_H
+#define __ASM_ARCH_RK30_LOADER_H
+
+#define SYS_LOADER_REBOOT_FLAG   0x5242C300  //high 24 bits is tag, low 8 bits is type
+#define SYS_KERNRL_REBOOT_FLAG   0xC3524200  //high 24 bits is tag, low 8 bits is type
+
+enum {
+    BOOT_NORMAL = 0, /* normal boot */
+    BOOT_LOADER,     /* enter loader rockusb mode */
+    BOOT_MASKROM,    /* enter maskrom rockusb mode (not support now) */
+    BOOT_RECOVER,    /* enter recover */
+    BOOT_NORECOVER,  /* do not enter recover */
+    BOOT_SECONDOS,   /* boot second OS (not support now)*/
+    BOOT_WIPEDATA,   /* enter recover and wipe data. */
+    BOOT_WIPEALL,    /* enter recover and wipe all data. */
+    BOOT_CHECKIMG,   /* check firmware img with backup part(in loader mode)*/
+    BOOT_FASTBOOT,   /* enter fast boot mode (not support now) */
+    BOOT_MAX         /* MAX VALID BOOT TYPE.*/
+};
+
+#endif
index b826ad78917a72efe0349f2dabff2c0fac16ef60..851162a2b12e5b3c3fbbad77d4183e1386d606b9 100644 (file)
@@ -1,16 +1,28 @@
-#include <linux/io.h>\r
-#include <linux/kernel.h>\r
-#include <mach/system.h>\r
-#include <mach/cru.h>\r
-#include <mach/iomux.h>\r
-\r
-static void rk30_arch_reset(char mode, const char *cmd)\r
-{\r
-       /* disable remap */\r
-       writel_relaxed(1 << (12 + 16), RK30_GRF_BASE + GRF_SOC_CON0);\r
-       dsb();\r
-       writel_relaxed(0xeca8, RK30_CRU_BASE + CRU_GLB_SRST_SND);\r
-       dsb();\r
-}\r
-\r
-void (*arch_reset)(char, const char *) = rk30_arch_reset;\r
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <mach/system.h>
+#include <linux/string.h>
+#include <mach/cru.h>
+#include <mach/iomux.h>
+#include <mach/loader.h>
+
+static void rk30_arch_reset(char mode, const char *cmd)
+{
+       unsigned int reason = 0;
+
+       if(cmd) {
+               if (!strcmp(cmd, "loader") || !strcmp(cmd, "bootloader")) 
+                       reason = SYS_LOADER_REBOOT_FLAG + BOOT_LOADER;
+               else if(!strcmp(cmd, "recovery"))
+                       reason = SYS_LOADER_REBOOT_FLAG + BOOT_RECOVER;
+       }
+       writel_relaxed(reason, RK30_PMU_PHYS + 0x40);  //PMU_OS_REG0
+       dsb();
+       /* disable remap */
+       writel_relaxed(1 << (12 + 16), RK30_GRF_BASE + GRF_SOC_CON0);
+       dsb();
+       writel_relaxed(0xeca8, RK30_CRU_BASE + CRU_GLB_SRST_SND);
+       dsb();
+}
+
+void (*arch_reset)(char, const char *) = rk30_arch_reset;