Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus

* 'upstream' of git://git.linux-mips.org/pub/scm/upstream-linus: (49 commits)
MIPS: JZ4740: Set nand ecc offsets for the qi_lb60 board
MIPS: JZ4740: qi_lb60: Add gpio-charger device
MIPS: Wire up syncfs(2).
MIPS: Hook up name_to_handle_at, open_by_handle_at and clock_adjtime syscalls.
MIPS: VR41xx: Convert to new irq_chip functions
MIPS: TXx9: Convert to new irq_chip functions
MIPS: SNI: Convert to new irq_chip functions
MIPS: Sibyte: Convert to new irq_chip functions
MIPS: IP32: Convert to new irq_chip functions
MIPS: IP27: Convert to new irq_chip functions
MIPS: IP22/IP28: Convert to new irq_chip functions
MIPS: RB532: Convert to new irq_chip functions
MIPS: PowerTV: Convert to new irq_chip functions
MIPS: PNX8550: Convert to new irq_chip functions
MIPS: PNX83xx: Convert to new irq_chip functions
MIPS: msp71xx: Convert to new irq_chip functions
MIPS: Loongson: Convert to new irq_chip functions
MIPS: Use generic show_interrupts()
MIPS: SMTC: Cleanup the hook mess and use irq_data
MIPS: SMTC: Use irq_data in smtc_forward_irq()
...

+2327 -1336
+4
arch/mips/Kconfig
··· 22 select HAVE_DMA_API_DEBUG 23 select HAVE_GENERIC_HARDIRQS 24 select GENERIC_IRQ_PROBE 25 select HAVE_ARCH_JUMP_LABEL 26 27 menu "Machine selection" ··· 862 863 config CFE 864 bool 865 866 config DMA_COHERENT 867 bool
··· 22 select HAVE_DMA_API_DEBUG 23 select HAVE_GENERIC_HARDIRQS 24 select GENERIC_IRQ_PROBE 25 + select GENERIC_IRQ_SHOW 26 select HAVE_ARCH_JUMP_LABEL 27 28 menu "Machine selection" ··· 861 862 config CFE 863 bool 864 + 865 + config ARCH_DMA_ADDR_T_64BIT 866 + def_bool (HIGHMEM && 64BIT_PHYS_ADDR) || 64BIT 867 868 config DMA_COHERENT 869 bool
+50 -48
arch/mips/alchemy/common/irq.c
··· 39 #include <asm/mach-pb1x00/pb1000.h> 40 #endif 41 42 - static int au1x_ic_settype(unsigned int irq, unsigned int flow_type); 43 44 /* NOTE on interrupt priorities: The original writers of this code said: 45 * ··· 218 }; 219 220 221 - static void au1x_ic0_unmask(unsigned int irq_nr) 222 { 223 - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; 224 au_writel(1 << bit, IC0_MASKSET); 225 au_writel(1 << bit, IC0_WAKESET); 226 au_sync(); 227 } 228 229 - static void au1x_ic1_unmask(unsigned int irq_nr) 230 { 231 - unsigned int bit = irq_nr - AU1000_INTC1_INT_BASE; 232 au_writel(1 << bit, IC1_MASKSET); 233 au_writel(1 << bit, IC1_WAKESET); 234 ··· 236 * nowhere in the current kernel sources is it disabled. --mlau 237 */ 238 #if defined(CONFIG_MIPS_PB1000) 239 - if (irq_nr == AU1000_GPIO15_INT) 240 au_writel(0x4000, PB1000_MDR); /* enable int */ 241 #endif 242 au_sync(); 243 } 244 245 - static void au1x_ic0_mask(unsigned int irq_nr) 246 { 247 - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; 248 au_writel(1 << bit, IC0_MASKCLR); 249 au_writel(1 << bit, IC0_WAKECLR); 250 au_sync(); 251 } 252 253 - static void au1x_ic1_mask(unsigned int irq_nr) 254 { 255 - unsigned int bit = irq_nr - AU1000_INTC1_INT_BASE; 256 au_writel(1 << bit, IC1_MASKCLR); 257 au_writel(1 << bit, IC1_WAKECLR); 258 au_sync(); 259 } 260 261 - static void au1x_ic0_ack(unsigned int irq_nr) 262 { 263 - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; 264 265 /* 266 * This may assume that we don't get interrupts from ··· 271 au_sync(); 272 } 273 274 - static void au1x_ic1_ack(unsigned int irq_nr) 275 { 276 - unsigned int bit = irq_nr - AU1000_INTC1_INT_BASE; 277 278 /* 279 * This may assume that we don't get interrupts from ··· 284 au_sync(); 285 } 286 287 - static void au1x_ic0_maskack(unsigned int irq_nr) 288 { 289 - unsigned int bit = irq_nr - AU1000_INTC0_INT_BASE; 290 291 au_writel(1 << bit, IC0_WAKECLR); 292 au_writel(1 << bit, IC0_MASKCLR); ··· 295 au_sync(); 296 } 297 298 - static void au1x_ic1_maskack(unsigned int irq_nr) 299 { 300 - unsigned int bit = irq_nr - AU1000_INTC1_INT_BASE; 301 302 au_writel(1 << bit, IC1_WAKECLR); 303 au_writel(1 << bit, IC1_MASKCLR); ··· 306 au_sync(); 307 } 308 309 - static int au1x_ic1_setwake(unsigned int irq, unsigned int on) 310 { 311 - int bit = irq - AU1000_INTC1_INT_BASE; 312 unsigned long wakemsk, flags; 313 314 /* only GPIO 0-7 can act as wakeup source. Fortunately these ··· 336 */ 337 static struct irq_chip au1x_ic0_chip = { 338 .name = "Alchemy-IC0", 339 - .ack = au1x_ic0_ack, 340 - .mask = au1x_ic0_mask, 341 - .mask_ack = au1x_ic0_maskack, 342 - .unmask = au1x_ic0_unmask, 343 - .set_type = au1x_ic_settype, 344 }; 345 346 static struct irq_chip au1x_ic1_chip = { 347 .name = "Alchemy-IC1", 348 - .ack = au1x_ic1_ack, 349 - .mask = au1x_ic1_mask, 350 - .mask_ack = au1x_ic1_maskack, 351 - .unmask = au1x_ic1_unmask, 352 - .set_type = au1x_ic_settype, 353 - .set_wake = au1x_ic1_setwake, 354 }; 355 356 - static int au1x_ic_settype(unsigned int irq, unsigned int flow_type) 357 { 358 struct irq_chip *chip; 359 unsigned long icr[6]; 360 - unsigned int bit, ic; 361 int ret; 362 363 if (irq >= AU1000_INTC1_INT_BASE) { ··· 389 au_writel(1 << bit, icr[5]); 390 au_writel(1 << bit, icr[4]); 391 au_writel(1 << bit, icr[0]); 392 - set_irq_chip_and_handler_name(irq, chip, 393 - handle_edge_irq, "riseedge"); 394 break; 395 case IRQ_TYPE_EDGE_FALLING: /* 0:1:0 */ 396 au_writel(1 << bit, icr[5]); 397 au_writel(1 << bit, icr[1]); 398 au_writel(1 << bit, icr[3]); 399 - set_irq_chip_and_handler_name(irq, chip, 400 - handle_edge_irq, "falledge"); 401 break; 402 case IRQ_TYPE_EDGE_BOTH: /* 0:1:1 */ 403 au_writel(1 << bit, icr[5]); 404 au_writel(1 << bit, icr[1]); 405 au_writel(1 << bit, icr[0]); 406 - set_irq_chip_and_handler_name(irq, chip, 407 - handle_edge_irq, "bothedge"); 408 break; 409 case IRQ_TYPE_LEVEL_HIGH: /* 1:0:1 */ 410 au_writel(1 << bit, icr[2]); 411 au_writel(1 << bit, icr[4]); 412 au_writel(1 << bit, icr[0]); 413 - set_irq_chip_and_handler_name(irq, chip, 414 - handle_level_irq, "hilevel"); 415 break; 416 case IRQ_TYPE_LEVEL_LOW: /* 1:1:0 */ 417 au_writel(1 << bit, icr[2]); 418 au_writel(1 << bit, icr[1]); 419 au_writel(1 << bit, icr[3]); 420 - set_irq_chip_and_handler_name(irq, chip, 421 - handle_level_irq, "lowlevel"); 422 break; 423 case IRQ_TYPE_NONE: /* 0:0:0 */ 424 au_writel(1 << bit, icr[5]); 425 au_writel(1 << bit, icr[4]); 426 au_writel(1 << bit, icr[3]); 427 - /* set at least chip so we can call set_irq_type() on it */ 428 - set_irq_chip(irq, chip); 429 break; 430 default: 431 ret = -EINVAL; 432 } 433 au_sync(); 434 435 return ret; ··· 506 */ 507 for (i = AU1000_INTC0_INT_BASE; 508 (i < AU1000_INTC0_INT_BASE + 32); i++) 509 - au1x_ic_settype(i, IRQ_TYPE_NONE); 510 511 for (i = AU1000_INTC1_INT_BASE; 512 (i < AU1000_INTC1_INT_BASE + 32); i++) 513 - au1x_ic_settype(i, IRQ_TYPE_NONE); 514 515 /* 516 * Initialize IC0, which is fixed per processor. ··· 528 au_writel(1 << bit, IC0_ASSIGNSET); 529 } 530 531 - au1x_ic_settype(irq_nr, map->im_type); 532 ++map; 533 } 534
··· 39 #include <asm/mach-pb1x00/pb1000.h> 40 #endif 41 42 + static int au1x_ic_settype(struct irq_data *d, unsigned int flow_type); 43 44 /* NOTE on interrupt priorities: The original writers of this code said: 45 * ··· 218 }; 219 220 221 + static void au1x_ic0_unmask(struct irq_data *d) 222 { 223 + unsigned int bit = d->irq - AU1000_INTC0_INT_BASE; 224 au_writel(1 << bit, IC0_MASKSET); 225 au_writel(1 << bit, IC0_WAKESET); 226 au_sync(); 227 } 228 229 + static void au1x_ic1_unmask(struct irq_data *d) 230 { 231 + unsigned int bit = d->irq - AU1000_INTC1_INT_BASE; 232 au_writel(1 << bit, IC1_MASKSET); 233 au_writel(1 << bit, IC1_WAKESET); 234 ··· 236 * nowhere in the current kernel sources is it disabled. --mlau 237 */ 238 #if defined(CONFIG_MIPS_PB1000) 239 + if (d->irq == AU1000_GPIO15_INT) 240 au_writel(0x4000, PB1000_MDR); /* enable int */ 241 #endif 242 au_sync(); 243 } 244 245 + static void au1x_ic0_mask(struct irq_data *d) 246 { 247 + unsigned int bit = d->irq - AU1000_INTC0_INT_BASE; 248 au_writel(1 << bit, IC0_MASKCLR); 249 au_writel(1 << bit, IC0_WAKECLR); 250 au_sync(); 251 } 252 253 + static void au1x_ic1_mask(struct irq_data *d) 254 { 255 + unsigned int bit = d->irq - AU1000_INTC1_INT_BASE; 256 au_writel(1 << bit, IC1_MASKCLR); 257 au_writel(1 << bit, IC1_WAKECLR); 258 au_sync(); 259 } 260 261 + static void au1x_ic0_ack(struct irq_data *d) 262 { 263 + unsigned int bit = d->irq - AU1000_INTC0_INT_BASE; 264 265 /* 266 * This may assume that we don't get interrupts from ··· 271 au_sync(); 272 } 273 274 + static void au1x_ic1_ack(struct irq_data *d) 275 { 276 + unsigned int bit = d->irq - AU1000_INTC1_INT_BASE; 277 278 /* 279 * This may assume that we don't get interrupts from ··· 284 au_sync(); 285 } 286 287 + static void au1x_ic0_maskack(struct irq_data *d) 288 { 289 + unsigned int bit = d->irq - AU1000_INTC0_INT_BASE; 290 291 au_writel(1 << bit, IC0_WAKECLR); 292 au_writel(1 << bit, IC0_MASKCLR); ··· 295 au_sync(); 296 } 297 298 + static void au1x_ic1_maskack(struct irq_data *d) 299 { 300 + unsigned int bit = d->irq - AU1000_INTC1_INT_BASE; 301 302 au_writel(1 << bit, IC1_WAKECLR); 303 au_writel(1 << bit, IC1_MASKCLR); ··· 306 au_sync(); 307 } 308 309 + static int au1x_ic1_setwake(struct irq_data *d, unsigned int on) 310 { 311 + int bit = d->irq - AU1000_INTC1_INT_BASE; 312 unsigned long wakemsk, flags; 313 314 /* only GPIO 0-7 can act as wakeup source. Fortunately these ··· 336 */ 337 static struct irq_chip au1x_ic0_chip = { 338 .name = "Alchemy-IC0", 339 + .irq_ack = au1x_ic0_ack, 340 + .irq_mask = au1x_ic0_mask, 341 + .irq_mask_ack = au1x_ic0_maskack, 342 + .irq_unmask = au1x_ic0_unmask, 343 + .irq_set_type = au1x_ic_settype, 344 }; 345 346 static struct irq_chip au1x_ic1_chip = { 347 .name = "Alchemy-IC1", 348 + .irq_ack = au1x_ic1_ack, 349 + .irq_mask = au1x_ic1_mask, 350 + .irq_mask_ack = au1x_ic1_maskack, 351 + .irq_unmask = au1x_ic1_unmask, 352 + .irq_set_type = au1x_ic_settype, 353 + .irq_set_wake = au1x_ic1_setwake, 354 }; 355 356 + static int au1x_ic_settype(struct irq_data *d, unsigned int flow_type) 357 { 358 struct irq_chip *chip; 359 unsigned long icr[6]; 360 + unsigned int bit, ic, irq = d->irq; 361 + irq_flow_handler_t handler = NULL; 362 + unsigned char *name = NULL; 363 int ret; 364 365 if (irq >= AU1000_INTC1_INT_BASE) { ··· 387 au_writel(1 << bit, icr[5]); 388 au_writel(1 << bit, icr[4]); 389 au_writel(1 << bit, icr[0]); 390 + handler = handle_edge_irq; 391 + name = "riseedge"; 392 break; 393 case IRQ_TYPE_EDGE_FALLING: /* 0:1:0 */ 394 au_writel(1 << bit, icr[5]); 395 au_writel(1 << bit, icr[1]); 396 au_writel(1 << bit, icr[3]); 397 + handler = handle_edge_irq; 398 + name = "falledge"; 399 break; 400 case IRQ_TYPE_EDGE_BOTH: /* 0:1:1 */ 401 au_writel(1 << bit, icr[5]); 402 au_writel(1 << bit, icr[1]); 403 au_writel(1 << bit, icr[0]); 404 + handler = handle_edge_irq; 405 + name = "bothedge"; 406 break; 407 case IRQ_TYPE_LEVEL_HIGH: /* 1:0:1 */ 408 au_writel(1 << bit, icr[2]); 409 au_writel(1 << bit, icr[4]); 410 au_writel(1 << bit, icr[0]); 411 + handler = handle_level_irq; 412 + name = "hilevel"; 413 break; 414 case IRQ_TYPE_LEVEL_LOW: /* 1:1:0 */ 415 au_writel(1 << bit, icr[2]); 416 au_writel(1 << bit, icr[1]); 417 au_writel(1 << bit, icr[3]); 418 + handler = handle_level_irq; 419 + name = "lowlevel"; 420 break; 421 case IRQ_TYPE_NONE: /* 0:0:0 */ 422 au_writel(1 << bit, icr[5]); 423 au_writel(1 << bit, icr[4]); 424 au_writel(1 << bit, icr[3]); 425 break; 426 default: 427 ret = -EINVAL; 428 } 429 + __irq_set_chip_handler_name_locked(d->irq, chip, handler, name); 430 + 431 au_sync(); 432 433 return ret; ··· 504 */ 505 for (i = AU1000_INTC0_INT_BASE; 506 (i < AU1000_INTC0_INT_BASE + 32); i++) 507 + au1x_ic_settype(irq_get_irq_data(i), IRQ_TYPE_NONE); 508 509 for (i = AU1000_INTC1_INT_BASE; 510 (i < AU1000_INTC1_INT_BASE + 32); i++) 511 + au1x_ic_settype(irq_get_irq_data(i), IRQ_TYPE_NONE); 512 513 /* 514 * Initialize IC0, which is fixed per processor. ··· 526 au_writel(1 << bit, IC0_ASSIGNSET); 527 } 528 529 + au1x_ic_settype(irq_get_irq_data(irq_nr), map->im_type); 530 ++map; 531 } 532
+9 -9
arch/mips/alchemy/devboards/bcsr.c
··· 97 * CPLD generates tons of spurious interrupts (at least on my DB1200). 98 * -- mlau 99 */ 100 - static void bcsr_irq_mask(unsigned int irq_nr) 101 { 102 - unsigned short v = 1 << (irq_nr - bcsr_csc_base); 103 __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR); 104 __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); 105 wmb(); 106 } 107 108 - static void bcsr_irq_maskack(unsigned int irq_nr) 109 { 110 - unsigned short v = 1 << (irq_nr - bcsr_csc_base); 111 __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR); 112 __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); 113 __raw_writew(v, bcsr_virt + BCSR_REG_INTSTAT); /* ack */ 114 wmb(); 115 } 116 117 - static void bcsr_irq_unmask(unsigned int irq_nr) 118 { 119 - unsigned short v = 1 << (irq_nr - bcsr_csc_base); 120 __raw_writew(v, bcsr_virt + BCSR_REG_INTSET); 121 __raw_writew(v, bcsr_virt + BCSR_REG_MASKSET); 122 wmb(); ··· 124 125 static struct irq_chip bcsr_irq_type = { 126 .name = "CPLD", 127 - .mask = bcsr_irq_mask, 128 - .mask_ack = bcsr_irq_maskack, 129 - .unmask = bcsr_irq_unmask, 130 }; 131 132 void __init bcsr_init_irq(int csc_start, int csc_end, int hook_irq)
··· 97 * CPLD generates tons of spurious interrupts (at least on my DB1200). 98 * -- mlau 99 */ 100 + static void bcsr_irq_mask(struct irq_data *d) 101 { 102 + unsigned short v = 1 << (d->irq - bcsr_csc_base); 103 __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR); 104 __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); 105 wmb(); 106 } 107 108 + static void bcsr_irq_maskack(struct irq_data *d) 109 { 110 + unsigned short v = 1 << (d->irq - bcsr_csc_base); 111 __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR); 112 __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR); 113 __raw_writew(v, bcsr_virt + BCSR_REG_INTSTAT); /* ack */ 114 wmb(); 115 } 116 117 + static void bcsr_irq_unmask(struct irq_data *d) 118 { 119 + unsigned short v = 1 << (d->irq - bcsr_csc_base); 120 __raw_writew(v, bcsr_virt + BCSR_REG_INTSET); 121 __raw_writew(v, bcsr_virt + BCSR_REG_MASKSET); 122 wmb(); ··· 124 125 static struct irq_chip bcsr_irq_type = { 126 .name = "CPLD", 127 + .irq_mask = bcsr_irq_mask, 128 + .irq_mask_ack = bcsr_irq_maskack, 129 + .irq_unmask = bcsr_irq_unmask, 130 }; 131 132 void __init bcsr_init_irq(int csc_start, int csc_end, int hook_irq)
+21 -21
arch/mips/ar7/irq.c
··· 49 50 static int ar7_irq_base; 51 52 - static void ar7_unmask_irq(unsigned int irq) 53 { 54 - writel(1 << ((irq - ar7_irq_base) % 32), 55 - REG(ESR_OFFSET(irq - ar7_irq_base))); 56 } 57 58 - static void ar7_mask_irq(unsigned int irq) 59 { 60 - writel(1 << ((irq - ar7_irq_base) % 32), 61 - REG(ECR_OFFSET(irq - ar7_irq_base))); 62 } 63 64 - static void ar7_ack_irq(unsigned int irq) 65 { 66 - writel(1 << ((irq - ar7_irq_base) % 32), 67 - REG(CR_OFFSET(irq - ar7_irq_base))); 68 } 69 70 - static void ar7_unmask_sec_irq(unsigned int irq) 71 { 72 - writel(1 << (irq - ar7_irq_base - 40), REG(SEC_ESR_OFFSET)); 73 } 74 75 - static void ar7_mask_sec_irq(unsigned int irq) 76 { 77 - writel(1 << (irq - ar7_irq_base - 40), REG(SEC_ECR_OFFSET)); 78 } 79 80 - static void ar7_ack_sec_irq(unsigned int irq) 81 { 82 - writel(1 << (irq - ar7_irq_base - 40), REG(SEC_CR_OFFSET)); 83 } 84 85 static struct irq_chip ar7_irq_type = { 86 .name = "AR7", 87 - .unmask = ar7_unmask_irq, 88 - .mask = ar7_mask_irq, 89 - .ack = ar7_ack_irq 90 }; 91 92 static struct irq_chip ar7_sec_irq_type = { 93 .name = "AR7", 94 - .unmask = ar7_unmask_sec_irq, 95 - .mask = ar7_mask_sec_irq, 96 - .ack = ar7_ack_sec_irq, 97 }; 98 99 static struct irqaction ar7_cascade_action = {
··· 49 50 static int ar7_irq_base; 51 52 + static void ar7_unmask_irq(struct irq_data *d) 53 { 54 + writel(1 << ((d->irq - ar7_irq_base) % 32), 55 + REG(ESR_OFFSET(d->irq - ar7_irq_base))); 56 } 57 58 + static void ar7_mask_irq(struct irq_data *d) 59 { 60 + writel(1 << ((d->irq - ar7_irq_base) % 32), 61 + REG(ECR_OFFSET(d->irq - ar7_irq_base))); 62 } 63 64 + static void ar7_ack_irq(struct irq_data *d) 65 { 66 + writel(1 << ((d->irq - ar7_irq_base) % 32), 67 + REG(CR_OFFSET(d->irq - ar7_irq_base))); 68 } 69 70 + static void ar7_unmask_sec_irq(struct irq_data *d) 71 { 72 + writel(1 << (d->irq - ar7_irq_base - 40), REG(SEC_ESR_OFFSET)); 73 } 74 75 + static void ar7_mask_sec_irq(struct irq_data *d) 76 { 77 + writel(1 << (d->irq - ar7_irq_base - 40), REG(SEC_ECR_OFFSET)); 78 } 79 80 + static void ar7_ack_sec_irq(struct irq_data *d) 81 { 82 + writel(1 << (d->irq - ar7_irq_base - 40), REG(SEC_CR_OFFSET)); 83 } 84 85 static struct irq_chip ar7_irq_type = { 86 .name = "AR7", 87 + .irq_unmask = ar7_unmask_irq, 88 + .irq_mask = ar7_mask_irq, 89 + .irq_ack = ar7_ack_irq 90 }; 91 92 static struct irq_chip ar7_sec_irq_type = { 93 .name = "AR7", 94 + .irq_unmask = ar7_unmask_sec_irq, 95 + .irq_mask = ar7_mask_sec_irq, 96 + .irq_ack = ar7_ack_sec_irq, 97 }; 98 99 static struct irqaction ar7_cascade_action = {
+10 -14
arch/mips/ath79/irq.c
··· 62 spurious_interrupt(); 63 } 64 65 - static void ar71xx_misc_irq_unmask(unsigned int irq) 66 { 67 void __iomem *base = ath79_reset_base; 68 u32 t; 69 - 70 - irq -= ATH79_MISC_IRQ_BASE; 71 72 t = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 73 __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_MISC_INT_ENABLE); ··· 75 __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 76 } 77 78 - static void ar71xx_misc_irq_mask(unsigned int irq) 79 { 80 void __iomem *base = ath79_reset_base; 81 u32 t; 82 - 83 - irq -= ATH79_MISC_IRQ_BASE; 84 85 t = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 86 __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_MISC_INT_ENABLE); ··· 88 __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 89 } 90 91 - static void ar724x_misc_irq_ack(unsigned int irq) 92 { 93 void __iomem *base = ath79_reset_base; 94 u32 t; 95 - 96 - irq -= ATH79_MISC_IRQ_BASE; 97 98 t = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_STATUS); 99 __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_MISC_INT_STATUS); ··· 103 104 static struct irq_chip ath79_misc_irq_chip = { 105 .name = "MISC", 106 - .unmask = ar71xx_misc_irq_unmask, 107 - .mask = ar71xx_misc_irq_mask, 108 }; 109 110 static void __init ath79_misc_irq_init(void) ··· 116 __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); 117 118 if (soc_is_ar71xx() || soc_is_ar913x()) 119 - ath79_misc_irq_chip.mask_ack = ar71xx_misc_irq_mask; 120 else if (soc_is_ar724x()) 121 - ath79_misc_irq_chip.ack = ar724x_misc_irq_ack; 122 else 123 BUG(); 124 125 for (i = ATH79_MISC_IRQ_BASE; 126 i < ATH79_MISC_IRQ_BASE + ATH79_MISC_IRQ_COUNT; i++) { 127 - irq_desc[i].status = IRQ_DISABLED; 128 set_irq_chip_and_handler(i, &ath79_misc_irq_chip, 129 handle_level_irq); 130 }
··· 62 spurious_interrupt(); 63 } 64 65 + static void ar71xx_misc_irq_unmask(struct irq_data *d) 66 { 67 + unsigned int irq = d->irq - ATH79_MISC_IRQ_BASE; 68 void __iomem *base = ath79_reset_base; 69 u32 t; 70 71 t = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 72 __raw_writel(t | (1 << irq), base + AR71XX_RESET_REG_MISC_INT_ENABLE); ··· 76 __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 77 } 78 79 + static void ar71xx_misc_irq_mask(struct irq_data *d) 80 { 81 + unsigned int irq = d->irq - ATH79_MISC_IRQ_BASE; 82 void __iomem *base = ath79_reset_base; 83 u32 t; 84 85 t = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 86 __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_MISC_INT_ENABLE); ··· 90 __raw_readl(base + AR71XX_RESET_REG_MISC_INT_ENABLE); 91 } 92 93 + static void ar724x_misc_irq_ack(struct irq_data *d) 94 { 95 + unsigned int irq = d->irq - ATH79_MISC_IRQ_BASE; 96 void __iomem *base = ath79_reset_base; 97 u32 t; 98 99 t = __raw_readl(base + AR71XX_RESET_REG_MISC_INT_STATUS); 100 __raw_writel(t & ~(1 << irq), base + AR71XX_RESET_REG_MISC_INT_STATUS); ··· 106 107 static struct irq_chip ath79_misc_irq_chip = { 108 .name = "MISC", 109 + .irq_unmask = ar71xx_misc_irq_unmask, 110 + .irq_mask = ar71xx_misc_irq_mask, 111 }; 112 113 static void __init ath79_misc_irq_init(void) ··· 119 __raw_writel(0, base + AR71XX_RESET_REG_MISC_INT_STATUS); 120 121 if (soc_is_ar71xx() || soc_is_ar913x()) 122 + ath79_misc_irq_chip.irq_mask_ack = ar71xx_misc_irq_mask; 123 else if (soc_is_ar724x()) 124 + ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; 125 else 126 BUG(); 127 128 for (i = ATH79_MISC_IRQ_BASE; 129 i < ATH79_MISC_IRQ_BASE + ATH79_MISC_IRQ_COUNT; i++) { 130 set_irq_chip_and_handler(i, &ath79_misc_irq_chip, 131 handle_level_irq); 132 }
+32 -45
arch/mips/bcm63xx/irq.c
··· 76 * internal IRQs operations: only mask/unmask on PERF irq mask 77 * register. 78 */ 79 - static inline void bcm63xx_internal_irq_mask(unsigned int irq) 80 { 81 u32 mask; 82 83 - irq -= IRQ_INTERNAL_BASE; 84 mask = bcm_perf_readl(PERF_IRQMASK_REG); 85 mask &= ~(1 << irq); 86 bcm_perf_writel(mask, PERF_IRQMASK_REG); 87 } 88 89 - static void bcm63xx_internal_irq_unmask(unsigned int irq) 90 { 91 u32 mask; 92 93 - irq -= IRQ_INTERNAL_BASE; 94 mask = bcm_perf_readl(PERF_IRQMASK_REG); 95 mask |= (1 << irq); 96 bcm_perf_writel(mask, PERF_IRQMASK_REG); 97 - } 98 - 99 - static unsigned int bcm63xx_internal_irq_startup(unsigned int irq) 100 - { 101 - bcm63xx_internal_irq_unmask(irq); 102 - return 0; 103 } 104 105 /* 106 * external IRQs operations: mask/unmask and clear on PERF external 107 * irq control register. 108 */ 109 - static void bcm63xx_external_irq_mask(unsigned int irq) 110 { 111 u32 reg; 112 113 - irq -= IRQ_EXT_BASE; 114 reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG); 115 reg &= ~EXTIRQ_CFG_MASK(irq); 116 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 117 } 118 119 - static void bcm63xx_external_irq_unmask(unsigned int irq) 120 { 121 u32 reg; 122 123 - irq -= IRQ_EXT_BASE; 124 reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG); 125 reg |= EXTIRQ_CFG_MASK(irq); 126 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 127 } 128 129 - static void bcm63xx_external_irq_clear(unsigned int irq) 130 { 131 u32 reg; 132 133 - irq -= IRQ_EXT_BASE; 134 reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG); 135 reg |= EXTIRQ_CFG_CLEAR(irq); 136 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 137 } 138 139 - static unsigned int bcm63xx_external_irq_startup(unsigned int irq) 140 { 141 - set_c0_status(0x100 << (irq - IRQ_MIPS_BASE)); 142 irq_enable_hazard(); 143 - bcm63xx_external_irq_unmask(irq); 144 return 0; 145 } 146 147 - static void bcm63xx_external_irq_shutdown(unsigned int irq) 148 { 149 - bcm63xx_external_irq_mask(irq); 150 - clear_c0_status(0x100 << (irq - IRQ_MIPS_BASE)); 151 irq_disable_hazard(); 152 } 153 154 - static int bcm63xx_external_irq_set_type(unsigned int irq, 155 unsigned int flow_type) 156 { 157 u32 reg; 158 - struct irq_desc *desc = irq_desc + irq; 159 - 160 - irq -= IRQ_EXT_BASE; 161 162 flow_type &= IRQ_TYPE_SENSE_MASK; 163 ··· 191 } 192 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 193 194 - if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) { 195 - desc->status |= IRQ_LEVEL; 196 - desc->handle_irq = handle_level_irq; 197 - } else { 198 - desc->handle_irq = handle_edge_irq; 199 - } 200 201 - return 0; 202 } 203 204 static struct irq_chip bcm63xx_internal_irq_chip = { 205 .name = "bcm63xx_ipic", 206 - .startup = bcm63xx_internal_irq_startup, 207 - .shutdown = bcm63xx_internal_irq_mask, 208 - 209 - .mask = bcm63xx_internal_irq_mask, 210 - .mask_ack = bcm63xx_internal_irq_mask, 211 - .unmask = bcm63xx_internal_irq_unmask, 212 }; 213 214 static struct irq_chip bcm63xx_external_irq_chip = { 215 .name = "bcm63xx_epic", 216 - .startup = bcm63xx_external_irq_startup, 217 - .shutdown = bcm63xx_external_irq_shutdown, 218 219 - .ack = bcm63xx_external_irq_clear, 220 221 - .mask = bcm63xx_external_irq_mask, 222 - .unmask = bcm63xx_external_irq_unmask, 223 224 - .set_type = bcm63xx_external_irq_set_type, 225 }; 226 227 static struct irqaction cpu_ip2_cascade_action = {
··· 76 * internal IRQs operations: only mask/unmask on PERF irq mask 77 * register. 78 */ 79 + static inline void bcm63xx_internal_irq_mask(struct irq_data *d) 80 { 81 + unsigned int irq = d->irq - IRQ_INTERNAL_BASE; 82 u32 mask; 83 84 mask = bcm_perf_readl(PERF_IRQMASK_REG); 85 mask &= ~(1 << irq); 86 bcm_perf_writel(mask, PERF_IRQMASK_REG); 87 } 88 89 + static void bcm63xx_internal_irq_unmask(struct irq_data *d) 90 { 91 + unsigned int irq = d->irq - IRQ_INTERNAL_BASE; 92 u32 mask; 93 94 mask = bcm_perf_readl(PERF_IRQMASK_REG); 95 mask |= (1 << irq); 96 bcm_perf_writel(mask, PERF_IRQMASK_REG); 97 } 98 99 /* 100 * external IRQs operations: mask/unmask and clear on PERF external 101 * irq control register. 102 */ 103 + static void bcm63xx_external_irq_mask(struct irq_data *d) 104 { 105 + unsigned int irq = d->irq - IRQ_EXT_BASE; 106 u32 reg; 107 108 reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG); 109 reg &= ~EXTIRQ_CFG_MASK(irq); 110 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 111 } 112 113 + static void bcm63xx_external_irq_unmask(struct irq_data *d) 114 { 115 + unsigned int irq = d->irq - IRQ_EXT_BASE; 116 u32 reg; 117 118 reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG); 119 reg |= EXTIRQ_CFG_MASK(irq); 120 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 121 } 122 123 + static void bcm63xx_external_irq_clear(struct irq_data *d) 124 { 125 + unsigned int irq = d->irq - IRQ_EXT_BASE; 126 u32 reg; 127 128 reg = bcm_perf_readl(PERF_EXTIRQ_CFG_REG); 129 reg |= EXTIRQ_CFG_CLEAR(irq); 130 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 131 } 132 133 + static unsigned int bcm63xx_external_irq_startup(struct irq_data *d) 134 { 135 + set_c0_status(0x100 << (d->irq - IRQ_MIPS_BASE)); 136 irq_enable_hazard(); 137 + bcm63xx_external_irq_unmask(d); 138 return 0; 139 } 140 141 + static void bcm63xx_external_irq_shutdown(struct irq_data *d) 142 { 143 + bcm63xx_external_irq_mask(d); 144 + clear_c0_status(0x100 << (d->irq - IRQ_MIPS_BASE)); 145 irq_disable_hazard(); 146 } 147 148 + static int bcm63xx_external_irq_set_type(struct irq_data *d, 149 unsigned int flow_type) 150 { 151 + unsigned int irq = d->irq - IRQ_EXT_BASE; 152 u32 reg; 153 154 flow_type &= IRQ_TYPE_SENSE_MASK; 155 ··· 199 } 200 bcm_perf_writel(reg, PERF_EXTIRQ_CFG_REG); 201 202 + irqd_set_trigger_type(d, flow_type); 203 + if (flow_type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) 204 + __irq_set_handler_locked(d->irq, handle_level_irq); 205 + else 206 + __irq_set_handler_locked(d->irq, handle_edge_irq); 207 208 + return IRQ_SET_MASK_OK_NOCOPY; 209 } 210 211 static struct irq_chip bcm63xx_internal_irq_chip = { 212 .name = "bcm63xx_ipic", 213 + .irq_mask = bcm63xx_internal_irq_mask, 214 + .irq_unmask = bcm63xx_internal_irq_unmask, 215 }; 216 217 static struct irq_chip bcm63xx_external_irq_chip = { 218 .name = "bcm63xx_epic", 219 + .irq_startup = bcm63xx_external_irq_startup, 220 + .irq_shutdown = bcm63xx_external_irq_shutdown, 221 222 + .irq_ack = bcm63xx_external_irq_clear, 223 224 + .irq_mask = bcm63xx_external_irq_mask, 225 + .irq_unmask = bcm63xx_external_irq_unmask, 226 227 + .irq_set_type = bcm63xx_external_irq_set_type, 228 }; 229 230 static struct irqaction cpu_ip2_cascade_action = {
+14 -46
arch/mips/dec/ioasic-irq.c
··· 17 #include <asm/dec/ioasic_addrs.h> 18 #include <asm/dec/ioasic_ints.h> 19 20 - 21 static int ioasic_irq_base; 22 23 - 24 - static inline void unmask_ioasic_irq(unsigned int irq) 25 { 26 u32 simr; 27 28 simr = ioasic_read(IO_REG_SIMR); 29 - simr |= (1 << (irq - ioasic_irq_base)); 30 ioasic_write(IO_REG_SIMR, simr); 31 } 32 33 - static inline void mask_ioasic_irq(unsigned int irq) 34 { 35 u32 simr; 36 37 simr = ioasic_read(IO_REG_SIMR); 38 - simr &= ~(1 << (irq - ioasic_irq_base)); 39 ioasic_write(IO_REG_SIMR, simr); 40 } 41 42 - static inline void clear_ioasic_irq(unsigned int irq) 43 { 44 - u32 sir; 45 - 46 - sir = ~(1 << (irq - ioasic_irq_base)); 47 - ioasic_write(IO_REG_SIR, sir); 48 - } 49 - 50 - static inline void ack_ioasic_irq(unsigned int irq) 51 - { 52 - mask_ioasic_irq(irq); 53 fast_iob(); 54 - } 55 - 56 - static inline void end_ioasic_irq(unsigned int irq) 57 - { 58 - if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 59 - unmask_ioasic_irq(irq); 60 } 61 62 static struct irq_chip ioasic_irq_type = { 63 .name = "IO-ASIC", 64 - .ack = ack_ioasic_irq, 65 - .mask = mask_ioasic_irq, 66 - .mask_ack = ack_ioasic_irq, 67 - .unmask = unmask_ioasic_irq, 68 }; 69 - 70 - 71 - #define unmask_ioasic_dma_irq unmask_ioasic_irq 72 - 73 - #define mask_ioasic_dma_irq mask_ioasic_irq 74 - 75 - #define ack_ioasic_dma_irq ack_ioasic_irq 76 - 77 - static inline void end_ioasic_dma_irq(unsigned int irq) 78 - { 79 - clear_ioasic_irq(irq); 80 - fast_iob(); 81 - end_ioasic_irq(irq); 82 - } 83 84 static struct irq_chip ioasic_dma_irq_type = { 85 .name = "IO-ASIC-DMA", 86 - .ack = ack_ioasic_dma_irq, 87 - .mask = mask_ioasic_dma_irq, 88 - .mask_ack = ack_ioasic_dma_irq, 89 - .unmask = unmask_ioasic_dma_irq, 90 - .end = end_ioasic_dma_irq, 91 }; 92 - 93 94 void __init init_ioasic_irqs(int base) 95 {
··· 17 #include <asm/dec/ioasic_addrs.h> 18 #include <asm/dec/ioasic_ints.h> 19 20 static int ioasic_irq_base; 21 22 + static void unmask_ioasic_irq(struct irq_data *d) 23 { 24 u32 simr; 25 26 simr = ioasic_read(IO_REG_SIMR); 27 + simr |= (1 << (d->irq - ioasic_irq_base)); 28 ioasic_write(IO_REG_SIMR, simr); 29 } 30 31 + static void mask_ioasic_irq(struct irq_data *d) 32 { 33 u32 simr; 34 35 simr = ioasic_read(IO_REG_SIMR); 36 + simr &= ~(1 << (d->irq - ioasic_irq_base)); 37 ioasic_write(IO_REG_SIMR, simr); 38 } 39 40 + static void ack_ioasic_irq(struct irq_data *d) 41 { 42 + mask_ioasic_irq(d); 43 fast_iob(); 44 } 45 46 static struct irq_chip ioasic_irq_type = { 47 .name = "IO-ASIC", 48 + .irq_ack = ack_ioasic_irq, 49 + .irq_mask = mask_ioasic_irq, 50 + .irq_mask_ack = ack_ioasic_irq, 51 + .irq_unmask = unmask_ioasic_irq, 52 }; 53 54 static struct irq_chip ioasic_dma_irq_type = { 55 .name = "IO-ASIC-DMA", 56 + .irq_ack = ack_ioasic_irq, 57 + .irq_mask = mask_ioasic_irq, 58 + .irq_mask_ack = ack_ioasic_irq, 59 + .irq_unmask = unmask_ioasic_irq, 60 }; 61 62 void __init init_ioasic_irqs(int base) 63 {
+10 -13
arch/mips/dec/kn02-irq.c
··· 27 */ 28 u32 cached_kn02_csr; 29 30 - 31 static int kn02_irq_base; 32 33 - 34 - static inline void unmask_kn02_irq(unsigned int irq) 35 { 36 volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + 37 KN02_CSR); 38 39 - cached_kn02_csr |= (1 << (irq - kn02_irq_base + 16)); 40 *csr = cached_kn02_csr; 41 } 42 43 - static inline void mask_kn02_irq(unsigned int irq) 44 { 45 volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + 46 KN02_CSR); 47 48 - cached_kn02_csr &= ~(1 << (irq - kn02_irq_base + 16)); 49 *csr = cached_kn02_csr; 50 } 51 52 - static void ack_kn02_irq(unsigned int irq) 53 { 54 - mask_kn02_irq(irq); 55 iob(); 56 } 57 58 static struct irq_chip kn02_irq_type = { 59 .name = "KN02-CSR", 60 - .ack = ack_kn02_irq, 61 - .mask = mask_kn02_irq, 62 - .mask_ack = ack_kn02_irq, 63 - .unmask = unmask_kn02_irq, 64 }; 65 - 66 67 void __init init_kn02_irqs(int base) 68 {
··· 27 */ 28 u32 cached_kn02_csr; 29 30 static int kn02_irq_base; 31 32 + static void unmask_kn02_irq(struct irq_data *d) 33 { 34 volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + 35 KN02_CSR); 36 37 + cached_kn02_csr |= (1 << (d->irq - kn02_irq_base + 16)); 38 *csr = cached_kn02_csr; 39 } 40 41 + static void mask_kn02_irq(struct irq_data *d) 42 { 43 volatile u32 *csr = (volatile u32 *)CKSEG1ADDR(KN02_SLOT_BASE + 44 KN02_CSR); 45 46 + cached_kn02_csr &= ~(1 << (d->irq - kn02_irq_base + 16)); 47 *csr = cached_kn02_csr; 48 } 49 50 + static void ack_kn02_irq(struct irq_data *d) 51 { 52 + mask_kn02_irq(d); 53 iob(); 54 } 55 56 static struct irq_chip kn02_irq_type = { 57 .name = "KN02-CSR", 58 + .irq_ack = ack_kn02_irq, 59 + .irq_mask = mask_kn02_irq, 60 + .irq_mask_ack = ack_kn02_irq, 61 + .irq_unmask = unmask_kn02_irq, 62 }; 63 64 void __init init_kn02_irqs(int base) 65 {
+27 -40
arch/mips/emma/markeins/irq.c
··· 34 35 #include <asm/emma/emma2rh.h> 36 37 - static void emma2rh_irq_enable(unsigned int irq) 38 { 39 - u32 reg_value; 40 - u32 reg_bitmask; 41 - u32 reg_index; 42 - 43 - irq -= EMMA2RH_IRQ_BASE; 44 45 reg_index = EMMA2RH_BHIF_INT_EN_0 + 46 (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32); ··· 46 emma2rh_out32(reg_index, reg_value | reg_bitmask); 47 } 48 49 - static void emma2rh_irq_disable(unsigned int irq) 50 { 51 - u32 reg_value; 52 - u32 reg_bitmask; 53 - u32 reg_index; 54 - 55 - irq -= EMMA2RH_IRQ_BASE; 56 57 reg_index = EMMA2RH_BHIF_INT_EN_0 + 58 (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32); ··· 60 61 struct irq_chip emma2rh_irq_controller = { 62 .name = "emma2rh_irq", 63 - .ack = emma2rh_irq_disable, 64 - .mask = emma2rh_irq_disable, 65 - .mask_ack = emma2rh_irq_disable, 66 - .unmask = emma2rh_irq_enable, 67 }; 68 69 void emma2rh_irq_init(void) ··· 74 handle_level_irq, "level"); 75 } 76 77 - static void emma2rh_sw_irq_enable(unsigned int irq) 78 { 79 u32 reg; 80 - 81 - irq -= EMMA2RH_SW_IRQ_BASE; 82 83 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); 84 reg |= 1 << irq; 85 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); 86 } 87 88 - static void emma2rh_sw_irq_disable(unsigned int irq) 89 { 90 u32 reg; 91 - 92 - irq -= EMMA2RH_SW_IRQ_BASE; 93 94 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); 95 reg &= ~(1 << irq); ··· 96 97 struct irq_chip emma2rh_sw_irq_controller = { 98 .name = "emma2rh_sw_irq", 99 - .ack = emma2rh_sw_irq_disable, 100 - .mask = emma2rh_sw_irq_disable, 101 - .mask_ack = emma2rh_sw_irq_disable, 102 - .unmask = emma2rh_sw_irq_enable, 103 }; 104 105 void emma2rh_sw_irq_init(void) ··· 110 handle_level_irq, "level"); 111 } 112 113 - static void emma2rh_gpio_irq_enable(unsigned int irq) 114 { 115 u32 reg; 116 - 117 - irq -= EMMA2RH_GPIO_IRQ_BASE; 118 119 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); 120 reg |= 1 << irq; 121 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); 122 } 123 124 - static void emma2rh_gpio_irq_disable(unsigned int irq) 125 { 126 u32 reg; 127 - 128 - irq -= EMMA2RH_GPIO_IRQ_BASE; 129 130 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); 131 reg &= ~(1 << irq); 132 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); 133 } 134 135 - static void emma2rh_gpio_irq_ack(unsigned int irq) 136 { 137 - irq -= EMMA2RH_GPIO_IRQ_BASE; 138 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); 139 } 140 141 - static void emma2rh_gpio_irq_mask_ack(unsigned int irq) 142 { 143 u32 reg; 144 145 - irq -= EMMA2RH_GPIO_IRQ_BASE; 146 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); 147 148 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); ··· 151 152 struct irq_chip emma2rh_gpio_irq_controller = { 153 .name = "emma2rh_gpio_irq", 154 - .ack = emma2rh_gpio_irq_ack, 155 - .mask = emma2rh_gpio_irq_disable, 156 - .mask_ack = emma2rh_gpio_irq_mask_ack, 157 - .unmask = emma2rh_gpio_irq_enable, 158 }; 159 160 void emma2rh_gpio_irq_init(void)
··· 34 35 #include <asm/emma/emma2rh.h> 36 37 + static void emma2rh_irq_enable(struct irq_data *d) 38 { 39 + unsigned int irq = d->irq - EMMA2RH_IRQ_BASE; 40 + u32 reg_value, reg_bitmask, reg_index; 41 42 reg_index = EMMA2RH_BHIF_INT_EN_0 + 43 (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32); ··· 49 emma2rh_out32(reg_index, reg_value | reg_bitmask); 50 } 51 52 + static void emma2rh_irq_disable(struct irq_data *d) 53 { 54 + unsigned int irq = d->irq - EMMA2RH_IRQ_BASE; 55 + u32 reg_value, reg_bitmask, reg_index; 56 57 reg_index = EMMA2RH_BHIF_INT_EN_0 + 58 (EMMA2RH_BHIF_INT_EN_1 - EMMA2RH_BHIF_INT_EN_0) * (irq / 32); ··· 66 67 struct irq_chip emma2rh_irq_controller = { 68 .name = "emma2rh_irq", 69 + .irq_mask = emma2rh_irq_disable, 70 + .irq_unmask = emma2rh_irq_enable, 71 }; 72 73 void emma2rh_irq_init(void) ··· 82 handle_level_irq, "level"); 83 } 84 85 + static void emma2rh_sw_irq_enable(struct irq_data *d) 86 { 87 + unsigned int irq = d->irq - EMMA2RH_SW_IRQ_BASE; 88 u32 reg; 89 90 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); 91 reg |= 1 << irq; 92 emma2rh_out32(EMMA2RH_BHIF_SW_INT_EN, reg); 93 } 94 95 + static void emma2rh_sw_irq_disable(struct irq_data *d) 96 { 97 + unsigned int irq = d->irq - EMMA2RH_SW_IRQ_BASE; 98 u32 reg; 99 100 reg = emma2rh_in32(EMMA2RH_BHIF_SW_INT_EN); 101 reg &= ~(1 << irq); ··· 106 107 struct irq_chip emma2rh_sw_irq_controller = { 108 .name = "emma2rh_sw_irq", 109 + .irq_mask = emma2rh_sw_irq_disable, 110 + .irq_unmask = emma2rh_sw_irq_enable, 111 }; 112 113 void emma2rh_sw_irq_init(void) ··· 122 handle_level_irq, "level"); 123 } 124 125 + static void emma2rh_gpio_irq_enable(struct irq_data *d) 126 { 127 + unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; 128 u32 reg; 129 130 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); 131 reg |= 1 << irq; 132 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); 133 } 134 135 + static void emma2rh_gpio_irq_disable(struct irq_data *d) 136 { 137 + unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; 138 u32 reg; 139 140 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); 141 reg &= ~(1 << irq); 142 emma2rh_out32(EMMA2RH_GPIO_INT_MASK, reg); 143 } 144 145 + static void emma2rh_gpio_irq_ack(struct irq_data *d) 146 { 147 + unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; 148 + 149 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); 150 } 151 152 + static void emma2rh_gpio_irq_mask_ack(struct irq_data *d) 153 { 154 + unsigned int irq = d->irq - EMMA2RH_GPIO_IRQ_BASE; 155 u32 reg; 156 157 emma2rh_out32(EMMA2RH_GPIO_INT_ST, ~(1 << irq)); 158 159 reg = emma2rh_in32(EMMA2RH_GPIO_INT_MASK); ··· 164 165 struct irq_chip emma2rh_gpio_irq_controller = { 166 .name = "emma2rh_gpio_irq", 167 + .irq_ack = emma2rh_gpio_irq_ack, 168 + .irq_mask = emma2rh_gpio_irq_disable, 169 + .irq_mask_ack = emma2rh_gpio_irq_mask_ack, 170 + .irq_unmask = emma2rh_gpio_irq_enable, 171 }; 172 173 void emma2rh_gpio_irq_init(void)
+32 -30
arch/mips/include/asm/irq.h
··· 55 #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF 56 #include <linux/cpumask.h> 57 58 - extern int plat_set_irq_affinity(unsigned int irq, 59 - const struct cpumask *affinity); 60 - extern void smtc_forward_irq(unsigned int irq); 61 62 /* 63 * IRQ affinity hook invoked at the beginning of interrupt dispatch ··· 70 * cpumask implementations, this version is optimistically assuming 71 * that cpumask.h macro overhead is reasonable during interrupt dispatch. 72 */ 73 - #define IRQ_AFFINITY_HOOK(irq) \ 74 - do { \ 75 - if (!cpumask_test_cpu(smp_processor_id(), irq_desc[irq].affinity)) {\ 76 - smtc_forward_irq(irq); \ 77 - irq_exit(); \ 78 - return; \ 79 - } \ 80 - } while (0) 81 82 #else /* Not doing SMTC affinity */ 83 84 - #define IRQ_AFFINITY_HOOK(irq) do { } while (0) 85 86 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */ 87 88 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP 89 90 /* 91 * Clear interrupt mask handling "backstop" if irq_hwmask ··· 101 * functions will take over re-enabling the low-level mask. 102 * Otherwise it will be done on return from exception. 103 */ 104 - #define __DO_IRQ_SMTC_HOOK(irq) \ 105 - do { \ 106 - IRQ_AFFINITY_HOOK(irq); \ 107 - if (irq_hwmask[irq] & 0x0000ff00) \ 108 - write_c0_tccontext(read_c0_tccontext() & \ 109 - ~(irq_hwmask[irq] & 0x0000ff00)); \ 110 - } while (0) 111 112 - #define __NO_AFFINITY_IRQ_SMTC_HOOK(irq) \ 113 - do { \ 114 - if (irq_hwmask[irq] & 0x0000ff00) \ 115 - write_c0_tccontext(read_c0_tccontext() & \ 116 - ~(irq_hwmask[irq] & 0x0000ff00)); \ 117 - } while (0) 118 119 #else 120 121 - #define __DO_IRQ_SMTC_HOOK(irq) \ 122 - do { \ 123 - IRQ_AFFINITY_HOOK(irq); \ 124 - } while (0) 125 - #define __NO_AFFINITY_IRQ_SMTC_HOOK(irq) do { } while (0) 126 127 #endif 128
··· 55 #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF 56 #include <linux/cpumask.h> 57 58 + extern int plat_set_irq_affinity(struct irq_data *d, 59 + const struct cpumask *affinity, bool force); 60 + extern void smtc_forward_irq(struct irq_data *d); 61 62 /* 63 * IRQ affinity hook invoked at the beginning of interrupt dispatch ··· 70 * cpumask implementations, this version is optimistically assuming 71 * that cpumask.h macro overhead is reasonable during interrupt dispatch. 72 */ 73 + static inline int handle_on_other_cpu(unsigned int irq) 74 + { 75 + struct irq_data *d = irq_get_irq_data(irq); 76 + 77 + if (cpumask_test_cpu(smp_processor_id(), d->affinity)) 78 + return 0; 79 + smtc_forward_irq(d); 80 + return 1; 81 + } 82 83 #else /* Not doing SMTC affinity */ 84 85 + static inline int handle_on_other_cpu(unsigned int irq) { return 0; } 86 87 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */ 88 89 #ifdef CONFIG_MIPS_MT_SMTC_IM_BACKSTOP 90 + 91 + static inline void smtc_im_backstop(unsigned int irq) 92 + { 93 + if (irq_hwmask[irq] & 0x0000ff00) 94 + write_c0_tccontext(read_c0_tccontext() & 95 + ~(irq_hwmask[irq] & 0x0000ff00)); 96 + } 97 98 /* 99 * Clear interrupt mask handling "backstop" if irq_hwmask ··· 93 * functions will take over re-enabling the low-level mask. 94 * Otherwise it will be done on return from exception. 95 */ 96 + static inline int smtc_handle_on_other_cpu(unsigned int irq) 97 + { 98 + int ret = handle_on_other_cpu(irq); 99 100 + if (!ret) 101 + smtc_im_backstop(irq); 102 + return ret; 103 + } 104 105 #else 106 107 + static inline void smtc_im_backstop(unsigned int irq) { } 108 + static inline int smtc_handle_on_other_cpu(unsigned int irq) 109 + { 110 + return handle_on_other_cpu(irq); 111 + } 112 113 #endif 114
+21
arch/mips/include/asm/pmc-sierra/msp71xx/cpu-feature-overrides.h
···
··· 1 + /* 2 + * This file is subject to the terms and conditions of the GNU General Public 3 + * License. See the file "COPYING" in the main directory of this archive 4 + * for more details. 5 + * 6 + * Copyright (C) 2003, 04, 07 Ralf Baechle (ralf@linux-mips.org) 7 + */ 8 + #ifndef __ASM_MACH_MSP71XX_CPU_FEATURE_OVERRIDES_H 9 + #define __ASM_MACH_MSP71XX_CPU_FEATURE_OVERRIDES_H 10 + 11 + #define cpu_has_mips16 1 12 + #define cpu_has_dsp 1 13 + #define cpu_has_mipsmt 1 14 + #define cpu_has_fpu 0 15 + 16 + #define cpu_has_mips32r1 0 17 + #define cpu_has_mips32r2 1 18 + #define cpu_has_mips64r1 0 19 + #define cpu_has_mips64r2 0 20 + 21 + #endif /* __ASM_MACH_MSP71XX_CPU_FEATURE_OVERRIDES_H */
+343
arch/mips/include/asm/pmc-sierra/msp71xx/msp_gpio_macros.h
···
··· 1 + /* 2 + * 3 + * Macros for external SMP-safe access to the PMC MSP71xx reference 4 + * board GPIO pins 5 + * 6 + * Copyright 2010 PMC-Sierra, Inc. 7 + * 8 + * This program is free software; you can redistribute it and/or modify it 9 + * under the terms of the GNU General Public License as published by the 10 + * Free Software Foundation; either version 2 of the License, or (at your 11 + * option) any later version. 12 + * 13 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 14 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 15 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 16 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 17 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 18 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 19 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 20 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 + * 24 + * You should have received a copy of the GNU General Public License along 25 + * with this program; if not, write to the Free Software Foundation, Inc., 26 + * 675 Mass Ave, Cambridge, MA 02139, USA. 27 + */ 28 + 29 + #ifndef __MSP_GPIO_MACROS_H__ 30 + #define __MSP_GPIO_MACROS_H__ 31 + 32 + #include <msp_regops.h> 33 + #include <msp_regs.h> 34 + 35 + #ifdef CONFIG_PMC_MSP7120_GW 36 + #define MSP_NUM_GPIOS 20 37 + #else 38 + #define MSP_NUM_GPIOS 28 39 + #endif 40 + 41 + /* -- GPIO Enumerations -- */ 42 + enum msp_gpio_data { 43 + MSP_GPIO_LO = 0, 44 + MSP_GPIO_HI = 1, 45 + MSP_GPIO_NONE, /* Special - Means pin is out of range */ 46 + MSP_GPIO_TOGGLE, /* Special - Sets pin to opposite */ 47 + }; 48 + 49 + enum msp_gpio_mode { 50 + MSP_GPIO_INPUT = 0x0, 51 + /* MSP_GPIO_ INTERRUPT = 0x1, Not supported yet */ 52 + MSP_GPIO_UART_INPUT = 0x2, /* Only GPIO 4 or 5 */ 53 + MSP_GPIO_OUTPUT = 0x8, 54 + MSP_GPIO_UART_OUTPUT = 0x9, /* Only GPIO 2 or 3 */ 55 + MSP_GPIO_PERIF_TIMERA = 0x9, /* Only GPIO 0 or 1 */ 56 + MSP_GPIO_PERIF_TIMERB = 0xa, /* Only GPIO 0 or 1 */ 57 + MSP_GPIO_UNKNOWN = 0xb, /* No such GPIO or mode */ 58 + }; 59 + 60 + /* -- Static Tables -- */ 61 + 62 + /* Maps pins to data register */ 63 + static volatile u32 * const MSP_GPIO_DATA_REGISTER[] = { 64 + /* GPIO 0 and 1 on the first register */ 65 + GPIO_DATA1_REG, GPIO_DATA1_REG, 66 + /* GPIO 2, 3, 4, and 5 on the second register */ 67 + GPIO_DATA2_REG, GPIO_DATA2_REG, GPIO_DATA2_REG, GPIO_DATA2_REG, 68 + /* GPIO 6, 7, 8, and 9 on the third register */ 69 + GPIO_DATA3_REG, GPIO_DATA3_REG, GPIO_DATA3_REG, GPIO_DATA3_REG, 70 + /* GPIO 10, 11, 12, 13, 14, and 15 on the fourth register */ 71 + GPIO_DATA4_REG, GPIO_DATA4_REG, GPIO_DATA4_REG, GPIO_DATA4_REG, 72 + GPIO_DATA4_REG, GPIO_DATA4_REG, 73 + /* GPIO 16 - 23 on the first strange EXTENDED register */ 74 + EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, 75 + EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, 76 + EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, 77 + /* GPIO 24 - 27 on the second strange EXTENDED register */ 78 + EXTENDED_GPIO2_REG, EXTENDED_GPIO2_REG, EXTENDED_GPIO2_REG, 79 + EXTENDED_GPIO2_REG, 80 + }; 81 + 82 + /* Maps pins to mode register */ 83 + static volatile u32 * const MSP_GPIO_MODE_REGISTER[] = { 84 + /* GPIO 0 and 1 on the first register */ 85 + GPIO_CFG1_REG, GPIO_CFG1_REG, 86 + /* GPIO 2, 3, 4, and 5 on the second register */ 87 + GPIO_CFG2_REG, GPIO_CFG2_REG, GPIO_CFG2_REG, GPIO_CFG2_REG, 88 + /* GPIO 6, 7, 8, and 9 on the third register */ 89 + GPIO_CFG3_REG, GPIO_CFG3_REG, GPIO_CFG3_REG, GPIO_CFG3_REG, 90 + /* GPIO 10, 11, 12, 13, 14, and 15 on the fourth register */ 91 + GPIO_CFG4_REG, GPIO_CFG4_REG, GPIO_CFG4_REG, GPIO_CFG4_REG, 92 + GPIO_CFG4_REG, GPIO_CFG4_REG, 93 + /* GPIO 16 - 23 on the first strange EXTENDED register */ 94 + EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, 95 + EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, 96 + EXTENDED_GPIO1_REG, EXTENDED_GPIO1_REG, 97 + /* GPIO 24 - 27 on the second strange EXTENDED register */ 98 + EXTENDED_GPIO2_REG, EXTENDED_GPIO2_REG, EXTENDED_GPIO2_REG, 99 + EXTENDED_GPIO2_REG, 100 + }; 101 + 102 + /* Maps 'basic' pins to relative offset from 0 per register */ 103 + static int MSP_GPIO_OFFSET[] = { 104 + /* GPIO 0 and 1 on the first register */ 105 + 0, 0, 106 + /* GPIO 2, 3, 4, and 5 on the second register */ 107 + 2, 2, 2, 2, 108 + /* GPIO 6, 7, 8, and 9 on the third register */ 109 + 6, 6, 6, 6, 110 + /* GPIO 10, 11, 12, 13, 14, and 15 on the fourth register */ 111 + 10, 10, 10, 10, 10, 10, 112 + }; 113 + 114 + /* Maps MODE to allowed pin mask */ 115 + static unsigned int MSP_GPIO_MODE_ALLOWED[] = { 116 + 0xffffffff, /* Mode 0 - INPUT */ 117 + 0x00000, /* Mode 1 - INTERRUPT */ 118 + 0x00030, /* Mode 2 - UART_INPUT (GPIO 4, 5)*/ 119 + 0, 0, 0, 0, 0, /* Modes 3, 4, 5, 6, and 7 are reserved */ 120 + 0xffffffff, /* Mode 8 - OUTPUT */ 121 + 0x0000f, /* Mode 9 - UART_OUTPUT/ 122 + PERF_TIMERA (GPIO 0, 1, 2, 3) */ 123 + 0x00003, /* Mode a - PERF_TIMERB (GPIO 0, 1) */ 124 + 0x00000, /* Mode b - Not really a mode! */ 125 + }; 126 + 127 + /* -- Bit masks -- */ 128 + 129 + /* This gives you the 'register relative offset gpio' number */ 130 + #define OFFSET_GPIO_NUMBER(gpio) (gpio - MSP_GPIO_OFFSET[gpio]) 131 + 132 + /* These take the 'register relative offset gpio' number */ 133 + #define BASIC_DATA_REG_MASK(ogpio) (1 << ogpio) 134 + #define BASIC_MODE_REG_VALUE(mode, ogpio) \ 135 + (mode << BASIC_MODE_REG_SHIFT(ogpio)) 136 + #define BASIC_MODE_REG_MASK(ogpio) \ 137 + BASIC_MODE_REG_VALUE(0xf, ogpio) 138 + #define BASIC_MODE_REG_SHIFT(ogpio) (ogpio * 4) 139 + #define BASIC_MODE_REG_FROM_REG(data, ogpio) \ 140 + ((data & BASIC_MODE_REG_MASK(ogpio)) >> BASIC_MODE_REG_SHIFT(ogpio)) 141 + 142 + /* These take the actual GPIO number (0 through 15) */ 143 + #define BASIC_DATA_MASK(gpio) \ 144 + BASIC_DATA_REG_MASK(OFFSET_GPIO_NUMBER(gpio)) 145 + #define BASIC_MODE_MASK(gpio) \ 146 + BASIC_MODE_REG_MASK(OFFSET_GPIO_NUMBER(gpio)) 147 + #define BASIC_MODE(mode, gpio) \ 148 + BASIC_MODE_REG_VALUE(mode, OFFSET_GPIO_NUMBER(gpio)) 149 + #define BASIC_MODE_SHIFT(gpio) \ 150 + BASIC_MODE_REG_SHIFT(OFFSET_GPIO_NUMBER(gpio)) 151 + #define BASIC_MODE_FROM_REG(data, gpio) \ 152 + BASIC_MODE_REG_FROM_REG(data, OFFSET_GPIO_NUMBER(gpio)) 153 + 154 + /* 155 + * Each extended GPIO register is 32 bits long and is responsible for up to 156 + * eight GPIOs. The least significant 16 bits contain the set and clear bit 157 + * pair for each of the GPIOs. The most significant 16 bits contain the 158 + * disable and enable bit pair for each of the GPIOs. For example, the 159 + * extended GPIO reg for GPIOs 16-23 is as follows: 160 + * 161 + * 31: GPIO23_DISABLE 162 + * ... 163 + * 19: GPIO17_DISABLE 164 + * 18: GPIO17_ENABLE 165 + * 17: GPIO16_DISABLE 166 + * 16: GPIO16_ENABLE 167 + * ... 168 + * 3: GPIO17_SET 169 + * 2: GPIO17_CLEAR 170 + * 1: GPIO16_SET 171 + * 0: GPIO16_CLEAR 172 + */ 173 + 174 + /* This gives the 'register relative offset gpio' number */ 175 + #define EXTENDED_OFFSET_GPIO(gpio) (gpio < 24 ? gpio - 16 : gpio - 24) 176 + 177 + /* These take the 'register relative offset gpio' number */ 178 + #define EXTENDED_REG_DISABLE(ogpio) (0x2 << ((ogpio * 2) + 16)) 179 + #define EXTENDED_REG_ENABLE(ogpio) (0x1 << ((ogpio * 2) + 16)) 180 + #define EXTENDED_REG_SET(ogpio) (0x2 << (ogpio * 2)) 181 + #define EXTENDED_REG_CLR(ogpio) (0x1 << (ogpio * 2)) 182 + 183 + /* These take the actual GPIO number (16 through 27) */ 184 + #define EXTENDED_DISABLE(gpio) \ 185 + EXTENDED_REG_DISABLE(EXTENDED_OFFSET_GPIO(gpio)) 186 + #define EXTENDED_ENABLE(gpio) \ 187 + EXTENDED_REG_ENABLE(EXTENDED_OFFSET_GPIO(gpio)) 188 + #define EXTENDED_SET(gpio) \ 189 + EXTENDED_REG_SET(EXTENDED_OFFSET_GPIO(gpio)) 190 + #define EXTENDED_CLR(gpio) \ 191 + EXTENDED_REG_CLR(EXTENDED_OFFSET_GPIO(gpio)) 192 + 193 + #define EXTENDED_FULL_MASK (0xffffffff) 194 + 195 + /* -- API inline-functions -- */ 196 + 197 + /* 198 + * Gets the current value of the specified pin 199 + */ 200 + static inline enum msp_gpio_data msp_gpio_pin_get(unsigned int gpio) 201 + { 202 + u32 pinhi_mask = 0, pinhi_mask2 = 0; 203 + 204 + if (gpio >= MSP_NUM_GPIOS) 205 + return MSP_GPIO_NONE; 206 + 207 + if (gpio < 16) { 208 + pinhi_mask = BASIC_DATA_MASK(gpio); 209 + } else { 210 + /* 211 + * Two cases are possible with the EXTENDED register: 212 + * - In output mode (ENABLED flag set), check the CLR bit 213 + * - In input mode (ENABLED flag not set), check the SET bit 214 + */ 215 + pinhi_mask = EXTENDED_ENABLE(gpio) | EXTENDED_CLR(gpio); 216 + pinhi_mask2 = EXTENDED_SET(gpio); 217 + } 218 + if (((*MSP_GPIO_DATA_REGISTER[gpio] & pinhi_mask) == pinhi_mask) || 219 + (*MSP_GPIO_DATA_REGISTER[gpio] & pinhi_mask2)) 220 + return MSP_GPIO_HI; 221 + else 222 + return MSP_GPIO_LO; 223 + } 224 + 225 + /* Sets the specified pin to the specified value */ 226 + static inline void msp_gpio_pin_set(enum msp_gpio_data data, unsigned int gpio) 227 + { 228 + if (gpio >= MSP_NUM_GPIOS) 229 + return; 230 + 231 + if (gpio < 16) { 232 + if (data == MSP_GPIO_TOGGLE) 233 + toggle_reg32(MSP_GPIO_DATA_REGISTER[gpio], 234 + BASIC_DATA_MASK(gpio)); 235 + else if (data == MSP_GPIO_HI) 236 + set_reg32(MSP_GPIO_DATA_REGISTER[gpio], 237 + BASIC_DATA_MASK(gpio)); 238 + else 239 + clear_reg32(MSP_GPIO_DATA_REGISTER[gpio], 240 + BASIC_DATA_MASK(gpio)); 241 + } else { 242 + if (data == MSP_GPIO_TOGGLE) { 243 + /* Special ugly case: 244 + * We have to read the CLR bit. 245 + * If set, we write the CLR bit. 246 + * If not, we write the SET bit. 247 + */ 248 + u32 tmpdata; 249 + 250 + custom_read_reg32(MSP_GPIO_DATA_REGISTER[gpio], 251 + tmpdata); 252 + if (tmpdata & EXTENDED_CLR(gpio)) 253 + tmpdata = EXTENDED_CLR(gpio); 254 + else 255 + tmpdata = EXTENDED_SET(gpio); 256 + custom_write_reg32(MSP_GPIO_DATA_REGISTER[gpio], 257 + tmpdata); 258 + } else { 259 + u32 newdata; 260 + 261 + if (data == MSP_GPIO_HI) 262 + newdata = EXTENDED_SET(gpio); 263 + else 264 + newdata = EXTENDED_CLR(gpio); 265 + set_value_reg32(MSP_GPIO_DATA_REGISTER[gpio], 266 + EXTENDED_FULL_MASK, newdata); 267 + } 268 + } 269 + } 270 + 271 + /* Sets the specified pin to the specified value */ 272 + static inline void msp_gpio_pin_hi(unsigned int gpio) 273 + { 274 + msp_gpio_pin_set(MSP_GPIO_HI, gpio); 275 + } 276 + 277 + /* Sets the specified pin to the specified value */ 278 + static inline void msp_gpio_pin_lo(unsigned int gpio) 279 + { 280 + msp_gpio_pin_set(MSP_GPIO_LO, gpio); 281 + } 282 + 283 + /* Sets the specified pin to the opposite value */ 284 + static inline void msp_gpio_pin_toggle(unsigned int gpio) 285 + { 286 + msp_gpio_pin_set(MSP_GPIO_TOGGLE, gpio); 287 + } 288 + 289 + /* Gets the mode of the specified pin */ 290 + static inline enum msp_gpio_mode msp_gpio_pin_get_mode(unsigned int gpio) 291 + { 292 + enum msp_gpio_mode retval = MSP_GPIO_UNKNOWN; 293 + uint32_t data; 294 + 295 + if (gpio >= MSP_NUM_GPIOS) 296 + return retval; 297 + 298 + data = *MSP_GPIO_MODE_REGISTER[gpio]; 299 + 300 + if (gpio < 16) { 301 + retval = BASIC_MODE_FROM_REG(data, gpio); 302 + } else { 303 + /* Extended pins can only be either INPUT or OUTPUT */ 304 + if (data & EXTENDED_ENABLE(gpio)) 305 + retval = MSP_GPIO_OUTPUT; 306 + else 307 + retval = MSP_GPIO_INPUT; 308 + } 309 + 310 + return retval; 311 + } 312 + 313 + /* 314 + * Sets the specified mode on the requested pin 315 + * Returns 0 on success, or -1 if that mode is not allowed on this pin 316 + */ 317 + static inline int msp_gpio_pin_mode(enum msp_gpio_mode mode, unsigned int gpio) 318 + { 319 + u32 modemask, newmode; 320 + 321 + if ((1 << gpio) & ~MSP_GPIO_MODE_ALLOWED[mode]) 322 + return -1; 323 + 324 + if (gpio >= MSP_NUM_GPIOS) 325 + return -1; 326 + 327 + if (gpio < 16) { 328 + modemask = BASIC_MODE_MASK(gpio); 329 + newmode = BASIC_MODE(mode, gpio); 330 + } else { 331 + modemask = EXTENDED_FULL_MASK; 332 + if (mode == MSP_GPIO_INPUT) 333 + newmode = EXTENDED_DISABLE(gpio); 334 + else 335 + newmode = EXTENDED_ENABLE(gpio); 336 + } 337 + /* Do the set atomically */ 338 + set_value_reg32(MSP_GPIO_MODE_REGISTER[gpio], modemask, newmode); 339 + 340 + return 0; 341 + } 342 + 343 + #endif /* __MSP_GPIO_MACROS_H__ */
+9 -8
arch/mips/include/asm/pmc-sierra/msp71xx/msp_regs.h
··· 91 /* MAC C device registers */ 92 #define MSP_ADSL2_BASE (MSP_MSB_BASE + 0xA80000) 93 /* ADSL2 device registers */ 94 - #define MSP_USB_BASE (MSP_MSB_BASE + 0xB40000) 95 - /* USB device registers */ 96 - #define MSP_USB_BASE_START (MSP_MSB_BASE + 0xB40100) 97 - /* USB device registers */ 98 - #define MSP_USB_BASE_END (MSP_MSB_BASE + 0xB401FF) 99 - /* USB device registers */ 100 #define MSP_CPUIF_BASE (MSP_MSB_BASE + 0xC00000) 101 /* CPU interface registers */ 102 ··· 317 #define CPU_ERR2_REG regptr(MSP_SLP_BASE + 0x184) 318 /* CPU/SLP Error status 1 */ 319 320 - #define EXTENDED_GPIO_REG regptr(MSP_SLP_BASE + 0x188) 321 - /* Extended GPIO register */ 322 323 /* System Error registers */ 324 #define SLP_ERR_STS_REG regptr(MSP_SLP_BASE + 0x190)
··· 91 /* MAC C device registers */ 92 #define MSP_ADSL2_BASE (MSP_MSB_BASE + 0xA80000) 93 /* ADSL2 device registers */ 94 + #define MSP_USB0_BASE (MSP_MSB_BASE + 0xB00000) 95 + /* USB0 device registers */ 96 + #define MSP_USB1_BASE (MSP_MSB_BASE + 0x300000) 97 + /* USB1 device registers */ 98 #define MSP_CPUIF_BASE (MSP_MSB_BASE + 0xC00000) 99 /* CPU interface registers */ 100 ··· 319 #define CPU_ERR2_REG regptr(MSP_SLP_BASE + 0x184) 320 /* CPU/SLP Error status 1 */ 321 322 + /* Extended GPIO registers */ 323 + #define EXTENDED_GPIO1_REG regptr(MSP_SLP_BASE + 0x188) 324 + #define EXTENDED_GPIO2_REG regptr(MSP_SLP_BASE + 0x18c) 325 + #define EXTENDED_GPIO_REG EXTENDED_GPIO1_REG 326 + /* Backward-compatibility */ 327 328 /* System Error registers */ 329 #define SLP_ERR_STS_REG regptr(MSP_SLP_BASE + 0x190)
+144
arch/mips/include/asm/pmc-sierra/msp71xx/msp_usb.h
···
··· 1 + /****************************************************************** 2 + * Copyright (c) 2000-2007 PMC-Sierra INC. 3 + * 4 + * This program is free software; you can redistribute it 5 + * and/or modify it under the terms of the GNU General 6 + * Public License as published by the Free Software 7 + * Foundation; either version 2 of the License, or (at your 8 + * option) any later version. 9 + * 10 + * This program is distributed in the hope that it will be 11 + * useful, but WITHOUT ANY WARRANTY; without even the implied 12 + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 13 + * PURPOSE. See the GNU General Public License for more 14 + * details. 15 + * 16 + * You should have received a copy of the GNU General Public 17 + * License along with this program; if not, write to the Free 18 + * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 19 + * 02139, USA. 20 + * 21 + * PMC-SIERRA INC. DISCLAIMS ANY LIABILITY OF ANY KIND 22 + * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS 23 + * SOFTWARE. 24 + */ 25 + #ifndef MSP_USB_H_ 26 + #define MSP_USB_H_ 27 + 28 + #ifdef CONFIG_MSP_HAS_DUAL_USB 29 + #define NUM_USB_DEVS 2 30 + #else 31 + #define NUM_USB_DEVS 1 32 + #endif 33 + 34 + /* Register spaces for USB host 0 */ 35 + #define MSP_USB0_MAB_START (MSP_USB0_BASE + 0x0) 36 + #define MSP_USB0_MAB_END (MSP_USB0_BASE + 0x17) 37 + #define MSP_USB0_ID_START (MSP_USB0_BASE + 0x40000) 38 + #define MSP_USB0_ID_END (MSP_USB0_BASE + 0x4008f) 39 + #define MSP_USB0_HS_START (MSP_USB0_BASE + 0x40100) 40 + #define MSP_USB0_HS_END (MSP_USB0_BASE + 0x401FF) 41 + 42 + /* Register spaces for USB host 1 */ 43 + #define MSP_USB1_MAB_START (MSP_USB1_BASE + 0x0) 44 + #define MSP_USB1_MAB_END (MSP_USB1_BASE + 0x17) 45 + #define MSP_USB1_ID_START (MSP_USB1_BASE + 0x40000) 46 + #define MSP_USB1_ID_END (MSP_USB1_BASE + 0x4008f) 47 + #define MSP_USB1_HS_START (MSP_USB1_BASE + 0x40100) 48 + #define MSP_USB1_HS_END (MSP_USB1_BASE + 0x401ff) 49 + 50 + /* USB Identification registers */ 51 + struct msp_usbid_regs { 52 + u32 id; /* 0x0: Identification register */ 53 + u32 hwgen; /* 0x4: General HW params */ 54 + u32 hwhost; /* 0x8: Host HW params */ 55 + u32 hwdev; /* 0xc: Device HW params */ 56 + u32 hwtxbuf; /* 0x10: Tx buffer HW params */ 57 + u32 hwrxbuf; /* 0x14: Rx buffer HW params */ 58 + u32 reserved[26]; 59 + u32 timer0_load; /* 0x80: General-purpose timer 0 load*/ 60 + u32 timer0_ctrl; /* 0x84: General-purpose timer 0 control */ 61 + u32 timer1_load; /* 0x88: General-purpose timer 1 load*/ 62 + u32 timer1_ctrl; /* 0x8c: General-purpose timer 1 control */ 63 + }; 64 + 65 + /* MSBus to AMBA registers */ 66 + struct msp_mab_regs { 67 + u32 isr; /* 0x0: Interrupt status */ 68 + u32 imr; /* 0x4: Interrupt mask */ 69 + u32 thcr0; /* 0x8: Transaction header capture 0 */ 70 + u32 thcr1; /* 0xc: Transaction header capture 1 */ 71 + u32 int_stat; /* 0x10: Interrupt status summary */ 72 + u32 phy_cfg; /* 0x14: USB phy config */ 73 + }; 74 + 75 + /* EHCI registers */ 76 + struct msp_usbhs_regs { 77 + u32 hciver; /* 0x0: Version and offset to operational regs */ 78 + u32 hcsparams; /* 0x4: Host control structural parameters */ 79 + u32 hccparams; /* 0x8: Host control capability parameters */ 80 + u32 reserved0[5]; 81 + u32 dciver; /* 0x20: Device interface version */ 82 + u32 dccparams; /* 0x24: Device control capability parameters */ 83 + u32 reserved1[6]; 84 + u32 cmd; /* 0x40: USB command */ 85 + u32 sts; /* 0x44: USB status */ 86 + u32 int_ena; /* 0x48: USB interrupt enable */ 87 + u32 frindex; /* 0x4c: Frame index */ 88 + u32 reserved3; 89 + union { 90 + struct { 91 + u32 flb_addr; /* 0x54: Frame list base address */ 92 + u32 next_async_addr; /* 0x58: next asynchronous addr */ 93 + u32 ttctrl; /* 0x5c: embedded transaction translator 94 + async buffer status */ 95 + u32 burst_size; /* 0x60: Controller burst size */ 96 + u32 tx_fifo_ctrl; /* 0x64: Tx latency FIFO tuning */ 97 + u32 reserved0[4]; 98 + u32 endpt_nak; /* 0x78: Endpoint NAK */ 99 + u32 endpt_nak_ena; /* 0x7c: Endpoint NAK enable */ 100 + u32 cfg_flag; /* 0x80: Config flag */ 101 + u32 port_sc1; /* 0x84: Port status & control 1 */ 102 + u32 reserved1[7]; 103 + u32 otgsc; /* 0xa4: OTG status & control */ 104 + u32 mode; /* 0xa8: USB controller mode */ 105 + } host; 106 + 107 + struct { 108 + u32 dev_addr; /* 0x54: Device address */ 109 + u32 endpt_list_addr; /* 0x58: Endpoint list address */ 110 + u32 reserved0[7]; 111 + u32 endpt_nak; /* 0x74 */ 112 + u32 endpt_nak_ctrl; /* 0x78 */ 113 + u32 cfg_flag; /* 0x80 */ 114 + u32 port_sc1; /* 0x84: Port status & control 1 */ 115 + u32 reserved[7]; 116 + u32 otgsc; /* 0xa4: OTG status & control */ 117 + u32 mode; /* 0xa8: USB controller mode */ 118 + u32 endpt_setup_stat; /* 0xac */ 119 + u32 endpt_prime; /* 0xb0 */ 120 + u32 endpt_flush; /* 0xb4 */ 121 + u32 endpt_stat; /* 0xb8 */ 122 + u32 endpt_complete; /* 0xbc */ 123 + u32 endpt_ctrl0; /* 0xc0 */ 124 + u32 endpt_ctrl1; /* 0xc4 */ 125 + u32 endpt_ctrl2; /* 0xc8 */ 126 + u32 endpt_ctrl3; /* 0xcc */ 127 + } device; 128 + } u; 129 + }; 130 + /* 131 + * Container for the more-generic platform_device. 132 + * This exists mainly as a way to map the non-standard register 133 + * spaces and make them accessible to the USB ISR. 134 + */ 135 + struct mspusb_device { 136 + struct msp_mab_regs __iomem *mab_regs; 137 + struct msp_usbid_regs __iomem *usbid_regs; 138 + struct msp_usbhs_regs __iomem *usbhs_regs; 139 + struct platform_device dev; 140 + }; 141 + 142 + #define to_mspusb_device(x) container_of((x), struct mspusb_device, dev) 143 + #define TO_HOST_ID(x) ((x) & 0x3) 144 + #endif /*MSP_USB_H_*/
+11 -11
arch/mips/include/asm/spinlock.h
··· 245 __asm__ __volatile__( 246 " .set noreorder # arch_read_lock \n" 247 "1: ll %1, %2 \n" 248 - " bltz %1, 2f \n" 249 " addu %1, 1 \n" 250 - " sc %1, %0 \n" 251 " beqz %1, 1b \n" 252 " nop \n" 253 " .subsection 2 \n" 254 - "2: ll %1, %2 \n" 255 - " bltz %1, 2b \n" 256 " addu %1, 1 \n" 257 - " b 1b \n" 258 " nop \n" 259 " .previous \n" 260 " .set reorder \n" ··· 324 __asm__ __volatile__( 325 " .set noreorder # arch_write_lock \n" 326 "1: ll %1, %2 \n" 327 - " bnez %1, 2f \n" 328 " lui %1, 0x8000 \n" 329 - " sc %1, %0 \n" 330 - " beqz %1, 2f \n" 331 " nop \n" 332 " .subsection 2 \n" 333 - "2: ll %1, %2 \n" 334 - " bnez %1, 2b \n" 335 " lui %1, 0x8000 \n" 336 - " b 1b \n" 337 " nop \n" 338 " .previous \n" 339 " .set reorder \n"
··· 245 __asm__ __volatile__( 246 " .set noreorder # arch_read_lock \n" 247 "1: ll %1, %2 \n" 248 + " bltz %1, 3f \n" 249 " addu %1, 1 \n" 250 + "2: sc %1, %0 \n" 251 " beqz %1, 1b \n" 252 " nop \n" 253 " .subsection 2 \n" 254 + "3: ll %1, %2 \n" 255 + " bltz %1, 3b \n" 256 " addu %1, 1 \n" 257 + " b 2b \n" 258 " nop \n" 259 " .previous \n" 260 " .set reorder \n" ··· 324 __asm__ __volatile__( 325 " .set noreorder # arch_write_lock \n" 326 "1: ll %1, %2 \n" 327 + " bnez %1, 3f \n" 328 " lui %1, 0x8000 \n" 329 + "2: sc %1, %0 \n" 330 + " beqz %1, 3f \n" 331 " nop \n" 332 " .subsection 2 \n" 333 + "3: ll %1, %2 \n" 334 + " bnez %1, 3b \n" 335 " lui %1, 0x8000 \n" 336 + " b 2b \n" 337 " nop \n" 338 " .previous \n" 339 " .set reorder \n"
+18 -6
arch/mips/include/asm/unistd.h
··· 359 #define __NR_fanotify_init (__NR_Linux + 336) 360 #define __NR_fanotify_mark (__NR_Linux + 337) 361 #define __NR_prlimit64 (__NR_Linux + 338) 362 363 /* 364 * Offset of the last Linux o32 flavoured syscall 365 */ 366 - #define __NR_Linux_syscalls 338 367 368 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 369 370 #define __NR_O32_Linux 4000 371 - #define __NR_O32_Linux_syscalls 338 372 373 #if _MIPS_SIM == _MIPS_SIM_ABI64 374 ··· 678 #define __NR_fanotify_init (__NR_Linux + 295) 679 #define __NR_fanotify_mark (__NR_Linux + 296) 680 #define __NR_prlimit64 (__NR_Linux + 297) 681 682 /* 683 * Offset of the last Linux 64-bit flavoured syscall 684 */ 685 - #define __NR_Linux_syscalls 297 686 687 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 688 689 #define __NR_64_Linux 5000 690 - #define __NR_64_Linux_syscalls 297 691 692 #if _MIPS_SIM == _MIPS_SIM_NABI32 693 ··· 1002 #define __NR_fanotify_init (__NR_Linux + 300) 1003 #define __NR_fanotify_mark (__NR_Linux + 301) 1004 #define __NR_prlimit64 (__NR_Linux + 302) 1005 1006 /* 1007 * Offset of the last N32 flavoured syscall 1008 */ 1009 - #define __NR_Linux_syscalls 302 1010 1011 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1012 1013 #define __NR_N32_Linux 6000 1014 - #define __NR_N32_Linux_syscalls 302 1015 1016 #ifdef __KERNEL__ 1017
··· 359 #define __NR_fanotify_init (__NR_Linux + 336) 360 #define __NR_fanotify_mark (__NR_Linux + 337) 361 #define __NR_prlimit64 (__NR_Linux + 338) 362 + #define __NR_name_to_handle_at (__NR_Linux + 339) 363 + #define __NR_open_by_handle_at (__NR_Linux + 340) 364 + #define __NR_clock_adjtime (__NR_Linux + 341) 365 + #define __NR_syncfs (__NR_Linux + 342) 366 367 /* 368 * Offset of the last Linux o32 flavoured syscall 369 */ 370 + #define __NR_Linux_syscalls 342 371 372 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 373 374 #define __NR_O32_Linux 4000 375 + #define __NR_O32_Linux_syscalls 342 376 377 #if _MIPS_SIM == _MIPS_SIM_ABI64 378 ··· 674 #define __NR_fanotify_init (__NR_Linux + 295) 675 #define __NR_fanotify_mark (__NR_Linux + 296) 676 #define __NR_prlimit64 (__NR_Linux + 297) 677 + #define __NR_name_to_handle_at (__NR_Linux + 298) 678 + #define __NR_open_by_handle_at (__NR_Linux + 299) 679 + #define __NR_clock_adjtime (__NR_Linux + 300) 680 + #define __NR_syncfs (__NR_Linux + 301) 681 682 /* 683 * Offset of the last Linux 64-bit flavoured syscall 684 */ 685 + #define __NR_Linux_syscalls 301 686 687 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */ 688 689 #define __NR_64_Linux 5000 690 + #define __NR_64_Linux_syscalls 301 691 692 #if _MIPS_SIM == _MIPS_SIM_NABI32 693 ··· 994 #define __NR_fanotify_init (__NR_Linux + 300) 995 #define __NR_fanotify_mark (__NR_Linux + 301) 996 #define __NR_prlimit64 (__NR_Linux + 302) 997 + #define __NR_name_to_handle_at (__NR_Linux + 303) 998 + #define __NR_open_by_handle_at (__NR_Linux + 304) 999 + #define __NR_clock_adjtime (__NR_Linux + 305) 1000 + #define __NR_clock_adjtime (__NR_Linux + 306) 1001 1002 /* 1003 * Offset of the last N32 flavoured syscall 1004 */ 1005 + #define __NR_Linux_syscalls 306 1006 1007 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */ 1008 1009 #define __NR_N32_Linux 6000 1010 + #define __NR_N32_Linux_syscalls 306 1011 1012 #ifdef __KERNEL__ 1013
+6 -8
arch/mips/jazz/irq.c
··· 23 24 static DEFINE_RAW_SPINLOCK(r4030_lock); 25 26 - static void enable_r4030_irq(unsigned int irq) 27 { 28 - unsigned int mask = 1 << (irq - JAZZ_IRQ_START); 29 unsigned long flags; 30 31 raw_spin_lock_irqsave(&r4030_lock, flags); ··· 34 raw_spin_unlock_irqrestore(&r4030_lock, flags); 35 } 36 37 - void disable_r4030_irq(unsigned int irq) 38 { 39 - unsigned int mask = ~(1 << (irq - JAZZ_IRQ_START)); 40 unsigned long flags; 41 42 raw_spin_lock_irqsave(&r4030_lock, flags); ··· 47 48 static struct irq_chip r4030_irq_type = { 49 .name = "R4030", 50 - .ack = disable_r4030_irq, 51 - .mask = disable_r4030_irq, 52 - .mask_ack = disable_r4030_irq, 53 - .unmask = enable_r4030_irq, 54 }; 55 56 void __init init_r4030_ints(void)
··· 23 24 static DEFINE_RAW_SPINLOCK(r4030_lock); 25 26 + static void enable_r4030_irq(struct irq_data *d) 27 { 28 + unsigned int mask = 1 << (d->irq - JAZZ_IRQ_START); 29 unsigned long flags; 30 31 raw_spin_lock_irqsave(&r4030_lock, flags); ··· 34 raw_spin_unlock_irqrestore(&r4030_lock, flags); 35 } 36 37 + void disable_r4030_irq(struct irq_data *d) 38 { 39 + unsigned int mask = ~(1 << (d->irq - JAZZ_IRQ_START)); 40 unsigned long flags; 41 42 raw_spin_lock_irqsave(&r4030_lock, flags); ··· 47 48 static struct irq_chip r4030_irq_type = { 49 .name = "R4030", 50 + .irq_mask = disable_r4030_irq, 51 + .irq_unmask = enable_r4030_irq, 52 }; 53 54 void __init init_r4030_ints(void)
+28 -4
arch/mips/jz4740/board-qi_lb60.c
··· 23 #include <linux/spi/spi_gpio.h> 24 #include <linux/power_supply.h> 25 #include <linux/power/jz4740-battery.h> 26 27 #include <asm/mach-jz4740/jz4740_fb.h> 28 #include <asm/mach-jz4740/jz4740_mmc.h> ··· 50 51 /* NAND */ 52 static struct nand_ecclayout qi_lb60_ecclayout_1gb = { 53 - /* .eccbytes = 36, 54 .eccpos = { 55 6, 7, 8, 9, 10, 11, 12, 13, 56 14, 15, 16, 17, 18, 19, 20, 21, 57 22, 23, 24, 25, 26, 27, 28, 29, 58 30, 31, 32, 33, 34, 35, 36, 37, 59 38, 39, 40, 41 60 - },*/ 61 .oobfree = { 62 { .offset = 2, .length = 4 }, 63 { .offset = 42, .length = 22 } ··· 86 }; 87 88 static struct nand_ecclayout qi_lb60_ecclayout_2gb = { 89 - /* .eccbytes = 72, 90 .eccpos = { 91 12, 13, 14, 15, 16, 17, 18, 19, 92 20, 21, 22, 23, 24, 25, 26, 27, ··· 97 60, 61, 62, 63, 64, 65, 66, 67, 98 68, 69, 70, 71, 72, 73, 74, 75, 99 76, 77, 78, 79, 80, 81, 82, 83 100 - },*/ 101 .oobfree = { 102 { .offset = 2, .length = 10 }, 103 { .offset = 84, .length = 44 }, ··· 397 }, 398 }; 399 400 static struct platform_device *jz_platform_devices[] __initdata = { 401 &jz4740_udc_device, 402 &jz4740_mmc_device, ··· 433 &jz4740_adc_device, 434 &qi_lb60_gpio_keys, 435 &qi_lb60_pwm_beeper, 436 }; 437 438 static void __init board_gpio_setup(void)
··· 23 #include <linux/spi/spi_gpio.h> 24 #include <linux/power_supply.h> 25 #include <linux/power/jz4740-battery.h> 26 + #include <linux/power/gpio-charger.h> 27 28 #include <asm/mach-jz4740/jz4740_fb.h> 29 #include <asm/mach-jz4740/jz4740_mmc.h> ··· 49 50 /* NAND */ 51 static struct nand_ecclayout qi_lb60_ecclayout_1gb = { 52 + .eccbytes = 36, 53 .eccpos = { 54 6, 7, 8, 9, 10, 11, 12, 13, 55 14, 15, 16, 17, 18, 19, 20, 21, 56 22, 23, 24, 25, 26, 27, 28, 29, 57 30, 31, 32, 33, 34, 35, 36, 37, 58 38, 39, 40, 41 59 + }, 60 .oobfree = { 61 { .offset = 2, .length = 4 }, 62 { .offset = 42, .length = 22 } ··· 85 }; 86 87 static struct nand_ecclayout qi_lb60_ecclayout_2gb = { 88 + .eccbytes = 72, 89 .eccpos = { 90 12, 13, 14, 15, 16, 17, 18, 19, 91 20, 21, 22, 23, 24, 25, 26, 27, ··· 96 60, 61, 62, 63, 64, 65, 66, 67, 97 68, 69, 70, 71, 72, 73, 74, 75, 98 76, 77, 78, 79, 80, 81, 82, 83 99 + }, 100 .oobfree = { 101 { .offset = 2, .length = 10 }, 102 { .offset = 84, .length = 44 }, ··· 396 }, 397 }; 398 399 + /* charger */ 400 + static char *qi_lb60_batteries[] = { 401 + "battery", 402 + }; 403 + 404 + static struct gpio_charger_platform_data qi_lb60_charger_pdata = { 405 + .name = "usb", 406 + .type = POWER_SUPPLY_TYPE_USB, 407 + .gpio = JZ_GPIO_PORTD(28), 408 + .gpio_active_low = 1, 409 + .supplied_to = qi_lb60_batteries, 410 + .num_supplicants = ARRAY_SIZE(qi_lb60_batteries), 411 + }; 412 + 413 + static struct platform_device qi_lb60_charger_device = { 414 + .name = "gpio-charger", 415 + .dev = { 416 + .platform_data = &qi_lb60_charger_pdata, 417 + }, 418 + }; 419 + 420 + 421 static struct platform_device *jz_platform_devices[] __initdata = { 422 &jz4740_udc_device, 423 &jz4740_mmc_device, ··· 410 &jz4740_adc_device, 411 &qi_lb60_gpio_keys, 412 &qi_lb60_pwm_beeper, 413 + &qi_lb60_charger_device, 414 }; 415 416 static void __init board_gpio_setup(void)
+50 -61
arch/mips/jz4740/gpio.c
··· 86 spinlock_t lock; 87 88 struct gpio_chip gpio_chip; 89 - struct irq_chip irq_chip; 90 struct sys_device sysdev; 91 }; 92 ··· 101 return container_of(gpio_chip, struct jz_gpio_chip, gpio_chip); 102 } 103 104 - static inline struct jz_gpio_chip *irq_to_jz_gpio_chip(unsigned int irq) 105 { 106 - return get_irq_chip_data(irq); 107 } 108 109 static inline void jz_gpio_write_bit(unsigned int gpio, unsigned int reg) ··· 324 generic_handle_irq(gpio_irq); 325 }; 326 327 - static inline void jz_gpio_set_irq_bit(unsigned int irq, unsigned int reg) 328 { 329 - struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq); 330 - writel(IRQ_TO_BIT(irq), chip->base + reg); 331 } 332 333 - static void jz_gpio_irq_mask(unsigned int irq) 334 { 335 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_MASK_SET); 336 }; 337 338 - static void jz_gpio_irq_unmask(unsigned int irq) 339 { 340 - struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq); 341 342 - jz_gpio_check_trigger_both(chip, irq); 343 344 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_MASK_CLEAR); 345 }; 346 347 /* TODO: Check if function is gpio */ 348 - static unsigned int jz_gpio_irq_startup(unsigned int irq) 349 { 350 - struct irq_desc *desc = irq_to_desc(irq); 351 - 352 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_SELECT_SET); 353 - 354 - desc->status &= ~IRQ_MASKED; 355 - jz_gpio_irq_unmask(irq); 356 - 357 return 0; 358 } 359 360 - static void jz_gpio_irq_shutdown(unsigned int irq) 361 { 362 - struct irq_desc *desc = irq_to_desc(irq); 363 - 364 - jz_gpio_irq_mask(irq); 365 - desc->status |= IRQ_MASKED; 366 367 /* Set direction to input */ 368 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_CLEAR); 369 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_SELECT_CLEAR); 370 } 371 372 - static void jz_gpio_irq_ack(unsigned int irq) 373 { 374 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_FLAG_CLEAR); 375 }; 376 377 - static int jz_gpio_irq_set_type(unsigned int irq, unsigned int flow_type) 378 { 379 - struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq); 380 - struct irq_desc *desc = irq_to_desc(irq); 381 - 382 - jz_gpio_irq_mask(irq); 383 384 if (flow_type == IRQ_TYPE_EDGE_BOTH) { 385 uint32_t value = readl(chip->base + JZ_REG_GPIO_PIN); ··· 384 385 switch (flow_type) { 386 case IRQ_TYPE_EDGE_RISING: 387 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_SET); 388 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_SET); 389 break; 390 case IRQ_TYPE_EDGE_FALLING: 391 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_CLEAR); 392 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_SET); 393 break; 394 case IRQ_TYPE_LEVEL_HIGH: 395 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_SET); 396 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_CLEAR); 397 break; 398 case IRQ_TYPE_LEVEL_LOW: 399 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_CLEAR); 400 - jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_CLEAR); 401 break; 402 default: 403 return -EINVAL; 404 } 405 406 - if (!(desc->status & IRQ_MASKED)) 407 - jz_gpio_irq_unmask(irq); 408 - 409 return 0; 410 } 411 412 - static int jz_gpio_irq_set_wake(unsigned int irq, unsigned int on) 413 { 414 - struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq); 415 spin_lock(&chip->lock); 416 if (on) 417 - chip->wakeup |= IRQ_TO_BIT(irq); 418 else 419 - chip->wakeup &= ~IRQ_TO_BIT(irq); 420 spin_unlock(&chip->lock); 421 422 set_irq_wake(chip->irq, on); 423 return 0; 424 } 425 426 /* 427 * This lock class tells lockdep that GPIO irqs are in a different ··· 449 .direction_input = jz_gpio_direction_input, \ 450 .base = JZ4740_GPIO_BASE_ ## _bank, \ 451 .ngpio = JZ4740_GPIO_NUM_ ## _bank, \ 452 - }, \ 453 - .irq_chip = { \ 454 - .name = "GPIO Bank " # _bank, \ 455 - .mask = jz_gpio_irq_mask, \ 456 - .unmask = jz_gpio_irq_unmask, \ 457 - .ack = jz_gpio_irq_ack, \ 458 - .startup = jz_gpio_irq_startup, \ 459 - .shutdown = jz_gpio_irq_shutdown, \ 460 - .set_type = jz_gpio_irq_set_type, \ 461 - .set_wake = jz_gpio_irq_set_wake, \ 462 }, \ 463 } 464 ··· 514 set_irq_chained_handler(chip->irq, jz_gpio_irq_demux_handler); 515 516 for (irq = chip->irq_base; irq < chip->irq_base + chip->gpio_chip.ngpio; ++irq) { 517 - lockdep_set_class(&irq_desc[irq].lock, &gpio_lock_class); 518 set_irq_chip_data(irq, chip); 519 - set_irq_chip_and_handler(irq, &chip->irq_chip, handle_level_irq); 520 } 521 522 return 0;
··· 86 spinlock_t lock; 87 88 struct gpio_chip gpio_chip; 89 struct sys_device sysdev; 90 }; 91 ··· 102 return container_of(gpio_chip, struct jz_gpio_chip, gpio_chip); 103 } 104 105 + static inline struct jz_gpio_chip *irq_to_jz_gpio_chip(struct irq_data *data) 106 { 107 + return irq_data_get_irq_chip_data(data); 108 } 109 110 static inline void jz_gpio_write_bit(unsigned int gpio, unsigned int reg) ··· 325 generic_handle_irq(gpio_irq); 326 }; 327 328 + static inline void jz_gpio_set_irq_bit(struct irq_data *data, unsigned int reg) 329 { 330 + struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(data); 331 + writel(IRQ_TO_BIT(data->irq), chip->base + reg); 332 } 333 334 + static void jz_gpio_irq_mask(struct irq_data *data) 335 { 336 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_MASK_SET); 337 }; 338 339 + static void jz_gpio_irq_unmask(struct irq_data *data) 340 { 341 + struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(data); 342 343 + jz_gpio_check_trigger_both(chip, data->irq); 344 345 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_MASK_CLEAR); 346 }; 347 348 /* TODO: Check if function is gpio */ 349 + static unsigned int jz_gpio_irq_startup(struct irq_data *data) 350 { 351 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_SELECT_SET); 352 + jz_gpio_irq_unmask(data); 353 return 0; 354 } 355 356 + static void jz_gpio_irq_shutdown(struct irq_data *data) 357 { 358 + jz_gpio_irq_mask(data); 359 360 /* Set direction to input */ 361 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_DIRECTION_CLEAR); 362 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_SELECT_CLEAR); 363 } 364 365 + static void jz_gpio_irq_ack(struct irq_data *data) 366 { 367 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_FLAG_CLEAR); 368 }; 369 370 + static int jz_gpio_irq_set_type(struct irq_data *data, unsigned int flow_type) 371 { 372 + struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(data); 373 + unsigned int irq = data->irq; 374 375 if (flow_type == IRQ_TYPE_EDGE_BOTH) { 376 uint32_t value = readl(chip->base + JZ_REG_GPIO_PIN); ··· 395 396 switch (flow_type) { 397 case IRQ_TYPE_EDGE_RISING: 398 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_DIRECTION_SET); 399 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_TRIGGER_SET); 400 break; 401 case IRQ_TYPE_EDGE_FALLING: 402 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_DIRECTION_CLEAR); 403 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_TRIGGER_SET); 404 break; 405 case IRQ_TYPE_LEVEL_HIGH: 406 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_DIRECTION_SET); 407 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_TRIGGER_CLEAR); 408 break; 409 case IRQ_TYPE_LEVEL_LOW: 410 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_DIRECTION_CLEAR); 411 + jz_gpio_set_irq_bit(data, JZ_REG_GPIO_TRIGGER_CLEAR); 412 break; 413 default: 414 return -EINVAL; 415 } 416 417 return 0; 418 } 419 420 + static int jz_gpio_irq_set_wake(struct irq_data *data, unsigned int on) 421 { 422 + struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(data); 423 spin_lock(&chip->lock); 424 if (on) 425 + chip->wakeup |= IRQ_TO_BIT(data->irq); 426 else 427 + chip->wakeup &= ~IRQ_TO_BIT(data->irq); 428 spin_unlock(&chip->lock); 429 430 set_irq_wake(chip->irq, on); 431 return 0; 432 } 433 + 434 + static struct irq_chip jz_gpio_irq_chip = { 435 + .name = "GPIO", 436 + .irq_mask = jz_gpio_irq_mask, 437 + .irq_unmask = jz_gpio_irq_unmask, 438 + .irq_ack = jz_gpio_irq_ack, 439 + .irq_startup = jz_gpio_irq_startup, 440 + .irq_shutdown = jz_gpio_irq_shutdown, 441 + .irq_set_type = jz_gpio_irq_set_type, 442 + .irq_set_wake = jz_gpio_irq_set_wake, 443 + .flags = IRQCHIP_SET_TYPE_MASKED, 444 + }; 445 446 /* 447 * This lock class tells lockdep that GPIO irqs are in a different ··· 451 .direction_input = jz_gpio_direction_input, \ 452 .base = JZ4740_GPIO_BASE_ ## _bank, \ 453 .ngpio = JZ4740_GPIO_NUM_ ## _bank, \ 454 }, \ 455 } 456 ··· 526 set_irq_chained_handler(chip->irq, jz_gpio_irq_demux_handler); 527 528 for (irq = chip->irq_base; irq < chip->irq_base + chip->gpio_chip.ngpio; ++irq) { 529 + irq_set_lockdep_class(irq, &gpio_lock_class); 530 set_irq_chip_data(irq, chip); 531 + set_irq_chip_and_handler(irq, &jz_gpio_irq_chip, 532 + handle_level_irq); 533 } 534 535 return 0;
+20 -12
arch/mips/jz4740/irq.c
··· 43 44 #define IRQ_BIT(x) BIT((x) - JZ4740_IRQ_BASE) 45 46 - static void intc_irq_unmask(unsigned int irq) 47 { 48 - writel(IRQ_BIT(irq), jz_intc_base + JZ_REG_INTC_CLEAR_MASK); 49 } 50 51 - static void intc_irq_mask(unsigned int irq) 52 { 53 - writel(IRQ_BIT(irq), jz_intc_base + JZ_REG_INTC_SET_MASK); 54 } 55 56 - static int intc_irq_set_wake(unsigned int irq, unsigned int on) 57 { 58 if (on) 59 - jz_intc_wakeup |= IRQ_BIT(irq); 60 else 61 - jz_intc_wakeup &= ~IRQ_BIT(irq); 62 63 return 0; 64 } 65 66 static struct irq_chip intc_irq_type = { 67 .name = "INTC", 68 - .mask = intc_irq_mask, 69 - .mask_ack = intc_irq_mask, 70 - .unmask = intc_irq_unmask, 71 - .set_wake = intc_irq_set_wake, 72 }; 73 74 static irqreturn_t jz4740_cascade(int irq, void *data) ··· 100 101 jz_intc_base = ioremap(JZ4740_INTC_BASE_ADDR, 0x14); 102 103 for (i = JZ4740_IRQ_BASE; i < JZ4740_IRQ_BASE + 32; i++) { 104 - intc_irq_mask(i); 105 set_irq_chip_and_handler(i, &intc_irq_type, handle_level_irq); 106 } 107
··· 43 44 #define IRQ_BIT(x) BIT((x) - JZ4740_IRQ_BASE) 45 46 + static inline unsigned long intc_irq_bit(struct irq_data *data) 47 { 48 + return (unsigned long)irq_data_get_irq_chip_data(data); 49 } 50 51 + static void intc_irq_unmask(struct irq_data *data) 52 { 53 + writel(intc_irq_bit(data), jz_intc_base + JZ_REG_INTC_CLEAR_MASK); 54 } 55 56 + static void intc_irq_mask(struct irq_data *data) 57 + { 58 + writel(intc_irq_bit(data), jz_intc_base + JZ_REG_INTC_SET_MASK); 59 + } 60 + 61 + static int intc_irq_set_wake(struct irq_data *data, unsigned int on) 62 { 63 if (on) 64 + jz_intc_wakeup |= intc_irq_bit(data); 65 else 66 + jz_intc_wakeup &= ~intc_irq_bit(data); 67 68 return 0; 69 } 70 71 static struct irq_chip intc_irq_type = { 72 .name = "INTC", 73 + .irq_mask = intc_irq_mask, 74 + .irq_mask_ack = intc_irq_mask, 75 + .irq_unmask = intc_irq_unmask, 76 + .irq_set_wake = intc_irq_set_wake, 77 }; 78 79 static irqreturn_t jz4740_cascade(int irq, void *data) ··· 95 96 jz_intc_base = ioremap(JZ4740_INTC_BASE_ADDR, 0x14); 97 98 + /* Mask all irqs */ 99 + writel(0xffffffff, jz_intc_base + JZ_REG_INTC_SET_MASK); 100 + 101 for (i = JZ4740_IRQ_BASE; i < JZ4740_IRQ_BASE + 32; i++) { 102 + set_irq_chip_data(i, (void *)IRQ_BIT(i)); 103 set_irq_chip_and_handler(i, &intc_irq_type, handle_level_irq); 104 } 105
+17 -20
arch/mips/kernel/i8259.c
··· 31 32 static int i8259A_auto_eoi = -1; 33 DEFINE_RAW_SPINLOCK(i8259A_lock); 34 - static void disable_8259A_irq(unsigned int irq); 35 - static void enable_8259A_irq(unsigned int irq); 36 - static void mask_and_ack_8259A(unsigned int irq); 37 static void init_8259A(int auto_eoi); 38 39 static struct irq_chip i8259A_chip = { 40 - .name = "XT-PIC", 41 - .mask = disable_8259A_irq, 42 - .disable = disable_8259A_irq, 43 - .unmask = enable_8259A_irq, 44 - .mask_ack = mask_and_ack_8259A, 45 #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF 46 - .set_affinity = plat_set_irq_affinity, 47 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */ 48 }; 49 ··· 59 #define cached_master_mask (cached_irq_mask) 60 #define cached_slave_mask (cached_irq_mask >> 8) 61 62 - static void disable_8259A_irq(unsigned int irq) 63 { 64 - unsigned int mask; 65 unsigned long flags; 66 67 - irq -= I8259A_IRQ_BASE; 68 mask = 1 << irq; 69 raw_spin_lock_irqsave(&i8259A_lock, flags); 70 cached_irq_mask |= mask; ··· 74 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 75 } 76 77 - static void enable_8259A_irq(unsigned int irq) 78 { 79 - unsigned int mask; 80 unsigned long flags; 81 82 - irq -= I8259A_IRQ_BASE; 83 mask = ~(1 << irq); 84 raw_spin_lock_irqsave(&i8259A_lock, flags); 85 cached_irq_mask &= mask; ··· 143 * first, _then_ send the EOI, and the order of EOI 144 * to the two 8259s is important! 145 */ 146 - static void mask_and_ack_8259A(unsigned int irq) 147 { 148 - unsigned int irqmask; 149 unsigned long flags; 150 151 - irq -= I8259A_IRQ_BASE; 152 irqmask = 1 << irq; 153 raw_spin_lock_irqsave(&i8259A_lock, flags); 154 /* ··· 287 * In AEOI mode we just have to mask the interrupt 288 * when acking. 289 */ 290 - i8259A_chip.mask_ack = disable_8259A_irq; 291 else 292 - i8259A_chip.mask_ack = mask_and_ack_8259A; 293 294 udelay(100); /* wait for 8259A to initialize */ 295
··· 31 32 static int i8259A_auto_eoi = -1; 33 DEFINE_RAW_SPINLOCK(i8259A_lock); 34 + static void disable_8259A_irq(struct irq_data *d); 35 + static void enable_8259A_irq(struct irq_data *d); 36 + static void mask_and_ack_8259A(struct irq_data *d); 37 static void init_8259A(int auto_eoi); 38 39 static struct irq_chip i8259A_chip = { 40 + .name = "XT-PIC", 41 + .irq_mask = disable_8259A_irq, 42 + .irq_disable = disable_8259A_irq, 43 + .irq_unmask = enable_8259A_irq, 44 + .irq_mask_ack = mask_and_ack_8259A, 45 #ifdef CONFIG_MIPS_MT_SMTC_IRQAFF 46 + .irq_set_affinity = plat_set_irq_affinity, 47 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */ 48 }; 49 ··· 59 #define cached_master_mask (cached_irq_mask) 60 #define cached_slave_mask (cached_irq_mask >> 8) 61 62 + static void disable_8259A_irq(struct irq_data *d) 63 { 64 + unsigned int mask, irq = d->irq - I8259A_IRQ_BASE; 65 unsigned long flags; 66 67 mask = 1 << irq; 68 raw_spin_lock_irqsave(&i8259A_lock, flags); 69 cached_irq_mask |= mask; ··· 75 raw_spin_unlock_irqrestore(&i8259A_lock, flags); 76 } 77 78 + static void enable_8259A_irq(struct irq_data *d) 79 { 80 + unsigned int mask, irq = d->irq - I8259A_IRQ_BASE; 81 unsigned long flags; 82 83 mask = ~(1 << irq); 84 raw_spin_lock_irqsave(&i8259A_lock, flags); 85 cached_irq_mask &= mask; ··· 145 * first, _then_ send the EOI, and the order of EOI 146 * to the two 8259s is important! 147 */ 148 + static void mask_and_ack_8259A(struct irq_data *d) 149 { 150 + unsigned int irqmask, irq = d->irq - I8259A_IRQ_BASE; 151 unsigned long flags; 152 153 irqmask = 1 << irq; 154 raw_spin_lock_irqsave(&i8259A_lock, flags); 155 /* ··· 290 * In AEOI mode we just have to mask the interrupt 291 * when acking. 292 */ 293 + i8259A_chip.irq_mask_ack = disable_8259A_irq; 294 else 295 + i8259A_chip.irq_mask_ack = mask_and_ack_8259A; 296 297 udelay(100); /* wait for 8259A to initialize */ 298
+18 -25
arch/mips/kernel/irq-gic.c
··· 87 return i; 88 } 89 90 - static unsigned int gic_irq_startup(unsigned int irq) 91 { 92 - irq -= _irqbase; 93 - pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); 94 - GIC_SET_INTR_MASK(irq); 95 - return 0; 96 - } 97 98 - static void gic_irq_ack(unsigned int irq) 99 - { 100 - irq -= _irqbase; 101 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); 102 GIC_CLR_INTR_MASK(irq); 103 ··· 98 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq); 99 } 100 101 - static void gic_mask_irq(unsigned int irq) 102 { 103 - irq -= _irqbase; 104 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); 105 GIC_CLR_INTR_MASK(irq); 106 } 107 108 - static void gic_unmask_irq(unsigned int irq) 109 { 110 - irq -= _irqbase; 111 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); 112 GIC_SET_INTR_MASK(irq); 113 } ··· 116 117 static DEFINE_SPINLOCK(gic_lock); 118 119 - static int gic_set_affinity(unsigned int irq, const struct cpumask *cpumask) 120 { 121 cpumask_t tmp = CPU_MASK_NONE; 122 unsigned long flags; 123 int i; 124 125 - irq -= _irqbase; 126 pr_debug("%s(%d) called\n", __func__, irq); 127 cpumask_and(&tmp, cpumask, cpu_online_mask); 128 if (cpus_empty(tmp)) ··· 141 set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask); 142 143 } 144 - cpumask_copy(irq_desc[irq].affinity, cpumask); 145 spin_unlock_irqrestore(&gic_lock, flags); 146 147 - return 0; 148 } 149 #endif 150 151 static struct irq_chip gic_irq_controller = { 152 - .name = "MIPS GIC", 153 - .startup = gic_irq_startup, 154 - .ack = gic_irq_ack, 155 - .mask = gic_mask_irq, 156 - .mask_ack = gic_mask_irq, 157 - .unmask = gic_unmask_irq, 158 - .eoi = gic_unmask_irq, 159 #ifdef CONFIG_SMP 160 - .set_affinity = gic_set_affinity, 161 #endif 162 }; 163
··· 87 return i; 88 } 89 90 + static void gic_irq_ack(struct irq_data *d) 91 { 92 + unsigned int irq = d->irq - _irqbase; 93 94 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); 95 GIC_CLR_INTR_MASK(irq); 96 ··· 105 GICWRITE(GIC_REG(SHARED, GIC_SH_WEDGE), irq); 106 } 107 108 + static void gic_mask_irq(struct irq_data *d) 109 { 110 + unsigned int irq = d->irq - _irqbase; 111 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); 112 GIC_CLR_INTR_MASK(irq); 113 } 114 115 + static void gic_unmask_irq(struct irq_data *d) 116 { 117 + unsigned int irq = d->irq - _irqbase; 118 pr_debug("CPU%d: %s: irq%d\n", smp_processor_id(), __func__, irq); 119 GIC_SET_INTR_MASK(irq); 120 } ··· 123 124 static DEFINE_SPINLOCK(gic_lock); 125 126 + static int gic_set_affinity(struct irq_data *d, const struct cpumask *cpumask, 127 + bool force) 128 { 129 + unsigned int irq = d->irq - _irqbase; 130 cpumask_t tmp = CPU_MASK_NONE; 131 unsigned long flags; 132 int i; 133 134 pr_debug("%s(%d) called\n", __func__, irq); 135 cpumask_and(&tmp, cpumask, cpu_online_mask); 136 if (cpus_empty(tmp)) ··· 147 set_bit(irq, pcpu_masks[first_cpu(tmp)].pcpu_mask); 148 149 } 150 + cpumask_copy(d->affinity, cpumask); 151 spin_unlock_irqrestore(&gic_lock, flags); 152 153 + return IRQ_SET_MASK_OK_NOCOPY; 154 } 155 #endif 156 157 static struct irq_chip gic_irq_controller = { 158 + .name = "MIPS GIC", 159 + .irq_ack = gic_irq_ack, 160 + .irq_mask = gic_mask_irq, 161 + .irq_mask_ack = gic_mask_irq, 162 + .irq_unmask = gic_unmask_irq, 163 + .irq_eoi = gic_unmask_irq, 164 #ifdef CONFIG_SMP 165 + .irq_set_affinity = gic_set_affinity, 166 #endif 167 }; 168
+13 -13
arch/mips/kernel/irq-gt641xx.c
··· 29 30 static DEFINE_RAW_SPINLOCK(gt641xx_irq_lock); 31 32 - static void ack_gt641xx_irq(unsigned int irq) 33 { 34 unsigned long flags; 35 u32 cause; 36 37 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 38 cause = GT_READ(GT_INTRCAUSE_OFS); 39 - cause &= ~GT641XX_IRQ_TO_BIT(irq); 40 GT_WRITE(GT_INTRCAUSE_OFS, cause); 41 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 42 } 43 44 - static void mask_gt641xx_irq(unsigned int irq) 45 { 46 unsigned long flags; 47 u32 mask; 48 49 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 50 mask = GT_READ(GT_INTRMASK_OFS); 51 - mask &= ~GT641XX_IRQ_TO_BIT(irq); 52 GT_WRITE(GT_INTRMASK_OFS, mask); 53 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 54 } 55 56 - static void mask_ack_gt641xx_irq(unsigned int irq) 57 { 58 unsigned long flags; 59 u32 cause, mask; 60 61 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 62 mask = GT_READ(GT_INTRMASK_OFS); 63 - mask &= ~GT641XX_IRQ_TO_BIT(irq); 64 GT_WRITE(GT_INTRMASK_OFS, mask); 65 66 cause = GT_READ(GT_INTRCAUSE_OFS); 67 - cause &= ~GT641XX_IRQ_TO_BIT(irq); 68 GT_WRITE(GT_INTRCAUSE_OFS, cause); 69 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 70 } 71 72 - static void unmask_gt641xx_irq(unsigned int irq) 73 { 74 unsigned long flags; 75 u32 mask; 76 77 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 78 mask = GT_READ(GT_INTRMASK_OFS); 79 - mask |= GT641XX_IRQ_TO_BIT(irq); 80 GT_WRITE(GT_INTRMASK_OFS, mask); 81 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 82 } 83 84 static struct irq_chip gt641xx_irq_chip = { 85 .name = "GT641xx", 86 - .ack = ack_gt641xx_irq, 87 - .mask = mask_gt641xx_irq, 88 - .mask_ack = mask_ack_gt641xx_irq, 89 - .unmask = unmask_gt641xx_irq, 90 }; 91 92 void gt641xx_irq_dispatch(void)
··· 29 30 static DEFINE_RAW_SPINLOCK(gt641xx_irq_lock); 31 32 + static void ack_gt641xx_irq(struct irq_data *d) 33 { 34 unsigned long flags; 35 u32 cause; 36 37 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 38 cause = GT_READ(GT_INTRCAUSE_OFS); 39 + cause &= ~GT641XX_IRQ_TO_BIT(d->irq); 40 GT_WRITE(GT_INTRCAUSE_OFS, cause); 41 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 42 } 43 44 + static void mask_gt641xx_irq(struct irq_data *d) 45 { 46 unsigned long flags; 47 u32 mask; 48 49 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 50 mask = GT_READ(GT_INTRMASK_OFS); 51 + mask &= ~GT641XX_IRQ_TO_BIT(d->irq); 52 GT_WRITE(GT_INTRMASK_OFS, mask); 53 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 54 } 55 56 + static void mask_ack_gt641xx_irq(struct irq_data *d) 57 { 58 unsigned long flags; 59 u32 cause, mask; 60 61 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 62 mask = GT_READ(GT_INTRMASK_OFS); 63 + mask &= ~GT641XX_IRQ_TO_BIT(d->irq); 64 GT_WRITE(GT_INTRMASK_OFS, mask); 65 66 cause = GT_READ(GT_INTRCAUSE_OFS); 67 + cause &= ~GT641XX_IRQ_TO_BIT(d->irq); 68 GT_WRITE(GT_INTRCAUSE_OFS, cause); 69 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 70 } 71 72 + static void unmask_gt641xx_irq(struct irq_data *d) 73 { 74 unsigned long flags; 75 u32 mask; 76 77 raw_spin_lock_irqsave(&gt641xx_irq_lock, flags); 78 mask = GT_READ(GT_INTRMASK_OFS); 79 + mask |= GT641XX_IRQ_TO_BIT(d->irq); 80 GT_WRITE(GT_INTRMASK_OFS, mask); 81 raw_spin_unlock_irqrestore(&gt641xx_irq_lock, flags); 82 } 83 84 static struct irq_chip gt641xx_irq_chip = { 85 .name = "GT641xx", 86 + .irq_ack = ack_gt641xx_irq, 87 + .irq_mask = mask_gt641xx_irq, 88 + .irq_mask_ack = mask_ack_gt641xx_irq, 89 + .irq_unmask = unmask_gt641xx_irq, 90 }; 91 92 void gt641xx_irq_dispatch(void)
+24 -27
arch/mips/kernel/irq-msc01.c
··· 28 static unsigned int irq_base; 29 30 /* mask off an interrupt */ 31 - static inline void mask_msc_irq(unsigned int irq) 32 { 33 if (irq < (irq_base + 32)) 34 MSCIC_WRITE(MSC01_IC_DISL, 1<<(irq - irq_base)); 35 else ··· 39 } 40 41 /* unmask an interrupt */ 42 - static inline void unmask_msc_irq(unsigned int irq) 43 { 44 if (irq < (irq_base + 32)) 45 MSCIC_WRITE(MSC01_IC_ENAL, 1<<(irq - irq_base)); 46 else ··· 52 /* 53 * Masks and ACKs an IRQ 54 */ 55 - static void level_mask_and_ack_msc_irq(unsigned int irq) 56 { 57 - mask_msc_irq(irq); 58 if (!cpu_has_veic) 59 MSCIC_WRITE(MSC01_IC_EOI, 0); 60 /* This actually needs to be a call into platform code */ ··· 66 /* 67 * Masks and ACKs an IRQ 68 */ 69 - static void edge_mask_and_ack_msc_irq(unsigned int irq) 70 { 71 - mask_msc_irq(irq); 72 if (!cpu_has_veic) 73 MSCIC_WRITE(MSC01_IC_EOI, 0); 74 else { ··· 80 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r); 81 } 82 smtc_im_ack_irq(irq); 83 - } 84 - 85 - /* 86 - * End IRQ processing 87 - */ 88 - static void end_msc_irq(unsigned int irq) 89 - { 90 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 91 - unmask_msc_irq(irq); 92 } 93 94 /* ··· 106 107 static struct irq_chip msc_levelirq_type = { 108 .name = "SOC-it-Level", 109 - .ack = level_mask_and_ack_msc_irq, 110 - .mask = mask_msc_irq, 111 - .mask_ack = level_mask_and_ack_msc_irq, 112 - .unmask = unmask_msc_irq, 113 - .eoi = unmask_msc_irq, 114 - .end = end_msc_irq, 115 }; 116 117 static struct irq_chip msc_edgeirq_type = { 118 .name = "SOC-it-Edge", 119 - .ack = edge_mask_and_ack_msc_irq, 120 - .mask = mask_msc_irq, 121 - .mask_ack = edge_mask_and_ack_msc_irq, 122 - .unmask = unmask_msc_irq, 123 - .eoi = unmask_msc_irq, 124 - .end = end_msc_irq, 125 }; 126 127
··· 28 static unsigned int irq_base; 29 30 /* mask off an interrupt */ 31 + static inline void mask_msc_irq(struct irq_data *d) 32 { 33 + unsigned int irq = d->irq; 34 + 35 if (irq < (irq_base + 32)) 36 MSCIC_WRITE(MSC01_IC_DISL, 1<<(irq - irq_base)); 37 else ··· 37 } 38 39 /* unmask an interrupt */ 40 + static inline void unmask_msc_irq(struct irq_data *d) 41 { 42 + unsigned int irq = d->irq; 43 + 44 if (irq < (irq_base + 32)) 45 MSCIC_WRITE(MSC01_IC_ENAL, 1<<(irq - irq_base)); 46 else ··· 48 /* 49 * Masks and ACKs an IRQ 50 */ 51 + static void level_mask_and_ack_msc_irq(struct irq_data *d) 52 { 53 + unsigned int irq = d->irq; 54 + 55 + mask_msc_irq(d); 56 if (!cpu_has_veic) 57 MSCIC_WRITE(MSC01_IC_EOI, 0); 58 /* This actually needs to be a call into platform code */ ··· 60 /* 61 * Masks and ACKs an IRQ 62 */ 63 + static void edge_mask_and_ack_msc_irq(struct irq_data *d) 64 { 65 + unsigned int irq = d->irq; 66 + 67 + mask_msc_irq(d); 68 if (!cpu_has_veic) 69 MSCIC_WRITE(MSC01_IC_EOI, 0); 70 else { ··· 72 MSCIC_WRITE(MSC01_IC_SUP+irq*8, r); 73 } 74 smtc_im_ack_irq(irq); 75 } 76 77 /* ··· 107 108 static struct irq_chip msc_levelirq_type = { 109 .name = "SOC-it-Level", 110 + .irq_ack = level_mask_and_ack_msc_irq, 111 + .irq_mask = mask_msc_irq, 112 + .irq_mask_ack = level_mask_and_ack_msc_irq, 113 + .irq_unmask = unmask_msc_irq, 114 + .irq_eoi = unmask_msc_irq, 115 }; 116 117 static struct irq_chip msc_edgeirq_type = { 118 .name = "SOC-it-Edge", 119 + .irq_ack = edge_mask_and_ack_msc_irq, 120 + .irq_mask = mask_msc_irq, 121 + .irq_mask_ack = edge_mask_and_ack_msc_irq, 122 + .irq_unmask = unmask_msc_irq, 123 + .irq_eoi = unmask_msc_irq, 124 }; 125 126
+9 -9
arch/mips/kernel/irq-rm7000.c
··· 18 #include <asm/mipsregs.h> 19 #include <asm/system.h> 20 21 - static inline void unmask_rm7k_irq(unsigned int irq) 22 { 23 - set_c0_intcontrol(0x100 << (irq - RM7K_CPU_IRQ_BASE)); 24 } 25 26 - static inline void mask_rm7k_irq(unsigned int irq) 27 { 28 - clear_c0_intcontrol(0x100 << (irq - RM7K_CPU_IRQ_BASE)); 29 } 30 31 static struct irq_chip rm7k_irq_controller = { 32 .name = "RM7000", 33 - .ack = mask_rm7k_irq, 34 - .mask = mask_rm7k_irq, 35 - .mask_ack = mask_rm7k_irq, 36 - .unmask = unmask_rm7k_irq, 37 - .eoi = unmask_rm7k_irq 38 }; 39 40 void __init rm7k_cpu_irq_init(void)
··· 18 #include <asm/mipsregs.h> 19 #include <asm/system.h> 20 21 + static inline void unmask_rm7k_irq(struct irq_data *d) 22 { 23 + set_c0_intcontrol(0x100 << (d->irq - RM7K_CPU_IRQ_BASE)); 24 } 25 26 + static inline void mask_rm7k_irq(struct irq_data *d) 27 { 28 + clear_c0_intcontrol(0x100 << (d->irq - RM7K_CPU_IRQ_BASE)); 29 } 30 31 static struct irq_chip rm7k_irq_controller = { 32 .name = "RM7000", 33 + .irq_ack = mask_rm7k_irq, 34 + .irq_mask = mask_rm7k_irq, 35 + .irq_mask_ack = mask_rm7k_irq, 36 + .irq_unmask = unmask_rm7k_irq, 37 + .irq_eoi = unmask_rm7k_irq 38 }; 39 40 void __init rm7k_cpu_irq_init(void)
+23 -26
arch/mips/kernel/irq-rm9000.c
··· 19 #include <asm/mipsregs.h> 20 #include <asm/system.h> 21 22 - static inline void unmask_rm9k_irq(unsigned int irq) 23 { 24 - set_c0_intcontrol(0x1000 << (irq - RM9K_CPU_IRQ_BASE)); 25 } 26 27 - static inline void mask_rm9k_irq(unsigned int irq) 28 { 29 - clear_c0_intcontrol(0x1000 << (irq - RM9K_CPU_IRQ_BASE)); 30 } 31 32 - static inline void rm9k_cpu_irq_enable(unsigned int irq) 33 { 34 unsigned long flags; 35 36 local_irq_save(flags); 37 - unmask_rm9k_irq(irq); 38 local_irq_restore(flags); 39 } 40 ··· 43 */ 44 static void local_rm9k_perfcounter_irq_startup(void *args) 45 { 46 - unsigned int irq = (unsigned int) args; 47 - 48 - rm9k_cpu_irq_enable(irq); 49 } 50 51 - static unsigned int rm9k_perfcounter_irq_startup(unsigned int irq) 52 { 53 - on_each_cpu(local_rm9k_perfcounter_irq_startup, (void *) irq, 1); 54 55 return 0; 56 } 57 58 static void local_rm9k_perfcounter_irq_shutdown(void *args) 59 { 60 - unsigned int irq = (unsigned int) args; 61 unsigned long flags; 62 63 local_irq_save(flags); 64 - mask_rm9k_irq(irq); 65 local_irq_restore(flags); 66 } 67 68 - static void rm9k_perfcounter_irq_shutdown(unsigned int irq) 69 { 70 - on_each_cpu(local_rm9k_perfcounter_irq_shutdown, (void *) irq, 1); 71 } 72 73 static struct irq_chip rm9k_irq_controller = { 74 .name = "RM9000", 75 - .ack = mask_rm9k_irq, 76 - .mask = mask_rm9k_irq, 77 - .mask_ack = mask_rm9k_irq, 78 - .unmask = unmask_rm9k_irq, 79 - .eoi = unmask_rm9k_irq 80 }; 81 82 static struct irq_chip rm9k_perfcounter_irq = { 83 .name = "RM9000", 84 - .startup = rm9k_perfcounter_irq_startup, 85 - .shutdown = rm9k_perfcounter_irq_shutdown, 86 - .ack = mask_rm9k_irq, 87 - .mask = mask_rm9k_irq, 88 - .mask_ack = mask_rm9k_irq, 89 - .unmask = unmask_rm9k_irq, 90 }; 91 92 unsigned int rm9000_perfcount_irq;
··· 19 #include <asm/mipsregs.h> 20 #include <asm/system.h> 21 22 + static inline void unmask_rm9k_irq(struct irq_data *d) 23 { 24 + set_c0_intcontrol(0x1000 << (d->irq - RM9K_CPU_IRQ_BASE)); 25 } 26 27 + static inline void mask_rm9k_irq(struct irq_data *d) 28 { 29 + clear_c0_intcontrol(0x1000 << (d->irq - RM9K_CPU_IRQ_BASE)); 30 } 31 32 + static inline void rm9k_cpu_irq_enable(struct irq_data *d) 33 { 34 unsigned long flags; 35 36 local_irq_save(flags); 37 + unmask_rm9k_irq(d); 38 local_irq_restore(flags); 39 } 40 ··· 43 */ 44 static void local_rm9k_perfcounter_irq_startup(void *args) 45 { 46 + rm9k_cpu_irq_enable(args); 47 } 48 49 + static unsigned int rm9k_perfcounter_irq_startup(struct irq_data *d) 50 { 51 + on_each_cpu(local_rm9k_perfcounter_irq_startup, d, 1); 52 53 return 0; 54 } 55 56 static void local_rm9k_perfcounter_irq_shutdown(void *args) 57 { 58 unsigned long flags; 59 60 local_irq_save(flags); 61 + mask_rm9k_irq(args); 62 local_irq_restore(flags); 63 } 64 65 + static void rm9k_perfcounter_irq_shutdown(struct irq_data *d) 66 { 67 + on_each_cpu(local_rm9k_perfcounter_irq_shutdown, d, 1); 68 } 69 70 static struct irq_chip rm9k_irq_controller = { 71 .name = "RM9000", 72 + .irq_ack = mask_rm9k_irq, 73 + .irq_mask = mask_rm9k_irq, 74 + .irq_mask_ack = mask_rm9k_irq, 75 + .irq_unmask = unmask_rm9k_irq, 76 + .irq_eoi = unmask_rm9k_irq 77 }; 78 79 static struct irq_chip rm9k_perfcounter_irq = { 80 .name = "RM9000", 81 + .irq_startup = rm9k_perfcounter_irq_startup, 82 + .irq_shutdown = rm9k_perfcounter_irq_shutdown, 83 + .irq_ack = mask_rm9k_irq, 84 + .irq_mask = mask_rm9k_irq, 85 + .irq_mask_ack = mask_rm9k_irq, 86 + .irq_unmask = unmask_rm9k_irq, 87 }; 88 89 unsigned int rm9000_perfcount_irq;
+5 -44
arch/mips/kernel/irq.c
··· 81 82 atomic_t irq_err_count; 83 84 - /* 85 - * Generic, controller-independent functions: 86 - */ 87 - 88 - int show_interrupts(struct seq_file *p, void *v) 89 { 90 - int i = *(loff_t *) v, j; 91 - struct irqaction * action; 92 - unsigned long flags; 93 - 94 - if (i == 0) { 95 - seq_printf(p, " "); 96 - for_each_online_cpu(j) 97 - seq_printf(p, "CPU%d ", j); 98 - seq_putc(p, '\n'); 99 - } 100 - 101 - if (i < NR_IRQS) { 102 - raw_spin_lock_irqsave(&irq_desc[i].lock, flags); 103 - action = irq_desc[i].action; 104 - if (!action) 105 - goto skip; 106 - seq_printf(p, "%3d: ", i); 107 - #ifndef CONFIG_SMP 108 - seq_printf(p, "%10u ", kstat_irqs(i)); 109 - #else 110 - for_each_online_cpu(j) 111 - seq_printf(p, "%10u ", kstat_irqs_cpu(i, j)); 112 - #endif 113 - seq_printf(p, " %14s", irq_desc[i].chip->name); 114 - seq_printf(p, " %s", action->name); 115 - 116 - for (action=action->next; action; action = action->next) 117 - seq_printf(p, ", %s", action->name); 118 - 119 - seq_putc(p, '\n'); 120 - skip: 121 - raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); 122 - } else if (i == NR_IRQS) { 123 - seq_putc(p, '\n'); 124 - seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); 125 - } 126 return 0; 127 } 128 ··· 144 { 145 irq_enter(); 146 check_stack_overflow(); 147 - __DO_IRQ_SMTC_HOOK(irq); 148 - generic_handle_irq(irq); 149 irq_exit(); 150 } 151 ··· 158 void __irq_entry do_IRQ_no_affinity(unsigned int irq) 159 { 160 irq_enter(); 161 - __NO_AFFINITY_IRQ_SMTC_HOOK(irq); 162 generic_handle_irq(irq); 163 irq_exit(); 164 }
··· 81 82 atomic_t irq_err_count; 83 84 + int arch_show_interrupts(struct seq_file *p, int prec) 85 { 86 + seq_printf(p, "%*s: %10u\n", prec, "ERR", atomic_read(&irq_err_count)); 87 return 0; 88 } 89 ··· 183 { 184 irq_enter(); 185 check_stack_overflow(); 186 + if (!smtc_handle_on_other_cpu(irq)) 187 + generic_handle_irq(irq); 188 irq_exit(); 189 } 190 ··· 197 void __irq_entry do_IRQ_no_affinity(unsigned int irq) 198 { 199 irq_enter(); 200 + smtc_im_backstop(irq); 201 generic_handle_irq(irq); 202 irq_exit(); 203 }
+21 -25
arch/mips/kernel/irq_cpu.c
··· 37 #include <asm/mipsmtregs.h> 38 #include <asm/system.h> 39 40 - static inline void unmask_mips_irq(unsigned int irq) 41 { 42 - set_c0_status(0x100 << (irq - MIPS_CPU_IRQ_BASE)); 43 irq_enable_hazard(); 44 } 45 46 - static inline void mask_mips_irq(unsigned int irq) 47 { 48 - clear_c0_status(0x100 << (irq - MIPS_CPU_IRQ_BASE)); 49 irq_disable_hazard(); 50 } 51 52 static struct irq_chip mips_cpu_irq_controller = { 53 .name = "MIPS", 54 - .ack = mask_mips_irq, 55 - .mask = mask_mips_irq, 56 - .mask_ack = mask_mips_irq, 57 - .unmask = unmask_mips_irq, 58 - .eoi = unmask_mips_irq, 59 }; 60 61 /* 62 * Basically the same as above but taking care of all the MT stuff 63 */ 64 65 - #define unmask_mips_mt_irq unmask_mips_irq 66 - #define mask_mips_mt_irq mask_mips_irq 67 - 68 - static unsigned int mips_mt_cpu_irq_startup(unsigned int irq) 69 { 70 unsigned int vpflags = dvpe(); 71 72 - clear_c0_cause(0x100 << (irq - MIPS_CPU_IRQ_BASE)); 73 evpe(vpflags); 74 - unmask_mips_mt_irq(irq); 75 - 76 return 0; 77 } 78 ··· 76 * While we ack the interrupt interrupts are disabled and thus we don't need 77 * to deal with concurrency issues. Same for mips_cpu_irq_end. 78 */ 79 - static void mips_mt_cpu_irq_ack(unsigned int irq) 80 { 81 unsigned int vpflags = dvpe(); 82 - clear_c0_cause(0x100 << (irq - MIPS_CPU_IRQ_BASE)); 83 evpe(vpflags); 84 - mask_mips_mt_irq(irq); 85 } 86 87 static struct irq_chip mips_mt_cpu_irq_controller = { 88 .name = "MIPS", 89 - .startup = mips_mt_cpu_irq_startup, 90 - .ack = mips_mt_cpu_irq_ack, 91 - .mask = mask_mips_mt_irq, 92 - .mask_ack = mips_mt_cpu_irq_ack, 93 - .unmask = unmask_mips_mt_irq, 94 - .eoi = unmask_mips_mt_irq, 95 }; 96 97 void __init mips_cpu_irq_init(void)
··· 37 #include <asm/mipsmtregs.h> 38 #include <asm/system.h> 39 40 + static inline void unmask_mips_irq(struct irq_data *d) 41 { 42 + set_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 43 irq_enable_hazard(); 44 } 45 46 + static inline void mask_mips_irq(struct irq_data *d) 47 { 48 + clear_c0_status(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 49 irq_disable_hazard(); 50 } 51 52 static struct irq_chip mips_cpu_irq_controller = { 53 .name = "MIPS", 54 + .irq_ack = mask_mips_irq, 55 + .irq_mask = mask_mips_irq, 56 + .irq_mask_ack = mask_mips_irq, 57 + .irq_unmask = unmask_mips_irq, 58 + .irq_eoi = unmask_mips_irq, 59 }; 60 61 /* 62 * Basically the same as above but taking care of all the MT stuff 63 */ 64 65 + static unsigned int mips_mt_cpu_irq_startup(struct irq_data *d) 66 { 67 unsigned int vpflags = dvpe(); 68 69 + clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 70 evpe(vpflags); 71 + unmask_mips_irq(d); 72 return 0; 73 } 74 ··· 80 * While we ack the interrupt interrupts are disabled and thus we don't need 81 * to deal with concurrency issues. Same for mips_cpu_irq_end. 82 */ 83 + static void mips_mt_cpu_irq_ack(struct irq_data *d) 84 { 85 unsigned int vpflags = dvpe(); 86 + clear_c0_cause(0x100 << (d->irq - MIPS_CPU_IRQ_BASE)); 87 evpe(vpflags); 88 + mask_mips_irq(d); 89 } 90 91 static struct irq_chip mips_mt_cpu_irq_controller = { 92 .name = "MIPS", 93 + .irq_startup = mips_mt_cpu_irq_startup, 94 + .irq_ack = mips_mt_cpu_irq_ack, 95 + .irq_mask = mask_mips_irq, 96 + .irq_mask_ack = mips_mt_cpu_irq_ack, 97 + .irq_unmask = unmask_mips_irq, 98 + .irq_eoi = unmask_mips_irq, 99 }; 100 101 void __init mips_cpu_irq_init(void)
+14 -14
arch/mips/kernel/irq_txx9.c
··· 63 unsigned char mode; 64 } txx9irq[TXx9_MAX_IR] __read_mostly; 65 66 - static void txx9_irq_unmask(unsigned int irq) 67 { 68 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 69 u32 __iomem *ilrp = &txx9_ircptr->ilr[(irq_nr % 16 ) / 2]; 70 int ofs = irq_nr / 16 * 16 + (irq_nr & 1) * 8; 71 ··· 79 #endif 80 } 81 82 - static inline void txx9_irq_mask(unsigned int irq) 83 { 84 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 85 u32 __iomem *ilrp = &txx9_ircptr->ilr[(irq_nr % 16) / 2]; 86 int ofs = irq_nr / 16 * 16 + (irq_nr & 1) * 8; 87 ··· 99 #endif 100 } 101 102 - static void txx9_irq_mask_ack(unsigned int irq) 103 { 104 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 105 106 - txx9_irq_mask(irq); 107 /* clear edge detection */ 108 if (unlikely(TXx9_IRCR_EDGE(txx9irq[irq_nr].mode))) 109 __raw_writel(TXx9_IRSCR_EIClrE | irq_nr, &txx9_ircptr->scr); 110 } 111 112 - static int txx9_irq_set_type(unsigned int irq, unsigned int flow_type) 113 { 114 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 115 u32 cr; 116 u32 __iomem *crp; 117 int ofs; ··· 139 140 static struct irq_chip txx9_irq_chip = { 141 .name = "TXX9", 142 - .ack = txx9_irq_mask_ack, 143 - .mask = txx9_irq_mask, 144 - .mask_ack = txx9_irq_mask_ack, 145 - .unmask = txx9_irq_unmask, 146 - .set_type = txx9_irq_set_type, 147 }; 148 149 void __init txx9_irq_init(unsigned long baseaddr)
··· 63 unsigned char mode; 64 } txx9irq[TXx9_MAX_IR] __read_mostly; 65 66 + static void txx9_irq_unmask(struct irq_data *d) 67 { 68 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 69 u32 __iomem *ilrp = &txx9_ircptr->ilr[(irq_nr % 16 ) / 2]; 70 int ofs = irq_nr / 16 * 16 + (irq_nr & 1) * 8; 71 ··· 79 #endif 80 } 81 82 + static inline void txx9_irq_mask(struct irq_data *d) 83 { 84 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 85 u32 __iomem *ilrp = &txx9_ircptr->ilr[(irq_nr % 16) / 2]; 86 int ofs = irq_nr / 16 * 16 + (irq_nr & 1) * 8; 87 ··· 99 #endif 100 } 101 102 + static void txx9_irq_mask_ack(struct irq_data *d) 103 { 104 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 105 106 + txx9_irq_mask(d); 107 /* clear edge detection */ 108 if (unlikely(TXx9_IRCR_EDGE(txx9irq[irq_nr].mode))) 109 __raw_writel(TXx9_IRSCR_EIClrE | irq_nr, &txx9_ircptr->scr); 110 } 111 112 + static int txx9_irq_set_type(struct irq_data *d, unsigned int flow_type) 113 { 114 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 115 u32 cr; 116 u32 __iomem *crp; 117 int ofs; ··· 139 140 static struct irq_chip txx9_irq_chip = { 141 .name = "TXX9", 142 + .irq_ack = txx9_irq_mask_ack, 143 + .irq_mask = txx9_irq_mask, 144 + .irq_mask_ack = txx9_irq_mask_ack, 145 + .irq_unmask = txx9_irq_unmask, 146 + .irq_set_type = txx9_irq_set_type, 147 }; 148 149 void __init txx9_irq_init(unsigned long baseaddr)
+4
arch/mips/kernel/scall32-o32.S
··· 586 sys sys_fanotify_init 2 587 sys sys_fanotify_mark 6 588 sys sys_prlimit64 4 589 .endm 590 591 /* We pre-compute the number of _instruction_ bytes needed to
··· 586 sys sys_fanotify_init 2 587 sys sys_fanotify_mark 6 588 sys sys_prlimit64 4 589 + sys sys_name_to_handle_at 5 590 + sys sys_open_by_handle_at 3 /* 4340 */ 591 + sys sys_clock_adjtime 2 592 + sys sys_syncfs 1 593 .endm 594 595 /* We pre-compute the number of _instruction_ bytes needed to
+4
arch/mips/kernel/scall64-64.S
··· 425 PTR sys_fanotify_init /* 5295 */ 426 PTR sys_fanotify_mark 427 PTR sys_prlimit64 428 .size sys_call_table,.-sys_call_table
··· 425 PTR sys_fanotify_init /* 5295 */ 426 PTR sys_fanotify_mark 427 PTR sys_prlimit64 428 + PTR sys_name_to_handle_at 429 + PTR sys_open_by_handle_at 430 + PTR sys_clock_adjtime /* 5300 */ 431 + PTR sys_syncfs 432 .size sys_call_table,.-sys_call_table
+4
arch/mips/kernel/scall64-n32.S
··· 425 PTR sys_fanotify_init /* 6300 */ 426 PTR sys_fanotify_mark 427 PTR sys_prlimit64 428 .size sysn32_call_table,.-sysn32_call_table
··· 425 PTR sys_fanotify_init /* 6300 */ 426 PTR sys_fanotify_mark 427 PTR sys_prlimit64 428 + PTR sys_name_to_handle_at 429 + PTR sys_open_by_handle_at 430 + PTR compat_sys_clock_adjtime /* 6305 */ 431 + PTR sys_syncfs 432 .size sysn32_call_table,.-sysn32_call_table
+4
arch/mips/kernel/scall64-o32.S
··· 543 PTR sys_fanotify_init 544 PTR sys_32_fanotify_mark 545 PTR sys_prlimit64 546 .size sys_call_table,.-sys_call_table
··· 543 PTR sys_fanotify_init 544 PTR sys_32_fanotify_mark 545 PTR sys_prlimit64 546 + PTR sys_name_to_handle_at 547 + PTR compat_sys_open_by_handle_at /* 4340 */ 548 + PTR compat_sys_clock_adjtime 549 + PTR sys_syncfs 550 .size sys_call_table,.-sys_call_table
+6 -7
arch/mips/kernel/smtc.c
··· 677 */ 678 } 679 680 - void smtc_forward_irq(unsigned int irq) 681 { 682 int target; 683 684 /* ··· 693 * and efficiency, we just pick the easiest one to find. 694 */ 695 696 - target = cpumask_first(irq_desc[irq].affinity); 697 698 /* 699 * We depend on the platform code to have correctly processed ··· 708 */ 709 710 /* If no one is eligible, service locally */ 711 - if (target >= NR_CPUS) { 712 do_IRQ_no_affinity(irq); 713 - return; 714 - } 715 - 716 - smtc_send_ipi(target, IRQ_AFFINITY_IPI, irq); 717 } 718 719 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
··· 677 */ 678 } 679 680 + void smtc_forward_irq(struct irq_data *d) 681 { 682 + unsigned int irq = d->irq; 683 int target; 684 685 /* ··· 692 * and efficiency, we just pick the easiest one to find. 693 */ 694 695 + target = cpumask_first(d->affinity); 696 697 /* 698 * We depend on the platform code to have correctly processed ··· 707 */ 708 709 /* If no one is eligible, service locally */ 710 + if (target >= NR_CPUS) 711 do_IRQ_no_affinity(irq); 712 + else 713 + smtc_send_ipi(target, IRQ_AFFINITY_IPI, irq); 714 } 715 716 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
+8 -8
arch/mips/lasat/interrupt.c
··· 32 static volatile int *lasat_int_mask; 33 static volatile int lasat_int_mask_shift; 34 35 - void disable_lasat_irq(unsigned int irq_nr) 36 { 37 - irq_nr -= LASAT_IRQ_BASE; 38 *lasat_int_mask &= ~(1 << irq_nr) << lasat_int_mask_shift; 39 } 40 41 - void enable_lasat_irq(unsigned int irq_nr) 42 { 43 - irq_nr -= LASAT_IRQ_BASE; 44 *lasat_int_mask |= (1 << irq_nr) << lasat_int_mask_shift; 45 } 46 47 static struct irq_chip lasat_irq_type = { 48 .name = "Lasat", 49 - .ack = disable_lasat_irq, 50 - .mask = disable_lasat_irq, 51 - .mask_ack = disable_lasat_irq, 52 - .unmask = enable_lasat_irq, 53 }; 54 55 static inline int ls1bit32(unsigned int x)
··· 32 static volatile int *lasat_int_mask; 33 static volatile int lasat_int_mask_shift; 34 35 + void disable_lasat_irq(struct irq_data *d) 36 { 37 + unsigned int irq_nr = d->irq - LASAT_IRQ_BASE; 38 + 39 *lasat_int_mask &= ~(1 << irq_nr) << lasat_int_mask_shift; 40 } 41 42 + void enable_lasat_irq(struct irq_data *d) 43 { 44 + unsigned int irq_nr = d->irq - LASAT_IRQ_BASE; 45 + 46 *lasat_int_mask |= (1 << irq_nr) << lasat_int_mask_shift; 47 } 48 49 static struct irq_chip lasat_irq_type = { 50 .name = "Lasat", 51 + .irq_mask = disable_lasat_irq, 52 + .irq_unmask = enable_lasat_irq, 53 }; 54 55 static inline int ls1bit32(unsigned int x)
+7 -9
arch/mips/loongson/common/bonito-irq.c
··· 16 17 #include <loongson.h> 18 19 - static inline void bonito_irq_enable(unsigned int irq) 20 { 21 - LOONGSON_INTENSET = (1 << (irq - LOONGSON_IRQ_BASE)); 22 mmiowb(); 23 } 24 25 - static inline void bonito_irq_disable(unsigned int irq) 26 { 27 - LOONGSON_INTENCLR = (1 << (irq - LOONGSON_IRQ_BASE)); 28 mmiowb(); 29 } 30 31 static struct irq_chip bonito_irq_type = { 32 - .name = "bonito_irq", 33 - .ack = bonito_irq_disable, 34 - .mask = bonito_irq_disable, 35 - .mask_ack = bonito_irq_disable, 36 - .unmask = bonito_irq_enable, 37 }; 38 39 static struct irqaction __maybe_unused dma_timeout_irqaction = {
··· 16 17 #include <loongson.h> 18 19 + static inline void bonito_irq_enable(struct irq_data *d) 20 { 21 + LOONGSON_INTENSET = (1 << (d->irq - LOONGSON_IRQ_BASE)); 22 mmiowb(); 23 } 24 25 + static inline void bonito_irq_disable(struct irq_data *d) 26 { 27 + LOONGSON_INTENCLR = (1 << (d->irq - LOONGSON_IRQ_BASE)); 28 mmiowb(); 29 } 30 31 static struct irq_chip bonito_irq_type = { 32 + .name = "bonito_irq", 33 + .irq_mask = bonito_irq_disable, 34 + .irq_unmask = bonito_irq_enable, 35 }; 36 37 static struct irqaction __maybe_unused dma_timeout_irqaction = {
+1 -2
arch/mips/mipssim/sim_smtc.c
··· 27 #include <asm/atomic.h> 28 #include <asm/cpu.h> 29 #include <asm/processor.h> 30 #include <asm/system.h> 31 #include <asm/mmu_context.h> 32 #include <asm/smtc_ipi.h> ··· 58 */ 59 static void __cpuinit ssmtc_init_secondary(void) 60 { 61 - void smtc_init_secondary(void); 62 - 63 smtc_init_secondary(); 64 } 65
··· 27 #include <asm/atomic.h> 28 #include <asm/cpu.h> 29 #include <asm/processor.h> 30 + #include <asm/smtc.h> 31 #include <asm/system.h> 32 #include <asm/mmu_context.h> 33 #include <asm/smtc_ipi.h> ··· 57 */ 58 static void __cpuinit ssmtc_init_secondary(void) 59 { 60 smtc_init_secondary(); 61 } 62
+5 -5
arch/mips/mti-malta/malta-smtc.c
··· 34 */ 35 static void __cpuinit msmtc_init_secondary(void) 36 { 37 - void smtc_init_secondary(void); 38 int myvpe; 39 40 /* Don't enable Malta I/O interrupts (IP2) for secondary VPEs */ ··· 113 */ 114 115 116 - int plat_set_irq_affinity(unsigned int irq, const struct cpumask *affinity) 117 { 118 cpumask_t tmask; 119 int cpu = 0; ··· 144 if ((cpu_data[cpu].vpe_id != 0) || !cpu_online(cpu)) 145 cpu_clear(cpu, tmask); 146 } 147 - cpumask_copy(irq_desc[irq].affinity, &tmask); 148 149 if (cpus_empty(tmask)) 150 /* ··· 155 "IRQ affinity leaves no legal CPU for IRQ %d\n", irq); 156 157 /* Do any generic SMTC IRQ affinity setup */ 158 - smtc_set_irq_affinity(irq, tmask); 159 160 - return 0; 161 } 162 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
··· 34 */ 35 static void __cpuinit msmtc_init_secondary(void) 36 { 37 int myvpe; 38 39 /* Don't enable Malta I/O interrupts (IP2) for secondary VPEs */ ··· 114 */ 115 116 117 + int plat_set_irq_affinity(struct irq_data *d, const struct cpumask *affinity, 118 + bool force) 119 { 120 cpumask_t tmask; 121 int cpu = 0; ··· 144 if ((cpu_data[cpu].vpe_id != 0) || !cpu_online(cpu)) 145 cpu_clear(cpu, tmask); 146 } 147 + cpumask_copy(d->affinity, &tmask); 148 149 if (cpus_empty(tmask)) 150 /* ··· 155 "IRQ affinity leaves no legal CPU for IRQ %d\n", irq); 156 157 /* Do any generic SMTC IRQ affinity setup */ 158 + smtc_set_irq_affinity(d->irq, tmask); 159 160 + return IRQ_SET_MASK_OK_NOCOPY; 161 } 162 #endif /* CONFIG_MIPS_MT_SMTC_IRQAFF */
+15
arch/mips/pmc-sierra/Kconfig
··· 23 select SYS_SUPPORTS_MULTITHREADING 24 select IRQ_MSP_CIC 25 select HW_HAS_PCI 26 27 config PMC_MSP7120_FPGA 28 bool "PMC-Sierra MSP7120 FPGA" ··· 37 config HYPERTRANSPORT 38 bool "Hypertransport Support for PMC-Sierra Yosemite" 39 depends on PMC_YOSEMITE
··· 23 select SYS_SUPPORTS_MULTITHREADING 24 select IRQ_MSP_CIC 25 select HW_HAS_PCI 26 + select MSP_HAS_USB 27 + select MSP_ETH 28 29 config PMC_MSP7120_FPGA 30 bool "PMC-Sierra MSP7120 FPGA" ··· 35 config HYPERTRANSPORT 36 bool "Hypertransport Support for PMC-Sierra Yosemite" 37 depends on PMC_YOSEMITE 38 + 39 + config MSP_HAS_USB 40 + boolean 41 + depends on PMC_MSP 42 + 43 + config MSP_ETH 44 + boolean 45 + select MSP_HAS_MAC 46 + depends on PMC_MSP 47 + 48 + config MSP_HAS_MAC 49 + boolean 50 + depends on PMC_MSP
+5 -3
arch/mips/pmc-sierra/msp71xx/Makefile
··· 6 obj-$(CONFIG_HAVE_GPIO_LIB) += gpio.o gpio_extended.o 7 obj-$(CONFIG_PMC_MSP7120_GW) += msp_hwbutton.o 8 obj-$(CONFIG_IRQ_MSP_SLP) += msp_irq_slp.o 9 - obj-$(CONFIG_IRQ_MSP_CIC) += msp_irq_cic.o 10 obj-$(CONFIG_PCI) += msp_pci.o 11 - obj-$(CONFIG_MSPETH) += msp_eth.o 12 - obj-$(CONFIG_USB_MSP71XX) += msp_usb.o
··· 6 obj-$(CONFIG_HAVE_GPIO_LIB) += gpio.o gpio_extended.o 7 obj-$(CONFIG_PMC_MSP7120_GW) += msp_hwbutton.o 8 obj-$(CONFIG_IRQ_MSP_SLP) += msp_irq_slp.o 9 + obj-$(CONFIG_IRQ_MSP_CIC) += msp_irq_cic.o msp_irq_per.o 10 obj-$(CONFIG_PCI) += msp_pci.o 11 + obj-$(CONFIG_MSP_HAS_MAC) += msp_eth.o 12 + obj-$(CONFIG_MSP_HAS_USB) += msp_usb.o 13 + obj-$(CONFIG_MIPS_MT_SMP) += msp_smp.o 14 + obj-$(CONFIG_MIPS_MT_SMTC) += msp_smtc.o
+187
arch/mips/pmc-sierra/msp71xx/msp_eth.c
···
··· 1 + /* 2 + * The setup file for ethernet related hardware on PMC-Sierra MSP processors. 3 + * 4 + * Copyright 2010 PMC-Sierra, Inc. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + * 11 + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED 12 + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 13 + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN 14 + * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 15 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 16 + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 17 + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 18 + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 19 + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 20 + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 21 + * 22 + * You should have received a copy of the GNU General Public License along 23 + * with this program; if not, write to the Free Software Foundation, Inc., 24 + * 675 Mass Ave, Cambridge, MA 02139, USA. 25 + */ 26 + 27 + #include <linux/init.h> 28 + #include <linux/kernel.h> 29 + #include <linux/ioport.h> 30 + #include <linux/platform_device.h> 31 + #include <linux/delay.h> 32 + #include <msp_regs.h> 33 + #include <msp_int.h> 34 + #include <msp_gpio_macros.h> 35 + 36 + 37 + #define MSP_ETHERNET_GPIO0 14 38 + #define MSP_ETHERNET_GPIO1 15 39 + #define MSP_ETHERNET_GPIO2 16 40 + 41 + #ifdef CONFIG_MSP_HAS_TSMAC 42 + #define MSP_TSMAC_SIZE 0x10020 43 + #define MSP_TSMAC_ID "pmc_tsmac" 44 + 45 + static struct resource msp_tsmac0_resources[] = { 46 + [0] = { 47 + .start = MSP_MAC0_BASE, 48 + .end = MSP_MAC0_BASE + MSP_TSMAC_SIZE - 1, 49 + .flags = IORESOURCE_MEM, 50 + }, 51 + [1] = { 52 + .start = MSP_INT_MAC0, 53 + .end = MSP_INT_MAC0, 54 + .flags = IORESOURCE_IRQ, 55 + }, 56 + }; 57 + 58 + static struct resource msp_tsmac1_resources[] = { 59 + [0] = { 60 + .start = MSP_MAC1_BASE, 61 + .end = MSP_MAC1_BASE + MSP_TSMAC_SIZE - 1, 62 + .flags = IORESOURCE_MEM, 63 + }, 64 + [1] = { 65 + .start = MSP_INT_MAC1, 66 + .end = MSP_INT_MAC1, 67 + .flags = IORESOURCE_IRQ, 68 + }, 69 + }; 70 + static struct resource msp_tsmac2_resources[] = { 71 + [0] = { 72 + .start = MSP_MAC2_BASE, 73 + .end = MSP_MAC2_BASE + MSP_TSMAC_SIZE - 1, 74 + .flags = IORESOURCE_MEM, 75 + }, 76 + [1] = { 77 + .start = MSP_INT_SAR, 78 + .end = MSP_INT_SAR, 79 + .flags = IORESOURCE_IRQ, 80 + }, 81 + }; 82 + 83 + 84 + static struct platform_device tsmac_device[] = { 85 + [0] = { 86 + .name = MSP_TSMAC_ID, 87 + .id = 0, 88 + .num_resources = ARRAY_SIZE(msp_tsmac0_resources), 89 + .resource = msp_tsmac0_resources, 90 + }, 91 + [1] = { 92 + .name = MSP_TSMAC_ID, 93 + .id = 1, 94 + .num_resources = ARRAY_SIZE(msp_tsmac1_resources), 95 + .resource = msp_tsmac1_resources, 96 + }, 97 + [2] = { 98 + .name = MSP_TSMAC_ID, 99 + .id = 2, 100 + .num_resources = ARRAY_SIZE(msp_tsmac2_resources), 101 + .resource = msp_tsmac2_resources, 102 + }, 103 + }; 104 + #define msp_eth_devs tsmac_device 105 + 106 + #else 107 + /* If it is not TSMAC assume MSP_ETH (100Mbps) */ 108 + #define MSP_ETH_ID "pmc_mspeth" 109 + #define MSP_ETH_SIZE 0xE0 110 + static struct resource msp_eth0_resources[] = { 111 + [0] = { 112 + .start = MSP_MAC0_BASE, 113 + .end = MSP_MAC0_BASE + MSP_ETH_SIZE - 1, 114 + .flags = IORESOURCE_MEM, 115 + }, 116 + [1] = { 117 + .start = MSP_INT_MAC0, 118 + .end = MSP_INT_MAC0, 119 + .flags = IORESOURCE_IRQ, 120 + }, 121 + }; 122 + 123 + static struct resource msp_eth1_resources[] = { 124 + [0] = { 125 + .start = MSP_MAC1_BASE, 126 + .end = MSP_MAC1_BASE + MSP_ETH_SIZE - 1, 127 + .flags = IORESOURCE_MEM, 128 + }, 129 + [1] = { 130 + .start = MSP_INT_MAC1, 131 + .end = MSP_INT_MAC1, 132 + .flags = IORESOURCE_IRQ, 133 + }, 134 + }; 135 + 136 + 137 + 138 + static struct platform_device mspeth_device[] = { 139 + [0] = { 140 + .name = MSP_ETH_ID, 141 + .id = 0, 142 + .num_resources = ARRAY_SIZE(msp_eth0_resources), 143 + .resource = msp_eth0_resources, 144 + }, 145 + [1] = { 146 + .name = MSP_ETH_ID, 147 + .id = 1, 148 + .num_resources = ARRAY_SIZE(msp_eth1_resources), 149 + .resource = msp_eth1_resources, 150 + }, 151 + 152 + }; 153 + #define msp_eth_devs mspeth_device 154 + 155 + #endif 156 + int __init msp_eth_setup(void) 157 + { 158 + int i, ret = 0; 159 + 160 + /* Configure the GPIO and take the ethernet PHY out of reset */ 161 + msp_gpio_pin_mode(MSP_GPIO_OUTPUT, MSP_ETHERNET_GPIO0); 162 + msp_gpio_pin_hi(MSP_ETHERNET_GPIO0); 163 + 164 + #ifdef CONFIG_MSP_HAS_TSMAC 165 + /* 3 phys on boards with TSMAC */ 166 + msp_gpio_pin_mode(MSP_GPIO_OUTPUT, MSP_ETHERNET_GPIO1); 167 + msp_gpio_pin_hi(MSP_ETHERNET_GPIO1); 168 + 169 + msp_gpio_pin_mode(MSP_GPIO_OUTPUT, MSP_ETHERNET_GPIO2); 170 + msp_gpio_pin_hi(MSP_ETHERNET_GPIO2); 171 + #endif 172 + for (i = 0; i < ARRAY_SIZE(msp_eth_devs); i++) { 173 + ret = platform_device_register(&msp_eth_devs[i]); 174 + printk(KERN_INFO "device: %d, return value = %d\n", i, ret); 175 + if (ret) { 176 + platform_device_unregister(&msp_eth_devs[i]); 177 + break; 178 + } 179 + } 180 + 181 + if (ret) 182 + printk(KERN_WARNING "Could not initialize " 183 + "MSPETH device structures.\n"); 184 + 185 + return ret; 186 + } 187 + subsys_initcall(msp_eth_setup);
+46 -8
arch/mips/pmc-sierra/msp71xx/msp_irq.c
··· 19 20 #include <msp_int.h> 21 22 - extern void msp_int_handle(void); 23 - 24 /* SLP bases systems */ 25 extern void msp_slp_irq_init(void); 26 extern void msp_slp_irq_dispatch(void); ··· 26 /* CIC based systems */ 27 extern void msp_cic_irq_init(void); 28 extern void msp_cic_irq_dispatch(void); 29 30 /* 31 * The PMC-Sierra MSP interrupts are arranged in a 3 level cascaded ··· 106 do_IRQ(MSP_INT_SW1); 107 } 108 109 - static struct irqaction cascade_msp = { 110 .handler = no_action, 111 - .name = "MSP cascade" 112 }; 113 114 115 void __init arch_init_irq(void) 116 { 117 /* initialize the 1st-level CPU based interrupt controller */ 118 mips_cpu_irq_init(); 119 120 #ifdef CONFIG_IRQ_MSP_CIC 121 msp_cic_irq_init(); 122 123 /* setup the cascaded interrupts */ 124 - setup_irq(MSP_INT_CIC, &cascade_msp); 125 - setup_irq(MSP_INT_PER, &cascade_msp); 126 #else 127 /* setup the 2nd-level SLP register based interrupt controller */ 128 msp_slp_irq_init(); 129 130 /* setup the cascaded SLP/PER interrupts */ 131 - setup_irq(MSP_INT_SLP, &cascade_msp); 132 - setup_irq(MSP_INT_PER, &cascade_msp); 133 #endif 134 }
··· 19 20 #include <msp_int.h> 21 22 /* SLP bases systems */ 23 extern void msp_slp_irq_init(void); 24 extern void msp_slp_irq_dispatch(void); ··· 28 /* CIC based systems */ 29 extern void msp_cic_irq_init(void); 30 extern void msp_cic_irq_dispatch(void); 31 + 32 + /* VSMP support init */ 33 + extern void msp_vsmp_int_init(void); 34 + 35 + /* vectored interrupt implementation */ 36 + 37 + /* SW0/1 interrupts are used for SMP/SMTC */ 38 + static inline void mac0_int_dispatch(void) { do_IRQ(MSP_INT_MAC0); } 39 + static inline void mac1_int_dispatch(void) { do_IRQ(MSP_INT_MAC1); } 40 + static inline void mac2_int_dispatch(void) { do_IRQ(MSP_INT_SAR); } 41 + static inline void usb_int_dispatch(void) { do_IRQ(MSP_INT_USB); } 42 + static inline void sec_int_dispatch(void) { do_IRQ(MSP_INT_SEC); } 43 44 /* 45 * The PMC-Sierra MSP interrupts are arranged in a 3 level cascaded ··· 96 do_IRQ(MSP_INT_SW1); 97 } 98 99 + static struct irqaction cic_cascade_msp = { 100 .handler = no_action, 101 + .name = "MSP CIC cascade" 102 }; 103 104 + static struct irqaction per_cascade_msp = { 105 + .handler = no_action, 106 + .name = "MSP PER cascade" 107 + }; 108 109 void __init arch_init_irq(void) 110 { 111 + /* assume we'll be using vectored interrupt mode except in UP mode*/ 112 + #ifdef CONFIG_MIPS_MT 113 + BUG_ON(!cpu_has_vint); 114 + #endif 115 /* initialize the 1st-level CPU based interrupt controller */ 116 mips_cpu_irq_init(); 117 118 #ifdef CONFIG_IRQ_MSP_CIC 119 msp_cic_irq_init(); 120 + #ifdef CONFIG_MIPS_MT 121 + set_vi_handler(MSP_INT_CIC, msp_cic_irq_dispatch); 122 + set_vi_handler(MSP_INT_MAC0, mac0_int_dispatch); 123 + set_vi_handler(MSP_INT_MAC1, mac1_int_dispatch); 124 + set_vi_handler(MSP_INT_SAR, mac2_int_dispatch); 125 + set_vi_handler(MSP_INT_USB, usb_int_dispatch); 126 + set_vi_handler(MSP_INT_SEC, sec_int_dispatch); 127 + #ifdef CONFIG_MIPS_MT_SMP 128 + msp_vsmp_int_init(); 129 + #elif defined CONFIG_MIPS_MT_SMTC 130 + /*Set hwmask for all platform devices */ 131 + irq_hwmask[MSP_INT_MAC0] = C_IRQ0; 132 + irq_hwmask[MSP_INT_MAC1] = C_IRQ1; 133 + irq_hwmask[MSP_INT_USB] = C_IRQ2; 134 + irq_hwmask[MSP_INT_SAR] = C_IRQ3; 135 + irq_hwmask[MSP_INT_SEC] = C_IRQ5; 136 137 + #endif /* CONFIG_MIPS_MT_SMP */ 138 + #endif /* CONFIG_MIPS_MT */ 139 /* setup the cascaded interrupts */ 140 + setup_irq(MSP_INT_CIC, &cic_cascade_msp); 141 + setup_irq(MSP_INT_PER, &per_cascade_msp); 142 + 143 #else 144 /* setup the 2nd-level SLP register based interrupt controller */ 145 + /* VSMP /SMTC support support is not enabled for SLP */ 146 msp_slp_irq_init(); 147 148 /* setup the cascaded SLP/PER interrupts */ 149 + setup_irq(MSP_INT_SLP, &cic_cascade_msp); 150 + setup_irq(MSP_INT_PER, &per_cascade_msp); 151 #endif 152 }
+163 -80
arch/mips/pmc-sierra/msp71xx/msp_irq_cic.c
··· 1 /* 2 - * This file define the irq handler for MSP SLM subsystem interrupts. 3 * 4 - * Copyright 2005-2007 PMC-Sierra, Inc, derived from irq_cpu.c 5 - * Author: Andrew Hughes, Andrew_Hughes@pmc-sierra.com 6 * 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 ··· 15 #include <linux/bitops.h> 16 #include <linux/irq.h> 17 18 #include <asm/system.h> 19 20 #include <msp_cic_int.h> 21 #include <msp_regs.h> 22 23 /* 24 - * NOTE: We are only enabling support for VPE0 right now. 25 */ 26 27 - static inline void unmask_msp_cic_irq(unsigned int irq) 28 - { 29 - 30 - /* check for PER interrupt range */ 31 - if (irq < MSP_PER_INTBASE) 32 - *CIC_VPE0_MSK_REG |= (1 << (irq - MSP_CIC_INTBASE)); 33 - else 34 - *PER_INT_MSK_REG |= (1 << (irq - MSP_PER_INTBASE)); 35 - } 36 - 37 - static inline void mask_msp_cic_irq(unsigned int irq) 38 - { 39 - /* check for PER interrupt range */ 40 - if (irq < MSP_PER_INTBASE) 41 - *CIC_VPE0_MSK_REG &= ~(1 << (irq - MSP_CIC_INTBASE)); 42 - else 43 - *PER_INT_MSK_REG &= ~(1 << (irq - MSP_PER_INTBASE)); 44 - } 45 46 /* 47 - * While we ack the interrupt interrupts are disabled and thus we don't need 48 - * to deal with concurrency issues. Same for msp_cic_irq_end. 49 */ 50 - static inline void ack_msp_cic_irq(unsigned int irq) 51 { 52 - mask_msp_cic_irq(irq); 53 54 /* 55 - * only really necessary for 18, 16-14 and sometimes 3:0 (since 56 - * these can be edge sensitive) but it doesn't hurt for the others. 57 - */ 58 59 - /* check for PER interrupt range */ 60 - if (irq < MSP_PER_INTBASE) 61 - *CIC_STS_REG = (1 << (irq - MSP_CIC_INTBASE)); 62 - else 63 - *PER_INT_STS_REG = (1 << (irq - MSP_PER_INTBASE)); 64 } 65 66 static struct irq_chip msp_cic_irq_controller = { 67 .name = "MSP_CIC", 68 - .ack = ack_msp_cic_irq, 69 - .mask = ack_msp_cic_irq, 70 - .mask_ack = ack_msp_cic_irq, 71 - .unmask = unmask_msp_cic_irq, 72 }; 73 - 74 75 void __init msp_cic_irq_init(void) 76 { 77 int i; 78 - 79 /* Mask/clear interrupts. */ 80 *CIC_VPE0_MSK_REG = 0x00000000; 81 - *PER_INT_MSK_REG = 0x00000000; 82 *CIC_STS_REG = 0xFFFFFFFF; 83 - *PER_INT_STS_REG = 0xFFFFFFFF; 84 - 85 - #if defined(CONFIG_PMC_MSP7120_GW) || \ 86 - defined(CONFIG_PMC_MSP7120_EVAL) 87 /* 88 - * The MSP7120 RG and EVBD boards use IRQ[6:4] for PCI. 89 - * These inputs map to EXT_INT_POL[6:4] inside the CIC. 90 - * They are to be active low, level sensitive. 91 - */ 92 *CIC_EXT_CFG_REG &= 0xFFFF8F8F; 93 - #endif 94 95 /* initialize all the IRQ descriptors */ 96 - for (i = MSP_CIC_INTBASE; i < MSP_PER_INTBASE + 32; i++) 97 set_irq_chip_and_handler(i, &msp_cic_irq_controller, 98 handle_level_irq); 99 } 100 101 void msp_cic_irq_dispatch(void) 102 { 103 - u32 pending; 104 - int intbase; 105 - 106 - intbase = MSP_CIC_INTBASE; 107 - pending = *CIC_STS_REG & *CIC_VPE0_MSK_REG; 108 - 109 - /* check for PER interrupt */ 110 - if (pending == (1 << (MSP_INT_PER - MSP_CIC_INTBASE))) { 111 - intbase = MSP_PER_INTBASE; 112 - pending = *PER_INT_STS_REG & *PER_INT_MSK_REG; 113 - } 114 - 115 - /* check for spurious interrupt */ 116 - if (pending == 0x00000000) { 117 - printk(KERN_ERR 118 - "Spurious %s interrupt? status %08x, mask %08x\n", 119 - (intbase == MSP_CIC_INTBASE) ? "CIC" : "PER", 120 - (intbase == MSP_CIC_INTBASE) ? 121 - *CIC_STS_REG : *PER_INT_STS_REG, 122 - (intbase == MSP_CIC_INTBASE) ? 123 - *CIC_VPE0_MSK_REG : *PER_INT_MSK_REG); 124 - return; 125 - } 126 - 127 - /* check for the timer and dispatch it first */ 128 - if ((intbase == MSP_CIC_INTBASE) && 129 - (pending & (1 << (MSP_INT_VPE0_TIMER - MSP_CIC_INTBASE)))) 130 do_IRQ(MSP_INT_VPE0_TIMER); 131 - else 132 - do_IRQ(ffs(pending) + intbase - 1); 133 }
··· 1 /* 2 + * Copyright 2010 PMC-Sierra, Inc, derived from irq_cpu.c 3 * 4 + * This file define the irq handler for MSP CIC subsystem interrupts. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the ··· 16 #include <linux/bitops.h> 17 #include <linux/irq.h> 18 19 + #include <asm/mipsregs.h> 20 #include <asm/system.h> 21 22 #include <msp_cic_int.h> 23 #include <msp_regs.h> 24 25 /* 26 + * External API 27 */ 28 + extern void msp_per_irq_init(void); 29 + extern void msp_per_irq_dispatch(void); 30 31 32 /* 33 + * Convenience Macro. Should be somewhere generic. 34 */ 35 + #define get_current_vpe() \ 36 + ((read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE) 37 + 38 + #ifdef CONFIG_SMP 39 + 40 + #define LOCK_VPE(flags, mtflags) \ 41 + do { \ 42 + local_irq_save(flags); \ 43 + mtflags = dmt(); \ 44 + } while (0) 45 + 46 + #define UNLOCK_VPE(flags, mtflags) \ 47 + do { \ 48 + emt(mtflags); \ 49 + local_irq_restore(flags);\ 50 + } while (0) 51 + 52 + #define LOCK_CORE(flags, mtflags) \ 53 + do { \ 54 + local_irq_save(flags); \ 55 + mtflags = dvpe(); \ 56 + } while (0) 57 + 58 + #define UNLOCK_CORE(flags, mtflags) \ 59 + do { \ 60 + evpe(mtflags); \ 61 + local_irq_restore(flags);\ 62 + } while (0) 63 + 64 + #else 65 + 66 + #define LOCK_VPE(flags, mtflags) 67 + #define UNLOCK_VPE(flags, mtflags) 68 + #endif 69 + 70 + /* ensure writes to cic are completed */ 71 + static inline void cic_wmb(void) 72 { 73 + const volatile void __iomem *cic_mem = CIC_VPE0_MSK_REG; 74 + volatile u32 dummy_read; 75 + 76 + wmb(); 77 + dummy_read = __raw_readl(cic_mem); 78 + dummy_read++; 79 + } 80 + 81 + static void unmask_cic_irq(struct irq_data *d) 82 + { 83 + volatile u32 *cic_msk_reg = CIC_VPE0_MSK_REG; 84 + int vpe; 85 + #ifdef CONFIG_SMP 86 + unsigned int mtflags; 87 + unsigned long flags; 88 89 /* 90 + * Make sure we have IRQ affinity. It may have changed while 91 + * we were processing the IRQ. 92 + */ 93 + if (!cpumask_test_cpu(smp_processor_id(), d->affinity)) 94 + return; 95 + #endif 96 97 + vpe = get_current_vpe(); 98 + LOCK_VPE(flags, mtflags); 99 + cic_msk_reg[vpe] |= (1 << (d->irq - MSP_CIC_INTBASE)); 100 + UNLOCK_VPE(flags, mtflags); 101 + cic_wmb(); 102 } 103 + 104 + static void mask_cic_irq(struct irq_data *d) 105 + { 106 + volatile u32 *cic_msk_reg = CIC_VPE0_MSK_REG; 107 + int vpe = get_current_vpe(); 108 + #ifdef CONFIG_SMP 109 + unsigned long flags, mtflags; 110 + #endif 111 + LOCK_VPE(flags, mtflags); 112 + cic_msk_reg[vpe] &= ~(1 << (d->irq - MSP_CIC_INTBASE)); 113 + UNLOCK_VPE(flags, mtflags); 114 + cic_wmb(); 115 + } 116 + static void msp_cic_irq_ack(struct irq_data *d) 117 + { 118 + mask_cic_irq(d); 119 + /* 120 + * Only really necessary for 18, 16-14 and sometimes 3:0 121 + * (since these can be edge sensitive) but it doesn't 122 + * hurt for the others 123 + */ 124 + *CIC_STS_REG = (1 << (d->irq - MSP_CIC_INTBASE)); 125 + smtc_im_ack_irq(d->irq); 126 + } 127 + 128 + /*Note: Limiting to VSMP . Not tested in SMTC */ 129 + 130 + #ifdef CONFIG_MIPS_MT_SMP 131 + static int msp_cic_irq_set_affinity(struct irq_data *d, 132 + const struct cpumask *cpumask, bool force) 133 + { 134 + int cpu; 135 + unsigned long flags; 136 + unsigned int mtflags; 137 + unsigned long imask = (1 << (irq - MSP_CIC_INTBASE)); 138 + volatile u32 *cic_mask = (volatile u32 *)CIC_VPE0_MSK_REG; 139 + 140 + /* timer balancing should be disabled in kernel code */ 141 + BUG_ON(irq == MSP_INT_VPE0_TIMER || irq == MSP_INT_VPE1_TIMER); 142 + 143 + LOCK_CORE(flags, mtflags); 144 + /* enable if any of each VPE's TCs require this IRQ */ 145 + for_each_online_cpu(cpu) { 146 + if (cpumask_test_cpu(cpu, cpumask)) 147 + cic_mask[cpu] |= imask; 148 + else 149 + cic_mask[cpu] &= ~imask; 150 + 151 + } 152 + 153 + UNLOCK_CORE(flags, mtflags); 154 + return 0; 155 + 156 + } 157 + #endif 158 159 static struct irq_chip msp_cic_irq_controller = { 160 .name = "MSP_CIC", 161 + .irq_mask = mask_cic_irq, 162 + .irq_mask_ack = msp_cic_irq_ack, 163 + .irq_unmask = unmask_cic_irq, 164 + .irq_ack = msp_cic_irq_ack, 165 + #ifdef CONFIG_MIPS_MT_SMP 166 + .irq_set_affinity = msp_cic_irq_set_affinity, 167 + #endif 168 }; 169 170 void __init msp_cic_irq_init(void) 171 { 172 int i; 173 /* Mask/clear interrupts. */ 174 *CIC_VPE0_MSK_REG = 0x00000000; 175 + *CIC_VPE1_MSK_REG = 0x00000000; 176 *CIC_STS_REG = 0xFFFFFFFF; 177 /* 178 + * The MSP7120 RG and EVBD boards use IRQ[6:4] for PCI. 179 + * These inputs map to EXT_INT_POL[6:4] inside the CIC. 180 + * They are to be active low, level sensitive. 181 + */ 182 *CIC_EXT_CFG_REG &= 0xFFFF8F8F; 183 184 /* initialize all the IRQ descriptors */ 185 + for (i = MSP_CIC_INTBASE ; i < MSP_CIC_INTBASE + 32 ; i++) { 186 set_irq_chip_and_handler(i, &msp_cic_irq_controller, 187 handle_level_irq); 188 + #ifdef CONFIG_MIPS_MT_SMTC 189 + /* Mask of CIC interrupt */ 190 + irq_hwmask[i] = C_IRQ4; 191 + #endif 192 + } 193 + 194 + /* Initialize the PER interrupt sub-system */ 195 + msp_per_irq_init(); 196 } 197 198 + /* CIC masked by CIC vector processing before dispatch called */ 199 void msp_cic_irq_dispatch(void) 200 { 201 + volatile u32 *cic_msk_reg = (volatile u32 *)CIC_VPE0_MSK_REG; 202 + u32 cic_mask; 203 + u32 pending; 204 + int cic_status = *CIC_STS_REG; 205 + cic_mask = cic_msk_reg[get_current_vpe()]; 206 + pending = cic_status & cic_mask; 207 + if (pending & (1 << (MSP_INT_VPE0_TIMER - MSP_CIC_INTBASE))) { 208 do_IRQ(MSP_INT_VPE0_TIMER); 209 + } else if (pending & (1 << (MSP_INT_VPE1_TIMER - MSP_CIC_INTBASE))) { 210 + do_IRQ(MSP_INT_VPE1_TIMER); 211 + } else if (pending & (1 << (MSP_INT_PER - MSP_CIC_INTBASE))) { 212 + msp_per_irq_dispatch(); 213 + } else if (pending) { 214 + do_IRQ(ffs(pending) + MSP_CIC_INTBASE - 1); 215 + } else{ 216 + spurious_interrupt(); 217 + } 218 }
+135
arch/mips/pmc-sierra/msp71xx/msp_irq_per.c
···
··· 1 + /* 2 + * Copyright 2010 PMC-Sierra, Inc, derived from irq_cpu.c 3 + * 4 + * This file define the irq handler for MSP PER subsystem interrupts. 5 + * 6 + * This program is free software; you can redistribute it and/or modify it 7 + * under the terms of the GNU General Public License as published by the 8 + * Free Software Foundation; either version 2 of the License, or (at your 9 + * option) any later version. 10 + */ 11 + 12 + #include <linux/init.h> 13 + #include <linux/interrupt.h> 14 + #include <linux/kernel.h> 15 + #include <linux/spinlock.h> 16 + #include <linux/bitops.h> 17 + 18 + #include <asm/mipsregs.h> 19 + #include <asm/system.h> 20 + 21 + #include <msp_cic_int.h> 22 + #include <msp_regs.h> 23 + 24 + 25 + /* 26 + * Convenience Macro. Should be somewhere generic. 27 + */ 28 + #define get_current_vpe() \ 29 + ((read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE) 30 + 31 + #ifdef CONFIG_SMP 32 + /* 33 + * The PER registers must be protected from concurrent access. 34 + */ 35 + 36 + static DEFINE_SPINLOCK(per_lock); 37 + #endif 38 + 39 + /* ensure writes to per are completed */ 40 + 41 + static inline void per_wmb(void) 42 + { 43 + const volatile void __iomem *per_mem = PER_INT_MSK_REG; 44 + volatile u32 dummy_read; 45 + 46 + wmb(); 47 + dummy_read = __raw_readl(per_mem); 48 + dummy_read++; 49 + } 50 + 51 + static inline void unmask_per_irq(struct irq_data *d) 52 + { 53 + #ifdef CONFIG_SMP 54 + unsigned long flags; 55 + spin_lock_irqsave(&per_lock, flags); 56 + *PER_INT_MSK_REG |= (1 << (d->irq - MSP_PER_INTBASE)); 57 + spin_unlock_irqrestore(&per_lock, flags); 58 + #else 59 + *PER_INT_MSK_REG |= (1 << (d->irq - MSP_PER_INTBASE)); 60 + #endif 61 + per_wmb(); 62 + } 63 + 64 + static inline void mask_per_irq(struct irq_data *d) 65 + { 66 + #ifdef CONFIG_SMP 67 + unsigned long flags; 68 + spin_lock_irqsave(&per_lock, flags); 69 + *PER_INT_MSK_REG &= ~(1 << (d->irq - MSP_PER_INTBASE)); 70 + spin_unlock_irqrestore(&per_lock, flags); 71 + #else 72 + *PER_INT_MSK_REG &= ~(1 << (d->irq - MSP_PER_INTBASE)); 73 + #endif 74 + per_wmb(); 75 + } 76 + 77 + static inline void msp_per_irq_ack(struct irq_data *d) 78 + { 79 + mask_per_irq(d); 80 + /* 81 + * In the PER interrupt controller, only bits 11 and 10 82 + * are write-to-clear, (SPI TX complete, SPI RX complete). 83 + * It does nothing for any others. 84 + */ 85 + *PER_INT_STS_REG = (1 << (d->irq - MSP_PER_INTBASE)); 86 + } 87 + 88 + #ifdef CONFIG_SMP 89 + static int msp_per_irq_set_affinity(struct irq_data *d, 90 + const struct cpumask *affinity, bool force) 91 + { 92 + /* WTF is this doing ????? */ 93 + unmask_per_irq(d); 94 + return 0; 95 + } 96 + #endif 97 + 98 + static struct irq_chip msp_per_irq_controller = { 99 + .name = "MSP_PER", 100 + .irq_enable = unmask_per_irq. 101 + .irq_disable = mask_per_irq, 102 + .irq_ack = msp_per_irq_ack, 103 + #ifdef CONFIG_SMP 104 + .irq_set_affinity = msp_per_irq_set_affinity, 105 + #endif 106 + }; 107 + 108 + void __init msp_per_irq_init(void) 109 + { 110 + int i; 111 + /* Mask/clear interrupts. */ 112 + *PER_INT_MSK_REG = 0x00000000; 113 + *PER_INT_STS_REG = 0xFFFFFFFF; 114 + /* initialize all the IRQ descriptors */ 115 + for (i = MSP_PER_INTBASE; i < MSP_PER_INTBASE + 32; i++) { 116 + irq_set_chip(i, &msp_per_irq_controller); 117 + #ifdef CONFIG_MIPS_MT_SMTC 118 + irq_hwmask[i] = C_IRQ4; 119 + #endif 120 + } 121 + } 122 + 123 + void msp_per_irq_dispatch(void) 124 + { 125 + u32 per_mask = *PER_INT_MSK_REG; 126 + u32 per_status = *PER_INT_STS_REG; 127 + u32 pending; 128 + 129 + pending = per_status & per_mask; 130 + if (pending) { 131 + do_IRQ(ffs(pending) + MSP_PER_INTBASE - 1); 132 + } else { 133 + spurious_interrupt(); 134 + } 135 + }
+12 -6
arch/mips/pmc-sierra/msp71xx/msp_irq_slp.c
··· 21 #include <msp_slp_int.h> 22 #include <msp_regs.h> 23 24 - static inline void unmask_msp_slp_irq(unsigned int irq) 25 { 26 /* check for PER interrupt range */ 27 if (irq < MSP_PER_INTBASE) 28 *SLP_INT_MSK_REG |= (1 << (irq - MSP_SLP_INTBASE)); ··· 32 *PER_INT_MSK_REG |= (1 << (irq - MSP_PER_INTBASE)); 33 } 34 35 - static inline void mask_msp_slp_irq(unsigned int irq) 36 { 37 /* check for PER interrupt range */ 38 if (irq < MSP_PER_INTBASE) 39 *SLP_INT_MSK_REG &= ~(1 << (irq - MSP_SLP_INTBASE)); ··· 47 * While we ack the interrupt interrupts are disabled and thus we don't need 48 * to deal with concurrency issues. Same for msp_slp_irq_end. 49 */ 50 - static inline void ack_msp_slp_irq(unsigned int irq) 51 { 52 /* check for PER interrupt range */ 53 if (irq < MSP_PER_INTBASE) 54 *SLP_INT_STS_REG = (1 << (irq - MSP_SLP_INTBASE)); ··· 60 61 static struct irq_chip msp_slp_irq_controller = { 62 .name = "MSP_SLP", 63 - .ack = ack_msp_slp_irq, 64 - .mask = mask_msp_slp_irq, 65 - .unmask = unmask_msp_slp_irq, 66 }; 67 68 void __init msp_slp_irq_init(void)
··· 21 #include <msp_slp_int.h> 22 #include <msp_regs.h> 23 24 + static inline void unmask_msp_slp_irq(struct irq_data *d) 25 { 26 + unsigned int irq = d->irq; 27 + 28 /* check for PER interrupt range */ 29 if (irq < MSP_PER_INTBASE) 30 *SLP_INT_MSK_REG |= (1 << (irq - MSP_SLP_INTBASE)); ··· 30 *PER_INT_MSK_REG |= (1 << (irq - MSP_PER_INTBASE)); 31 } 32 33 + static inline void mask_msp_slp_irq(struct irq_data *d) 34 { 35 + unsigned int irq = d->irq; 36 + 37 /* check for PER interrupt range */ 38 if (irq < MSP_PER_INTBASE) 39 *SLP_INT_MSK_REG &= ~(1 << (irq - MSP_SLP_INTBASE)); ··· 43 * While we ack the interrupt interrupts are disabled and thus we don't need 44 * to deal with concurrency issues. Same for msp_slp_irq_end. 45 */ 46 + static inline void ack_msp_slp_irq(struct irq_data *d) 47 { 48 + unsigned int irq = d->irq; 49 + 50 /* check for PER interrupt range */ 51 if (irq < MSP_PER_INTBASE) 52 *SLP_INT_STS_REG = (1 << (irq - MSP_SLP_INTBASE)); ··· 54 55 static struct irq_chip msp_slp_irq_controller = { 56 .name = "MSP_SLP", 57 + .irq_ack = ack_msp_slp_irq, 58 + .irq_mask = mask_msp_slp_irq, 59 + .irq_unmask = unmask_msp_slp_irq, 60 }; 61 62 void __init msp_slp_irq_init(void)
+10
arch/mips/pmc-sierra/msp71xx/msp_setup.c
··· 146 pm_power_off = msp_power_off; 147 } 148 149 void __init prom_init(void) 150 { 151 unsigned long family; ··· 227 * in separate specific files. 228 */ 229 msp_serial_setup(); 230 231 #ifdef CONFIG_PMCTWILED 232 /*
··· 146 pm_power_off = msp_power_off; 147 } 148 149 + extern struct plat_smp_ops msp_smtc_smp_ops; 150 + 151 void __init prom_init(void) 152 { 153 unsigned long family; ··· 225 * in separate specific files. 226 */ 227 msp_serial_setup(); 228 + 229 + #ifdef CONFIG_MIPS_MT_SMP 230 + register_smp_ops(&vsmp_smp_ops); 231 + #endif 232 + 233 + #ifdef CONFIG_MIPS_MT_SMTC 234 + register_smp_ops(&msp_smtc_smp_ops); 235 + #endif 236 237 #ifdef CONFIG_PMCTWILED 238 /*
+77
arch/mips/pmc-sierra/msp71xx/msp_smp.c
···
··· 1 + /* 2 + * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc. 3 + * Copyright (C) 2001 Ralf Baechle 4 + * Copyright (C) 2010 PMC-Sierra, Inc. 5 + * 6 + * VSMP support for MSP platforms . Derived from malta vsmp support. 7 + * 8 + * This program is free software; you can distribute it and/or modify it 9 + * under the terms of the GNU General Public License (Version 2) as 10 + * published by the Free Software Foundation. 11 + * 12 + * This program is distributed in the hope it will be useful, but WITHOUT 13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15 + * for more details. 16 + * 17 + * You should have received a copy of the GNU General Public License along 18 + * with this program; if not, write to the Free Software Foundation, Inc., 19 + * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 20 + * 21 + */ 22 + #include <linux/smp.h> 23 + #include <linux/interrupt.h> 24 + 25 + #ifdef CONFIG_MIPS_MT_SMP 26 + #define MIPS_CPU_IPI_RESCHED_IRQ 0 /* SW int 0 for resched */ 27 + #define MIPS_CPU_IPI_CALL_IRQ 1 /* SW int 1 for call */ 28 + 29 + 30 + static void ipi_resched_dispatch(void) 31 + { 32 + do_IRQ(MIPS_CPU_IPI_RESCHED_IRQ); 33 + } 34 + 35 + static void ipi_call_dispatch(void) 36 + { 37 + do_IRQ(MIPS_CPU_IPI_CALL_IRQ); 38 + } 39 + 40 + static irqreturn_t ipi_resched_interrupt(int irq, void *dev_id) 41 + { 42 + return IRQ_HANDLED; 43 + } 44 + 45 + static irqreturn_t ipi_call_interrupt(int irq, void *dev_id) 46 + { 47 + smp_call_function_interrupt(); 48 + 49 + return IRQ_HANDLED; 50 + } 51 + 52 + static struct irqaction irq_resched = { 53 + .handler = ipi_resched_interrupt, 54 + .flags = IRQF_DISABLED | IRQF_PERCPU, 55 + .name = "IPI_resched" 56 + }; 57 + 58 + static struct irqaction irq_call = { 59 + .handler = ipi_call_interrupt, 60 + .flags = IRQF_DISABLED | IRQF_PERCPU, 61 + .name = "IPI_call" 62 + }; 63 + 64 + void __init arch_init_ipiirq(int irq, struct irqaction *action) 65 + { 66 + setup_irq(irq, action); 67 + set_irq_handler(irq, handle_percpu_irq); 68 + } 69 + 70 + void __init msp_vsmp_int_init(void) 71 + { 72 + set_vi_handler(MIPS_CPU_IPI_RESCHED_IRQ, ipi_resched_dispatch); 73 + set_vi_handler(MIPS_CPU_IPI_CALL_IRQ, ipi_call_dispatch); 74 + arch_init_ipiirq(MIPS_CPU_IPI_RESCHED_IRQ, &irq_resched); 75 + arch_init_ipiirq(MIPS_CPU_IPI_CALL_IRQ, &irq_call); 76 + } 77 + #endif /* CONFIG_MIPS_MT_SMP */
+105
arch/mips/pmc-sierra/msp71xx/msp_smtc.c
···
··· 1 + /* 2 + * MSP71xx Platform-specific hooks for SMP operation 3 + */ 4 + #include <linux/irq.h> 5 + #include <linux/init.h> 6 + 7 + #include <asm/mipsmtregs.h> 8 + #include <asm/mipsregs.h> 9 + #include <asm/smtc.h> 10 + #include <asm/smtc_ipi.h> 11 + 12 + /* VPE/SMP Prototype implements platform interfaces directly */ 13 + 14 + /* 15 + * Cause the specified action to be performed on a targeted "CPU" 16 + */ 17 + 18 + static void msp_smtc_send_ipi_single(int cpu, unsigned int action) 19 + { 20 + /* "CPU" may be TC of same VPE, VPE of same CPU, or different CPU */ 21 + smtc_send_ipi(cpu, LINUX_SMP_IPI, action); 22 + } 23 + 24 + static void msp_smtc_send_ipi_mask(const struct cpumask *mask, 25 + unsigned int action) 26 + { 27 + unsigned int i; 28 + 29 + for_each_cpu(i, mask) 30 + msp_smtc_send_ipi_single(i, action); 31 + } 32 + 33 + /* 34 + * Post-config but pre-boot cleanup entry point 35 + */ 36 + static void __cpuinit msp_smtc_init_secondary(void) 37 + { 38 + int myvpe; 39 + 40 + /* Don't enable Malta I/O interrupts (IP2) for secondary VPEs */ 41 + myvpe = read_c0_tcbind() & TCBIND_CURVPE; 42 + if (myvpe > 0) 43 + change_c0_status(ST0_IM, STATUSF_IP0 | STATUSF_IP1 | 44 + STATUSF_IP6 | STATUSF_IP7); 45 + smtc_init_secondary(); 46 + } 47 + 48 + /* 49 + * Platform "CPU" startup hook 50 + */ 51 + static void __cpuinit msp_smtc_boot_secondary(int cpu, 52 + struct task_struct *idle) 53 + { 54 + smtc_boot_secondary(cpu, idle); 55 + } 56 + 57 + /* 58 + * SMP initialization finalization entry point 59 + */ 60 + static void __cpuinit msp_smtc_smp_finish(void) 61 + { 62 + smtc_smp_finish(); 63 + } 64 + 65 + /* 66 + * Hook for after all CPUs are online 67 + */ 68 + 69 + static void msp_smtc_cpus_done(void) 70 + { 71 + } 72 + 73 + /* 74 + * Platform SMP pre-initialization 75 + * 76 + * As noted above, we can assume a single CPU for now 77 + * but it may be multithreaded. 78 + */ 79 + 80 + static void __init msp_smtc_smp_setup(void) 81 + { 82 + /* 83 + * we won't get the definitive value until 84 + * we've run smtc_prepare_cpus later, but 85 + */ 86 + 87 + if (read_c0_config3() & (1 << 2)) 88 + smp_num_siblings = smtc_build_cpu_map(0); 89 + } 90 + 91 + static void __init msp_smtc_prepare_cpus(unsigned int max_cpus) 92 + { 93 + smtc_prepare_cpus(max_cpus); 94 + } 95 + 96 + struct plat_smp_ops msp_smtc_smp_ops = { 97 + .send_ipi_single = msp_smtc_send_ipi_single, 98 + .send_ipi_mask = msp_smtc_send_ipi_mask, 99 + .init_secondary = msp_smtc_init_secondary, 100 + .smp_finish = msp_smtc_smp_finish, 101 + .cpus_done = msp_smtc_cpus_done, 102 + .boot_secondary = msp_smtc_boot_secondary, 103 + .smp_setup = msp_smtc_smp_setup, 104 + .prepare_cpus = msp_smtc_prepare_cpus, 105 + };
+15 -1
arch/mips/pmc-sierra/msp71xx/msp_time.c
··· 29 #include <linux/module.h> 30 #include <linux/ptrace.h> 31 32 #include <asm/mipsregs.h> 33 #include <asm/time.h> 34 35 #include <msp_prom.h> 36 #include <msp_int.h> 37 #include <msp_regs.h> 38 39 void __init plat_time_init(void) 40 { ··· 90 91 unsigned int __cpuinit get_c0_compare_int(void) 92 { 93 - return MSP_INT_VPE0_TIMER; 94 }
··· 29 #include <linux/module.h> 30 #include <linux/ptrace.h> 31 32 + #include <asm/cevt-r4k.h> 33 #include <asm/mipsregs.h> 34 #include <asm/time.h> 35 36 #include <msp_prom.h> 37 #include <msp_int.h> 38 #include <msp_regs.h> 39 + 40 + #define get_current_vpe() \ 41 + ((read_c0_tcbind() >> TCBIND_CURVPE_SHIFT) & TCBIND_CURVPE) 42 + 43 + static struct irqaction timer_vpe1; 44 + static int tim_installed; 45 46 void __init plat_time_init(void) 47 { ··· 83 84 unsigned int __cpuinit get_c0_compare_int(void) 85 { 86 + /* MIPS_MT modes may want timer for second VPE */ 87 + if ((get_current_vpe()) && !tim_installed) { 88 + memcpy(&timer_vpe1, &c0_compare_irqaction, sizeof(timer_vpe1)); 89 + setup_irq(MSP_INT_VPE1_TIMER, &timer_vpe1); 90 + tim_installed++; 91 + } 92 + 93 + return get_current_vpe() ? MSP_INT_VPE1_TIMER : MSP_INT_VPE0_TIMER; 94 }
+181 -68
arch/mips/pmc-sierra/msp71xx/msp_usb.c
··· 1 /* 2 * The setup file for USB related hardware on PMC-Sierra MSP processors. 3 * 4 - * Copyright 2006-2007 PMC-Sierra, Inc. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the ··· 23 * with this program; if not, write to the Free Software Foundation, Inc., 24 * 675 Mass Ave, Cambridge, MA 02139, USA. 25 */ 26 27 - #include <linux/dma-mapping.h> 28 #include <linux/init.h> 29 #include <linux/ioport.h> 30 #include <linux/platform_device.h> ··· 34 #include <msp_regs.h> 35 #include <msp_int.h> 36 #include <msp_prom.h> 37 38 #if defined(CONFIG_USB_EHCI_HCD) 39 - static struct resource msp_usbhost_resources [] = { 40 - [0] = { 41 - .start = MSP_USB_BASE_START, 42 - .end = MSP_USB_BASE_END, 43 - .flags = IORESOURCE_MEM, 44 }, 45 [1] = { 46 - .start = MSP_INT_USB, 47 - .end = MSP_INT_USB, 48 - .flags = IORESOURCE_IRQ, 49 }, 50 }; 51 52 - static u64 msp_usbhost_dma_mask = DMA_BIT_MASK(32); 53 54 - static struct platform_device msp_usbhost_device = { 55 - .name = "pmcmsp-ehci", 56 - .id = 0, 57 .dev = { 58 - .dma_mask = &msp_usbhost_dma_mask, 59 - .coherent_dma_mask = DMA_BIT_MASK(32), 60 }, 61 - .num_resources = ARRAY_SIZE(msp_usbhost_resources), 62 - .resource = msp_usbhost_resources, 63 }; 64 - #endif /* CONFIG_USB_EHCI_HCD */ 65 66 - #if defined(CONFIG_USB_GADGET) 67 - static struct resource msp_usbdev_resources [] = { 68 - [0] = { 69 - .start = MSP_USB_BASE, 70 - .end = MSP_USB_BASE_END, 71 .flags = IORESOURCE_MEM, 72 }, 73 [1] = { ··· 91 .end = MSP_INT_USB, 92 .flags = IORESOURCE_IRQ, 93 }, 94 - }; 95 - 96 - static u64 msp_usbdev_dma_mask = DMA_BIT_MASK(32); 97 - 98 - static struct platform_device msp_usbdev_device = { 99 - .name = "msp71xx_udc", 100 - .id = 0, 101 - .dev = { 102 - .dma_mask = &msp_usbdev_dma_mask, 103 - .coherent_dma_mask = DMA_BIT_MASK(32), 104 }, 105 - .num_resources = ARRAY_SIZE(msp_usbdev_resources), 106 - .resource = msp_usbdev_resources, 107 }; 108 #endif /* CONFIG_USB_GADGET */ 109 - 110 - #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_GADGET) 111 - static struct platform_device *msp_devs[1]; 112 - #endif 113 - 114 115 static int __init msp_usb_setup(void) 116 { 117 - #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_GADGET) 118 - char *strp; 119 - char envstr[32]; 120 - unsigned int val = 0; 121 - int result = 0; 122 123 /* 124 - * construct environment name usbmode 125 - * set usbmode <host/device> as pmon environment var 126 */ 127 snprintf((char *)&envstr[0], sizeof(envstr), "usbmode"); 128 129 - #if defined(CONFIG_USB_EHCI_HCD) 130 - /* default to host mode */ 131 val = 1; 132 - #endif 133 134 /* get environment string */ 135 strp = prom_getenv((char *)&envstr[0]); 136 if (strp) { 137 if (!strcmp(strp, "device")) 138 val = 0; 139 } 140 141 if (val) { 142 #if defined(CONFIG_USB_EHCI_HCD) 143 - /* get host mode device */ 144 - msp_devs[0] = &msp_usbhost_device; 145 - ppfinit("platform add USB HOST done %s.\n", 146 - msp_devs[0]->name); 147 - 148 - result = platform_add_devices(msp_devs, ARRAY_SIZE(msp_devs)); 149 - #endif /* CONFIG_USB_EHCI_HCD */ 150 - } 151 #if defined(CONFIG_USB_GADGET) 152 - else { 153 /* get device mode structure */ 154 - msp_devs[0] = &msp_usbdev_device; 155 - ppfinit("platform add USB DEVICE done %s.\n", 156 - msp_devs[0]->name); 157 - 158 - result = platform_add_devices(msp_devs, ARRAY_SIZE(msp_devs)); 159 } 160 - #endif /* CONFIG_USB_GADGET */ 161 - #endif /* CONFIG_USB_EHCI_HCD || CONFIG_USB_GADGET */ 162 163 - return result; 164 } 165 166 subsys_initcall(msp_usb_setup);
··· 1 /* 2 * The setup file for USB related hardware on PMC-Sierra MSP processors. 3 * 4 + * Copyright 2006 PMC-Sierra, Inc. 5 * 6 * This program is free software; you can redistribute it and/or modify it 7 * under the terms of the GNU General Public License as published by the ··· 23 * with this program; if not, write to the Free Software Foundation, Inc., 24 * 675 Mass Ave, Cambridge, MA 02139, USA. 25 */ 26 + #if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_GADGET) 27 28 #include <linux/init.h> 29 #include <linux/ioport.h> 30 #include <linux/platform_device.h> ··· 34 #include <msp_regs.h> 35 #include <msp_int.h> 36 #include <msp_prom.h> 37 + #include <msp_usb.h> 38 + 39 40 #if defined(CONFIG_USB_EHCI_HCD) 41 + static struct resource msp_usbhost0_resources[] = { 42 + [0] = { /* EHCI-HS operational and capabilities registers */ 43 + .start = MSP_USB0_HS_START, 44 + .end = MSP_USB0_HS_END, 45 + .flags = IORESOURCE_MEM, 46 }, 47 [1] = { 48 + .start = MSP_INT_USB, 49 + .end = MSP_INT_USB, 50 + .flags = IORESOURCE_IRQ, 51 + }, 52 + [2] = { /* MSBus-to-AMBA bridge register space */ 53 + .start = MSP_USB0_MAB_START, 54 + .end = MSP_USB0_MAB_END, 55 + .flags = IORESOURCE_MEM, 56 + }, 57 + [3] = { /* Identification and general hardware parameters */ 58 + .start = MSP_USB0_ID_START, 59 + .end = MSP_USB0_ID_END, 60 + .flags = IORESOURCE_MEM, 61 }, 62 }; 63 64 + static u64 msp_usbhost0_dma_mask = 0xffffffffUL; 65 66 + static struct mspusb_device msp_usbhost0_device = { 67 .dev = { 68 + .name = "pmcmsp-ehci", 69 + .id = 0, 70 + .dev = { 71 + .dma_mask = &msp_usbhost0_dma_mask, 72 + .coherent_dma_mask = 0xffffffffUL, 73 + }, 74 + .num_resources = ARRAY_SIZE(msp_usbhost0_resources), 75 + .resource = msp_usbhost0_resources, 76 }, 77 }; 78 79 + /* MSP7140/MSP82XX has two USB2 hosts. */ 80 + #ifdef CONFIG_MSP_HAS_DUAL_USB 81 + static u64 msp_usbhost1_dma_mask = 0xffffffffUL; 82 + 83 + static struct resource msp_usbhost1_resources[] = { 84 + [0] = { /* EHCI-HS operational and capabilities registers */ 85 + .start = MSP_USB1_HS_START, 86 + .end = MSP_USB1_HS_END, 87 .flags = IORESOURCE_MEM, 88 }, 89 [1] = { ··· 75 .end = MSP_INT_USB, 76 .flags = IORESOURCE_IRQ, 77 }, 78 + [2] = { /* MSBus-to-AMBA bridge register space */ 79 + .start = MSP_USB1_MAB_START, 80 + .end = MSP_USB1_MAB_END, 81 + .flags = IORESOURCE_MEM, 82 }, 83 + [3] = { /* Identification and general hardware parameters */ 84 + .start = MSP_USB1_ID_START, 85 + .end = MSP_USB1_ID_END, 86 + .flags = IORESOURCE_MEM, 87 + }, 88 }; 89 + 90 + static struct mspusb_device msp_usbhost1_device = { 91 + .dev = { 92 + .name = "pmcmsp-ehci", 93 + .id = 1, 94 + .dev = { 95 + .dma_mask = &msp_usbhost1_dma_mask, 96 + .coherent_dma_mask = 0xffffffffUL, 97 + }, 98 + .num_resources = ARRAY_SIZE(msp_usbhost1_resources), 99 + .resource = msp_usbhost1_resources, 100 + }, 101 + }; 102 + #endif /* CONFIG_MSP_HAS_DUAL_USB */ 103 + #endif /* CONFIG_USB_EHCI_HCD */ 104 + 105 + #if defined(CONFIG_USB_GADGET) 106 + static struct resource msp_usbdev0_resources[] = { 107 + [0] = { /* EHCI-HS operational and capabilities registers */ 108 + .start = MSP_USB0_HS_START, 109 + .end = MSP_USB0_HS_END, 110 + .flags = IORESOURCE_MEM, 111 + }, 112 + [1] = { 113 + .start = MSP_INT_USB, 114 + .end = MSP_INT_USB, 115 + .flags = IORESOURCE_IRQ, 116 + }, 117 + [2] = { /* MSBus-to-AMBA bridge register space */ 118 + .start = MSP_USB0_MAB_START, 119 + .end = MSP_USB0_MAB_END, 120 + .flags = IORESOURCE_MEM, 121 + }, 122 + [3] = { /* Identification and general hardware parameters */ 123 + .start = MSP_USB0_ID_START, 124 + .end = MSP_USB0_ID_END, 125 + .flags = IORESOURCE_MEM, 126 + }, 127 + }; 128 + 129 + static u64 msp_usbdev_dma_mask = 0xffffffffUL; 130 + 131 + /* This may need to be converted to a mspusb_device, too. */ 132 + static struct mspusb_device msp_usbdev0_device = { 133 + .dev = { 134 + .name = "msp71xx_udc", 135 + .id = 0, 136 + .dev = { 137 + .dma_mask = &msp_usbdev_dma_mask, 138 + .coherent_dma_mask = 0xffffffffUL, 139 + }, 140 + .num_resources = ARRAY_SIZE(msp_usbdev0_resources), 141 + .resource = msp_usbdev0_resources, 142 + }, 143 + }; 144 + 145 + #ifdef CONFIG_MSP_HAS_DUAL_USB 146 + static struct resource msp_usbdev1_resources[] = { 147 + [0] = { /* EHCI-HS operational and capabilities registers */ 148 + .start = MSP_USB1_HS_START, 149 + .end = MSP_USB1_HS_END, 150 + .flags = IORESOURCE_MEM, 151 + }, 152 + [1] = { 153 + .start = MSP_INT_USB, 154 + .end = MSP_INT_USB, 155 + .flags = IORESOURCE_IRQ, 156 + }, 157 + [2] = { /* MSBus-to-AMBA bridge register space */ 158 + .start = MSP_USB1_MAB_START, 159 + .end = MSP_USB1_MAB_END, 160 + .flags = IORESOURCE_MEM, 161 + }, 162 + [3] = { /* Identification and general hardware parameters */ 163 + .start = MSP_USB1_ID_START, 164 + .end = MSP_USB1_ID_END, 165 + .flags = IORESOURCE_MEM, 166 + }, 167 + }; 168 + 169 + /* This may need to be converted to a mspusb_device, too. */ 170 + static struct mspusb_device msp_usbdev1_device = { 171 + .dev = { 172 + .name = "msp71xx_udc", 173 + .id = 0, 174 + .dev = { 175 + .dma_mask = &msp_usbdev_dma_mask, 176 + .coherent_dma_mask = 0xffffffffUL, 177 + }, 178 + .num_resources = ARRAY_SIZE(msp_usbdev1_resources), 179 + .resource = msp_usbdev1_resources, 180 + }, 181 + }; 182 + 183 + #endif /* CONFIG_MSP_HAS_DUAL_USB */ 184 #endif /* CONFIG_USB_GADGET */ 185 186 static int __init msp_usb_setup(void) 187 { 188 + char *strp; 189 + char envstr[32]; 190 + struct platform_device *msp_devs[NUM_USB_DEVS]; 191 + unsigned int val; 192 193 + /* construct environment name usbmode */ 194 + /* set usbmode <host/device> as pmon environment var */ 195 /* 196 + * Could this perhaps be integrated into the "features" env var? 197 + * Use the features key "U", and follow with "H" for host-mode, 198 + * "D" for device-mode. If it works for Ethernet, why not USB... 199 + * -- hammtrev, 2007/03/22 200 */ 201 snprintf((char *)&envstr[0], sizeof(envstr), "usbmode"); 202 203 + /* set default host mode */ 204 val = 1; 205 206 /* get environment string */ 207 strp = prom_getenv((char *)&envstr[0]); 208 if (strp) { 209 + /* compare string */ 210 if (!strcmp(strp, "device")) 211 val = 0; 212 } 213 214 if (val) { 215 #if defined(CONFIG_USB_EHCI_HCD) 216 + msp_devs[0] = &msp_usbhost0_device.dev; 217 + ppfinit("platform add USB HOST done %s.\n", msp_devs[0]->name); 218 + #ifdef CONFIG_MSP_HAS_DUAL_USB 219 + msp_devs[1] = &msp_usbhost1_device.dev; 220 + ppfinit("platform add USB HOST done %s.\n", msp_devs[1]->name); 221 + #endif 222 + #else 223 + ppfinit("%s: echi_hcd not supported\n", __FILE__); 224 + #endif /* CONFIG_USB_EHCI_HCD */ 225 + } else { 226 #if defined(CONFIG_USB_GADGET) 227 /* get device mode structure */ 228 + msp_devs[0] = &msp_usbdev0_device.dev; 229 + ppfinit("platform add USB DEVICE done %s.\n" 230 + , msp_devs[0]->name); 231 + #ifdef CONFIG_MSP_HAS_DUAL_USB 232 + msp_devs[1] = &msp_usbdev1_device.dev; 233 + ppfinit("platform add USB DEVICE done %s.\n" 234 + , msp_devs[1]->name); 235 + #endif 236 + #else 237 + ppfinit("%s: usb_gadget not supported\n", __FILE__); 238 + #endif /* CONFIG_USB_GADGET */ 239 } 240 + /* add device */ 241 + platform_add_devices(msp_devs, ARRAY_SIZE(msp_devs)); 242 243 + return 0; 244 } 245 246 subsys_initcall(msp_usb_setup); 247 + #endif /* CONFIG_USB_EHCI_HCD || CONFIG_USB_GADGET */
+22 -88
arch/mips/pnx833x/common/interrupts.c
··· 152 PNX833X_PIC_INT_REG(irq) = 0; 153 } 154 155 - static int irqflags[PNX833X_PIC_NUM_IRQ]; /* initialized by zeroes */ 156 - #define IRQFLAG_STARTED 1 157 - #define IRQFLAG_DISABLED 2 158 - 159 static DEFINE_RAW_SPINLOCK(pnx833x_irq_lock); 160 161 static unsigned int pnx833x_startup_pic_irq(unsigned int irq) ··· 160 unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE; 161 162 raw_spin_lock_irqsave(&pnx833x_irq_lock, flags); 163 - 164 - irqflags[pic_irq] = IRQFLAG_STARTED; /* started, not disabled */ 165 pnx833x_hard_enable_pic_irq(pic_irq); 166 - 167 raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags); 168 return 0; 169 } 170 171 - static void pnx833x_shutdown_pic_irq(unsigned int irq) 172 { 173 unsigned long flags; 174 - unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE; 175 176 raw_spin_lock_irqsave(&pnx833x_irq_lock, flags); 177 178 - irqflags[pic_irq] = 0; /* not started */ 179 pnx833x_hard_disable_pic_irq(pic_irq); 180 - 181 raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags); 182 - } 183 - 184 - static void pnx833x_enable_pic_irq(unsigned int irq) 185 - { 186 - unsigned long flags; 187 - unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE; 188 - 189 - raw_spin_lock_irqsave(&pnx833x_irq_lock, flags); 190 - 191 - irqflags[pic_irq] &= ~IRQFLAG_DISABLED; 192 - if (irqflags[pic_irq] == IRQFLAG_STARTED) 193 - pnx833x_hard_enable_pic_irq(pic_irq); 194 - 195 - raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags); 196 - } 197 - 198 - static void pnx833x_disable_pic_irq(unsigned int irq) 199 - { 200 - unsigned long flags; 201 - unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE; 202 - 203 - raw_spin_lock_irqsave(&pnx833x_irq_lock, flags); 204 - 205 - irqflags[pic_irq] |= IRQFLAG_DISABLED; 206 - pnx833x_hard_disable_pic_irq(pic_irq); 207 - 208 - raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags); 209 - } 210 - 211 - static void pnx833x_ack_pic_irq(unsigned int irq) 212 - { 213 - } 214 - 215 - static void pnx833x_end_pic_irq(unsigned int irq) 216 - { 217 } 218 219 static DEFINE_RAW_SPINLOCK(pnx833x_gpio_pnx833x_irq_lock); 220 221 - static unsigned int pnx833x_startup_gpio_irq(unsigned int irq) 222 { 223 - int pin = irq - PNX833X_GPIO_IRQ_BASE; 224 - unsigned long flags; 225 - raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags); 226 - pnx833x_gpio_enable_irq(pin); 227 - raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags); 228 - return 0; 229 - } 230 - 231 - static void pnx833x_enable_gpio_irq(unsigned int irq) 232 - { 233 - int pin = irq - PNX833X_GPIO_IRQ_BASE; 234 unsigned long flags; 235 raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags); 236 pnx833x_gpio_enable_irq(pin); 237 raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags); 238 } 239 240 - static void pnx833x_disable_gpio_irq(unsigned int irq) 241 { 242 - int pin = irq - PNX833X_GPIO_IRQ_BASE; 243 unsigned long flags; 244 raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags); 245 pnx833x_gpio_disable_irq(pin); 246 raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags); 247 } 248 249 - static void pnx833x_ack_gpio_irq(unsigned int irq) 250 { 251 - } 252 - 253 - static void pnx833x_end_gpio_irq(unsigned int irq) 254 - { 255 - int pin = irq - PNX833X_GPIO_IRQ_BASE; 256 - unsigned long flags; 257 - raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags); 258 - pnx833x_gpio_clear_irq(pin); 259 - raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags); 260 - } 261 - 262 - static int pnx833x_set_type_gpio_irq(unsigned int irq, unsigned int flow_type) 263 - { 264 - int pin = irq - PNX833X_GPIO_IRQ_BASE; 265 int gpio_mode; 266 267 switch (flow_type) { ··· 238 239 static struct irq_chip pnx833x_pic_irq_type = { 240 .name = "PNX-PIC", 241 - .startup = pnx833x_startup_pic_irq, 242 - .shutdown = pnx833x_shutdown_pic_irq, 243 - .enable = pnx833x_enable_pic_irq, 244 - .disable = pnx833x_disable_pic_irq, 245 - .ack = pnx833x_ack_pic_irq, 246 - .end = pnx833x_end_pic_irq 247 }; 248 249 static struct irq_chip pnx833x_gpio_irq_type = { 250 .name = "PNX-GPIO", 251 - .startup = pnx833x_startup_gpio_irq, 252 - .shutdown = pnx833x_disable_gpio_irq, 253 - .enable = pnx833x_enable_gpio_irq, 254 - .disable = pnx833x_disable_gpio_irq, 255 - .ack = pnx833x_ack_gpio_irq, 256 - .end = pnx833x_end_gpio_irq, 257 - .set_type = pnx833x_set_type_gpio_irq 258 }; 259 260 void __init arch_init_irq(void)
··· 152 PNX833X_PIC_INT_REG(irq) = 0; 153 } 154 155 static DEFINE_RAW_SPINLOCK(pnx833x_irq_lock); 156 157 static unsigned int pnx833x_startup_pic_irq(unsigned int irq) ··· 164 unsigned int pic_irq = irq - PNX833X_PIC_IRQ_BASE; 165 166 raw_spin_lock_irqsave(&pnx833x_irq_lock, flags); 167 pnx833x_hard_enable_pic_irq(pic_irq); 168 raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags); 169 return 0; 170 } 171 172 + static void pnx833x_enable_pic_irq(struct irq_data *d) 173 { 174 unsigned long flags; 175 + unsigned int pic_irq = d->irq - PNX833X_PIC_IRQ_BASE; 176 177 raw_spin_lock_irqsave(&pnx833x_irq_lock, flags); 178 + pnx833x_hard_enable_pic_irq(pic_irq); 179 + raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags); 180 + } 181 182 + static void pnx833x_disable_pic_irq(struct irq_data *d) 183 + { 184 + unsigned long flags; 185 + unsigned int pic_irq = d->irq - PNX833X_PIC_IRQ_BASE; 186 + 187 + raw_spin_lock_irqsave(&pnx833x_irq_lock, flags); 188 pnx833x_hard_disable_pic_irq(pic_irq); 189 raw_spin_unlock_irqrestore(&pnx833x_irq_lock, flags); 190 } 191 192 static DEFINE_RAW_SPINLOCK(pnx833x_gpio_pnx833x_irq_lock); 193 194 + static void pnx833x_enable_gpio_irq(struct irq_data *d) 195 { 196 + int pin = d->irq - PNX833X_GPIO_IRQ_BASE; 197 unsigned long flags; 198 raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags); 199 pnx833x_gpio_enable_irq(pin); 200 raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags); 201 } 202 203 + static void pnx833x_disable_gpio_irq(struct irq_data *d) 204 { 205 + int pin = d->irq - PNX833X_GPIO_IRQ_BASE; 206 unsigned long flags; 207 raw_spin_lock_irqsave(&pnx833x_gpio_pnx833x_irq_lock, flags); 208 pnx833x_gpio_disable_irq(pin); 209 raw_spin_unlock_irqrestore(&pnx833x_gpio_pnx833x_irq_lock, flags); 210 } 211 212 + static int pnx833x_set_type_gpio_irq(struct irq_data *d, unsigned int flow_type) 213 { 214 + int pin = d->irq - PNX833X_GPIO_IRQ_BASE; 215 int gpio_mode; 216 217 switch (flow_type) { ··· 296 297 static struct irq_chip pnx833x_pic_irq_type = { 298 .name = "PNX-PIC", 299 + .irq_enable = pnx833x_enable_pic_irq, 300 + .irq_disable = pnx833x_disable_pic_irq, 301 }; 302 303 static struct irq_chip pnx833x_gpio_irq_type = { 304 .name = "PNX-GPIO", 305 + .irq_enable = pnx833x_enable_gpio_irq, 306 + .irq_disable = pnx833x_disable_gpio_irq, 307 + .irq_set_type = pnx833x_set_type_gpio_irq, 308 }; 309 310 void __init arch_init_irq(void)
+9 -9
arch/mips/pnx8550/common/int.c
··· 114 PNX8550_GIC_REQ(irq_nr) = (1<<26 | 1<<16) | (1<<28) | gic_prio[irq_nr]; 115 } 116 117 - static inline void mask_irq(unsigned int irq_nr) 118 { 119 if ((PNX8550_INT_CP0_MIN <= irq_nr) && (irq_nr <= PNX8550_INT_CP0_MAX)) { 120 modify_cp0_intmask(1 << irq_nr, 0); 121 } else if ((PNX8550_INT_GIC_MIN <= irq_nr) && ··· 131 } 132 } 133 134 - static inline void unmask_irq(unsigned int irq_nr) 135 { 136 if ((PNX8550_INT_CP0_MIN <= irq_nr) && (irq_nr <= PNX8550_INT_CP0_MAX)) { 137 modify_cp0_intmask(0, 1 << irq_nr); 138 } else if ((PNX8550_INT_GIC_MIN <= irq_nr) && ··· 161 162 static struct irq_chip level_irq_type = { 163 .name = "PNX Level IRQ", 164 - .ack = mask_irq, 165 - .mask = mask_irq, 166 - .mask_ack = mask_irq, 167 - .unmask = unmask_irq, 168 }; 169 170 static struct irqaction gic_action = { ··· 182 int i; 183 int configPR; 184 185 - for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++) { 186 set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq); 187 - mask_irq(i); /* mask the irq just in case */ 188 - } 189 190 /* init of GIC/IPC interrupts */ 191 /* should be done before cp0 since cp0 init enables the GIC int */
··· 114 PNX8550_GIC_REQ(irq_nr) = (1<<26 | 1<<16) | (1<<28) | gic_prio[irq_nr]; 115 } 116 117 + static inline void mask_irq(struct irq_data *d) 118 { 119 + unsigned int irq_nr = d->irq; 120 + 121 if ((PNX8550_INT_CP0_MIN <= irq_nr) && (irq_nr <= PNX8550_INT_CP0_MAX)) { 122 modify_cp0_intmask(1 << irq_nr, 0); 123 } else if ((PNX8550_INT_GIC_MIN <= irq_nr) && ··· 129 } 130 } 131 132 + static inline void unmask_irq(struct irq_data *d) 133 { 134 + unsigned int irq_nr = d->irq; 135 + 136 if ((PNX8550_INT_CP0_MIN <= irq_nr) && (irq_nr <= PNX8550_INT_CP0_MAX)) { 137 modify_cp0_intmask(0, 1 << irq_nr); 138 } else if ((PNX8550_INT_GIC_MIN <= irq_nr) && ··· 157 158 static struct irq_chip level_irq_type = { 159 .name = "PNX Level IRQ", 160 + .irq_mask = mask_irq, 161 + .irq_unmask = unmask_irq, 162 }; 163 164 static struct irqaction gic_action = { ··· 180 int i; 181 int configPR; 182 183 + for (i = 0; i < PNX8550_INT_CP0_TOTINT; i++) 184 set_irq_chip_and_handler(i, &level_irq_type, handle_level_irq); 185 186 /* init of GIC/IPC interrupts */ 187 /* should be done before cp0 since cp0 init enables the GIC int */
+6 -7
arch/mips/powertv/asic/irq_asic.c
··· 21 22 #include <asm/mach-powertv/asic_regs.h> 23 24 - static inline void unmask_asic_irq(unsigned int irq) 25 { 26 unsigned long enable_bit; 27 28 enable_bit = (1 << (irq & 0x1f)); 29 ··· 46 } 47 } 48 49 - static inline void mask_asic_irq(unsigned int irq) 50 { 51 unsigned long disable_mask; 52 53 disable_mask = ~(1 << (irq & 0x1f)); 54 ··· 73 74 static struct irq_chip asic_irq_chip = { 75 .name = "ASIC Level", 76 - .ack = mask_asic_irq, 77 - .mask = mask_asic_irq, 78 - .mask_ack = mask_asic_irq, 79 - .unmask = unmask_asic_irq, 80 - .eoi = unmask_asic_irq, 81 }; 82 83 void __init asic_irq_init(void)
··· 21 22 #include <asm/mach-powertv/asic_regs.h> 23 24 + static inline void unmask_asic_irq(struct irq_data *d) 25 { 26 unsigned long enable_bit; 27 + unsigned int irq = d->irq; 28 29 enable_bit = (1 << (irq & 0x1f)); 30 ··· 45 } 46 } 47 48 + static inline void mask_asic_irq(struct irq_data *d) 49 { 50 unsigned long disable_mask; 51 + unsigned int irq = d->irq; 52 53 disable_mask = ~(1 << (irq & 0x1f)); 54 ··· 71 72 static struct irq_chip asic_irq_chip = { 73 .name = "ASIC Level", 74 + .irq_mask = mask_asic_irq, 75 + .irq_unmask = unmask_asic_irq, 76 }; 77 78 void __init asic_irq_init(void)
+16 -16
arch/mips/rb532/irq.c
··· 111 clear_c0_cause(ipnum); 112 } 113 114 - static void rb532_enable_irq(unsigned int irq_nr) 115 { 116 int ip = irq_nr - GROUP0_IRQ_BASE; 117 - unsigned int group, intr_bit; 118 volatile unsigned int *addr; 119 120 if (ip < 0) ··· 132 } 133 } 134 135 - static void rb532_disable_irq(unsigned int irq_nr) 136 { 137 int ip = irq_nr - GROUP0_IRQ_BASE; 138 - unsigned int group, intr_bit, mask; 139 volatile unsigned int *addr; 140 141 if (ip < 0) { ··· 163 } 164 } 165 166 - static void rb532_mask_and_ack_irq(unsigned int irq_nr) 167 { 168 - rb532_disable_irq(irq_nr); 169 - ack_local_irq(group_to_ip(irq_to_group(irq_nr))); 170 } 171 172 - static int rb532_set_type(unsigned int irq_nr, unsigned type) 173 { 174 - int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE; 175 - int group = irq_to_group(irq_nr); 176 177 - if (group != GPIO_MAPPED_IRQ_GROUP || irq_nr > (GROUP4_IRQ_BASE + 13)) 178 return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL; 179 180 switch (type) { ··· 193 194 static struct irq_chip rc32434_irq_type = { 195 .name = "RB532", 196 - .ack = rb532_disable_irq, 197 - .mask = rb532_disable_irq, 198 - .mask_ack = rb532_mask_and_ack_irq, 199 - .unmask = rb532_enable_irq, 200 - .set_type = rb532_set_type, 201 }; 202 203 void __init arch_init_irq(void)
··· 111 clear_c0_cause(ipnum); 112 } 113 114 + static void rb532_enable_irq(struct irq_data *d) 115 { 116 + unsigned int group, intr_bit, irq_nr = d->irq; 117 int ip = irq_nr - GROUP0_IRQ_BASE; 118 volatile unsigned int *addr; 119 120 if (ip < 0) ··· 132 } 133 } 134 135 + static void rb532_disable_irq(struct irq_data *d) 136 { 137 + unsigned int group, intr_bit, mask, irq_nr = d->irq; 138 int ip = irq_nr - GROUP0_IRQ_BASE; 139 volatile unsigned int *addr; 140 141 if (ip < 0) { ··· 163 } 164 } 165 166 + static void rb532_mask_and_ack_irq(struct irq_data *d) 167 { 168 + rb532_disable_irq(d); 169 + ack_local_irq(group_to_ip(irq_to_group(d->irq))); 170 } 171 172 + static int rb532_set_type(struct irq_data *d, unsigned type) 173 { 174 + int gpio = d->irq - GPIO_MAPPED_IRQ_BASE; 175 + int group = irq_to_group(d->irq); 176 177 + if (group != GPIO_MAPPED_IRQ_GROUP || d->irq > (GROUP4_IRQ_BASE + 13)) 178 return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL; 179 180 switch (type) { ··· 193 194 static struct irq_chip rc32434_irq_type = { 195 .name = "RB532", 196 + .irq_ack = rb532_disable_irq, 197 + .irq_mask = rb532_disable_irq, 198 + .irq_mask_ack = rb532_mask_and_ack_irq, 199 + .irq_unmask = rb532_enable_irq, 200 + .irq_set_type = rb532_set_type, 201 }; 202 203 void __init arch_init_irq(void)
+26 -34
arch/mips/sgi-ip22/ip22-int.c
··· 31 32 extern int ip22_eisa_init(void); 33 34 - static void enable_local0_irq(unsigned int irq) 35 { 36 /* don't allow mappable interrupt to be enabled from setup_irq, 37 * we have our own way to do so */ 38 - if (irq != SGI_MAP_0_IRQ) 39 - sgint->imask0 |= (1 << (irq - SGINT_LOCAL0)); 40 } 41 42 - static void disable_local0_irq(unsigned int irq) 43 { 44 - sgint->imask0 &= ~(1 << (irq - SGINT_LOCAL0)); 45 } 46 47 static struct irq_chip ip22_local0_irq_type = { 48 .name = "IP22 local 0", 49 - .ack = disable_local0_irq, 50 - .mask = disable_local0_irq, 51 - .mask_ack = disable_local0_irq, 52 - .unmask = enable_local0_irq, 53 }; 54 55 - static void enable_local1_irq(unsigned int irq) 56 { 57 /* don't allow mappable interrupt to be enabled from setup_irq, 58 * we have our own way to do so */ 59 - if (irq != SGI_MAP_1_IRQ) 60 - sgint->imask1 |= (1 << (irq - SGINT_LOCAL1)); 61 } 62 63 - static void disable_local1_irq(unsigned int irq) 64 { 65 - sgint->imask1 &= ~(1 << (irq - SGINT_LOCAL1)); 66 } 67 68 static struct irq_chip ip22_local1_irq_type = { 69 .name = "IP22 local 1", 70 - .ack = disable_local1_irq, 71 - .mask = disable_local1_irq, 72 - .mask_ack = disable_local1_irq, 73 - .unmask = enable_local1_irq, 74 }; 75 76 - static void enable_local2_irq(unsigned int irq) 77 { 78 sgint->imask0 |= (1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0)); 79 - sgint->cmeimask0 |= (1 << (irq - SGINT_LOCAL2)); 80 } 81 82 - static void disable_local2_irq(unsigned int irq) 83 { 84 - sgint->cmeimask0 &= ~(1 << (irq - SGINT_LOCAL2)); 85 if (!sgint->cmeimask0) 86 sgint->imask0 &= ~(1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0)); 87 } 88 89 static struct irq_chip ip22_local2_irq_type = { 90 .name = "IP22 local 2", 91 - .ack = disable_local2_irq, 92 - .mask = disable_local2_irq, 93 - .mask_ack = disable_local2_irq, 94 - .unmask = enable_local2_irq, 95 }; 96 97 - static void enable_local3_irq(unsigned int irq) 98 { 99 sgint->imask1 |= (1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1)); 100 - sgint->cmeimask1 |= (1 << (irq - SGINT_LOCAL3)); 101 } 102 103 - static void disable_local3_irq(unsigned int irq) 104 { 105 - sgint->cmeimask1 &= ~(1 << (irq - SGINT_LOCAL3)); 106 if (!sgint->cmeimask1) 107 sgint->imask1 &= ~(1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1)); 108 } 109 110 static struct irq_chip ip22_local3_irq_type = { 111 .name = "IP22 local 3", 112 - .ack = disable_local3_irq, 113 - .mask = disable_local3_irq, 114 - .mask_ack = disable_local3_irq, 115 - .unmask = enable_local3_irq, 116 }; 117 118 static void indy_local0_irqdispatch(void)
··· 31 32 extern int ip22_eisa_init(void); 33 34 + static void enable_local0_irq(struct irq_data *d) 35 { 36 /* don't allow mappable interrupt to be enabled from setup_irq, 37 * we have our own way to do so */ 38 + if (d->irq != SGI_MAP_0_IRQ) 39 + sgint->imask0 |= (1 << (d->irq - SGINT_LOCAL0)); 40 } 41 42 + static void disable_local0_irq(struct irq_data *d) 43 { 44 + sgint->imask0 &= ~(1 << (d->irq - SGINT_LOCAL0)); 45 } 46 47 static struct irq_chip ip22_local0_irq_type = { 48 .name = "IP22 local 0", 49 + .irq_mask = disable_local0_irq, 50 + .irq_unmask = enable_local0_irq, 51 }; 52 53 + static void enable_local1_irq(struct irq_data *d) 54 { 55 /* don't allow mappable interrupt to be enabled from setup_irq, 56 * we have our own way to do so */ 57 + if (d->irq != SGI_MAP_1_IRQ) 58 + sgint->imask1 |= (1 << (d->irq - SGINT_LOCAL1)); 59 } 60 61 + static void disable_local1_irq(struct irq_data *d) 62 { 63 + sgint->imask1 &= ~(1 << (d->irq - SGINT_LOCAL1)); 64 } 65 66 static struct irq_chip ip22_local1_irq_type = { 67 .name = "IP22 local 1", 68 + .irq_mask = disable_local1_irq, 69 + .irq_unmask = enable_local1_irq, 70 }; 71 72 + static void enable_local2_irq(struct irq_data *d) 73 { 74 sgint->imask0 |= (1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0)); 75 + sgint->cmeimask0 |= (1 << (d->irq - SGINT_LOCAL2)); 76 } 77 78 + static void disable_local2_irq(struct irq_data *d) 79 { 80 + sgint->cmeimask0 &= ~(1 << (d->irq - SGINT_LOCAL2)); 81 if (!sgint->cmeimask0) 82 sgint->imask0 &= ~(1 << (SGI_MAP_0_IRQ - SGINT_LOCAL0)); 83 } 84 85 static struct irq_chip ip22_local2_irq_type = { 86 .name = "IP22 local 2", 87 + .irq_mask = disable_local2_irq, 88 + .irq_unmask = enable_local2_irq, 89 }; 90 91 + static void enable_local3_irq(struct irq_data *d) 92 { 93 sgint->imask1 |= (1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1)); 94 + sgint->cmeimask1 |= (1 << (d->irq - SGINT_LOCAL3)); 95 } 96 97 + static void disable_local3_irq(struct irq_data *d) 98 { 99 + sgint->cmeimask1 &= ~(1 << (d->irq - SGINT_LOCAL3)); 100 if (!sgint->cmeimask1) 101 sgint->imask1 &= ~(1 << (SGI_MAP_1_IRQ - SGINT_LOCAL1)); 102 } 103 104 static struct irq_chip ip22_local3_irq_type = { 105 .name = "IP22 local 3", 106 + .irq_mask = disable_local3_irq, 107 + .irq_unmask = enable_local3_irq, 108 }; 109 110 static void indy_local0_irqdispatch(void)
+18 -20
arch/mips/sgi-ip27/ip27-irq.c
··· 240 } 241 242 /* Startup one of the (PCI ...) IRQs routes over a bridge. */ 243 - static unsigned int startup_bridge_irq(unsigned int irq) 244 { 245 struct bridge_controller *bc; 246 bridgereg_t device; ··· 248 int pin, swlevel; 249 cpuid_t cpu; 250 251 - pin = SLOT_FROM_PCI_IRQ(irq); 252 - bc = IRQ_TO_BRIDGE(irq); 253 bridge = bc->base; 254 255 - pr_debug("bridge_startup(): irq= 0x%x pin=%d\n", irq, pin); 256 /* 257 * "map" irq to a swlevel greater than 6 since the first 6 bits 258 * of INT_PEND0 are taken 259 */ 260 - swlevel = find_level(&cpu, irq); 261 bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8)); 262 bridge->b_int_enable |= (1 << pin); 263 bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */ ··· 288 } 289 290 /* Shutdown one of the (PCI ...) IRQs routes over a bridge. */ 291 - static void shutdown_bridge_irq(unsigned int irq) 292 { 293 - struct bridge_controller *bc = IRQ_TO_BRIDGE(irq); 294 bridge_t *bridge = bc->base; 295 int pin, swlevel; 296 cpuid_t cpu; 297 298 - pr_debug("bridge_shutdown: irq 0x%x\n", irq); 299 - pin = SLOT_FROM_PCI_IRQ(irq); 300 301 /* 302 * map irq to a swlevel greater than 6 since the first 6 bits 303 * of INT_PEND0 are taken 304 */ 305 - swlevel = find_level(&cpu, irq); 306 intr_disconnect_level(cpu, swlevel); 307 308 bridge->b_int_enable &= ~(1 << pin); 309 bridge->b_wid_tflush; 310 } 311 312 - static inline void enable_bridge_irq(unsigned int irq) 313 { 314 cpuid_t cpu; 315 int swlevel; 316 317 - swlevel = find_level(&cpu, irq); /* Criminal offence */ 318 intr_connect_level(cpu, swlevel); 319 } 320 321 - static inline void disable_bridge_irq(unsigned int irq) 322 { 323 cpuid_t cpu; 324 int swlevel; 325 326 - swlevel = find_level(&cpu, irq); /* Criminal offence */ 327 intr_disconnect_level(cpu, swlevel); 328 } 329 330 static struct irq_chip bridge_irq_type = { 331 .name = "bridge", 332 - .startup = startup_bridge_irq, 333 - .shutdown = shutdown_bridge_irq, 334 - .ack = disable_bridge_irq, 335 - .mask = disable_bridge_irq, 336 - .mask_ack = disable_bridge_irq, 337 - .unmask = enable_bridge_irq, 338 }; 339 340 void __devinit register_bridge_irq(unsigned int irq)
··· 240 } 241 242 /* Startup one of the (PCI ...) IRQs routes over a bridge. */ 243 + static unsigned int startup_bridge_irq(struct irq_data *d) 244 { 245 struct bridge_controller *bc; 246 bridgereg_t device; ··· 248 int pin, swlevel; 249 cpuid_t cpu; 250 251 + pin = SLOT_FROM_PCI_IRQ(d->irq); 252 + bc = IRQ_TO_BRIDGE(d->irq); 253 bridge = bc->base; 254 255 + pr_debug("bridge_startup(): irq= 0x%x pin=%d\n", d->irq, pin); 256 /* 257 * "map" irq to a swlevel greater than 6 since the first 6 bits 258 * of INT_PEND0 are taken 259 */ 260 + swlevel = find_level(&cpu, d->irq); 261 bridge->b_int_addr[pin].addr = (0x20000 | swlevel | (bc->nasid << 8)); 262 bridge->b_int_enable |= (1 << pin); 263 bridge->b_int_enable |= 0x7ffffe00; /* more stuff in int_enable */ ··· 288 } 289 290 /* Shutdown one of the (PCI ...) IRQs routes over a bridge. */ 291 + static void shutdown_bridge_irq(struct irq_data *d) 292 { 293 + struct bridge_controller *bc = IRQ_TO_BRIDGE(d->irq); 294 bridge_t *bridge = bc->base; 295 int pin, swlevel; 296 cpuid_t cpu; 297 298 + pr_debug("bridge_shutdown: irq 0x%x\n", d->irq); 299 + pin = SLOT_FROM_PCI_IRQ(d->irq); 300 301 /* 302 * map irq to a swlevel greater than 6 since the first 6 bits 303 * of INT_PEND0 are taken 304 */ 305 + swlevel = find_level(&cpu, d->irq); 306 intr_disconnect_level(cpu, swlevel); 307 308 bridge->b_int_enable &= ~(1 << pin); 309 bridge->b_wid_tflush; 310 } 311 312 + static inline void enable_bridge_irq(struct irq_data *d) 313 { 314 cpuid_t cpu; 315 int swlevel; 316 317 + swlevel = find_level(&cpu, d->irq); /* Criminal offence */ 318 intr_connect_level(cpu, swlevel); 319 } 320 321 + static inline void disable_bridge_irq(struct irq_data *d) 322 { 323 cpuid_t cpu; 324 int swlevel; 325 326 + swlevel = find_level(&cpu, d->irq); /* Criminal offence */ 327 intr_disconnect_level(cpu, swlevel); 328 } 329 330 static struct irq_chip bridge_irq_type = { 331 .name = "bridge", 332 + .irq_startup = startup_bridge_irq, 333 + .irq_shutdown = shutdown_bridge_irq, 334 + .irq_mask = disable_bridge_irq, 335 + .irq_unmask = enable_bridge_irq, 336 }; 337 338 void __devinit register_bridge_irq(unsigned int irq)
+4 -7
arch/mips/sgi-ip27/ip27-timer.c
··· 36 #include <asm/sn/sn0/hubio.h> 37 #include <asm/pci/bridge.h> 38 39 - static void enable_rt_irq(unsigned int irq) 40 { 41 } 42 43 - static void disable_rt_irq(unsigned int irq) 44 { 45 } 46 47 static struct irq_chip rt_irq_type = { 48 .name = "SN HUB RT timer", 49 - .ack = disable_rt_irq, 50 - .mask = disable_rt_irq, 51 - .mask_ack = disable_rt_irq, 52 - .unmask = enable_rt_irq, 53 - .eoi = enable_rt_irq, 54 }; 55 56 static int rt_next_event(unsigned long delta, struct clock_event_device *evt)
··· 36 #include <asm/sn/sn0/hubio.h> 37 #include <asm/pci/bridge.h> 38 39 + static void enable_rt_irq(struct irq_data *d) 40 { 41 } 42 43 + static void disable_rt_irq(struct irq_data *d) 44 { 45 } 46 47 static struct irq_chip rt_irq_type = { 48 .name = "SN HUB RT timer", 49 + .irq_mask = disable_rt_irq, 50 + .irq_unmask = enable_rt_irq, 51 }; 52 53 static int rt_next_event(unsigned long delta, struct clock_event_device *evt)
+42 -92
arch/mips/sgi-ip32/ip32-irq.c
··· 130 131 static uint64_t crime_mask; 132 133 - static inline void crime_enable_irq(unsigned int irq) 134 { 135 - unsigned int bit = irq - CRIME_IRQ_BASE; 136 137 crime_mask |= 1 << bit; 138 crime->imask = crime_mask; 139 } 140 141 - static inline void crime_disable_irq(unsigned int irq) 142 { 143 - unsigned int bit = irq - CRIME_IRQ_BASE; 144 145 crime_mask &= ~(1 << bit); 146 crime->imask = crime_mask; 147 flush_crime_bus(); 148 } 149 150 - static void crime_level_mask_and_ack_irq(unsigned int irq) 151 - { 152 - crime_disable_irq(irq); 153 - } 154 - 155 - static void crime_level_end_irq(unsigned int irq) 156 - { 157 - if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 158 - crime_enable_irq(irq); 159 - } 160 - 161 static struct irq_chip crime_level_interrupt = { 162 .name = "IP32 CRIME", 163 - .ack = crime_level_mask_and_ack_irq, 164 - .mask = crime_disable_irq, 165 - .mask_ack = crime_level_mask_and_ack_irq, 166 - .unmask = crime_enable_irq, 167 - .end = crime_level_end_irq, 168 }; 169 170 - static void crime_edge_mask_and_ack_irq(unsigned int irq) 171 { 172 - unsigned int bit = irq - CRIME_IRQ_BASE; 173 uint64_t crime_int; 174 175 /* Edge triggered interrupts must be cleared. */ 176 - 177 crime_int = crime->hard_int; 178 crime_int &= ~(1 << bit); 179 crime->hard_int = crime_int; 180 181 - crime_disable_irq(irq); 182 - } 183 - 184 - static void crime_edge_end_irq(unsigned int irq) 185 - { 186 - if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 187 - crime_enable_irq(irq); 188 } 189 190 static struct irq_chip crime_edge_interrupt = { 191 .name = "IP32 CRIME", 192 - .ack = crime_edge_mask_and_ack_irq, 193 - .mask = crime_disable_irq, 194 - .mask_ack = crime_edge_mask_and_ack_irq, 195 - .unmask = crime_enable_irq, 196 - .end = crime_edge_end_irq, 197 }; 198 199 /* ··· 182 183 static unsigned long macepci_mask; 184 185 - static void enable_macepci_irq(unsigned int irq) 186 { 187 - macepci_mask |= MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ); 188 mace->pci.control = macepci_mask; 189 - crime_mask |= 1 << (irq - CRIME_IRQ_BASE); 190 crime->imask = crime_mask; 191 } 192 193 - static void disable_macepci_irq(unsigned int irq) 194 { 195 - crime_mask &= ~(1 << (irq - CRIME_IRQ_BASE)); 196 crime->imask = crime_mask; 197 flush_crime_bus(); 198 - macepci_mask &= ~MACEPCI_CONTROL_INT(irq - MACEPCI_SCSI0_IRQ); 199 mace->pci.control = macepci_mask; 200 flush_mace_bus(); 201 } 202 203 - static void end_macepci_irq(unsigned int irq) 204 - { 205 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 206 - enable_macepci_irq(irq); 207 - } 208 - 209 static struct irq_chip ip32_macepci_interrupt = { 210 .name = "IP32 MACE PCI", 211 - .ack = disable_macepci_irq, 212 - .mask = disable_macepci_irq, 213 - .mask_ack = disable_macepci_irq, 214 - .unmask = enable_macepci_irq, 215 - .end = end_macepci_irq, 216 }; 217 218 /* This is used for MACE ISA interrupts. That means bits 4-6 in the ··· 245 246 static unsigned long maceisa_mask; 247 248 - static void enable_maceisa_irq(unsigned int irq) 249 { 250 unsigned int crime_int = 0; 251 252 - pr_debug("maceisa enable: %u\n", irq); 253 254 - switch (irq) { 255 case MACEISA_AUDIO_SW_IRQ ... MACEISA_AUDIO3_MERR_IRQ: 256 crime_int = MACE_AUDIO_INT; 257 break; ··· 265 pr_debug("crime_int %08x enabled\n", crime_int); 266 crime_mask |= crime_int; 267 crime->imask = crime_mask; 268 - maceisa_mask |= 1 << (irq - MACEISA_AUDIO_SW_IRQ); 269 mace->perif.ctrl.imask = maceisa_mask; 270 } 271 272 - static void disable_maceisa_irq(unsigned int irq) 273 { 274 unsigned int crime_int = 0; 275 276 - maceisa_mask &= ~(1 << (irq - MACEISA_AUDIO_SW_IRQ)); 277 if (!(maceisa_mask & MACEISA_AUDIO_INT)) 278 crime_int |= MACE_AUDIO_INT; 279 if (!(maceisa_mask & MACEISA_MISC_INT)) ··· 287 flush_mace_bus(); 288 } 289 290 - static void mask_and_ack_maceisa_irq(unsigned int irq) 291 { 292 unsigned long mace_int; 293 294 /* edge triggered */ 295 mace_int = mace->perif.ctrl.istat; 296 - mace_int &= ~(1 << (irq - MACEISA_AUDIO_SW_IRQ)); 297 mace->perif.ctrl.istat = mace_int; 298 299 - disable_maceisa_irq(irq); 300 - } 301 - 302 - static void end_maceisa_irq(unsigned irq) 303 - { 304 - if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) 305 - enable_maceisa_irq(irq); 306 } 307 308 static struct irq_chip ip32_maceisa_level_interrupt = { 309 .name = "IP32 MACE ISA", 310 - .ack = disable_maceisa_irq, 311 - .mask = disable_maceisa_irq, 312 - .mask_ack = disable_maceisa_irq, 313 - .unmask = enable_maceisa_irq, 314 - .end = end_maceisa_irq, 315 }; 316 317 static struct irq_chip ip32_maceisa_edge_interrupt = { 318 .name = "IP32 MACE ISA", 319 - .ack = mask_and_ack_maceisa_irq, 320 - .mask = disable_maceisa_irq, 321 - .mask_ack = mask_and_ack_maceisa_irq, 322 - .unmask = enable_maceisa_irq, 323 - .end = end_maceisa_irq, 324 }; 325 326 /* This is used for regular non-ISA, non-PCI MACE interrupts. That means 327 * bits 0-3 and 7 in the CRIME register. 328 */ 329 330 - static void enable_mace_irq(unsigned int irq) 331 { 332 - unsigned int bit = irq - CRIME_IRQ_BASE; 333 334 crime_mask |= (1 << bit); 335 crime->imask = crime_mask; 336 } 337 338 - static void disable_mace_irq(unsigned int irq) 339 { 340 - unsigned int bit = irq - CRIME_IRQ_BASE; 341 342 crime_mask &= ~(1 << bit); 343 crime->imask = crime_mask; 344 flush_crime_bus(); 345 } 346 347 - static void end_mace_irq(unsigned int irq) 348 - { 349 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 350 - enable_mace_irq(irq); 351 - } 352 - 353 static struct irq_chip ip32_mace_interrupt = { 354 .name = "IP32 MACE", 355 - .ack = disable_mace_irq, 356 - .mask = disable_mace_irq, 357 - .mask_ack = disable_mace_irq, 358 - .unmask = enable_mace_irq, 359 - .end = end_mace_irq, 360 }; 361 362 static void ip32_unknown_interrupt(void)
··· 130 131 static uint64_t crime_mask; 132 133 + static inline void crime_enable_irq(struct irq_data *d) 134 { 135 + unsigned int bit = d->irq - CRIME_IRQ_BASE; 136 137 crime_mask |= 1 << bit; 138 crime->imask = crime_mask; 139 } 140 141 + static inline void crime_disable_irq(struct irq_data *d) 142 { 143 + unsigned int bit = d->irq - CRIME_IRQ_BASE; 144 145 crime_mask &= ~(1 << bit); 146 crime->imask = crime_mask; 147 flush_crime_bus(); 148 } 149 150 static struct irq_chip crime_level_interrupt = { 151 .name = "IP32 CRIME", 152 + .irq_mask = crime_disable_irq, 153 + .irq_unmask = crime_enable_irq, 154 }; 155 156 + static void crime_edge_mask_and_ack_irq(struct irq_data *d) 157 { 158 + unsigned int bit = d->irq - CRIME_IRQ_BASE; 159 uint64_t crime_int; 160 161 /* Edge triggered interrupts must be cleared. */ 162 crime_int = crime->hard_int; 163 crime_int &= ~(1 << bit); 164 crime->hard_int = crime_int; 165 166 + crime_disable_irq(d); 167 } 168 169 static struct irq_chip crime_edge_interrupt = { 170 .name = "IP32 CRIME", 171 + .irq_ack = crime_edge_mask_and_ack_irq, 172 + .irq_mask = crime_disable_irq, 173 + .irq_mask_ack = crime_edge_mask_and_ack_irq, 174 + .irq_unmask = crime_enable_irq, 175 }; 176 177 /* ··· 204 205 static unsigned long macepci_mask; 206 207 + static void enable_macepci_irq(struct irq_data *d) 208 { 209 + macepci_mask |= MACEPCI_CONTROL_INT(d->irq - MACEPCI_SCSI0_IRQ); 210 mace->pci.control = macepci_mask; 211 + crime_mask |= 1 << (d->irq - CRIME_IRQ_BASE); 212 crime->imask = crime_mask; 213 } 214 215 + static void disable_macepci_irq(struct irq_data *d) 216 { 217 + crime_mask &= ~(1 << (d->irq - CRIME_IRQ_BASE)); 218 crime->imask = crime_mask; 219 flush_crime_bus(); 220 + macepci_mask &= ~MACEPCI_CONTROL_INT(d->irq - MACEPCI_SCSI0_IRQ); 221 mace->pci.control = macepci_mask; 222 flush_mace_bus(); 223 } 224 225 static struct irq_chip ip32_macepci_interrupt = { 226 .name = "IP32 MACE PCI", 227 + .irq_mask = disable_macepci_irq, 228 + .irq_unmask = enable_macepci_irq, 229 }; 230 231 /* This is used for MACE ISA interrupts. That means bits 4-6 in the ··· 276 277 static unsigned long maceisa_mask; 278 279 + static void enable_maceisa_irq(struct irq_data *d) 280 { 281 unsigned int crime_int = 0; 282 283 + pr_debug("maceisa enable: %u\n", d->irq); 284 285 + switch (d->irq) { 286 case MACEISA_AUDIO_SW_IRQ ... MACEISA_AUDIO3_MERR_IRQ: 287 crime_int = MACE_AUDIO_INT; 288 break; ··· 296 pr_debug("crime_int %08x enabled\n", crime_int); 297 crime_mask |= crime_int; 298 crime->imask = crime_mask; 299 + maceisa_mask |= 1 << (d->irq - MACEISA_AUDIO_SW_IRQ); 300 mace->perif.ctrl.imask = maceisa_mask; 301 } 302 303 + static void disable_maceisa_irq(struct irq_data *d) 304 { 305 unsigned int crime_int = 0; 306 307 + maceisa_mask &= ~(1 << (d->irq - MACEISA_AUDIO_SW_IRQ)); 308 if (!(maceisa_mask & MACEISA_AUDIO_INT)) 309 crime_int |= MACE_AUDIO_INT; 310 if (!(maceisa_mask & MACEISA_MISC_INT)) ··· 318 flush_mace_bus(); 319 } 320 321 + static void mask_and_ack_maceisa_irq(struct irq_data *d) 322 { 323 unsigned long mace_int; 324 325 /* edge triggered */ 326 mace_int = mace->perif.ctrl.istat; 327 + mace_int &= ~(1 << (d->irq - MACEISA_AUDIO_SW_IRQ)); 328 mace->perif.ctrl.istat = mace_int; 329 330 + disable_maceisa_irq(d); 331 } 332 333 static struct irq_chip ip32_maceisa_level_interrupt = { 334 .name = "IP32 MACE ISA", 335 + .irq_mask = disable_maceisa_irq, 336 + .irq_unmask = enable_maceisa_irq, 337 }; 338 339 static struct irq_chip ip32_maceisa_edge_interrupt = { 340 .name = "IP32 MACE ISA", 341 + .irq_ack = mask_and_ack_maceisa_irq, 342 + .irq_mask = disable_maceisa_irq, 343 + .irq_mask_ack = mask_and_ack_maceisa_irq, 344 + .irq_unmask = enable_maceisa_irq, 345 }; 346 347 /* This is used for regular non-ISA, non-PCI MACE interrupts. That means 348 * bits 0-3 and 7 in the CRIME register. 349 */ 350 351 + static void enable_mace_irq(struct irq_data *d) 352 { 353 + unsigned int bit = d->irq - CRIME_IRQ_BASE; 354 355 crime_mask |= (1 << bit); 356 crime->imask = crime_mask; 357 } 358 359 + static void disable_mace_irq(struct irq_data *d) 360 { 361 + unsigned int bit = d->irq - CRIME_IRQ_BASE; 362 363 crime_mask &= ~(1 << bit); 364 crime->imask = crime_mask; 365 flush_crime_bus(); 366 } 367 368 static struct irq_chip ip32_mace_interrupt = { 369 .name = "IP32 MACE", 370 + .irq_mask = disable_mace_irq, 371 + .irq_unmask = enable_mace_irq, 372 }; 373 374 static void ip32_unknown_interrupt(void)
+20 -35
arch/mips/sibyte/bcm1480/irq.c
··· 44 * for interrupt lines 45 */ 46 47 - 48 - static void end_bcm1480_irq(unsigned int irq); 49 - static void enable_bcm1480_irq(unsigned int irq); 50 - static void disable_bcm1480_irq(unsigned int irq); 51 - static void ack_bcm1480_irq(unsigned int irq); 52 - #ifdef CONFIG_SMP 53 - static int bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask); 54 - #endif 55 - 56 #ifdef CONFIG_PCI 57 extern unsigned long ht_eoi_space; 58 #endif 59 - 60 - static struct irq_chip bcm1480_irq_type = { 61 - .name = "BCM1480-IMR", 62 - .ack = ack_bcm1480_irq, 63 - .mask = disable_bcm1480_irq, 64 - .mask_ack = ack_bcm1480_irq, 65 - .unmask = enable_bcm1480_irq, 66 - .end = end_bcm1480_irq, 67 - #ifdef CONFIG_SMP 68 - .set_affinity = bcm1480_set_affinity 69 - #endif 70 - }; 71 72 /* Store the CPU id (not the logical number) */ 73 int bcm1480_irq_owner[BCM1480_NR_IRQS]; ··· 88 } 89 90 #ifdef CONFIG_SMP 91 - static int bcm1480_set_affinity(unsigned int irq, const struct cpumask *mask) 92 { 93 int i = 0, old_cpu, cpu, int_on, k; 94 u64 cur_ints; 95 unsigned long flags; 96 - unsigned int irq_dirty; 97 98 i = cpumask_first(mask); 99 ··· 136 137 /*****************************************************************************/ 138 139 - static void disable_bcm1480_irq(unsigned int irq) 140 { 141 bcm1480_mask_irq(bcm1480_irq_owner[irq], irq); 142 } 143 144 - static void enable_bcm1480_irq(unsigned int irq) 145 { 146 bcm1480_unmask_irq(bcm1480_irq_owner[irq], irq); 147 } 148 149 150 - static void ack_bcm1480_irq(unsigned int irq) 151 { 152 u64 pending; 153 - unsigned int irq_dirty; 154 int k; 155 156 /* ··· 201 bcm1480_mask_irq(bcm1480_irq_owner[irq], irq); 202 } 203 204 - 205 - static void end_bcm1480_irq(unsigned int irq) 206 - { 207 - if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) { 208 - bcm1480_unmask_irq(bcm1480_irq_owner[irq], irq); 209 - } 210 - } 211 - 212 213 void __init init_bcm1480_irqs(void) 214 {
··· 44 * for interrupt lines 45 */ 46 47 #ifdef CONFIG_PCI 48 extern unsigned long ht_eoi_space; 49 #endif 50 51 /* Store the CPU id (not the logical number) */ 52 int bcm1480_irq_owner[BCM1480_NR_IRQS]; ··· 109 } 110 111 #ifdef CONFIG_SMP 112 + static int bcm1480_set_affinity(struct irq_data *d, const struct cpumask *mask, 113 + bool force) 114 { 115 + unsigned int irq_dirty, irq = d->irq; 116 int i = 0, old_cpu, cpu, int_on, k; 117 u64 cur_ints; 118 unsigned long flags; 119 120 i = cpumask_first(mask); 121 ··· 156 157 /*****************************************************************************/ 158 159 + static void disable_bcm1480_irq(struct irq_data *d) 160 { 161 + unsigned int irq = d->irq; 162 + 163 bcm1480_mask_irq(bcm1480_irq_owner[irq], irq); 164 } 165 166 + static void enable_bcm1480_irq(struct irq_data *d) 167 { 168 + unsigned int irq = d->irq; 169 + 170 bcm1480_unmask_irq(bcm1480_irq_owner[irq], irq); 171 } 172 173 174 + static void ack_bcm1480_irq(struct irq_data *d) 175 { 176 + unsigned int irq_dirty, irq = d->irq; 177 u64 pending; 178 int k; 179 180 /* ··· 217 bcm1480_mask_irq(bcm1480_irq_owner[irq], irq); 218 } 219 220 + static struct irq_chip bcm1480_irq_type = { 221 + .name = "BCM1480-IMR", 222 + .irq_mask_ack = ack_bcm1480_irq, 223 + .irq_mask = disable_bcm1480_irq, 224 + .irq_unmask = enable_bcm1480_irq, 225 + #ifdef CONFIG_SMP 226 + .irq_set_affinity = bcm1480_set_affinity 227 + #endif 228 + }; 229 230 void __init init_bcm1480_irqs(void) 231 {
+15 -38
arch/mips/sibyte/sb1250/irq.c
··· 43 * for interrupt lines 44 */ 45 46 - 47 - static void end_sb1250_irq(unsigned int irq); 48 - static void enable_sb1250_irq(unsigned int irq); 49 - static void disable_sb1250_irq(unsigned int irq); 50 - static void ack_sb1250_irq(unsigned int irq); 51 - #ifdef CONFIG_SMP 52 - static int sb1250_set_affinity(unsigned int irq, const struct cpumask *mask); 53 - #endif 54 - 55 #ifdef CONFIG_SIBYTE_HAS_LDT 56 extern unsigned long ldt_eoi_space; 57 #endif 58 - 59 - static struct irq_chip sb1250_irq_type = { 60 - .name = "SB1250-IMR", 61 - .ack = ack_sb1250_irq, 62 - .mask = disable_sb1250_irq, 63 - .mask_ack = ack_sb1250_irq, 64 - .unmask = enable_sb1250_irq, 65 - .end = end_sb1250_irq, 66 - #ifdef CONFIG_SMP 67 - .set_affinity = sb1250_set_affinity 68 - #endif 69 - }; 70 71 /* Store the CPU id (not the logical number) */ 72 int sb1250_irq_owner[SB1250_NR_IRQS]; ··· 81 } 82 83 #ifdef CONFIG_SMP 84 - static int sb1250_set_affinity(unsigned int irq, const struct cpumask *mask) 85 { 86 int i = 0, old_cpu, cpu, int_on; 87 u64 cur_ints; 88 unsigned long flags; 89 ··· 123 } 124 #endif 125 126 - /*****************************************************************************/ 127 - 128 - static void disable_sb1250_irq(unsigned int irq) 129 { 130 - sb1250_mask_irq(sb1250_irq_owner[irq], irq); 131 - } 132 133 - static void enable_sb1250_irq(unsigned int irq) 134 - { 135 sb1250_unmask_irq(sb1250_irq_owner[irq], irq); 136 } 137 138 139 - static void ack_sb1250_irq(unsigned int irq) 140 { 141 #ifdef CONFIG_SIBYTE_HAS_LDT 142 u64 pending; 143 ··· 176 sb1250_mask_irq(sb1250_irq_owner[irq], irq); 177 } 178 179 - 180 - static void end_sb1250_irq(unsigned int irq) 181 - { 182 - if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) { 183 - sb1250_unmask_irq(sb1250_irq_owner[irq], irq); 184 - } 185 - } 186 - 187 188 void __init init_sb1250_irqs(void) 189 {
··· 43 * for interrupt lines 44 */ 45 46 #ifdef CONFIG_SIBYTE_HAS_LDT 47 extern unsigned long ldt_eoi_space; 48 #endif 49 50 /* Store the CPU id (not the logical number) */ 51 int sb1250_irq_owner[SB1250_NR_IRQS]; ··· 102 } 103 104 #ifdef CONFIG_SMP 105 + static int sb1250_set_affinity(struct irq_data *d, const struct cpumask *mask, 106 + bool force) 107 { 108 int i = 0, old_cpu, cpu, int_on; 109 + unsigned int irq = d->irq; 110 u64 cur_ints; 111 unsigned long flags; 112 ··· 142 } 143 #endif 144 145 + static void enable_sb1250_irq(struct irq_data *d) 146 { 147 + unsigned int irq = d->irq; 148 149 sb1250_unmask_irq(sb1250_irq_owner[irq], irq); 150 } 151 152 153 + static void ack_sb1250_irq(struct irq_data *d) 154 { 155 + unsigned int irq = d->irq; 156 #ifdef CONFIG_SIBYTE_HAS_LDT 157 u64 pending; 158 ··· 199 sb1250_mask_irq(sb1250_irq_owner[irq], irq); 200 } 201 202 + static struct irq_chip sb1250_irq_type = { 203 + .name = "SB1250-IMR", 204 + .irq_mask_ack = ack_sb1250_irq, 205 + .irq_unmask = enable_sb1250_irq, 206 + #ifdef CONFIG_SMP 207 + .irq_set_affinity = sb1250_set_affinity 208 + #endif 209 + }; 210 211 void __init init_sb1250_irqs(void) 212 {
+6 -17
arch/mips/sni/a20r.c
··· 168 return status; 169 } 170 171 - static inline void unmask_a20r_irq(unsigned int irq) 172 { 173 - set_c0_status(0x100 << (irq - SNI_A20R_IRQ_BASE)); 174 irq_enable_hazard(); 175 } 176 177 - static inline void mask_a20r_irq(unsigned int irq) 178 { 179 - clear_c0_status(0x100 << (irq - SNI_A20R_IRQ_BASE)); 180 irq_disable_hazard(); 181 - } 182 - 183 - static void end_a20r_irq(unsigned int irq) 184 - { 185 - if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS))) { 186 - a20r_ack_hwint(); 187 - unmask_a20r_irq(irq); 188 - } 189 } 190 191 static struct irq_chip a20r_irq_type = { 192 .name = "A20R", 193 - .ack = mask_a20r_irq, 194 - .mask = mask_a20r_irq, 195 - .mask_ack = mask_a20r_irq, 196 - .unmask = unmask_a20r_irq, 197 - .end = end_a20r_irq, 198 }; 199 200 /*
··· 168 return status; 169 } 170 171 + static inline void unmask_a20r_irq(struct irq_data *d) 172 { 173 + set_c0_status(0x100 << (d->irq - SNI_A20R_IRQ_BASE)); 174 irq_enable_hazard(); 175 } 176 177 + static inline void mask_a20r_irq(struct irq_data *d) 178 { 179 + clear_c0_status(0x100 << (d->irq - SNI_A20R_IRQ_BASE)); 180 irq_disable_hazard(); 181 } 182 183 static struct irq_chip a20r_irq_type = { 184 .name = "A20R", 185 + .irq_mask = mask_a20r_irq, 186 + .irq_unmask = unmask_a20r_irq, 187 }; 188 189 /*
+6 -15
arch/mips/sni/pcimt.c
··· 194 .io_map_base = SNI_PORT_BASE 195 }; 196 197 - static void enable_pcimt_irq(unsigned int irq) 198 { 199 - unsigned int mask = 1 << (irq - PCIMT_IRQ_INT2); 200 201 *(volatile u8 *) PCIMT_IRQSEL |= mask; 202 } 203 204 - void disable_pcimt_irq(unsigned int irq) 205 { 206 - unsigned int mask = ~(1 << (irq - PCIMT_IRQ_INT2)); 207 208 *(volatile u8 *) PCIMT_IRQSEL &= mask; 209 } 210 211 - static void end_pcimt_irq(unsigned int irq) 212 - { 213 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 214 - enable_pcimt_irq(irq); 215 - } 216 - 217 static struct irq_chip pcimt_irq_type = { 218 .name = "PCIMT", 219 - .ack = disable_pcimt_irq, 220 - .mask = disable_pcimt_irq, 221 - .mask_ack = disable_pcimt_irq, 222 - .unmask = enable_pcimt_irq, 223 - .end = end_pcimt_irq, 224 }; 225 226 /*
··· 194 .io_map_base = SNI_PORT_BASE 195 }; 196 197 + static void enable_pcimt_irq(struct irq_data *d) 198 { 199 + unsigned int mask = 1 << (d->irq - PCIMT_IRQ_INT2); 200 201 *(volatile u8 *) PCIMT_IRQSEL |= mask; 202 } 203 204 + void disable_pcimt_irq(struct irq_data *d) 205 { 206 + unsigned int mask = ~(1 << (d->irq - PCIMT_IRQ_INT2)); 207 208 *(volatile u8 *) PCIMT_IRQSEL &= mask; 209 } 210 211 static struct irq_chip pcimt_irq_type = { 212 .name = "PCIMT", 213 + .irq_mask = disable_pcimt_irq, 214 + .irq_unmask = enable_pcimt_irq, 215 }; 216 217 /*
+6 -15
arch/mips/sni/pcit.c
··· 156 .io_map_base = SNI_PORT_BASE 157 }; 158 159 - static void enable_pcit_irq(unsigned int irq) 160 { 161 - u32 mask = 1 << (irq - SNI_PCIT_INT_START + 24); 162 163 *(volatile u32 *)SNI_PCIT_INT_REG |= mask; 164 } 165 166 - void disable_pcit_irq(unsigned int irq) 167 { 168 - u32 mask = 1 << (irq - SNI_PCIT_INT_START + 24); 169 170 *(volatile u32 *)SNI_PCIT_INT_REG &= ~mask; 171 } 172 173 - void end_pcit_irq(unsigned int irq) 174 - { 175 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 176 - enable_pcit_irq(irq); 177 - } 178 - 179 static struct irq_chip pcit_irq_type = { 180 .name = "PCIT", 181 - .ack = disable_pcit_irq, 182 - .mask = disable_pcit_irq, 183 - .mask_ack = disable_pcit_irq, 184 - .unmask = enable_pcit_irq, 185 - .end = end_pcit_irq, 186 }; 187 188 static void pcit_hwint1(void)
··· 156 .io_map_base = SNI_PORT_BASE 157 }; 158 159 + static void enable_pcit_irq(struct irq_data *d) 160 { 161 + u32 mask = 1 << (d->irq - SNI_PCIT_INT_START + 24); 162 163 *(volatile u32 *)SNI_PCIT_INT_REG |= mask; 164 } 165 166 + void disable_pcit_irq(struct irq_data *d) 167 { 168 + u32 mask = 1 << (d->irq - SNI_PCIT_INT_START + 24); 169 170 *(volatile u32 *)SNI_PCIT_INT_REG &= ~mask; 171 } 172 173 static struct irq_chip pcit_irq_type = { 174 .name = "PCIT", 175 + .irq_mask = disable_pcit_irq, 176 + .irq_unmask = enable_pcit_irq, 177 }; 178 179 static void pcit_hwint1(void)
+15 -27
arch/mips/sni/rm200.c
··· 155 #define cached_master_mask (rm200_cached_irq_mask) 156 #define cached_slave_mask (rm200_cached_irq_mask >> 8) 157 158 - static void sni_rm200_disable_8259A_irq(unsigned int irq) 159 { 160 - unsigned int mask; 161 unsigned long flags; 162 163 - irq -= RM200_I8259A_IRQ_BASE; 164 mask = 1 << irq; 165 raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags); 166 rm200_cached_irq_mask |= mask; ··· 170 raw_spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags); 171 } 172 173 - static void sni_rm200_enable_8259A_irq(unsigned int irq) 174 { 175 - unsigned int mask; 176 unsigned long flags; 177 178 - irq -= RM200_I8259A_IRQ_BASE; 179 mask = ~(1 << irq); 180 raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags); 181 rm200_cached_irq_mask &= mask; ··· 208 * first, _then_ send the EOI, and the order of EOI 209 * to the two 8259s is important! 210 */ 211 - void sni_rm200_mask_and_ack_8259A(unsigned int irq) 212 { 213 - unsigned int irqmask; 214 unsigned long flags; 215 216 - irq -= RM200_I8259A_IRQ_BASE; 217 irqmask = 1 << irq; 218 raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags); 219 /* ··· 282 283 static struct irq_chip sni_rm200_i8259A_chip = { 284 .name = "RM200-XT-PIC", 285 - .mask = sni_rm200_disable_8259A_irq, 286 - .unmask = sni_rm200_enable_8259A_irq, 287 - .mask_ack = sni_rm200_mask_and_ack_8259A, 288 }; 289 290 /* ··· 426 #define SNI_RM200_INT_START 24 427 #define SNI_RM200_INT_END 28 428 429 - static void enable_rm200_irq(unsigned int irq) 430 { 431 - unsigned int mask = 1 << (irq - SNI_RM200_INT_START); 432 433 *(volatile u8 *)SNI_RM200_INT_ENA_REG &= ~mask; 434 } 435 436 - void disable_rm200_irq(unsigned int irq) 437 { 438 - unsigned int mask = 1 << (irq - SNI_RM200_INT_START); 439 440 *(volatile u8 *)SNI_RM200_INT_ENA_REG |= mask; 441 } 442 443 - void end_rm200_irq(unsigned int irq) 444 - { 445 - if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS))) 446 - enable_rm200_irq(irq); 447 - } 448 - 449 static struct irq_chip rm200_irq_type = { 450 .name = "RM200", 451 - .ack = disable_rm200_irq, 452 - .mask = disable_rm200_irq, 453 - .mask_ack = disable_rm200_irq, 454 - .unmask = enable_rm200_irq, 455 - .end = end_rm200_irq, 456 }; 457 458 static void sni_rm200_hwint(void)
··· 155 #define cached_master_mask (rm200_cached_irq_mask) 156 #define cached_slave_mask (rm200_cached_irq_mask >> 8) 157 158 + static void sni_rm200_disable_8259A_irq(struct irq_data *d) 159 { 160 + unsigned int mask, irq = d->irq - RM200_I8259A_IRQ_BASE; 161 unsigned long flags; 162 163 mask = 1 << irq; 164 raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags); 165 rm200_cached_irq_mask |= mask; ··· 171 raw_spin_unlock_irqrestore(&sni_rm200_i8259A_lock, flags); 172 } 173 174 + static void sni_rm200_enable_8259A_irq(struct irq_data *d) 175 { 176 + unsigned int mask, irq = d->irq - RM200_I8259A_IRQ_BASE; 177 unsigned long flags; 178 179 mask = ~(1 << irq); 180 raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags); 181 rm200_cached_irq_mask &= mask; ··· 210 * first, _then_ send the EOI, and the order of EOI 211 * to the two 8259s is important! 212 */ 213 + void sni_rm200_mask_and_ack_8259A(struct irq_data *d) 214 { 215 + unsigned int irqmask, irq = d->irq - RM200_I8259A_IRQ_BASE; 216 unsigned long flags; 217 218 irqmask = 1 << irq; 219 raw_spin_lock_irqsave(&sni_rm200_i8259A_lock, flags); 220 /* ··· 285 286 static struct irq_chip sni_rm200_i8259A_chip = { 287 .name = "RM200-XT-PIC", 288 + .irq_mask = sni_rm200_disable_8259A_irq, 289 + .irq_unmask = sni_rm200_enable_8259A_irq, 290 + .irq_mask_ack = sni_rm200_mask_and_ack_8259A, 291 }; 292 293 /* ··· 429 #define SNI_RM200_INT_START 24 430 #define SNI_RM200_INT_END 28 431 432 + static void enable_rm200_irq(struct irq_data *d) 433 { 434 + unsigned int mask = 1 << (d->irq - SNI_RM200_INT_START); 435 436 *(volatile u8 *)SNI_RM200_INT_ENA_REG &= ~mask; 437 } 438 439 + void disable_rm200_irq(struct irq_data *d) 440 { 441 + unsigned int mask = 1 << (d->irq - SNI_RM200_INT_START); 442 443 *(volatile u8 *)SNI_RM200_INT_ENA_REG |= mask; 444 } 445 446 static struct irq_chip rm200_irq_type = { 447 .name = "RM200", 448 + .irq_mask = disable_rm200_irq, 449 + .irq_unmask = enable_rm200_irq, 450 }; 451 452 static void sni_rm200_hwint(void)
+14 -14
arch/mips/txx9/generic/irq_tx4939.c
··· 50 unsigned char mode; 51 } tx4939irq[TX4939_NUM_IR] __read_mostly; 52 53 - static void tx4939_irq_unmask(unsigned int irq) 54 { 55 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 56 u32 __iomem *lvlp; 57 int ofs; 58 if (irq_nr < 32) { ··· 68 lvlp); 69 } 70 71 - static inline void tx4939_irq_mask(unsigned int irq) 72 { 73 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 74 u32 __iomem *lvlp; 75 int ofs; 76 if (irq_nr < 32) { ··· 87 mmiowb(); 88 } 89 90 - static void tx4939_irq_mask_ack(unsigned int irq) 91 { 92 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 93 94 - tx4939_irq_mask(irq); 95 if (TXx9_IRCR_EDGE(tx4939irq[irq_nr].mode)) { 96 irq_nr--; 97 /* clear edge detection */ ··· 101 } 102 } 103 104 - static int tx4939_irq_set_type(unsigned int irq, unsigned int flow_type) 105 { 106 - unsigned int irq_nr = irq - TXX9_IRQ_BASE; 107 u32 cr; 108 u32 __iomem *crp; 109 int ofs; ··· 145 146 static struct irq_chip tx4939_irq_chip = { 147 .name = "TX4939", 148 - .ack = tx4939_irq_mask_ack, 149 - .mask = tx4939_irq_mask, 150 - .mask_ack = tx4939_irq_mask_ack, 151 - .unmask = tx4939_irq_unmask, 152 - .set_type = tx4939_irq_set_type, 153 }; 154 155 static int tx4939_irq_set_pri(int irc_irq, int new_pri)
··· 50 unsigned char mode; 51 } tx4939irq[TX4939_NUM_IR] __read_mostly; 52 53 + static void tx4939_irq_unmask(struct irq_data *d) 54 { 55 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 56 u32 __iomem *lvlp; 57 int ofs; 58 if (irq_nr < 32) { ··· 68 lvlp); 69 } 70 71 + static inline void tx4939_irq_mask(struct irq_data *d) 72 { 73 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 74 u32 __iomem *lvlp; 75 int ofs; 76 if (irq_nr < 32) { ··· 87 mmiowb(); 88 } 89 90 + static void tx4939_irq_mask_ack(struct irq_data *d) 91 { 92 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 93 94 + tx4939_irq_mask(d); 95 if (TXx9_IRCR_EDGE(tx4939irq[irq_nr].mode)) { 96 irq_nr--; 97 /* clear edge detection */ ··· 101 } 102 } 103 104 + static int tx4939_irq_set_type(struct irq_data *d, unsigned int flow_type) 105 { 106 + unsigned int irq_nr = d->irq - TXX9_IRQ_BASE; 107 u32 cr; 108 u32 __iomem *crp; 109 int ofs; ··· 145 146 static struct irq_chip tx4939_irq_chip = { 147 .name = "TX4939", 148 + .irq_ack = tx4939_irq_mask_ack, 149 + .irq_mask = tx4939_irq_mask, 150 + .irq_mask_ack = tx4939_irq_mask_ack, 151 + .irq_unmask = tx4939_irq_unmask, 152 + .irq_set_type = tx4939_irq_set_type, 153 }; 154 155 static int tx4939_irq_set_pri(int irc_irq, int new_pri)
+6 -8
arch/mips/txx9/jmr3927/irq.c
··· 47 * CP0_STATUS is a thread's resource (saved/restored on context switch). 48 * So disable_irq/enable_irq MUST handle IOC/IRC registers. 49 */ 50 - static void mask_irq_ioc(unsigned int irq) 51 { 52 /* 0: mask */ 53 - unsigned int irq_nr = irq - JMR3927_IRQ_IOC; 54 unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); 55 unsigned int bit = 1 << irq_nr; 56 jmr3927_ioc_reg_out(imask & ~bit, JMR3927_IOC_INTM_ADDR); 57 /* flush write buffer */ 58 (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); 59 } 60 - static void unmask_irq_ioc(unsigned int irq) 61 { 62 /* 0: mask */ 63 - unsigned int irq_nr = irq - JMR3927_IRQ_IOC; 64 unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); 65 unsigned int bit = 1 << irq_nr; 66 jmr3927_ioc_reg_out(imask | bit, JMR3927_IOC_INTM_ADDR); ··· 95 96 static struct irq_chip jmr3927_irq_ioc = { 97 .name = "jmr3927_ioc", 98 - .ack = mask_irq_ioc, 99 - .mask = mask_irq_ioc, 100 - .mask_ack = mask_irq_ioc, 101 - .unmask = unmask_irq_ioc, 102 }; 103 104 void __init jmr3927_irq_setup(void)
··· 47 * CP0_STATUS is a thread's resource (saved/restored on context switch). 48 * So disable_irq/enable_irq MUST handle IOC/IRC registers. 49 */ 50 + static void mask_irq_ioc(struct irq_data *d) 51 { 52 /* 0: mask */ 53 + unsigned int irq_nr = d->irq - JMR3927_IRQ_IOC; 54 unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); 55 unsigned int bit = 1 << irq_nr; 56 jmr3927_ioc_reg_out(imask & ~bit, JMR3927_IOC_INTM_ADDR); 57 /* flush write buffer */ 58 (void)jmr3927_ioc_reg_in(JMR3927_IOC_REV_ADDR); 59 } 60 + static void unmask_irq_ioc(struct irq_data *d) 61 { 62 /* 0: mask */ 63 + unsigned int irq_nr = d->irq - JMR3927_IRQ_IOC; 64 unsigned char imask = jmr3927_ioc_reg_in(JMR3927_IOC_INTM_ADDR); 65 unsigned int bit = 1 << irq_nr; 66 jmr3927_ioc_reg_out(imask | bit, JMR3927_IOC_INTM_ADDR); ··· 95 96 static struct irq_chip jmr3927_irq_ioc = { 97 .name = "jmr3927_ioc", 98 + .irq_mask = mask_irq_ioc, 99 + .irq_unmask = unmask_irq_ioc, 100 }; 101 102 void __init jmr3927_irq_setup(void)
+26 -32
arch/mips/txx9/rbtx4927/irq.c
··· 117 #include <asm/txx9/generic.h> 118 #include <asm/txx9/rbtx4927.h> 119 120 - static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq); 121 - static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq); 122 - 123 - #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC" 124 - static struct irq_chip toshiba_rbtx4927_irq_ioc_type = { 125 - .name = TOSHIBA_RBTX4927_IOC_NAME, 126 - .ack = toshiba_rbtx4927_irq_ioc_disable, 127 - .mask = toshiba_rbtx4927_irq_ioc_disable, 128 - .mask_ack = toshiba_rbtx4927_irq_ioc_disable, 129 - .unmask = toshiba_rbtx4927_irq_ioc_enable, 130 - }; 131 - 132 static int toshiba_rbtx4927_irq_nested(int sw_irq) 133 { 134 u8 level3; ··· 126 return -1; 127 return RBTX4927_IRQ_IOC + __fls8(level3); 128 } 129 130 static void __init toshiba_rbtx4927_irq_ioc_init(void) 131 { ··· 168 handle_level_irq); 169 set_irq_chained_handler(RBTX4927_IRQ_IOCINT, handle_simple_irq); 170 } 171 - 172 - static void toshiba_rbtx4927_irq_ioc_enable(unsigned int irq) 173 - { 174 - unsigned char v; 175 - 176 - v = readb(rbtx4927_imask_addr); 177 - v |= (1 << (irq - RBTX4927_IRQ_IOC)); 178 - writeb(v, rbtx4927_imask_addr); 179 - } 180 - 181 - static void toshiba_rbtx4927_irq_ioc_disable(unsigned int irq) 182 - { 183 - unsigned char v; 184 - 185 - v = readb(rbtx4927_imask_addr); 186 - v &= ~(1 << (irq - RBTX4927_IRQ_IOC)); 187 - writeb(v, rbtx4927_imask_addr); 188 - mmiowb(); 189 - } 190 - 191 192 static int rbtx4927_irq_dispatch(int pending) 193 {
··· 117 #include <asm/txx9/generic.h> 118 #include <asm/txx9/rbtx4927.h> 119 120 static int toshiba_rbtx4927_irq_nested(int sw_irq) 121 { 122 u8 level3; ··· 138 return -1; 139 return RBTX4927_IRQ_IOC + __fls8(level3); 140 } 141 + 142 + static void toshiba_rbtx4927_irq_ioc_enable(struct irq_data *d) 143 + { 144 + unsigned char v; 145 + 146 + v = readb(rbtx4927_imask_addr); 147 + v |= (1 << (d->irq - RBTX4927_IRQ_IOC)); 148 + writeb(v, rbtx4927_imask_addr); 149 + } 150 + 151 + static void toshiba_rbtx4927_irq_ioc_disable(struct irq_data *d) 152 + { 153 + unsigned char v; 154 + 155 + v = readb(rbtx4927_imask_addr); 156 + v &= ~(1 << (d->irq - RBTX4927_IRQ_IOC)); 157 + writeb(v, rbtx4927_imask_addr); 158 + mmiowb(); 159 + } 160 + 161 + #define TOSHIBA_RBTX4927_IOC_NAME "RBTX4927-IOC" 162 + static struct irq_chip toshiba_rbtx4927_irq_ioc_type = { 163 + .name = TOSHIBA_RBTX4927_IOC_NAME, 164 + .irq_mask = toshiba_rbtx4927_irq_ioc_disable, 165 + .irq_unmask = toshiba_rbtx4927_irq_ioc_enable, 166 + }; 167 168 static void __init toshiba_rbtx4927_irq_ioc_init(void) 169 { ··· 154 handle_level_irq); 155 set_irq_chained_handler(RBTX4927_IRQ_IOCINT, handle_simple_irq); 156 } 157 158 static int rbtx4927_irq_dispatch(int pending) 159 {
+23 -31
arch/mips/txx9/rbtx4938/irq.c
··· 69 #include <asm/txx9/generic.h> 70 #include <asm/txx9/rbtx4938.h> 71 72 - static void toshiba_rbtx4938_irq_ioc_enable(unsigned int irq); 73 - static void toshiba_rbtx4938_irq_ioc_disable(unsigned int irq); 74 - 75 - #define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC" 76 - static struct irq_chip toshiba_rbtx4938_irq_ioc_type = { 77 - .name = TOSHIBA_RBTX4938_IOC_NAME, 78 - .ack = toshiba_rbtx4938_irq_ioc_disable, 79 - .mask = toshiba_rbtx4938_irq_ioc_disable, 80 - .mask_ack = toshiba_rbtx4938_irq_ioc_disable, 81 - .unmask = toshiba_rbtx4938_irq_ioc_enable, 82 - }; 83 - 84 static int toshiba_rbtx4938_irq_nested(int sw_irq) 85 { 86 u8 level3; ··· 80 return RBTX4938_IRQ_IOC + __fls8(level3); 81 } 82 83 - static void __init 84 - toshiba_rbtx4938_irq_ioc_init(void) 85 - { 86 - int i; 87 - 88 - for (i = RBTX4938_IRQ_IOC; 89 - i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++) 90 - set_irq_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type, 91 - handle_level_irq); 92 - 93 - set_irq_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq); 94 - } 95 - 96 - static void 97 - toshiba_rbtx4938_irq_ioc_enable(unsigned int irq) 98 { 99 unsigned char v; 100 101 v = readb(rbtx4938_imask_addr); 102 - v |= (1 << (irq - RBTX4938_IRQ_IOC)); 103 writeb(v, rbtx4938_imask_addr); 104 mmiowb(); 105 } 106 107 - static void 108 - toshiba_rbtx4938_irq_ioc_disable(unsigned int irq) 109 { 110 unsigned char v; 111 112 v = readb(rbtx4938_imask_addr); 113 - v &= ~(1 << (irq - RBTX4938_IRQ_IOC)); 114 writeb(v, rbtx4938_imask_addr); 115 mmiowb(); 116 } 117 118 static int rbtx4938_irq_dispatch(int pending) 119 { ··· 124 else 125 irq = -1; 126 return irq; 127 } 128 129 void __init rbtx4938_irq_setup(void)
··· 69 #include <asm/txx9/generic.h> 70 #include <asm/txx9/rbtx4938.h> 71 72 static int toshiba_rbtx4938_irq_nested(int sw_irq) 73 { 74 u8 level3; ··· 92 return RBTX4938_IRQ_IOC + __fls8(level3); 93 } 94 95 + static void toshiba_rbtx4938_irq_ioc_enable(struct irq_data *d) 96 { 97 unsigned char v; 98 99 v = readb(rbtx4938_imask_addr); 100 + v |= (1 << (d->irq - RBTX4938_IRQ_IOC)); 101 writeb(v, rbtx4938_imask_addr); 102 mmiowb(); 103 } 104 105 + static void toshiba_rbtx4938_irq_ioc_disable(struct irq_data *d) 106 { 107 unsigned char v; 108 109 v = readb(rbtx4938_imask_addr); 110 + v &= ~(1 << (d->irq - RBTX4938_IRQ_IOC)); 111 writeb(v, rbtx4938_imask_addr); 112 mmiowb(); 113 } 114 + 115 + #define TOSHIBA_RBTX4938_IOC_NAME "RBTX4938-IOC" 116 + static struct irq_chip toshiba_rbtx4938_irq_ioc_type = { 117 + .name = TOSHIBA_RBTX4938_IOC_NAME, 118 + .irq_mask = toshiba_rbtx4938_irq_ioc_disable, 119 + .irq_unmask = toshiba_rbtx4938_irq_ioc_enable, 120 + }; 121 122 static int rbtx4938_irq_dispatch(int pending) 123 { ··· 144 else 145 irq = -1; 146 return irq; 147 + } 148 + 149 + static void __init toshiba_rbtx4938_irq_ioc_init(void) 150 + { 151 + int i; 152 + 153 + for (i = RBTX4938_IRQ_IOC; 154 + i < RBTX4938_IRQ_IOC + RBTX4938_NR_IRQ_IOC; i++) 155 + set_irq_chip_and_handler(i, &toshiba_rbtx4938_irq_ioc_type, 156 + handle_level_irq); 157 + 158 + set_irq_chained_handler(RBTX4938_IRQ_IOCINT, handle_simple_irq); 159 } 160 161 void __init rbtx4938_irq_setup(void)
+6 -8
arch/mips/txx9/rbtx4939/irq.c
··· 19 * RBTX4939 IOC controller definition 20 */ 21 22 - static void rbtx4939_ioc_irq_unmask(unsigned int irq) 23 { 24 - int ioc_nr = irq - RBTX4939_IRQ_IOC; 25 26 writeb(readb(rbtx4939_ien_addr) | (1 << ioc_nr), rbtx4939_ien_addr); 27 } 28 29 - static void rbtx4939_ioc_irq_mask(unsigned int irq) 30 { 31 - int ioc_nr = irq - RBTX4939_IRQ_IOC; 32 33 writeb(readb(rbtx4939_ien_addr) & ~(1 << ioc_nr), rbtx4939_ien_addr); 34 mmiowb(); ··· 36 37 static struct irq_chip rbtx4939_ioc_irq_chip = { 38 .name = "IOC", 39 - .ack = rbtx4939_ioc_irq_mask, 40 - .mask = rbtx4939_ioc_irq_mask, 41 - .mask_ack = rbtx4939_ioc_irq_mask, 42 - .unmask = rbtx4939_ioc_irq_unmask, 43 }; 44 45
··· 19 * RBTX4939 IOC controller definition 20 */ 21 22 + static void rbtx4939_ioc_irq_unmask(struct irq_data *d) 23 { 24 + int ioc_nr = d->irq - RBTX4939_IRQ_IOC; 25 26 writeb(readb(rbtx4939_ien_addr) | (1 << ioc_nr), rbtx4939_ien_addr); 27 } 28 29 + static void rbtx4939_ioc_irq_mask(struct irq_data *d) 30 { 31 + int ioc_nr = d->irq - RBTX4939_IRQ_IOC; 32 33 writeb(readb(rbtx4939_ien_addr) & ~(1 << ioc_nr), rbtx4939_ien_addr); 34 mmiowb(); ··· 36 37 static struct irq_chip rbtx4939_ioc_irq_chip = { 38 .name = "IOC", 39 + .irq_mask = rbtx4939_ioc_irq_mask, 40 + .irq_unmask = rbtx4939_ioc_irq_unmask, 41 }; 42 43
+34 -38
arch/mips/vr41xx/common/icu.c
··· 154 155 void vr41xx_enable_piuint(uint16_t mask) 156 { 157 - struct irq_desc *desc = irq_desc + PIU_IRQ; 158 unsigned long flags; 159 160 if (current_cpu_type() == CPU_VR4111 || ··· 169 170 void vr41xx_disable_piuint(uint16_t mask) 171 { 172 - struct irq_desc *desc = irq_desc + PIU_IRQ; 173 unsigned long flags; 174 175 if (current_cpu_type() == CPU_VR4111 || ··· 184 185 void vr41xx_enable_aiuint(uint16_t mask) 186 { 187 - struct irq_desc *desc = irq_desc + AIU_IRQ; 188 unsigned long flags; 189 190 if (current_cpu_type() == CPU_VR4111 || ··· 199 200 void vr41xx_disable_aiuint(uint16_t mask) 201 { 202 - struct irq_desc *desc = irq_desc + AIU_IRQ; 203 unsigned long flags; 204 205 if (current_cpu_type() == CPU_VR4111 || ··· 214 215 void vr41xx_enable_kiuint(uint16_t mask) 216 { 217 - struct irq_desc *desc = irq_desc + KIU_IRQ; 218 unsigned long flags; 219 220 if (current_cpu_type() == CPU_VR4111 || ··· 229 230 void vr41xx_disable_kiuint(uint16_t mask) 231 { 232 - struct irq_desc *desc = irq_desc + KIU_IRQ; 233 unsigned long flags; 234 235 if (current_cpu_type() == CPU_VR4111 || ··· 244 245 void vr41xx_enable_macint(uint16_t mask) 246 { 247 - struct irq_desc *desc = irq_desc + ETHERNET_IRQ; 248 unsigned long flags; 249 250 raw_spin_lock_irqsave(&desc->lock, flags); ··· 256 257 void vr41xx_disable_macint(uint16_t mask) 258 { 259 - struct irq_desc *desc = irq_desc + ETHERNET_IRQ; 260 unsigned long flags; 261 262 raw_spin_lock_irqsave(&desc->lock, flags); ··· 268 269 void vr41xx_enable_dsiuint(uint16_t mask) 270 { 271 - struct irq_desc *desc = irq_desc + DSIU_IRQ; 272 unsigned long flags; 273 274 raw_spin_lock_irqsave(&desc->lock, flags); ··· 280 281 void vr41xx_disable_dsiuint(uint16_t mask) 282 { 283 - struct irq_desc *desc = irq_desc + DSIU_IRQ; 284 unsigned long flags; 285 286 raw_spin_lock_irqsave(&desc->lock, flags); ··· 292 293 void vr41xx_enable_firint(uint16_t mask) 294 { 295 - struct irq_desc *desc = irq_desc + FIR_IRQ; 296 unsigned long flags; 297 298 raw_spin_lock_irqsave(&desc->lock, flags); ··· 304 305 void vr41xx_disable_firint(uint16_t mask) 306 { 307 - struct irq_desc *desc = irq_desc + FIR_IRQ; 308 unsigned long flags; 309 310 raw_spin_lock_irqsave(&desc->lock, flags); ··· 316 317 void vr41xx_enable_pciint(void) 318 { 319 - struct irq_desc *desc = irq_desc + PCI_IRQ; 320 unsigned long flags; 321 322 if (current_cpu_type() == CPU_VR4122 || ··· 332 333 void vr41xx_disable_pciint(void) 334 { 335 - struct irq_desc *desc = irq_desc + PCI_IRQ; 336 unsigned long flags; 337 338 if (current_cpu_type() == CPU_VR4122 || ··· 348 349 void vr41xx_enable_scuint(void) 350 { 351 - struct irq_desc *desc = irq_desc + SCU_IRQ; 352 unsigned long flags; 353 354 if (current_cpu_type() == CPU_VR4122 || ··· 364 365 void vr41xx_disable_scuint(void) 366 { 367 - struct irq_desc *desc = irq_desc + SCU_IRQ; 368 unsigned long flags; 369 370 if (current_cpu_type() == CPU_VR4122 || ··· 380 381 void vr41xx_enable_csiint(uint16_t mask) 382 { 383 - struct irq_desc *desc = irq_desc + CSI_IRQ; 384 unsigned long flags; 385 386 if (current_cpu_type() == CPU_VR4122 || ··· 396 397 void vr41xx_disable_csiint(uint16_t mask) 398 { 399 - struct irq_desc *desc = irq_desc + CSI_IRQ; 400 unsigned long flags; 401 402 if (current_cpu_type() == CPU_VR4122 || ··· 412 413 void vr41xx_enable_bcuint(void) 414 { 415 - struct irq_desc *desc = irq_desc + BCU_IRQ; 416 unsigned long flags; 417 418 if (current_cpu_type() == CPU_VR4122 || ··· 428 429 void vr41xx_disable_bcuint(void) 430 { 431 - struct irq_desc *desc = irq_desc + BCU_IRQ; 432 unsigned long flags; 433 434 if (current_cpu_type() == CPU_VR4122 || ··· 442 443 EXPORT_SYMBOL(vr41xx_disable_bcuint); 444 445 - static void disable_sysint1_irq(unsigned int irq) 446 { 447 - icu1_clear(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); 448 } 449 450 - static void enable_sysint1_irq(unsigned int irq) 451 { 452 - icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(irq)); 453 } 454 455 static struct irq_chip sysint1_irq_type = { 456 .name = "SYSINT1", 457 - .ack = disable_sysint1_irq, 458 - .mask = disable_sysint1_irq, 459 - .mask_ack = disable_sysint1_irq, 460 - .unmask = enable_sysint1_irq, 461 }; 462 463 - static void disable_sysint2_irq(unsigned int irq) 464 { 465 - icu2_clear(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); 466 } 467 468 - static void enable_sysint2_irq(unsigned int irq) 469 { 470 - icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(irq)); 471 } 472 473 static struct irq_chip sysint2_irq_type = { 474 .name = "SYSINT2", 475 - .ack = disable_sysint2_irq, 476 - .mask = disable_sysint2_irq, 477 - .mask_ack = disable_sysint2_irq, 478 - .unmask = enable_sysint2_irq, 479 }; 480 481 static inline int set_sysint1_assign(unsigned int irq, unsigned char assign) 482 { 483 - struct irq_desc *desc = irq_desc + irq; 484 uint16_t intassign0, intassign1; 485 unsigned int pin; 486 ··· 536 537 static inline int set_sysint2_assign(unsigned int irq, unsigned char assign) 538 { 539 - struct irq_desc *desc = irq_desc + irq; 540 uint16_t intassign2, intassign3; 541 unsigned int pin; 542
··· 154 155 void vr41xx_enable_piuint(uint16_t mask) 156 { 157 + struct irq_desc *desc = irq_to_desc(PIU_IRQ); 158 unsigned long flags; 159 160 if (current_cpu_type() == CPU_VR4111 || ··· 169 170 void vr41xx_disable_piuint(uint16_t mask) 171 { 172 + struct irq_desc *desc = irq_to_desc(PIU_IRQ); 173 unsigned long flags; 174 175 if (current_cpu_type() == CPU_VR4111 || ··· 184 185 void vr41xx_enable_aiuint(uint16_t mask) 186 { 187 + struct irq_desc *desc = irq_to_desc(AIU_IRQ); 188 unsigned long flags; 189 190 if (current_cpu_type() == CPU_VR4111 || ··· 199 200 void vr41xx_disable_aiuint(uint16_t mask) 201 { 202 + struct irq_desc *desc = irq_to_desc(AIU_IRQ); 203 unsigned long flags; 204 205 if (current_cpu_type() == CPU_VR4111 || ··· 214 215 void vr41xx_enable_kiuint(uint16_t mask) 216 { 217 + struct irq_desc *desc = irq_to_desc(KIU_IRQ); 218 unsigned long flags; 219 220 if (current_cpu_type() == CPU_VR4111 || ··· 229 230 void vr41xx_disable_kiuint(uint16_t mask) 231 { 232 + struct irq_desc *desc = irq_to_desc(KIU_IRQ); 233 unsigned long flags; 234 235 if (current_cpu_type() == CPU_VR4111 || ··· 244 245 void vr41xx_enable_macint(uint16_t mask) 246 { 247 + struct irq_desc *desc = irq_to_desc(ETHERNET_IRQ); 248 unsigned long flags; 249 250 raw_spin_lock_irqsave(&desc->lock, flags); ··· 256 257 void vr41xx_disable_macint(uint16_t mask) 258 { 259 + struct irq_desc *desc = irq_to_desc(ETHERNET_IRQ); 260 unsigned long flags; 261 262 raw_spin_lock_irqsave(&desc->lock, flags); ··· 268 269 void vr41xx_enable_dsiuint(uint16_t mask) 270 { 271 + struct irq_desc *desc = irq_to_desc(DSIU_IRQ); 272 unsigned long flags; 273 274 raw_spin_lock_irqsave(&desc->lock, flags); ··· 280 281 void vr41xx_disable_dsiuint(uint16_t mask) 282 { 283 + struct irq_desc *desc = irq_to_desc(DSIU_IRQ); 284 unsigned long flags; 285 286 raw_spin_lock_irqsave(&desc->lock, flags); ··· 292 293 void vr41xx_enable_firint(uint16_t mask) 294 { 295 + struct irq_desc *desc = irq_to_desc(FIR_IRQ); 296 unsigned long flags; 297 298 raw_spin_lock_irqsave(&desc->lock, flags); ··· 304 305 void vr41xx_disable_firint(uint16_t mask) 306 { 307 + struct irq_desc *desc = irq_to_desc(FIR_IRQ); 308 unsigned long flags; 309 310 raw_spin_lock_irqsave(&desc->lock, flags); ··· 316 317 void vr41xx_enable_pciint(void) 318 { 319 + struct irq_desc *desc = irq_to_desc(PCI_IRQ); 320 unsigned long flags; 321 322 if (current_cpu_type() == CPU_VR4122 || ··· 332 333 void vr41xx_disable_pciint(void) 334 { 335 + struct irq_desc *desc = irq_to_desc(PCI_IRQ); 336 unsigned long flags; 337 338 if (current_cpu_type() == CPU_VR4122 || ··· 348 349 void vr41xx_enable_scuint(void) 350 { 351 + struct irq_desc *desc = irq_to_desc(SCU_IRQ); 352 unsigned long flags; 353 354 if (current_cpu_type() == CPU_VR4122 || ··· 364 365 void vr41xx_disable_scuint(void) 366 { 367 + struct irq_desc *desc = irq_to_desc(SCU_IRQ); 368 unsigned long flags; 369 370 if (current_cpu_type() == CPU_VR4122 || ··· 380 381 void vr41xx_enable_csiint(uint16_t mask) 382 { 383 + struct irq_desc *desc = irq_to_desc(CSI_IRQ); 384 unsigned long flags; 385 386 if (current_cpu_type() == CPU_VR4122 || ··· 396 397 void vr41xx_disable_csiint(uint16_t mask) 398 { 399 + struct irq_desc *desc = irq_to_desc(CSI_IRQ); 400 unsigned long flags; 401 402 if (current_cpu_type() == CPU_VR4122 || ··· 412 413 void vr41xx_enable_bcuint(void) 414 { 415 + struct irq_desc *desc = irq_to_desc(BCU_IRQ); 416 unsigned long flags; 417 418 if (current_cpu_type() == CPU_VR4122 || ··· 428 429 void vr41xx_disable_bcuint(void) 430 { 431 + struct irq_desc *desc = irq_to_desc(BCU_IRQ); 432 unsigned long flags; 433 434 if (current_cpu_type() == CPU_VR4122 || ··· 442 443 EXPORT_SYMBOL(vr41xx_disable_bcuint); 444 445 + static void disable_sysint1_irq(struct irq_data *d) 446 { 447 + icu1_clear(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(d->irq)); 448 } 449 450 + static void enable_sysint1_irq(struct irq_data *d) 451 { 452 + icu1_set(MSYSINT1REG, 1 << SYSINT1_IRQ_TO_PIN(d->irq)); 453 } 454 455 static struct irq_chip sysint1_irq_type = { 456 .name = "SYSINT1", 457 + .irq_mask = disable_sysint1_irq, 458 + .irq_unmask = enable_sysint1_irq, 459 }; 460 461 + static void disable_sysint2_irq(struct irq_data *d) 462 { 463 + icu2_clear(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(d->irq)); 464 } 465 466 + static void enable_sysint2_irq(struct irq_data *d) 467 { 468 + icu2_set(MSYSINT2REG, 1 << SYSINT2_IRQ_TO_PIN(d->irq)); 469 } 470 471 static struct irq_chip sysint2_irq_type = { 472 .name = "SYSINT2", 473 + .irq_mask = disable_sysint2_irq, 474 + .irq_unmask = enable_sysint2_irq, 475 }; 476 477 static inline int set_sysint1_assign(unsigned int irq, unsigned char assign) 478 { 479 + struct irq_desc *desc = irq_to_desc(irq); 480 uint16_t intassign0, intassign1; 481 unsigned int pin; 482 ··· 540 541 static inline int set_sysint2_assign(unsigned int irq, unsigned char assign) 542 { 543 + struct irq_desc *desc = irq_to_desc(irq); 544 uint16_t intassign2, intassign3; 545 unsigned int pin; 546
+10 -9
arch/mips/vr41xx/common/irq.c
··· 62 static void irq_dispatch(unsigned int irq) 63 { 64 irq_cascade_t *cascade; 65 - struct irq_desc *desc; 66 67 if (irq >= NR_IRQS) { 68 atomic_inc(&irq_err_count); ··· 70 71 cascade = irq_cascade + irq; 72 if (cascade->get_irq != NULL) { 73 - unsigned int source_irq = irq; 74 int ret; 75 - desc = irq_desc + source_irq; 76 - if (desc->chip->mask_ack) 77 - desc->chip->mask_ack(source_irq); 78 else { 79 - desc->chip->mask(source_irq); 80 - desc->chip->ack(source_irq); 81 } 82 ret = cascade->get_irq(irq); 83 irq = ret; ··· 87 atomic_inc(&irq_err_count); 88 else 89 irq_dispatch(irq); 90 - if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask) 91 - desc->chip->unmask(source_irq); 92 } else 93 do_IRQ(irq); 94 }
··· 62 static void irq_dispatch(unsigned int irq) 63 { 64 irq_cascade_t *cascade; 65 66 if (irq >= NR_IRQS) { 67 atomic_inc(&irq_err_count); ··· 71 72 cascade = irq_cascade + irq; 73 if (cascade->get_irq != NULL) { 74 + struct irq_desc *desc = irq_to_desc(irq); 75 + struct irq_data *idata = irq_desc_get_irq_data(desc); 76 + struct irq_chip *chip = irq_desc_get_chip(desc); 77 int ret; 78 + 79 + if (chip->irq_mask_ack) 80 + chip->irq_mask_ack(idata); 81 else { 82 + chip->irq_mask(idata); 83 + chip->irq_ack(idata); 84 } 85 ret = cascade->get_irq(irq); 86 irq = ret; ··· 86 atomic_inc(&irq_err_count); 87 else 88 irq_dispatch(irq); 89 + if (!(desc->status & IRQ_DISABLED) && chip->irq_unmask) 90 + chip->irq_unmask(idata); 91 } else 92 do_IRQ(irq); 93 }