aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@linaro.org>2013-02-17 06:42:51 -0500
committerLinus Walleij <linus.walleij@linaro.org>2013-03-06 23:27:30 -0500
commit39b70ee05199f9bea50641df104aee4dbd913d1d (patch)
treec72950eecf18b62a3bd5af13fdd8ceadfdad1ade /drivers/gpio
parent51e13c2475913d45a3ec546dee647538a9341d6a (diff)
gpio: pl061: bind pinctrl by gpio request
Add the pl061_gpio_request() to request pinctrl. Create the logic between pl061 gpio driver and pinctrl (pinctrl-single) driver. While a gpio pin is requested, it will request pinctrl driver to set that pin with gpio function mode. So pinctrl driver should append .gpio_request_enable() in pinmux_ops. Signed-off-by: Haojian Zhuang <haojian.zhuang@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpio-pl061.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/gpio/gpio-pl061.c b/drivers/gpio/gpio-pl061.c
index d1d603585a93..06ed257c5d31 100644
--- a/drivers/gpio/gpio-pl061.c
+++ b/drivers/gpio/gpio-pl061.c
@@ -23,6 +23,7 @@
23#include <linux/amba/bus.h> 23#include <linux/amba/bus.h>
24#include <linux/amba/pl061.h> 24#include <linux/amba/pl061.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/pinctrl/consumer.h>
26#include <linux/pm.h> 27#include <linux/pm.h>
27#include <asm/mach/irq.h> 28#include <asm/mach/irq.h>
28 29
@@ -60,6 +61,17 @@ struct pl061_gpio {
60#endif 61#endif
61}; 62};
62 63
64static int pl061_gpio_request(struct gpio_chip *chip, unsigned offset)
65{
66 /*
67 * Map back to global GPIO space and request muxing, the direction
68 * parameter does not matter for this controller.
69 */
70 int gpio = chip->base + offset;
71
72 return pinctrl_request_gpio(gpio);
73}
74
63static int pl061_direction_input(struct gpio_chip *gc, unsigned offset) 75static int pl061_direction_input(struct gpio_chip *gc, unsigned offset)
64{ 76{
65 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc); 77 struct pl061_gpio *chip = container_of(gc, struct pl061_gpio, gc);
@@ -274,6 +286,7 @@ static int pl061_probe(struct amba_device *adev, const struct amba_id *id)
274 286
275 spin_lock_init(&chip->lock); 287 spin_lock_init(&chip->lock);
276 288
289 chip->gc.request = pl061_gpio_request;
277 chip->gc.direction_input = pl061_direction_input; 290 chip->gc.direction_input = pl061_direction_input;
278 chip->gc.direction_output = pl061_direction_output; 291 chip->gc.direction_output = pl061_direction_output;
279 chip->gc.get = pl061_get_value; 292 chip->gc.get = pl061_get_value;