projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ppc/85xx: Fix crashes due to generation of SPE instruction
[oweals/u-boot.git]
/
cpu
/
sh4
/
watchdog.c
diff --git
a/cpu/sh4/watchdog.c
b/cpu/sh4/watchdog.c
index 04723a74627c4ae4e6fa78cd8ddd7cf55279e580..f6924290f00c381916c9ba24c8ba33625cf8351b 100644
(file)
--- a/
cpu/sh4/watchdog.c
+++ b/
cpu/sh4/watchdog.c
@@
-17,36
+17,55
@@
#include <common.h>
#include <asm/processor.h>
#include <common.h>
#include <asm/processor.h>
+#include <asm/io.h>
#define WDT_BASE WTCNT
#define WDT_BASE WTCNT
-static unsigned char cnt_read (void){
- return *((volatile unsigned char *)(WDT_BASE + 0x00));
+#define WDT_WD (1 << 6)
+#define WDT_RST_P (0)
+#define WDT_RST_M (1 << 5)
+#define WDT_ENABLE (1 << 7)
+
+#if defined(CONFIG_WATCHDOG)
+static unsigned char csr_read(void)
+{
+ return inb(WDT_BASE + 0x04);
}
}
-static unsigned char csr_read (void){
- return *((volatile unsigned char *)(WDT_BASE + 0x04));
+static void cnt_write(unsigned char value)
+{
+ outl((unsigned short)value | 0x5A00, WDT_BASE + 0x00);
}
}
-static void cnt_write (unsigned char value){
- while (csr_read() & (1 << 5)) {
- /* delay */
- }
- *((volatile unsigned short *)(WDT_BASE + 0x00))
- = ((unsigned short) value) | 0x5A00;
+static void csr_write(unsigned char value)
+{
+ outl((unsigned short)value | 0xA500, WDT_BASE + 0x04);
}
}
-static void csr_write (unsigned char value){
- *((volatile unsigned short *)(WDT_BASE + 0x04))
-
= ((unsigned short) value) | 0xA500
;
+void watchdog_reset(void)
+{
+
outl(0x55000000, WDT_BASE + 0x08)
;
}
}
+int watchdog_init(void)
+{
+ /* Set overflow time*/
+ cnt_write(0);
+ /* Power on reset */
+ csr_write(WDT_WD|WDT_RST_P|WDT_ENABLE);
-int watchdog_init (void){ return 0; }
+ return 0;
+}
-
void reset_cpu (unsigned long ignore
d)
+
int watchdog_disable(voi
d)
{
{
- while(1);
+ csr_write(csr_read() & ~WDT_ENABLE);
+ return 0;
}
}
+#endif
-
+void reset_cpu(unsigned long ignored)
+{
+ while (1)
+ ;
+}