Linux 5.7.7
[linux/fpc-iii.git] / arch / arm / mach-iop32x / irq.c
blob2d48bf1398c10d26c41776b9dfa9d1d6bc505f29
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * arch/arm/mach-iop32x/irq.c
5 * Generic IOP32X IRQ handling functionality
7 * Author: Rory Bolt <rorybolt@pacbell.net>
8 * Copyright (C) 2002 Rory Bolt
9 */
11 #include <linux/init.h>
12 #include <linux/interrupt.h>
13 #include <linux/list.h>
14 #include <asm/mach/irq.h>
15 #include <asm/irq.h>
16 #include <asm/mach-types.h>
18 #include "hardware.h"
20 static u32 iop32x_mask;
22 static void intctl_write(u32 val)
24 asm volatile("mcr p6, 0, %0, c0, c0, 0" : : "r" (val));
27 static void intstr_write(u32 val)
29 asm volatile("mcr p6, 0, %0, c4, c0, 0" : : "r" (val));
32 static void
33 iop32x_irq_mask(struct irq_data *d)
35 iop32x_mask &= ~(1 << d->irq);
36 intctl_write(iop32x_mask);
39 static void
40 iop32x_irq_unmask(struct irq_data *d)
42 iop32x_mask |= 1 << d->irq;
43 intctl_write(iop32x_mask);
46 struct irq_chip ext_chip = {
47 .name = "IOP32x",
48 .irq_ack = iop32x_irq_mask,
49 .irq_mask = iop32x_irq_mask,
50 .irq_unmask = iop32x_irq_unmask,
53 void __init iop32x_init_irq(void)
55 int i;
57 iop_init_cp6_handler();
59 intctl_write(0);
60 intstr_write(0);
61 if (machine_is_glantank() ||
62 machine_is_iq80321() ||
63 machine_is_iq31244() ||
64 machine_is_n2100() ||
65 machine_is_em7210())
66 *IOP3XX_PCIIRSR = 0x0f;
68 for (i = 0; i < NR_IRQS; i++) {
69 irq_set_chip_and_handler(i, &ext_chip, handle_level_irq);
70 irq_clear_status_flags(i, IRQ_NOREQUEST | IRQ_NOPROBE);