|
@@ -18,6 +18,7 @@
|
|
|
|
|
|
enum {
|
|
|
Wdogfreq = 65536,
|
|
|
+ Wdogtime = 5, /* seconds, ≤ 15 */
|
|
|
};
|
|
|
|
|
|
/*
|
|
@@ -28,6 +29,7 @@ enum {
|
|
|
Password = 0x5A<<24,
|
|
|
CfgMask = 0x03<<4,
|
|
|
CfgReset = 0x02<<4,
|
|
|
+ Rsts = 0x20>>2,
|
|
|
Wdog = 0x24>>2,
|
|
|
};
|
|
|
|
|
@@ -50,6 +52,25 @@ archreboot(void)
|
|
|
;
|
|
|
}
|
|
|
|
|
|
+static void
|
|
|
+wdogfeed(void)
|
|
|
+{
|
|
|
+ u32int *r;
|
|
|
+
|
|
|
+ r = (u32int*)POWERREGS;
|
|
|
+ r[Wdog] = Password | (Wdogtime * Wdogfreq);
|
|
|
+ r[Rstc] = Password | (r[Rstc] & ~CfgMask) | CfgReset;
|
|
|
+}
|
|
|
+
|
|
|
+void
|
|
|
+wdogoff(void)
|
|
|
+{
|
|
|
+ u32int *r;
|
|
|
+
|
|
|
+ r = (u32int*)POWERREGS;
|
|
|
+ r[Rstc] = Password | (r[Rstc] & ~CfgMask);
|
|
|
+}
|
|
|
+
|
|
|
void
|
|
|
cpuidprint(void)
|
|
|
{
|
|
@@ -59,6 +80,7 @@ cpuidprint(void)
|
|
|
void
|
|
|
archbcmlink(void)
|
|
|
{
|
|
|
+ addclock0link(wdogfeed, HZ);
|
|
|
}
|
|
|
|
|
|
int
|