aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio/gpio-mpc8xxx.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-12-16 11:13:49 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2011-12-16 11:13:49 -0800
commit1c5ff0f54dc7f821f3d88b2ddbe0ec623b3317c2 (patch)
tree0cc2720f7f52de4c6e29553368845400cdafbe8a /drivers/gpio/gpio-mpc8xxx.c
parent3f5fcf60e912a79721cbbd63704a03bbfb92eac2 (diff)
parent87b9b0e0d50db3282fb1eb702307ccfca8775744 (diff)
downloadlinux-stericsson-1c5ff0f54dc7f821f3d88b2ddbe0ec623b3317c2.tar.gz
Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6
* 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6: gpio: Fix DA9052 GPIO build errors. gpio: mpc8xxx: don't allow input-only pins to be output for MPC5121 gpio-ml-ioh: Add the irq_disable/irq_enable hooks for ml-ioh irq chip gpio-ml-ioh: fix a bug in the interrupt handler gpio: pl061: drop extra check for NULL platform_data
Diffstat (limited to 'drivers/gpio/gpio-mpc8xxx.c')
-rw-r--r--drivers/gpio/gpio-mpc8xxx.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index ec3fcf0a7e12..5cd04b65c556 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -132,6 +132,15 @@ static int mpc8xxx_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val
return 0;
}
+static int mpc5121_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
+{
+ /* GPIO 28..31 are input only on MPC5121 */
+ if (gpio >= 28)
+ return -EINVAL;
+
+ return mpc8xxx_gpio_dir_out(gc, gpio, val);
+}
+
static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
{
struct of_mm_gpio_chip *mm = to_of_mm_gpio_chip(gc);
@@ -340,11 +349,10 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
mm_gc->save_regs = mpc8xxx_gpio_save_regs;
gc->ngpio = MPC8XXX_GPIO_PINS;
gc->direction_input = mpc8xxx_gpio_dir_in;
- gc->direction_output = mpc8xxx_gpio_dir_out;
- if (of_device_is_compatible(np, "fsl,mpc8572-gpio"))
- gc->get = mpc8572_gpio_get;
- else
- gc->get = mpc8xxx_gpio_get;
+ gc->direction_output = of_device_is_compatible(np, "fsl,mpc5121-gpio") ?
+ mpc5121_gpio_dir_out : mpc8xxx_gpio_dir_out;
+ gc->get = of_device_is_compatible(np, "fsl,mpc8572-gpio") ?
+ mpc8572_gpio_get : mpc8xxx_gpio_get;
gc->set = mpc8xxx_gpio_set;
gc->to_irq = mpc8xxx_gpio_to_irq;