diff options
author | Mike Frysinger <vapier@gentoo.org> | 2011-04-15 03:08:20 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2011-05-25 08:13:43 -0400 |
commit | f58c3276d3652b0d96654ba08f0afc87c013da57 (patch) | |
tree | a7276504d01d8a0a170f6b52eea80a2cbef6b225 /arch/blackfin/mach-bf537/ints-priority.c | |
parent | 6327a574f9ce85f0daab8693913003a456f27f1f (diff) |
Blackfin: move bf537-specific irq code out of common code
The SIC interrupt line muxing that the bf537 does is specific to this
CPU (thankfully), so rip it out of the common code and move it to a
bf537-specific file. This tidies up the common code significantly.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/mach-bf537/ints-priority.c')
-rw-r--r-- | arch/blackfin/mach-bf537/ints-priority.c | 124 |
1 files changed, 124 insertions, 0 deletions
diff --git a/arch/blackfin/mach-bf537/ints-priority.c b/arch/blackfin/mach-bf537/ints-priority.c index f6500622b35d..cbf19011667b 100644 --- a/arch/blackfin/mach-bf537/ints-priority.c +++ b/arch/blackfin/mach-bf537/ints-priority.c | |||
@@ -10,6 +10,12 @@ | |||
10 | #include <linux/irq.h> | 10 | #include <linux/irq.h> |
11 | #include <asm/blackfin.h> | 11 | #include <asm/blackfin.h> |
12 | 12 | ||
13 | #include <asm/irq_handler.h> | ||
14 | #include <asm/bfin5xx_spi.h> | ||
15 | #include <asm/bfin_sport.h> | ||
16 | #include <asm/bfin_can.h> | ||
17 | #include <asm/dpmc.h> | ||
18 | |||
13 | void __init program_IAR(void) | 19 | void __init program_IAR(void) |
14 | { | 20 | { |
15 | /* Program the IAR0 Register with the configured priority */ | 21 | /* Program the IAR0 Register with the configured priority */ |
@@ -51,3 +57,121 @@ void __init program_IAR(void) | |||
51 | 57 | ||
52 | SSYNC(); | 58 | SSYNC(); |
53 | } | 59 | } |
60 | |||
61 | #define SPI_ERR_MASK (BIT_STAT_TXCOL | BIT_STAT_RBSY | BIT_STAT_MODF | BIT_STAT_TXE) /* SPI_STAT */ | ||
62 | #define SPORT_ERR_MASK (ROVF | RUVF | TOVF | TUVF) /* SPORT_STAT */ | ||
63 | #define PPI_ERR_MASK (0xFFFF & ~FLD) /* PPI_STATUS */ | ||
64 | #define EMAC_ERR_MASK (PHYINT | MMCINT | RXFSINT | TXFSINT | WAKEDET | RXDMAERR | TXDMAERR | STMDONE) /* EMAC_SYSTAT */ | ||
65 | #define UART_ERR_MASK (0x6) /* UART_IIR */ | ||
66 | #define CAN_ERR_MASK (EWTIF | EWRIF | EPIF | BOIF | WUIF | UIAIF | AAIF | RMLIF | UCEIF | EXTIF | ADIF) /* CAN_GIF */ | ||
67 | |||
68 | static int error_int_mask; | ||
69 | |||
70 | static void bf537_generic_error_mask_irq(struct irq_data *d) | ||
71 | { | ||
72 | error_int_mask &= ~(1L << (d->irq - IRQ_PPI_ERROR)); | ||
73 | if (!error_int_mask) | ||
74 | bfin_internal_mask_irq(IRQ_GENERIC_ERROR); | ||
75 | } | ||
76 | |||
77 | static void bf537_generic_error_unmask_irq(struct irq_data *d) | ||
78 | { | ||
79 | bfin_internal_unmask_irq(IRQ_GENERIC_ERROR); | ||
80 | error_int_mask |= 1L << (d->irq - IRQ_PPI_ERROR); | ||
81 | } | ||
82 | |||
83 | static struct irq_chip bf537_generic_error_irqchip = { | ||
84 | .name = "ERROR", | ||
85 | .irq_ack = bfin_ack_noop, | ||
86 | .irq_mask_ack = bf537_generic_error_mask_irq, | ||
87 | .irq_mask = bf537_generic_error_mask_irq, | ||
88 | .irq_unmask = bf537_generic_error_unmask_irq, | ||
89 | }; | ||
90 | |||
91 | static void bf537_demux_error_irq(unsigned int int_err_irq, | ||
92 | struct irq_desc *inta_desc) | ||
93 | { | ||
94 | int irq = 0; | ||
95 | |||
96 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) | ||
97 | if (bfin_read_EMAC_SYSTAT() & EMAC_ERR_MASK) | ||
98 | irq = IRQ_MAC_ERROR; | ||
99 | else | ||
100 | #endif | ||
101 | if (bfin_read_SPORT0_STAT() & SPORT_ERR_MASK) | ||
102 | irq = IRQ_SPORT0_ERROR; | ||
103 | else if (bfin_read_SPORT1_STAT() & SPORT_ERR_MASK) | ||
104 | irq = IRQ_SPORT1_ERROR; | ||
105 | else if (bfin_read_PPI_STATUS() & PPI_ERR_MASK) | ||
106 | irq = IRQ_PPI_ERROR; | ||
107 | else if (bfin_read_CAN_GIF() & CAN_ERR_MASK) | ||
108 | irq = IRQ_CAN_ERROR; | ||
109 | else if (bfin_read_SPI_STAT() & SPI_ERR_MASK) | ||
110 | irq = IRQ_SPI_ERROR; | ||
111 | else if ((bfin_read_UART0_IIR() & UART_ERR_MASK) == UART_ERR_MASK) | ||
112 | irq = IRQ_UART0_ERROR; | ||
113 | else if ((bfin_read_UART1_IIR() & UART_ERR_MASK) == UART_ERR_MASK) | ||
114 | irq = IRQ_UART1_ERROR; | ||
115 | |||
116 | if (irq) { | ||
117 | if (error_int_mask & (1L << (irq - IRQ_PPI_ERROR))) | ||
118 | bfin_handle_irq(irq); | ||
119 | else { | ||
120 | |||
121 | switch (irq) { | ||
122 | case IRQ_PPI_ERROR: | ||
123 | bfin_write_PPI_STATUS(PPI_ERR_MASK); | ||
124 | break; | ||
125 | #if (defined(CONFIG_BF537) || defined(CONFIG_BF536)) | ||
126 | case IRQ_MAC_ERROR: | ||
127 | bfin_write_EMAC_SYSTAT(EMAC_ERR_MASK); | ||
128 | break; | ||
129 | #endif | ||
130 | case IRQ_SPORT0_ERROR: | ||
131 | bfin_write_SPORT0_STAT(SPORT_ERR_MASK); | ||
132 | break; | ||
133 | |||
134 | case IRQ_SPORT1_ERROR: | ||
135 | bfin_write_SPORT1_STAT(SPORT_ERR_MASK); | ||
136 | break; | ||
137 | |||
138 | case IRQ_CAN_ERROR: | ||
139 | bfin_write_CAN_GIS(CAN_ERR_MASK); | ||
140 | break; | ||
141 | |||
142 | case IRQ_SPI_ERROR: | ||
143 | bfin_write_SPI_STAT(SPI_ERR_MASK); | ||
144 | break; | ||
145 | |||
146 | default: | ||
147 | break; | ||
148 | } | ||
149 | |||
150 | pr_debug("IRQ %d:" | ||
151 | " MASKED PERIPHERAL ERROR INTERRUPT ASSERTED\n", | ||
152 | irq); | ||
153 | } | ||
154 | } else | ||
155 | pr_err("%s: IRQ ?: PERIPHERAL ERROR INTERRUPT ASSERTED BUT NO SOURCE FOUND\n", | ||
156 | __func__); | ||
157 | |||
158 | } | ||
159 | |||
160 | void __init init_mach_irq(void) | ||
161 | { | ||
162 | int irq; | ||
163 | |||
164 | #if defined(CONFIG_BF537) || defined(CONFIG_BF536) | ||
165 | /* Clear EMAC Interrupt Status bits so we can demux it later */ | ||
166 | bfin_write_EMAC_SYSTAT(-1); | ||
167 | #endif | ||
168 | |||
169 | irq_set_chained_handler(IRQ_GENERIC_ERROR, bf537_demux_error_irq); | ||
170 | for (irq = IRQ_PPI_ERROR; irq <= IRQ_UART1_ERROR; irq++) | ||
171 | irq_set_chip_and_handler(irq, &bf537_generic_error_irqchip, | ||
172 | handle_level_irq); | ||
173 | |||
174 | #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) | ||
175 | irq_set_chained_handler(IRQ_MAC_ERROR, bfin_demux_mac_status_irq); | ||
176 | #endif | ||
177 | } | ||