| To: | Ralf Baechle <ralf@linux-mips.org> |
|---|---|
| Subject: | [PATCH] ar7: register watchdog driver only if enabled in hardware configuration |
| From: | Florian Fainelli <florian@openwrt.org> |
| Date: | Tue, 4 Aug 2009 23:09:36 +0200 |
| Cc: | linux-mips@linux-mips.org |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:from:date:subject :mime-version:x-uid:x-length:to:cc:content-type :content-transfer-encoding:content-disposition:message-id; bh=eS/OWK3+wDWq7Xy8FqzibW030xcVvpJlJIOzK0m8/Lg=; b=GhnNldHMs1vxA491dye1iFc6/hhWcUNtZMup52VhEAkSpbNp5VoAuDes+Vz8UjJhhE WvySmuh+/P/MGzky2OYDendIgmHCKc7TfPh/bBc3Mr26J3qPqjc4hJdbDBp7e2Z4yvln lwqpMcXDw86YuO7z4/La6f4RU6xpjwni9RMJU= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:from:date:subject:mime-version:x-uid:x-length:to:cc :content-type:content-transfer-encoding:content-disposition :message-id; b=LsYxBzu67yg5N+ZYBPsRFSeYUHI5M3KtqSRGNUvqF7RWFkn1K6mtCCop1Nv8UfttYH XbXkImMfbuPvVyeyj6uSF2si/+K1WKxgLo5n2MgYHHvQSqAGJr7qeDV9bndrxWSi9ZJ7 iNSFAqIti3F/FeMc2lq4u4Rsp0LI0e9rJC8MQ= |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| Sender: | linux-mips-bounce@linux-mips.org |
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>
---
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index e2278c0..835f3f0 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -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];
@@ -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;
}
diff --git a/arch/mips/include/asm/mach-ar7/ar7.h
b/arch/mips/include/asm/mach-ar7/ar7.h
index de71694..21cbbc7 100644
--- a/arch/mips/include/asm/mach-ar7/ar7.h
+++ b/arch/mips/include/asm/mach-ar7/ar7.h
@@ -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;
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 5/5] cpmac: bump version to 0.5.1, Florian Fainelli |
|---|---|
| Next by Date: | [PATCH 6/5] cpmac: unmark as broken, Florian Fainelli |
| Previous by Thread: | [PATCH 5/5] cpmac: bump version to 0.5.1, Florian Fainelli |
| Next by Thread: | Re: [PATCH] ar7: register watchdog driver only if enabled in hardware configuration, Alexander Clouter |
| Indexes: | [Date] [Thread] [Top] [All Lists] |