Commit 8d91771c authored by Linus Walleij's avatar Linus Walleij

gpio/nomadik: use ioremap() instead of static mappings

We were using a custom io_p2v() (physical-to-virtual) translation
macro, but it's fully possible to just ioremap() this memory
now, so skip use of static addresses altogether.
Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
parent ebc6178d
...@@ -28,8 +28,6 @@ ...@@ -28,8 +28,6 @@
#include <plat/pincfg.h> #include <plat/pincfg.h>
#include <plat/gpio-nomadik.h> #include <plat/gpio-nomadik.h>
#include <mach/hardware.h>
#include <asm/gpio.h>
/* /*
* The GPIO module in the Nomadik family of Systems-on-Chip is an * The GPIO module in the Nomadik family of Systems-on-Chip is an
...@@ -1139,6 +1137,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) ...@@ -1139,6 +1137,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
struct resource *res; struct resource *res;
struct clk *clk; struct clk *clk;
int secondary_irq; int secondary_irq;
void __iomem *base;
int irq; int irq;
int ret; int ret;
...@@ -1169,10 +1168,16 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) ...@@ -1169,10 +1168,16 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
goto out; goto out;
} }
base = ioremap(res->start, resource_size(res));
if (!base) {
ret = -ENOMEM;
goto out_release;
}
clk = clk_get(&dev->dev, NULL); clk = clk_get(&dev->dev, NULL);
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
ret = PTR_ERR(clk); ret = PTR_ERR(clk);
goto out_release; goto out_unmap;
} }
nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL); nmk_chip = kzalloc(sizeof(*nmk_chip), GFP_KERNEL);
...@@ -1186,7 +1191,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) ...@@ -1186,7 +1191,7 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
*/ */
nmk_chip->bank = dev->id; nmk_chip->bank = dev->id;
nmk_chip->clk = clk; nmk_chip->clk = clk;
nmk_chip->addr = io_p2v(res->start); nmk_chip->addr = base;
nmk_chip->chip = nmk_gpio_template; nmk_chip->chip = nmk_gpio_template;
nmk_chip->parent_irq = irq; nmk_chip->parent_irq = irq;
nmk_chip->secondary_parent_irq = secondary_irq; nmk_chip->secondary_parent_irq = secondary_irq;
...@@ -1226,6 +1231,8 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) ...@@ -1226,6 +1231,8 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
out_clk: out_clk:
clk_disable(clk); clk_disable(clk);
clk_put(clk); clk_put(clk);
out_unmap:
iounmap(base);
out_release: out_release:
release_mem_region(res->start, resource_size(res)); release_mem_region(res->start, resource_size(res));
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment