diff options
Diffstat (limited to 'drivers/net/sky2.c')
-rw-r--r-- | drivers/net/sky2.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/drivers/net/sky2.c b/drivers/net/sky2.c index 16616f5440d0..842abd9396c6 100644 --- a/drivers/net/sky2.c +++ b/drivers/net/sky2.c | |||
@@ -104,6 +104,7 @@ static const struct pci_device_id sky2_id_table[] = { | |||
104 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, | 104 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, |
105 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, /* DGE-560T */ | 105 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4b00) }, /* DGE-560T */ |
106 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) }, /* DGE-550SX */ | 106 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4001) }, /* DGE-550SX */ |
107 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, 0x4B02) }, /* DGE-560SX */ | ||
107 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, | 108 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4340) }, |
108 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, | 109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4341) }, |
109 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, | 110 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4342) }, |
@@ -676,17 +677,15 @@ static void sky2_mac_init(struct sky2_hw *hw, unsigned port) | |||
676 | /* Flush Rx MAC FIFO on any flow control or error */ | 677 | /* Flush Rx MAC FIFO on any flow control or error */ |
677 | sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); | 678 | sky2_write16(hw, SK_REG(port, RX_GMF_FL_MSK), GMR_FS_ANY_ERR); |
678 | 679 | ||
679 | /* Set threshold to 0xa (64 bytes) | 680 | /* Set threshold to 0xa (64 bytes) + 1 to workaround pause bug */ |
680 | * ASF disabled so no need to do WA dev #4.30 | 681 | sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF+1); |
681 | */ | ||
682 | sky2_write16(hw, SK_REG(port, RX_GMF_FL_THR), RX_GMF_FL_THR_DEF); | ||
683 | 682 | ||
684 | /* Configure Tx MAC FIFO */ | 683 | /* Configure Tx MAC FIFO */ |
685 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR); | 684 | sky2_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_CLR); |
686 | sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); | 685 | sky2_write16(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_OPER_ON); |
687 | 686 | ||
688 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { | 687 | if (hw->chip_id == CHIP_ID_YUKON_EC_U) { |
689 | sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 512/8); | 688 | sky2_write8(hw, SK_REG(port, RX_GMF_LP_THR), 768/8); |
690 | sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); | 689 | sky2_write8(hw, SK_REG(port, RX_GMF_UP_THR), 1024/8); |
691 | if (hw->dev[port]->mtu > ETH_DATA_LEN) { | 690 | if (hw->dev[port]->mtu > ETH_DATA_LEN) { |
692 | /* set Tx GMAC FIFO Almost Empty Threshold */ | 691 | /* set Tx GMAC FIFO Almost Empty Threshold */ |
@@ -1060,7 +1059,8 @@ static int sky2_rx_start(struct sky2_port *sky2) | |||
1060 | sky2->rx_put = sky2->rx_next = 0; | 1059 | sky2->rx_put = sky2->rx_next = 0; |
1061 | sky2_qset(hw, rxq); | 1060 | sky2_qset(hw, rxq); |
1062 | 1061 | ||
1063 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && hw->chip_rev >= 2) { | 1062 | if (hw->chip_id == CHIP_ID_YUKON_EC_U && |
1063 | (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0)) { | ||
1064 | /* MAC Rx RAM Read is controlled by hardware */ | 1064 | /* MAC Rx RAM Read is controlled by hardware */ |
1065 | sky2_write32(hw, Q_ADDR(rxq, Q_F), F_M_RX_RAM_DIS); | 1065 | sky2_write32(hw, Q_ADDR(rxq, Q_F), F_M_RX_RAM_DIS); |
1066 | } | 1066 | } |
@@ -1350,7 +1350,7 @@ static int sky2_xmit_frame(struct sk_buff *skb, struct net_device *dev) | |||
1350 | u32 tcpsum; | 1350 | u32 tcpsum; |
1351 | 1351 | ||
1352 | tcpsum = offset << 16; /* sum start */ | 1352 | tcpsum = offset << 16; /* sum start */ |
1353 | tcpsum |= offset + skb->csum; /* sum write */ | 1353 | tcpsum |= offset + skb->csum_offset; /* sum write */ |
1354 | 1354 | ||
1355 | ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; | 1355 | ctrl = CALSUM | WR_SUM | INIT_SUM | LOCK_SUM; |
1356 | if (skb->nh.iph->protocol == IPPROTO_UDP) | 1356 | if (skb->nh.iph->protocol == IPPROTO_UDP) |
@@ -1453,7 +1453,7 @@ static void sky2_tx_complete(struct sky2_port *sky2, u16 done) | |||
1453 | if (unlikely(netif_msg_tx_done(sky2))) | 1453 | if (unlikely(netif_msg_tx_done(sky2))) |
1454 | printk(KERN_DEBUG "%s: tx done %u\n", | 1454 | printk(KERN_DEBUG "%s: tx done %u\n", |
1455 | dev->name, idx); | 1455 | dev->name, idx); |
1456 | dev_kfree_skb(re->skb); | 1456 | dev_kfree_skb_any(re->skb); |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | le->opcode = 0; /* paranoia */ | 1459 | le->opcode = 0; /* paranoia */ |
@@ -1509,7 +1509,7 @@ static int sky2_down(struct net_device *dev) | |||
1509 | 1509 | ||
1510 | /* WA for dev. #4.209 */ | 1510 | /* WA for dev. #4.209 */ |
1511 | if (hw->chip_id == CHIP_ID_YUKON_EC_U | 1511 | if (hw->chip_id == CHIP_ID_YUKON_EC_U |
1512 | && hw->chip_rev == CHIP_REV_YU_EC_U_A1) | 1512 | && (hw->chip_rev == CHIP_REV_YU_EC_U_A1 || hw->chip_rev == CHIP_REV_YU_EC_U_B0)) |
1513 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), | 1513 | sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T), |
1514 | sky2->speed != SPEED_1000 ? | 1514 | sky2->speed != SPEED_1000 ? |
1515 | TX_STFW_ENA : TX_STFW_DIS); | 1515 | TX_STFW_ENA : TX_STFW_DIS); |
@@ -2065,7 +2065,7 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) | |||
2065 | case OP_RXSTAT: | 2065 | case OP_RXSTAT: |
2066 | skb = sky2_receive(dev, length, status); | 2066 | skb = sky2_receive(dev, length, status); |
2067 | if (!skb) | 2067 | if (!skb) |
2068 | break; | 2068 | goto force_update; |
2069 | 2069 | ||
2070 | skb->protocol = eth_type_trans(skb, dev); | 2070 | skb->protocol = eth_type_trans(skb, dev); |
2071 | dev->last_rx = jiffies; | 2071 | dev->last_rx = jiffies; |
@@ -2081,8 +2081,8 @@ static int sky2_status_intr(struct sky2_hw *hw, int to_do) | |||
2081 | 2081 | ||
2082 | /* Update receiver after 16 frames */ | 2082 | /* Update receiver after 16 frames */ |
2083 | if (++buf_write[le->link] == RX_BUF_WRITE) { | 2083 | if (++buf_write[le->link] == RX_BUF_WRITE) { |
2084 | sky2_put_idx(hw, rxqaddr[le->link], | 2084 | force_update: |
2085 | sky2->rx_put); | 2085 | sky2_put_idx(hw, rxqaddr[le->link], sky2->rx_put); |
2086 | buf_write[le->link] = 0; | 2086 | buf_write[le->link] = 0; |
2087 | } | 2087 | } |
2088 | 2088 | ||
@@ -3311,7 +3311,7 @@ static irqreturn_t __devinit sky2_test_intr(int irq, void *dev_id) | |||
3311 | return IRQ_NONE; | 3311 | return IRQ_NONE; |
3312 | 3312 | ||
3313 | if (status & Y2_IS_IRQ_SW) { | 3313 | if (status & Y2_IS_IRQ_SW) { |
3314 | hw->msi_detected = 1; | 3314 | hw->msi = 1; |
3315 | wake_up(&hw->msi_wait); | 3315 | wake_up(&hw->msi_wait); |
3316 | sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ); | 3316 | sky2_write8(hw, B0_CTST, CS_CL_SW_IRQ); |
3317 | } | 3317 | } |
@@ -3330,7 +3330,7 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) | |||
3330 | 3330 | ||
3331 | sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW); | 3331 | sky2_write32(hw, B0_IMSK, Y2_IS_IRQ_SW); |
3332 | 3332 | ||
3333 | err = request_irq(pdev->irq, sky2_test_intr, IRQF_SHARED, DRV_NAME, hw); | 3333 | err = request_irq(pdev->irq, sky2_test_intr, 0, DRV_NAME, hw); |
3334 | if (err) { | 3334 | if (err) { |
3335 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", | 3335 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", |
3336 | pci_name(pdev), pdev->irq); | 3336 | pci_name(pdev), pdev->irq); |
@@ -3340,9 +3340,9 @@ static int __devinit sky2_test_msi(struct sky2_hw *hw) | |||
3340 | sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ); | 3340 | sky2_write8(hw, B0_CTST, CS_ST_SW_IRQ); |
3341 | sky2_read8(hw, B0_CTST); | 3341 | sky2_read8(hw, B0_CTST); |
3342 | 3342 | ||
3343 | wait_event_timeout(hw->msi_wait, hw->msi_detected, HZ/10); | 3343 | wait_event_timeout(hw->msi_wait, hw->msi, HZ/10); |
3344 | 3344 | ||
3345 | if (!hw->msi_detected) { | 3345 | if (!hw->msi) { |
3346 | /* MSI test failed, go back to INTx mode */ | 3346 | /* MSI test failed, go back to INTx mode */ |
3347 | printk(KERN_INFO PFX "%s: No interrupt generated using MSI, " | 3347 | printk(KERN_INFO PFX "%s: No interrupt generated using MSI, " |
3348 | "switching to INTx mode.\n", | 3348 | "switching to INTx mode.\n", |
@@ -3475,7 +3475,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3475 | goto err_out_free_netdev; | 3475 | goto err_out_free_netdev; |
3476 | } | 3476 | } |
3477 | 3477 | ||
3478 | err = request_irq(pdev->irq, sky2_intr, IRQF_SHARED, dev->name, hw); | 3478 | err = request_irq(pdev->irq, sky2_intr, hw->msi ? 0 : IRQF_SHARED, |
3479 | dev->name, hw); | ||
3479 | if (err) { | 3480 | if (err) { |
3480 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", | 3481 | printk(KERN_ERR PFX "%s: cannot assign irq %d\n", |
3481 | pci_name(pdev), pdev->irq); | 3482 | pci_name(pdev), pdev->irq); |
@@ -3505,7 +3506,8 @@ static int __devinit sky2_probe(struct pci_dev *pdev, | |||
3505 | return 0; | 3506 | return 0; |
3506 | 3507 | ||
3507 | err_out_unregister: | 3508 | err_out_unregister: |
3508 | pci_disable_msi(pdev); | 3509 | if (hw->msi) |
3510 | pci_disable_msi(pdev); | ||
3509 | unregister_netdev(dev); | 3511 | unregister_netdev(dev); |
3510 | err_out_free_netdev: | 3512 | err_out_free_netdev: |
3511 | free_netdev(dev); | 3513 | free_netdev(dev); |
@@ -3548,7 +3550,8 @@ static void __devexit sky2_remove(struct pci_dev *pdev) | |||
3548 | sky2_read8(hw, B0_CTST); | 3550 | sky2_read8(hw, B0_CTST); |
3549 | 3551 | ||
3550 | free_irq(pdev->irq, hw); | 3552 | free_irq(pdev->irq, hw); |
3551 | pci_disable_msi(pdev); | 3553 | if (hw->msi) |
3554 | pci_disable_msi(pdev); | ||
3552 | pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); | 3555 | pci_free_consistent(pdev, STATUS_LE_BYTES, hw->st_le, hw->st_dma); |
3553 | pci_release_regions(pdev); | 3556 | pci_release_regions(pdev); |
3554 | pci_disable_device(pdev); | 3557 | pci_disable_device(pdev); |