aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pasemi_mac.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-05-08 01:47:21 -0400
committerJeff Garzik <jeff@garzik.org>2007-05-08 01:47:53 -0400
commit771f7404a9deca902594823d616cd7a84f827982 (patch)
tree438332343f0737316277e278de663d40ddedb940 /drivers/net/pasemi_mac.c
parent418aea75246d5f83caa3a003fd66fe3b1aa01738 (diff)
pasemi_mac: Move the IRQ mapping from the PCI layer to the driver
Fixes for ethernet IRQ mapping, to be done in the driver instead of in the platform setup code. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/pasemi_mac.c')
-rw-r--r--drivers/net/pasemi_mac.c30
1 files changed, 21 insertions, 9 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index bde833542b6f..c7995d77ccfc 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -33,6 +33,8 @@
33#include <linux/tcp.h> 33#include <linux/tcp.h>
34#include <net/checksum.h> 34#include <net/checksum.h>
35 35
36#include <asm/irq.h>
37
36#include "pasemi_mac.h" 38#include "pasemi_mac.h"
37 39
38 40
@@ -531,6 +533,7 @@ static irqreturn_t pasemi_mac_tx_intr(int irq, void *data)
531static int pasemi_mac_open(struct net_device *dev) 533static int pasemi_mac_open(struct net_device *dev)
532{ 534{
533 struct pasemi_mac *mac = netdev_priv(dev); 535 struct pasemi_mac *mac = netdev_priv(dev);
536 int base_irq;
534 unsigned int flags; 537 unsigned int flags;
535 int ret; 538 int ret;
536 539
@@ -594,28 +597,37 @@ static int pasemi_mac_open(struct net_device *dev)
594 netif_start_queue(dev); 597 netif_start_queue(dev);
595 netif_poll_enable(dev); 598 netif_poll_enable(dev);
596 599
597 ret = request_irq(mac->dma_pdev->irq + mac->dma_txch, 600 /* Interrupts are a bit different for our DMA controller: While
598 &pasemi_mac_tx_intr, IRQF_DISABLED, 601 * it's got one a regular PCI device header, the interrupt there
602 * is really the base of the range it's using. Each tx and rx
603 * channel has it's own interrupt source.
604 */
605
606 base_irq = virq_to_hw(mac->dma_pdev->irq);
607
608 mac->tx_irq = irq_create_mapping(NULL, base_irq + mac->dma_txch);
609 mac->rx_irq = irq_create_mapping(NULL, base_irq + 20 + mac->dma_txch);
610
611 ret = request_irq(mac->tx_irq, &pasemi_mac_tx_intr, IRQF_DISABLED,
599 mac->tx->irq_name, dev); 612 mac->tx->irq_name, dev);
600 if (ret) { 613 if (ret) {
601 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", 614 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n",
602 mac->dma_pdev->irq + mac->dma_txch, ret); 615 base_irq + mac->dma_txch, ret);
603 goto out_tx_int; 616 goto out_tx_int;
604 } 617 }
605 618
606 ret = request_irq(mac->dma_pdev->irq + 20 + mac->dma_rxch, 619 ret = request_irq(mac->rx_irq, &pasemi_mac_rx_intr, IRQF_DISABLED,
607 &pasemi_mac_rx_intr, IRQF_DISABLED,
608 mac->rx->irq_name, dev); 620 mac->rx->irq_name, dev);
609 if (ret) { 621 if (ret) {
610 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", 622 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n",
611 mac->dma_pdev->irq + 20 + mac->dma_rxch, ret); 623 base_irq + 20 + mac->dma_rxch, ret);
612 goto out_rx_int; 624 goto out_rx_int;
613 } 625 }
614 626
615 return 0; 627 return 0;
616 628
617out_rx_int: 629out_rx_int:
618 free_irq(mac->dma_pdev->irq + mac->dma_txch, dev); 630 free_irq(mac->tx_irq, dev);
619out_tx_int: 631out_tx_int:
620 netif_poll_disable(dev); 632 netif_poll_disable(dev);
621 netif_stop_queue(dev); 633 netif_stop_queue(dev);
@@ -699,8 +711,8 @@ static int pasemi_mac_close(struct net_device *dev)
699 pci_write_config_dword(mac->dma_pdev, 711 pci_write_config_dword(mac->dma_pdev,
700 PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0); 712 PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0);
701 713
702 free_irq(mac->dma_pdev->irq + mac->dma_txch, dev); 714 free_irq(mac->tx_irq, dev);
703 free_irq(mac->dma_pdev->irq + 20 + mac->dma_rxch, dev); 715 free_irq(mac->rx_irq, dev);
704 716
705 /* Free resources */ 717 /* Free resources */
706 pasemi_mac_free_rx_resources(dev); 718 pasemi_mac_free_rx_resources(dev);