aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/mach-common/ints-priority.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/blackfin/mach-common/ints-priority.c')
-rw-r--r--arch/blackfin/mach-common/ints-priority.c56
1 files changed, 14 insertions, 42 deletions
diff --git a/arch/blackfin/mach-common/ints-priority.c b/arch/blackfin/mach-common/ints-priority.c
index 225ef14af75e..f5fd768022ea 100644
--- a/arch/blackfin/mach-common/ints-priority.c
+++ b/arch/blackfin/mach-common/ints-priority.c
@@ -316,7 +316,7 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
316 printk(KERN_ERR 316 printk(KERN_ERR
317 "%s : %s : LINE %d :\nIRQ ?: PERIPHERAL ERROR" 317 "%s : %s : LINE %d :\nIRQ ?: PERIPHERAL ERROR"
318 " INTERRUPT ASSERTED BUT NO SOURCE FOUND\n", 318 " INTERRUPT ASSERTED BUT NO SOURCE FOUND\n",
319 __FUNCTION__, __FILE__, __LINE__); 319 __func__, __FILE__, __LINE__);
320 320
321} 321}
322#endif /* BF537_GENERIC_ERROR_INT_DEMUX */ 322#endif /* BF537_GENERIC_ERROR_INT_DEMUX */
@@ -326,6 +326,7 @@ static void bfin_demux_error_irq(unsigned int int_err_irq,
326static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)]; 326static unsigned short gpio_enabled[gpio_bank(MAX_BLACKFIN_GPIOS)];
327static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)]; 327static unsigned short gpio_edge_triggered[gpio_bank(MAX_BLACKFIN_GPIOS)];
328 328
329extern void bfin_gpio_irq_prepare(unsigned gpio);
329 330
330static void bfin_gpio_ack_irq(unsigned int irq) 331static void bfin_gpio_ack_irq(unsigned int irq)
331{ 332{
@@ -364,35 +365,25 @@ static void bfin_gpio_unmask_irq(unsigned int irq)
364 365
365static unsigned int bfin_gpio_irq_startup(unsigned int irq) 366static unsigned int bfin_gpio_irq_startup(unsigned int irq)
366{ 367{
367 unsigned int ret;
368 u16 gpionr = irq - IRQ_PF0; 368 u16 gpionr = irq - IRQ_PF0;
369 char buf[8];
370 369
371 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 370 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr)))
372 snprintf(buf, sizeof buf, "IRQ %d", irq); 371 bfin_gpio_irq_prepare(gpionr);
373 ret = gpio_request(gpionr, buf);
374 if (ret)
375 return ret;
376 }
377 372
378 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr); 373 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
379 bfin_gpio_unmask_irq(irq); 374 bfin_gpio_unmask_irq(irq);
380 375
381 return ret; 376 return 0;
382} 377}
383 378
384static void bfin_gpio_irq_shutdown(unsigned int irq) 379static void bfin_gpio_irq_shutdown(unsigned int irq)
385{ 380{
386 bfin_gpio_mask_irq(irq); 381 bfin_gpio_mask_irq(irq);
387 gpio_free(irq - IRQ_PF0);
388 gpio_enabled[gpio_bank(irq - IRQ_PF0)] &= ~gpio_bit(irq - IRQ_PF0); 382 gpio_enabled[gpio_bank(irq - IRQ_PF0)] &= ~gpio_bit(irq - IRQ_PF0);
389} 383}
390 384
391static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) 385static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
392{ 386{
393
394 unsigned int ret;
395 char buf[8];
396 u16 gpionr = irq - IRQ_PF0; 387 u16 gpionr = irq - IRQ_PF0;
397 388
398 if (type == IRQ_TYPE_PROBE) { 389 if (type == IRQ_TYPE_PROBE) {
@@ -404,12 +395,8 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
404 395
405 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | 396 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
406 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 397 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
407 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 398 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr)))
408 snprintf(buf, sizeof buf, "IRQ %d", irq); 399 bfin_gpio_irq_prepare(gpionr);
409 ret = gpio_request(gpionr, buf);
410 if (ret)
411 return ret;
412 }
413 400
414 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr); 401 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
415 } else { 402 } else {
@@ -595,6 +582,8 @@ static struct pin_int_t *pint[NR_PINT_SYS_IRQS] = {
595 (struct pin_int_t *)PINT3_MASK_SET, 582 (struct pin_int_t *)PINT3_MASK_SET,
596}; 583};
597 584
585extern void bfin_gpio_irq_prepare(unsigned gpio);
586
598inline unsigned short get_irq_base(u8 bank, u8 bmap) 587inline unsigned short get_irq_base(u8 bank, u8 bmap)
599{ 588{
600 589
@@ -697,8 +686,6 @@ static void bfin_gpio_unmask_irq(unsigned int irq)
697 686
698static unsigned int bfin_gpio_irq_startup(unsigned int irq) 687static unsigned int bfin_gpio_irq_startup(unsigned int irq)
699{ 688{
700 unsigned int ret;
701 char buf[8];
702 u16 gpionr = irq_to_gpio(irq); 689 u16 gpionr = irq_to_gpio(irq);
703 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 690 u8 pint_val = irq2pint_lut[irq - SYS_IRQS];
704 691
@@ -709,17 +696,13 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
709 return -ENODEV; 696 return -ENODEV;
710 } 697 }
711 698
712 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 699 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr)))
713 snprintf(buf, sizeof buf, "IRQ %d", irq); 700 bfin_gpio_irq_prepare(gpionr);
714 ret = gpio_request(gpionr, buf);
715 if (ret)
716 return ret;
717 }
718 701
719 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr); 702 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
720 bfin_gpio_unmask_irq(irq); 703 bfin_gpio_unmask_irq(irq);
721 704
722 return ret; 705 return 0;
723} 706}
724 707
725static void bfin_gpio_irq_shutdown(unsigned int irq) 708static void bfin_gpio_irq_shutdown(unsigned int irq)
@@ -727,15 +710,12 @@ static void bfin_gpio_irq_shutdown(unsigned int irq)
727 u16 gpionr = irq_to_gpio(irq); 710 u16 gpionr = irq_to_gpio(irq);
728 711
729 bfin_gpio_mask_irq(irq); 712 bfin_gpio_mask_irq(irq);
730 gpio_free(gpionr);
731 gpio_enabled[gpio_bank(gpionr)] &= ~gpio_bit(gpionr); 713 gpio_enabled[gpio_bank(gpionr)] &= ~gpio_bit(gpionr);
732} 714}
733 715
734static int bfin_gpio_irq_type(unsigned int irq, unsigned int type) 716static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
735{ 717{
736 718
737 unsigned int ret;
738 char buf[8];
739 u16 gpionr = irq_to_gpio(irq); 719 u16 gpionr = irq_to_gpio(irq);
740 u8 pint_val = irq2pint_lut[irq - SYS_IRQS]; 720 u8 pint_val = irq2pint_lut[irq - SYS_IRQS];
741 u32 pintbit = PINT_BIT(pint_val); 721 u32 pintbit = PINT_BIT(pint_val);
@@ -753,12 +733,8 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
753 733
754 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING | 734 if (type & (IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING |
755 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) { 735 IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW)) {
756 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) { 736 if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr)))
757 snprintf(buf, sizeof buf, "IRQ %d", irq); 737 bfin_gpio_irq_prepare(gpionr);
758 ret = gpio_request(gpionr, buf);
759 if (ret)
760 return ret;
761 }
762 738
763 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr); 739 gpio_enabled[gpio_bank(gpionr)] |= gpio_bit(gpionr);
764 } else { 740 } else {
@@ -766,8 +742,6 @@ static int bfin_gpio_irq_type(unsigned int irq, unsigned int type)
766 return 0; 742 return 0;
767 } 743 }
768 744
769 gpio_direction_input(gpionr);
770
771 if ((type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW))) 745 if ((type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_LEVEL_LOW)))
772 pint[bank]->invert_set = pintbit; /* low or falling edge denoted by one */ 746 pint[bank]->invert_set = pintbit; /* low or falling edge denoted by one */
773 else 747 else
@@ -965,8 +939,6 @@ int __init init_arch_irq(void)
965 939
966 local_irq_disable(); 940 local_irq_disable();
967 941
968 init_exception_buff();
969
970#ifdef CONFIG_BF54x 942#ifdef CONFIG_BF54x
971# ifdef CONFIG_PINTx_REASSIGN 943# ifdef CONFIG_PINTx_REASSIGN
972 pint[0]->assign = CONFIG_PINT0_ASSIGN; 944 pint[0]->assign = CONFIG_PINT0_ASSIGN;