]> Pileus Git - ~andy/linux/blobdiff - drivers/gpio/gpio-mpc8xxx.c
[media] s5h1409: convert set_fontend to use DVBv5 parameters
[~andy/linux] / drivers / gpio / gpio-mpc8xxx.c
index d74d19bf3af56b30cecc986d860674c92f076a7b..5cd04b65c55610f1e015f25738f7c9f3b2649df7 100644 (file)
@@ -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);
@@ -146,6 +155,7 @@ static int mpc8xxx_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
 static void mpc8xxx_gpio_irq_cascade(unsigned int irq, struct irq_desc *desc)
 {
        struct mpc8xxx_gpio_chip *mpc8xxx_gc = irq_desc_get_handler_data(desc);
+       struct irq_chip *chip = irq_desc_get_chip(desc);
        struct of_mm_gpio_chip *mm = &mpc8xxx_gc->mm_gc;
        unsigned int mask;
 
@@ -153,6 +163,7 @@ static void mpc8xxx_gpio_irq_cascade(unsigned int irq, struct irq_desc *desc)
        if (mask)
                generic_handle_irq(irq_linear_revmap(mpc8xxx_gc->irq,
                                                     32 - ffs(mask)));
+       chip->irq_eoi(&desc->irq_data);
 }
 
 static void mpc8xxx_irq_unmask(struct irq_data *d)
@@ -338,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;