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>
This commit is contained in:
committed by
Russell King
parent
dc6048c7f9
commit
af7dc2281f
@ -15,6 +15,8 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/clk.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/gpio.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/interrupt.h>
|
||||
@ -35,6 +37,7 @@
|
||||
struct nmk_gpio_chip {
|
||||
struct gpio_chip chip;
|
||||
void __iomem *addr;
|
||||
struct clk *clk;
|
||||
unsigned int parent_irq;
|
||||
spinlock_t lock;
|
||||
/* Keep track of configured edges */
|
||||
@ -310,6 +313,7 @@ static int __init nmk_gpio_probe(struct platform_device *dev)
|
||||
struct nmk_gpio_chip *nmk_chip;
|
||||
struct gpio_chip *chip;
|
||||
struct resource *res;
|
||||
struct clk *clk;
|
||||
int irq;
|
||||
int ret;
|
||||
|
||||
@ -334,15 +338,24 @@ static int __init nmk_gpio_probe(struct platform_device *dev)
|
||||
goto out;
|
||||
}
|
||||
|
||||
clk = clk_get(&dev->dev, NULL);
|
||||
if (IS_ERR(clk)) {
|
||||
ret = PTR_ERR(clk);
|
||||
goto out_release;
|
||||
}
|
||||
|
||||
clk_enable(clk);
|
||||
|
||||
nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL);
|
||||
if (!nmk_chip) {
|
||||
ret = -ENOMEM;
|
||||
goto out_release;
|
||||
goto out_clk;
|
||||
}
|
||||
/*
|
||||
* The virt address in nmk_chip->addr is in the nomadik register space,
|
||||
* so we can simply convert the resource address, without remapping
|
||||
*/
|
||||
nmk_chip->clk = clk;
|
||||
nmk_chip->addr = io_p2v(res->start);
|
||||
nmk_chip->chip = nmk_gpio_template;
|
||||
nmk_chip->parent_irq = irq;
|
||||
@ -368,6 +381,9 @@ static int __init nmk_gpio_probe(struct platform_device *dev)
|
||||
|
||||
out_free:
|
||||
kfree(nmk_chip);
|
||||
out_clk:
|
||||
clk_disable(clk);
|
||||
clk_put(clk);
|
||||
out_release:
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
out:
|
||||
@ -385,6 +401,8 @@ static int __exit nmk_gpio_remove(struct platform_device *dev)
|
||||
|
||||
nmk_chip = platform_get_drvdata(dev);
|
||||
gpiochip_remove(&nmk_chip->chip);
|
||||
clk_disable(nmk_chip->clk);
|
||||
clk_put(nmk_chip->clk);
|
||||
kfree(nmk_chip);
|
||||
release_mem_region(res->start, resource_size(res));
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user