Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

MIPS: AR7: register watchdog device only if enabled in hw configuration

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>

authored by

Florian Fainelli and committed by
Ralf Baechle
72838a17 2cfac7f7

+11 -1
+8 -1
arch/mips/ar7/platform.c
··· 503 503 { 504 504 u16 chip_id; 505 505 int res; 506 + u32 *bootcr, val; 506 507 #ifdef CONFIG_SERIAL_8250 507 508 static struct uart_port uart_port[2]; 508 509 ··· 596 595 597 596 ar7_wdt_res.end = ar7_wdt_res.start + 0x20; 598 597 599 - res = platform_device_register(&ar7_wdt); 598 + bootcr = (u32 *)ioremap_nocache(AR7_REGS_DCL, 4); 599 + val = *bootcr; 600 + iounmap(bootcr); 601 + 602 + /* Register watchdog only if enabled in hardware */ 603 + if (val & AR7_WDT_HW_ENA) 604 + res = platform_device_register(&ar7_wdt); 600 605 601 606 return res; 602 607 }
+3
arch/mips/include/asm/mach-ar7/ar7.h
··· 78 78 #define AR7_REF_CLOCK 25000000 79 79 #define AR7_XTAL_CLOCK 24000000 80 80 81 + /* DCL */ 82 + #define AR7_WDT_HW_ENA 0x10 83 + 81 84 struct plat_cpmac_data { 82 85 int reset_bit; 83 86 int power_bit;