aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2012-03-04 10:57:31 -0500
committerMike Turquette <mturquette@linaro.org>2012-05-08 19:33:57 -0400
commit4f04be62af95119d258b8035f498100e43c8c527 (patch)
tree86778fee3006ca06791bcbf65ea437a1e13fded7
parent452503ebc7cc4cce5b9e52cf2f03255365a53234 (diff)
ARM: Orion: WDT: Add clk/clkdev support
Remove tclk from platform data. This makes the platform data structure empty, so remove it. Signed-off-by: Andrew Lunn <andrew@lunn.ch> Tested-by: Jamie Lentin <jm@lentin.co.uk> Signed-off-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r--arch/arm/mach-kirkwood/common.c3
-rw-r--r--arch/arm/mach-orion5x/common.c2
-rw-r--r--arch/arm/plat-orion/common.c12
-rw-r--r--arch/arm/plat-orion/include/plat/common.h2
-rw-r--r--arch/arm/plat-orion/include/plat/orion_wdt.h18
-rw-r--r--drivers/watchdog/orion_wdt.c16
6 files changed, 17 insertions, 36 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index c22354405297..880f3667a2eb 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -112,6 +112,7 @@ void __init kirkwood_clk_init(void)
112 orion_clkdev_add(NULL, "orion_spi.1", runit); 112 orion_clkdev_add(NULL, "orion_spi.1", runit);
113 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge0); 113 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge0);
114 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", ge1); 114 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", ge1);
115 orion_clkdev_add(NULL, "orion_wdt", tclk);
115} 116}
116 117
117/***************************************************************************** 118/*****************************************************************************
@@ -351,7 +352,7 @@ void __init kirkwood_xor1_init(void)
351 ****************************************************************************/ 352 ****************************************************************************/
352void __init kirkwood_wdt_init(void) 353void __init kirkwood_wdt_init(void)
353{ 354{
354 orion_wdt_init(kirkwood_tclk); 355 orion_wdt_init();
355} 356}
356 357
357 358
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 3fc731824e9c..067bdd7c06dd 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -193,7 +193,7 @@ static void __init orion5x_crypto_init(void)
193 ****************************************************************************/ 193 ****************************************************************************/
194void __init orion5x_wdt_init(void) 194void __init orion5x_wdt_init(void)
195{ 195{
196 orion_wdt_init(orion5x_tclk); 196 orion_wdt_init();
197} 197}
198 198
199 199
diff --git a/arch/arm/plat-orion/common.c b/arch/arm/plat-orion/common.c
index a33733bb380d..d349998f72e5 100644
--- a/arch/arm/plat-orion/common.c
+++ b/arch/arm/plat-orion/common.c
@@ -19,7 +19,6 @@
19#include <linux/mv643xx_eth.h> 19#include <linux/mv643xx_eth.h>
20#include <linux/mv643xx_i2c.h> 20#include <linux/mv643xx_i2c.h>
21#include <net/dsa.h> 21#include <net/dsa.h>
22#include <plat/orion_wdt.h>
23#include <plat/mv_xor.h> 22#include <plat/mv_xor.h>
24#include <plat/ehci-orion.h> 23#include <plat/ehci-orion.h>
25#include <mach/bridge-regs.h> 24#include <mach/bridge-regs.h>
@@ -47,6 +46,7 @@ void __init orion_clkdev_init(struct clk *tclk)
47 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", tclk); 46 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", tclk);
48 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk); 47 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk);
49 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk); 48 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk);
49 orion_clkdev_add(NULL, "orion_wdt", tclk);
50} 50}
51 51
52/* Fill in the resources structure and link it into the platform 52/* Fill in the resources structure and link it into the platform
@@ -575,24 +575,18 @@ void __init orion_spi_1_init(unsigned long mapbase)
575/***************************************************************************** 575/*****************************************************************************
576 * Watchdog 576 * Watchdog
577 ****************************************************************************/ 577 ****************************************************************************/
578static struct orion_wdt_platform_data orion_wdt_data;
579
580static struct resource orion_wdt_resource = 578static struct resource orion_wdt_resource =
581 DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28); 579 DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28);
582 580
583static struct platform_device orion_wdt_device = { 581static struct platform_device orion_wdt_device = {
584 .name = "orion_wdt", 582 .name = "orion_wdt",
585 .id = -1, 583 .id = -1,
586 .dev = {
587 .platform_data = &orion_wdt_data,
588 },
589 .resource = &orion_wdt_resource,
590 .num_resources = 1, 584 .num_resources = 1,
585 .resource = &orion_wdt_resource,
591}; 586};
592 587
593void __init orion_wdt_init(unsigned long tclk) 588void __init orion_wdt_init(void)
594{ 589{
595 orion_wdt_data.tclk = tclk;
596 platform_device_register(&orion_wdt_device); 590 platform_device_register(&orion_wdt_device);
597} 591}
598 592
diff --git a/arch/arm/plat-orion/include/plat/common.h b/arch/arm/plat-orion/include/plat/common.h
index 00d8761c7d28..c3bfa91bfaa6 100644
--- a/arch/arm/plat-orion/include/plat/common.h
+++ b/arch/arm/plat-orion/include/plat/common.h
@@ -71,7 +71,7 @@ void __init orion_spi_init(unsigned long mapbase);
71 71
72void __init orion_spi_1_init(unsigned long mapbase); 72void __init orion_spi_1_init(unsigned long mapbase);
73 73
74void __init orion_wdt_init(unsigned long tclk); 74void __init orion_wdt_init(void);
75 75
76void __init orion_xor0_init(unsigned long mapbase_low, 76void __init orion_xor0_init(unsigned long mapbase_low,
77 unsigned long mapbase_high, 77 unsigned long mapbase_high,
diff --git a/arch/arm/plat-orion/include/plat/orion_wdt.h b/arch/arm/plat-orion/include/plat/orion_wdt.h
deleted file mode 100644
index 665c362a2fba..000000000000
--- a/arch/arm/plat-orion/include/plat/orion_wdt.h
+++ /dev/null
@@ -1,18 +0,0 @@
1/*
2 * arch/arm/plat-orion/include/plat/orion_wdt.h
3 *
4 * This file is licensed under the terms of the GNU General Public
5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied.
7 */
8
9#ifndef __PLAT_ORION_WDT_H
10#define __PLAT_ORION_WDT_H
11
12struct orion_wdt_platform_data {
13 u32 tclk; /* no <linux/clk.h> support yet */
14};
15
16
17#endif
18
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 788aa158e78c..0f5736949c61 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -24,8 +24,8 @@
24#include <linux/uaccess.h> 24#include <linux/uaccess.h>
25#include <linux/io.h> 25#include <linux/io.h>
26#include <linux/spinlock.h> 26#include <linux/spinlock.h>
27#include <linux/clk.h>
27#include <mach/bridge-regs.h> 28#include <mach/bridge-regs.h>
28#include <plat/orion_wdt.h>
29 29
30/* 30/*
31 * Watchdog timer block registers. 31 * Watchdog timer block registers.
@@ -41,6 +41,7 @@
41static bool nowayout = WATCHDOG_NOWAYOUT; 41static bool nowayout = WATCHDOG_NOWAYOUT;
42static int heartbeat = -1; /* module parameter (seconds) */ 42static int heartbeat = -1; /* module parameter (seconds) */
43static unsigned int wdt_max_duration; /* (seconds) */ 43static unsigned int wdt_max_duration; /* (seconds) */
44static struct clk *clk;
44static unsigned int wdt_tclk; 45static unsigned int wdt_tclk;
45static void __iomem *wdt_reg; 46static void __iomem *wdt_reg;
46static unsigned long wdt_status; 47static unsigned long wdt_status;
@@ -237,16 +238,16 @@ static struct miscdevice orion_wdt_miscdev = {
237 238
238static int __devinit orion_wdt_probe(struct platform_device *pdev) 239static int __devinit orion_wdt_probe(struct platform_device *pdev)
239{ 240{
240 struct orion_wdt_platform_data *pdata = pdev->dev.platform_data;
241 struct resource *res; 241 struct resource *res;
242 int ret; 242 int ret;
243 243
244 if (pdata) { 244 clk = clk_get(&pdev->dev, NULL);
245 wdt_tclk = pdata->tclk; 245 if (IS_ERR(clk)) {
246 } else { 246 printk(KERN_ERR "Orion Watchdog missing clock\n");
247 pr_err("misses platform data\n");
248 return -ENODEV; 247 return -ENODEV;
249 } 248 }
249 clk_prepare_enable(clk);
250 wdt_tclk = clk_get_rate(clk);
250 251
251 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 252 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
252 253
@@ -282,6 +283,9 @@ static int __devexit orion_wdt_remove(struct platform_device *pdev)
282 if (!ret) 283 if (!ret)
283 orion_wdt_miscdev.parent = NULL; 284 orion_wdt_miscdev.parent = NULL;
284 285
286 clk_disable_unprepare(clk);
287 clk_put(clk);
288
285 return ret; 289 return ret;
286} 290}
287 291