Lines Matching +full:gpio +full:- +full:mux +full:- +full:clock

2  * linux/arch/arm/mach-at91/gpio.c
14 #include <linux/gpio.h>
31 struct at91_gpio_chip *next; /* Bank sharing same clock */
34 struct clk *clock; /* associated clock */ member
86 /*--------------------------------------------------------------------------*/
103 * mux the pin to the "GPIO" peripheral role.
111 return -EINVAL; in at91_set_GPIO_periph()
121 * mux the pin to the "A" internal peripheral role.
129 return -EINVAL; in at91_set_A_periph()
141 * mux the pin to the "B" internal peripheral role.
149 return -EINVAL; in at91_set_B_periph()
161 * mux the pin to the gpio controller (instead of "A" or "B" peripheral), and
170 return -EINVAL; in at91_set_gpio_input()
182 * mux the pin to the gpio controller (instead of "A" or "B" peripheral),
191 return -EINVAL; in at91_set_gpio_output()
212 return -EINVAL; in at91_set_deglitch()
219 * enable/disable the multi-driver; This is only valid for output and
228 return -EINVAL; in at91_set_multi_drive()
236 * assuming the pin is muxed as a gpio output, set its value.
244 return -EINVAL; in at91_set_gpio_value()
252 * read the pin's value (works even if it's not muxed as a gpio).
261 return -EINVAL; in at91_get_gpio_value()
267 /*--------------------------------------------------------------------------*/
276 unsigned pin = irq_to_gpio(d->irq); in gpio_irq_set_wake()
281 return -EINVAL; in gpio_irq_set_wake()
305 clk_disable(gpio_chip[i].clock); in at91_gpio_suspend()
308 printk(KERN_DEBUG "GPIO-%c may wake for %08x\n", 'A'+i, wakeups[i]); in at91_gpio_suspend()
322 clk_enable(gpio_chip[i].clock); in at91_gpio_resume()
334 /* Several AIC controller irqs are dispatched through this GPIO handler.
347 unsigned pin = irq_to_gpio(d->irq); in gpio_irq_mask()
357 unsigned pin = irq_to_gpio(d->irq); in gpio_irq_unmask()
372 return -EINVAL; in gpio_irq_type()
377 .name = "GPIO",
391 void __iomem *pio = at91_gpio->regbase; in gpio_irq_handler()
395 chip->irq_ack(idata); in gpio_irq_handler()
397 /* Reading ISR acks pending (edge triggered) GPIO interrupts. in gpio_irq_handler()
403 if (!at91_gpio->next) in gpio_irq_handler()
405 at91_gpio = at91_gpio->next; in gpio_irq_handler()
406 pio = at91_gpio->regbase; in gpio_irq_handler()
410 irq_pin = gpio_to_irq(at91_gpio->chip.base); in gpio_irq_handler()
419 chip->irq_unmask(idata); in gpio_irq_handler()
420 /* now it may re-trigger */ in gpio_irq_handler()
423 /*--------------------------------------------------------------------------*/
448 seq_printf(s, "GPIO:%s", __raw_readl(pio + PIO_PDSR) & mask ? "1" : "0"); in at91_gpio_show()
483 /*--------------------------------------------------------------------------*/
486 * This lock class tells lockdep that GPIO irqs are in a different
492 * Called from the processor-specific init to enable GPIO interrupt support.
502 unsigned id = this->id; in at91_gpio_irq_setup()
505 __raw_writel(~0, this->regbase + PIO_IDR); in at91_gpio_irq_setup()
507 for (i = 0, irq = gpio_to_irq(this->chip.base); i < 32; in at91_gpio_irq_setup()
524 if (prev && prev->next == this) in at91_gpio_irq_setup()
530 pr_info("AT91: %d gpio irqs in %d banks\n", irq - gpio_to_irq(0), gpio_banks); in at91_gpio_irq_setup()
538 void __iomem *pio = at91_gpio->regbase; in at91_gpiolib_direction_input()
549 void __iomem *pio = at91_gpio->regbase; in at91_gpiolib_direction_output()
560 void __iomem *pio = at91_gpio->regbase; in at91_gpiolib_get()
571 void __iomem *pio = at91_gpio->regbase; in at91_gpiolib_set()
581 for (i = 0; i < chip->ngpio; i++) { in at91_gpiolib_dbg_show()
582 unsigned pin = chip->base + i; in at91_gpiolib_dbg_show()
589 seq_printf(s, "[%s] GPIO%s%d: ", in at91_gpiolib_dbg_show()
590 gpio_label, chip->label, i); in at91_gpiolib_dbg_show()
592 seq_printf(s, "[gpio] %s\n", in at91_gpiolib_dbg_show()
604 * Called from the processor-specific init to enable GPIO pin support.
618 at91_gpio->id = data[i].id; in at91_gpio_init()
619 at91_gpio->chip.base = i * 32; in at91_gpio_init()
621 at91_gpio->regbase = ioremap(data[i].regbase, 512); in at91_gpio_init()
622 if (!at91_gpio->regbase) { in at91_gpio_init()
627 at91_gpio->clock = clk_get_sys(NULL, at91_gpio->chip.label); in at91_gpio_init()
628 if (!at91_gpio->clock) { in at91_gpio_init()
629 pr_err("at91_gpio.%d, failed to get clock, ignoring.\n", i); in at91_gpio_init()
633 /* enable PIO controller's clock */ in at91_gpio_init()
634 clk_enable(at91_gpio->clock); in at91_gpio_init()
637 if (last && last->id == at91_gpio->id) in at91_gpio_init()
638 last->next = at91_gpio; in at91_gpio_init()
641 gpiochip_add(&at91_gpio->chip); in at91_gpio_init()