• Home
  • Raw
  • Download

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
1118 dev = alloc_etherdev(sizeof(*vp)); in vortex_probe1()
1124 vp = netdev_priv(dev); in vortex_probe1()
1147 vp->enable_wol = 1; in vortex_probe1()
1163 vp->ioaddr = ioaddr; in vortex_probe1()
1164 vp->large_frames = mtu > 1500; in vortex_probe1()
1165 vp->drv_flags = vci->drv_flags; in vortex_probe1()
1166 vp->has_nway = (vci->drv_flags & HAS_NWAY) ? 1 : 0; in vortex_probe1()
1167 vp->io_size = vci->io_size; in vortex_probe1()
1168 vp->card_idx = card_idx; in vortex_probe1()
1169 vp->window = -1; in vortex_probe1()
1199 spin_lock_init(&vp->lock); in vortex_probe1()
1200 spin_lock_init(&vp->mii_lock); in vortex_probe1()
1201 spin_lock_init(&vp->window_lock); in vortex_probe1()
1202 vp->gendev = gendev; in vortex_probe1()
1203 vp->mii.dev = dev; in vortex_probe1()
1204 vp->mii.mdio_read = mdio_read; in vortex_probe1()
1205 vp->mii.mdio_write = mdio_write; in vortex_probe1()
1206 vp->mii.phy_id_mask = 0x1f; in vortex_probe1()
1207 vp->mii.reg_num_mask = 0x1f; in vortex_probe1()
1210 vp->rx_ring = dma_alloc_coherent(gendev, sizeof(struct boom_rx_desc) * RX_RING_SIZE in vortex_probe1()
1212 &vp->rx_ring_dma, GFP_KERNEL); in vortex_probe1()
1214 if (!vp->rx_ring) in vortex_probe1()
1217 vp->tx_ring = (struct boom_tx_desc *)(vp->rx_ring + RX_RING_SIZE); in vortex_probe1()
1218 vp->tx_ring_dma = vp->rx_ring_dma + sizeof(struct boom_rx_desc) * RX_RING_SIZE; in vortex_probe1()
1227 vp->media_override = 7; in vortex_probe1()
1229 vp->media_override = ((option & 7) == 2) ? 0 : option & 15; in vortex_probe1()
1230 if (vp->media_override != 7) in vortex_probe1()
1231 vp->medialock = 1; in vortex_probe1()
1232 vp->full_duplex = (option & 0x200) ? 1 : 0; in vortex_probe1()
1233 vp->bus_master = (option & 16) ? 1 : 0; in vortex_probe1()
1237 vp->full_duplex = 1; in vortex_probe1()
1239 vp->enable_wol = 1; in vortex_probe1()
1243 vp->full_duplex = 1; in vortex_probe1()
1245 vp->flow_ctrl = 1; in vortex_probe1()
1247 vp->enable_wol = 1; in vortex_probe1()
1250 vp->mii.force_media = vp->full_duplex; in vortex_probe1()
1251 vp->options = option; in vortex_probe1()
1265 window_write16(vp, base + i, 0, Wn0EepromCmd); in vortex_probe1()
1269 if ((window_read16(vp, 0, Wn0EepromCmd) & in vortex_probe1()
1273 eeprom[i] = window_read16(vp, 0, Wn0EepromData); in vortex_probe1()
1298 window_write8(vp, dev->dev_addr[i], 2, i); in vortex_probe1()
1307 step = (window_read8(vp, 4, Wn4_NetDiag) & 0x1e) >> 1; in vortex_probe1()
1318 vp->cb_fn_base = pci_iomap(pdev, 2, 0); in vortex_probe1()
1319 if (!vp->cb_fn_base) { in vortex_probe1()
1328 vp->cb_fn_base); in vortex_probe1()
1331 n = window_read16(vp, 2, Wn2_ResetOptions) & ~0x4010; in vortex_probe1()
1332 if (vp->drv_flags & INVERT_LED_PWR) in vortex_probe1()
1334 if (vp->drv_flags & INVERT_MII_PWR) in vortex_probe1()
1336 window_write16(vp, n, 2, Wn2_ResetOptions); in vortex_probe1()
1337 if (vp->drv_flags & WNO_XCVR_PWR) { in vortex_probe1()
1338 window_write16(vp, 0x0800, 0, 0); in vortex_probe1()
1343 vp->info1 = eeprom[13]; in vortex_probe1()
1344 vp->info2 = eeprom[15]; in vortex_probe1()
1345 vp->capabilities = eeprom[16]; in vortex_probe1()
1347 if (vp->info1 & 0x8000) { in vortex_probe1()
1348 vp->full_duplex = 1; in vortex_probe1()
1356 vp->available_media = window_read16(vp, 3, Wn3_Options); in vortex_probe1()
1357 if ((vp->available_media & 0xff) == 0) /* Broken 3c916 */ in vortex_probe1()
1358 vp->available_media = 0x40; in vortex_probe1()
1359 config = window_read32(vp, 3, Wn3_Config); in vortex_probe1()
1362 config, window_read16(vp, 3, Wn3_Options)); in vortex_probe1()
1371 vp->default_media = XCVR(config); in vortex_probe1()
1372 if (vp->default_media == XCVR_NWAY) in vortex_probe1()
1373 vp->has_nway = 1; in vortex_probe1()
1374 vp->autoselect = AUTOSELECT(config); in vortex_probe1()
1377 if (vp->media_override != 7) { in vortex_probe1()
1379 print_name, vp->media_override, in vortex_probe1()
1380 media_tbl[vp->media_override].name); in vortex_probe1()
1381 dev->if_port = vp->media_override; in vortex_probe1()
1383 dev->if_port = vp->default_media; in vortex_probe1()
1385 if ((vp->available_media & 0x40) || (vci->drv_flags & HAS_NWAY) || in vortex_probe1()
1389 if (vp->drv_flags & EXTRA_PREAMBLE) in vortex_probe1()
1391 mdio_sync(vp, 32); in vortex_probe1()
1408 vp->phys[phy_idx++] = phyx; in vortex_probe1()
1420 vp->phys[0] = 24; in vortex_probe1()
1422 vp->advertising = mdio_read(dev, vp->phys[0], MII_ADVERTISE); in vortex_probe1()
1423 if (vp->full_duplex) { in vortex_probe1()
1425 vp->advertising &= ~0x02A0; in vortex_probe1()
1426 mdio_write(dev, vp->phys[0], 4, vp->advertising); in vortex_probe1()
1429 vp->mii.phy_id = vp->phys[0]; in vortex_probe1()
1432 if (vp->capabilities & CapBusMaster) { in vortex_probe1()
1433 vp->full_bus_master_tx = 1; in vortex_probe1()
1436 (vp->info2 & 1) ? "early" : "whole-frame" ); in vortex_probe1()
1438 vp->full_bus_master_rx = (vp->info2 & 1) ? 1 : 2; in vortex_probe1()
1439 vp->bus_master = 0; /* AKPM: vortex only */ in vortex_probe1()
1443 if (vp->full_bus_master_tx) { in vortex_probe1()
1447 ((hw_checksums[card_idx] == -1 && (vp->drv_flags & HAS_HWCKSM)) || in vortex_probe1()
1465 vp->pm_state_valid = 1; in vortex_probe1()
1477 vp->rx_ring, vp->rx_ring_dma); in vortex_probe1()
1488 struct vortex_private *vp = netdev_priv(dev); in issue_and_wait() local
1489 void __iomem *ioaddr = vp->ioaddr; in issue_and_wait()
1515 struct vortex_private *vp = netdev_priv(dev); in vortex_set_duplex() local
1518 dev->name, (vp->full_duplex) ? "full" : "half"); in vortex_set_duplex()
1521 window_write16(vp, in vortex_set_duplex()
1522 ((vp->info1 & 0x8000) || vp->full_duplex ? 0x20 : 0) | in vortex_set_duplex()
1523 (vp->large_frames ? 0x40 : 0) | in vortex_set_duplex()
1524 ((vp->full_duplex && vp->flow_ctrl && vp->partner_flow_ctrl) ? in vortex_set_duplex()
1531 struct vortex_private *vp = netdev_priv(dev); in vortex_check_media() local
1537 if (mii_check_media(&vp->mii, ok_to_print, init)) { in vortex_check_media()
1538 vp->full_duplex = vp->mii.full_duplex; in vortex_check_media()
1548 struct vortex_private *vp = netdev_priv(dev); in vortex_up() local
1549 void __iomem *ioaddr = vp->ioaddr; in vortex_up()
1553 if (VORTEX_PCI(vp)) { in vortex_up()
1554 pci_set_power_state(VORTEX_PCI(vp), PCI_D0); /* Go active */ in vortex_up()
1555 if (vp->pm_state_valid) in vortex_up()
1556 pci_restore_state(VORTEX_PCI(vp)); in vortex_up()
1557 err = pci_enable_device(VORTEX_PCI(vp)); in vortex_up()
1565 config = window_read32(vp, 3, Wn3_Config); in vortex_up()
1567 if (vp->media_override != 7) { in vortex_up()
1569 dev->name, vp->media_override, in vortex_up()
1570 media_tbl[vp->media_override].name); in vortex_up()
1571 dev->if_port = vp->media_override; in vortex_up()
1572 } else if (vp->autoselect) { in vortex_up()
1573 if (vp->has_nway) { in vortex_up()
1581 while (! (vp->available_media & media_tbl[dev->if_port].mask)) in vortex_up()
1588 dev->if_port = vp->default_media; in vortex_up()
1594 timer_setup(&vp->timer, vortex_timer, 0); in vortex_up()
1595 mod_timer(&vp->timer, RUN_AT(media_tbl[dev->if_port].wait)); in vortex_up()
1601 vp->full_duplex = vp->mii.force_media; in vortex_up()
1605 window_write32(vp, config, 3, Wn3_Config); in vortex_up()
1608 mdio_read(dev, vp->phys[0], MII_BMSR); in vortex_up()
1609 mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA); in vortex_up()
1610 vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0); in vortex_up()
1611 vp->mii.full_duplex = vp->full_duplex; in vortex_up()
1629 dev->name, dev->irq, window_read16(vp, 4, Wn4_Media)); in vortex_up()
1634 window_write8(vp, dev->dev_addr[i], 2, i); in vortex_up()
1636 window_write16(vp, 0, 2, i); in vortex_up()
1638 if (vp->cb_fn_base) { in vortex_up()
1639 unsigned short n = window_read16(vp, 2, Wn2_ResetOptions) & ~0x4010; in vortex_up()
1640 if (vp->drv_flags & INVERT_LED_PWR) in vortex_up()
1642 if (vp->drv_flags & INVERT_MII_PWR) in vortex_up()
1644 window_write16(vp, n, 2, Wn2_ResetOptions); in vortex_up()
1651 window_write16(vp, in vortex_up()
1652 (window_read16(vp, 4, Wn4_Media) & in vortex_up()
1661 window_read8(vp, 6, i); in vortex_up()
1662 window_read16(vp, 6, 10); in vortex_up()
1663 window_read16(vp, 6, 12); in vortex_up()
1665 window_read8(vp, 4, 12); in vortex_up()
1667 window_write16(vp, 0x0040, 4, Wn4_NetDiag); in vortex_up()
1669 if (vp->full_bus_master_rx) { /* Boomerang bus master. */ in vortex_up()
1670 vp->cur_rx = 0; in vortex_up()
1674 iowrite32(vp->rx_ring_dma, ioaddr + UpListPtr); in vortex_up()
1676 if (vp->full_bus_master_tx) { /* Boomerang bus master Tx. */ in vortex_up()
1677 vp->cur_tx = vp->dirty_tx = 0; in vortex_up()
1678 if (vp->drv_flags & IS_BOOMERANG) in vortex_up()
1682 vp->rx_ring[i].status = 0; in vortex_up()
1684 vp->tx_skbuff[i] = NULL; in vortex_up()
1696 vp->status_enable = SetStatusEnb | HostError|IntReq|StatsFull|TxComplete| in vortex_up()
1697 (vp->full_bus_master_tx ? DownComplete : TxAvailable) | in vortex_up()
1698 (vp->full_bus_master_rx ? UpComplete : RxComplete) | in vortex_up()
1699 (vp->bus_master ? DMADone : 0); in vortex_up()
1700 vp->intr_enable = SetIntrEnb | IntLatch | TxAvailable | in vortex_up()
1701 (vp->full_bus_master_rx ? 0 : RxComplete) | in vortex_up()
1703 | (vp->bus_master ? DMADone : 0) | UpComplete | DownComplete; in vortex_up()
1704 iowrite16(vp->status_enable, ioaddr + EL3_CMD); in vortex_up()
1708 iowrite16(vp->intr_enable, ioaddr + EL3_CMD); in vortex_up()
1709 if (vp->cb_fn_base) /* The PCMCIA people are idiots. */ in vortex_up()
1710 iowrite32(0x8000, vp->cb_fn_base + 4); in vortex_up()
1720 struct vortex_private *vp = netdev_priv(dev); in vortex_open() local
1731 if (vp->full_bus_master_rx) { /* Boomerang bus master. */ in vortex_open()
1736 vp->rx_ring[i].next = cpu_to_le32(vp->rx_ring_dma + sizeof(struct boom_rx_desc) * (i+1)); in vortex_open()
1737 vp->rx_ring[i].status = 0; /* Clear complete bit. */ in vortex_open()
1738 vp->rx_ring[i].length = cpu_to_le32(PKT_BUF_SZ | LAST_FRAG); in vortex_open()
1742 vp->rx_skbuff[i] = skb; in vortex_open()
1747 dma = dma_map_single(vp->gendev, skb->data, in vortex_open()
1749 if (dma_mapping_error(vp->gendev, dma)) in vortex_open()
1751 vp->rx_ring[i].addr = cpu_to_le32(dma); in vortex_open()
1759 vp->rx_ring[i-1].next = cpu_to_le32(vp->rx_ring_dma); in vortex_open()
1768 if (vp->rx_skbuff[i]) { in vortex_open()
1769 dev_kfree_skb(vp->rx_skbuff[i]); in vortex_open()
1770 vp->rx_skbuff[i] = NULL; in vortex_open()
1784 struct vortex_private *vp = from_timer(vp, t, timer); in vortex_timer() local
1785 struct net_device *dev = vp->mii.dev; in vortex_timer()
1786 void __iomem *ioaddr = vp->ioaddr; in vortex_timer()
1797 media_status = window_read16(vp, 4, Wn4_Media); in vortex_timer()
1830 if (vp->medialock) in vortex_timer()
1836 spin_lock_irq(&vp->lock); in vortex_timer()
1840 } while ( ! (vp->available_media & media_tbl[dev->if_port].mask)); in vortex_timer()
1842 dev->if_port = vp->default_media; in vortex_timer()
1852 window_write16(vp, in vortex_timer()
1857 config = window_read32(vp, 3, Wn3_Config); in vortex_timer()
1859 window_write32(vp, config, 3, Wn3_Config); in vortex_timer()
1867 spin_unlock_irq(&vp->lock); in vortex_timer()
1875 mod_timer(&vp->timer, RUN_AT(next_tick)); in vortex_timer()
1876 if (vp->deferred) in vortex_timer()
1882 struct vortex_private *vp = netdev_priv(dev); in vortex_tx_timeout() local
1883 void __iomem *ioaddr = vp->ioaddr; in vortex_tx_timeout()
1889 window_read16(vp, 4, Wn4_NetDiag), in vortex_tx_timeout()
1890 window_read16(vp, 4, Wn4_Media), in vortex_tx_timeout()
1892 window_read16(vp, 4, Wn4_FIFODiag)); in vortex_tx_timeout()
1910 if (vp->full_bus_master_tx) { in vortex_tx_timeout()
1912 if (vp->cur_tx - vp->dirty_tx > 0 && ioread32(ioaddr + DownListPtr) == 0) in vortex_tx_timeout()
1913 iowrite32(vp->tx_ring_dma + (vp->dirty_tx % TX_RING_SIZE) * sizeof(struct boom_tx_desc), in vortex_tx_timeout()
1915 if (vp->cur_tx - vp->dirty_tx < TX_RING_SIZE) { in vortex_tx_timeout()
1919 if (vp->drv_flags & IS_BOOMERANG) in vortex_tx_timeout()
1939 struct vortex_private *vp = netdev_priv(dev); in vortex_error() local
1940 void __iomem *ioaddr = vp->ioaddr; in vortex_error()
1963 if (tx_status & 0x08) vp->xstats.tx_max_collisions++; in vortex_error()
1967 } else if ((tx_status & 0x08) && (vp->drv_flags & MAX_COLLISION_RESET)) { /* maxCollisions */ in vortex_error()
1990 (window_read16(vp, 5, 10) & ~StatsFull), in vortex_error()
1992 vp->intr_enable &= ~StatsFull; in vortex_error()
1997 iowrite16(vp->status_enable, ioaddr + EL3_CMD); in vortex_error()
1998 iowrite16(vp->intr_enable, ioaddr + EL3_CMD); in vortex_error()
2002 fifo_diag = window_read16(vp, 4, Wn4_FIFODiag); in vortex_error()
2006 if (vp->full_bus_master_tx) { in vortex_error()
2035 if (!vp->full_bus_master_tx) in vortex_error()
2043 struct vortex_private *vp = netdev_priv(dev); in vortex_start_xmit() local
2044 void __iomem *ioaddr = vp->ioaddr; in vortex_start_xmit()
2049 if (vp->bus_master) { in vortex_start_xmit()
2052 vp->tx_skb_dma = dma_map_single(vp->gendev, skb->data, len, in vortex_start_xmit()
2054 if (dma_mapping_error(vp->gendev, vp->tx_skb_dma)) { in vortex_start_xmit()
2060 spin_lock_irq(&vp->window_lock); in vortex_start_xmit()
2061 window_set(vp, 7); in vortex_start_xmit()
2062 iowrite32(vp->tx_skb_dma, ioaddr + Wn7_MasterAddr); in vortex_start_xmit()
2064 spin_unlock_irq(&vp->window_lock); in vortex_start_xmit()
2065 vp->tx_skb = skb; in vortex_start_xmit()
2111 struct vortex_private *vp = netdev_priv(dev); in boomerang_start_xmit() local
2112 void __iomem *ioaddr = vp->ioaddr; in boomerang_start_xmit()
2114 int entry = vp->cur_tx % TX_RING_SIZE; in boomerang_start_xmit()
2116 struct boom_tx_desc *prev_entry = &vp->tx_ring[(vp->cur_tx-1) % TX_RING_SIZE]; in boomerang_start_xmit()
2123 dev->name, vp->cur_tx); in boomerang_start_xmit()
2132 if (vp->handling_irq) in boomerang_start_xmit()
2135 if (vp->cur_tx - vp->dirty_tx >= TX_RING_SIZE) { in boomerang_start_xmit()
2143 vp->tx_skbuff[entry] = skb; in boomerang_start_xmit()
2145 vp->tx_ring[entry].next = 0; in boomerang_start_xmit()
2148 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); in boomerang_start_xmit()
2150 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded | AddTCPChksum | AddUDPChksum); in boomerang_start_xmit()
2153 dma_addr = dma_map_single(vp->gendev, skb->data, skb->len, in boomerang_start_xmit()
2155 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2158 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2159 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb->len | LAST_FRAG); in boomerang_start_xmit()
2163 dma_addr = dma_map_single(vp->gendev, skb->data, in boomerang_start_xmit()
2165 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2168 vp->tx_ring[entry].frag[0].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2169 vp->tx_ring[entry].frag[0].length = cpu_to_le32(skb_headlen(skb)); in boomerang_start_xmit()
2174 dma_addr = skb_frag_dma_map(vp->gendev, frag, in boomerang_start_xmit()
2178 if (dma_mapping_error(vp->gendev, dma_addr)) { in boomerang_start_xmit()
2180 dma_unmap_page(vp->gendev, in boomerang_start_xmit()
2181 le32_to_cpu(vp->tx_ring[entry].frag[i+1].addr), in boomerang_start_xmit()
2182 le32_to_cpu(vp->tx_ring[entry].frag[i+1].length), in boomerang_start_xmit()
2185 dma_unmap_single(vp->gendev, in boomerang_start_xmit()
2186 le32_to_cpu(vp->tx_ring[entry].frag[0].addr), in boomerang_start_xmit()
2187 le32_to_cpu(vp->tx_ring[entry].frag[0].length), in boomerang_start_xmit()
2193 vp->tx_ring[entry].frag[i+1].addr = in boomerang_start_xmit()
2197 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)|LAST_FRAG); in boomerang_start_xmit()
2199 vp->tx_ring[entry].frag[i+1].length = cpu_to_le32(skb_frag_size(frag)); in boomerang_start_xmit()
2203 dma_addr = dma_map_single(vp->gendev, skb->data, skb->len, DMA_TO_DEVICE); in boomerang_start_xmit()
2204 if (dma_mapping_error(vp->gendev, dma_addr)) in boomerang_start_xmit()
2206 vp->tx_ring[entry].addr = cpu_to_le32(dma_addr); in boomerang_start_xmit()
2207 vp->tx_ring[entry].length = cpu_to_le32(skb->len | LAST_FRAG); in boomerang_start_xmit()
2208 vp->tx_ring[entry].status = cpu_to_le32(skb->len | TxIntrUploaded); in boomerang_start_xmit()
2211 spin_lock_irqsave(&vp->lock, flags); in boomerang_start_xmit()
2214 prev_entry->next = cpu_to_le32(vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc)); in boomerang_start_xmit()
2216 iowrite32(vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc), ioaddr + DownListPtr); in boomerang_start_xmit()
2217 vp->queued_packet++; in boomerang_start_xmit()
2220 vp->cur_tx++; in boomerang_start_xmit()
2223 if (vp->cur_tx - vp->dirty_tx > TX_RING_SIZE - 1) { in boomerang_start_xmit()
2235 spin_unlock_irqrestore(&vp->lock, flags); in boomerang_start_xmit()
2239 dev_err(vp->gendev, "Error mapping dma buffer\n"); in boomerang_start_xmit()
2254 struct vortex_private *vp = netdev_priv(dev); in _vortex_interrupt() local
2261 ioaddr = vp->ioaddr; in _vortex_interrupt()
2273 status |= vp->deferred; in _vortex_interrupt()
2274 vp->deferred = 0; in _vortex_interrupt()
2284 spin_lock(&vp->window_lock); in _vortex_interrupt()
2285 window_set(vp, 7); in _vortex_interrupt()
2305 dma_unmap_single(vp->gendev, vp->tx_skb_dma, (vp->tx_skb->len + 3) & ~3, DMA_TO_DEVICE); in _vortex_interrupt()
2307 bytes_compl += vp->tx_skb->len; in _vortex_interrupt()
2308 dev_consume_skb_irq(vp->tx_skb); /* Release the transferred buffer */ in _vortex_interrupt()
2328 spin_unlock(&vp->window_lock); in _vortex_interrupt()
2330 spin_lock(&vp->window_lock); in _vortex_interrupt()
2331 window_set(vp, 7); in _vortex_interrupt()
2339 vp->deferred |= status; in _vortex_interrupt()
2340 iowrite16(SetStatusEnb | (~vp->deferred & vp->status_enable), in _vortex_interrupt()
2342 iowrite16(AckIntr | (vp->deferred & 0x7ff), ioaddr + EL3_CMD); in _vortex_interrupt()
2345 mod_timer(&vp->timer, jiffies + 1*HZ); in _vortex_interrupt()
2353 spin_unlock(&vp->window_lock); in _vortex_interrupt()
2370 struct vortex_private *vp = netdev_priv(dev); in _boomerang_interrupt() local
2377 ioaddr = vp->ioaddr; in _boomerang_interrupt()
2379 vp->handling_irq = 1; in _boomerang_interrupt()
2397 status |= vp->deferred; in _boomerang_interrupt()
2398 vp->deferred = 0; in _boomerang_interrupt()
2416 unsigned int dirty_tx = vp->dirty_tx; in _boomerang_interrupt()
2419 while (vp->cur_tx - dirty_tx > 0) { in _boomerang_interrupt()
2423 vp->tx_ring_dma + entry * sizeof(struct boom_tx_desc)) in _boomerang_interrupt()
2426 if ((vp->tx_ring[entry].status & DN_COMPLETE) == 0) in _boomerang_interrupt()
2430 if (vp->tx_skbuff[entry]) { in _boomerang_interrupt()
2431 struct sk_buff *skb = vp->tx_skbuff[entry]; in _boomerang_interrupt()
2434 dma_unmap_single(vp->gendev, in _boomerang_interrupt()
2435 le32_to_cpu(vp->tx_ring[entry].frag[0].addr), in _boomerang_interrupt()
2436 le32_to_cpu(vp->tx_ring[entry].frag[0].length)&0xFFF, in _boomerang_interrupt()
2440 dma_unmap_page(vp->gendev, in _boomerang_interrupt()
2441 le32_to_cpu(vp->tx_ring[entry].frag[i].addr), in _boomerang_interrupt()
2442 le32_to_cpu(vp->tx_ring[entry].frag[i].length)&0xFFF, in _boomerang_interrupt()
2445 dma_unmap_single(vp->gendev, in _boomerang_interrupt()
2446 le32_to_cpu(vp->tx_ring[entry].addr), skb->len, DMA_TO_DEVICE); in _boomerang_interrupt()
2451 vp->tx_skbuff[entry] = NULL; in _boomerang_interrupt()
2458 vp->dirty_tx = dirty_tx; in _boomerang_interrupt()
2459 if (vp->cur_tx - dirty_tx <= TX_RING_SIZE - 1) { in _boomerang_interrupt()
2475 vp->deferred |= status; in _boomerang_interrupt()
2476 iowrite16(SetStatusEnb | (~vp->deferred & vp->status_enable), in _boomerang_interrupt()
2478 iowrite16(AckIntr | (vp->deferred & 0x7ff), ioaddr + EL3_CMD); in _boomerang_interrupt()
2481 mod_timer(&vp->timer, jiffies + 1*HZ); in _boomerang_interrupt()
2486 if (vp->cb_fn_base) /* The PCMCIA people are idiots. */ in _boomerang_interrupt()
2487 iowrite32(0x8000, vp->cb_fn_base + 4); in _boomerang_interrupt()
2496 vp->handling_irq = 0; in _boomerang_interrupt()
2504 struct vortex_private *vp = netdev_priv(dev); in vortex_boomerang_interrupt() local
2508 spin_lock_irqsave(&vp->lock, flags); in vortex_boomerang_interrupt()
2510 if (vp->full_bus_master_rx) in vortex_boomerang_interrupt()
2515 spin_unlock_irqrestore(&vp->lock, flags); in vortex_boomerang_interrupt()
2522 struct vortex_private *vp = netdev_priv(dev); in vortex_rx() local
2523 void __iomem *ioaddr = vp->ioaddr; in vortex_rx()
2553 if (vp->bus_master && in vortex_rx()
2555 dma_addr_t dma = dma_map_single(vp->gendev, skb_put(skb, pkt_len), in vortex_rx()
2562 dma_unmap_single(vp->gendev, dma, pkt_len, DMA_FROM_DEVICE); in vortex_rx()
2591 struct vortex_private *vp = netdev_priv(dev); in boomerang_rx() local
2592 int entry = vp->cur_rx % RX_RING_SIZE; in boomerang_rx()
2593 void __iomem *ioaddr = vp->ioaddr; in boomerang_rx()
2600 while ((rx_status = le32_to_cpu(vp->rx_ring[entry].status)) & RxDComplete){ in boomerang_rx()
2618 dma_addr_t dma = le32_to_cpu(vp->rx_ring[entry].addr); in boomerang_rx()
2629 dma_sync_single_for_cpu(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2631 skb_put_data(skb, vp->rx_skbuff[entry]->data, in boomerang_rx()
2633 dma_sync_single_for_device(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2634 vp->rx_copy++; in boomerang_rx()
2645 newdma = dma_map_single(vp->gendev, newskb->data, in boomerang_rx()
2647 if (dma_mapping_error(vp->gendev, newdma)) { in boomerang_rx()
2654 skb = vp->rx_skbuff[entry]; in boomerang_rx()
2655 vp->rx_skbuff[entry] = newskb; in boomerang_rx()
2656 vp->rx_ring[entry].addr = cpu_to_le32(newdma); in boomerang_rx()
2658 dma_unmap_single(vp->gendev, dma, PKT_BUF_SZ, DMA_FROM_DEVICE); in boomerang_rx()
2659 vp->rx_nocopy++; in boomerang_rx()
2668 vp->rx_csumhits++; in boomerang_rx()
2676 vp->rx_ring[entry].status = 0; /* Clear complete bit. */ in boomerang_rx()
2678 entry = (++vp->cur_rx) % RX_RING_SIZE; in boomerang_rx()
2686 struct vortex_private *vp = netdev_priv(dev); in vortex_down() local
2687 void __iomem *ioaddr = vp->ioaddr; in vortex_down()
2692 del_timer_sync(&vp->timer); in vortex_down()
2711 if (vp->full_bus_master_rx) in vortex_down()
2713 if (vp->full_bus_master_tx) in vortex_down()
2716 if (final_down && VORTEX_PCI(vp)) { in vortex_down()
2717 vp->pm_state_valid = 1; in vortex_down()
2718 pci_save_state(VORTEX_PCI(vp)); in vortex_down()
2726 struct vortex_private *vp = netdev_priv(dev); in vortex_close() local
2727 void __iomem *ioaddr = vp->ioaddr; in vortex_close()
2738 dev->name, vp->rx_nocopy, vp->rx_copy, vp->queued_packet, vp->rx_csumhits); in vortex_close()
2742 if (vp->rx_csumhits && in vortex_close()
2743 (vp->drv_flags & HAS_HWCKSM) == 0 && in vortex_close()
2744 (vp->card_idx >= MAX_UNITS || hw_checksums[vp->card_idx] == -1)) { in vortex_close()
2752 if (vp->full_bus_master_rx) { /* Free Boomerang bus master Rx buffers. */ in vortex_close()
2754 if (vp->rx_skbuff[i]) { in vortex_close()
2755 dma_unmap_single(vp->gendev, le32_to_cpu(vp->rx_ring[i].addr), in vortex_close()
2757 dev_kfree_skb(vp->rx_skbuff[i]); in vortex_close()
2758 vp->rx_skbuff[i] = NULL; in vortex_close()
2761 if (vp->full_bus_master_tx) { /* Free Boomerang bus master Tx buffers. */ in vortex_close()
2763 if (vp->tx_skbuff[i]) { in vortex_close()
2764 struct sk_buff *skb = vp->tx_skbuff[i]; in vortex_close()
2769 dma_unmap_single(vp->gendev, in vortex_close()
2770 le32_to_cpu(vp->tx_ring[i].frag[k].addr), in vortex_close()
2771 le32_to_cpu(vp->tx_ring[i].frag[k].length)&0xFFF, in vortex_close()
2774 dma_unmap_single(vp->gendev, le32_to_cpu(vp->tx_ring[i].addr), skb->len, DMA_TO_DEVICE); in vortex_close()
2777 vp->tx_skbuff[i] = NULL; in vortex_close()
2789 struct vortex_private *vp = netdev_priv(dev); in dump_tx_ring() local
2790 void __iomem *ioaddr = vp->ioaddr; in dump_tx_ring()
2792 if (vp->full_bus_master_tx) { in dump_tx_ring()
2797 vp->full_bus_master_tx, in dump_tx_ring()
2798 vp->dirty_tx, vp->dirty_tx % TX_RING_SIZE, in dump_tx_ring()
2799 vp->cur_tx, vp->cur_tx % TX_RING_SIZE); in dump_tx_ring()
2802 &vp->tx_ring[vp->dirty_tx % TX_RING_SIZE]); in dump_tx_ring()
2808 length = le32_to_cpu(vp->tx_ring[i].frag[0].length); in dump_tx_ring()
2810 length = le32_to_cpu(vp->tx_ring[i].length); in dump_tx_ring()
2813 i, &vp->tx_ring[i], length, in dump_tx_ring()
2814 le32_to_cpu(vp->tx_ring[i].status)); in dump_tx_ring()
2824 struct vortex_private *vp = netdev_priv(dev); in vortex_get_stats() local
2825 void __iomem *ioaddr = vp->ioaddr; in vortex_get_stats()
2829 spin_lock_irqsave (&vp->lock, flags); in vortex_get_stats()
2831 spin_unlock_irqrestore (&vp->lock, flags); in vortex_get_stats()
2845 struct vortex_private *vp = netdev_priv(dev); in update_stats() local
2849 dev->stats.tx_carrier_errors += window_read8(vp, 6, 0); in update_stats()
2850 dev->stats.tx_heartbeat_errors += window_read8(vp, 6, 1); in update_stats()
2851 dev->stats.tx_window_errors += window_read8(vp, 6, 4); in update_stats()
2852 dev->stats.rx_fifo_errors += window_read8(vp, 6, 5); in update_stats()
2853 dev->stats.tx_packets += window_read8(vp, 6, 6); in update_stats()
2854 dev->stats.tx_packets += (window_read8(vp, 6, 9) & in update_stats()
2856 /* Rx packets */ window_read8(vp, 6, 7); /* Must read to clear */ in update_stats()
2860 dev->stats.rx_bytes += window_read16(vp, 6, 10); in update_stats()
2861 dev->stats.tx_bytes += window_read16(vp, 6, 12); in update_stats()
2863 vp->xstats.tx_multiple_collisions += window_read8(vp, 6, 2); in update_stats()
2864 vp->xstats.tx_single_collisions += window_read8(vp, 6, 3); in update_stats()
2865 vp->xstats.tx_deferred += window_read8(vp, 6, 8); in update_stats()
2866 vp->xstats.rx_bad_ssd += window_read8(vp, 4, 12); in update_stats()
2868 dev->stats.collisions = vp->xstats.tx_multiple_collisions in update_stats()
2869 + vp->xstats.tx_single_collisions in update_stats()
2870 + vp->xstats.tx_max_collisions; in update_stats()
2873 u8 up = window_read8(vp, 4, 13); in update_stats()
2881 struct vortex_private *vp = netdev_priv(dev); in vortex_nway_reset() local
2883 return mii_nway_restart(&vp->mii); in vortex_nway_reset()
2889 struct vortex_private *vp = netdev_priv(dev); in vortex_get_link_ksettings() local
2891 mii_ethtool_get_link_ksettings(&vp->mii, cmd); in vortex_get_link_ksettings()
2899 struct vortex_private *vp = netdev_priv(dev); in vortex_set_link_ksettings() local
2901 return mii_ethtool_set_link_ksettings(&vp->mii, cmd); in vortex_set_link_ksettings()
2927 struct vortex_private *vp = netdev_priv(dev); in vortex_get_ethtool_stats() local
2928 void __iomem *ioaddr = vp->ioaddr; in vortex_get_ethtool_stats()
2931 spin_lock_irqsave(&vp->lock, flags); in vortex_get_ethtool_stats()
2933 spin_unlock_irqrestore(&vp->lock, flags); in vortex_get_ethtool_stats()
2935 data[0] = vp->xstats.tx_deferred; in vortex_get_ethtool_stats()
2936 data[1] = vp->xstats.tx_max_collisions; in vortex_get_ethtool_stats()
2937 data[2] = vp->xstats.tx_multiple_collisions; in vortex_get_ethtool_stats()
2938 data[3] = vp->xstats.tx_single_collisions; in vortex_get_ethtool_stats()
2939 data[4] = vp->xstats.rx_bad_ssd; in vortex_get_ethtool_stats()
2958 struct vortex_private *vp = netdev_priv(dev); in vortex_get_drvinfo() local
2961 if (VORTEX_PCI(vp)) { in vortex_get_drvinfo()
2962 strlcpy(info->bus_info, pci_name(VORTEX_PCI(vp)), in vortex_get_drvinfo()
2965 if (VORTEX_EISA(vp)) in vortex_get_drvinfo()
2966 strlcpy(info->bus_info, dev_name(vp->gendev), in vortex_get_drvinfo()
2976 struct vortex_private *vp = netdev_priv(dev); in vortex_get_wol() local
2978 if (!VORTEX_PCI(vp)) in vortex_get_wol()
2984 if (vp->enable_wol) in vortex_get_wol()
2990 struct vortex_private *vp = netdev_priv(dev); in vortex_set_wol() local
2992 if (!VORTEX_PCI(vp)) in vortex_set_wol()
2999 vp->enable_wol = 1; in vortex_set_wol()
3001 vp->enable_wol = 0; in vortex_set_wol()
3030 struct vortex_private *vp = netdev_priv(dev); in vortex_ioctl() local
3033 if(VORTEX_PCI(vp)) in vortex_ioctl()
3034 state = VORTEX_PCI(vp)->current_state; in vortex_ioctl()
3039 pci_set_power_state(VORTEX_PCI(vp), PCI_D0); in vortex_ioctl()
3040 err = generic_mii_ioctl(&vp->mii, if_mii(rq), cmd, NULL); in vortex_ioctl()
3042 pci_set_power_state(VORTEX_PCI(vp), state); in vortex_ioctl()
3054 struct vortex_private *vp = netdev_priv(dev); in set_rx_mode() local
3055 void __iomem *ioaddr = vp->ioaddr; in set_rx_mode()
3080 struct vortex_private *vp = netdev_priv(dev); in set_8021q_mode() local
3083 if ((vp->drv_flags&IS_CYCLONE) || (vp->drv_flags&IS_TORNADO)) { in set_8021q_mode()
3091 window_write16(vp, max_pkt_size, 3, Wn3_MaxPktSize); in set_8021q_mode()
3095 window_write16(vp, VLAN_ETHER_TYPE, 7, Wn7_VlanEtherType); in set_8021q_mode()
3099 vp->large_frames = dev->mtu > 1500 || enable; in set_8021q_mode()
3101 mac_ctrl = window_read16(vp, 3, Wn3_MAC_Ctrl); in set_8021q_mode()
3102 if (vp->large_frames) in set_8021q_mode()
3106 window_write16(vp, mac_ctrl, 3, Wn3_MAC_Ctrl); in set_8021q_mode()
3126 static void mdio_delay(struct vortex_private *vp) in mdio_delay() argument
3128 window_read32(vp, 4, Wn4_PhysicalMgmt); in mdio_delay()
3140 static void mdio_sync(struct vortex_private *vp, int bits) in mdio_sync() argument
3144 window_write16(vp, MDIO_DATA_WRITE1, 4, Wn4_PhysicalMgmt); in mdio_sync()
3145 mdio_delay(vp); in mdio_sync()
3146 window_write16(vp, MDIO_DATA_WRITE1 | MDIO_SHIFT_CLK, in mdio_sync()
3148 mdio_delay(vp); in mdio_sync()
3155 struct vortex_private *vp = netdev_priv(dev); in mdio_read() local
3159 spin_lock_bh(&vp->mii_lock); in mdio_read()
3162 mdio_sync(vp, 32); in mdio_read()
3167 window_write16(vp, dataval, 4, Wn4_PhysicalMgmt); in mdio_read()
3168 mdio_delay(vp); in mdio_read()
3169 window_write16(vp, dataval | MDIO_SHIFT_CLK, in mdio_read()
3171 mdio_delay(vp); in mdio_read()
3175 window_write16(vp, MDIO_ENB_IN, 4, Wn4_PhysicalMgmt); in mdio_read()
3176 mdio_delay(vp); in mdio_read()
3178 ((window_read16(vp, 4, Wn4_PhysicalMgmt) & in mdio_read()
3180 window_write16(vp, MDIO_ENB_IN | MDIO_SHIFT_CLK, in mdio_read()
3182 mdio_delay(vp); in mdio_read()
3185 spin_unlock_bh(&vp->mii_lock); in mdio_read()
3192 struct vortex_private *vp = netdev_priv(dev); in mdio_write() local
3196 spin_lock_bh(&vp->mii_lock); in mdio_write()
3199 mdio_sync(vp, 32); in mdio_write()
3204 window_write16(vp, dataval, 4, Wn4_PhysicalMgmt); in mdio_write()
3205 mdio_delay(vp); in mdio_write()
3206 window_write16(vp, dataval | MDIO_SHIFT_CLK, in mdio_write()
3208 mdio_delay(vp); in mdio_write()
3212 window_write16(vp, MDIO_ENB_IN, 4, Wn4_PhysicalMgmt); in mdio_write()
3213 mdio_delay(vp); in mdio_write()
3214 window_write16(vp, MDIO_ENB_IN | MDIO_SHIFT_CLK, in mdio_write()
3216 mdio_delay(vp); in mdio_write()
3219 spin_unlock_bh(&vp->mii_lock); in mdio_write()
3226 struct vortex_private *vp = netdev_priv(dev); in acpi_set_WOL() local
3227 void __iomem *ioaddr = vp->ioaddr; in acpi_set_WOL()
3229 device_set_wakeup_enable(vp->gendev, vp->enable_wol); in acpi_set_WOL()
3231 if (vp->enable_wol) { in acpi_set_WOL()
3233 window_write16(vp, 2, 7, 0x0c); in acpi_set_WOL()
3238 if (pci_enable_wake(VORTEX_PCI(vp), PCI_D3hot, 1)) { in acpi_set_WOL()
3239 pr_info("%s: WOL not supported.\n", pci_name(VORTEX_PCI(vp))); in acpi_set_WOL()
3241 vp->enable_wol = 0; in acpi_set_WOL()
3245 if (VORTEX_PCI(vp)->current_state < PCI_D3hot) in acpi_set_WOL()
3249 pci_set_power_state(VORTEX_PCI(vp), PCI_D3hot); in acpi_set_WOL()
3257 struct vortex_private *vp; in vortex_remove_one() local
3264 vp = netdev_priv(dev); in vortex_remove_one()
3266 if (vp->cb_fn_base) in vortex_remove_one()
3267 pci_iounmap(pdev, vp->cb_fn_base); in vortex_remove_one()
3272 if (vp->pm_state_valid) in vortex_remove_one()
3277 iowrite16(TotalReset | ((vp->drv_flags & EEPROM_RESET) ? 0x04 : 0x14), in vortex_remove_one()
3278 vp->ioaddr + EL3_CMD); in vortex_remove_one()
3280 pci_iounmap(pdev, vp->ioaddr); in vortex_remove_one()
3285 vp->rx_ring, vp->rx_ring_dma); in vortex_remove_one()