Lines Matching full:vp
584 /* Chip features we care about in vp->capabilities, read from the EEPROM. */
660 static void window_set(struct vortex_private *vp, int window) in window_set() argument
662 if (window != vp->window) { in window_set()
663 iowrite16(SelectWindow + window, vp->ioaddr + EL3_CMD); in window_set()
664 vp->window = window; in window_set()
670 window_read ## size(struct vortex_private *vp, int window, int addr) \
674 spin_lock_irqsave(&vp->window_lock, flags); \
675 window_set(vp, window); \
676 ret = ioread ## size(vp->ioaddr + addr); \
677 spin_unlock_irqrestore(&vp->window_lock, flags); \
681 window_write ## size(struct vortex_private *vp, u ## size value, \
685 spin_lock_irqsave(&vp->window_lock, flags); \
686 window_set(vp, window); \
687 iowrite ## size(value, vp->ioaddr + addr); \
688 spin_unlock_irqrestore(&vp->window_lock, flags); \
700 #define VORTEX_PCI(vp) \ argument
701 ((struct pci_dev *) (((vp)->gendev) ? DEVICE_PCI((vp)->gendev) : NULL))
709 #define VORTEX_EISA(vp) \ argument
710 ((struct eisa_device *) (((vp)->gendev) ? DEVICE_EISA((vp)->gendev) : NULL))
758 static void mdio_sync(struct vortex_private *vp, int bits);
760 static void mdio_write(struct net_device *vp, int phy_id, int location, int value);
930 struct vortex_private *vp; in vortex_eisa_remove() local
941 vp = netdev_priv(dev); in vortex_eisa_remove()
942 ioaddr = vp->ioaddr; in vortex_eisa_remove()
1091 struct vortex_private *vp; in vortex_probe1() local
1119 dev = alloc_etherdev(sizeof(*vp)); in vortex_probe1()
1125 vp = netdev_priv(dev); in vortex_probe1()
1148 vp->enable_wol = 1; in vortex_probe1()
1164 vp->ioaddr = ioaddr; in vortex_probe1()
1165 vp->large_frames = mtu > 1500; in vortex_probe1()
1166 vp->drv_flags = vci->drv_flags; in vortex_probe1()
1167 vp->has_nway = (vci->drv_flags & HAS_NWAY) ? 1 : 0; in vortex_probe1()
1168 vp->io_size = vci->io_size; in vortex_probe1()
1169 vp->card_idx = card_idx; in vortex_probe1()
1170 vp->window = -1; in vortex_probe1()
1200 spin_lock_init(&vp->lock); in vortex_probe1()
1201 spin_lock_init(&vp->mii_lock); in vortex_probe1()
1202 spin_lock_init(&vp->window_lock); in vortex_probe1()
1203 vp->gendev = gendev; in vortex_probe1()
1204 vp->mii.dev = dev; in vortex_probe1()
1205 vp->mii.mdio_read = mdio_read; in vortex_probe1()
1206 vp->mii.mdio_write = mdio_write; in vortex_probe1()
1207 vp->mii.phy_id_mask = 0x1f; in vortex_probe1()
1208 vp->mii.reg_num_mask = 0x1f; in vortex_probe1()
1211 vp->rx_ring = dma_alloc_coherent(gendev, sizeof(struct boom_rx_desc) * RX_RING_SIZE in vortex_probe1()
1213 &vp->rx_ring_dma, GFP_KERNEL); in vortex_probe1()
1215 if (!vp->rx_ring) in vortex_probe1()
1218 vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE); in vortex_probe1()
1219 vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE; in vortex_probe1()
1228 vp->media_override = 7; in vortex_probe1()
1230 vp->media_override = ((option & 7) == 2) ? 0 : option & 15; in vortex_probe1()
1231 if (vp->media_override != 7) in vortex_probe1()
1232 vp->medialock = 1; in vortex_probe1()
1233 vp->full_duplex = (option & 0x200) ? 1 : 0; in vortex_probe1()
1234 vp->bus_master = (option & 16) ? 1 : 0; in vortex_probe1()
1238 vp->full_duplex = 1; in vortex_probe1()
1240 vp->enable_wol = 1; in vortex_probe1()
1244 vp->full_duplex = 1; in vortex_probe1()
1246 vp->flow_ctrl = 1; in vortex_probe1()
1248 vp->enable_wol = 1; in vortex_probe1()
1251 vp->mii.force_media = vp->full_duplex; in vortex_probe1()
1252 vp->options = option; in vortex_probe1()
1266 window_write16(vp, base + i, 0, Wn0EepromCmd); in vortex_probe1()
1270 if ((window_read16(vp, 0, Wn0EepromCmd) & in vortex_probe1()
1274 eeprom[i] = window_read16(vp, 0, Wn0EepromData); in vortex_probe1()
1300 window_write8(vp, dev->dev_addr[i], 2, i); in vortex_probe1()
1309 step = (window_read8(vp, 4, Wn4_NetDiag) & 0x1e) >> 1; in vortex_probe1()
1320 vp->cb_fn_base = pci_iomap(pdev, 2, 0); in vortex_probe1()
1321 if (!vp->cb_fn_base) { in vortex_probe1()
1330 vp->cb_fn_base); in vortex_probe1()
1333 n = window_read16(vp, 2, Wn2_ResetOptions) & ~0x4010; in vortex_probe1()
1334 if (vp->drv_flags & INVERT_LED_PWR) in vortex_probe1()
1336 if (vp->drv_flags & INVERT_MII_PWR) in vortex_probe1()
1338 window_write16(vp, n, 2, Wn2_ResetOptions); in vortex_probe1()
1339 if (vp->drv_flags & WNO_XCVR_PWR) { in vortex_probe1()
1340 window_write16(vp, 0x0800, 0, 0); in vortex_probe1()
1345 vp->info1 = eeprom[13]; in vortex_probe1()
1346 vp->info2 = eeprom[15]; in vortex_probe1()
1347 vp->capabilities = eeprom[16]; in vortex_probe1()
1349 if (vp->info1 & 0x8000) { in vortex_probe1()
1350 vp->full_duplex = 1; in vortex_probe1()
1358 vp->available_media = window_read16(vp, 3, Wn3_Options); in vortex_probe1()
1359 if ((vp->available_media & 0xff) == 0) /* Broken 3c916 */ in vortex_probe1()
1360 vp->available_media = 0x40; in vortex_probe1()
1361 config = window_read32(vp, 3, Wn3_Config); in vortex_probe1()
1364 config, window_read16(vp, 3, Wn3_Options)); in vortex_probe1()
1373 vp->default_media = XCVR(config); in vortex_probe1()
1374 if (vp->default_media == XCVR_NWAY) in vortex_probe1()
1375 vp->has_nway = 1; in vortex_probe1()
1376 vp->autoselect = AUTOSELECT(config); in vortex_probe1()
1379 if (vp->media_override != 7) { in vortex_probe1()
1381 print_name, vp->media_override, in vortex_probe1()
1382 media_tbl[vp->media_override].name); in vortex_probe1()
1383 dev->if_port = vp->media_override; in vortex_probe1()
1385 dev->if_port = vp->default_media; in vortex_probe1()
1387 if ((vp->available_media & 0x40) || (vci->drv_flags & HAS_NWAY) || in vortex_probe1()
1391 if (vp->drv_flags & EXTRA_PREAMBLE) in vortex_probe1()
1393 mdio_sync(vp, 32); in vortex_probe1()
1410 vp->phys[phy_idx++] = phyx; in vortex_probe1()
1422 vp->phys[0] = 24; in vortex_probe1()
1424 vp->advertising = mdio_read(dev, vp->phys[0], MII_ADVERTISE); in vortex_probe1()
1425 if (vp->full_duplex) { in vortex_probe1()
1427 vp->advertising &= ~0x02A0; in vortex_probe1()
1428 mdio_write(dev, vp->phys[0], 4, vp->advertising); in vortex_probe1()
1431 vp->mii.phy_id = vp->phys[0]; in vortex_probe1()
1434 if (vp->capabilities & CapBusMaster) { in vortex_probe1()
1435 vp->full_bus_master_tx = 1; in vortex_probe1()
1438 (vp->info2 & 1) ? "early" : "whole-frame" ); in vortex_probe1()
1440 vp->full_bus_master_rx = (vp->info2 & 1) ? 1 : 2; in vortex_probe1()
1441 vp->bus_master = 0; /* AKPM: vortex only */ in vortex_probe1()
1445 if (vp->full_bus_master_tx) { in vortex_probe1()
1449 ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) || in vortex_probe1()
1467 vp->pm_state_valid = 1; in vortex_probe1()
1479 vp->rx_ring, vp->rx_ring_dma); in vortex_probe1()
1490 struct vortex_private *vp = netdev_priv(dev); in issue_and_wait() local
1491 void __iomem *ioaddr = vp->ioaddr; in issue_and_wait()
1517 struct vortex_private *vp = netdev_priv(dev); in vortex_set_duplex() local
1520 dev->name, (vp->full_duplex) ? "full" : "half"); in vortex_set_duplex()
1523 window_write16(vp, in vortex_set_duplex()
1524 ((vp->info1 & 0x8000) || vp->full_duplex ? 0x20 : 0) | in vortex_set_duplex()
1525 (vp->large_frames ? 0x40 : 0) | in vortex_set_duplex()
1526 ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? in vortex_set_duplex()
1533 struct vortex_private *vp = netdev_priv(dev); in vortex_check_media() local
1539 if (mii_check_media(&vp->mii, ok_to_print, init)) { in vortex_check_media()
1540 vp->full_duplex = vp->mii.full_duplex; in vortex_check_media()
1550 struct vortex_private *vp = netdev_priv(dev); in vortex_up() local
1551 void __iomem *ioaddr = vp->ioaddr; in vortex_up()
1555 if (VORTEX_PCI(vp)) { in vortex_up()
1556 pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */ in vortex_up()
1557 if (vp->pm_state_valid) in vortex_up()
1558 pci_restore_state(VORTEX_PCI(vp)); in vortex_up()
1559 err = pci_enable_device(VORTEX_PCI(vp)); in vortex_up()
1567 config = window_read32(vp, 3, Wn3_Config); in vortex_up()
1569 if (vp->media_override != 7) { in vortex_up()
1571 dev->name, vp->media_override, in vortex_up()
1572 media_tbl[vp->media_override].name); in vortex_up()
1573 dev->if_port = vp->media_override; in vortex_up()
1574 } else if (vp->autoselect) { in vortex_up()
1575 if (vp->has_nway) { in vortex_up()
1583 while (! (vp->available_media & media_tbl[dev->if_port].mask)) in vortex_up()
1590 dev->if_port = vp->default_media; in vortex_up()
1596 timer_setup(&vp->timer, vortex_timer, 0); in vortex_up()
1597 mod_timer(&vp->timer, RUN_AT(media_tbl[dev->if_port].wait)); in vortex_up()
1603 vp->full_duplex = vp->mii.force_media; in vortex_up()
1607 window_write32(vp, config, 3, Wn3_Config); in vortex_up()
1610 mdio_read(dev, vp->phys[0], MII_BMSR); in vortex_up()
1611 mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA); in vortex_up()
1612 vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0); in vortex_up()
1613 vp->mii.full_duplex = vp->full_duplex; in vortex_up()
1631 dev->name, dev->irq, window_read16(vp, 4, Wn4_Media)); in vortex_up()
1636 window_write8(vp, dev->dev_addr[i], 2, i); in vortex_up()
1638 window_write16(vp, 0, 2, i); in vortex_up()
1640 if (vp->cb_fn_base) { in vortex_up()
1641 unsigned short n = window_read16(vp, 2, Wn2_ResetOptions) & ~0x4010; in vortex_up()
1642 if (vp->drv_flags & INVERT_LED_PWR) in vortex_up()
1644 if (vp->drv_flags & INVERT_MII_PWR) in vortex_up()
1646 window_write16(vp, n, 2, Wn2_ResetOptions); in vortex_up()
1653 window_write16(vp, in vortex_up()
1654 (window_read16(vp, 4, Wn4_Media) & in vortex_up()
1663 window_read8(vp, 6, i); in vortex_up()
1664 window_read16(vp, 6, 10); in vortex_up()
1665 window_read16(vp, 6, 12); in vortex_up()
1667 window_read8(vp, 4, 12); in vortex_up()
1669 window_write16(vp, 0x0040, 4, Wn4_NetDiag); in vortex_up()
1671 if (vp->full_bus_master_rx) { /* Boomerang bus master. */ in vortex_up()
1672 vp->cur_rx = 0; in vortex_up()
1676 iowrite32(vp->rx_ring_dma, ioaddr + UpListPtr); in vortex_up()
1678 if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */ in vortex_up()
1679 vp->cur_tx = vp->dirty_tx = 0; in vortex_up()
1680 if (vp->drv_flags & IS_BOOMERANG) in vortex_up()
1684 vp->rx_ring[i].status = 0; in vortex_up()
1686 vp->tx_skbuff[i] = NULL; in vortex_up()
1698 vp->status_enable = SetStatusEnb | HostError|IntReq|StatsFull|TxComplete| in vortex_up()
1699 (vp->full_bus_master_tx ? DownComplete : TxAvailable) | in vortex_up()
1700 (vp->full_bus_master_rx ? UpComplete : RxComplete) | in vortex_up()
1701 (vp->bus_master ? DMADone : 0); in vortex_up()
1702 vp->intr_enable = SetIntrEnb | IntLatch | TxAvailable | in vortex_up()
1703 (vp->full_bus_master_rx ? 0 : RxComplete) | in vortex_up()
1705 | (vp->bus_master ? DMADone : 0) | UpComplete | DownComplete; in vortex_up()
1706 iowrite16(vp->status_enable, ioaddr + EL3_CMD); in vortex_up()
1710 iowrite16(vp->intr_enable, ioaddr + EL3_CMD); in vortex_up()
1711 if (vp->cb_fn_base) /* The PCMCIA people are idiots. */ in vortex_up()
1712 iowrite32(0x8000, vp->cb_fn_base + 4); in vortex_up()
1722 struct vortex_private *vp = netdev_priv(dev); in vortex_open() local
1733 if (vp->full_bus_master_rx) { /* Boomerang bus master. */ in vortex_open()
1738 vp->rx_ring[i].next = cpu_to_le32(vp->rx_ring_dma + sizeof(struct boom_rx_desc) * (i+1)); in vortex_open()
1739 vp->rx_ring[i].status = 0; /* Clear complete bit. */ in vortex_open()
1740 vp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ | LAST_FRAG); in vortex_open()
1744 vp->rx_skbuff[i] = skb; in vortex_open()
1749 dma = dma_map_single(vp->gendev, skb->data, in vortex_open()
1751 if (dma_mapping_error(vp->gendev, dma)) in vortex_open()
1753 vp->rx_ring[i].addr = cpu_to_le32(dma); in vortex_open()
1761 vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma); in vortex_open()
1770 if (vp->rx_skbuff[i]) { in vortex_open()
1771 dev_kfree_skb(vp->rx_skbuff[i]); in vortex_open()
1772 vp->rx_skbuff[i] = NULL; in vortex_open()
1786 struct vortex_private *vp = from_timer(vp, t, timer); in vortex_timer() local
1787 struct net_device *dev = vp->mii.dev; in vortex_timer()
1788 void __iomem *ioaddr = vp->ioaddr; in vortex_timer()
1799 media_status = window_read16(vp, 4, Wn4_Media); in vortex_timer()
1832 if (vp->medialock) in vortex_timer()
1838 spin_lock_irq(&vp->lock); in vortex_timer()
1842 } while ( ! (vp->available_media & media_tbl[dev->if_port].mask)); in vortex_timer()
1844 dev->if_port = vp->default_media; in vortex_timer()
1854 window_write16(vp, in vortex_timer()
1859 config = window_read32(vp, 3, Wn3_Config); in vortex_timer()
1861 window_write32(vp, config, 3, Wn3_Config); in vortex_timer()
1869 spin_unlock_irq(&vp->lock); in vortex_timer()
1877 mod_timer(&vp->timer, RUN_AT(next_tick)); in vortex_timer()
1878 if (vp->deferred) in vortex_timer()
1884 struct vortex_private *vp = netdev_priv(dev); in vortex_tx_timeout() local
1885 void __iomem *ioaddr = vp->ioaddr; in vortex_tx_timeout()
1891 window_read16(vp, 4, Wn4_NetDiag), in vortex_tx_timeout()
1892 window_read16(vp, 4, Wn4_Media), in vortex_tx_timeout()
1894 window_read16(vp, 4, Wn4_FIFODiag)); in vortex_tx_timeout()
1912 if (vp->full_bus_master_tx) { in vortex_tx_timeout()
1914 if (vp->cur_tx - vp->dirty_tx > 0 && ioread32(ioaddr + DownListPtr) == 0) in vortex_tx_timeout()
1915 iowrite32(vp->tx_ring_dma + (vp->dirty_tx % TX_RING_SIZE) * sizeof(struct boom_tx_desc), in vortex_tx_timeout()
1917 if (vp->cur_tx - vp->dirty_tx < TX_RING_SIZE) { in vortex_tx_timeout()
1921 if (vp->drv_flags & IS_BOOMERANG) in vortex_tx_timeout()
1941 struct vortex_private *vp = netdev_priv(dev); in vortex_error() local
1942 void __iomem *ioaddr = vp->ioaddr; in vortex_error()
1965 if (tx_status & 0x08) vp->xstats.tx_max_collisions++; in vortex_error()
1969 } else if ((tx_status & 0x08) && (vp->drv_flags & MAX_COLLISION_RESET)) { /* maxCollisions */ in vortex_error()
1992 (window_read16(vp, 5, 10) & ~StatsFull), in vortex_error()
1994 vp->intr_enable &= ~StatsFull; in vortex_error()
1999 iowrite16(vp->status_enable, ioaddr + EL3_CMD); in vortex_error()
2000 iowrite16(vp->intr_enable, ioaddr + EL3_CMD); in vortex_error()
2004 fifo_diag = window_read16(vp, 4, Wn4_FIFODiag); in vortex_error()
2008 if (vp->full_bus_master_tx) { in vortex_error()
2037 if (!vp->full_bus_master_tx) in vortex_error()
2045 struct vortex_private *vp = netdev_priv(dev); in vortex_start_xmit() local
2046 void __iomem *ioaddr = vp->ioaddr; in vortex_start_xmit()
2051 if (vp->bus_master) { in vortex_start_xmit()
2054 vp->tx_skb_dma = dma_map_single(vp->gendev, skb->data, len, in vortex_start_xmit()
2056 if (dma_mapping_error(vp->gendev, vp->tx_skb_dma)) { in vortex_start_xmit()
2062 spin_lock_irq(&vp->window_lock); in vortex_start_xmit()
2063 window_set(vp, 7); in vortex_start_xmit()
2064 iowrite32(vp->tx_skb_dma, ioaddr + Wn7_MasterAddr); in vortex_start_xmit()
2066 spin_unlock_irq(&vp->window_lock); in vortex_start_xmit()
2067 vp->tx_skb = skb; in vortex_start_xmit()
2113 struct vortex_private *vp = netdev_priv(dev); in boomerang_start_xmit() local
2114 void __iomem *ioaddr = vp->ioaddr; in boomerang_start_xmit()
2116 int entry = vp->cur_tx % TX_RING_SIZE; in boomerang_start_xmit()
2118 struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; in boomerang_start_xmit()
2125 dev->name, vp->cur_tx); in boomerang_start_xmit()
2134 if (vp->handling_irq) in boomerang_start_xmit()
2137 if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { in boomerang_start_xmit()
2145 vp->tx_skbuff[entry] = skb; in boomerang_start_xmit()
2147 vp->tx_ring[entry].next = 0; in boomerang_start_xmit()
2150 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); in boomerang_start_xmit()
2152 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); in boomerang_start_xmit()
2155 dma_addr = dma_map_single(vp->gendev, skb->data, skb->len, in boomerang_start_xmit()
2157 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2160 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2161 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); in boomerang_start_xmit()
2165 dma_addr = dma_map_single(vp->gendev, skb->data, in boomerang_start_xmit()
2167 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2170 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2171 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); in boomerang_start_xmit()
2176 dma_addr = skb_frag_dma_map(vp->gendev, frag, in boomerang_start_xmit()
2180 if (dma_mapping_error(vp->gendev, dma_addr)) { in boomerang_start_xmit()
2182 dma_unmap_page(vp->gendev, in boomerang_start_xmit()
2183 le32_to_cpu(vp->tx_ring[entry].frag[i+1].addr), in boomerang_start_xmit()
2184 le32_to_cpu(vp->tx_ring[entry].frag[i+1].length), in boomerang_start_xmit()
2187 dma_unmap_single(vp->gendev, in boomerang_start_xmit()
2188 le32_to_cpu(vp->tx_ring[entry].frag[0].addr), in boomerang_start_xmit()
2189 le32_to_cpu(vp->tx_ring[entry].frag[0].length), in boomerang_start_xmit()
2195 vp->tx_ring[entry].frag[i+1].addr = in boomerang_start_xmit()
2199 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); in boomerang_start_xmit()
2201 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)); in boomerang_start_xmit()
2205 dma_addr = dma_map_single(vp->gendev, skb->data, skb->len, DMA_TO_DEVICE); in boomerang_start_xmit()
2206 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2208 vp->tx_ring[entry].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2209 vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); in boomerang_start_xmit()
2210 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); in boomerang_start_xmit()
2213 spin_lock_irqsave(&vp->lock, flags); in boomerang_start_xmit()
2216 prev_entry->next = cpu_to_le32(vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc)); in boomerang_start_xmit()
2218 iowrite32(vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc), ioaddr + DownListPtr); in boomerang_start_xmit()
2219 vp->queued_packet++; in boomerang_start_xmit()
2222 vp->cur_tx++; in boomerang_start_xmit()
2225 if (vp->cur_tx - vp->dirty_tx > TX_RING_SIZE - 1) { in boomerang_start_xmit()
2237 spin_unlock_irqrestore(&vp->lock, flags); in boomerang_start_xmit()
2241 dev_err(vp->gendev, "Error mapping dma buffer\n"); in boomerang_start_xmit()
2256 struct vortex_private *vp = netdev_priv(dev); in _vortex_interrupt() local
2263 ioaddr = vp->ioaddr; in _vortex_interrupt()
2275 status |= vp->deferred; in _vortex_interrupt()
2276 vp->deferred = 0; in _vortex_interrupt()
2286 spin_lock(&vp->window_lock); in _vortex_interrupt()
2287 window_set(vp, 7); in _vortex_interrupt()
2307 dma_unmap_single(vp->gendev, vp->tx_skb_dma, (vp->tx_skb->len + 3) & ~3, DMA_TO_DEVICE); in _vortex_interrupt()
2309 bytes_compl += vp->tx_skb->len; in _vortex_interrupt()
2310 dev_consume_skb_irq(vp->tx_skb); /* Release the transferred buffer */ in _vortex_interrupt()
2330 spin_unlock(&vp->window_lock); in _vortex_interrupt()
2332 spin_lock(&vp->window_lock); in _vortex_interrupt()
2333 window_set(vp, 7); in _vortex_interrupt()
2341 vp->deferred |= status; in _vortex_interrupt()
2342 iowrite16(SetStatusEnb | (~vp->deferred & vp->status_enable), in _vortex_interrupt()
2344 iowrite16(AckIntr | (vp->deferred & 0x7ff), ioaddr + EL3_CMD); in _vortex_interrupt()
2347 mod_timer(&vp->timer, jiffies + 1*HZ); in _vortex_interrupt()
2355 spin_unlock(&vp->window_lock); in _vortex_interrupt()
2372 struct vortex_private *vp = netdev_priv(dev); in _boomerang_interrupt() local
2379 ioaddr = vp->ioaddr; in _boomerang_interrupt()
2381 vp->handling_irq = 1; in _boomerang_interrupt()
2399 status |= vp->deferred; in _boomerang_interrupt()
2400 vp->deferred = 0; in _boomerang_interrupt()
2418 unsigned int dirty_tx = vp->dirty_tx; in _boomerang_interrupt()
2421 while (vp->cur_tx - dirty_tx > 0) { in _boomerang_interrupt()
2425 vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc)) in _boomerang_interrupt()
2428 if ((vp->tx_ring[entry].status & DN_COMPLETE) == 0) in _boomerang_interrupt()
2432 if (vp->tx_skbuff[entry]) { in _boomerang_interrupt()
2433 struct sk_buff *skb = vp->tx_skbuff[entry]; in _boomerang_interrupt()
2436 dma_unmap_single(vp->gendev, in _boomerang_interrupt()
2437 le32_to_cpu(vp->tx_ring[entry].frag[0].addr), in _boomerang_interrupt()
2438 le32_to_cpu(vp->tx_ring[entry].frag[0].length)&0xFFF, in _boomerang_interrupt()
2442 dma_unmap_page(vp->gendev, in _boomerang_interrupt()
2443 le32_to_cpu(vp->tx_ring[entry].frag[i].addr), in _boomerang_interrupt()
2444 le32_to_cpu(vp->tx_ring[entry].frag[i].length)&0xFFF, in _boomerang_interrupt()
2447 dma_unmap_single(vp->gendev, in _boomerang_interrupt()
2448 le32_to_cpu(vp->tx_ring[entry].addr), skb->len, DMA_TO_DEVICE); in _boomerang_interrupt()
2453 vp->tx_skbuff[entry] = NULL; in _boomerang_interrupt()
2460 vp->dirty_tx = dirty_tx; in _boomerang_interrupt()
2461 if (vp->cur_tx - dirty_tx <= TX_RING_SIZE - 1) { in _boomerang_interrupt()
2477 vp->deferred |= status; in _boomerang_interrupt()
2478 iowrite16(SetStatusEnb | (~vp->deferred & vp->status_enable), in _boomerang_interrupt()
2480 iowrite16(AckIntr | (vp->deferred & 0x7ff), ioaddr + EL3_CMD); in _boomerang_interrupt()
2483 mod_timer(&vp->timer, jiffies + 1*HZ); in _boomerang_interrupt()
2488 if (vp->cb_fn_base) /* The PCMCIA people are idiots. */ in _boomerang_interrupt()
2489 iowrite32(0x8000, vp->cb_fn_base + 4); in _boomerang_interrupt()
2498 vp->handling_irq = 0; in _boomerang_interrupt()
2506 struct vortex_private *vp = netdev_priv(dev); in vortex_boomerang_interrupt() local
2510 spin_lock_irqsave(&vp->lock, flags); in vortex_boomerang_interrupt()
2512 if (vp->full_bus_master_rx) in vortex_boomerang_interrupt()
2517 spin_unlock_irqrestore(&vp->lock, flags); in vortex_boomerang_interrupt()
2524 struct vortex_private *vp = netdev_priv(dev); in vortex_rx() local
2525 void __iomem *ioaddr = vp->ioaddr; in vortex_rx()
2555 if (vp->bus_master && in vortex_rx()
2557 dma_addr_t dma = dma_map_single(vp->gendev, skb_put(skb, pkt_len), in vortex_rx()
2564 dma_unmap_single(vp->gendev, dma, pkt_len, DMA_FROM_DEVICE); in vortex_rx()
2593 struct vortex_private *vp = netdev_priv(dev); in boomerang_rx() local
2594 int entry = vp->cur_rx % RX_RING_SIZE; in boomerang_rx()
2595 void __iomem *ioaddr = vp->ioaddr; in boomerang_rx()
2602 while ((rx_status = le32_to_cpu(vp->rx_ring[entry].status)) & RxDComplete){ in boomerang_rx()
2620 dma_addr_t dma = le32_to_cpu(vp->rx_ring[entry].addr); in boomerang_rx()
2631 dma_sync_single_for_cpu(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2633 skb_put_data(skb, vp->rx_skbuff[entry]->data, in boomerang_rx()
2635 dma_sync_single_for_device(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2636 vp->rx_copy++; in boomerang_rx()
2647 newdma = dma_map_single(vp->gendev, newskb->data, in boomerang_rx()
2649 if (dma_mapping_error(vp->gendev, newdma)) { in boomerang_rx()
2656 skb = vp->rx_skbuff[entry]; in boomerang_rx()
2657 vp->rx_skbuff[entry] = newskb; in boomerang_rx()
2658 vp->rx_ring[entry].addr = cpu_to_le32(newdma); in boomerang_rx()
2660 dma_unmap_single(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2661 vp->rx_nocopy++; in boomerang_rx()
2670 vp->rx_csumhits++; in boomerang_rx()
2678 vp->rx_ring[entry].status = 0; /* Clear complete bit. */ in boomerang_rx()
2680 entry = (++vp->cur_rx) % RX_RING_SIZE; in boomerang_rx()
2688 struct vortex_private *vp = netdev_priv(dev); in vortex_down() local
2689 void __iomem *ioaddr = vp->ioaddr; in vortex_down()
2694 del_timer_sync(&vp->timer); in vortex_down()
2713 if (vp->full_bus_master_rx) in vortex_down()
2715 if (vp->full_bus_master_tx) in vortex_down()
2718 if (final_down && VORTEX_PCI(vp)) { in vortex_down()
2719 vp->pm_state_valid = 1; in vortex_down()
2720 pci_save_state(VORTEX_PCI(vp)); in vortex_down()
2728 struct vortex_private *vp = netdev_priv(dev); in vortex_close() local
2729 void __iomem *ioaddr = vp->ioaddr; in vortex_close()
2740 dev->name, vp->rx_nocopy, vp->rx_copy, vp->queued_packet, vp->rx_csumhits); in vortex_close()
2744 if (vp->rx_csumhits && in vortex_close()
2745 (vp->drv_flags & HAS_HWCKSM) == 0 && in vortex_close()
2746 (vp->card_idx >= MAX_UNITS || hw_checksums[vp->card_idx] == -1)) { in vortex_close()
2754 if (vp->full_bus_master_rx) { /* Free Boomerang bus master Rx buffers. */ in vortex_close()
2756 if (vp->rx_skbuff[i]) { in vortex_close()
2757 dma_unmap_single(vp->gendev, le32_to_cpu(vp->rx_ring[i].addr), in vortex_close()
2759 dev_kfree_skb(vp->rx_skbuff[i]); in vortex_close()
2760 vp->rx_skbuff[i] = NULL; in vortex_close()
2763 if (vp->full_bus_master_tx) { /* Free Boomerang bus master Tx buffers. */ in vortex_close()
2765 if (vp->tx_skbuff[i]) { in vortex_close()
2766 struct sk_buff *skb = vp->tx_skbuff[i]; in vortex_close()
2771 dma_unmap_single(vp->gendev, in vortex_close()
2772 le32_to_cpu(vp->tx_ring[i].frag[k].addr), in vortex_close()
2773 le32_to_cpu(vp->tx_ring[i].frag[k].length)&0xFFF, in vortex_close()
2776 dma_unmap_single(vp->gendev, le32_to_cpu(vp->tx_ring[i].addr), skb->len, DMA_TO_DEVICE); in vortex_close()
2779 vp->tx_skbuff[i] = NULL; in vortex_close()
2791 struct vortex_private *vp = netdev_priv(dev); in dump_tx_ring() local
2792 void __iomem *ioaddr = vp->ioaddr; in dump_tx_ring()
2794 if (vp->full_bus_master_tx) { in dump_tx_ring()
2799 vp->full_bus_master_tx, in dump_tx_ring()
2800 vp->dirty_tx, vp->dirty_tx % TX_RING_SIZE, in dump_tx_ring()
2801 vp->cur_tx, vp->cur_tx % TX_RING_SIZE); in dump_tx_ring()
2804 &vp->tx_ring[vp->dirty_tx % TX_RING_SIZE]); in dump_tx_ring()
2810 length = le32_to_cpu(vp->tx_ring[i].frag[0].length); in dump_tx_ring()
2812 length = le32_to_cpu(vp->tx_ring[i].length); in dump_tx_ring()
2815 i, &vp->tx_ring[i], length, in dump_tx_ring()
2816 le32_to_cpu(vp->tx_ring[i].status)); in dump_tx_ring()
2826 struct vortex_private *vp = netdev_priv(dev); in vortex_get_stats() local
2827 void __iomem *ioaddr = vp->ioaddr; in vortex_get_stats()
2831 spin_lock_irqsave (&vp->lock, flags); in vortex_get_stats()
2833 spin_unlock_irqrestore (&vp->lock, flags); in vortex_get_stats()
2847 struct vortex_private *vp = netdev_priv(dev); in update_stats() local
2851 dev->stats.tx_carrier_errors += window_read8(vp, 6, 0); in update_stats()
2852 dev->stats.tx_heartbeat_errors += window_read8(vp, 6, 1); in update_stats()
2853 dev->stats.tx_window_errors += window_read8(vp, 6, 4); in update_stats()
2854 dev->stats.rx_fifo_errors += window_read8(vp, 6, 5); in update_stats()
2855 dev->stats.tx_packets += window_read8(vp, 6, 6); in update_stats()
2856 dev->stats.tx_packets += (window_read8(vp, 6, 9) & in update_stats()
2858 /* Rx packets */ window_read8(vp, 6, 7); /* Must read to clear */ in update_stats()
2862 dev->stats.rx_bytes += window_read16(vp, 6, 10); in update_stats()
2863 dev->stats.tx_bytes += window_read16(vp, 6, 12); in update_stats()
2865 vp->xstats.tx_multiple_collisions += window_read8(vp, 6, 2); in update_stats()
2866 vp->xstats.tx_single_collisions += window_read8(vp, 6, 3); in update_stats()
2867 vp->xstats.tx_deferred += window_read8(vp, 6, 8); in update_stats()
2868 vp->xstats.rx_bad_ssd += window_read8(vp, 4, 12); in update_stats()
2870 dev->stats.collisions = vp->xstats.tx_multiple_collisions in update_stats()
2871 + vp->xstats.tx_single_collisions in update_stats()
2872 + vp->xstats.tx_max_collisions; in update_stats()
2875 u8 up = window_read8(vp, 4, 13); in update_stats()
2883 struct vortex_private *vp = netdev_priv(dev); in vortex_nway_reset() local
2885 return mii_nway_restart(&vp->mii); in vortex_nway_reset()
2891 struct vortex_private *vp = netdev_priv(dev); in vortex_get_link_ksettings() local
2893 mii_ethtool_get_link_ksettings(&vp->mii, cmd); in vortex_get_link_ksettings()
2901 struct vortex_private *vp = netdev_priv(dev); in vortex_set_link_ksettings() local
2903 return mii_ethtool_set_link_ksettings(&vp->mii, cmd); in vortex_set_link_ksettings()
2929 struct vortex_private *vp = netdev_priv(dev); in vortex_get_ethtool_stats() local
2930 void __iomem *ioaddr = vp->ioaddr; in vortex_get_ethtool_stats()
2933 spin_lock_irqsave(&vp->lock, flags); in vortex_get_ethtool_stats()
2935 spin_unlock_irqrestore(&vp->lock, flags); in vortex_get_ethtool_stats()
2937 data[0] = vp->xstats.tx_deferred; in vortex_get_ethtool_stats()
2938 data[1] = vp->xstats.tx_max_collisions; in vortex_get_ethtool_stats()
2939 data[2] = vp->xstats.tx_multiple_collisions; in vortex_get_ethtool_stats()
2940 data[3] = vp->xstats.tx_single_collisions; in vortex_get_ethtool_stats()
2941 data[4] = vp->xstats.rx_bad_ssd; in vortex_get_ethtool_stats()
2960 struct vortex_private *vp = netdev_priv(dev); in vortex_get_drvinfo() local
2963 if (VORTEX_PCI(vp)) { in vortex_get_drvinfo()
2964 strscpy(info->bus_info, pci_name(VORTEX_PCI(vp)), in vortex_get_drvinfo()
2967 if (VORTEX_EISA(vp)) in vortex_get_drvinfo()
2968 strscpy(info->bus_info, dev_name(vp->gendev), in vortex_get_drvinfo()
2978 struct vortex_private *vp = netdev_priv(dev); in vortex_get_wol() local
2980 if (!VORTEX_PCI(vp)) in vortex_get_wol()
2986 if (vp->enable_wol) in vortex_get_wol()
2992 struct vortex_private *vp = netdev_priv(dev); in vortex_set_wol() local
2994 if (!VORTEX_PCI(vp)) in vortex_set_wol()
3001 vp->enable_wol = 1; in vortex_set_wol()
3003 vp->enable_wol = 0; in vortex_set_wol()
3032 struct vortex_private *vp = netdev_priv(dev); in vortex_ioctl() local
3035 if(VORTEX_PCI(vp)) in vortex_ioctl()
3036 state = VORTEX_PCI(vp)->current_state; in vortex_ioctl()
3041 pci_set_power_state(VORTEX_PCI(vp), PCI_D0); in vortex_ioctl()
3042 err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL); in vortex_ioctl()
3044 pci_set_power_state(VORTEX_PCI(vp), state); in vortex_ioctl()
3056 struct vortex_private *vp = netdev_priv(dev); in set_rx_mode() local
3057 void __iomem *ioaddr = vp->ioaddr; in set_rx_mode()
3082 struct vortex_private *vp = netdev_priv(dev); in set_8021q_mode() local
3085 if ((vp->drv_flags&IS_CYCLONE) || (vp->drv_flags&IS_TORNADO)) { in set_8021q_mode()
3093 window_write16(vp, max_pkt_size, 3, Wn3_MaxPktSize); in set_8021q_mode()
3097 window_write16(vp, VLAN_ETHER_TYPE, 7, Wn7_VlanEtherType); in set_8021q_mode()
3101 vp->large_frames = dev->mtu > 1500 || enable; in set_8021q_mode()
3103 mac_ctrl = window_read16(vp, 3, Wn3_MAC_Ctrl); in set_8021q_mode()
3104 if (vp->large_frames) in set_8021q_mode()
3108 window_write16(vp, mac_ctrl, 3, Wn3_MAC_Ctrl); in set_8021q_mode()
3128 static void mdio_delay(struct vortex_private *vp) in mdio_delay() argument
3130 window_read32(vp, 4, Wn4_PhysicalMgmt); in mdio_delay()
3142 static void mdio_sync(struct vortex_private *vp, int bits) in mdio_sync() argument
3146 window_write16(vp, MDIO_DATA_WRITE1, 4, Wn4_PhysicalMgmt); in mdio_sync()
3147 mdio_delay(vp); in mdio_sync()
3148 window_write16(vp, MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, in mdio_sync()
3150 mdio_delay(vp); in mdio_sync()
3157 struct vortex_private *vp = netdev_priv(dev); in mdio_read() local
3161 spin_lock_bh(&vp->mii_lock); in mdio_read()
3164 mdio_sync(vp, 32); in mdio_read()
3169 window_write16(vp, dataval, 4, Wn4_PhysicalMgmt); in mdio_read()
3170 mdio_delay(vp); in mdio_read()
3171 window_write16(vp, dataval | MDIO_SHIFT_CLK, in mdio_read()
3173 mdio_delay(vp); in mdio_read()
3177 window_write16(vp, MDIO_ENB_IN, 4, Wn4_PhysicalMgmt); in mdio_read()
3178 mdio_delay(vp); in mdio_read()
3180 ((window_read16(vp, 4, Wn4_PhysicalMgmt) & in mdio_read()
3182 window_write16(vp, MDIO_ENB_IN | MDIO_SHIFT_CLK, in mdio_read()
3184 mdio_delay(vp); in mdio_read()
3187 spin_unlock_bh(&vp->mii_lock); in mdio_read()
3194 struct vortex_private *vp = netdev_priv(dev); in mdio_write() local
3198 spin_lock_bh(&vp->mii_lock); in mdio_write()
3201 mdio_sync(vp, 32); in mdio_write()
3206 window_write16(vp, dataval, 4, Wn4_PhysicalMgmt); in mdio_write()
3207 mdio_delay(vp); in mdio_write()
3208 window_write16(vp, dataval | MDIO_SHIFT_CLK, in mdio_write()
3210 mdio_delay(vp); in mdio_write()
3214 window_write16(vp, MDIO_ENB_IN, 4, Wn4_PhysicalMgmt); in mdio_write()
3215 mdio_delay(vp); in mdio_write()
3216 window_write16(vp, MDIO_ENB_IN | MDIO_SHIFT_CLK, in mdio_write()
3218 mdio_delay(vp); in mdio_write()
3221 spin_unlock_bh(&vp->mii_lock); in mdio_write()
3228 struct vortex_private *vp = netdev_priv(dev); in acpi_set_WOL() local
3229 void __iomem *ioaddr = vp->ioaddr; in acpi_set_WOL()
3231 device_set_wakeup_enable(vp->gendev, vp->enable_wol); in acpi_set_WOL()
3233 if (vp->enable_wol) { in acpi_set_WOL()
3235 window_write16(vp, 2, 7, 0x0c); in acpi_set_WOL()
3240 if (pci_enable_wake(VORTEX_PCI(vp), PCI_D3hot, 1)) { in acpi_set_WOL()
3241 pr_info("%s: WOL not supported.\n", pci_name(VORTEX_PCI(vp))); in acpi_set_WOL()
3243 vp->enable_wol = 0; in acpi_set_WOL()
3247 if (VORTEX_PCI(vp)->current_state < PCI_D3hot) in acpi_set_WOL()
3251 pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot); in acpi_set_WOL()
3259 struct vortex_private *vp; in vortex_remove_one() local
3266 vp = netdev_priv(dev); in vortex_remove_one()
3268 if (vp->cb_fn_base) in vortex_remove_one()
3269 pci_iounmap(pdev, vp->cb_fn_base); in vortex_remove_one()
3274 if (vp->pm_state_valid) in vortex_remove_one()
3279 iowrite16(TotalReset | ((vp->drv_flags & EEPROM_RESET) ? 0x04 : 0x14), in vortex_remove_one()
3280 vp->ioaddr + EL3_CMD); in vortex_remove_one()
3282 pci_iounmap(pdev, vp->ioaddr); in vortex_remove_one()
3287 vp->rx_ring, vp->rx_ring_dma); in vortex_remove_one()