aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/skge.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-03-16 17:01:27 -0400
committerJeff Garzik <jeff@garzik.org>2007-03-23 01:48:33 -0400
commit4ebabfcb1d6af5191ef5c8305717ccbc24979f6c (patch)
treebaa48c3423069032e9ef71c7b028c663d6c98475 /drivers/net/skge.c
parente3a1b99fb60dab1b39d5022d1d8f47bebfe6d8c6 (diff)
skge: mask irqs when device down
Wheen a port on the skge driver is not used, it should mask off interrupts from theat port. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/skge.c')
-rw-r--r--drivers/net/skge.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/drivers/net/skge.c b/drivers/net/skge.c
index fad189e01ec6..6e1eb23d93c4 100644
--- a/drivers/net/skge.c
+++ b/drivers/net/skge.c
@@ -105,7 +105,8 @@ static const int txqaddr[] = { Q_XA1, Q_XA2 };
105static const int rxqaddr[] = { Q_R1, Q_R2 }; 105static const int rxqaddr[] = { Q_R1, Q_R2 };
106static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F }; 106static const u32 rxirqmask[] = { IS_R1_F, IS_R2_F };
107static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F }; 107static const u32 txirqmask[] = { IS_XA1_F, IS_XA2_F };
108static const u32 irqmask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F }; 108static const u32 napimask[] = { IS_R1_F|IS_XA1_F, IS_R2_F|IS_XA2_F };
109static const u32 portmask[] = { IS_PORT_1, IS_PORT_2 };
109 110
110static int skge_get_regs_len(struct net_device *dev) 111static int skge_get_regs_len(struct net_device *dev)
111{ 112{
@@ -2504,6 +2505,11 @@ static int skge_up(struct net_device *dev)
2504 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); 2505 skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F);
2505 skge_led(skge, LED_MODE_ON); 2506 skge_led(skge, LED_MODE_ON);
2506 2507
2508 spin_lock_irq(&hw->hw_lock);
2509 hw->intr_mask |= portmask[port];
2510 skge_write32(hw, B0_IMSK, hw->intr_mask);
2511 spin_unlock_irq(&hw->hw_lock);
2512
2507 netif_poll_enable(dev); 2513 netif_poll_enable(dev);
2508 return 0; 2514 return 0;
2509 2515
@@ -2533,6 +2539,13 @@ static int skge_down(struct net_device *dev)
2533 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC) 2539 if (hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)
2534 cancel_delayed_work(&skge->link_thread); 2540 cancel_delayed_work(&skge->link_thread);
2535 2541
2542 netif_poll_disable(dev);
2543
2544 spin_lock_irq(&hw->hw_lock);
2545 hw->intr_mask &= ~portmask[port];
2546 skge_write32(hw, B0_IMSK, hw->intr_mask);
2547 spin_unlock_irq(&hw->hw_lock);
2548
2536 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF); 2549 skge_write8(skge->hw, SK_REG(skge->port, LNK_LED_REG), LED_OFF);
2537 if (hw->chip_id == CHIP_ID_GENESIS) 2550 if (hw->chip_id == CHIP_ID_GENESIS)
2538 genesis_stop(skge); 2551 genesis_stop(skge);
@@ -2575,8 +2588,6 @@ static int skge_down(struct net_device *dev)
2575 2588
2576 skge_led(skge, LED_MODE_OFF); 2589 skge_led(skge, LED_MODE_OFF);
2577 2590
2578 netif_poll_disable(dev);
2579
2580 netif_tx_lock_bh(dev); 2591 netif_tx_lock_bh(dev);
2581 skge_tx_clean(dev); 2592 skge_tx_clean(dev);
2582 netif_tx_unlock_bh(dev); 2593 netif_tx_unlock_bh(dev);
@@ -3051,7 +3062,7 @@ static int skge_poll(struct net_device *dev, int *budget)
3051 3062
3052 spin_lock_irqsave(&hw->hw_lock, flags); 3063 spin_lock_irqsave(&hw->hw_lock, flags);
3053 __netif_rx_complete(dev); 3064 __netif_rx_complete(dev);
3054 hw->intr_mask |= irqmask[skge->port]; 3065 hw->intr_mask |= napimask[skge->port];
3055 skge_write32(hw, B0_IMSK, hw->intr_mask); 3066 skge_write32(hw, B0_IMSK, hw->intr_mask);
3056 skge_read32(hw, B0_IMSK); 3067 skge_read32(hw, B0_IMSK);
3057 spin_unlock_irqrestore(&hw->hw_lock, flags); 3068 spin_unlock_irqrestore(&hw->hw_lock, flags);
@@ -3415,10 +3426,9 @@ static int skge_reset(struct skge_hw *hw)
3415 else 3426 else
3416 hw->ram_size = t8 * 4096; 3427 hw->ram_size = t8 * 4096;
3417 3428
3418 hw->intr_mask = IS_HW_ERR | IS_PORT_1; 3429 hw->intr_mask = IS_HW_ERR;
3419 if (hw->ports > 1)
3420 hw->intr_mask |= IS_PORT_2;
3421 3430
3431 /* Use PHY IRQ for all but fiber based Genesis board */
3422 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC)) 3432 if (!(hw->chip_id == CHIP_ID_GENESIS && hw->phy_type == SK_PHY_XMAC))
3423 hw->intr_mask |= IS_EXT_REG; 3433 hw->intr_mask |= IS_EXT_REG;
3424 3434