48 #include <linux/slab.h>
54 #include <asm/exception.h>
57 #define MAKE_HWIRQ(b, n) ((b << 5) | (n))
58 #define HWIRQ_BANK(i) (i >> 5)
59 #define HWIRQ_BIT(i) BIT(i & 0x1f)
61 #define NR_IRQS_BANK0 8
62 #define BANK0_HWIRQ_MASK 0xff
64 #define SHORTCUT1_MASK 0x00007c00
65 #define SHORTCUT2_MASK 0x001f8000
66 #define SHORTCUT_SHIFT 10
67 #define BANK1_HWIRQ BIT(8)
68 #define BANK2_HWIRQ BIT(9)
69 #define BANK0_VALID_MASK (BANK0_HWIRQ_MASK | BANK1_HWIRQ | BANK2_HWIRQ \
70 | SHORTCUT1_MASK | SHORTCUT2_MASK)
72 #define REG_FIQ_CONTROL 0x0c
75 #define IRQS_PER_BANK 32
77 static int reg_pending[]
__initconst = { 0x00, 0x04, 0x08 };
78 static int reg_enable[]
__initconst = { 0x18, 0x10, 0x14 };
79 static int reg_disable[]
__initconst = { 0x24, 0x1c, 0x20 };
82 static const int shortcuts[] = {
84 21, 22, 23, 24, 25, 30
97 static void armctrl_mask_irq(
struct irq_data *
d)
102 static void armctrl_unmask_irq(
struct irq_data *d)
107 static struct irq_chip armctrl_chip = {
108 .name =
"ARMCTRL-level",
109 .irq_mask = armctrl_mask_irq,
110 .irq_unmask = armctrl_unmask_irq
114 const u32 *intspec,
unsigned int intsize,
115 unsigned long *out_hwirq,
unsigned int *out_type)
129 *out_hwirq =
MAKE_HWIRQ(intspec[0], intspec[1]);
135 .xlate = armctrl_xlate
146 panic(
"%s: unable to map IC registers\n",
155 intc.pending[
b] = base + reg_pending[
b];
156 intc.enable[
b] = base + reg_enable[
b];
157 intc.disable[
b] = base + reg_disable[
b];
159 for (i = 0; i < bank_irqs[
b]; i++) {
162 irq_set_chip_and_handler(irq, &armctrl_chip,
171 { .compatible =
"brcm,bcm2835-armctrl-ic", .data = armctrl_of_init },
186 static void armctrl_handle_bank(
int bank,
struct pt_regs *
regs)
196 static void armctrl_handle_shortcut(
int bank,
struct pt_regs *regs,
213 armctrl_handle_shortcut(1, regs, stat & SHORTCUT1_MASK);
215 armctrl_handle_shortcut(2, regs, stat & SHORTCUT2_MASK);
217 armctrl_handle_bank(1, regs);
219 armctrl_handle_bank(2, regs);