static int pmc_irq_map(struct irq_domain *h, unsigned int virq, irq_hw_number_t hw) { struct at91_pmc *pmc = h->host_data; irq_set_lockdep_class(virq, &pmc_lock_class); irq_set_chip_and_handler(virq, &pmc_irq, handle_level_irq); irq_set_chip_data(virq, pmc); return 0; }
/* * Called from the processor-specific init to enable GPIO interrupt support. */ void __init at91_gpio_irq_setup(void) { unsigned pioc; int gpio_irqnbr = 0; struct at91_gpio_chip *this, *prev; /* Setup proper .irq_set_type function */ if (has_pio3()) gpio_irqchip.irq_set_type = alt_gpio_irq_type; else gpio_irqchip.irq_set_type = gpio_irq_type; for (pioc = 0, this = gpio_chip, prev = NULL; pioc++ < gpio_banks; prev = this, this++) { int offset; __raw_writel(~0, this->regbase + PIO_IDR); /* setup irq domain for this GPIO controller */ at91_gpio_irqdomain(this); for (offset = 0; offset < this->chip.ngpio; offset++) { unsigned int virq = irq_find_mapping(this->domain, offset); irq_set_lockdep_class(virq, &gpio_lock_class); /* * Can use the "simple" and not "edge" handler since it's * shorter, and the AIC handles interrupts sanely. */ irq_set_chip_and_handler(virq, &gpio_irqchip, handle_simple_irq); set_irq_flags(virq, IRQF_VALID); irq_set_chip_data(virq, this); gpio_irqnbr++; } /* The toplevel handler handles one bank of GPIOs, except * on some SoC it can handles up to three... * We only set up the handler for the first of the list. */ if (prev && prev->next == this) continue; this->pioc_virq = irq_create_mapping(NULL, this->pioc_hwirq); irq_set_chip_data(this->pioc_virq, this); irq_set_chained_handler(this->pioc_virq, gpio_irq_handler); } pr_info("AT91: %d gpio irqs in %d banks\n", gpio_irqnbr, gpio_banks); }
static int intc_irqpin_irq_domain_map(struct irq_domain *h, unsigned int virq, irq_hw_number_t hw) { struct intc_irqpin_priv *p = h->host_data; p->irq[hw].domain_irq = virq; p->irq[hw].hw_irq = hw; intc_irqpin_dbg(&p->irq[hw], "map"); irq_set_chip_data(virq, h->host_data); irq_set_lockdep_class(virq, &intc_irqpin_irq_lock_class); irq_set_chip_and_handler(virq, &p->irq_chip, handle_level_irq); return 0; }
/* * Called from the processor-specific init to enable GPIO interrupt support. */ void __init at91_gpio_irq_setup(void) { unsigned pioc, pin; struct at91_gpio_chip *this, *prev; for (pioc = 0, pin = PIN_BASE, this = gpio_chip, prev = NULL; pioc++ < gpio_banks; prev = this, this++) { unsigned id = this->bank->id; unsigned i; __raw_writel(~0, this->regbase + PIO_IDR); for (i = 0, pin = this->chip.base; i < 32; i++, pin++) { irq_set_lockdep_class(pin, &gpio_lock_class); /* * Can use the "simple" and not "edge" handler since it's * shorter, and the AIC handles interrupts sanely. */ irq_set_chip_and_handler(pin, &gpio_irqchip, handle_simple_irq); set_irq_flags(pin, IRQF_VALID); } /* The toplevel handler handles one bank of GPIOs, except * AT91SAM9263_ID_PIOCDE handles three... PIOC is first in * the list, so we only set up that handler. */ if (prev && prev->next == this) continue; irq_set_chip_data(id, this); irq_set_chained_handler(id, gpio_irq_handler); } pr_info("AT91: %d gpio irqs in %d banks\n", pin - PIN_BASE, gpio_banks); }
void __init rk30_gpio_init(void) { unsigned int i, j, pin, irqs = 0; struct rk30_gpio_bank *bank; struct seq_file s; struct gpio_chip chip; bank = rk30_gpio_banks; for (i = 0; i < ARRAY_SIZE(rk30_gpio_banks); i++, bank++) { spin_lock_init(&bank->lock); bank->clk = clk_get(NULL, bank->chip.label); clk_enable(bank->clk); gpiochip_add(&bank->chip); __raw_writel(0, bank->regbase + GPIO_INTEN); pin = bank->chip.base; for (j = 0; j < 32; j++) { unsigned int irq = gpio_to_irq(pin); if (pin > MAX_PIN) break; irq_set_lockdep_class(irq, &gpio_lock_class); irq_set_chip_data(irq, bank); irq_set_chip_and_handler(irq, &rk30_gpio_irq_chip, handle_level_irq); set_irq_flags(irq, IRQF_VALID); pin++; irqs++; } irq_set_handler_data(bank->irq, bank); irq_set_chained_handler(bank->irq, rk30_gpio_irq_handler); } printk("%s: %d gpio irqs in %d banks\n", __func__, irqs, ARRAY_SIZE(rk30_gpio_banks)); // Dump the GPIO registers rk30_gpiolib_dbg_show(&s, &chip); }