aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/orion_wdt.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 15:34:33 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-28 15:34:33 -0400
commit09893ee84591b0417a9186a7e7cf1503ccf99ac2 (patch)
treeda8b044ad157b82203df04ae48cb60f4737cc390 /drivers/watchdog/orion_wdt.c
parent4bb2d1009f671815870e8f78e826e4f9071392a7 (diff)
parent7d1206bc2859c6e9f46e35ae697c138e7d7858a7 (diff)
Merge tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull "ARM: More device tree support updates" from Olof Johansson: "This branch contains a number of updates for device tree support on several ARM platforms, in particular: * AT91 continues the device tree conversion adding support for a number of on-chip drivers and other functionality * ux500 adds probing of some of the core SoC blocks through device tree * Initial device tree support for ST SPEAr600 platforms * kirkwood continues the conversion to device-tree probing" Manually merge arch/arm/mach-ux500/Kconfig due to MACH_U8500 rename, and drivers/usb/gadget/at91_udc.c due to header file include cleanups. Also do an "evil merge" for the MACH_U8500 config option rename that the affected RMI4 touchscreen driver in staging. It's called MACH_MOP500 now, and it was missed during previous merges. * tag 'dt2' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (48 commits) ARM: SPEAr600: Add device-tree support to SPEAr600 boards ARM: ux500: Provide local timer support for Device Tree ARM: ux500: Enable PL022 SSP Controller in Device Tree ARM: ux500: Enable PL310 Level 2 Cache Controller in Device Tree ARM: ux500: Enable PL011 AMBA UART Controller for Device Tree ARM: ux500: Enable Cortex-A9 GIC (Generic Interrupt Controller) in Device Tree ARM: ux500: db8500: list most devices in the snowball device tree ARM: ux500: split dts file for snowball into generic part ARM: ux500: combine the board init functions for DT boot ARM: ux500: Initial Device Tree support for Snowball ARM: ux500: CONFIG: Enable Device Tree support for future endeavours ARM: kirkwood: use devicetree for rtc-mv ARM: kirkwood: rtc-mv devicetree bindings ARM: kirkwood: fdt: define uart[01] as disabled, enable uart0 ARM: kirkwood: fdt: facilitate new boards during fdt migration ARM: kirkwood: fdt: absorb kirkwood_init() ARM: kirkwood: fdt: use mrvl ticker symbol ARM: orion: wdt: use resource vice direct access ARM: Kirkwood: Remove tclk from kirkwood_asoc_platform_data. ARM: orion: spi: remove enable_clock_fix which is not used ...
Diffstat (limited to 'drivers/watchdog/orion_wdt.c')
-rw-r--r--drivers/watchdog/orion_wdt.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 4ad78f86851..1368e4ca310 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -28,9 +28,9 @@
28/* 28/*
29 * Watchdog timer block registers. 29 * Watchdog timer block registers.
30 */ 30 */
31#define TIMER_CTRL (TIMER_VIRT_BASE + 0x0000) 31#define TIMER_CTRL 0x0000
32#define WDT_EN 0x0010 32#define WDT_EN 0x0010
33#define WDT_VAL (TIMER_VIRT_BASE + 0x0024) 33#define WDT_VAL 0x0024
34 34
35#define WDT_MAX_CYCLE_COUNT 0xffffffff 35#define WDT_MAX_CYCLE_COUNT 0xffffffff
36#define WDT_IN_USE 0 36#define WDT_IN_USE 0
@@ -40,6 +40,7 @@ static int nowayout = WATCHDOG_NOWAYOUT;
40static int heartbeat = -1; /* module parameter (seconds) */ 40static int heartbeat = -1; /* module parameter (seconds) */
41static unsigned int wdt_max_duration; /* (seconds) */ 41static unsigned int wdt_max_duration; /* (seconds) */
42static unsigned int wdt_tclk; 42static unsigned int wdt_tclk;
43static void __iomem *wdt_reg;
43static unsigned long wdt_status; 44static unsigned long wdt_status;
44static DEFINE_SPINLOCK(wdt_lock); 45static DEFINE_SPINLOCK(wdt_lock);
45 46
@@ -48,7 +49,7 @@ static void orion_wdt_ping(void)
48 spin_lock(&wdt_lock); 49 spin_lock(&wdt_lock);
49 50
50 /* Reload watchdog duration */ 51 /* Reload watchdog duration */
51 writel(wdt_tclk * heartbeat, WDT_VAL); 52 writel(wdt_tclk * heartbeat, wdt_reg + WDT_VAL);
52 53
53 spin_unlock(&wdt_lock); 54 spin_unlock(&wdt_lock);
54} 55}
@@ -60,7 +61,7 @@ static void orion_wdt_enable(void)
60 spin_lock(&wdt_lock); 61 spin_lock(&wdt_lock);
61 62
62 /* Set watchdog duration */ 63 /* Set watchdog duration */
63 writel(wdt_tclk * heartbeat, WDT_VAL); 64 writel(wdt_tclk * heartbeat, wdt_reg + WDT_VAL);
64 65
65 /* Clear watchdog timer interrupt */ 66 /* Clear watchdog timer interrupt */
66 reg = readl(BRIDGE_CAUSE); 67 reg = readl(BRIDGE_CAUSE);
@@ -68,9 +69,9 @@ static void orion_wdt_enable(void)
68 writel(reg, BRIDGE_CAUSE); 69 writel(reg, BRIDGE_CAUSE);
69 70
70 /* Enable watchdog timer */ 71 /* Enable watchdog timer */
71 reg = readl(TIMER_CTRL); 72 reg = readl(wdt_reg + TIMER_CTRL);
72 reg |= WDT_EN; 73 reg |= WDT_EN;
73 writel(reg, TIMER_CTRL); 74 writel(reg, wdt_reg + TIMER_CTRL);
74 75
75 /* Enable reset on watchdog */ 76 /* Enable reset on watchdog */
76 reg = readl(RSTOUTn_MASK); 77 reg = readl(RSTOUTn_MASK);
@@ -92,9 +93,9 @@ static void orion_wdt_disable(void)
92 writel(reg, RSTOUTn_MASK); 93 writel(reg, RSTOUTn_MASK);
93 94
94 /* Disable watchdog timer */ 95 /* Disable watchdog timer */
95 reg = readl(TIMER_CTRL); 96 reg = readl(wdt_reg + TIMER_CTRL);
96 reg &= ~WDT_EN; 97 reg &= ~WDT_EN;
97 writel(reg, TIMER_CTRL); 98 writel(reg, wdt_reg + TIMER_CTRL);
98 99
99 spin_unlock(&wdt_lock); 100 spin_unlock(&wdt_lock);
100} 101}
@@ -102,7 +103,7 @@ static void orion_wdt_disable(void)
102static int orion_wdt_get_timeleft(int *time_left) 103static int orion_wdt_get_timeleft(int *time_left)
103{ 104{
104 spin_lock(&wdt_lock); 105 spin_lock(&wdt_lock);
105 *time_left = readl(WDT_VAL) / wdt_tclk; 106 *time_left = readl(wdt_reg + WDT_VAL) / wdt_tclk;
106 spin_unlock(&wdt_lock); 107 spin_unlock(&wdt_lock);
107 return 0; 108 return 0;
108} 109}
@@ -236,6 +237,7 @@ static struct miscdevice orion_wdt_miscdev = {
236static int __devinit orion_wdt_probe(struct platform_device *pdev) 237static int __devinit orion_wdt_probe(struct platform_device *pdev)
237{ 238{
238 struct orion_wdt_platform_data *pdata = pdev->dev.platform_data; 239 struct orion_wdt_platform_data *pdata = pdev->dev.platform_data;
240 struct resource *res;
239 int ret; 241 int ret;
240 242
241 if (pdata) { 243 if (pdata) {
@@ -245,6 +247,10 @@ static int __devinit orion_wdt_probe(struct platform_device *pdev)
245 return -ENODEV; 247 return -ENODEV;
246 } 248 }
247 249
250 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
251
252 wdt_reg = ioremap(res->start, resource_size(res));
253
248 if (orion_wdt_miscdev.parent) 254 if (orion_wdt_miscdev.parent)
249 return -EBUSY; 255 return -EBUSY;
250 orion_wdt_miscdev.parent = &pdev->dev; 256 orion_wdt_miscdev.parent = &pdev->dev;