Root/target/linux/cns21xx/patches-3.7/202-cns21xx-add-watchdog-device.patch

1--- a/arch/arm/mach-cns21xx/common.h
2+++ b/arch/arm/mach-cns21xx/common.h
3@@ -20,5 +20,6 @@ extern struct sys_timer cns21xx_timer;
4 int cns21xx_register_uart0(void);
5 int cns21xx_register_uart1(void);
6 int cns21xx_register_usb(void);
7+int cns21xx_register_wdt(void);
8 
9 #endif /* _MACH_CNS21XX_COMMON_H */
10--- a/arch/arm/mach-cns21xx/devices.c
11+++ b/arch/arm/mach-cns21xx/devices.c
12@@ -11,6 +11,7 @@
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/serial_8250.h>
16+#include <linux/fa_wdt.h>
17 
18 #include <mach/irqs.h>
19 #include <mach/hardware.h>
20@@ -77,3 +78,32 @@ int __init cns21xx_register_uart1(void)
21     HAL_MISC_ENABLE_UART1_PINS();
22     return platform_device_register(&cns21xx_uart1_device);
23 }
24+
25+static struct resource cns21xx_wdt_resources[] = {
26+ {
27+ .start = CNS21XX_WDT_BASE,
28+ .end = CNS21XX_WDT_BASE + SZ_4K - 1,
29+ .flags = IORESOURCE_MEM,
30+ },
31+};
32+
33+#define CNS21XX_WDT_CLOCK 10 /* 10 Hz */
34+
35+static struct fa_wdt_platform_data cns21xx_wdt_data = {
36+ .clock = CNS21XX_WDT_CLOCK,
37+};
38+
39+static struct platform_device cns21xx_wdt_device = {
40+ .name = "fa-wdt",
41+ .id = -1,
42+ .resource = cns21xx_wdt_resources,
43+ .num_resources = ARRAY_SIZE(cns21xx_wdt_resources),
44+ .dev = {
45+ .platform_data = &cns21xx_wdt_data,
46+ },
47+};
48+
49+int __init cns21xx_register_wdt(void)
50+{
51+ return platform_device_register(&cns21xx_wdt_device);
52+}
53--- a/drivers/watchdog/Kconfig
54+++ b/drivers/watchdog/Kconfig
55@@ -354,7 +354,7 @@ config IMX2_WDT
56 
57 config FA_WATCHDOG
58     tristate "Faraday watchdog"
59- depends on ARCH_GEMINI
60+ depends on ARCH_GEMINI || ARCH_CNS21XX
61     help
62       Say Y here if you want support for the built-in watchdog timer
63       found in some Faraday FA526 based SoCs.
64

Archive Download this file



interactive