diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2010-05-06 06:14:17 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2010-05-06 15:17:20 -0400 |
commit | af7dc2281fd3cedc04cb51bcc0887cdaf65c3fcc (patch) | |
tree | 5bd51ed12452e283806827e1793415ba6011b757 /arch/arm/plat-nomadik | |
parent | dc6048c7f97beaf8c5bb97ed772f43330d04727a (diff) |
ARM: 6104/1: nomadik-gpio: use clk API
Add clocks with appropriate names in platforms that use it, and use the
clk API in nomadik-gpio.
Acked-by: Alessandro Rubini <rubini@unipv.it>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Srinidhi Kasagar <srinidhi.kasagar@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-nomadik')
-rw-r--r-- | arch/arm/plat-nomadik/gpio.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c index eac9c9a7fbf9..d28900cfa541 100644 --- a/arch/arm/plat-nomadik/gpio.c +++ b/arch/arm/plat-nomadik/gpio.c | |||
@@ -15,6 +15,8 @@ | |||
15 | #include <linux/device.h> | 15 | #include <linux/device.h> |
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/io.h> | 17 | #include <linux/io.h> |
18 | #include <linux/clk.h> | ||
19 | #include <linux/err.h> | ||
18 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
19 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
20 | #include <linux/interrupt.h> | 22 | #include <linux/interrupt.h> |
@@ -35,6 +37,7 @@ | |||
35 | struct nmk_gpio_chip { | 37 | struct nmk_gpio_chip { |
36 | struct gpio_chip chip; | 38 | struct gpio_chip chip; |
37 | void __iomem *addr; | 39 | void __iomem *addr; |
40 | struct clk *clk; | ||
38 | unsigned int parent_irq; | 41 | unsigned int parent_irq; |
39 | spinlock_t lock; | 42 | spinlock_t lock; |
40 | /* Keep track of configured edges */ | 43 | /* Keep track of configured edges */ |
@@ -310,6 +313,7 @@ static int __init nmk_gpio_probe(struct platform_device *dev) | |||
310 | struct nmk_gpio_chip *nmk_chip; | 313 | struct nmk_gpio_chip *nmk_chip; |
311 | struct gpio_chip *chip; | 314 | struct gpio_chip *chip; |
312 | struct resource *res; | 315 | struct resource *res; |
316 | struct clk *clk; | ||
313 | int irq; | 317 | int irq; |
314 | int ret; | 318 | int ret; |
315 | 319 | ||
@@ -334,15 +338,24 @@ static int __init nmk_gpio_probe(struct platform_device *dev) | |||
334 | goto out; | 338 | goto out; |
335 | } | 339 | } |
336 | 340 | ||
341 | clk = clk_get(&dev->dev, NULL); | ||
342 | if (IS_ERR(clk)) { | ||
343 | ret = PTR_ERR(clk); | ||
344 | goto out_release; | ||
345 | } | ||
346 | |||
347 | clk_enable(clk); | ||
348 | |||
337 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); | 349 | nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); |
338 | if (!nmk_chip) { | 350 | if (!nmk_chip) { |
339 | ret = -ENOMEM; | 351 | ret = -ENOMEM; |
340 | goto out_release; | 352 | goto out_clk; |
341 | } | 353 | } |
342 | /* | 354 | /* |
343 | * The virt address in nmk_chip->addr is in the nomadik register space, | 355 | * The virt address in nmk_chip->addr is in the nomadik register space, |
344 | * so we can simply convert the resource address, without remapping | 356 | * so we can simply convert the resource address, without remapping |
345 | */ | 357 | */ |
358 | nmk_chip->clk = clk; | ||
346 | nmk_chip->addr = io_p2v(res->start); | 359 | nmk_chip->addr = io_p2v(res->start); |
347 | nmk_chip->chip = nmk_gpio_template; | 360 | nmk_chip->chip = nmk_gpio_template; |
348 | nmk_chip->parent_irq = irq; | 361 | nmk_chip->parent_irq = irq; |
@@ -368,6 +381,9 @@ static int __init nmk_gpio_probe(struct platform_device *dev) | |||
368 | 381 | ||
369 | out_free: | 382 | out_free: |
370 | kfree(nmk_chip); | 383 | kfree(nmk_chip); |
384 | out_clk: | ||
385 | clk_disable(clk); | ||
386 | clk_put(clk); | ||
371 | out_release: | 387 | out_release: |
372 | release_mem_region(res->start, resource_size(res)); | 388 | release_mem_region(res->start, resource_size(res)); |
373 | out: | 389 | out: |
@@ -385,6 +401,8 @@ static int __exit nmk_gpio_remove(struct platform_device *dev) | |||
385 | 401 | ||
386 | nmk_chip = platform_get_drvdata(dev); | 402 | nmk_chip = platform_get_drvdata(dev); |
387 | gpiochip_remove(&nmk_chip->chip); | 403 | gpiochip_remove(&nmk_chip->chip); |
404 | clk_disable(nmk_chip->clk); | ||
405 | clk_put(nmk_chip->clk); | ||
388 | kfree(nmk_chip); | 406 | kfree(nmk_chip); |
389 | release_mem_region(res->start, resource_size(res)); | 407 | release_mem_region(res->start, resource_size(res)); |
390 | return 0; | 408 | return 0; |