|
@@ -83,6 +83,33 @@ static void qe_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
|
|
spin_unlock_irqrestore(&qe_gc->lock, flags);
|
|
spin_unlock_irqrestore(&qe_gc->lock, flags);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void qe_gpio_set_multiple(struct gpio_chip *gc,
|
|
|
|
+ unsigned long *mask, unsigned long *bits)
|
|
|
|
+{
|
|
|
|
+ struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
|
|
|
|
+ struct qe_gpio_chip *qe_gc = gpiochip_get_data(gc);
|
|
|
|
+ struct qe_pio_regs __iomem *regs = mm_gc->regs;
|
|
|
|
+ unsigned long flags;
|
|
|
|
+ int i;
|
|
|
|
+
|
|
|
|
+ spin_lock_irqsave(&qe_gc->lock, flags);
|
|
|
|
+
|
|
|
|
+ for (i = 0; i < gc->ngpio; i++) {
|
|
|
|
+ if (*mask == 0)
|
|
|
|
+ break;
|
|
|
|
+ if (__test_and_clear_bit(i, mask)) {
|
|
|
|
+ if (test_bit(i, bits))
|
|
|
|
+ qe_gc->cpdata |= (1U << (QE_PIO_PINS - 1 - i));
|
|
|
|
+ else
|
|
|
|
+ qe_gc->cpdata &= ~(1U << (QE_PIO_PINS - 1 - i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ out_be32(®s->cpdata, qe_gc->cpdata);
|
|
|
|
+
|
|
|
|
+ spin_unlock_irqrestore(&qe_gc->lock, flags);
|
|
|
|
+}
|
|
|
|
+
|
|
static int qe_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
|
|
static int qe_gpio_dir_in(struct gpio_chip *gc, unsigned int gpio)
|
|
{
|
|
{
|
|
struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
|
|
struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
|
|
@@ -298,6 +325,7 @@ static int __init qe_add_gpiochips(void)
|
|
gc->direction_output = qe_gpio_dir_out;
|
|
gc->direction_output = qe_gpio_dir_out;
|
|
gc->get = qe_gpio_get;
|
|
gc->get = qe_gpio_get;
|
|
gc->set = qe_gpio_set;
|
|
gc->set = qe_gpio_set;
|
|
|
|
+ gc->set_multiple = qe_gpio_set_multiple;
|
|
|
|
|
|
ret = of_mm_gpiochip_add_data(np, mm_gc, qe_gc);
|
|
ret = of_mm_gpiochip_add_data(np, mm_gc, qe_gc);
|
|
if (ret)
|
|
if (ret)
|