Message ID | 5D23E7CAADD3BE4A97642792FFC691C561C7A520@MBX215.d.ethz.ch |
---|---|
State | New |
Headers | show |
Series | [01/22] Xilinx: ARM: GPIO: updated driver names for cleanup | expand |
On Sat, Jul 21, 2018 at 4:28 PM Hedges Alexander <ahedges@student.ethz.ch> wrote: > From: Iban Rodriguez <irodriguez@cemitec.com> > Date: Fri, 13 May 2016 12:11:46 +0200 > > Add function to set multiple GPIO of the same chip at the same time > and register it. > > Signed-off-by: Iban Rodriguez <irodriguez@cemitec.com> > Signed-off-by: Michal Simek <michal.simek@xilinx.com> > Signed-off-by: Alexander Hedges <ahedges@ethz.ch> > (cherry picked from commit 63bcc8b82965b185e632170dca04185539d970f9) Instead of this I think it is better to switch the whole driver over to just use GPIO_GENERIC, see for example how we implement drivers/gpio/gpio-ftgpio010.c. If you select GPIO_GENERIC and use bgpio_init() to set up the affected registers, the GPIO_GENERIC code will implement and supply get/set_multiple() callbacks that are widely tested and deployed with other platforms already. Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-gpio" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index 8e5d7440dbf0..fd14ea4ea19e 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -130,6 +130,7 @@ static void xgpio_set(struct gpio_chip *gc, unsigned int gpio, int val) * @bits: Value to be wrote on each GPIO * * This function writes the specified values into the specified signals of the +IO at once * GPIO devices. */ static void xgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, @@ -137,7 +138,9 @@ static void xgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, { unsigned long flags; struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc); - struct xgpio_instance *chip = gpiochip_get_data(gc); + struct xgpio_instance *chip = + container_of(mm_gc, struct xgpio_instance, mmchip); + void __iomem *regs = mm_gc->regs; int i; spin_lock_irqsave(&chip->gpio_lock, flags); @@ -154,7 +157,7 @@ static void xgpio_set_multiple(struct gpio_chip *gc, unsigned long *mask, } } - xgpio_writereg(mm_gc->regs + XGPIO_DATA_OFFSET, + xgpio_writereg(regs + chip->offset + XGPIO_DATA_OFFSET, chip->gpio_state); spin_unlock_irqrestore(&chip->gpio_lock, flags); @@ -586,6 +589,7 @@ static int xgpio_of_probe(struct platform_device *pdev) chip->mmchip.gc.direction_output = xgpio_dir_out; chip->mmchip.gc.get = xgpio_get; chip->mmchip.gc.set = xgpio_set; + chip->mmchip.gc.set_multiple = xgpio_set_multiple; chip->mmchip.save_regs = xgpio_save_regs;