2 * This file define the irq handler for MSP SLM subsystem interrupts.
4 * Copyright 2005-2007 PMC-Sierra, Inc, derived from irq_cpu.c
5 * Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/kernel.h>
16 #include <linux/bitops.h>
17 #include <linux/irq.h>
19 #include <asm/system.h>
21 #include <msp_cic_int.h>
25 * NOTE: We are only enabling support for VPE0 right now.
28 static inline void unmask_msp_cic_irq(unsigned int irq
)
31 /* check for PER interrupt range */
32 if (irq
< MSP_PER_INTBASE
)
33 *CIC_VPE0_MSK_REG
|= (1 << (irq
- MSP_CIC_INTBASE
));
35 *PER_INT_MSK_REG
|= (1 << (irq
- MSP_PER_INTBASE
));
38 static inline void mask_msp_cic_irq(unsigned int irq
)
40 /* check for PER interrupt range */
41 if (irq
< MSP_PER_INTBASE
)
42 *CIC_VPE0_MSK_REG
&= ~(1 << (irq
- MSP_CIC_INTBASE
));
44 *PER_INT_MSK_REG
&= ~(1 << (irq
- MSP_PER_INTBASE
));
48 * While we ack the interrupt interrupts are disabled and thus we don't need
49 * to deal with concurrency issues. Same for msp_cic_irq_end.
51 static inline void ack_msp_cic_irq(unsigned int irq
)
53 mask_msp_cic_irq(irq
);
56 * only really necessary for 18, 16-14 and sometimes 3:0 (since
57 * these can be edge sensitive) but it doesn't hurt for the others.
60 /* check for PER interrupt range */
61 if (irq
< MSP_PER_INTBASE
)
62 *CIC_STS_REG
= (1 << (irq
- MSP_CIC_INTBASE
));
64 *PER_INT_STS_REG
= (1 << (irq
- MSP_PER_INTBASE
));
67 static struct irq_chip msp_cic_irq_controller
= {
69 .ack
= ack_msp_cic_irq
,
70 .mask
= ack_msp_cic_irq
,
71 .mask_ack
= ack_msp_cic_irq
,
72 .unmask
= unmask_msp_cic_irq
,
76 void __init
msp_cic_irq_init(void)
80 /* Mask/clear interrupts. */
81 *CIC_VPE0_MSK_REG
= 0x00000000;
82 *PER_INT_MSK_REG
= 0x00000000;
83 *CIC_STS_REG
= 0xFFFFFFFF;
84 *PER_INT_STS_REG
= 0xFFFFFFFF;
86 #if defined(CONFIG_PMC_MSP7120_GW) || \
87 defined(CONFIG_PMC_MSP7120_EVAL)
89 * The MSP7120 RG and EVBD boards use IRQ[6:4] for PCI.
90 * These inputs map to EXT_INT_POL[6:4] inside the CIC.
91 * They are to be active low, level sensitive.
93 *CIC_EXT_CFG_REG
&= 0xFFFF8F8F;
96 /* initialize all the IRQ descriptors */
97 for (i
= MSP_CIC_INTBASE
; i
< MSP_PER_INTBASE
+ 32; i
++)
98 set_irq_chip_and_handler(i
, &msp_cic_irq_controller
,
102 void msp_cic_irq_dispatch(void)
107 intbase
= MSP_CIC_INTBASE
;
108 pending
= *CIC_STS_REG
& *CIC_VPE0_MSK_REG
;
110 /* check for PER interrupt */
111 if (pending
== (1 << (MSP_INT_PER
- MSP_CIC_INTBASE
))) {
112 intbase
= MSP_PER_INTBASE
;
113 pending
= *PER_INT_STS_REG
& *PER_INT_MSK_REG
;
116 /* check for spurious interrupt */
117 if (pending
== 0x00000000) {
119 "Spurious %s interrupt? status %08x, mask %08x\n",
120 (intbase
== MSP_CIC_INTBASE
) ? "CIC" : "PER",
121 (intbase
== MSP_CIC_INTBASE
) ?
122 *CIC_STS_REG
: *PER_INT_STS_REG
,
123 (intbase
== MSP_CIC_INTBASE
) ?
124 *CIC_VPE0_MSK_REG
: *PER_INT_MSK_REG
);
128 /* check for the timer and dispatch it first */
129 if ((intbase
== MSP_CIC_INTBASE
) &&
130 (pending
& (1 << (MSP_INT_VPE0_TIMER
- MSP_CIC_INTBASE
))))
131 do_IRQ(MSP_INT_VPE0_TIMER
);
133 do_IRQ(ffs(pending
) + intbase
- 1);