Skip to content

Commit

Permalink
MIPS: AR7: register watchdog device only if enabled in hw configuration
Browse files Browse the repository at this point in the history
This patch checks if the watchdog enable bit is set in the DCL register
meaning that the hardware watchdog actually works and if so, register the
ar7_wdt platform_device.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  • Loading branch information
Florian Fainelli authored and Ralf Baechle committed Nov 2, 2009
1 parent 2cfac7f commit 72838a1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 8 additions & 1 deletion arch/mips/ar7/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ static int __init ar7_register_devices(void)
{
u16 chip_id;
int res;
u32 *bootcr, val;
#ifdef CONFIG_SERIAL_8250
static struct uart_port uart_port[2];

Expand Down Expand Up @@ -595,7 +596,13 @@ static int __init ar7_register_devices(void)

ar7_wdt_res.end = ar7_wdt_res.start + 0x20;

res = platform_device_register(&ar7_wdt);
bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4);
val = *bootcr;
iounmap(bootcr);

/* Register watchdog only if enabled in hardware */
if (val & AR7_WDT_HW_ENA)
res = platform_device_register(&ar7_wdt);

return res;
}
Expand Down
3 changes: 3 additions & 0 deletions arch/mips/include/asm/mach-ar7/ar7.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
#define AR7_REF_CLOCK 25000000
#define AR7_XTAL_CLOCK 24000000

/* DCL */
#define AR7_WDT_HW_ENA 0x10

struct plat_cpmac_data {
int reset_bit;
int power_bit;
Expand Down

0 comments on commit 72838a1

Please sign in to comment.