Lines Matching +full:num +full:- +full:irqs
1 // SPDX-License-Identifier: GPL-2.0
3 * linux/arch/arm/mach-sa1100/neponset.c
7 #include <linux/gpio/gpio-reg.h>
20 #include <asm/mach-types.h>
28 #include <mach/irqs.h>
85 .dev_id = "sa11x0-uart.1",
87 GPIO_LOOKUP("neponset-mdm-ctl0", 2, "rts", GPIO_ACTIVE_LOW),
88 GPIO_LOOKUP("neponset-mdm-ctl0", 3, "dtr", GPIO_ACTIVE_LOW),
89 GPIO_LOOKUP("neponset-mdm-ctl1", 3, "cts", GPIO_ACTIVE_LOW),
90 GPIO_LOOKUP("neponset-mdm-ctl1", 4, "dsr", GPIO_ACTIVE_LOW),
91 GPIO_LOOKUP("neponset-mdm-ctl1", 5, "dcd", GPIO_ACTIVE_LOW),
97 .dev_id = "sa11x0-uart.3",
99 GPIO_LOOKUP("neponset-mdm-ctl0", 0, "rts", GPIO_ACTIVE_LOW),
100 GPIO_LOOKUP("neponset-mdm-ctl0", 1, "dtr", GPIO_ACTIVE_LOW),
101 GPIO_LOOKUP("neponset-mdm-ctl1", 0, "cts", GPIO_ACTIVE_LOW),
102 GPIO_LOOKUP("neponset-mdm-ctl1", 1, "dsr", GPIO_ACTIVE_LOW),
103 GPIO_LOOKUP("neponset-mdm-ctl1", 2, "dcd", GPIO_ACTIVE_LOW),
113 GPIO_LOOKUP("neponset-ncr", 5, "a0vpp", GPIO_ACTIVE_HIGH),
114 GPIO_LOOKUP("neponset-ncr", 6, "a1vpp", GPIO_ACTIVE_HIGH),
129 n->gpio[0]->set_multiple(n->gpio[0], &m, &v); in neponset_ncr_frob()
137 * since the ETHERNET and USAR IRQs are level based, and we need to
150 desc->irq_data.chip->irq_ack(&desc->irq_data); in neponset_irq_handler()
157 irr = readb_relaxed(d->base + IRR); in neponset_irq_handler()
166 * recheck the register for any pending IRQs. in neponset_irq_handler()
169 desc->irq_data.chip->irq_mask(&desc->irq_data); in neponset_irq_handler()
172 * Ack the interrupt now to prevent re-entering in neponset_irq_handler()
177 desc->irq_data.chip->irq_ack(&desc->irq_data); in neponset_irq_handler()
180 generic_handle_irq(d->irq_base + NEP_IRQ_SMC91X); in neponset_irq_handler()
183 generic_handle_irq(d->irq_base + NEP_IRQ_USAR); in neponset_irq_handler()
185 desc->irq_data.chip->irq_unmask(&desc->irq_data); in neponset_irq_handler()
189 generic_handle_irq(d->irq_base + NEP_IRQ_SA1111); in neponset_irq_handler()
207 unsigned num, bool in, const char *const * names) in neponset_init_gpio() argument
211 gc = gpio_reg_init(dev, reg, -1, num, label, in ? 0xffffffff : 0, in neponset_init_gpio()
234 .parent = &dev->dev, in neponset_probe()
245 0x02000000, "smc91x-regs"), in neponset_probe()
247 0x02000000, "smc91x-attrib"), in neponset_probe()
254 .parent = &dev->dev, in neponset_probe()
265 return -EBUSY; in neponset_probe()
275 ret = -ENXIO; in neponset_probe()
281 ret = -ENOMEM; in neponset_probe()
285 d->base = ioremap(nep_res->start, SZ_4K); in neponset_probe()
286 if (!d->base) { in neponset_probe()
287 ret = -ENOMEM; in neponset_probe()
291 if (readb_relaxed(d->base + WHOAMI) != 0x11) { in neponset_probe()
292 dev_warn(&dev->dev, "Neponset board detected, but wrong ID: %02x\n", in neponset_probe()
293 readb_relaxed(d->base + WHOAMI)); in neponset_probe()
294 ret = -ENODEV; in neponset_probe()
298 ret = irq_alloc_descs(-1, IRQ_BOARD_START, NEP_IRQ_NR, -1); in neponset_probe()
300 dev_err(&dev->dev, "unable to allocate %u irqs: %d\n", in neponset_probe()
303 ret = -ENOMEM; in neponset_probe()
307 d->irq_base = ret; in neponset_probe()
309 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_SMC91X, &nochip, in neponset_probe()
311 irq_clear_status_flags(d->irq_base + NEP_IRQ_SMC91X, IRQ_NOREQUEST | IRQ_NOPROBE); in neponset_probe()
312 irq_set_chip_and_handler(d->irq_base + NEP_IRQ_USAR, &nochip, in neponset_probe()
314 irq_clear_status_flags(d->irq_base + NEP_IRQ_USAR, IRQ_NOREQUEST | IRQ_NOPROBE); in neponset_probe()
315 irq_set_chip(d->irq_base + NEP_IRQ_SA1111, &nochip); in neponset_probe()
321 writeb_relaxed(NCR_GP01_OFF, d->base + NCR_0); in neponset_probe()
323 neponset_init_gpio(&d->gpio[0], &dev->dev, "neponset-ncr", in neponset_probe()
324 d->base + NCR_0, NCR_NGPIO, false, in neponset_probe()
326 neponset_init_gpio(&d->gpio[1], &dev->dev, "neponset-mdm-ctl0", in neponset_probe()
327 d->base + MDM_CTL_0, MDM_CTL0_NGPIO, false, in neponset_probe()
329 neponset_init_gpio(&d->gpio[2], &dev->dev, "neponset-mdm-ctl1", in neponset_probe()
330 d->base + MDM_CTL_1, MDM_CTL1_NGPIO, true, in neponset_probe()
332 neponset_init_gpio(&d->gpio[3], &dev->dev, "neponset-aud-ctl", in neponset_probe()
333 d->base + AUD_CTL, AUD_NGPIO, false, in neponset_probe()
341 * We would set IRQ_GPIO25 to be a wake-up IRQ, but unfortunately in neponset_probe()
348 dev_info(&dev->dev, "Neponset daughter board, providing IRQ%u-%u\n", in neponset_probe()
349 d->irq_base, d->irq_base + NEP_IRQ_NR - 1); in neponset_probe()
356 sa1111_resources[1].start = d->irq_base + NEP_IRQ_SA1111; in neponset_probe()
357 sa1111_resources[1].end = d->irq_base + NEP_IRQ_SA1111; in neponset_probe()
358 d->sa1111 = platform_device_register_full(&sa1111_devinfo); in neponset_probe()
362 smc91x_resources[2].start = d->irq_base + NEP_IRQ_SMC91X; in neponset_probe()
363 smc91x_resources[2].end = d->irq_base + NEP_IRQ_SMC91X; in neponset_probe()
364 d->smc91x = platform_device_register_full(&smc91x_devinfo); in neponset_probe()
372 iounmap(d->base); in neponset_probe()
384 if (!IS_ERR(d->sa1111)) in neponset_remove()
385 platform_device_unregister(d->sa1111); in neponset_remove()
386 if (!IS_ERR(d->smc91x)) in neponset_remove()
387 platform_device_unregister(d->smc91x); in neponset_remove()
394 irq_free_descs(d->irq_base, NEP_IRQ_NR); in neponset_remove()
396 iounmap(d->base); in neponset_remove()
408 for (i = 0; i < ARRAY_SIZE(d->gpio); i++) { in neponset_resume()
409 ret = gpio_reg_resume(d->gpio[i]); in neponset_resume()