diff options
Diffstat (limited to 'arch/blackfin/mach-common/ints-priority.c')
-rw-r--r-- | arch/blackfin/mach-common/ints-priority.c | 331 |
1 files changed, 230 insertions, 101 deletions
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c index 2729cba715b0..7ca09ec2ca53 100644 --- a/arch/blackfin/mach-common/ints-priority.c +++ b/arch/blackfin/mach-common/ints-priority.c | |||
@@ -26,8 +26,9 @@ | |||
26 | #include <asm/gpio.h> | 26 | #include <asm/gpio.h> |
27 | #include <asm/irq_handler.h> | 27 | #include <asm/irq_handler.h> |
28 | #include <asm/dpmc.h> | 28 | #include <asm/dpmc.h> |
29 | #include <asm/traps.h> | ||
29 | 30 | ||
30 | #ifndef CONFIG_BF60x | 31 | #ifndef SEC_GCTL |
31 | # define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) | 32 | # define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) |
32 | #else | 33 | #else |
33 | # define SIC_SYSIRQ(irq) ((irq) - IVG15) | 34 | # define SIC_SYSIRQ(irq) ((irq) - IVG15) |
@@ -56,7 +57,7 @@ unsigned long bfin_sic_iwr[3]; /* Up to 3 SIC_IWRx registers */ | |||
56 | unsigned vr_wakeup; | 57 | unsigned vr_wakeup; |
57 | #endif | 58 | #endif |
58 | 59 | ||
59 | #ifndef CONFIG_BF60x | 60 | #ifndef SEC_GCTL |
60 | static struct ivgx { | 61 | static struct ivgx { |
61 | /* irq number for request_irq, available in mach-bf5xx/irq.h */ | 62 | /* irq number for request_irq, available in mach-bf5xx/irq.h */ |
62 | unsigned int irqno; | 63 | unsigned int irqno; |
@@ -143,7 +144,7 @@ static void bfin_core_unmask_irq(struct irq_data *d) | |||
143 | void bfin_internal_mask_irq(unsigned int irq) | 144 | void bfin_internal_mask_irq(unsigned int irq) |
144 | { | 145 | { |
145 | unsigned long flags = hard_local_irq_save(); | 146 | unsigned long flags = hard_local_irq_save(); |
146 | #ifndef CONFIG_BF60x | 147 | #ifndef SEC_GCTL |
147 | #ifdef SIC_IMASK0 | 148 | #ifdef SIC_IMASK0 |
148 | unsigned mask_bank = SIC_SYSIRQ(irq) / 32; | 149 | unsigned mask_bank = SIC_SYSIRQ(irq) / 32; |
149 | unsigned mask_bit = SIC_SYSIRQ(irq) % 32; | 150 | unsigned mask_bit = SIC_SYSIRQ(irq) % 32; |
@@ -175,7 +176,7 @@ void bfin_internal_unmask_irq(unsigned int irq) | |||
175 | { | 176 | { |
176 | unsigned long flags = hard_local_irq_save(); | 177 | unsigned long flags = hard_local_irq_save(); |
177 | 178 | ||
178 | #ifndef CONFIG_BF60x | 179 | #ifndef SEC_GCTL |
179 | #ifdef SIC_IMASK0 | 180 | #ifdef SIC_IMASK0 |
180 | unsigned mask_bank = SIC_SYSIRQ(irq) / 32; | 181 | unsigned mask_bank = SIC_SYSIRQ(irq) / 32; |
181 | unsigned mask_bit = SIC_SYSIRQ(irq) % 32; | 182 | unsigned mask_bit = SIC_SYSIRQ(irq) % 32; |
@@ -199,7 +200,7 @@ void bfin_internal_unmask_irq(unsigned int irq) | |||
199 | hard_local_irq_restore(flags); | 200 | hard_local_irq_restore(flags); |
200 | } | 201 | } |
201 | 202 | ||
202 | #ifdef CONFIG_BF60x | 203 | #ifdef SEC_GCTL |
203 | static void bfin_sec_preflow_handler(struct irq_data *d) | 204 | static void bfin_sec_preflow_handler(struct irq_data *d) |
204 | { | 205 | { |
205 | unsigned long flags = hard_local_irq_save(); | 206 | unsigned long flags = hard_local_irq_save(); |
@@ -310,7 +311,24 @@ static void bfin_sec_disable(struct irq_data *d) | |||
310 | hard_local_irq_restore(flags); | 311 | hard_local_irq_restore(flags); |
311 | } | 312 | } |
312 | 313 | ||
313 | static void bfin_sec_raise_irq(unsigned int sid) | 314 | static void bfin_sec_set_priority(unsigned int sec_int_levels, u8 *sec_int_priority) |
315 | { | ||
316 | unsigned long flags = hard_local_irq_save(); | ||
317 | uint32_t reg_sctl; | ||
318 | int i; | ||
319 | |||
320 | bfin_write_SEC_SCI(0, SEC_CPLVL, sec_int_levels); | ||
321 | |||
322 | for (i = 0; i < SYS_IRQS - BFIN_IRQ(0); i++) { | ||
323 | reg_sctl = bfin_read_SEC_SCTL(i) & ~SEC_SCTL_PRIO; | ||
324 | reg_sctl |= sec_int_priority[i] << SEC_SCTL_PRIO_OFFSET; | ||
325 | bfin_write_SEC_SCTL(i, reg_sctl); | ||
326 | } | ||
327 | |||
328 | hard_local_irq_restore(flags); | ||
329 | } | ||
330 | |||
331 | void bfin_sec_raise_irq(unsigned int sid) | ||
314 | { | 332 | { |
315 | unsigned long flags = hard_local_irq_save(); | 333 | unsigned long flags = hard_local_irq_save(); |
316 | 334 | ||
@@ -396,24 +414,34 @@ void handle_sec_fault(unsigned int irq, struct irq_desc *desc) | |||
396 | raw_spin_unlock(&desc->lock); | 414 | raw_spin_unlock(&desc->lock); |
397 | } | 415 | } |
398 | 416 | ||
399 | static int sec_suspend(void) | 417 | void handle_core_fault(unsigned int irq, struct irq_desc *desc) |
400 | { | 418 | { |
401 | return 0; | 419 | struct pt_regs *fp = get_irq_regs(); |
402 | } | ||
403 | 420 | ||
404 | static void sec_resume(void) | 421 | raw_spin_lock(&desc->lock); |
405 | { | ||
406 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET); | ||
407 | udelay(100); | ||
408 | bfin_write_SEC_GCTL(SEC_GCTL_EN); | ||
409 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); | ||
410 | } | ||
411 | 422 | ||
412 | static struct syscore_ops sec_pm_syscore_ops = { | 423 | switch (irq) { |
413 | .suspend = sec_suspend, | 424 | case IRQ_C0_DBL_FAULT: |
414 | .resume = sec_resume, | 425 | double_fault_c(fp); |
415 | }; | 426 | break; |
427 | case IRQ_C0_HW_ERR: | ||
428 | dump_bfin_process(fp); | ||
429 | dump_bfin_mem(fp); | ||
430 | show_regs(fp); | ||
431 | printk(KERN_NOTICE "Kernel Stack\n"); | ||
432 | show_stack(current, NULL); | ||
433 | print_modules(); | ||
434 | panic("Kernel core hardware error"); | ||
435 | break; | ||
436 | case IRQ_C0_NMI_L1_PARITY_ERR: | ||
437 | panic("NMI occurs unexpectedly"); | ||
438 | break; | ||
439 | default: | ||
440 | panic("Core 1 fault occurs unexpectedly"); | ||
441 | } | ||
416 | 442 | ||
443 | raw_spin_unlock(&desc->lock); | ||
444 | } | ||
417 | #endif | 445 | #endif |
418 | 446 | ||
419 | #ifdef CONFIG_SMP | 447 | #ifdef CONFIG_SMP |
@@ -437,7 +465,7 @@ static void bfin_internal_unmask_irq_chip(struct irq_data *d) | |||
437 | } | 465 | } |
438 | #endif | 466 | #endif |
439 | 467 | ||
440 | #if defined(CONFIG_PM) && !defined(CONFIG_BF60x) | 468 | #if defined(CONFIG_PM) && !defined(SEC_GCTL) |
441 | int bfin_internal_set_wake(unsigned int irq, unsigned int state) | 469 | int bfin_internal_set_wake(unsigned int irq, unsigned int state) |
442 | { | 470 | { |
443 | u32 bank, bit, wakeup = 0; | 471 | u32 bank, bit, wakeup = 0; |
@@ -496,7 +524,10 @@ static int bfin_internal_set_wake_chip(struct irq_data *d, unsigned int state) | |||
496 | return bfin_internal_set_wake(d->irq, state); | 524 | return bfin_internal_set_wake(d->irq, state); |
497 | } | 525 | } |
498 | #else | 526 | #else |
499 | # define bfin_internal_set_wake(irq, state) | 527 | inline int bfin_internal_set_wake(unsigned int irq, unsigned int state) |
528 | { | ||
529 | return 0; | ||
530 | } | ||
500 | # define bfin_internal_set_wake_chip NULL | 531 | # define bfin_internal_set_wake_chip NULL |
501 | #endif | 532 | #endif |
502 | 533 | ||
@@ -518,7 +549,7 @@ static struct irq_chip bfin_internal_irqchip = { | |||
518 | .irq_set_wake = bfin_internal_set_wake_chip, | 549 | .irq_set_wake = bfin_internal_set_wake_chip, |
519 | }; | 550 | }; |
520 | 551 | ||
521 | #ifdef CONFIG_BF60x | 552 | #ifdef SEC_GCTL |
522 | static struct irq_chip bfin_sec_irqchip = { | 553 | static struct irq_chip bfin_sec_irqchip = { |
523 | .name = "SEC", | 554 | .name = "SEC", |
524 | .irq_mask_ack = bfin_sec_mask_ack_irq, | 555 | .irq_mask_ack = bfin_sec_mask_ack_irq, |
@@ -868,14 +899,6 @@ void bfin_demux_gpio_irq(unsigned int inta_irq, | |||
868 | 899 | ||
869 | #else | 900 | #else |
870 | 901 | ||
871 | # ifndef CONFIG_BF60x | ||
872 | #define NR_PINT_SYS_IRQS 4 | ||
873 | #define NR_PINTS 160 | ||
874 | # else | ||
875 | #define NR_PINT_SYS_IRQS 6 | ||
876 | #define NR_PINTS 112 | ||
877 | #endif | ||
878 | |||
879 | #define NR_PINT_BITS 32 | 902 | #define NR_PINT_BITS 32 |
880 | #define IRQ_NOT_AVAIL 0xFF | 903 | #define IRQ_NOT_AVAIL 0xFF |
881 | 904 | ||
@@ -897,29 +920,21 @@ static struct bfin_pint_regs * const pint[NR_PINT_SYS_IRQS] = { | |||
897 | #endif | 920 | #endif |
898 | }; | 921 | }; |
899 | 922 | ||
900 | #ifndef CONFIG_BF60x | ||
901 | inline unsigned int get_irq_base(u32 bank, u8 bmap) | 923 | inline unsigned int get_irq_base(u32 bank, u8 bmap) |
902 | { | 924 | { |
903 | unsigned int irq_base; | 925 | unsigned int irq_base; |
904 | 926 | ||
927 | #ifndef CONFIG_BF60x | ||
905 | if (bank < 2) { /*PA-PB */ | 928 | if (bank < 2) { /*PA-PB */ |
906 | irq_base = IRQ_PA0 + bmap * 16; | 929 | irq_base = IRQ_PA0 + bmap * 16; |
907 | } else { /*PC-PJ */ | 930 | } else { /*PC-PJ */ |
908 | irq_base = IRQ_PC0 + bmap * 16; | 931 | irq_base = IRQ_PC0 + bmap * 16; |
909 | } | 932 | } |
910 | |||
911 | return irq_base; | ||
912 | } | ||
913 | #else | 933 | #else |
914 | inline unsigned int get_irq_base(u32 bank, u8 bmap) | ||
915 | { | ||
916 | unsigned int irq_base; | ||
917 | |||
918 | irq_base = IRQ_PA0 + bank * 16 + bmap * 16; | 934 | irq_base = IRQ_PA0 + bank * 16 + bmap * 16; |
919 | 935 | #endif | |
920 | return irq_base; | 936 | return irq_base; |
921 | } | 937 | } |
922 | #endif | ||
923 | 938 | ||
924 | /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ | 939 | /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ |
925 | void init_pint_lut(void) | 940 | void init_pint_lut(void) |
@@ -1089,6 +1104,9 @@ static int bfin_gpio_irq_type(struct irq_data *d, unsigned int type) | |||
1089 | } | 1104 | } |
1090 | 1105 | ||
1091 | #ifdef CONFIG_PM | 1106 | #ifdef CONFIG_PM |
1107 | static struct bfin_pm_pint_save save_pint_reg[NR_PINT_SYS_IRQS]; | ||
1108 | static u32 save_pint_sec_ctl[NR_PINT_SYS_IRQS]; | ||
1109 | |||
1092 | static int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) | 1110 | static int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) |
1093 | { | 1111 | { |
1094 | u32 pint_irq; | 1112 | u32 pint_irq; |
@@ -1124,6 +1142,59 @@ static int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) | |||
1124 | 1142 | ||
1125 | return 0; | 1143 | return 0; |
1126 | } | 1144 | } |
1145 | |||
1146 | void bfin_pint_suspend(void) | ||
1147 | { | ||
1148 | u32 bank; | ||
1149 | |||
1150 | for (bank = 0; bank < NR_PINT_SYS_IRQS; bank++) { | ||
1151 | save_pint_reg[bank].mask_set = pint[bank]->mask_set; | ||
1152 | save_pint_reg[bank].assign = pint[bank]->assign; | ||
1153 | save_pint_reg[bank].edge_set = pint[bank]->edge_set; | ||
1154 | save_pint_reg[bank].invert_set = pint[bank]->invert_set; | ||
1155 | } | ||
1156 | } | ||
1157 | |||
1158 | void bfin_pint_resume(void) | ||
1159 | { | ||
1160 | u32 bank; | ||
1161 | |||
1162 | for (bank = 0; bank < NR_PINT_SYS_IRQS; bank++) { | ||
1163 | pint[bank]->mask_set = save_pint_reg[bank].mask_set; | ||
1164 | pint[bank]->assign = save_pint_reg[bank].assign; | ||
1165 | pint[bank]->edge_set = save_pint_reg[bank].edge_set; | ||
1166 | pint[bank]->invert_set = save_pint_reg[bank].invert_set; | ||
1167 | } | ||
1168 | } | ||
1169 | |||
1170 | #ifdef SEC_GCTL | ||
1171 | static int sec_suspend(void) | ||
1172 | { | ||
1173 | u32 bank; | ||
1174 | |||
1175 | for (bank = 0; bank < NR_PINT_SYS_IRQS; bank++) | ||
1176 | save_pint_sec_ctl[bank] = bfin_read_SEC_SCTL(bank + SIC_SYSIRQ(IRQ_PINT0)); | ||
1177 | return 0; | ||
1178 | } | ||
1179 | |||
1180 | static void sec_resume(void) | ||
1181 | { | ||
1182 | u32 bank; | ||
1183 | |||
1184 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET); | ||
1185 | udelay(100); | ||
1186 | bfin_write_SEC_GCTL(SEC_GCTL_EN); | ||
1187 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); | ||
1188 | |||
1189 | for (bank = 0; bank < NR_PINT_SYS_IRQS; bank++) | ||
1190 | bfin_write_SEC_SCTL(bank + SIC_SYSIRQ(IRQ_PINT0), save_pint_sec_ctl[bank]); | ||
1191 | } | ||
1192 | |||
1193 | static struct syscore_ops sec_pm_syscore_ops = { | ||
1194 | .suspend = sec_suspend, | ||
1195 | .resume = sec_resume, | ||
1196 | }; | ||
1197 | #endif | ||
1127 | #else | 1198 | #else |
1128 | # define bfin_gpio_set_wake NULL | 1199 | # define bfin_gpio_set_wake NULL |
1129 | #endif | 1200 | #endif |
@@ -1230,6 +1301,7 @@ void __cpuinit init_exception_vectors(void) | |||
1230 | CSYNC(); | 1301 | CSYNC(); |
1231 | } | 1302 | } |
1232 | 1303 | ||
1304 | #ifndef SEC_GCTL | ||
1233 | /* | 1305 | /* |
1234 | * This function should be called during kernel startup to initialize | 1306 | * This function should be called during kernel startup to initialize |
1235 | * the BFin IRQ handling routines. | 1307 | * the BFin IRQ handling routines. |
@@ -1240,7 +1312,6 @@ int __init init_arch_irq(void) | |||
1240 | int irq; | 1312 | int irq; |
1241 | unsigned long ilat = 0; | 1313 | unsigned long ilat = 0; |
1242 | 1314 | ||
1243 | #ifndef CONFIG_BF60x | ||
1244 | /* Disable all the peripheral intrs - page 4-29 HW Ref manual */ | 1315 | /* Disable all the peripheral intrs - page 4-29 HW Ref manual */ |
1245 | #ifdef SIC_IMASK0 | 1316 | #ifdef SIC_IMASK0 |
1246 | bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); | 1317 | bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); |
@@ -1255,9 +1326,6 @@ int __init init_arch_irq(void) | |||
1255 | #else | 1326 | #else |
1256 | bfin_write_SIC_IMASK(SIC_UNMASK_ALL); | 1327 | bfin_write_SIC_IMASK(SIC_UNMASK_ALL); |
1257 | #endif | 1328 | #endif |
1258 | #else /* CONFIG_BF60x */ | ||
1259 | bfin_write_SEC_GCTL(SEC_GCTL_RESET); | ||
1260 | #endif | ||
1261 | 1329 | ||
1262 | local_irq_disable(); | 1330 | local_irq_disable(); |
1263 | 1331 | ||
@@ -1267,10 +1335,6 @@ int __init init_arch_irq(void) | |||
1267 | pint[1]->assign = CONFIG_PINT1_ASSIGN; | 1335 | pint[1]->assign = CONFIG_PINT1_ASSIGN; |
1268 | pint[2]->assign = CONFIG_PINT2_ASSIGN; | 1336 | pint[2]->assign = CONFIG_PINT2_ASSIGN; |
1269 | pint[3]->assign = CONFIG_PINT3_ASSIGN; | 1337 | pint[3]->assign = CONFIG_PINT3_ASSIGN; |
1270 | # ifdef CONFIG_BF60x | ||
1271 | pint[4]->assign = CONFIG_PINT4_ASSIGN; | ||
1272 | pint[5]->assign = CONFIG_PINT5_ASSIGN; | ||
1273 | # endif | ||
1274 | # endif | 1338 | # endif |
1275 | /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ | 1339 | /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ |
1276 | init_pint_lut(); | 1340 | init_pint_lut(); |
@@ -1283,7 +1347,6 @@ int __init init_arch_irq(void) | |||
1283 | irq_set_chip(irq, &bfin_internal_irqchip); | 1347 | irq_set_chip(irq, &bfin_internal_irqchip); |
1284 | 1348 | ||
1285 | switch (irq) { | 1349 | switch (irq) { |
1286 | #ifndef CONFIG_BF60x | ||
1287 | #if BFIN_GPIO_PINT | 1350 | #if BFIN_GPIO_PINT |
1288 | case IRQ_PINT0: | 1351 | case IRQ_PINT0: |
1289 | case IRQ_PINT1: | 1352 | case IRQ_PINT1: |
@@ -1319,7 +1382,6 @@ int __init init_arch_irq(void) | |||
1319 | irq_set_handler(irq, handle_percpu_irq); | 1382 | irq_set_handler(irq, handle_percpu_irq); |
1320 | break; | 1383 | break; |
1321 | #endif | 1384 | #endif |
1322 | #endif | ||
1323 | 1385 | ||
1324 | #ifdef CONFIG_TICKSOURCE_CORETMR | 1386 | #ifdef CONFIG_TICKSOURCE_CORETMR |
1325 | case IRQ_CORETMR: | 1387 | case IRQ_CORETMR: |
@@ -1349,8 +1411,7 @@ int __init init_arch_irq(void) | |||
1349 | 1411 | ||
1350 | init_mach_irq(); | 1412 | init_mach_irq(); |
1351 | 1413 | ||
1352 | #ifndef CONFIG_BF60x | 1414 | #if (defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) |
1353 | #if (defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) && !defined(CONFIG_BF60x) | ||
1354 | for (irq = IRQ_MAC_PHYINT; irq <= IRQ_MAC_STMDONE; irq++) | 1415 | for (irq = IRQ_MAC_PHYINT; irq <= IRQ_MAC_STMDONE; irq++) |
1355 | irq_set_chip_and_handler(irq, &bfin_mac_status_irqchip, | 1416 | irq_set_chip_and_handler(irq, &bfin_mac_status_irqchip, |
1356 | handle_level_irq); | 1417 | handle_level_irq); |
@@ -1360,28 +1421,6 @@ int __init init_arch_irq(void) | |||
1360 | irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++) | 1421 | irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++) |
1361 | irq_set_chip_and_handler(irq, &bfin_gpio_irqchip, | 1422 | irq_set_chip_and_handler(irq, &bfin_gpio_irqchip, |
1362 | handle_level_irq); | 1423 | handle_level_irq); |
1363 | #else | ||
1364 | for (irq = BFIN_IRQ(0); irq <= SYS_IRQS; irq++) { | ||
1365 | if (irq < CORE_IRQS) { | ||
1366 | irq_set_chip(irq, &bfin_sec_irqchip); | ||
1367 | __irq_set_handler(irq, handle_sec_fault, 0, NULL); | ||
1368 | } else if (irq >= BFIN_IRQ(21) && irq <= BFIN_IRQ(26)) { | ||
1369 | irq_set_chip(irq, &bfin_sec_irqchip); | ||
1370 | irq_set_chained_handler(irq, bfin_demux_gpio_irq); | ||
1371 | } else if (irq >= BFIN_IRQ(34) && irq <= BFIN_IRQ(37)) { | ||
1372 | irq_set_chip(irq, &bfin_sec_irqchip); | ||
1373 | irq_set_handler(irq, handle_percpu_irq); | ||
1374 | } else { | ||
1375 | irq_set_chip_and_handler(irq, &bfin_sec_irqchip, | ||
1376 | handle_fasteoi_irq); | ||
1377 | __irq_set_preflow_handler(irq, bfin_sec_preflow_handler); | ||
1378 | } | ||
1379 | } | ||
1380 | for (irq = GPIO_IRQ_BASE; | ||
1381 | irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++) | ||
1382 | irq_set_chip_and_handler(irq, &bfin_gpio_irqchip, | ||
1383 | handle_level_irq); | ||
1384 | #endif | ||
1385 | bfin_write_IMASK(0); | 1424 | bfin_write_IMASK(0); |
1386 | CSYNC(); | 1425 | CSYNC(); |
1387 | ilat = bfin_read_ILAT(); | 1426 | ilat = bfin_read_ILAT(); |
@@ -1393,7 +1432,6 @@ int __init init_arch_irq(void) | |||
1393 | /* IMASK=xxx is equivalent to STI xx or bfin_irq_flags=xx, | 1432 | /* IMASK=xxx is equivalent to STI xx or bfin_irq_flags=xx, |
1394 | * local_irq_enable() | 1433 | * local_irq_enable() |
1395 | */ | 1434 | */ |
1396 | #ifndef CONFIG_BF60x | ||
1397 | program_IAR(); | 1435 | program_IAR(); |
1398 | /* Therefore it's better to setup IARs before interrupts enabled */ | 1436 | /* Therefore it's better to setup IARs before interrupts enabled */ |
1399 | search_IAR(); | 1437 | search_IAR(); |
@@ -1427,23 +1465,6 @@ int __init init_arch_irq(void) | |||
1427 | #else | 1465 | #else |
1428 | bfin_write_SIC_IWR(IWR_DISABLE_ALL); | 1466 | bfin_write_SIC_IWR(IWR_DISABLE_ALL); |
1429 | #endif | 1467 | #endif |
1430 | #else /* CONFIG_BF60x */ | ||
1431 | /* Enable interrupts IVG7-15 */ | ||
1432 | bfin_irq_flags |= IMASK_IVG15 | | ||
1433 | IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | | ||
1434 | IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; | ||
1435 | |||
1436 | |||
1437 | bfin_write_SEC_FCTL(SEC_FCTL_EN | SEC_FCTL_SYSRST_EN | SEC_FCTL_FLTIN_EN); | ||
1438 | bfin_sec_enable_sci(SIC_SYSIRQ(IRQ_WATCH0)); | ||
1439 | bfin_sec_enable_ssi(SIC_SYSIRQ(IRQ_WATCH0)); | ||
1440 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET); | ||
1441 | udelay(100); | ||
1442 | bfin_write_SEC_GCTL(SEC_GCTL_EN); | ||
1443 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); | ||
1444 | init_software_driven_irq(); | ||
1445 | register_syscore_ops(&sec_pm_syscore_ops); | ||
1446 | #endif | ||
1447 | return 0; | 1468 | return 0; |
1448 | } | 1469 | } |
1449 | 1470 | ||
@@ -1452,14 +1473,11 @@ __attribute__((l1_text)) | |||
1452 | #endif | 1473 | #endif |
1453 | static int vec_to_irq(int vec) | 1474 | static int vec_to_irq(int vec) |
1454 | { | 1475 | { |
1455 | #ifndef CONFIG_BF60x | ||
1456 | struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst; | 1476 | struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst; |
1457 | struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; | 1477 | struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; |
1458 | unsigned long sic_status[3]; | 1478 | unsigned long sic_status[3]; |
1459 | #endif | ||
1460 | if (likely(vec == EVT_IVTMR_P)) | 1479 | if (likely(vec == EVT_IVTMR_P)) |
1461 | return IRQ_CORETMR; | 1480 | return IRQ_CORETMR; |
1462 | #ifndef CONFIG_BF60x | ||
1463 | #ifdef SIC_ISR | 1481 | #ifdef SIC_ISR |
1464 | sic_status[0] = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); | 1482 | sic_status[0] = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); |
1465 | #else | 1483 | #else |
@@ -1488,11 +1506,119 @@ static int vec_to_irq(int vec) | |||
1488 | #endif | 1506 | #endif |
1489 | return ivg->irqno; | 1507 | return ivg->irqno; |
1490 | } | 1508 | } |
1491 | #else | 1509 | } |
1492 | /* for bf60x read */ | 1510 | |
1511 | #else /* SEC_GCTL */ | ||
1512 | |||
1513 | /* | ||
1514 | * This function should be called during kernel startup to initialize | ||
1515 | * the BFin IRQ handling routines. | ||
1516 | */ | ||
1517 | |||
1518 | int __init init_arch_irq(void) | ||
1519 | { | ||
1520 | int irq; | ||
1521 | unsigned long ilat = 0; | ||
1522 | |||
1523 | bfin_write_SEC_GCTL(SEC_GCTL_RESET); | ||
1524 | |||
1525 | local_irq_disable(); | ||
1526 | |||
1527 | #if BFIN_GPIO_PINT | ||
1528 | # ifdef CONFIG_PINTx_REASSIGN | ||
1529 | pint[0]->assign = CONFIG_PINT0_ASSIGN; | ||
1530 | pint[1]->assign = CONFIG_PINT1_ASSIGN; | ||
1531 | pint[2]->assign = CONFIG_PINT2_ASSIGN; | ||
1532 | pint[3]->assign = CONFIG_PINT3_ASSIGN; | ||
1533 | pint[4]->assign = CONFIG_PINT4_ASSIGN; | ||
1534 | pint[5]->assign = CONFIG_PINT5_ASSIGN; | ||
1535 | # endif | ||
1536 | /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ | ||
1537 | init_pint_lut(); | ||
1538 | #endif | ||
1539 | |||
1540 | for (irq = 0; irq <= SYS_IRQS; irq++) { | ||
1541 | if (irq <= IRQ_CORETMR) { | ||
1542 | irq_set_chip(irq, &bfin_core_irqchip); | ||
1543 | #ifdef CONFIG_TICKSOURCE_CORETMR | ||
1544 | if (irq == IRQ_CORETMR) | ||
1545 | # ifdef CONFIG_SMP | ||
1546 | irq_set_handler(irq, handle_percpu_irq); | ||
1547 | # else | ||
1548 | irq_set_handler(irq, handle_simple_irq); | ||
1549 | # endif | ||
1550 | #endif | ||
1551 | } else if (irq < BFIN_IRQ(0)) { | ||
1552 | irq_set_chip_and_handler(irq, &bfin_internal_irqchip, | ||
1553 | handle_simple_irq); | ||
1554 | } else if (irq == IRQ_SEC_ERR) { | ||
1555 | irq_set_chip_and_handler(irq, &bfin_sec_irqchip, | ||
1556 | handle_sec_fault); | ||
1557 | } else if (irq < CORE_IRQS && irq >= IRQ_C0_DBL_FAULT) { | ||
1558 | irq_set_chip_and_handler(irq, &bfin_sec_irqchip, | ||
1559 | handle_core_fault); | ||
1560 | } else if (irq >= BFIN_IRQ(21) && irq <= BFIN_IRQ(26)) { | ||
1561 | irq_set_chip(irq, &bfin_sec_irqchip); | ||
1562 | irq_set_chained_handler(irq, bfin_demux_gpio_irq); | ||
1563 | } else if (irq >= BFIN_IRQ(34) && irq <= BFIN_IRQ(37)) { | ||
1564 | irq_set_chip(irq, &bfin_sec_irqchip); | ||
1565 | irq_set_handler(irq, handle_percpu_irq); | ||
1566 | } else { | ||
1567 | irq_set_chip_and_handler(irq, &bfin_sec_irqchip, | ||
1568 | handle_fasteoi_irq); | ||
1569 | __irq_set_preflow_handler(irq, bfin_sec_preflow_handler); | ||
1570 | } | ||
1571 | } | ||
1572 | for (irq = GPIO_IRQ_BASE; | ||
1573 | irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++) | ||
1574 | irq_set_chip_and_handler(irq, &bfin_gpio_irqchip, | ||
1575 | handle_level_irq); | ||
1576 | |||
1577 | bfin_write_IMASK(0); | ||
1578 | CSYNC(); | ||
1579 | ilat = bfin_read_ILAT(); | ||
1580 | CSYNC(); | ||
1581 | bfin_write_ILAT(ilat); | ||
1582 | CSYNC(); | ||
1583 | |||
1584 | printk(KERN_INFO "Configuring Blackfin Priority Driven Interrupts\n"); | ||
1585 | |||
1586 | bfin_sec_set_priority(CONFIG_SEC_IRQ_PRIORITY_LEVELS, sec_int_priority); | ||
1587 | |||
1588 | bfin_sec_set_priority(CONFIG_SEC_IRQ_PRIORITY_LEVELS, sec_int_priority); | ||
1589 | |||
1590 | /* Enable interrupts IVG7-15 */ | ||
1591 | bfin_irq_flags |= IMASK_IVG15 | | ||
1592 | IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | | ||
1593 | IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; | ||
1594 | |||
1595 | |||
1596 | bfin_write_SEC_FCTL(SEC_FCTL_EN | SEC_FCTL_SYSRST_EN | SEC_FCTL_FLTIN_EN); | ||
1597 | bfin_sec_enable_sci(SIC_SYSIRQ(IRQ_WATCH0)); | ||
1598 | bfin_sec_enable_ssi(SIC_SYSIRQ(IRQ_WATCH0)); | ||
1599 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET); | ||
1600 | udelay(100); | ||
1601 | bfin_write_SEC_GCTL(SEC_GCTL_EN); | ||
1602 | bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); | ||
1603 | bfin_write_SEC_SCI(1, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); | ||
1604 | |||
1605 | init_software_driven_irq(); | ||
1606 | register_syscore_ops(&sec_pm_syscore_ops); | ||
1607 | |||
1608 | return 0; | ||
1609 | } | ||
1610 | |||
1611 | #ifdef CONFIG_DO_IRQ_L1 | ||
1612 | __attribute__((l1_text)) | ||
1613 | #endif | ||
1614 | static int vec_to_irq(int vec) | ||
1615 | { | ||
1616 | if (likely(vec == EVT_IVTMR_P)) | ||
1617 | return IRQ_CORETMR; | ||
1618 | |||
1493 | return BFIN_IRQ(bfin_read_SEC_SCI(0, SEC_CSID)); | 1619 | return BFIN_IRQ(bfin_read_SEC_SCI(0, SEC_CSID)); |
1494 | #endif /* end of CONFIG_BF60x */ | ||
1495 | } | 1620 | } |
1621 | #endif /* SEC_GCTL */ | ||
1496 | 1622 | ||
1497 | #ifdef CONFIG_DO_IRQ_L1 | 1623 | #ifdef CONFIG_DO_IRQ_L1 |
1498 | __attribute__((l1_text)) | 1624 | __attribute__((l1_text)) |
@@ -1514,6 +1640,10 @@ int __ipipe_get_irq_priority(unsigned irq) | |||
1514 | if (irq <= IRQ_CORETMR) | 1640 | if (irq <= IRQ_CORETMR) |
1515 | return irq; | 1641 | return irq; |
1516 | 1642 | ||
1643 | #ifdef SEC_GCTL | ||
1644 | if (irq >= BFIN_IRQ(0)) | ||
1645 | return IVG11; | ||
1646 | #else | ||
1517 | for (ient = 0; ient < NR_PERI_INTS; ient++) { | 1647 | for (ient = 0; ient < NR_PERI_INTS; ient++) { |
1518 | struct ivgx *ivg = ivg_table + ient; | 1648 | struct ivgx *ivg = ivg_table + ient; |
1519 | if (ivg->irqno == irq) { | 1649 | if (ivg->irqno == irq) { |
@@ -1524,6 +1654,7 @@ int __ipipe_get_irq_priority(unsigned irq) | |||
1524 | } | 1654 | } |
1525 | } | 1655 | } |
1526 | } | 1656 | } |
1657 | #endif | ||
1527 | 1658 | ||
1528 | return IVG15; | 1659 | return IVG15; |
1529 | } | 1660 | } |
@@ -1536,8 +1667,6 @@ asmlinkage int __ipipe_grab_irq(int vec, struct pt_regs *regs) | |||
1536 | { | 1667 | { |
1537 | struct ipipe_percpu_domain_data *p = ipipe_root_cpudom_ptr(); | 1668 | struct ipipe_percpu_domain_data *p = ipipe_root_cpudom_ptr(); |
1538 | struct ipipe_domain *this_domain = __ipipe_current_domain; | 1669 | struct ipipe_domain *this_domain = __ipipe_current_domain; |
1539 | struct ivgx *ivg_stop = ivg7_13[vec-IVG7].istop; | ||
1540 | struct ivgx *ivg = ivg7_13[vec-IVG7].ifirst; | ||
1541 | int irq, s = 0; | 1670 | int irq, s = 0; |
1542 | 1671 | ||
1543 | irq = vec_to_irq(vec); | 1672 | irq = vec_to_irq(vec); |