Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrew Lunn and committed by
Mike Turquette
4f04be62 452503eb

+17 -36
+2 -1
arch/arm/mach-kirkwood/common.c
··· 112 112 orion_clkdev_add(NULL, "orion_spi.1", runit); 113 113 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".0", ge0); 114 114 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", ge1); 115 + orion_clkdev_add(NULL, "orion_wdt", tclk); 115 116 } 116 117 117 118 /***************************************************************************** ··· 352 351 ****************************************************************************/ 353 352 void __init kirkwood_wdt_init(void) 354 353 { 355 - orion_wdt_init(kirkwood_tclk); 354 + orion_wdt_init(); 356 355 } 357 356 358 357
+1 -1
arch/arm/mach-orion5x/common.c
··· 193 193 ****************************************************************************/ 194 194 void __init orion5x_wdt_init(void) 195 195 { 196 - orion_wdt_init(orion5x_tclk); 196 + orion_wdt_init(); 197 197 } 198 198 199 199
+3 -9
arch/arm/plat-orion/common.c
··· 19 19 #include <linux/mv643xx_eth.h> 20 20 #include <linux/mv643xx_i2c.h> 21 21 #include <net/dsa.h> 22 - #include <plat/orion_wdt.h> 23 22 #include <plat/mv_xor.h> 24 23 #include <plat/ehci-orion.h> 25 24 #include <mach/bridge-regs.h> ··· 46 47 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".1", tclk); 47 48 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".2", tclk); 48 49 orion_clkdev_add(NULL, MV643XX_ETH_NAME ".3", tclk); 50 + orion_clkdev_add(NULL, "orion_wdt", tclk); 49 51 } 50 52 51 53 /* Fill in the resources structure and link it into the platform ··· 575 575 /***************************************************************************** 576 576 * Watchdog 577 577 ****************************************************************************/ 578 - static struct orion_wdt_platform_data orion_wdt_data; 579 - 580 578 static struct resource orion_wdt_resource = 581 579 DEFINE_RES_MEM(TIMER_VIRT_BASE, 0x28); 582 580 583 581 static struct platform_device orion_wdt_device = { 584 582 .name = "orion_wdt", 585 583 .id = -1, 586 - .dev = { 587 - .platform_data = &orion_wdt_data, 588 - }, 589 - .resource = &orion_wdt_resource, 590 584 .num_resources = 1, 585 + .resource = &orion_wdt_resource, 591 586 }; 592 587 593 - void __init orion_wdt_init(unsigned long tclk) 588 + void __init orion_wdt_init(void) 594 589 { 595 - orion_wdt_data.tclk = tclk; 596 590 platform_device_register(&orion_wdt_device); 597 591 } 598 592
+1 -1
arch/arm/plat-orion/include/plat/common.h
··· 71 71 72 72 void __init orion_spi_1_init(unsigned long mapbase); 73 73 74 - void __init orion_wdt_init(unsigned long tclk); 74 + void __init orion_wdt_init(void); 75 75 76 76 void __init orion_xor0_init(unsigned long mapbase_low, 77 77 unsigned long mapbase_high,
-18
arch/arm/plat-orion/include/plat/orion_wdt.h
··· 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 - 12 - struct orion_wdt_platform_data { 13 - u32 tclk; /* no <linux/clk.h> support yet */ 14 - }; 15 - 16 - 17 - #endif 18 -
+10 -6
drivers/watchdog/orion_wdt.c
··· 24 24 #include <linux/uaccess.h> 25 25 #include <linux/io.h> 26 26 #include <linux/spinlock.h> 27 + #include <linux/clk.h> 27 28 #include <mach/bridge-regs.h> 28 - #include <plat/orion_wdt.h> 29 29 30 30 /* 31 31 * Watchdog timer block registers. ··· 41 41 static bool nowayout = WATCHDOG_NOWAYOUT; 42 42 static int heartbeat = -1; /* module parameter (seconds) */ 43 43 static unsigned int wdt_max_duration; /* (seconds) */ 44 + static struct clk *clk; 44 45 static unsigned int wdt_tclk; 45 46 static void __iomem *wdt_reg; 46 47 static unsigned long wdt_status; ··· 238 237 239 238 static int __devinit orion_wdt_probe(struct platform_device *pdev) 240 239 { 241 - struct orion_wdt_platform_data *pdata = pdev->dev.platform_data; 242 240 struct resource *res; 243 241 int ret; 244 242 245 - if (pdata) { 246 - wdt_tclk = pdata->tclk; 247 - } else { 248 - pr_err("misses platform data\n"); 243 + clk = clk_get(&pdev->dev, NULL); 244 + if (IS_ERR(clk)) { 245 + printk(KERN_ERR "Orion Watchdog missing clock\n"); 249 246 return -ENODEV; 250 247 } 248 + clk_prepare_enable(clk); 249 + wdt_tclk = clk_get_rate(clk); 251 250 252 251 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 253 252 ··· 282 281 ret = misc_deregister(&orion_wdt_miscdev); 283 282 if (!ret) 284 283 orion_wdt_miscdev.parent = NULL; 284 + 285 + clk_disable_unprepare(clk); 286 + clk_put(clk); 285 287 286 288 return ret; 287 289 }