• Home
  • Raw
  • Download

Lines Matching refs:tp

400 	struct sis190_private *tp = netdev_priv(dev);  in __mdio_write()  local
402 mdio_write(tp->mmio_addr, phy_id, reg, val); in __mdio_write()
407 struct sis190_private *tp = netdev_priv(dev); in __mdio_read() local
409 return mdio_read(tp->mmio_addr, phy_id, reg); in __mdio_read()
487 static struct sk_buff *sis190_alloc_rx_skb(struct sis190_private *tp, in sis190_alloc_rx_skb() argument
490 u32 rx_buf_sz = tp->rx_buf_sz; in sis190_alloc_rx_skb()
494 skb = netdev_alloc_skb(tp->dev, rx_buf_sz); in sis190_alloc_rx_skb()
497 mapping = dma_map_single(&tp->pci_dev->dev, skb->data, tp->rx_buf_sz, in sis190_alloc_rx_skb()
499 if (dma_mapping_error(&tp->pci_dev->dev, mapping)) in sis190_alloc_rx_skb()
512 static u32 sis190_rx_fill(struct sis190_private *tp, struct net_device *dev, in sis190_rx_fill() argument
520 if (tp->Rx_skbuff[i]) in sis190_rx_fill()
523 tp->Rx_skbuff[i] = sis190_alloc_rx_skb(tp, tp->RxDescRing + i); in sis190_rx_fill()
525 if (!tp->Rx_skbuff[i]) in sis190_rx_fill()
531 static bool sis190_try_rx_copy(struct sis190_private *tp, in sis190_try_rx_copy() argument
541 skb = netdev_alloc_skb_ip_align(tp->dev, pkt_size); in sis190_try_rx_copy()
545 dma_sync_single_for_cpu(&tp->pci_dev->dev, addr, tp->rx_buf_sz, in sis190_try_rx_copy()
575 struct sis190_private *tp, void __iomem *ioaddr) in sis190_rx_interrupt() argument
578 u32 rx_left, cur_rx = tp->cur_rx; in sis190_rx_interrupt()
581 rx_left = NUM_RX_DESC + tp->dirty_rx - cur_rx; in sis190_rx_interrupt()
586 struct RxDesc *desc = tp->RxDescRing + entry; in sis190_rx_interrupt()
597 sis190_give_to_asic(desc, tp->rx_buf_sz); in sis190_rx_interrupt()
599 struct sk_buff *skb = tp->Rx_skbuff[entry]; in sis190_rx_interrupt()
602 struct pci_dev *pdev = tp->pci_dev; in sis190_rx_interrupt()
604 if (unlikely(pkt_size > tp->rx_buf_sz)) { in sis190_rx_interrupt()
605 netif_info(tp, intr, dev, in sis190_rx_interrupt()
609 sis190_give_to_asic(desc, tp->rx_buf_sz); in sis190_rx_interrupt()
614 if (sis190_try_rx_copy(tp, &skb, pkt_size, addr)) { in sis190_rx_interrupt()
616 tp->rx_buf_sz, in sis190_rx_interrupt()
618 sis190_give_to_asic(desc, tp->rx_buf_sz); in sis190_rx_interrupt()
621 tp->rx_buf_sz, in sis190_rx_interrupt()
623 tp->Rx_skbuff[entry] = NULL; in sis190_rx_interrupt()
638 count = cur_rx - tp->cur_rx; in sis190_rx_interrupt()
639 tp->cur_rx = cur_rx; in sis190_rx_interrupt()
641 delta = sis190_rx_fill(tp, dev, tp->dirty_rx, tp->cur_rx); in sis190_rx_interrupt()
643 netif_info(tp, intr, dev, "no Rx buffer allocated\n"); in sis190_rx_interrupt()
644 tp->dirty_rx += delta; in sis190_rx_interrupt()
646 if ((tp->dirty_rx + NUM_RX_DESC) == tp->cur_rx) in sis190_rx_interrupt()
647 netif_emerg(tp, intr, dev, "Rx buffers exhausted\n"); in sis190_rx_interrupt()
687 struct sis190_private *tp, void __iomem *ioaddr) in sis190_tx_interrupt() argument
690 u32 pending, dirty_tx = tp->dirty_tx; in sis190_tx_interrupt()
698 pending = tp->cur_tx - dirty_tx; in sis190_tx_interrupt()
703 struct TxDesc *txd = tp->TxDescRing + entry; in sis190_tx_interrupt()
710 skb = tp->Tx_skbuff[entry]; in sis190_tx_interrupt()
718 sis190_unmap_tx_skb(tp->pci_dev, skb, txd); in sis190_tx_interrupt()
719 tp->Tx_skbuff[entry] = NULL; in sis190_tx_interrupt()
723 if (tp->dirty_tx != dirty_tx) { in sis190_tx_interrupt()
724 tp->dirty_tx = dirty_tx; in sis190_tx_interrupt()
738 struct sis190_private *tp = netdev_priv(dev); in sis190_irq() local
739 void __iomem *ioaddr = tp->mmio_addr; in sis190_irq()
760 netif_info(tp, intr, dev, "link change\n"); in sis190_irq()
761 del_timer(&tp->timer); in sis190_irq()
762 schedule_work(&tp->phy_task); in sis190_irq()
766 sis190_rx_interrupt(dev, tp, ioaddr); in sis190_irq()
769 sis190_tx_interrupt(dev, tp, ioaddr); in sis190_irq()
777 struct sis190_private *tp = netdev_priv(dev); in sis190_netpoll() local
778 const int irq = tp->pci_dev->irq; in sis190_netpoll()
786 static void sis190_free_rx_skb(struct sis190_private *tp, in sis190_free_rx_skb() argument
789 struct pci_dev *pdev = tp->pci_dev; in sis190_free_rx_skb()
791 dma_unmap_single(&pdev->dev, le32_to_cpu(desc->addr), tp->rx_buf_sz, in sis190_free_rx_skb()
798 static void sis190_rx_clear(struct sis190_private *tp) in sis190_rx_clear() argument
803 if (!tp->Rx_skbuff[i]) in sis190_rx_clear()
805 sis190_free_rx_skb(tp, tp->Rx_skbuff + i, tp->RxDescRing + i); in sis190_rx_clear()
809 static void sis190_init_ring_indexes(struct sis190_private *tp) in sis190_init_ring_indexes() argument
811 tp->dirty_tx = tp->dirty_rx = tp->cur_tx = tp->cur_rx = 0; in sis190_init_ring_indexes()
816 struct sis190_private *tp = netdev_priv(dev); in sis190_init_ring() local
818 sis190_init_ring_indexes(tp); in sis190_init_ring()
820 memset(tp->Tx_skbuff, 0x0, NUM_TX_DESC * sizeof(struct sk_buff *)); in sis190_init_ring()
821 memset(tp->Rx_skbuff, 0x0, NUM_RX_DESC * sizeof(struct sk_buff *)); in sis190_init_ring()
823 if (sis190_rx_fill(tp, dev, 0, NUM_RX_DESC) != NUM_RX_DESC) in sis190_init_ring()
826 sis190_mark_as_last_descriptor(tp->RxDescRing + NUM_RX_DESC - 1); in sis190_init_ring()
831 sis190_rx_clear(tp); in sis190_init_ring()
837 struct sis190_private *tp = netdev_priv(dev); in sis190_set_rx_mode() local
838 void __iomem *ioaddr = tp->mmio_addr; in sis190_set_rx_mode()
866 spin_lock_irqsave(&tp->lock, flags); in sis190_set_rx_mode()
872 spin_unlock_irqrestore(&tp->lock, flags); in sis190_set_rx_mode()
885 struct sis190_private *tp = netdev_priv(dev); in sis190_hw_start() local
886 void __iomem *ioaddr = tp->mmio_addr; in sis190_hw_start()
890 SIS_W32(TxDescStartAddr, tp->tx_dma); in sis190_hw_start()
891 SIS_W32(RxDescStartAddr, tp->rx_dma); in sis190_hw_start()
918 struct sis190_private *tp = in sis190_phy_task() local
920 struct net_device *dev = tp->dev; in sis190_phy_task()
921 void __iomem *ioaddr = tp->mmio_addr; in sis190_phy_task()
922 int phy_id = tp->mii_if.phy_id; in sis190_phy_task()
933 mod_timer(&tp->timer, jiffies + HZ/10); in sis190_phy_task()
938 if (!(val & BMSR_ANEGCOMPLETE) && tp->link_status != LNK_AUTONEG) { in sis190_phy_task()
940 netif_warn(tp, link, dev, "auto-negotiating...\n"); in sis190_phy_task()
941 tp->link_status = LNK_AUTONEG; in sis190_phy_task()
942 } else if ((val & BMSR_LSTATUS) && tp->link_status != LNK_ON) { in sis190_phy_task()
966 netif_info(tp, link, dev, "mii ext = %04x\n", val); in sis190_phy_task()
971 netif_info(tp, link, dev, "mii lpa=%04x adv=%04x exp=%04x\n", in sis190_phy_task()
995 if ((tp->features & F_HAS_RGMII) && in sis190_phy_task()
996 (tp->features & F_PHY_BCM5461)) { in sis190_phy_task()
1006 if (tp->features & F_HAS_RGMII) { in sis190_phy_task()
1011 tp->negotiated_lpa = p->val; in sis190_phy_task()
1013 netif_info(tp, link, dev, "link on %s mode\n", p->msg); in sis190_phy_task()
1015 tp->link_status = LNK_ON; in sis190_phy_task()
1016 } else if (!(val & BMSR_LSTATUS) && tp->link_status != LNK_AUTONEG) in sis190_phy_task()
1017 tp->link_status = LNK_OFF; in sis190_phy_task()
1018 mod_timer(&tp->timer, jiffies + SIS190_PHY_TIMEOUT); in sis190_phy_task()
1026 struct sis190_private *tp = from_timer(tp, t, timer); in sis190_phy_timer() local
1027 struct net_device *dev = tp->dev; in sis190_phy_timer()
1030 schedule_work(&tp->phy_task); in sis190_phy_timer()
1035 struct sis190_private *tp = netdev_priv(dev); in sis190_delete_timer() local
1037 del_timer_sync(&tp->timer); in sis190_delete_timer()
1042 struct sis190_private *tp = netdev_priv(dev); in sis190_request_timer() local
1043 struct timer_list *timer = &tp->timer; in sis190_request_timer()
1050 static void sis190_set_rxbufsize(struct sis190_private *tp, in sis190_set_rxbufsize() argument
1055 tp->rx_buf_sz = (mtu > RX_BUF_SIZE) ? mtu + ETH_HLEN + 8 : RX_BUF_SIZE; in sis190_set_rxbufsize()
1057 if (tp->rx_buf_sz & 0x07) { in sis190_set_rxbufsize()
1058 tp->rx_buf_sz += 8; in sis190_set_rxbufsize()
1059 tp->rx_buf_sz &= RX_BUF_MASK; in sis190_set_rxbufsize()
1065 struct sis190_private *tp = netdev_priv(dev); in sis190_open() local
1066 struct pci_dev *pdev = tp->pci_dev; in sis190_open()
1069 sis190_set_rxbufsize(tp, dev); in sis190_open()
1075 tp->TxDescRing = dma_alloc_coherent(&pdev->dev, TX_RING_BYTES, in sis190_open()
1076 &tp->tx_dma, GFP_KERNEL); in sis190_open()
1077 if (!tp->TxDescRing) in sis190_open()
1080 tp->RxDescRing = dma_alloc_coherent(&pdev->dev, RX_RING_BYTES, in sis190_open()
1081 &tp->rx_dma, GFP_KERNEL); in sis190_open()
1082 if (!tp->RxDescRing) in sis190_open()
1101 sis190_rx_clear(tp); in sis190_open()
1103 dma_free_coherent(&pdev->dev, RX_RING_BYTES, tp->RxDescRing, in sis190_open()
1104 tp->rx_dma); in sis190_open()
1106 dma_free_coherent(&pdev->dev, TX_RING_BYTES, tp->TxDescRing, in sis190_open()
1107 tp->tx_dma); in sis190_open()
1111 static void sis190_tx_clear(struct sis190_private *tp) in sis190_tx_clear() argument
1116 struct sk_buff *skb = tp->Tx_skbuff[i]; in sis190_tx_clear()
1121 sis190_unmap_tx_skb(tp->pci_dev, skb, tp->TxDescRing + i); in sis190_tx_clear()
1122 tp->Tx_skbuff[i] = NULL; in sis190_tx_clear()
1125 tp->dev->stats.tx_dropped++; in sis190_tx_clear()
1127 tp->cur_tx = tp->dirty_tx = 0; in sis190_tx_clear()
1132 struct sis190_private *tp = netdev_priv(dev); in sis190_down() local
1133 void __iomem *ioaddr = tp->mmio_addr; in sis190_down()
1141 spin_lock_irq(&tp->lock); in sis190_down()
1145 spin_unlock_irq(&tp->lock); in sis190_down()
1147 synchronize_irq(tp->pci_dev->irq); in sis190_down()
1156 sis190_tx_clear(tp); in sis190_down()
1157 sis190_rx_clear(tp); in sis190_down()
1162 struct sis190_private *tp = netdev_priv(dev); in sis190_close() local
1163 struct pci_dev *pdev = tp->pci_dev; in sis190_close()
1169 dma_free_coherent(&pdev->dev, TX_RING_BYTES, tp->TxDescRing, in sis190_close()
1170 tp->tx_dma); in sis190_close()
1171 dma_free_coherent(&pdev->dev, RX_RING_BYTES, tp->RxDescRing, in sis190_close()
1172 tp->rx_dma); in sis190_close()
1174 tp->TxDescRing = NULL; in sis190_close()
1175 tp->RxDescRing = NULL; in sis190_close()
1183 struct sis190_private *tp = netdev_priv(dev); in sis190_start_xmit() local
1184 void __iomem *ioaddr = tp->mmio_addr; in sis190_start_xmit()
1199 entry = tp->cur_tx % NUM_TX_DESC; in sis190_start_xmit()
1200 desc = tp->TxDescRing + entry; in sis190_start_xmit()
1204 netif_err(tp, tx_err, dev, in sis190_start_xmit()
1209 mapping = dma_map_single(&tp->pci_dev->dev, skb->data, len, in sis190_start_xmit()
1211 if (dma_mapping_error(&tp->pci_dev->dev, mapping)) { in sis190_start_xmit()
1212 netif_err(tp, tx_err, dev, in sis190_start_xmit()
1217 tp->Tx_skbuff[entry] = skb; in sis190_start_xmit()
1229 if (tp->negotiated_lpa & (LPA_1000HALF | LPA_100HALF | LPA_10HALF)) { in sis190_start_xmit()
1232 if (tp->negotiated_lpa & (LPA_1000HALF | LPA_1000FULL)) in sis190_start_xmit()
1236 tp->cur_tx++; in sis190_start_xmit()
1242 dirty_tx = tp->dirty_tx; in sis190_start_xmit()
1243 if ((tp->cur_tx - NUM_TX_DESC) == dirty_tx) { in sis190_start_xmit()
1246 if (dirty_tx != tp->dirty_tx) in sis190_start_xmit()
1273 struct sis190_private *tp = netdev_priv(dev); in sis190_default_phy() local
1274 struct mii_if_info *mii_if = &tp->mii_if; in sis190_default_phy()
1275 void __iomem *ioaddr = tp->mmio_addr; in sis190_default_phy()
1280 list_for_each_entry(phy, &tp->first_phy, list) { in sis190_default_phy()
1305 phy_default = list_first_entry(&tp->first_phy, in sis190_default_phy()
1311 if (netif_msg_probe(tp)) in sis190_default_phy()
1313 pci_name(tp->pci_dev), mii_if->phy_id); in sis190_default_phy()
1325 static void sis190_init_phy(struct net_device *dev, struct sis190_private *tp, in sis190_init_phy() argument
1329 void __iomem *ioaddr = tp->mmio_addr; in sis190_init_phy()
1350 tp->features |= p->feature; in sis190_init_phy()
1351 if (netif_msg_probe(tp)) in sis190_init_phy()
1353 pci_name(tp->pci_dev), p->name, phy_id); in sis190_init_phy()
1356 if (netif_msg_probe(tp)) in sis190_init_phy()
1358 pci_name(tp->pci_dev), in sis190_init_phy()
1363 static void sis190_mii_probe_88e1111_fixup(struct sis190_private *tp) in sis190_mii_probe_88e1111_fixup() argument
1365 if (tp->features & F_PHY_88E1111) { in sis190_mii_probe_88e1111_fixup()
1366 void __iomem *ioaddr = tp->mmio_addr; in sis190_mii_probe_88e1111_fixup()
1367 int phy_id = tp->mii_if.phy_id; in sis190_mii_probe_88e1111_fixup()
1373 p = (tp->features & F_HAS_RGMII) ? reg[0] : reg[1]; in sis190_mii_probe_88e1111_fixup()
1392 struct sis190_private *tp = netdev_priv(dev); in sis190_mii_probe() local
1393 struct mii_if_info *mii_if = &tp->mii_if; in sis190_mii_probe()
1394 void __iomem *ioaddr = tp->mmio_addr; in sis190_mii_probe()
1398 INIT_LIST_HEAD(&tp->first_phy); in sis190_mii_probe()
1412 sis190_free_phy(&tp->first_phy); in sis190_mii_probe()
1417 sis190_init_phy(dev, tp, phy, phy_id, status); in sis190_mii_probe()
1419 list_add(&tp->first_phy, &phy->list); in sis190_mii_probe()
1422 if (list_empty(&tp->first_phy)) { in sis190_mii_probe()
1423 if (netif_msg_probe(tp)) in sis190_mii_probe()
1425 pci_name(tp->pci_dev)); in sis190_mii_probe()
1433 sis190_mii_probe_88e1111_fixup(tp); in sis190_mii_probe()
1446 struct sis190_private *tp = netdev_priv(dev); in sis190_mii_remove() local
1448 sis190_free_phy(&tp->first_phy); in sis190_mii_remove()
1454 struct sis190_private *tp = netdev_priv(dev); in sis190_release_board() local
1456 iounmap(tp->mmio_addr); in sis190_release_board()
1464 struct sis190_private *tp; in sis190_init_board() local
1469 dev = alloc_etherdev(sizeof(*tp)); in sis190_init_board()
1477 tp = netdev_priv(dev); in sis190_init_board()
1478 tp->dev = dev; in sis190_init_board()
1479 tp->msg_enable = netif_msg_init(debug.msg_enable, SIS190_MSG_DEFAULT); in sis190_init_board()
1483 if (netif_msg_probe(tp)) in sis190_init_board()
1491 if (netif_msg_probe(tp)) in sis190_init_board()
1497 if (netif_msg_probe(tp)) in sis190_init_board()
1505 if (netif_msg_probe(tp)) in sis190_init_board()
1513 if (netif_msg_probe(tp)) in sis190_init_board()
1523 if (netif_msg_probe(tp)) in sis190_init_board()
1530 tp->pci_dev = pdev; in sis190_init_board()
1531 tp->mmio_addr = ioaddr; in sis190_init_board()
1532 tp->link_status = LNK_OFF; in sis190_init_board()
1553 struct sis190_private *tp = netdev_priv(dev); in sis190_tx_timeout() local
1554 void __iomem *ioaddr = tp->mmio_addr; in sis190_tx_timeout()
1562 netif_info(tp, tx_err, dev, "Transmit timeout, status %08x %08x\n", in sis190_tx_timeout()
1569 spin_lock_irq(&tp->lock); in sis190_tx_timeout()
1570 sis190_tx_clear(tp); in sis190_tx_timeout()
1571 spin_unlock_irq(&tp->lock); in sis190_tx_timeout()
1579 static void sis190_set_rgmii(struct sis190_private *tp, u8 reg) in sis190_set_rgmii() argument
1581 tp->features |= (reg & 0x80) ? F_HAS_RGMII : 0; in sis190_set_rgmii()
1587 struct sis190_private *tp = netdev_priv(dev); in sis190_get_mac_addr_from_eeprom() local
1588 void __iomem *ioaddr = tp->mmio_addr; in sis190_get_mac_addr_from_eeprom()
1593 if (netif_msg_probe(tp)) in sis190_get_mac_addr_from_eeprom()
1600 if (netif_msg_probe(tp)) in sis190_get_mac_addr_from_eeprom()
1614 sis190_set_rgmii(tp, sis190_read_eeprom(ioaddr, EEPROMInfo)); in sis190_get_mac_addr_from_eeprom()
1632 struct sis190_private *tp = netdev_priv(dev); in sis190_get_mac_addr_from_apc() local
1638 if (netif_msg_probe(tp)) in sis190_get_mac_addr_from_apc()
1648 if (netif_msg_probe(tp)) in sis190_get_mac_addr_from_apc()
1670 sis190_set_rgmii(tp, reg); in sis190_get_mac_addr_from_apc()
1688 struct sis190_private *tp = netdev_priv(dev); in sis190_init_rxfilter() local
1689 void __iomem *ioaddr = tp->mmio_addr; in sis190_init_rxfilter()
1726 struct sis190_private *tp = netdev_priv(dev); in sis190_set_speed_auto() local
1727 void __iomem *ioaddr = tp->mmio_addr; in sis190_set_speed_auto()
1728 int phy_id = tp->mii_if.phy_id; in sis190_set_speed_auto()
1731 netif_info(tp, link, dev, "Enabling Auto-negotiation\n"); in sis190_set_speed_auto()
1752 struct sis190_private *tp = netdev_priv(dev); in sis190_get_link_ksettings() local
1754 mii_ethtool_get_link_ksettings(&tp->mii_if, cmd); in sis190_get_link_ksettings()
1762 struct sis190_private *tp = netdev_priv(dev); in sis190_set_link_ksettings() local
1764 return mii_ethtool_set_link_ksettings(&tp->mii_if, cmd); in sis190_set_link_ksettings()
1770 struct sis190_private *tp = netdev_priv(dev); in sis190_get_drvinfo() local
1774 strscpy(info->bus_info, pci_name(tp->pci_dev), in sis190_get_drvinfo()
1786 struct sis190_private *tp = netdev_priv(dev); in sis190_get_regs() local
1789 spin_lock_irqsave(&tp->lock, flags); in sis190_get_regs()
1790 memcpy_fromio(p, tp->mmio_addr, regs->len); in sis190_get_regs()
1791 spin_unlock_irqrestore(&tp->lock, flags); in sis190_get_regs()
1796 struct sis190_private *tp = netdev_priv(dev); in sis190_nway_reset() local
1798 return mii_nway_restart(&tp->mii_if); in sis190_nway_reset()
1803 struct sis190_private *tp = netdev_priv(dev); in sis190_get_msglevel() local
1805 return tp->msg_enable; in sis190_get_msglevel()
1810 struct sis190_private *tp = netdev_priv(dev); in sis190_set_msglevel() local
1812 tp->msg_enable = value; in sis190_set_msglevel()
1829 struct sis190_private *tp = netdev_priv(dev); in sis190_ioctl() local
1832 generic_mii_ioctl(&tp->mii_if, if_mii(ifr), cmd, NULL); in sis190_ioctl()
1863 struct sis190_private *tp; in sis190_init_one() local
1882 tp = netdev_priv(dev); in sis190_init_one()
1883 ioaddr = tp->mmio_addr; in sis190_init_one()
1891 INIT_WORK(&tp->phy_task, sis190_phy_task); in sis190_init_one()
1898 spin_lock_init(&tp->lock); in sis190_init_one()
1908 if (netif_msg_probe(tp)) { in sis190_init_one()
1914 (tp->features & F_HAS_RGMII) ? "RGMII" : "GMII"); in sis190_init_one()
1933 struct sis190_private *tp = netdev_priv(dev); in sis190_remove_one() local
1936 cancel_work_sync(&tp->phy_task); in sis190_remove_one()