diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-01-19 15:44:33 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-02-08 12:50:16 -0500 |
commit | 39a80c7f379e1c1d3e63b204b8353b7381d0a3d5 (patch) | |
tree | 7e2b60598eac3d5aab46b1c6fcbf8511d2be9ee5 | |
parent | f1c2543738d18e4398e3d6e27abff6676667975a (diff) |
[ARM] omap: watchdog: convert clocks to match by devid and conid
This eliminates the need for separate OMAP24xx and OMAP34xx clock
requesting code sections.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r-- | arch/arm/mach-omap1/clock.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock24xx.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/clock34xx.c | 4 | ||||
-rw-r--r-- | drivers/watchdog/omap_wdt.c | 93 |
4 files changed, 30 insertions, 73 deletions
diff --git a/arch/arm/mach-omap1/clock.c b/arch/arm/mach-omap1/clock.c index 88c716331ee5..8ae7827bb8b8 100644 --- a/arch/arm/mach-omap1/clock.c +++ b/arch/arm/mach-omap1/clock.c | |||
@@ -85,7 +85,7 @@ static struct omap_clk omap_clks[] = { | |||
85 | CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310), | 85 | CLK(NULL, "arm_gpio_ck", &arm_gpio_ck, CK_1510 | CK_310), |
86 | CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), | 86 | CLK(NULL, "armxor_ck", &armxor_ck.clk, CK_16XX | CK_1510 | CK_310), |
87 | CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310), | 87 | CLK(NULL, "armtim_ck", &armtim_ck.clk, CK_16XX | CK_1510 | CK_310), |
88 | CLK(NULL, "armwdt_ck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), | 88 | CLK("omap_wdt", "fck", &armwdt_ck.clk, CK_16XX | CK_1510 | CK_310), |
89 | CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310), | 89 | CLK(NULL, "arminth_ck", &arminth_ck1510, CK_1510 | CK_310), |
90 | CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX), | 90 | CLK(NULL, "arminth_ck", &arminth_ck16xx, CK_16XX), |
91 | /* CK_GEN2 clocks */ | 91 | /* CK_GEN2 clocks */ |
diff --git a/arch/arm/mach-omap2/clock24xx.c b/arch/arm/mach-omap2/clock24xx.c index 36093ea878a3..6a6278e5bbce 100644 --- a/arch/arm/mach-omap2/clock24xx.c +++ b/arch/arm/mach-omap2/clock24xx.c | |||
@@ -163,8 +163,8 @@ static struct omap_clk omap24xx_clks[] = { | |||
163 | CLK(NULL, "uart3_fck", &uart3_fck, CK_243X | CK_242X), | 163 | CLK(NULL, "uart3_fck", &uart3_fck, CK_243X | CK_242X), |
164 | CLK(NULL, "gpios_ick", &gpios_ick, CK_243X | CK_242X), | 164 | CLK(NULL, "gpios_ick", &gpios_ick, CK_243X | CK_242X), |
165 | CLK(NULL, "gpios_fck", &gpios_fck, CK_243X | CK_242X), | 165 | CLK(NULL, "gpios_fck", &gpios_fck, CK_243X | CK_242X), |
166 | CLK(NULL, "mpu_wdt_ick", &mpu_wdt_ick, CK_243X | CK_242X), | 166 | CLK("omap_wdt", "ick", &mpu_wdt_ick, CK_243X | CK_242X), |
167 | CLK(NULL, "mpu_wdt_fck", &mpu_wdt_fck, CK_243X | CK_242X), | 167 | CLK("omap_wdt", "fck", &mpu_wdt_fck, CK_243X | CK_242X), |
168 | CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X | CK_242X), | 168 | CLK(NULL, "sync_32k_ick", &sync_32k_ick, CK_243X | CK_242X), |
169 | CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X | CK_242X), | 169 | CLK(NULL, "wdt1_ick", &wdt1_ick, CK_243X | CK_242X), |
170 | CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X | CK_242X), | 170 | CLK(NULL, "omapctrl_ick", &omapctrl_ick, CK_243X | CK_242X), |
diff --git a/arch/arm/mach-omap2/clock34xx.c b/arch/arm/mach-omap2/clock34xx.c index 2c22750016cc..b3334b355cb1 100644 --- a/arch/arm/mach-omap2/clock34xx.c +++ b/arch/arm/mach-omap2/clock34xx.c | |||
@@ -214,10 +214,10 @@ static struct omap_clk omap34xx_clks[] = { | |||
214 | CLK(NULL, "gpt1_fck", &gpt1_fck, CK_343X), | 214 | CLK(NULL, "gpt1_fck", &gpt1_fck, CK_343X), |
215 | CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_343X), | 215 | CLK(NULL, "wkup_32k_fck", &wkup_32k_fck, CK_343X), |
216 | CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_343X), | 216 | CLK(NULL, "gpio1_dbck", &gpio1_dbck, CK_343X), |
217 | CLK(NULL, "wdt2_fck", &wdt2_fck, CK_343X), | 217 | CLK("omap_wdt", "fck", &wdt2_fck, CK_343X), |
218 | CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_343X), | 218 | CLK(NULL, "wkup_l4_ick", &wkup_l4_ick, CK_343X), |
219 | CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2), | 219 | CLK(NULL, "usim_ick", &usim_ick, CK_3430ES2), |
220 | CLK(NULL, "wdt2_ick", &wdt2_ick, CK_343X), | 220 | CLK("omap_wdt", "ick", &wdt2_ick, CK_343X), |
221 | CLK(NULL, "wdt1_ick", &wdt1_ick, CK_343X), | 221 | CLK(NULL, "wdt1_ick", &wdt1_ick, CK_343X), |
222 | CLK(NULL, "gpio1_ick", &gpio1_ick, CK_343X), | 222 | CLK(NULL, "gpio1_ick", &gpio1_ick, CK_343X), |
223 | CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_343X), | 223 | CLK(NULL, "omap_32ksync_ick", &omap_32ksync_ick, CK_343X), |
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 2f2ce7429f5b..1a4c699762e6 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c | |||
@@ -60,9 +60,8 @@ struct omap_wdt_dev { | |||
60 | void __iomem *base; /* physical */ | 60 | void __iomem *base; /* physical */ |
61 | struct device *dev; | 61 | struct device *dev; |
62 | int omap_wdt_users; | 62 | int omap_wdt_users; |
63 | struct clk *armwdt_ck; | 63 | struct clk *ick; |
64 | struct clk *mpu_wdt_ick; | 64 | struct clk *fck; |
65 | struct clk *mpu_wdt_fck; | ||
66 | struct resource *mem; | 65 | struct resource *mem; |
67 | struct miscdevice omap_wdt_miscdev; | 66 | struct miscdevice omap_wdt_miscdev; |
68 | }; | 67 | }; |
@@ -146,13 +145,9 @@ static int omap_wdt_open(struct inode *inode, struct file *file) | |||
146 | if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) | 145 | if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) |
147 | return -EBUSY; | 146 | return -EBUSY; |
148 | 147 | ||
149 | if (cpu_is_omap16xx()) | 148 | if (wdev->ick) |
150 | clk_enable(wdev->armwdt_ck); /* Enable the clock */ | 149 | clk_enable(wdev->ick); /* Enable the interface clock */ |
151 | 150 | clk_enable(wdev->fck); /* Enable the functional clock */ | |
152 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { | ||
153 | clk_enable(wdev->mpu_wdt_ick); /* Enable the interface clock */ | ||
154 | clk_enable(wdev->mpu_wdt_fck); /* Enable the functional clock */ | ||
155 | } | ||
156 | 151 | ||
157 | /* initialize prescaler */ | 152 | /* initialize prescaler */ |
158 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) | 153 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) |
@@ -181,13 +176,9 @@ static int omap_wdt_release(struct inode *inode, struct file *file) | |||
181 | 176 | ||
182 | omap_wdt_disable(wdev); | 177 | omap_wdt_disable(wdev); |
183 | 178 | ||
184 | if (cpu_is_omap16xx()) | 179 | if (wdev->ick) |
185 | clk_disable(wdev->armwdt_ck); /* Disable the clock */ | 180 | clk_disable(wdev->ick); |
186 | 181 | clk_disable(wdev->fck); | |
187 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { | ||
188 | clk_disable(wdev->mpu_wdt_ick); /* Disable the clock */ | ||
189 | clk_disable(wdev->mpu_wdt_fck); /* Disable the clock */ | ||
190 | } | ||
191 | #else | 182 | #else |
192 | printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); | 183 | printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); |
193 | #endif | 184 | #endif |
@@ -303,44 +294,21 @@ static int __init omap_wdt_probe(struct platform_device *pdev) | |||
303 | wdev->omap_wdt_users = 0; | 294 | wdev->omap_wdt_users = 0; |
304 | wdev->mem = mem; | 295 | wdev->mem = mem; |
305 | 296 | ||
306 | if (cpu_is_omap16xx()) { | 297 | if (cpu_is_omap24xx() || cpu_is_omap34xx()) { |
307 | wdev->armwdt_ck = clk_get(&pdev->dev, "armwdt_ck"); | 298 | wdev->ick = clk_get(&pdev->dev, "ick"); |
308 | if (IS_ERR(wdev->armwdt_ck)) { | 299 | if (IS_ERR(wdev->ick)) { |
309 | ret = PTR_ERR(wdev->armwdt_ck); | 300 | ret = PTR_ERR(wdev->ick); |
310 | wdev->armwdt_ck = NULL; | 301 | wdev->ick = NULL; |
311 | goto err_clk; | 302 | goto err_clk; |
312 | } | 303 | } |
313 | } | 304 | } |
314 | 305 | wdev->fck = clk_get(&pdev->dev, "fck"); | |
315 | if (cpu_is_omap24xx()) { | 306 | if (IS_ERR(wdev->fck)) { |
316 | wdev->mpu_wdt_ick = clk_get(&pdev->dev, "mpu_wdt_ick"); | 307 | ret = PTR_ERR(wdev->fck); |
317 | if (IS_ERR(wdev->mpu_wdt_ick)) { | 308 | wdev->fck = NULL; |
318 | ret = PTR_ERR(wdev->mpu_wdt_ick); | 309 | goto err_clk; |
319 | wdev->mpu_wdt_ick = NULL; | ||
320 | goto err_clk; | ||
321 | } | ||
322 | wdev->mpu_wdt_fck = clk_get(&pdev->dev, "mpu_wdt_fck"); | ||
323 | if (IS_ERR(wdev->mpu_wdt_fck)) { | ||
324 | ret = PTR_ERR(wdev->mpu_wdt_fck); | ||
325 | wdev->mpu_wdt_fck = NULL; | ||
326 | goto err_clk; | ||
327 | } | ||
328 | } | 310 | } |
329 | 311 | ||
330 | if (cpu_is_omap34xx()) { | ||
331 | wdev->mpu_wdt_ick = clk_get(&pdev->dev, "wdt2_ick"); | ||
332 | if (IS_ERR(wdev->mpu_wdt_ick)) { | ||
333 | ret = PTR_ERR(wdev->mpu_wdt_ick); | ||
334 | wdev->mpu_wdt_ick = NULL; | ||
335 | goto err_clk; | ||
336 | } | ||
337 | wdev->mpu_wdt_fck = clk_get(&pdev->dev, "wdt2_fck"); | ||
338 | if (IS_ERR(wdev->mpu_wdt_fck)) { | ||
339 | ret = PTR_ERR(wdev->mpu_wdt_fck); | ||
340 | wdev->mpu_wdt_fck = NULL; | ||
341 | goto err_clk; | ||
342 | } | ||
343 | } | ||
344 | wdev->base = ioremap(res->start, res->end - res->start + 1); | 312 | wdev->base = ioremap(res->start, res->end - res->start + 1); |
345 | if (!wdev->base) { | 313 | if (!wdev->base) { |
346 | ret = -ENOMEM; | 314 | ret = -ENOMEM; |
@@ -380,12 +348,10 @@ err_ioremap: | |||
380 | wdev->base = NULL; | 348 | wdev->base = NULL; |
381 | 349 | ||
382 | err_clk: | 350 | err_clk: |
383 | if (wdev->armwdt_ck) | 351 | if (wdev->ick) |
384 | clk_put(wdev->armwdt_ck); | 352 | clk_put(wdev->ick); |
385 | if (wdev->mpu_wdt_ick) | 353 | if (wdev->fck) |
386 | clk_put(wdev->mpu_wdt_ick); | 354 | clk_put(wdev->fck); |
387 | if (wdev->mpu_wdt_fck) | ||
388 | clk_put(wdev->mpu_wdt_fck); | ||
389 | kfree(wdev); | 355 | kfree(wdev); |
390 | 356 | ||
391 | err_kzalloc: | 357 | err_kzalloc: |
@@ -417,20 +383,11 @@ static int omap_wdt_remove(struct platform_device *pdev) | |||
417 | release_mem_region(res->start, res->end - res->start + 1); | 383 | release_mem_region(res->start, res->end - res->start + 1); |
418 | platform_set_drvdata(pdev, NULL); | 384 | platform_set_drvdata(pdev, NULL); |
419 | 385 | ||
420 | if (wdev->armwdt_ck) { | 386 | if (wdev->ick) { |
421 | clk_put(wdev->armwdt_ck); | 387 | clk_put(wdev->ick); |
422 | wdev->armwdt_ck = NULL; | ||
423 | } | 388 | } |
424 | 389 | ||
425 | if (wdev->mpu_wdt_ick) { | 390 | clk_put(wdev->fck); |
426 | clk_put(wdev->mpu_wdt_ick); | ||
427 | wdev->mpu_wdt_ick = NULL; | ||
428 | } | ||
429 | |||
430 | if (wdev->mpu_wdt_fck) { | ||
431 | clk_put(wdev->mpu_wdt_fck); | ||
432 | wdev->mpu_wdt_fck = NULL; | ||
433 | } | ||
434 | iounmap(wdev->base); | 391 | iounmap(wdev->base); |
435 | 392 | ||
436 | kfree(wdev); | 393 | kfree(wdev); |