Skip to content

Commit

Permalink
ARM: Orion: WDT: Add clk/clkdev support
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andrew Lunn authored and Mike Turquette committed May 8, 2012
1 parent 452503e commit 4f04be6
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 36 deletions.
3 changes: 2 additions & 1 deletion arch/arm/mach-kirkwood/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ void __init kirkwood_clk_init(void)
orion_clkdev_add(NULL, "orion_spi.1", runit);
orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge0);
orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", ge1);
orion_clkdev_add(NULL, "orion_wdt", tclk);
}

/*****************************************************************************
Expand Down Expand Up @@ -351,7 +352,7 @@ void __init kirkwood_xor1_init(void)
****************************************************************************/
void __init kirkwood_wdt_init(void)
{
orion_wdt_init(kirkwood_tclk);
orion_wdt_init();
}


Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-orion5x/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static void __init orion5x_crypto_init(void)
****************************************************************************/
void __init orion5x_wdt_init(void)
{
orion_wdt_init(orion5x_tclk);
orion_wdt_init();
}


Expand Down
12 changes: 3 additions & 9 deletions arch/arm/plat-orion/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <linux/mv643xx_eth.h>
#include <linux/mv643xx_i2c.h>
#include <net/dsa.h>
#include <plat/orion_wdt.h>
#include <plat/mv_xor.h>
#include <plat/ehci-orion.h>
#include <mach/bridge-regs.h>
Expand Down Expand Up @@ -47,6 +46,7 @@ void __init orion_clkdev_init(struct clk *tclk)
orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", tclk);
orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk);
orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk);
orion_clkdev_add(NULL, "orion_wdt", tclk);
}

/* Fill in the resources structure and link it into the platform
Expand Down Expand Up @@ -575,24 +575,18 @@ void __init orion_spi_1_init(unsigned long mapbase)
/*****************************************************************************
* Watchdog
****************************************************************************/
static struct orion_wdt_platform_data orion_wdt_data;

static struct resource orion_wdt_resource =
DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28);

static struct platform_device orion_wdt_device = {
.name = "orion_wdt",
.id = -1,
.dev = {
.platform_data = &orion_wdt_data,
},
.resource = &orion_wdt_resource,
.num_resources = 1,
.resource = &orion_wdt_resource,
};

void __init orion_wdt_init(unsigned long tclk)
void __init orion_wdt_init(void)
{
orion_wdt_data.tclk = tclk;
platform_device_register(&orion_wdt_device);
}

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-orion/include/plat/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void __init orion_spi_init(unsigned long mapbase);

void __init orion_spi_1_init(unsigned long mapbase);

void __init orion_wdt_init(unsigned long tclk);
void __init orion_wdt_init(void);

void __init orion_xor0_init(unsigned long mapbase_low,
unsigned long mapbase_high,
Expand Down
18 changes: 0 additions & 18 deletions arch/arm/plat-orion/include/plat/orion_wdt.h

This file was deleted.

16 changes: 10 additions & 6 deletions drivers/watchdog/orion_wdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/spinlock.h>
#include <linux/clk.h>
#include <mach/bridge-regs.h>
#include <plat/orion_wdt.h>

/*
* Watchdog timer block registers.
Expand All @@ -41,6 +41,7 @@
static bool nowayout = WATCHDOG_NOWAYOUT;
static int heartbeat = -1; /* module parameter (seconds) */
static unsigned int wdt_max_duration; /* (seconds) */
static struct clk *clk;
static unsigned int wdt_tclk;
static void __iomem *wdt_reg;
static unsigned long wdt_status;
Expand Down Expand Up @@ -237,16 +238,16 @@ static struct miscdevice orion_wdt_miscdev = {

static int __devinit orion_wdt_probe(struct platform_device *pdev)
{
struct orion_wdt_platform_data *pdata = pdev->dev.platform_data;
struct resource *res;
int ret;

if (pdata) {
wdt_tclk = pdata->tclk;
} else {
pr_err("misses platform data\n");
clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(clk)) {
printk(KERN_ERR "Orion Watchdog missing clock\n");
return -ENODEV;
}
clk_prepare_enable(clk);
wdt_tclk = clk_get_rate(clk);

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);

Expand Down Expand Up @@ -282,6 +283,9 @@ static int __devexit orion_wdt_remove(struct platform_device *pdev)
if (!ret)
orion_wdt_miscdev.parent = NULL;

clk_disable_unprepare(clk);
clk_put(clk);

return ret;
}

Expand Down

0 comments on commit 4f04be6

Please sign in to comment.