23 #define MPIC_ERR_INT_BASE 0x3900
24 #define MPIC_ERR_INT_EISR 0x0000
25 #define MPIC_ERR_INT_EIMR 0x0010
27 static inline u32 mpic_fsl_err_read(
u32 __iomem *base,
unsigned int err_reg)
29 return in_be32(base + (err_reg >> 2));
37 static void fsl_mpic_mask_err(
struct irq_data *
d)
40 struct mpic *mpic = irq_data_get_irq_chip_data(d);
44 eimr |= (1 << (31 -
src));
45 mpic_fsl_err_write(mpic->err_regs, eimr);
48 static void fsl_mpic_unmask_err(
struct irq_data *
d)
51 struct mpic *mpic = irq_data_get_irq_chip_data(d);
55 eimr &= ~(1 << (31 -
src));
56 mpic_fsl_err_write(mpic->err_regs, eimr);
59 static struct irq_chip fsl_mpic_err_chip = {
60 .irq_disable = fsl_mpic_mask_err,
61 .irq_mask = fsl_mpic_mask_err,
62 .irq_unmask = fsl_mpic_unmask_err,
70 if (!mpic->err_regs) {
71 pr_err(
"could not map mpic error registers\n");
74 mpic->hc_err = fsl_mpic_err_chip;
75 mpic->hc_err.
name = mpic->name;
76 mpic->flags |= MPIC_FSL_HAS_EIMR;
78 for (i = MPIC_MAX_ERR - 1; i >= 0; i--)
79 mpic->err_int_vecs[i] = --intvec;
86 if ((mpic->flags & MPIC_FSL_HAS_EIMR) &&
87 (hw >= mpic->err_int_vecs[0] &&
89 WARN_ON(mpic->flags & MPIC_SECONDARY);
91 pr_debug(
"mpic: mapping as Error Interrupt\n");
93 irq_set_chip_and_handler(virq, &mpic->hc_err,
103 struct mpic *mpic = (
struct mpic *) data;
115 errint = __builtin_clz(eisr);
117 mpic->err_int_vecs[errint]);
119 if (cascade_irq !=
NO_IRQ) {
122 eimr |= 1 << (31 - errint);
123 mpic_fsl_err_write(mpic->err_regs, eimr);
125 eisr &= ~(1 << (31 - errint));
138 pr_err(
"Error interrupt setup failed\n");
143 mpic_fsl_err_write(mpic->err_regs, ~0);
146 "mpic-error-int", mpic);
148 pr_err(
"Failed to register error interrupt handler\n");