Skip to content

Commit

Permalink
[ARM] 3132/1: S3C2410 - reset on decompression error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ben Dooks authored and Russell King committed Nov 8, 2005
1 parent 4c18ad2 commit f8c905d
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
6 changes: 6 additions & 0 deletions arch/arm/boot/compressed/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
8 changes: 8 additions & 0 deletions arch/arm/mach-s3c2410/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 20 additions & 2 deletions include/asm-arm/arch-s3c2410/uncompress.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit f8c905d

Please sign in to comment.