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

Blackfin: bf537: fix excessive gpio int demuxing

The search logic in the gpio demux walks all possible gpio blocks starting
at the specified pin. The trouble on bf537 parts when we demux the port
F and port G mask A interrupts is that we also demux port H mask A ints.
Most of the time this isn't an issue as people don't usually use port H,
but might as well avoid it when possible.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>

+25 -30
+25 -30
arch/blackfin/mach-common/ints-priority.c
··· 567 567 # define bfin_gpio_set_wake NULL 568 568 #endif 569 569 570 + static void bfin_demux_gpio_block(unsigned int irq) 571 + { 572 + unsigned int gpio, mask; 573 + 574 + gpio = irq_to_gpio(irq); 575 + mask = get_gpiop_data(gpio) & get_gpiop_maska(gpio); 576 + 577 + while (mask) { 578 + if (mask & 1) 579 + bfin_handle_irq(irq); 580 + irq++; 581 + mask >>= 1; 582 + } 583 + } 584 + 570 585 static void bfin_demux_gpio_irq(unsigned int inta_irq, 571 586 struct irq_desc *desc) 572 587 { 573 - unsigned int i, gpio, mask, irq, search = 0; 588 + unsigned int irq; 574 589 575 590 switch (inta_irq) { 576 - #if defined(CONFIG_BF53x) 591 + #if defined(BF537_FAMILY) 577 592 case IRQ_PROG_INTA: 578 - irq = IRQ_PF0; 579 - search = 1; 593 + bfin_demux_gpio_block(IRQ_PF0); 594 + irq = IRQ_PG0; 580 595 break; 581 - # if defined(BF537_FAMILY) && !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) 596 + # if !(defined(CONFIG_BFIN_MAC) || defined(CONFIG_BFIN_MAC_MODULE)) 582 597 case IRQ_MAC_RX: 583 598 irq = IRQ_PH0; 584 599 break; 585 600 # endif 601 + #elif defined(BF533_FAMILY) 602 + case IRQ_PROG_INTA: 603 + irq = IRQ_PF0; 604 + break; 586 605 #elif defined(BF538_FAMILY) 587 606 case IRQ_PORTF_INTA: 588 607 irq = IRQ_PF0; ··· 632 613 return; 633 614 } 634 615 635 - if (search) { 636 - for (i = 0; i < MAX_BLACKFIN_GPIOS; i += GPIO_BANKSIZE) { 637 - irq += i; 638 - 639 - mask = get_gpiop_data(i) & get_gpiop_maska(i); 640 - 641 - while (mask) { 642 - if (mask & 1) 643 - bfin_handle_irq(irq); 644 - irq++; 645 - mask >>= 1; 646 - } 647 - } 648 - } else { 649 - gpio = irq_to_gpio(irq); 650 - mask = get_gpiop_data(gpio) & get_gpiop_maska(gpio); 651 - 652 - do { 653 - if (mask & 1) 654 - bfin_handle_irq(irq); 655 - irq++; 656 - mask >>= 1; 657 - } while (mask); 658 - } 659 - 616 + bfin_demux_gpio_block(irq); 660 617 } 661 618 662 619 #else /* CONFIG_BF54x */