[U-Boot] [PATCH 2/2] sh: Add trigger_address_error and support cpu reset

Nobuhiro Iwamatsu hemamu at t-base.ne.jp
Wed Jun 16 09:59:34 CEST 2010


This add support cpu reset by trigger_address_error function.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
---
 arch/sh/cpu/sh2/watchdog.c   |    8 ++++++--
 arch/sh/cpu/sh3/watchdog.c   |    7 +++++++
 arch/sh/cpu/sh4/watchdog.c   |    4 ++++
 arch/sh/include/asm/system.h |   10 ++++++++++
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/sh/cpu/sh2/watchdog.c b/arch/sh/cpu/sh2/watchdog.c
index de0254b..0257d8d 100644
--- a/arch/sh/cpu/sh2/watchdog.c
+++ b/arch/sh/cpu/sh2/watchdog.c
@@ -1,6 +1,6 @@
 /*
- * Copyright (C) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhoro at renesas.com>
- * Copyright (C) 2008 Renesas Solutions Corp.
+ * Copyright (C) 2008,2010 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
+ * Copyright (C) 2008,2010 Renesas Solutions Corp.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -20,6 +20,7 @@
 
 #include <common.h>
 #include <asm/processor.h>
+#include <asm/system.h>
 
 int watchdog_init(void)
 {
@@ -28,6 +29,9 @@ int watchdog_init(void)
 
 void reset_cpu(unsigned long ignored)
 {
+	/* Address error with SR.BL=1 first. */
+	trigger_address_error();
+
 	while (1)
 		;
 }
diff --git a/arch/sh/cpu/sh3/watchdog.c b/arch/sh/cpu/sh3/watchdog.c
index 92bea74..90694f8 100644
--- a/arch/sh/cpu/sh3/watchdog.c
+++ b/arch/sh/cpu/sh3/watchdog.c
@@ -1,4 +1,7 @@
 /*
+ * (C) Copyright 2010
+ * Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj at renesas.com>
+ *
  * (C) Copyright 2007
  * Yoshihiro Shimoda <shimoda.yoshihiro at renesas.com>
  *
@@ -20,6 +23,7 @@
 
 #include <common.h>
 #include <asm/processor.h>
+#include <asm/system.h>
 
 int watchdog_init(void)
 {
@@ -28,6 +32,9 @@ int watchdog_init(void)
 
 void reset_cpu(unsigned long ignored)
 {
+	/* Address error with SR.BL=1 first. */
+	trigger_address_error();
+
 	while (1)
 		;
 }
diff --git a/arch/sh/cpu/sh4/watchdog.c b/arch/sh/cpu/sh4/watchdog.c
index f692429..d7e1703 100644
--- a/arch/sh/cpu/sh4/watchdog.c
+++ b/arch/sh/cpu/sh4/watchdog.c
@@ -17,6 +17,7 @@
 
 #include <common.h>
 #include <asm/processor.h>
+#include <asm/system.h>
 #include <asm/io.h>
 
 #define WDT_BASE	WTCNT
@@ -66,6 +67,9 @@ int watchdog_disable(void)
 
 void reset_cpu(unsigned long ignored)
 {
+	/* Address error with SR.BL=1 first. */
+	trigger_address_error();
+
 	while (1)
 		;
 }
diff --git a/arch/sh/include/asm/system.h b/arch/sh/include/asm/system.h
index 90a53a0..56fd77a 100644
--- a/arch/sh/include/asm/system.h
+++ b/arch/sh/include/asm/system.h
@@ -272,4 +272,14 @@ void enable_hlt(void);
 
 #define arch_align_stack(x) (x)
 
+static inline void trigger_address_error(void)
+{
+	__asm__ __volatile__ (
+		"ldc %0, sr\n\t"
+		"mov.l @%1, %0"
+		:
+		: "r" (0x10000000), "r" (0x80000001)
+	);
+}
+
 #endif
-- 
1.7.1



More information about the U-Boot mailing list