• Home
  • Raw
  • Download

Lines Matching +full:eoc +full:- +full:level

8  *  (C) 1997-1998 Caldera, Inc.
10 * (C) 1999-2001 Torben Mathiasen
21 * Level One, LXT901 and LXT970 Data Sheets
39 #include <linux/dma-mapping.h>
63 MODULE_PARM_DESC(aui, "ThunderLAN use AUI port(s) (0-1)");
65 "ThunderLAN duplex setting(s) (0-default, 1-half, 2-full)");
85 "10BaseT-HD", "10BaseT-FD", "100baseTx-HD",
86 "100BaseTx-FD", "100BaseT4", NULL
97 { "Compaq Integrated NetFlex-3/P", TLAN_ADAPTER_NONE, 0x83 },
98 { "Compaq NetFlex-3/P",
100 { "Compaq NetFlex-3/P", TLAN_ADAPTER_NONE, 0x83 },
107 { "Olicom OC-2183/2185", TLAN_ADAPTER_USE_INTERN_10, 0x83 },
108 { "Olicom OC-2325", TLAN_ADAPTER_ACTIVITY_LED |
110 { "Olicom OC-2326", TLAN_ADAPTER_ACTIVITY_LED |
114 { "Compaq NetFlex-3/E",
117 { "Compaq NetFlex-3/E",
219 tag->buffer[9].address = addr; in tlan_store_skb()
220 tag->buffer[8].address = upper_32_bits(addr); in tlan_store_skb()
228 addr = tag->buffer[9].address; in tlan_get_skb()
229 addr |= ((unsigned long) tag->buffer[8].address << 16) << 16; in tlan_get_skb()
252 spin_lock_irqsave(&priv->lock, flags); in tlan_set_timer()
253 if (priv->timer.function != NULL && in tlan_set_timer()
254 priv->timer_type != TLAN_TIMER_ACTIVITY) { in tlan_set_timer()
256 spin_unlock_irqrestore(&priv->lock, flags); in tlan_set_timer()
259 priv->timer.function = tlan_timer; in tlan_set_timer()
261 spin_unlock_irqrestore(&priv->lock, flags); in tlan_set_timer()
263 priv->timer_set_at = jiffies; in tlan_set_timer()
264 priv->timer_type = type; in tlan_set_timer()
265 mod_timer(&priv->timer, jiffies + ticks); in tlan_set_timer()
307 if (priv->dma_storage) { in tlan_remove_one()
308 dma_free_coherent(&priv->pci_dev->dev, priv->dma_size, in tlan_remove_one()
309 priv->dma_storage, priv->dma_storage_dma); in tlan_remove_one()
316 cancel_work_sync(&priv->tlan_tqueue); in tlan_remove_one()
335 del_timer_sync(&priv->media_timer); in tlan_stop()
337 outl(TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD); in tlan_stop()
340 if (priv->timer.function != NULL) { in tlan_stop()
341 del_timer_sync(&priv->timer); in tlan_stop()
342 priv->timer.function = NULL; in tlan_stop()
381 int rc = -ENODEV; in tlan_probe()
404 rc = -ENODEV; in tlan_probe()
419 return tlan_probe1(pdev, -1, -1, 0, ent); in tlan_init_one()
449 int reg, rc = -ENODEV; in tlan_probe1()
467 rc = -ENOMEM; in tlan_probe1()
470 SET_NETDEV_DEV(dev, &pdev->dev); in tlan_probe1()
474 priv->pci_dev = pdev; in tlan_probe1()
475 priv->dev = dev; in tlan_probe1()
481 priv->adapter = &board_info[ent->driver_data]; in tlan_probe1()
483 rc = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); in tlan_probe1()
500 rc = -EIO; in tlan_probe1()
504 dev->base_addr = pci_io_base; in tlan_probe1()
505 dev->irq = pdev->irq; in tlan_probe1()
506 priv->adapter_rev = pdev->revision; in tlan_probe1()
515 priv->adapter = &board_info[13]; /* NetFlex-3/E */ in tlan_probe1()
516 priv->adapter_rev = 23; /* TLAN 2.3 */ in tlan_probe1()
518 priv->adapter = &board_info[14]; in tlan_probe1()
519 priv->adapter_rev = 10; /* TLAN 1.0 */ in tlan_probe1()
521 dev->base_addr = ioaddr; in tlan_probe1()
522 dev->irq = irq; in tlan_probe1()
526 if (dev->mem_start) { in tlan_probe1()
527 priv->aui = dev->mem_start & 0x01; in tlan_probe1()
528 priv->duplex = ((dev->mem_start & 0x06) == 0x06) ? 0 in tlan_probe1()
529 : (dev->mem_start & 0x06) >> 1; in tlan_probe1()
530 priv->speed = ((dev->mem_start & 0x18) == 0x18) ? 0 in tlan_probe1()
531 : (dev->mem_start & 0x18) >> 3; in tlan_probe1()
533 if (priv->speed == 0x1) in tlan_probe1()
534 priv->speed = TLAN_SPEED_10; in tlan_probe1()
535 else if (priv->speed == 0x2) in tlan_probe1()
536 priv->speed = TLAN_SPEED_100; in tlan_probe1()
538 debug = priv->debug = dev->mem_end; in tlan_probe1()
540 priv->aui = aui[boards_found]; in tlan_probe1()
541 priv->speed = speed[boards_found]; in tlan_probe1()
542 priv->duplex = duplex[boards_found]; in tlan_probe1()
543 priv->debug = debug; in tlan_probe1()
548 INIT_WORK(&priv->tlan_tqueue, tlan_tx_timeout_work); in tlan_probe1()
550 spin_lock_init(&priv->lock); in tlan_probe1()
572 priv->next_device = tlan_eisa_devices; in tlan_probe1()
578 (int)dev->irq, in tlan_probe1()
579 (int)dev->base_addr, in tlan_probe1()
580 priv->adapter->device_label, in tlan_probe1()
581 priv->adapter_rev); in tlan_probe1()
585 dma_free_coherent(&priv->pci_dev->dev, priv->dma_size, in tlan_probe1()
586 priv->dma_storage, priv->dma_storage_dma); in tlan_probe1()
609 if (priv->dma_storage) { in tlan_eisa_cleanup()
610 dma_free_coherent(&priv->pci_dev->dev, priv->dma_size, in tlan_eisa_cleanup()
611 priv->dma_storage, in tlan_eisa_cleanup()
612 priv->dma_storage_dma); in tlan_eisa_cleanup()
614 release_region(dev->base_addr, 0x10); in tlan_eisa_cleanup()
616 tlan_eisa_devices = priv->next_device; in tlan_eisa_cleanup()
618 tlan_have_eisa--; in tlan_eisa_cleanup()
739 disable_irq(dev->irq); in tlan_poll()
740 tlan_handle_interrupt(dev->irq, dev); in tlan_poll()
741 enable_irq(dev->irq); in tlan_poll()
765 strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); in tlan_get_drvinfo()
766 if (priv->pci_dev) in tlan_get_drvinfo()
767 strlcpy(info->bus_info, pci_name(priv->pci_dev), in tlan_get_drvinfo()
768 sizeof(info->bus_info)); in tlan_get_drvinfo()
770 strlcpy(info->bus_info, "EISA", sizeof(info->bus_info)); in tlan_get_drvinfo()
785 return -EIO; in tlan_get_eeprom()
825 priv->dma_storage = dma_alloc_coherent(&priv->pci_dev->dev, dma_size, in tlan_init()
826 &priv->dma_storage_dma, GFP_KERNEL); in tlan_init()
827 priv->dma_size = dma_size; in tlan_init()
829 if (priv->dma_storage == NULL) { in tlan_init()
831 dev->name); in tlan_init()
832 return -ENOMEM; in tlan_init()
834 priv->rx_list = (struct tlan_list *) in tlan_init()
835 ALIGN((unsigned long)priv->dma_storage, 8); in tlan_init()
836 priv->rx_list_dma = ALIGN(priv->dma_storage_dma, 8); in tlan_init()
837 priv->tx_list = priv->rx_list + TLAN_NUM_RX_LISTS; in tlan_init()
838 priv->tx_list_dma = in tlan_init()
839 priv->rx_list_dma + sizeof(struct tlan_list)*TLAN_NUM_RX_LISTS; in tlan_init()
844 (u8) priv->adapter->addr_ofs + i, in tlan_init()
845 (u8 *) &dev->dev_addr[i]); in tlan_init()
848 dev->name, err); in tlan_init()
850 /* Olicom OC-2325/OC-2326 have the address byte-swapped */ in tlan_init()
851 if (priv->adapter->addr_ofs == 0xf8) { in tlan_init()
853 char tmp = dev->dev_addr[i]; in tlan_init()
854 dev->dev_addr[i] = dev->dev_addr[i + 1]; in tlan_init()
855 dev->dev_addr[i + 1] = tmp; in tlan_init()
862 dev->netdev_ops = &tlan_netdev_ops; in tlan_init()
863 dev->ethtool_ops = &tlan_ethtool_ops; in tlan_init()
864 dev->watchdog_timeo = TX_TIMEOUT; in tlan_init()
895 priv->tlan_rev = tlan_dio_read8(dev->base_addr, TLAN_DEF_REVISION); in tlan_open()
896 err = request_irq(dev->irq, tlan_handle_interrupt, IRQF_SHARED, in tlan_open()
897 dev->name, dev); in tlan_open()
901 dev->irq); in tlan_open()
905 timer_setup(&priv->timer, NULL, 0); in tlan_open()
906 timer_setup(&priv->media_timer, tlan_phy_monitor, 0); in tlan_open()
911 dev->name, priv->tlan_rev); in tlan_open()
938 u32 phy = priv->phy[priv->phy_num]; in tlan_ioctl()
940 if (!priv->phy_online) in tlan_ioctl()
941 return -EAGAIN; in tlan_ioctl()
945 data->phy_id = phy; in tlan_ioctl()
950 tlan_mii_read_reg(dev, data->phy_id & 0x1f, in tlan_ioctl()
951 data->reg_num & 0x1f, &data->val_out); in tlan_ioctl()
956 tlan_mii_write_reg(dev, data->phy_id & 0x1f, in tlan_ioctl()
957 data->reg_num & 0x1f, data->val_in); in tlan_ioctl()
960 return -EOPNOTSUPP; in tlan_ioctl()
979 TLAN_DBG(TLAN_DEBUG_GNRL, "%s: Transmit timed out.\n", dev->name); in tlan_tx_timeout()
1007 tlan_tx_timeout(priv->dev, UINT_MAX); in tlan_tx_timeout_work()
1016 * 0 on success, non-zero on failure.
1041 if (!priv->phy_online) { in tlan_start_tx()
1043 dev->name); in tlan_start_tx()
1050 txlen = max(skb->len, (unsigned int)TLAN_MIN_FRAME_SIZE); in tlan_start_tx()
1052 tail_list = priv->tx_list + priv->tx_tail; in tlan_start_tx()
1054 priv->tx_list_dma + sizeof(struct tlan_list)*priv->tx_tail; in tlan_start_tx()
1056 if (tail_list->c_stat != TLAN_CSTAT_UNUSED) { in tlan_start_tx()
1059 dev->name, priv->tx_head, priv->tx_tail); in tlan_start_tx()
1061 priv->tx_busy_count++; in tlan_start_tx()
1065 tail_list->forward = 0; in tlan_start_tx()
1067 tail_list->buffer[0].address = dma_map_single(&priv->pci_dev->dev, in tlan_start_tx()
1068 skb->data, txlen, in tlan_start_tx()
1072 tail_list->frame_size = (u16) txlen; in tlan_start_tx()
1073 tail_list->buffer[0].count = TLAN_LAST_BUFFER | (u32) txlen; in tlan_start_tx()
1074 tail_list->buffer[1].count = 0; in tlan_start_tx()
1075 tail_list->buffer[1].address = 0; in tlan_start_tx()
1077 spin_lock_irqsave(&priv->lock, flags); in tlan_start_tx()
1078 tail_list->c_stat = TLAN_CSTAT_READY; in tlan_start_tx()
1079 if (!priv->tx_in_progress) { in tlan_start_tx()
1080 priv->tx_in_progress = 1; in tlan_start_tx()
1083 priv->tx_tail); in tlan_start_tx()
1084 outl(tail_list_phys, dev->base_addr + TLAN_CH_PARM); in tlan_start_tx()
1085 outl(TLAN_HC_GO, dev->base_addr + TLAN_HOST_CMD); in tlan_start_tx()
1089 priv->tx_tail); in tlan_start_tx()
1090 if (priv->tx_tail == 0) { in tlan_start_tx()
1091 (priv->tx_list + (TLAN_NUM_TX_LISTS - 1))->forward in tlan_start_tx()
1094 (priv->tx_list + (priv->tx_tail - 1))->forward in tlan_start_tx()
1098 spin_unlock_irqrestore(&priv->lock, flags); in tlan_start_tx()
1100 CIRC_INC(priv->tx_tail, TLAN_NUM_TX_LISTS); in tlan_start_tx()
1125 * re-enabling adapter interrupts.
1136 spin_lock(&priv->lock); in tlan_handle_interrupt()
1138 host_int = inw(dev->base_addr + TLAN_HOST_INT); in tlan_handle_interrupt()
1144 outw(host_int, dev->base_addr + TLAN_HOST_INT); in tlan_handle_interrupt()
1149 outl(host_cmd, dev->base_addr + TLAN_HOST_CMD); in tlan_handle_interrupt()
1153 spin_unlock(&priv->lock); in tlan_handle_interrupt()
1180 free_irq(dev->irq, dev); in tlan_close()
1182 TLAN_DBG(TLAN_DEBUG_GNRL, "Device %s closed.\n", dev->name); in tlan_close()
1214 TLAN_DBG(TLAN_DEBUG_RX, "RECEIVE: %s EOC count = %d\n", dev->name, in tlan_get_stats()
1215 priv->rx_eoc_count); in tlan_get_stats()
1216 TLAN_DBG(TLAN_DEBUG_TX, "TRANSMIT: %s Busy count = %d\n", dev->name, in tlan_get_stats()
1217 priv->tx_busy_count); in tlan_get_stats()
1219 tlan_print_dio(dev->base_addr); in tlan_get_stats()
1224 tlan_print_list(priv->rx_list + i, "RX", i); in tlan_get_stats()
1226 tlan_print_list(priv->tx_list + i, "TX", i); in tlan_get_stats()
1229 return &dev->stats; in tlan_get_stats()
1251 * stored in AREG_1-3, and the rest are selected via the
1265 if (dev->flags & IFF_PROMISC) { in tlan_set_multicast_list()
1266 tmp = tlan_dio_read8(dev->base_addr, TLAN_NET_CMD); in tlan_set_multicast_list()
1267 tlan_dio_write8(dev->base_addr, in tlan_set_multicast_list()
1270 tmp = tlan_dio_read8(dev->base_addr, TLAN_NET_CMD); in tlan_set_multicast_list()
1271 tlan_dio_write8(dev->base_addr, in tlan_set_multicast_list()
1273 if (dev->flags & IFF_ALLMULTI) { in tlan_set_multicast_list()
1276 tlan_dio_write32(dev->base_addr, TLAN_HASH_1, in tlan_set_multicast_list()
1278 tlan_dio_write32(dev->base_addr, TLAN_HASH_2, in tlan_set_multicast_list()
1285 (char *) &ha->addr); in tlan_set_multicast_list()
1288 tlan_hash_func((u8 *)&ha->addr); in tlan_set_multicast_list()
1292 hash2 |= (1 << (offset - 32)); in tlan_set_multicast_list()
1298 tlan_dio_write32(dev->base_addr, TLAN_HASH_1, hash1); in tlan_set_multicast_list()
1299 tlan_dio_write32(dev->base_addr, TLAN_HASH_2, hash2); in tlan_set_multicast_list()
1337 * in the channel (EOC), then the function checks to see if
1347 int eoc = 0; in tlan_handle_tx_eof() local
1355 priv->tx_head, priv->tx_tail); in tlan_handle_tx_eof()
1356 head_list = priv->tx_list + priv->tx_head; in tlan_handle_tx_eof()
1358 while (((tmp_c_stat = head_list->c_stat) & TLAN_CSTAT_FRM_CMP) in tlan_handle_tx_eof()
1363 dma_unmap_single(&priv->pci_dev->dev, in tlan_handle_tx_eof()
1364 head_list->buffer[0].address, in tlan_handle_tx_eof()
1365 max(skb->len, (unsigned int)TLAN_MIN_FRAME_SIZE), in tlan_handle_tx_eof()
1368 head_list->buffer[8].address = 0; in tlan_handle_tx_eof()
1369 head_list->buffer[9].address = 0; in tlan_handle_tx_eof()
1372 eoc = 1; in tlan_handle_tx_eof()
1374 dev->stats.tx_bytes += head_list->frame_size; in tlan_handle_tx_eof()
1376 head_list->c_stat = TLAN_CSTAT_UNUSED; in tlan_handle_tx_eof()
1378 CIRC_INC(priv->tx_head, TLAN_NUM_TX_LISTS); in tlan_handle_tx_eof()
1379 head_list = priv->tx_list + priv->tx_head; in tlan_handle_tx_eof()
1386 if (eoc) { in tlan_handle_tx_eof()
1388 "TRANSMIT: handling TX EOC (Head=%d Tail=%d)\n", in tlan_handle_tx_eof()
1389 priv->tx_head, priv->tx_tail); in tlan_handle_tx_eof()
1390 head_list = priv->tx_list + priv->tx_head; in tlan_handle_tx_eof()
1391 head_list_phys = priv->tx_list_dma in tlan_handle_tx_eof()
1392 + sizeof(struct tlan_list)*priv->tx_head; in tlan_handle_tx_eof()
1393 if ((head_list->c_stat & TLAN_CSTAT_READY) in tlan_handle_tx_eof()
1395 outl(head_list_phys, dev->base_addr + TLAN_CH_PARM); in tlan_handle_tx_eof()
1398 priv->tx_in_progress = 0; in tlan_handle_tx_eof()
1402 if (priv->adapter->flags & TLAN_ADAPTER_ACTIVITY_LED) { in tlan_handle_tx_eof()
1403 tlan_dio_write8(dev->base_addr, in tlan_handle_tx_eof()
1405 if (priv->timer.function == NULL) { in tlan_handle_tx_eof()
1406 priv->timer.function = tlan_timer; in tlan_handle_tx_eof()
1407 priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY; in tlan_handle_tx_eof()
1408 priv->timer_set_at = jiffies; in tlan_handle_tx_eof()
1409 priv->timer_type = TLAN_TIMER_ACTIVITY; in tlan_handle_tx_eof()
1410 add_timer(&priv->timer); in tlan_handle_tx_eof()
1411 } else if (priv->timer_type == TLAN_TIMER_ACTIVITY) { in tlan_handle_tx_eof()
1412 priv->timer_set_at = jiffies; in tlan_handle_tx_eof()
1470 * channel (EOC), the function restarts the receive channel
1480 int eoc = 0; in tlan_handle_rx_eof() local
1488 priv->rx_head, priv->rx_tail); in tlan_handle_rx_eof()
1489 head_list = priv->rx_list + priv->rx_head; in tlan_handle_rx_eof()
1491 priv->rx_list_dma + sizeof(struct tlan_list)*priv->rx_head; in tlan_handle_rx_eof()
1493 while (((tmp_c_stat = head_list->c_stat) & TLAN_CSTAT_FRM_CMP) in tlan_handle_rx_eof()
1495 dma_addr_t frame_dma = head_list->buffer[0].address; in tlan_handle_rx_eof()
1496 u32 frame_size = head_list->frame_size; in tlan_handle_rx_eof()
1501 eoc = 1; in tlan_handle_rx_eof()
1509 dma_unmap_single(&priv->pci_dev->dev, frame_dma, in tlan_handle_rx_eof()
1513 dev->stats.rx_bytes += frame_size; in tlan_handle_rx_eof()
1515 skb->protocol = eth_type_trans(skb, dev); in tlan_handle_rx_eof()
1518 head_list->buffer[0].address = in tlan_handle_rx_eof()
1519 dma_map_single(&priv->pci_dev->dev, new_skb->data, in tlan_handle_rx_eof()
1524 head_list->forward = 0; in tlan_handle_rx_eof()
1525 head_list->c_stat = 0; in tlan_handle_rx_eof()
1526 tail_list = priv->rx_list + priv->rx_tail; in tlan_handle_rx_eof()
1527 tail_list->forward = head_list_phys; in tlan_handle_rx_eof()
1529 CIRC_INC(priv->rx_head, TLAN_NUM_RX_LISTS); in tlan_handle_rx_eof()
1530 CIRC_INC(priv->rx_tail, TLAN_NUM_RX_LISTS); in tlan_handle_rx_eof()
1531 head_list = priv->rx_list + priv->rx_head; in tlan_handle_rx_eof()
1532 head_list_phys = priv->rx_list_dma in tlan_handle_rx_eof()
1533 + sizeof(struct tlan_list)*priv->rx_head; in tlan_handle_rx_eof()
1541 if (eoc) { in tlan_handle_rx_eof()
1543 "RECEIVE: handling RX EOC (Head=%d Tail=%d)\n", in tlan_handle_rx_eof()
1544 priv->rx_head, priv->rx_tail); in tlan_handle_rx_eof()
1545 head_list = priv->rx_list + priv->rx_head; in tlan_handle_rx_eof()
1546 head_list_phys = priv->rx_list_dma in tlan_handle_rx_eof()
1547 + sizeof(struct tlan_list)*priv->rx_head; in tlan_handle_rx_eof()
1548 outl(head_list_phys, dev->base_addr + TLAN_CH_PARM); in tlan_handle_rx_eof()
1550 priv->rx_eoc_count++; in tlan_handle_rx_eof()
1553 if (priv->adapter->flags & TLAN_ADAPTER_ACTIVITY_LED) { in tlan_handle_rx_eof()
1554 tlan_dio_write8(dev->base_addr, in tlan_handle_rx_eof()
1556 if (priv->timer.function == NULL) { in tlan_handle_rx_eof()
1557 priv->timer.function = tlan_timer; in tlan_handle_rx_eof()
1558 priv->timer.expires = jiffies + TLAN_TIMER_ACT_DELAY; in tlan_handle_rx_eof()
1559 priv->timer_set_at = jiffies; in tlan_handle_rx_eof()
1560 priv->timer_type = TLAN_TIMER_ACTIVITY; in tlan_handle_rx_eof()
1561 add_timer(&priv->timer); in tlan_handle_rx_eof()
1562 } else if (priv->timer_type == TLAN_TIMER_ACTIVITY) { in tlan_handle_rx_eof()
1563 priv->timer_set_at = jiffies; in tlan_handle_rx_eof()
1612 * This driver is structured to determine EOC occurrences by
1613 * reading the CSTAT member of the list structure. Tx EOC
1616 * functionality, so process EOC events if this is the
1628 if (priv->tlan_rev < 0x30) { in tlan_handle_tx_eoc()
1630 "TRANSMIT: handling TX EOC (Head=%d Tail=%d) -- IRQ\n", in tlan_handle_tx_eoc()
1631 priv->tx_head, priv->tx_tail); in tlan_handle_tx_eoc()
1632 head_list = priv->tx_list + priv->tx_head; in tlan_handle_tx_eoc()
1633 head_list_phys = priv->tx_list_dma in tlan_handle_tx_eoc()
1634 + sizeof(struct tlan_list)*priv->tx_head; in tlan_handle_tx_eoc()
1635 if ((head_list->c_stat & TLAN_CSTAT_READY) in tlan_handle_tx_eoc()
1638 outl(head_list_phys, dev->base_addr + TLAN_CH_PARM); in tlan_handle_tx_eoc()
1641 priv->tx_in_progress = 0; in tlan_handle_tx_eoc()
1685 error = inl(dev->base_addr + TLAN_CH_PARM); in tlan_handle_status_check()
1688 outl(TLAN_HC_AD_RST, dev->base_addr + TLAN_HOST_CMD); in tlan_handle_status_check()
1690 schedule_work(&priv->tlan_tqueue); in tlan_handle_status_check()
1695 TLAN_DBG(TLAN_DEBUG_GNRL, "%s: Status Check\n", dev->name); in tlan_handle_status_check()
1696 phy = priv->phy[priv->phy_num]; in tlan_handle_status_check()
1698 net_sts = tlan_dio_read8(dev->base_addr, TLAN_NET_STS); in tlan_handle_status_check()
1700 tlan_dio_write8(dev->base_addr, TLAN_NET_STS, net_sts); in tlan_handle_status_check()
1702 dev->name, (unsigned) net_sts); in tlan_handle_status_check()
1704 if ((net_sts & TLAN_NET_STS_MIRQ) && (priv->phy_num == 0)) { in tlan_handle_status_check()
1742 * This driver is structured to determine EOC occurrences by
1743 * reading the CSTAT member of the list structure. Rx EOC
1747 * pre-3.0, process EOC interrupts normally.
1757 if (priv->tlan_rev < 0x30) { in tlan_handle_rx_eoc()
1759 "RECEIVE: Handling RX EOC (head=%d tail=%d) -- IRQ\n", in tlan_handle_rx_eoc()
1760 priv->rx_head, priv->rx_tail); in tlan_handle_rx_eoc()
1761 head_list_phys = priv->rx_list_dma in tlan_handle_rx_eoc()
1762 + sizeof(struct tlan_list)*priv->rx_head; in tlan_handle_rx_eoc()
1763 outl(head_list_phys, dev->base_addr + TLAN_CH_PARM); in tlan_handle_rx_eoc()
1765 priv->rx_eoc_count++; in tlan_handle_rx_eoc()
1796 * - Autonegotiation requires being allowed about
1802 * PHYs were interrupt-capable like the internal
1804 * - The ACT LED, which shows adapter activity, is
1817 struct net_device *dev = priv->dev; in tlan_timer()
1821 priv->timer.function = NULL; in tlan_timer()
1823 switch (priv->timer_type) { in tlan_timer()
1843 spin_lock_irqsave(&priv->lock, flags); in tlan_timer()
1844 if (priv->timer.function == NULL) { in tlan_timer()
1845 elapsed = jiffies - priv->timer_set_at; in tlan_timer()
1847 tlan_dio_write8(dev->base_addr, in tlan_timer()
1850 priv->timer.expires = priv->timer_set_at in tlan_timer()
1852 spin_unlock_irqrestore(&priv->lock, flags); in tlan_timer()
1853 add_timer(&priv->timer); in tlan_timer()
1857 spin_unlock_irqrestore(&priv->lock, flags); in tlan_timer()
1897 priv->tx_head = 0; in tlan_reset_lists()
1898 priv->tx_tail = 0; in tlan_reset_lists()
1900 list = priv->tx_list + i; in tlan_reset_lists()
1901 list->c_stat = TLAN_CSTAT_UNUSED; in tlan_reset_lists()
1902 list->buffer[0].address = 0; in tlan_reset_lists()
1903 list->buffer[2].count = 0; in tlan_reset_lists()
1904 list->buffer[2].address = 0; in tlan_reset_lists()
1905 list->buffer[8].address = 0; in tlan_reset_lists()
1906 list->buffer[9].address = 0; in tlan_reset_lists()
1909 priv->rx_head = 0; in tlan_reset_lists()
1910 priv->rx_tail = TLAN_NUM_RX_LISTS - 1; in tlan_reset_lists()
1912 list = priv->rx_list + i; in tlan_reset_lists()
1913 list_phys = priv->rx_list_dma + sizeof(struct tlan_list)*i; in tlan_reset_lists()
1914 list->c_stat = TLAN_CSTAT_READY; in tlan_reset_lists()
1915 list->frame_size = TLAN_MAX_FRAME_SIZE; in tlan_reset_lists()
1916 list->buffer[0].count = TLAN_MAX_FRAME_SIZE | TLAN_LAST_BUFFER; in tlan_reset_lists()
1921 list->buffer[0].address = dma_map_single(&priv->pci_dev->dev, in tlan_reset_lists()
1922 skb->data, in tlan_reset_lists()
1926 list->buffer[1].count = 0; in tlan_reset_lists()
1927 list->buffer[1].address = 0; in tlan_reset_lists()
1928 list->forward = list_phys + sizeof(struct tlan_list); in tlan_reset_lists()
1933 tlan_store_skb(priv->rx_list + i, NULL); in tlan_reset_lists()
1936 list->forward = 0; in tlan_reset_lists()
1949 list = priv->tx_list + i; in tlan_free_lists()
1952 dma_unmap_single(&priv->pci_dev->dev, in tlan_free_lists()
1953 list->buffer[0].address, in tlan_free_lists()
1954 max(skb->len, (unsigned int)TLAN_MIN_FRAME_SIZE), in tlan_free_lists()
1957 list->buffer[8].address = 0; in tlan_free_lists()
1958 list->buffer[9].address = 0; in tlan_free_lists()
1963 list = priv->rx_list + i; in tlan_free_lists()
1966 dma_unmap_single(&priv->pci_dev->dev, in tlan_free_lists()
1967 list->buffer[0].address, in tlan_free_lists()
1970 list->buffer[8].address = 0; in tlan_free_lists()
1971 list->buffer[9].address = 0; in tlan_free_lists()
2034 pr_info(" Forward = 0x%08x\n", list->forward); in tlan_print_list()
2035 pr_info(" CSTAT = 0x%04hx\n", list->c_stat); in tlan_print_list()
2036 pr_info(" Frame Size = 0x%04hx\n", list->frame_size); in tlan_print_list()
2040 i, list->buffer[i].count, list->buffer[i].address); in tlan_print_list()
2074 outw(TLAN_GOOD_TX_FRMS, dev->base_addr + TLAN_DIO_ADR); in tlan_read_and_clear_stats()
2075 tx_good = inb(dev->base_addr + TLAN_DIO_DATA); in tlan_read_and_clear_stats()
2076 tx_good += inb(dev->base_addr + TLAN_DIO_DATA + 1) << 8; in tlan_read_and_clear_stats()
2077 tx_good += inb(dev->base_addr + TLAN_DIO_DATA + 2) << 16; in tlan_read_and_clear_stats()
2078 tx_under = inb(dev->base_addr + TLAN_DIO_DATA + 3); in tlan_read_and_clear_stats()
2080 outw(TLAN_GOOD_RX_FRMS, dev->base_addr + TLAN_DIO_ADR); in tlan_read_and_clear_stats()
2081 rx_good = inb(dev->base_addr + TLAN_DIO_DATA); in tlan_read_and_clear_stats()
2082 rx_good += inb(dev->base_addr + TLAN_DIO_DATA + 1) << 8; in tlan_read_and_clear_stats()
2083 rx_good += inb(dev->base_addr + TLAN_DIO_DATA + 2) << 16; in tlan_read_and_clear_stats()
2084 rx_over = inb(dev->base_addr + TLAN_DIO_DATA + 3); in tlan_read_and_clear_stats()
2086 outw(TLAN_DEFERRED_TX, dev->base_addr + TLAN_DIO_ADR); in tlan_read_and_clear_stats()
2087 def_tx = inb(dev->base_addr + TLAN_DIO_DATA); in tlan_read_and_clear_stats()
2088 def_tx += inb(dev->base_addr + TLAN_DIO_DATA + 1) << 8; in tlan_read_and_clear_stats()
2089 crc = inb(dev->base_addr + TLAN_DIO_DATA + 2); in tlan_read_and_clear_stats()
2090 code = inb(dev->base_addr + TLAN_DIO_DATA + 3); in tlan_read_and_clear_stats()
2092 outw(TLAN_MULTICOL_FRMS, dev->base_addr + TLAN_DIO_ADR); in tlan_read_and_clear_stats()
2093 multi_col = inb(dev->base_addr + TLAN_DIO_DATA); in tlan_read_and_clear_stats()
2094 multi_col += inb(dev->base_addr + TLAN_DIO_DATA + 1) << 8; in tlan_read_and_clear_stats()
2095 single_col = inb(dev->base_addr + TLAN_DIO_DATA + 2); in tlan_read_and_clear_stats()
2096 single_col += inb(dev->base_addr + TLAN_DIO_DATA + 3) << 8; in tlan_read_and_clear_stats()
2098 outw(TLAN_EXCESSCOL_FRMS, dev->base_addr + TLAN_DIO_ADR); in tlan_read_and_clear_stats()
2099 excess_col = inb(dev->base_addr + TLAN_DIO_DATA); in tlan_read_and_clear_stats()
2100 late_col = inb(dev->base_addr + TLAN_DIO_DATA + 1); in tlan_read_and_clear_stats()
2101 loss = inb(dev->base_addr + TLAN_DIO_DATA + 2); in tlan_read_and_clear_stats()
2104 dev->stats.rx_packets += rx_good; in tlan_read_and_clear_stats()
2105 dev->stats.rx_errors += rx_over + crc + code; in tlan_read_and_clear_stats()
2106 dev->stats.tx_packets += tx_good; in tlan_read_and_clear_stats()
2107 dev->stats.tx_errors += tx_under + loss; in tlan_read_and_clear_stats()
2108 dev->stats.collisions += multi_col in tlan_read_and_clear_stats()
2111 dev->stats.rx_over_errors += rx_over; in tlan_read_and_clear_stats()
2112 dev->stats.rx_crc_errors += crc; in tlan_read_and_clear_stats()
2113 dev->stats.rx_frame_errors += code; in tlan_read_and_clear_stats()
2115 dev->stats.tx_aborted_errors += tx_under; in tlan_read_and_clear_stats()
2116 dev->stats.tx_carrier_errors += loss; in tlan_read_and_clear_stats()
2134 * device. See Chap. 3, pp. 9-10 of the "ThunderLAN
2150 priv->tlan_full_duplex = false; in tlan_reset_adapter()
2151 priv->phy_online = 0; in tlan_reset_adapter()
2156 data = inl(dev->base_addr + TLAN_HOST_CMD); in tlan_reset_adapter()
2158 outl(data, dev->base_addr + TLAN_HOST_CMD); in tlan_reset_adapter()
2164 data = inl(dev->base_addr + TLAN_HOST_CMD); in tlan_reset_adapter()
2166 outl(data, dev->base_addr + TLAN_HOST_CMD); in tlan_reset_adapter()
2171 tlan_dio_write32(dev->base_addr, (u16) i, 0); in tlan_reset_adapter()
2176 tlan_dio_write16(dev->base_addr, TLAN_NET_CONFIG, (u16) data); in tlan_reset_adapter()
2180 outl(TLAN_HC_LD_TMR | 0x3f, dev->base_addr + TLAN_HOST_CMD); in tlan_reset_adapter()
2181 outl(TLAN_HC_LD_THR | 0x9, dev->base_addr + TLAN_HOST_CMD); in tlan_reset_adapter()
2185 outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR); in tlan_reset_adapter()
2186 addr = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO; in tlan_reset_adapter()
2191 if (priv->tlan_rev >= 0x30) { in tlan_reset_adapter()
2193 tlan_dio_write8(dev->base_addr, TLAN_INT_DIS, data8); in tlan_reset_adapter()
2198 if (priv->adapter->flags & TLAN_ADAPTER_BIT_RATE_PHY) { in tlan_reset_adapter()
2200 if (priv->aui == 1) { in tlan_reset_adapter()
2201 tlan_dio_write8(dev->base_addr, TLAN_ACOMMIT, 0x0a); in tlan_reset_adapter()
2202 } else if (priv->duplex == TLAN_DUPLEX_FULL) { in tlan_reset_adapter()
2203 tlan_dio_write8(dev->base_addr, TLAN_ACOMMIT, 0x00); in tlan_reset_adapter()
2204 priv->tlan_full_duplex = true; in tlan_reset_adapter()
2206 tlan_dio_write8(dev->base_addr, TLAN_ACOMMIT, 0x08); in tlan_reset_adapter()
2211 if (priv->phy_num == 0 || in tlan_reset_adapter()
2212 (priv->adapter->flags & TLAN_ADAPTER_USE_INTERN_10)) in tlan_reset_adapter()
2214 tlan_dio_write16(dev->base_addr, TLAN_NET_CONFIG, (u16) data); in tlan_reset_adapter()
2216 if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) in tlan_reset_adapter()
2240 phy = priv->phy[priv->phy_num]; in tlan_finish_reset()
2243 if (priv->tlan_full_duplex) in tlan_finish_reset()
2245 tlan_dio_write8(dev->base_addr, TLAN_NET_CMD, data); in tlan_finish_reset()
2247 if (priv->phy_num == 0) in tlan_finish_reset()
2249 tlan_dio_write8(dev->base_addr, TLAN_NET_MASK, data); in tlan_finish_reset()
2250 tlan_dio_write16(dev->base_addr, TLAN_MAX_RX, ((1536)+7)&~7); in tlan_finish_reset()
2254 if ((priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) || in tlan_finish_reset()
2255 (priv->aui)) { in tlan_finish_reset()
2272 "Link active, %s %uMbps %s-Duplex\n", in tlan_finish_reset()
2285 media[i-5]); in tlan_finish_reset()
2291 priv->media_timer.expires = jiffies + HZ; in tlan_finish_reset()
2292 add_timer(&priv->media_timer); in tlan_finish_reset()
2296 if (priv->phy_num == 0) { in tlan_finish_reset()
2300 sio = tlan_dio_read8(dev->base_addr, TLAN_NET_SIO); in tlan_finish_reset()
2302 tlan_dio_write8(dev->base_addr, TLAN_NET_SIO, sio); in tlan_finish_reset()
2306 tlan_set_mac(dev, 0, dev->dev_addr); in tlan_finish_reset()
2307 priv->phy_online = 1; in tlan_finish_reset()
2308 outb((TLAN_HC_INT_ON >> 8), dev->base_addr + TLAN_HOST_CMD + 1); in tlan_finish_reset()
2311 dev->base_addr + TLAN_HOST_CMD + 1); in tlan_finish_reset()
2312 outl(priv->rx_list_dma, dev->base_addr + TLAN_CH_PARM); in tlan_finish_reset()
2313 outl(TLAN_HC_GO | TLAN_HC_RT, dev->base_addr + TLAN_HOST_CMD); in tlan_finish_reset()
2314 tlan_dio_write8(dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK); in tlan_finish_reset()
2336 * areg The AREG to set the address in (0 - 3).
2357 tlan_dio_write8(dev->base_addr, in tlan_set_mac()
2361 tlan_dio_write8(dev->base_addr, in tlan_set_mac()
2398 phy = priv->phy[priv->phy_num]; in tlan_phy_print()
2400 if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) { in tlan_phy_print()
2447 if (priv->adapter->flags & TLAN_ADAPTER_UNMANAGED_PHY) { in tlan_phy_detect()
2448 priv->phy_num = 0xffff; in tlan_phy_detect()
2455 priv->phy[0] = TLAN_PHY_MAX_ADDR; in tlan_phy_detect()
2457 priv->phy[0] = TLAN_PHY_NONE; in tlan_phy_detect()
2459 priv->phy[1] = TLAN_PHY_NONE; in tlan_phy_detect()
2469 if ((priv->phy[1] == TLAN_PHY_NONE) && in tlan_phy_detect()
2471 priv->phy[1] = phy; in tlan_phy_detect()
2476 if (priv->phy[1] != TLAN_PHY_NONE) in tlan_phy_detect()
2477 priv->phy_num = 1; in tlan_phy_detect()
2478 else if (priv->phy[0] != TLAN_PHY_NONE) in tlan_phy_detect()
2479 priv->phy_num = 0; in tlan_phy_detect()
2493 TLAN_DBG(TLAN_DEBUG_GNRL, "%s: Powering down PHY(s).\n", dev->name); in tlan_phy_power_down()
2495 tlan_mii_sync(dev->base_addr); in tlan_phy_power_down()
2496 tlan_mii_write_reg(dev, priv->phy[priv->phy_num], MII_GEN_CTL, value); in tlan_phy_power_down()
2497 if ((priv->phy_num == 0) && (priv->phy[1] != TLAN_PHY_NONE)) { in tlan_phy_power_down()
2499 if (priv->adapter->flags & TLAN_ADAPTER_USE_INTERN_10) in tlan_phy_power_down()
2501 tlan_mii_sync(dev->base_addr); in tlan_phy_power_down()
2502 tlan_mii_write_reg(dev, priv->phy[1], MII_GEN_CTL, value); in tlan_phy_power_down()
2521 TLAN_DBG(TLAN_DEBUG_GNRL, "%s: Powering up PHY.\n", dev->name); in tlan_phy_power_up()
2522 tlan_mii_sync(dev->base_addr); in tlan_phy_power_up()
2524 tlan_mii_write_reg(dev, priv->phy[priv->phy_num], MII_GEN_CTL, value); in tlan_phy_power_up()
2525 tlan_mii_sync(dev->base_addr); in tlan_phy_power_up()
2544 phy = priv->phy[priv->phy_num]; in tlan_phy_reset()
2546 TLAN_DBG(TLAN_DEBUG_GNRL, "%s: Resetting PHY.\n", dev->name); in tlan_phy_reset()
2547 tlan_mii_sync(dev->base_addr); in tlan_phy_reset()
2579 phy = priv->phy[priv->phy_num]; in tlan_phy_start_link()
2580 TLAN_DBG(TLAN_DEBUG_GNRL, "%s: Trying to activate link.\n", dev->name); in tlan_phy_start_link()
2585 (!priv->aui)) { in tlan_phy_start_link()
2587 if (priv->speed == TLAN_SPEED_10 && in tlan_phy_start_link()
2588 priv->duplex == TLAN_DUPLEX_HALF) { in tlan_phy_start_link()
2590 } else if (priv->speed == TLAN_SPEED_10 && in tlan_phy_start_link()
2591 priv->duplex == TLAN_DUPLEX_FULL) { in tlan_phy_start_link()
2592 priv->tlan_full_duplex = true; in tlan_phy_start_link()
2594 } else if (priv->speed == TLAN_SPEED_100 && in tlan_phy_start_link()
2595 priv->duplex == TLAN_DUPLEX_HALF) { in tlan_phy_start_link()
2597 } else if (priv->speed == TLAN_SPEED_100 && in tlan_phy_start_link()
2598 priv->duplex == TLAN_DUPLEX_FULL) { in tlan_phy_start_link()
2599 priv->tlan_full_duplex = true; in tlan_phy_start_link()
2603 /* Set Auto-Neg advertisement */ in tlan_phy_start_link()
2606 /* Enablee Auto-Neg */ in tlan_phy_start_link()
2608 /* Restart Auto-Neg */ in tlan_phy_start_link()
2622 if ((priv->aui) && (priv->phy_num != 0)) { in tlan_phy_start_link()
2623 priv->phy_num = 0; in tlan_phy_start_link()
2626 tlan_dio_write16(dev->base_addr, TLAN_NET_CONFIG, data); in tlan_phy_start_link()
2629 } else if (priv->phy_num == 0) { in tlan_phy_start_link()
2632 if (priv->aui) { in tlan_phy_start_link()
2636 if (priv->duplex == TLAN_DUPLEX_FULL) { in tlan_phy_start_link()
2638 priv->tlan_full_duplex = true; in tlan_phy_start_link()
2640 if (priv->speed == TLAN_SPEED_100) in tlan_phy_start_link()
2666 phy = priv->phy[priv->phy_num]; in tlan_phy_finish_auto_neg()
2685 priv->tlan_full_duplex = true; in tlan_phy_finish_auto_neg()
2687 priv->tlan_full_duplex = true; in tlan_phy_finish_auto_neg()
2691 (priv->adapter->flags & TLAN_ADAPTER_USE_INTERN_10) && in tlan_phy_finish_auto_neg()
2692 (priv->phy_num != 0)) { in tlan_phy_finish_auto_neg()
2693 priv->phy_num = 0; in tlan_phy_finish_auto_neg()
2698 if (priv->phy_num == 0) { in tlan_phy_finish_auto_neg()
2699 if ((priv->duplex == TLAN_DUPLEX_FULL) || in tlan_phy_finish_auto_neg()
2703 netdev_info(dev, "Starting internal PHY with FULL-DUPLEX\n"); in tlan_phy_finish_auto_neg()
2707 netdev_info(dev, "Starting internal PHY with HALF-DUPLEX\n"); in tlan_phy_finish_auto_neg()
2738 struct net_device *dev = priv->dev; in tlan_phy_monitor()
2742 phy = priv->phy[priv->phy_num]; in tlan_phy_monitor()
2751 dev->name); in tlan_phy_monitor()
2752 tlan_dio_write8(dev->base_addr, TLAN_LED_REG, 0); in tlan_phy_monitor()
2754 if (priv->adapter->flags & TLAN_ADAPTER_USE_INTERN_10) { in tlan_phy_monitor()
2759 tlan_mii_sync(dev->base_addr); in tlan_phy_monitor()
2760 tlan_mii_write_reg(dev, priv->phy[0], in tlan_phy_monitor()
2763 priv->phy_num = 1; in tlan_phy_monitor()
2774 tlan_dio_write8(dev->base_addr, TLAN_LED_REG, TLAN_LED_LINK); in tlan_phy_monitor()
2776 dev->name); in tlan_phy_monitor()
2779 priv->media_timer.expires = jiffies + HZ; in tlan_phy_monitor()
2780 add_timer(&priv->media_timer); in tlan_phy_monitor()
2790 "ThunderLAN Programmer's Guide", pp. 15-24.
2815 * and then reads the 16-bit register value from the MII bus via
2832 outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR); in tlan_mii_read_reg()
2833 sio = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO; in tlan_mii_read_reg()
2836 spin_lock_irqsave(&priv->lock, flags); in tlan_mii_read_reg()
2838 tlan_mii_sync(dev->base_addr); in tlan_mii_read_reg()
2844 tlan_mii_send_data(dev->base_addr, 0x1, 2); /* start (01b) */ in tlan_mii_read_reg()
2845 tlan_mii_send_data(dev->base_addr, 0x2, 2); /* read (10b) */ in tlan_mii_read_reg()
2846 tlan_mii_send_data(dev->base_addr, phy, 5); /* device # */ in tlan_mii_read_reg()
2847 tlan_mii_send_data(dev->base_addr, reg, 5); /* register # */ in tlan_mii_read_reg()
2884 spin_unlock_irqrestore(&priv->lock, flags); in tlan_mii_read_reg()
2923 for (i = (0x1 << (num_bits - 1)); i; i >>= 1) { in tlan_mii_send_data()
2987 * writes the 16-bit register value from the MII configuration bus
3000 outw(TLAN_NET_SIO, dev->base_addr + TLAN_DIO_ADR); in tlan_mii_write_reg()
3001 sio = dev->base_addr + TLAN_DIO_DATA + TLAN_NET_SIO; in tlan_mii_write_reg()
3004 spin_lock_irqsave(&priv->lock, flags); in tlan_mii_write_reg()
3006 tlan_mii_sync(dev->base_addr); in tlan_mii_write_reg()
3012 tlan_mii_send_data(dev->base_addr, 0x1, 2); /* start (01b) */ in tlan_mii_write_reg()
3013 tlan_mii_send_data(dev->base_addr, 0x1, 2); /* write (01b) */ in tlan_mii_write_reg()
3014 tlan_mii_send_data(dev->base_addr, phy, 5); /* device # */ in tlan_mii_write_reg()
3015 tlan_mii_send_data(dev->base_addr, reg, 5); /* register # */ in tlan_mii_write_reg()
3017 tlan_mii_send_data(dev->base_addr, 0x2, 2); /* send ACK */ in tlan_mii_write_reg()
3018 tlan_mii_send_data(dev->base_addr, val, 16); /* send data */ in tlan_mii_write_reg()
3027 spin_unlock_irqrestore(&priv->lock, flags); in tlan_mii_write_reg()
3231 spin_lock_irqsave(&priv->lock, flags); in tlan_ee_read_byte()
3233 tlan_ee_send_start(dev->base_addr); in tlan_ee_read_byte()
3234 err = tlan_ee_send_byte(dev->base_addr, 0xa0, TLAN_EEPROM_ACK); in tlan_ee_read_byte()
3239 err = tlan_ee_send_byte(dev->base_addr, ee_addr, TLAN_EEPROM_ACK); in tlan_ee_read_byte()
3244 tlan_ee_send_start(dev->base_addr); in tlan_ee_read_byte()
3245 err = tlan_ee_send_byte(dev->base_addr, 0xa1, TLAN_EEPROM_ACK); in tlan_ee_read_byte()
3250 tlan_ee_receive_byte(dev->base_addr, data, TLAN_EEPROM_STOP); in tlan_ee_read_byte()
3252 spin_unlock_irqrestore(&priv->lock, flags); in tlan_ee_read_byte()