[ARM] 3132/1: S3C2410 - reset on decompression error
authorBen Dooks <ben-linux@fluff.org>
Tue, 8 Nov 2005 22:43:05 +0000 (22:43 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Tue, 8 Nov 2005 22:43:05 +0000 (22:43 +0000)
Patch from Ben Dooks

Force a watchdog reset if the system fails to
decompress properly.

Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/boot/compressed/misc.c
arch/arm/mach-s3c2410/Kconfig
include/asm-arm/arch-s3c2410/uncompress.h

index 50f13eec6cd70cd4c2e0a93233af141027211529..5ab94584baee6a46839e58819a9b443422c2a923 100644 (file)
@@ -283,8 +283,14 @@ void flush_window(void)
        putstr(".");
 }
 
+#ifndef arch_error
+#define arch_error(x)
+#endif
+
 static void error(char *x)
 {
+       arch_error(x);
+
        putstr("\n\n");
        putstr(x);
        putstr("\n\n -- System halted");
index c796bcdd6158208c77cc1f97b7bfbb8a12ca6573..0b9d7ca49ec1ff9f9520cc02c845c0c8990c30b1 100644 (file)
@@ -121,6 +121,14 @@ config S3C2410_BOOT_WATCHDOG
          system resets depends on the value of PCLK. The timeout on an
          200MHz s3c2410 should be about 30 seconds.
 
+config S3C2410_BOOT_ERROR_RESET
+       bool "S3C2410 Reboot on decompression error"
+       depends on ARCH_S3C2410
+       help
+         Say y here to use the watchdog to reset the system if the
+         kernel decompressor detects an error during decompression.
+
+
 comment "S3C2410 Setup"
 
 config S3C2410_DMA
index d7a4a8354fa9854be8a2bc23203a0336b57b93fa..ddd1578a7ee0a40d2877434176f7718797c9b1a4 100644 (file)
@@ -116,6 +116,8 @@ putstr(const char *ptr)
        }
 }
 
+#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
+
 /* CONFIG_S3C2410_BOOT_WATCHDOG
  *
  * Simple boot-time watchdog setup, to reboot the system if there is
@@ -126,8 +128,6 @@ putstr(const char *ptr)
 
 #define WDOG_COUNT (0xff00)
 
-#define __raw_writel(d,ad) do { *((volatile unsigned int *)(ad)) = (d); } while(0)
-
 static inline void arch_decomp_wdog(void)
 {
        __raw_writel(WDOG_COUNT, S3C2410_WTCNT);
@@ -145,6 +145,24 @@ static void arch_decomp_wdog_start(void)
 #define arch_decomp_wdog()
 #endif
 
+#ifdef CONFIG_S3C2410_BOOT_ERROR_RESET
+
+static void arch_decomp_error(const char *x)
+{
+       putstr("\n\n");
+       putstr(x);
+       putstr("\n\n -- System resetting\n");
+
+       __raw_writel(0x4000, S3C2410_WTDAT);
+       __raw_writel(0x4000, S3C2410_WTCNT);
+       __raw_writel(S3C2410_WTCON_ENABLE | S3C2410_WTCON_DIV128 | S3C2410_WTCON_RSTEN | S3C2410_WTCON_PRESCALE(0x40), S3C2410_WTCON);
+
+       while(1);
+}
+
+#define arch_error arch_decomp_error
+#endif
+
 static void error(char *err);
 
 static void