aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/mach-common/ints-priority.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/mach-common/ints-priority.c')
-rw-r--r--arch/blackfin/mach-common/ints-priority.c174
1 files changed, 64 insertions, 110 deletions
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 880595afe98d..225ef14af75e 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -74,7 +74,7 @@ unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */
74#endif 74#endif
75 75
76struct ivgx { 76struct ivgx {
77 /* irq number for request_irq, available in mach-bf533/irq.h */ 77 /* irq number for request_irq, available in mach-bf5xx/irq.h */
78 unsigned int irqno; 78 unsigned int irqno;
79 /* corresponding bit in the SIC_ISR register */ 79 /* corresponding bit in the SIC_ISR register */
80 unsigned int isrflag; 80 unsigned int isrflag;
@@ -86,7 +86,6 @@ struct ivg_slice {
86 struct ivgx *istop; 86 struct ivgx *istop;
87} ivg7_13[IVG13 - IVG7 + 1]; 87} ivg7_13[IVG13 - IVG7 + 1];
88 88
89static void search_IAR(void);
90 89
91/* 90/*
92 * Search SIC_IAR and fill tables with the irqvalues 91 * Search SIC_IAR and fill tables with the irqvalues
@@ -120,10 +119,10 @@ static void __init search_IAR(void)
120} 119}
121 120
122/* 121/*
123 * This is for BF533 internal IRQs 122 * This is for core internal IRQs
124 */ 123 */
125 124
126static void ack_noop(unsigned int irq) 125static void bfin_ack_noop(unsigned int irq)
127{ 126{
128 /* Dummy function. */ 127 /* Dummy function. */
129} 128}
@@ -156,11 +155,11 @@ static void bfin_internal_mask_irq(unsigned int irq)
156{ 155{
157#ifdef CONFIG_BF53x 156#ifdef CONFIG_BF53x
158 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & 157 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() &
159 ~(1 << (irq - (IRQ_CORETMR + 1)))); 158 ~(1 << SIC_SYSIRQ(irq)));
160#else 159#else
161 unsigned mask_bank, mask_bit; 160 unsigned mask_bank, mask_bit;
162 mask_bank = (irq - (IRQ_CORETMR + 1)) / 32; 161 mask_bank = SIC_SYSIRQ(irq) / 32;
163 mask_bit = (irq - (IRQ_CORETMR + 1)) % 32; 162 mask_bit = SIC_SYSIRQ(irq) % 32;
164 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & 163 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) &
165 ~(1 << mask_bit)); 164 ~(1 << mask_bit));
166#endif 165#endif
@@ -171,11 +170,11 @@ static void bfin_internal_unmask_irq(unsigned int irq)
171{ 170{
172#ifdef CONFIG_BF53x 171#ifdef CONFIG_BF53x
173 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | 172 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() |
174 (1 << (irq - (IRQ_CORETMR + 1)))); 173 (1 << SIC_SYSIRQ(irq)));
175#else 174#else
176 unsigned mask_bank, mask_bit; 175 unsigned mask_bank, mask_bit;
177 mask_bank = (irq - (IRQ_CORETMR + 1)) / 32; 176 mask_bank = SIC_SYSIRQ(irq) / 32;
178 mask_bit = (irq - (IRQ_CORETMR + 1)) % 32; 177 mask_bit = SIC_SYSIRQ(irq) % 32;
179 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) | 178 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) |
180 (1 << mask_bit)); 179 (1 << mask_bit));
181#endif 180#endif
@@ -187,8 +186,8 @@ int bfin_internal_set_wake(unsigned int irq, unsigned int state)
187{ 186{
188 unsigned bank, bit; 187 unsigned bank, bit;
189 unsigned long flags; 188 unsigned long flags;
190 bank = (irq - (IRQ_CORETMR + 1)) / 32; 189 bank = SIC_SYSIRQ(irq) / 32;
191 bit = (irq - (IRQ_CORETMR + 1)) % 32; 190 bit = SIC_SYSIRQ(irq) % 32;
192 191
193 local_irq_save(flags); 192 local_irq_save(flags);
194 193
@@ -204,15 +203,18 @@ int bfin_internal_set_wake(unsigned int irq, unsigned int state)
204#endif 203#endif
205 204
206static struct irq_chip bfin_core_irqchip = { 205static struct irq_chip bfin_core_irqchip = {
207 .ack = ack_noop, 206 .ack = bfin_ack_noop,
208 .mask = bfin_core_mask_irq, 207 .mask = bfin_core_mask_irq,
209 .unmask = bfin_core_unmask_irq, 208 .unmask = bfin_core_unmask_irq,
210}; 209};
211 210
212static struct irq_chip bfin_internal_irqchip = { 211static struct irq_chip bfin_internal_irqchip = {
213 .ack = ack_noop, 212 .ack = bfin_ack_noop,
214 .mask = bfin_internal_mask_irq, 213 .mask = bfin_internal_mask_irq,
215 .unmask = bfin_internal_unmask_irq, 214 .unmask = bfin_internal_unmask_irq,
215 .mask_ack = bfin_internal_mask_irq,
216 .disable = bfin_internal_mask_irq,
217 .enable = bfin_internal_unmask_irq,
216#ifdef CONFIG_PM 218#ifdef CONFIG_PM
217 .set_wake = bfin_internal_set_wake, 219 .set_wake = bfin_internal_set_wake,
218#endif 220#endif
@@ -221,38 +223,23 @@ static struct irq_chip bfin_internal_irqchip = {
221#ifdef BF537_GENERIC_ERROR_INT_DEMUX 223#ifdef BF537_GENERIC_ERROR_INT_DEMUX
222static int error_int_mask; 224static int error_int_mask;
223 225
224static void bfin_generic_error_ack_irq(unsigned int irq)
225{
226
227}
228
229static void bfin_generic_error_mask_irq(unsigned int irq) 226static void bfin_generic_error_mask_irq(unsigned int irq)
230{ 227{
231 error_int_mask &= ~(1L << (irq - IRQ_PPI_ERROR)); 228 error_int_mask &= ~(1L << (irq - IRQ_PPI_ERROR));
232 229
233 if (!error_int_mask) { 230 if (!error_int_mask)
234 local_irq_disable(); 231 bfin_internal_mask_irq(IRQ_GENERIC_ERROR);
235 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() &
236 ~(1 << (IRQ_GENERIC_ERROR -
237 (IRQ_CORETMR + 1))));
238 SSYNC();
239 local_irq_enable();
240 }
241} 232}
242 233
243static void bfin_generic_error_unmask_irq(unsigned int irq) 234static void bfin_generic_error_unmask_irq(unsigned int irq)
244{ 235{
245 local_irq_disable(); 236 bfin_internal_unmask_irq(IRQ_GENERIC_ERROR);
246 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | 1 <<
247 (IRQ_GENERIC_ERROR - (IRQ_CORETMR + 1)));
248 SSYNC();
249 local_irq_enable();
250
251 error_int_mask |= 1L << (irq - IRQ_PPI_ERROR); 237 error_int_mask |= 1L << (irq - IRQ_PPI_ERROR);
252} 238}
253 239
254static struct irq_chip bfin_generic_error_irqchip = { 240static struct irq_chip bfin_generic_error_irqchip = {
255 .ack = bfin_generic_error_ack_irq, 241 .ack = bfin_ack_noop,
242 .mask_ack = bfin_generic_error_mask_irq,
256 .mask = bfin_generic_error_mask_irq, 243 .mask = bfin_generic_error_mask_irq,
257 .unmask = bfin_generic_error_unmask_irq, 244 .unmask = bfin_generic_error_unmask_irq,
258}; 245};
@@ -608,7 +595,7 @@ static struct pin_int_t *pint[NR_PINT_SYS_IRQS] = {
608 (struct pin_int_t *)PINT3_MASK_SET, 595 (struct pin_int_t *)PINT3_MASK_SET,
609}; 596};
610 597
611unsigned short get_irq_base(u8 bank, u8 bmap) 598inline unsigned short get_irq_base(u8 bank, u8 bmap)
612{ 599{
613 600
614 u16 irq_base; 601 u16 irq_base;
@@ -969,17 +956,12 @@ int __init init_arch_irq(void)
969#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 956#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
970 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); 957 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL);
971 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); 958 bfin_write_SIC_IMASK1(SIC_UNMASK_ALL);
972 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
973 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
974# ifdef CONFIG_BF54x 959# ifdef CONFIG_BF54x
975 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); 960 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL);
976 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
977# endif 961# endif
978#else 962#else
979 bfin_write_SIC_IMASK(SIC_UNMASK_ALL); 963 bfin_write_SIC_IMASK(SIC_UNMASK_ALL);
980 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
981#endif 964#endif
982 SSYNC();
983 965
984 local_irq_disable(); 966 local_irq_disable();
985 967
@@ -1001,90 +983,53 @@ int __init init_arch_irq(void)
1001 set_irq_chip(irq, &bfin_core_irqchip); 983 set_irq_chip(irq, &bfin_core_irqchip);
1002 else 984 else
1003 set_irq_chip(irq, &bfin_internal_irqchip); 985 set_irq_chip(irq, &bfin_internal_irqchip);
1004#ifdef BF537_GENERIC_ERROR_INT_DEMUX
1005 if (irq != IRQ_GENERIC_ERROR) {
1006#endif
1007 986
1008 switch (irq) { 987 switch (irq) {
1009#if defined(CONFIG_BF53x) 988#if defined(CONFIG_BF53x)
1010 case IRQ_PROG_INTA: 989 case IRQ_PROG_INTA:
1011 set_irq_chained_handler(irq,
1012 bfin_demux_gpio_irq);
1013 break;
1014# if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) 990# if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE))
1015 case IRQ_MAC_RX: 991 case IRQ_MAC_RX:
1016 set_irq_chained_handler(irq,
1017 bfin_demux_gpio_irq);
1018 break;
1019# endif 992# endif
1020#elif defined(CONFIG_BF54x) 993#elif defined(CONFIG_BF54x)
1021 case IRQ_PINT0: 994 case IRQ_PINT0:
1022 set_irq_chained_handler(irq, 995 case IRQ_PINT1:
1023 bfin_demux_gpio_irq); 996 case IRQ_PINT2:
1024 break; 997 case IRQ_PINT3:
1025 case IRQ_PINT1:
1026 set_irq_chained_handler(irq,
1027 bfin_demux_gpio_irq);
1028 break;
1029 case IRQ_PINT2:
1030 set_irq_chained_handler(irq,
1031 bfin_demux_gpio_irq);
1032 break;
1033 case IRQ_PINT3:
1034 set_irq_chained_handler(irq,
1035 bfin_demux_gpio_irq);
1036 break;
1037#elif defined(CONFIG_BF52x) 998#elif defined(CONFIG_BF52x)
1038 case IRQ_PORTF_INTA: 999 case IRQ_PORTF_INTA:
1039 set_irq_chained_handler(irq, 1000 case IRQ_PORTG_INTA:
1040 bfin_demux_gpio_irq); 1001 case IRQ_PORTH_INTA:
1041 break;
1042 case IRQ_PORTG_INTA:
1043 set_irq_chained_handler(irq,
1044 bfin_demux_gpio_irq);
1045 break;
1046 case IRQ_PORTH_INTA:
1047 set_irq_chained_handler(irq,
1048 bfin_demux_gpio_irq);
1049 break;
1050#elif defined(CONFIG_BF561) 1002#elif defined(CONFIG_BF561)
1051 case IRQ_PROG0_INTA: 1003 case IRQ_PROG0_INTA:
1052 set_irq_chained_handler(irq, 1004 case IRQ_PROG1_INTA:
1053 bfin_demux_gpio_irq); 1005 case IRQ_PROG2_INTA:
1054 break;
1055 case IRQ_PROG1_INTA:
1056 set_irq_chained_handler(irq,
1057 bfin_demux_gpio_irq);
1058 break;
1059 case IRQ_PROG2_INTA:
1060 set_irq_chained_handler(irq,
1061 bfin_demux_gpio_irq);
1062 break;
1063#endif 1006#endif
1064 default: 1007 set_irq_chained_handler(irq,
1065 set_irq_handler(irq, handle_simple_irq); 1008 bfin_demux_gpio_irq);
1066 break; 1009 break;
1067 }
1068
1069#ifdef BF537_GENERIC_ERROR_INT_DEMUX 1010#ifdef BF537_GENERIC_ERROR_INT_DEMUX
1070 } else { 1011 case IRQ_GENERIC_ERROR:
1071 set_irq_handler(irq, bfin_demux_error_irq); 1012 set_irq_handler(irq, bfin_demux_error_irq);
1072 } 1013
1014 break;
1073#endif 1015#endif
1016 default:
1017 set_irq_handler(irq, handle_simple_irq);
1018 break;
1019 }
1074 } 1020 }
1021
1075#ifdef BF537_GENERIC_ERROR_INT_DEMUX 1022#ifdef BF537_GENERIC_ERROR_INT_DEMUX
1076 for (irq = IRQ_PPI_ERROR; irq <= IRQ_UART1_ERROR; irq++) { 1023 for (irq = IRQ_PPI_ERROR; irq <= IRQ_UART1_ERROR; irq++)
1077 set_irq_chip(irq, &bfin_generic_error_irqchip); 1024 set_irq_chip_and_handler(irq, &bfin_generic_error_irqchip,
1078 set_irq_handler(irq, handle_level_irq); 1025 handle_level_irq);
1079 }
1080#endif 1026#endif
1081 1027
1082 for (irq = GPIO_IRQ_BASE; irq < NR_IRQS; irq++) { 1028 /* if configured as edge, then will be changed to do_edge_IRQ */
1029 for (irq = GPIO_IRQ_BASE; irq < NR_IRQS; irq++)
1030 set_irq_chip_and_handler(irq, &bfin_gpio_irqchip,
1031 handle_level_irq);
1083 1032
1084 set_irq_chip(irq, &bfin_gpio_irqchip);
1085 /* if configured as edge, then will be changed to do_edge_IRQ */
1086 set_irq_handler(irq, handle_level_irq);
1087 }
1088 1033
1089 bfin_write_IMASK(0); 1034 bfin_write_IMASK(0);
1090 CSYNC(); 1035 CSYNC();
@@ -1106,6 +1051,16 @@ int __init init_arch_irq(void)
1106 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1051 IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 |
1107 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1052 IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW;
1108 1053
1054#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
1055 bfin_write_SIC_IWR0(IWR_ENABLE_ALL);
1056 bfin_write_SIC_IWR1(IWR_ENABLE_ALL);
1057# ifdef CONFIG_BF54x
1058 bfin_write_SIC_IWR2(IWR_ENABLE_ALL);
1059# endif
1060#else
1061 bfin_write_SIC_IWR(IWR_ENABLE_ALL);
1062#endif
1063
1109 return 0; 1064 return 0;
1110} 1065}
1111 1066
@@ -1122,7 +1077,6 @@ void do_irq(int vec, struct pt_regs *fp)
1122#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) 1077#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561)
1123 unsigned long sic_status[3]; 1078 unsigned long sic_status[3];
1124 1079
1125 SSYNC();
1126 sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0(); 1080 sic_status[0] = bfin_read_SIC_ISR0() & bfin_read_SIC_IMASK0();
1127 sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1(); 1081 sic_status[1] = bfin_read_SIC_ISR1() & bfin_read_SIC_IMASK1();
1128#ifdef CONFIG_BF54x 1082#ifdef CONFIG_BF54x
@@ -1138,7 +1092,7 @@ void do_irq(int vec, struct pt_regs *fp)
1138 } 1092 }
1139#else 1093#else
1140 unsigned long sic_status; 1094 unsigned long sic_status;
1141 SSYNC(); 1095
1142 sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); 1096 sic_status = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR();
1143 1097
1144 for (;; ivg++) { 1098 for (;; ivg++) {