Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

blackfin: mach-common: add sec support for bf60x

Add system event controller support for bf60x so that interrupt can be
handled.

Signed-off-by: Steven Miao <realmz6@gmail.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>

authored by

Steven Miao and committed by
Bob Liu
4f6b600f 96900315

+385 -39
+5 -1
arch/blackfin/include/asm/irqflags.h
··· 67 67 68 68 static inline notrace int hard_irqs_disabled_flags(unsigned long flags) 69 69 { 70 + #ifdef CONFIG_BF60x 71 + return (flags & IMASK_IVG11) == 0; 72 + #else 70 73 return (flags & ~0x3f) == 0; 74 + #endif 71 75 } 72 76 73 77 static inline notrace int hard_irqs_disabled(void) ··· 228 224 * Direct interface to linux/irqflags.h. 229 225 */ 230 226 #define arch_local_save_flags() hard_local_save_flags() 231 - #define arch_local_irq_save(flags) __hard_local_irq_save() 227 + #define arch_local_irq_save() __hard_local_irq_save() 232 228 #define arch_local_irq_restore(flags) __hard_local_irq_restore(flags) 233 229 #define arch_local_irq_enable() __hard_local_irq_enable() 234 230 #define arch_local_irq_disable() __hard_local_irq_disable()
+380 -38
arch/blackfin/mach-common/ints-priority.c
··· 16 16 #include <linux/seq_file.h> 17 17 #include <linux/irq.h> 18 18 #include <linux/sched.h> 19 + #include <linux/syscore_ops.h> 20 + #include <asm/delay.h> 19 21 #ifdef CONFIG_IPIPE 20 22 #include <linux/ipipe.h> 21 23 #endif ··· 27 25 #include <asm/irq_handler.h> 28 26 #include <asm/dpmc.h> 29 27 30 - #define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) 28 + #ifndef CONFIG_BF60x 29 + # define SIC_SYSIRQ(irq) (irq - (IRQ_CORETMR + 1)) 30 + #else 31 + # define SIC_SYSIRQ(irq) ((irq) - IVG15) 32 + #endif 31 33 32 34 /* 33 35 * NOTES: ··· 56 50 unsigned vr_wakeup; 57 51 #endif 58 52 53 + #ifndef CONFIG_BF60x 59 54 static struct ivgx { 60 55 /* irq number for request_irq, available in mach-bf5xx/irq.h */ 61 56 unsigned int irqno; ··· 85 78 86 79 for (irqN = 0; irqN < NR_PERI_INTS; irqN += 4) { 87 80 int irqn; 88 - u32 iar = bfin_read32((unsigned long *)SIC_IAR0 + 81 + u32 iar = 82 + bfin_read32((unsigned long *)SIC_IAR0 + 89 83 #if defined(CONFIG_BF51x) || defined(CONFIG_BF52x) || \ 90 84 defined(CONFIG_BF538) || defined(CONFIG_BF539) 91 85 ((irqN % 32) >> 3) + ((irqN / 32) * ((SIC_IAR4 - SIC_IAR0) / 4)) ··· 94 86 (irqN >> 3) 95 87 #endif 96 88 ); 97 - 98 89 for (irqn = irqN; irqn < irqN + 4; ++irqn) { 99 90 int iar_shift = (irqn & 7) * 4; 100 91 if (ivg == (0xf & (iar >> iar_shift))) { ··· 106 99 } 107 100 } 108 101 } 102 + #endif 109 103 110 104 /* 111 105 * This is for core internal IRQs 112 106 */ 113 - 114 107 void bfin_ack_noop(struct irq_data *d) 115 108 { 116 109 /* Dummy function. */ ··· 143 136 void bfin_internal_mask_irq(unsigned int irq) 144 137 { 145 138 unsigned long flags = hard_local_irq_save(); 146 - 139 + #ifndef CONFIG_BF60x 147 140 #ifdef SIC_IMASK0 148 141 unsigned mask_bank = SIC_SYSIRQ(irq) / 32; 149 142 unsigned mask_bit = SIC_SYSIRQ(irq) % 32; 150 143 bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & 151 - ~(1 << mask_bit)); 152 - # ifdef CONFIG_SMP 144 + ~(1 << mask_bit)); 145 + # if defined(CONFIG_SMP) || defined(CONFIG_ICC) 153 146 bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) & 154 - ~(1 << mask_bit)); 147 + ~(1 << mask_bit)); 155 148 # endif 156 149 #else 157 150 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & 158 - ~(1 << SIC_SYSIRQ(irq))); 151 + ~(1 << SIC_SYSIRQ(irq))); 152 + #endif /* end of SIC_IMASK0 */ 159 153 #endif 160 - 161 154 hard_local_irq_restore(flags); 162 155 } 163 156 ··· 167 160 } 168 161 169 162 #ifdef CONFIG_SMP 170 - static void bfin_internal_unmask_irq_affinity(unsigned int irq, 163 + void bfin_internal_unmask_irq_affinity(unsigned int irq, 171 164 const struct cpumask *affinity) 172 165 #else 173 166 void bfin_internal_unmask_irq(unsigned int irq) ··· 175 168 { 176 169 unsigned long flags = hard_local_irq_save(); 177 170 171 + #ifndef CONFIG_BF60x 178 172 #ifdef SIC_IMASK0 179 173 unsigned mask_bank = SIC_SYSIRQ(irq) / 32; 180 174 unsigned mask_bit = SIC_SYSIRQ(irq) % 32; ··· 183 175 if (cpumask_test_cpu(0, affinity)) 184 176 # endif 185 177 bfin_write_SIC_IMASK(mask_bank, 186 - bfin_read_SIC_IMASK(mask_bank) | 187 - (1 << mask_bit)); 178 + bfin_read_SIC_IMASK(mask_bank) | 179 + (1 << mask_bit)); 188 180 # ifdef CONFIG_SMP 189 181 if (cpumask_test_cpu(1, affinity)) 190 182 bfin_write_SICB_IMASK(mask_bank, 191 - bfin_read_SICB_IMASK(mask_bank) | 192 - (1 << mask_bit)); 183 + bfin_read_SICB_IMASK(mask_bank) | 184 + (1 << mask_bit)); 193 185 # endif 194 186 #else 195 187 bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | 196 - (1 << SIC_SYSIRQ(irq))); 188 + (1 << SIC_SYSIRQ(irq))); 197 189 #endif 190 + #endif 191 + hard_local_irq_restore(flags); 192 + } 193 + 194 + #ifdef CONFIG_BF60x 195 + static void bfin_sec_preflow_handler(struct irq_data *d) 196 + { 197 + unsigned long flags = hard_local_irq_save(); 198 + unsigned int sid = SIC_SYSIRQ(d->irq); 199 + 200 + bfin_write_SEC_SCI(0, SEC_CSID, sid); 198 201 199 202 hard_local_irq_restore(flags); 200 203 } 204 + 205 + static void bfin_sec_mask_ack_irq(struct irq_data *d) 206 + { 207 + unsigned long flags = hard_local_irq_save(); 208 + unsigned int sid = SIC_SYSIRQ(d->irq); 209 + 210 + bfin_write_SEC_SCI(0, SEC_CSID, sid); 211 + 212 + hard_local_irq_restore(flags); 213 + } 214 + 215 + static void bfin_sec_unmask_irq(struct irq_data *d) 216 + { 217 + unsigned long flags = hard_local_irq_save(); 218 + unsigned int sid = SIC_SYSIRQ(d->irq); 219 + 220 + bfin_write32(SEC_END, sid); 221 + 222 + hard_local_irq_restore(flags); 223 + } 224 + 225 + static void bfin_sec_enable_ssi(unsigned int sid) 226 + { 227 + unsigned long flags = hard_local_irq_save(); 228 + uint32_t reg_sctl = bfin_read_SEC_SCTL(sid); 229 + 230 + reg_sctl |= SEC_SCTL_SRC_EN; 231 + bfin_write_SEC_SCTL(sid, reg_sctl); 232 + 233 + hard_local_irq_restore(flags); 234 + } 235 + 236 + static void bfin_sec_disable_ssi(unsigned int sid) 237 + { 238 + unsigned long flags = hard_local_irq_save(); 239 + uint32_t reg_sctl = bfin_read_SEC_SCTL(sid); 240 + 241 + reg_sctl &= ((uint32_t)~SEC_SCTL_SRC_EN); 242 + bfin_write_SEC_SCTL(sid, reg_sctl); 243 + 244 + hard_local_irq_restore(flags); 245 + } 246 + 247 + static void bfin_sec_set_ssi_coreid(unsigned int sid, unsigned int coreid) 248 + { 249 + unsigned long flags = hard_local_irq_save(); 250 + uint32_t reg_sctl = bfin_read_SEC_SCTL(sid); 251 + 252 + reg_sctl &= ((uint32_t)~SEC_SCTL_CTG); 253 + bfin_write_SEC_SCTL(sid, reg_sctl | ((coreid << 20) & SEC_SCTL_CTG)); 254 + 255 + hard_local_irq_restore(flags); 256 + } 257 + 258 + static void bfin_sec_enable_sci(unsigned int sid) 259 + { 260 + unsigned long flags = hard_local_irq_save(); 261 + uint32_t reg_sctl = bfin_read_SEC_SCTL(sid); 262 + 263 + if (sid == SIC_SYSIRQ(IRQ_WATCH0)) 264 + reg_sctl |= SEC_SCTL_FAULT_EN; 265 + else 266 + reg_sctl |= SEC_SCTL_INT_EN; 267 + bfin_write_SEC_SCTL(sid, reg_sctl); 268 + 269 + hard_local_irq_restore(flags); 270 + } 271 + 272 + static void bfin_sec_disable_sci(unsigned int sid) 273 + { 274 + unsigned long flags = hard_local_irq_save(); 275 + uint32_t reg_sctl = bfin_read_SEC_SCTL(sid); 276 + 277 + reg_sctl &= ((uint32_t)~SEC_SCTL_INT_EN); 278 + bfin_write_SEC_SCTL(sid, reg_sctl); 279 + 280 + hard_local_irq_restore(flags); 281 + } 282 + 283 + static void bfin_sec_enable(struct irq_data *d) 284 + { 285 + unsigned long flags = hard_local_irq_save(); 286 + unsigned int sid = SIC_SYSIRQ(d->irq); 287 + 288 + bfin_sec_enable_sci(sid); 289 + bfin_sec_enable_ssi(sid); 290 + 291 + hard_local_irq_restore(flags); 292 + } 293 + 294 + static void bfin_sec_disable(struct irq_data *d) 295 + { 296 + unsigned long flags = hard_local_irq_save(); 297 + unsigned int sid = SIC_SYSIRQ(d->irq); 298 + 299 + bfin_sec_disable_sci(sid); 300 + bfin_sec_disable_ssi(sid); 301 + 302 + hard_local_irq_restore(flags); 303 + } 304 + 305 + static void bfin_sec_raise_irq(unsigned int sid) 306 + { 307 + unsigned long flags = hard_local_irq_save(); 308 + 309 + bfin_write32(SEC_RAISE, sid); 310 + 311 + hard_local_irq_restore(flags); 312 + } 313 + 314 + static void init_software_driven_irq(void) 315 + { 316 + bfin_sec_set_ssi_coreid(34, 0); 317 + bfin_sec_set_ssi_coreid(35, 1); 318 + bfin_sec_set_ssi_coreid(36, 0); 319 + bfin_sec_set_ssi_coreid(37, 1); 320 + } 321 + 322 + void bfin_sec_resume(void) 323 + { 324 + bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET); 325 + udelay(100); 326 + bfin_write_SEC_GCTL(SEC_GCTL_EN); 327 + bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); 328 + } 329 + 330 + void handle_sec_sfi_fault(uint32_t gstat) 331 + { 332 + 333 + } 334 + 335 + void handle_sec_sci_fault(uint32_t gstat) 336 + { 337 + uint32_t core_id; 338 + uint32_t cstat; 339 + 340 + core_id = gstat & SEC_GSTAT_SCI; 341 + cstat = bfin_read_SEC_SCI(core_id, SEC_CSTAT); 342 + if (cstat & SEC_CSTAT_ERR) { 343 + switch (cstat & SEC_CSTAT_ERRC) { 344 + case SEC_CSTAT_ACKERR: 345 + printk(KERN_DEBUG "sec ack err\n"); 346 + break; 347 + default: 348 + printk(KERN_DEBUG "sec sci unknow err\n"); 349 + } 350 + } 351 + 352 + } 353 + 354 + void handle_sec_ssi_fault(uint32_t gstat) 355 + { 356 + uint32_t sid; 357 + uint32_t sstat; 358 + 359 + sid = gstat & SEC_GSTAT_SID; 360 + sstat = bfin_read_SEC_SSTAT(sid); 361 + 362 + } 363 + 364 + void handle_sec_fault(unsigned int irq, struct irq_desc *desc) 365 + { 366 + uint32_t sec_gstat; 367 + 368 + raw_spin_lock(&desc->lock); 369 + 370 + sec_gstat = bfin_read32(SEC_GSTAT); 371 + if (sec_gstat & SEC_GSTAT_ERR) { 372 + 373 + switch (sec_gstat & SEC_GSTAT_ERRC) { 374 + case 0: 375 + handle_sec_sfi_fault(sec_gstat); 376 + break; 377 + case SEC_GSTAT_SCIERR: 378 + handle_sec_sci_fault(sec_gstat); 379 + break; 380 + case SEC_GSTAT_SSIERR: 381 + handle_sec_ssi_fault(sec_gstat); 382 + break; 383 + } 384 + 385 + 386 + } 387 + 388 + raw_spin_unlock(&desc->lock); 389 + } 390 + 391 + static int sec_suspend(void) 392 + { 393 + return 0; 394 + } 395 + 396 + static void sec_resume(void) 397 + { 398 + bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET); 399 + udelay(100); 400 + bfin_write_SEC_GCTL(SEC_GCTL_EN); 401 + bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); 402 + } 403 + 404 + static struct syscore_ops sec_pm_syscore_ops = { 405 + .suspend = sec_suspend, 406 + .resume = sec_resume, 407 + }; 408 + 409 + #endif 201 410 202 411 #ifdef CONFIG_SMP 203 412 static void bfin_internal_unmask_irq_chip(struct irq_data *d) ··· 501 276 502 277 static struct irq_chip bfin_core_irqchip = { 503 278 .name = "CORE", 504 - .irq_ack = bfin_ack_noop, 505 279 .irq_mask = bfin_core_mask_irq, 506 280 .irq_unmask = bfin_core_unmask_irq, 507 281 }; 508 282 509 283 static struct irq_chip bfin_internal_irqchip = { 510 284 .name = "INTN", 511 - .irq_ack = bfin_ack_noop, 512 285 .irq_mask = bfin_internal_mask_irq_chip, 513 286 .irq_unmask = bfin_internal_unmask_irq_chip, 514 - .irq_mask_ack = bfin_internal_mask_irq_chip, 515 287 .irq_disable = bfin_internal_mask_irq_chip, 516 288 .irq_enable = bfin_internal_unmask_irq_chip, 517 289 #ifdef CONFIG_SMP ··· 516 294 #endif 517 295 .irq_set_wake = bfin_internal_set_wake_chip, 518 296 }; 297 + 298 + #ifdef CONFIG_BF60x 299 + static struct irq_chip bfin_sec_irqchip = { 300 + .name = "SEC", 301 + .irq_mask_ack = bfin_sec_mask_ack_irq, 302 + .irq_mask = bfin_sec_mask_ack_irq, 303 + .irq_unmask = bfin_sec_unmask_irq, 304 + .irq_eoi = bfin_sec_unmask_irq, 305 + .irq_disable = bfin_sec_disable, 306 + .irq_enable = bfin_sec_enable, 307 + }; 308 + #endif 519 309 520 310 void bfin_handle_irq(unsigned irq) 521 311 { ··· 630 396 631 397 static struct irq_chip bfin_mac_status_irqchip = { 632 398 .name = "MACST", 633 - .irq_ack = bfin_ack_noop, 634 - .irq_mask_ack = bfin_mac_status_mask_irq, 635 399 .irq_mask = bfin_mac_status_mask_irq, 636 400 .irq_unmask = bfin_mac_status_unmask_irq, 637 401 .irq_set_wake = bfin_mac_status_set_wake, ··· 653 421 } else { 654 422 bfin_mac_status_ack_irq(irq); 655 423 pr_debug("IRQ %d:" 656 - " MASKED MAC ERROR INTERRUPT ASSERTED\n", 657 - irq); 424 + " MASKED MAC ERROR INTERRUPT ASSERTED\n", 425 + irq); 658 426 } 659 427 } else 660 428 printk(KERN_ERR 661 - "%s : %s : LINE %d :\nIRQ ?: MAC ERROR" 662 - " INTERRUPT ASSERTED BUT NO SOURCE FOUND" 663 - "(EMAC_SYSTAT=0x%X)\n", 664 - __func__, __FILE__, __LINE__, status); 429 + "%s : %s : LINE %d :\nIRQ ?: MAC ERROR" 430 + " INTERRUPT ASSERTED BUT NO SOURCE FOUND" 431 + "(EMAC_SYSTAT=0x%X)\n", 432 + __func__, __FILE__, __LINE__, status); 665 433 } 666 434 #endif 667 435 ··· 815 583 } 816 584 817 585 void bfin_demux_gpio_irq(unsigned int inta_irq, 818 - struct irq_desc *desc) 586 + struct irq_desc *desc) 819 587 { 820 588 unsigned int irq; 821 589 ··· 867 635 868 636 #else 869 637 638 + # ifndef CONFIG_BF60x 870 639 #define NR_PINT_SYS_IRQS 4 871 - #define NR_PINT_BITS 32 872 640 #define NR_PINTS 160 641 + # else 642 + #define NR_PINT_SYS_IRQS 6 643 + #define NR_PINTS 112 644 + #endif 645 + 646 + #define NR_PINT_BITS 32 873 647 #define IRQ_NOT_AVAIL 0xFF 874 648 875 649 #define PINT_2_BANK(x) ((x) >> 5) ··· 890 652 (struct bfin_pint_regs *)PINT1_MASK_SET, 891 653 (struct bfin_pint_regs *)PINT2_MASK_SET, 892 654 (struct bfin_pint_regs *)PINT3_MASK_SET, 655 + #ifdef CONFIG_BF60x 656 + (struct bfin_pint_regs *)PINT4_MASK_SET, 657 + (struct bfin_pint_regs *)PINT5_MASK_SET, 658 + #endif 893 659 }; 894 660 661 + #ifndef CONFIG_BF60x 895 662 inline unsigned int get_irq_base(u32 bank, u8 bmap) 896 663 { 897 664 unsigned int irq_base; ··· 909 666 910 667 return irq_base; 911 668 } 669 + #else 670 + inline unsigned int get_irq_base(u32 bank, u8 bmap) 671 + { 672 + unsigned int irq_base; 673 + 674 + irq_base = IRQ_PA0 + bank * 16 + bmap * 16; 675 + 676 + return irq_base; 677 + } 678 + #endif 912 679 913 680 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ 914 681 void init_pint_lut(void) ··· 1107 854 case 1: 1108 855 pint_irq = IRQ_PINT1; 1109 856 break; 857 + case 4: 858 + pint_irq = IRQ_PINT4; 859 + break; 860 + case 5: 861 + pint_irq = IRQ_PINT5; 862 + break; 1110 863 default: 1111 864 return -EINVAL; 1112 865 } ··· 1126 867 #endif 1127 868 1128 869 void bfin_demux_gpio_irq(unsigned int inta_irq, 1129 - struct irq_desc *desc) 870 + struct irq_desc *desc) 1130 871 { 1131 872 u32 bank, pint_val; 1132 873 u32 request, irq; 874 + u32 level_mask; 875 + int umask = 0; 876 + struct irq_chip *chip = irq_desc_get_chip(desc); 877 + 878 + if (chip->irq_mask_ack) { 879 + chip->irq_mask_ack(&desc->irq_data); 880 + } else { 881 + chip->irq_mask(&desc->irq_data); 882 + if (chip->irq_ack) 883 + chip->irq_ack(&desc->irq_data); 884 + } 1133 885 1134 886 switch (inta_irq) { 1135 887 case IRQ_PINT0: ··· 1155 885 case IRQ_PINT1: 1156 886 bank = 1; 1157 887 break; 888 + #ifdef CONFIG_BF60x 889 + case IRQ_PINT4: 890 + bank = 4; 891 + break; 892 + case IRQ_PINT5: 893 + bank = 5; 894 + break; 895 + #endif 1158 896 default: 1159 897 return; 1160 898 } ··· 1171 893 1172 894 request = pint[bank]->request; 1173 895 896 + level_mask = pint[bank]->edge_set & request; 897 + 1174 898 while (request) { 1175 899 if (request & 1) { 1176 900 irq = pint2irq_lut[pint_val] + SYS_IRQS; 901 + if (level_mask & PINT_BIT(pint_val)) { 902 + umask = 1; 903 + chip->irq_unmask(&desc->irq_data); 904 + } 1177 905 bfin_handle_irq(irq); 1178 906 } 1179 907 pint_val++; 1180 908 request >>= 1; 1181 909 } 1182 910 911 + if (!umask) 912 + chip->irq_unmask(&desc->irq_data); 1183 913 } 1184 914 #endif 1185 915 ··· 1237 951 int irq; 1238 952 unsigned long ilat = 0; 1239 953 954 + #ifndef CONFIG_BF60x 1240 955 /* Disable all the peripheral intrs - page 4-29 HW Ref manual */ 1241 956 #ifdef SIC_IMASK0 1242 957 bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); ··· 1245 958 # ifdef SIC_IMASK2 1246 959 bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); 1247 960 # endif 1248 - # ifdef CONFIG_SMP 961 + # if defined(CONFIG_SMP) || defined(CONFIG_ICC) 1249 962 bfin_write_SICB_IMASK0(SIC_UNMASK_ALL); 1250 963 bfin_write_SICB_IMASK1(SIC_UNMASK_ALL); 1251 964 # endif 1252 965 #else 1253 966 bfin_write_SIC_IMASK(SIC_UNMASK_ALL); 967 + #endif 968 + #else /* CONFIG_BF60x */ 969 + bfin_write_SEC_GCTL(SEC_GCTL_RESET); 1254 970 #endif 1255 971 1256 972 local_irq_disable(); ··· 1264 974 pint[1]->assign = CONFIG_PINT1_ASSIGN; 1265 975 pint[2]->assign = CONFIG_PINT2_ASSIGN; 1266 976 pint[3]->assign = CONFIG_PINT3_ASSIGN; 977 + # ifdef CONFIG_BF60x 978 + pint[4]->assign = CONFIG_PINT4_ASSIGN; 979 + pint[5]->assign = CONFIG_PINT5_ASSIGN; 980 + # endif 1267 981 # endif 1268 982 /* Whenever PINTx_ASSIGN is altered init_pint_lut() must be executed! */ 1269 983 init_pint_lut(); ··· 1280 986 irq_set_chip(irq, &bfin_internal_irqchip); 1281 987 1282 988 switch (irq) { 989 + #ifndef CONFIG_BF60x 1283 990 #if BFIN_GPIO_PINT 1284 991 case IRQ_PINT0: 1285 992 case IRQ_PINT1: ··· 1310 1015 bfin_demux_mac_status_irq); 1311 1016 break; 1312 1017 #endif 1313 - #ifdef CONFIG_SMP 1018 + #if defined(CONFIG_SMP) || defined(CONFIG_ICC) 1314 1019 case IRQ_SUPPLE_0: 1315 1020 case IRQ_SUPPLE_1: 1316 1021 irq_set_handler(irq, handle_percpu_irq); 1317 1022 break; 1023 + #endif 1318 1024 #endif 1319 1025 1320 1026 #ifdef CONFIG_TICKSOURCE_CORETMR ··· 1346 1050 1347 1051 init_mach_irq(); 1348 1052 1349 - #if defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE) 1053 + #ifndef CONFIG_BF60x 1054 + #if (defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) && !defined(CONFIG_BF60x) 1350 1055 for (irq = IRQ_MAC_PHYINT; irq <= IRQ_MAC_STMDONE; irq++) 1351 1056 irq_set_chip_and_handler(irq, &bfin_mac_status_irqchip, 1352 1057 handle_level_irq); ··· 1357 1060 irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++) 1358 1061 irq_set_chip_and_handler(irq, &bfin_gpio_irqchip, 1359 1062 handle_level_irq); 1360 - 1063 + #else 1064 + for (irq = BFIN_IRQ(0); irq <= SYS_IRQS; irq++) { 1065 + if (irq < CORE_IRQS) { 1066 + irq_set_chip(irq, &bfin_sec_irqchip); 1067 + __irq_set_handler(irq, handle_sec_fault, 0, NULL); 1068 + } else if (irq >= BFIN_IRQ(21) && irq <= BFIN_IRQ(26)) { 1069 + irq_set_chip(irq, &bfin_sec_irqchip); 1070 + irq_set_chained_handler(irq, bfin_demux_gpio_irq); 1071 + } else if (irq >= BFIN_IRQ(34) && irq <= BFIN_IRQ(37)) { 1072 + irq_set_chip(irq, &bfin_sec_irqchip); 1073 + irq_set_handler(irq, handle_percpu_irq); 1074 + } else { 1075 + irq_set_chip_and_handler(irq, &bfin_sec_irqchip, 1076 + handle_fasteoi_irq); 1077 + __irq_set_preflow_handler(irq, bfin_sec_preflow_handler); 1078 + } 1079 + } 1080 + for (irq = GPIO_IRQ_BASE; 1081 + irq < (GPIO_IRQ_BASE + MAX_BLACKFIN_GPIOS); irq++) 1082 + irq_set_chip_and_handler(irq, &bfin_gpio_irqchip, 1083 + handle_level_irq); 1084 + #endif 1361 1085 bfin_write_IMASK(0); 1362 1086 CSYNC(); 1363 1087 ilat = bfin_read_ILAT(); ··· 1390 1072 /* IMASK=xxx is equivalent to STI xx or bfin_irq_flags=xx, 1391 1073 * local_irq_enable() 1392 1074 */ 1075 + #ifndef CONFIG_BF60x 1393 1076 program_IAR(); 1394 1077 /* Therefore it's better to setup IARs before interrupts enabled */ 1395 1078 search_IAR(); 1396 1079 1397 1080 /* Enable interrupts IVG7-15 */ 1398 1081 bfin_irq_flags |= IMASK_IVG15 | 1399 - IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1400 - IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1082 + IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1083 + IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1084 + 1085 + bfin_sti(bfin_irq_flags); 1401 1086 1402 1087 /* This implicitly covers ANOMALY_05000171 1403 1088 * Boot-ROM code modifies SICA_IWRx wakeup registers ··· 1424 1103 #else 1425 1104 bfin_write_SIC_IWR(IWR_DISABLE_ALL); 1426 1105 #endif 1106 + #else /* CONFIG_BF60x */ 1107 + /* Enable interrupts IVG7-15 */ 1108 + bfin_irq_flags |= IMASK_IVG15 | 1109 + IMASK_IVG14 | IMASK_IVG13 | IMASK_IVG12 | IMASK_IVG11 | 1110 + IMASK_IVG10 | IMASK_IVG9 | IMASK_IVG8 | IMASK_IVG7 | IMASK_IVGHW; 1427 1111 1112 + 1113 + bfin_write_SEC_FCTL(SEC_FCTL_EN | SEC_FCTL_SYSRST_EN | SEC_FCTL_FLTIN_EN); 1114 + bfin_sec_enable_sci(SIC_SYSIRQ(IRQ_WATCH0)); 1115 + bfin_sec_enable_ssi(SIC_SYSIRQ(IRQ_WATCH0)); 1116 + bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_RESET); 1117 + udelay(100); 1118 + bfin_write_SEC_GCTL(SEC_GCTL_EN); 1119 + bfin_write_SEC_SCI(0, SEC_CCTL, SEC_CCTL_EN | SEC_CCTL_NMI_EN); 1120 + init_software_driven_irq(); 1121 + register_syscore_ops(&sec_pm_syscore_ops); 1122 + #endif 1428 1123 return 0; 1429 1124 } 1430 1125 ··· 1449 1112 #endif 1450 1113 static int vec_to_irq(int vec) 1451 1114 { 1115 + #ifndef CONFIG_BF60x 1452 1116 struct ivgx *ivg = ivg7_13[vec - IVG7].ifirst; 1453 1117 struct ivgx *ivg_stop = ivg7_13[vec - IVG7].istop; 1454 1118 unsigned long sic_status[3]; 1455 - 1119 + #endif 1456 1120 if (likely(vec == EVT_IVTMR_P)) 1457 1121 return IRQ_CORETMR; 1458 - 1122 + #ifndef CONFIG_BF60x 1459 1123 #ifdef SIC_ISR 1460 1124 sic_status[0] = bfin_read_SIC_IMASK() & bfin_read_SIC_ISR(); 1461 1125 #else ··· 1485 1147 #endif 1486 1148 return ivg->irqno; 1487 1149 } 1150 + #else 1151 + /* for bf60x read */ 1152 + return BFIN_IRQ(bfin_read_SEC_SCI(0, SEC_CSID)); 1153 + #endif /* end of CONFIG_BF60x */ 1488 1154 } 1489 1155 1490 1156 #ifdef CONFIG_DO_IRQ_L1