aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/mv64x60_wdt.c
diff options
context:
space:
mode:
authorDale Farnsworth <dale@farnsworth.org>2007-07-24 14:09:18 -0400
committerWim Van Sebroeck <wim@iguana.be>2007-07-24 17:15:58 -0400
commit8a5cfa648347ab04e63a7f5e3699768d1f9bf00d (patch)
treebd9a7457e23239bc8a755d35dc3aa793dd1f650c /drivers/char/watchdog/mv64x60_wdt.c
parent422db8d229affd429b5a7389600877aa7dea2704 (diff)
[WATCHDOG] mv64x60_wdt: Get register address from platform data
Previously, the address of the watchdog timer registers was retrieved by calling a global function, mv64x60_get_bridge_vbase(). That function doesn't exist in arch/powerpc. Instead, we now get the register address from a platform data resource and ioremap the registers within the driver. Signed-off-by: Dale Farnsworth <dale@farnsworth.org> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/char/watchdog/mv64x60_wdt.c')
-rw-r--r--drivers/char/watchdog/mv64x60_wdt.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c
index 038f76e39818..1ad632dd03e6 100644
--- a/drivers/char/watchdog/mv64x60_wdt.c
+++ b/drivers/char/watchdog/mv64x60_wdt.c
@@ -27,6 +27,8 @@
27#include <asm/uaccess.h> 27#include <asm/uaccess.h>
28#include <asm/io.h> 28#include <asm/io.h>
29 29
30#define MV64x60_WDT_WDC_OFFSET 0
31
30/* MV64x60 WDC (config) register access definitions */ 32/* MV64x60 WDC (config) register access definitions */
31#define MV64x60_WDC_CTL1_MASK (3 << 24) 33#define MV64x60_WDC_CTL1_MASK (3 << 24)
32#define MV64x60_WDC_CTL1(val) ((val & 3) << 24) 34#define MV64x60_WDC_CTL1(val) ((val & 3) << 24)
@@ -39,7 +41,7 @@
39 41
40static unsigned long wdt_flags; 42static unsigned long wdt_flags;
41static int wdt_status; 43static int wdt_status;
42static void __iomem *mv64x60_regs; 44static void __iomem *mv64x60_wdt_regs;
43static int mv64x60_wdt_timeout; 45static int mv64x60_wdt_timeout;
44 46
45static void mv64x60_wdt_reg_write(u32 val) 47static void mv64x60_wdt_reg_write(u32 val)
@@ -47,10 +49,10 @@ static void mv64x60_wdt_reg_write(u32 val)
47 /* Allow write only to CTL1 / CTL2 fields, retaining values in 49 /* Allow write only to CTL1 / CTL2 fields, retaining values in
48 * other fields. 50 * other fields.
49 */ 51 */
50 u32 data = readl(mv64x60_regs + MV64x60_WDT_WDC); 52 u32 data = readl(mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
51 data &= ~(MV64x60_WDC_CTL1_MASK | MV64x60_WDC_CTL2_MASK); 53 data &= ~(MV64x60_WDC_CTL1_MASK | MV64x60_WDC_CTL2_MASK);
52 data |= val; 54 data |= val;
53 writel(data, mv64x60_regs + MV64x60_WDT_WDC); 55 writel(data, mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
54} 56}
55 57
56static void mv64x60_wdt_service(void) 58static void mv64x60_wdt_service(void)
@@ -185,6 +187,7 @@ static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
185{ 187{
186 struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data; 188 struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data;
187 int bus_clk = 133; 189 int bus_clk = 133;
190 struct resource *r;
188 191
189 mv64x60_wdt_timeout = 10; 192 mv64x60_wdt_timeout = 10;
190 if (pdata) { 193 if (pdata) {
@@ -192,10 +195,16 @@ static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
192 bus_clk = pdata->bus_clk; 195 bus_clk = pdata->bus_clk;
193 } 196 }
194 197
195 mv64x60_regs = mv64x60_get_bridge_vbase(); 198 r = platform_get_resource(dev, IORESOURCE_MEM, 0);
199 if (!r)
200 return -ENODEV;
201
202 mv64x60_wdt_regs = ioremap(r->start, r->end - r->start + 1);
203 if (mv64x60_wdt_regs == NULL)
204 return -ENOMEM;
196 205
197 writel((mv64x60_wdt_timeout * (bus_clk * 1000000)) >> 8, 206 writel((mv64x60_wdt_timeout * (bus_clk * 1000000)) >> 8,
198 mv64x60_regs + MV64x60_WDT_WDC); 207 mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
199 208
200 return misc_register(&mv64x60_wdt_miscdev); 209 return misc_register(&mv64x60_wdt_miscdev);
201} 210}
@@ -207,6 +216,8 @@ static int __devexit mv64x60_wdt_remove(struct platform_device *dev)
207 mv64x60_wdt_service(); 216 mv64x60_wdt_service();
208 mv64x60_wdt_handler_disable(); 217 mv64x60_wdt_handler_disable();
209 218
219 iounmap(mv64x60_wdt_regs);
220
210 return 0; 221 return 0;
211} 222}
212 223