Lines Matching refs:lp
98 static int amd8111e_read_phy(struct amd8111e_priv *lp, in amd8111e_read_phy() argument
101 void __iomem *mmio = lp->mmio; in amd8111e_read_phy()
127 static int amd8111e_write_phy(struct amd8111e_priv *lp, in amd8111e_write_phy() argument
131 void __iomem *mmio = lp->mmio; in amd8111e_write_phy()
159 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_mdio_read() local
162 amd8111e_read_phy(lp, phy_id, reg_num, ®_val); in amd8111e_mdio_read()
171 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_mdio_write() local
173 amd8111e_write_phy(lp, phy_id, reg_num, val); in amd8111e_mdio_write()
181 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_set_ext_phy() local
185 advert = amd8111e_mdio_read(dev, lp->ext_phy_addr, MII_ADVERTISE); in amd8111e_set_ext_phy()
187 switch (lp->ext_phy_option) { in amd8111e_set_ext_phy()
208 amd8111e_mdio_write(dev, lp->ext_phy_addr, MII_ADVERTISE, tmp); in amd8111e_set_ext_phy()
210 bmcr = amd8111e_mdio_read(dev, lp->ext_phy_addr, MII_BMCR); in amd8111e_set_ext_phy()
212 amd8111e_mdio_write(dev, lp->ext_phy_addr, MII_BMCR, bmcr); in amd8111e_set_ext_phy()
221 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_free_skbs() local
227 if (lp->tx_skbuff[i]) { in amd8111e_free_skbs()
228 dma_unmap_single(&lp->pci_dev->dev, in amd8111e_free_skbs()
229 lp->tx_dma_addr[i], in amd8111e_free_skbs()
230 lp->tx_skbuff[i]->len, DMA_TO_DEVICE); in amd8111e_free_skbs()
231 dev_kfree_skb(lp->tx_skbuff[i]); in amd8111e_free_skbs()
232 lp->tx_skbuff[i] = NULL; in amd8111e_free_skbs()
233 lp->tx_dma_addr[i] = 0; in amd8111e_free_skbs()
238 rx_skbuff = lp->rx_skbuff[i]; in amd8111e_free_skbs()
240 dma_unmap_single(&lp->pci_dev->dev, in amd8111e_free_skbs()
241 lp->rx_dma_addr[i], in amd8111e_free_skbs()
242 lp->rx_buff_len - 2, DMA_FROM_DEVICE); in amd8111e_free_skbs()
243 dev_kfree_skb(lp->rx_skbuff[i]); in amd8111e_free_skbs()
244 lp->rx_skbuff[i] = NULL; in amd8111e_free_skbs()
245 lp->rx_dma_addr[i] = 0; in amd8111e_free_skbs()
257 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_set_rx_buff_len() local
264 lp->rx_buff_len = mtu + ETH_HLEN + 10; in amd8111e_set_rx_buff_len()
265 lp->options |= OPTION_JUMBO_ENABLE; in amd8111e_set_rx_buff_len()
267 lp->rx_buff_len = PKT_BUFF_SZ; in amd8111e_set_rx_buff_len()
268 lp->options &= ~OPTION_JUMBO_ENABLE; in amd8111e_set_rx_buff_len()
279 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_init_ring() local
282 lp->rx_idx = lp->tx_idx = 0; in amd8111e_init_ring()
283 lp->tx_complete_idx = 0; in amd8111e_init_ring()
284 lp->tx_ring_idx = 0; in amd8111e_init_ring()
287 if (lp->opened) in amd8111e_init_ring()
293 lp->tx_ring = dma_alloc_coherent(&lp->pci_dev->dev, in amd8111e_init_ring()
295 &lp->tx_ring_dma_addr, GFP_ATOMIC); in amd8111e_init_ring()
296 if (!lp->tx_ring) in amd8111e_init_ring()
299 lp->rx_ring = dma_alloc_coherent(&lp->pci_dev->dev, in amd8111e_init_ring()
301 &lp->rx_ring_dma_addr, GFP_ATOMIC); in amd8111e_init_ring()
302 if (!lp->rx_ring) in amd8111e_init_ring()
312 lp->rx_skbuff[i] = netdev_alloc_skb(dev, lp->rx_buff_len); in amd8111e_init_ring()
313 if (!lp->rx_skbuff[i]) { in amd8111e_init_ring()
316 dev_kfree_skb(lp->rx_skbuff[i]); in amd8111e_init_ring()
319 skb_reserve(lp->rx_skbuff[i], 2); in amd8111e_init_ring()
323 lp->rx_dma_addr[i] = dma_map_single(&lp->pci_dev->dev, in amd8111e_init_ring()
324 lp->rx_skbuff[i]->data, in amd8111e_init_ring()
325 lp->rx_buff_len - 2, in amd8111e_init_ring()
328 lp->rx_ring[i].buff_phy_addr = cpu_to_le32(lp->rx_dma_addr[i]); in amd8111e_init_ring()
329 lp->rx_ring[i].buff_count = cpu_to_le16(lp->rx_buff_len-2); in amd8111e_init_ring()
331 lp->rx_ring[i].rx_flags = cpu_to_le16(OWN_BIT); in amd8111e_init_ring()
336 lp->tx_ring[i].buff_phy_addr = 0; in amd8111e_init_ring()
337 lp->tx_ring[i].tx_flags = 0; in amd8111e_init_ring()
338 lp->tx_ring[i].buff_count = 0; in amd8111e_init_ring()
345 dma_free_coherent(&lp->pci_dev->dev, in amd8111e_init_ring()
347 lp->rx_ring, lp->rx_ring_dma_addr); in amd8111e_init_ring()
351 dma_free_coherent(&lp->pci_dev->dev, in amd8111e_init_ring()
353 lp->tx_ring, lp->tx_ring_dma_addr); in amd8111e_init_ring()
367 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_set_coalesce() local
368 void __iomem *mmio = lp->mmio; in amd8111e_set_coalesce()
369 struct amd8111e_coalesce_conf *coal_conf = &lp->coal_conf; in amd8111e_set_coalesce()
423 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_restart() local
424 void __iomem *mmio = lp->mmio; in amd8111e_restart()
452 writel((u32)lp->tx_ring_dma_addr, mmio + XMT_RING_BASE_ADDR0); in amd8111e_restart()
453 writel((u32)lp->rx_ring_dma_addr, mmio + RCV_RING_BASE_ADDR0); in amd8111e_restart()
462 if (lp->options & OPTION_JUMBO_ENABLE) { in amd8111e_restart()
483 if (lp->options & OPTION_INTR_COAL_ENABLE) { in amd8111e_restart()
498 static void amd8111e_init_hw_default(struct amd8111e_priv *lp) in amd8111e_init_hw_default() argument
502 void __iomem *mmio = lp->mmio; in amd8111e_init_hw_default()
509 writew( 0x8100 | lp->ext_phy_addr, mmio + AUTOPOLL0); in amd8111e_init_hw_default()
573 if (lp->options & OPTION_JUMBO_ENABLE) in amd8111e_init_hw_default()
589 static void amd8111e_disable_interrupt(struct amd8111e_priv *lp) in amd8111e_disable_interrupt() argument
594 writel(INTREN, lp->mmio + CMD0); in amd8111e_disable_interrupt()
597 intr0 = readl(lp->mmio + INT0); in amd8111e_disable_interrupt()
598 writel(intr0, lp->mmio + INT0); in amd8111e_disable_interrupt()
601 readl(lp->mmio + INT0); in amd8111e_disable_interrupt()
606 static void amd8111e_stop_chip(struct amd8111e_priv *lp) in amd8111e_stop_chip() argument
608 writel(RUN, lp->mmio + CMD0); in amd8111e_stop_chip()
611 readl(lp->mmio + CMD0); in amd8111e_stop_chip()
615 static void amd8111e_free_ring(struct amd8111e_priv *lp) in amd8111e_free_ring() argument
618 if (lp->rx_ring) { in amd8111e_free_ring()
619 dma_free_coherent(&lp->pci_dev->dev, in amd8111e_free_ring()
621 lp->rx_ring, lp->rx_ring_dma_addr); in amd8111e_free_ring()
622 lp->rx_ring = NULL; in amd8111e_free_ring()
625 if (lp->tx_ring) { in amd8111e_free_ring()
626 dma_free_coherent(&lp->pci_dev->dev, in amd8111e_free_ring()
628 lp->tx_ring, lp->tx_ring_dma_addr); in amd8111e_free_ring()
630 lp->tx_ring = NULL; in amd8111e_free_ring()
641 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_tx() local
645 while (lp->tx_complete_idx != lp->tx_idx) { in amd8111e_tx()
646 tx_index = lp->tx_complete_idx & TX_RING_DR_MOD_MASK; in amd8111e_tx()
647 status = le16_to_cpu(lp->tx_ring[tx_index].tx_flags); in amd8111e_tx()
652 lp->tx_ring[tx_index].buff_phy_addr = 0; in amd8111e_tx()
655 if (lp->tx_skbuff[tx_index]) { in amd8111e_tx()
656 dma_unmap_single(&lp->pci_dev->dev, in amd8111e_tx()
657 lp->tx_dma_addr[tx_index], in amd8111e_tx()
658 lp->tx_skbuff[tx_index]->len, in amd8111e_tx()
660 dev_consume_skb_irq(lp->tx_skbuff[tx_index]); in amd8111e_tx()
661 lp->tx_skbuff[tx_index] = NULL; in amd8111e_tx()
662 lp->tx_dma_addr[tx_index] = 0; in amd8111e_tx()
664 lp->tx_complete_idx++; in amd8111e_tx()
666 lp->coal_conf.tx_packets++; in amd8111e_tx()
667 lp->coal_conf.tx_bytes += in amd8111e_tx()
668 le16_to_cpu(lp->tx_ring[tx_index].buff_count); in amd8111e_tx()
671 lp->tx_complete_idx > lp->tx_idx - NUM_TX_BUFFERS + 2) { in amd8111e_tx()
683 struct amd8111e_priv *lp = container_of(napi, struct amd8111e_priv, napi); in amd8111e_rx_poll() local
684 struct net_device *dev = lp->amd8111e_net_dev; in amd8111e_rx_poll()
685 int rx_index = lp->rx_idx & RX_RING_DR_MOD_MASK; in amd8111e_rx_poll()
686 void __iomem *mmio = lp->mmio; in amd8111e_rx_poll()
696 status = le16_to_cpu(lp->rx_ring[rx_index].rx_flags); in amd8111e_rx_poll()
708 lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; in amd8111e_rx_poll()
714 lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; in amd8111e_rx_poll()
717 pkt_len = le16_to_cpu(lp->rx_ring[rx_index].msg_count) - 4; in amd8111e_rx_poll()
729 lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; in amd8111e_rx_poll()
730 lp->drv_rx_errors++; in amd8111e_rx_poll()
733 new_skb = netdev_alloc_skb(dev, lp->rx_buff_len); in amd8111e_rx_poll()
738 lp->rx_ring[rx_index].rx_flags &= RESET_RX_FLAGS; in amd8111e_rx_poll()
739 lp->drv_rx_errors++; in amd8111e_rx_poll()
744 skb = lp->rx_skbuff[rx_index]; in amd8111e_rx_poll()
745 dma_unmap_single(&lp->pci_dev->dev, lp->rx_dma_addr[rx_index], in amd8111e_rx_poll()
746 lp->rx_buff_len - 2, DMA_FROM_DEVICE); in amd8111e_rx_poll()
748 lp->rx_skbuff[rx_index] = new_skb; in amd8111e_rx_poll()
749 lp->rx_dma_addr[rx_index] = dma_map_single(&lp->pci_dev->dev, in amd8111e_rx_poll()
751 lp->rx_buff_len - 2, in amd8111e_rx_poll()
758 u16 vlan_tag = le16_to_cpu(lp->rx_ring[rx_index].tag_ctrl_info); in amd8111e_rx_poll()
764 lp->coal_conf.rx_packets++; in amd8111e_rx_poll()
765 lp->coal_conf.rx_bytes += pkt_len; in amd8111e_rx_poll()
769 lp->rx_ring[rx_index].buff_phy_addr in amd8111e_rx_poll()
770 = cpu_to_le32(lp->rx_dma_addr[rx_index]); in amd8111e_rx_poll()
771 lp->rx_ring[rx_index].buff_count = in amd8111e_rx_poll()
772 cpu_to_le16(lp->rx_buff_len-2); in amd8111e_rx_poll()
774 lp->rx_ring[rx_index].rx_flags |= cpu_to_le16(OWN_BIT); in amd8111e_rx_poll()
775 rx_index = (++lp->rx_idx) & RX_RING_DR_MOD_MASK; in amd8111e_rx_poll()
782 spin_lock_irqsave(&lp->lock, flags); in amd8111e_rx_poll()
785 spin_unlock_irqrestore(&lp->lock, flags); in amd8111e_rx_poll()
794 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_link_change() local
798 status0 = readl(lp->mmio + STAT0); in amd8111e_link_change()
802 lp->link_config.autoneg = AUTONEG_ENABLE; in amd8111e_link_change()
804 lp->link_config.autoneg = AUTONEG_DISABLE; in amd8111e_link_change()
807 lp->link_config.duplex = DUPLEX_FULL; in amd8111e_link_change()
809 lp->link_config.duplex = DUPLEX_HALF; in amd8111e_link_change()
812 lp->link_config.speed = SPEED_10; in amd8111e_link_change()
814 lp->link_config.speed = SPEED_100; in amd8111e_link_change()
817 (lp->link_config.speed == SPEED_100) ? in amd8111e_link_change()
819 (lp->link_config.duplex == DUPLEX_FULL) ? in amd8111e_link_change()
824 lp->link_config.speed = SPEED_INVALID; in amd8111e_link_change()
825 lp->link_config.duplex = DUPLEX_INVALID; in amd8111e_link_change()
826 lp->link_config.autoneg = AUTONEG_INVALID; in amd8111e_link_change()
857 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_get_stats() local
858 void __iomem *mmio = lp->mmio; in amd8111e_get_stats()
862 if (!lp->opened) in amd8111e_get_stats()
864 spin_lock_irqsave(&lp->lock, flags); in amd8111e_get_stats()
888 lp->drv_rx_errors; in amd8111e_get_stats()
944 spin_unlock_irqrestore(&lp->lock, flags); in amd8111e_get_stats()
954 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_calc_coalesce() local
955 struct amd8111e_coalesce_conf *coal_conf = &lp->coal_conf; in amd8111e_calc_coalesce()
1081 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_interrupt() local
1082 void __iomem *mmio = lp->mmio; in amd8111e_interrupt()
1089 spin_lock(&lp->lock); in amd8111e_interrupt()
1110 if (napi_schedule_prep(&lp->napi)) { in amd8111e_interrupt()
1114 __napi_schedule(&lp->napi); in amd8111e_interrupt()
1137 spin_unlock(&lp->lock); in amd8111e_interrupt()
1159 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_close() local
1162 napi_disable(&lp->napi); in amd8111e_close()
1164 spin_lock_irq(&lp->lock); in amd8111e_close()
1166 amd8111e_disable_interrupt(lp); in amd8111e_close()
1167 amd8111e_stop_chip(lp); in amd8111e_close()
1170 amd8111e_free_skbs(lp->amd8111e_net_dev); in amd8111e_close()
1172 netif_carrier_off(lp->amd8111e_net_dev); in amd8111e_close()
1175 if (lp->options & OPTION_DYN_IPG_ENABLE) in amd8111e_close()
1176 del_timer_sync(&lp->ipg_data.ipg_timer); in amd8111e_close()
1178 spin_unlock_irq(&lp->lock); in amd8111e_close()
1180 amd8111e_free_ring(lp); in amd8111e_close()
1184 lp->opened = 0; in amd8111e_close()
1193 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_open() local
1199 napi_enable(&lp->napi); in amd8111e_open()
1201 spin_lock_irq(&lp->lock); in amd8111e_open()
1203 amd8111e_init_hw_default(lp); in amd8111e_open()
1206 spin_unlock_irq(&lp->lock); in amd8111e_open()
1207 napi_disable(&lp->napi); in amd8111e_open()
1213 if (lp->options & OPTION_DYN_IPG_ENABLE) { in amd8111e_open()
1214 add_timer(&lp->ipg_data.ipg_timer); in amd8111e_open()
1218 lp->opened = 1; in amd8111e_open()
1220 spin_unlock_irq(&lp->lock); in amd8111e_open()
1230 static int amd8111e_tx_queue_avail(struct amd8111e_priv *lp) in amd8111e_tx_queue_avail() argument
1232 int tx_index = lp->tx_idx & TX_BUFF_MOD_MASK; in amd8111e_tx_queue_avail()
1233 if (lp->tx_skbuff[tx_index]) in amd8111e_tx_queue_avail()
1248 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_start_xmit() local
1252 spin_lock_irqsave(&lp->lock, flags); in amd8111e_start_xmit()
1254 tx_index = lp->tx_idx & TX_RING_DR_MOD_MASK; in amd8111e_start_xmit()
1256 lp->tx_ring[tx_index].buff_count = cpu_to_le16(skb->len); in amd8111e_start_xmit()
1258 lp->tx_skbuff[tx_index] = skb; in amd8111e_start_xmit()
1259 lp->tx_ring[tx_index].tx_flags = 0; in amd8111e_start_xmit()
1263 lp->tx_ring[tx_index].tag_ctrl_cmd |= in amd8111e_start_xmit()
1265 lp->tx_ring[tx_index].tag_ctrl_info = in amd8111e_start_xmit()
1270 lp->tx_dma_addr[tx_index] = in amd8111e_start_xmit()
1271 dma_map_single(&lp->pci_dev->dev, skb->data, skb->len, in amd8111e_start_xmit()
1273 lp->tx_ring[tx_index].buff_phy_addr = in amd8111e_start_xmit()
1274 cpu_to_le32(lp->tx_dma_addr[tx_index]); in amd8111e_start_xmit()
1278 lp->tx_ring[tx_index].tx_flags |= in amd8111e_start_xmit()
1281 lp->tx_idx++; in amd8111e_start_xmit()
1284 writel(VAL1 | TDMD0, lp->mmio + CMD0); in amd8111e_start_xmit()
1285 writel(VAL2 | RDMD0, lp->mmio + CMD0); in amd8111e_start_xmit()
1287 if (amd8111e_tx_queue_avail(lp) < 0) { in amd8111e_start_xmit()
1290 spin_unlock_irqrestore(&lp->lock, flags); in amd8111e_start_xmit()
1294 static void amd8111e_read_regs(struct amd8111e_priv *lp, u32 *buf) in amd8111e_read_regs() argument
1296 void __iomem *mmio = lp->mmio; in amd8111e_read_regs()
1320 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_set_multicast_list() local
1325 writel(VAL2 | PROM, lp->mmio + CMD2); in amd8111e_set_multicast_list()
1329 writel(PROM, lp->mmio + CMD2); in amd8111e_set_multicast_list()
1334 lp->options |= OPTION_MULTICAST_ENABLE; in amd8111e_set_multicast_list()
1335 amd8111e_writeq(*(u64 *)mc_filter, lp->mmio + LADRF); in amd8111e_set_multicast_list()
1341 lp->options &= ~OPTION_MULTICAST_ENABLE; in amd8111e_set_multicast_list()
1342 amd8111e_writeq(*(u64 *)mc_filter, lp->mmio + LADRF); in amd8111e_set_multicast_list()
1344 writel(PROM, lp->mmio + CMD2); in amd8111e_set_multicast_list()
1348 lp->options |= OPTION_MULTICAST_ENABLE; in amd8111e_set_multicast_list()
1354 amd8111e_writeq(*(u64 *)mc_filter, lp->mmio + LADRF); in amd8111e_set_multicast_list()
1357 readl(lp->mmio + CMD2); in amd8111e_set_multicast_list()
1364 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_get_drvinfo() local
1365 struct pci_dev *pci_dev = lp->pci_dev; in amd8111e_get_drvinfo()
1379 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_get_regs() local
1381 amd8111e_read_regs(lp, buf); in amd8111e_get_regs()
1387 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_get_link_ksettings() local
1388 spin_lock_irq(&lp->lock); in amd8111e_get_link_ksettings()
1389 mii_ethtool_get_link_ksettings(&lp->mii_if, cmd); in amd8111e_get_link_ksettings()
1390 spin_unlock_irq(&lp->lock); in amd8111e_get_link_ksettings()
1397 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_set_link_ksettings() local
1399 spin_lock_irq(&lp->lock); in amd8111e_set_link_ksettings()
1400 res = mii_ethtool_set_link_ksettings(&lp->mii_if, cmd); in amd8111e_set_link_ksettings()
1401 spin_unlock_irq(&lp->lock); in amd8111e_set_link_ksettings()
1407 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_nway_reset() local
1408 return mii_nway_restart(&lp->mii_if); in amd8111e_nway_reset()
1413 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_get_link() local
1414 return mii_link_ok(&lp->mii_if); in amd8111e_get_link()
1419 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_get_wol() local
1421 if (lp->options & OPTION_WOL_ENABLE) in amd8111e_get_wol()
1427 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_set_wol() local
1430 spin_lock_irq(&lp->lock); in amd8111e_set_wol()
1432 lp->options |= in amd8111e_set_wol()
1435 lp->options |= in amd8111e_set_wol()
1438 lp->options &= ~OPTION_WOL_ENABLE; in amd8111e_set_wol()
1439 spin_unlock_irq(&lp->lock); in amd8111e_set_wol()
1462 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_ioctl() local
1468 data->phy_id = lp->ext_phy_addr; in amd8111e_ioctl()
1473 spin_lock_irq(&lp->lock); in amd8111e_ioctl()
1474 err = amd8111e_read_phy(lp, data->phy_id, in amd8111e_ioctl()
1476 spin_unlock_irq(&lp->lock); in amd8111e_ioctl()
1483 spin_lock_irq(&lp->lock); in amd8111e_ioctl()
1484 err = amd8111e_write_phy(lp, data->phy_id, in amd8111e_ioctl()
1486 spin_unlock_irq(&lp->lock); in amd8111e_ioctl()
1498 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_set_mac_address() local
1503 spin_lock_irq(&lp->lock); in amd8111e_set_mac_address()
1506 writeb(dev->dev_addr[i], lp->mmio + PADR + i); in amd8111e_set_mac_address()
1508 spin_unlock_irq(&lp->lock); in amd8111e_set_mac_address()
1518 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_change_mtu() local
1529 spin_lock_irq(&lp->lock); in amd8111e_change_mtu()
1532 writel(RUN, lp->mmio + CMD0); in amd8111e_change_mtu()
1537 spin_unlock_irq(&lp->lock); in amd8111e_change_mtu()
1543 static int amd8111e_enable_magicpkt(struct amd8111e_priv *lp) in amd8111e_enable_magicpkt() argument
1545 writel(VAL1 | MPPLBA, lp->mmio + CMD3); in amd8111e_enable_magicpkt()
1546 writel(VAL0 | MPEN_SW, lp->mmio + CMD7); in amd8111e_enable_magicpkt()
1549 readl(lp->mmio + CMD7); in amd8111e_enable_magicpkt()
1553 static int amd8111e_enable_link_change(struct amd8111e_priv *lp) in amd8111e_enable_link_change() argument
1557 writel(VAL0 | LCMODE_SW, lp->mmio + CMD7); in amd8111e_enable_link_change()
1560 readl(lp->mmio + CMD7); in amd8111e_enable_link_change()
1571 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_tx_timeout() local
1576 spin_lock_irq(&lp->lock); in amd8111e_tx_timeout()
1578 spin_unlock_irq(&lp->lock); in amd8111e_tx_timeout()
1586 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_suspend() local
1592 spin_lock_irq(&lp->lock); in amd8111e_suspend()
1593 amd8111e_disable_interrupt(lp); in amd8111e_suspend()
1594 spin_unlock_irq(&lp->lock); in amd8111e_suspend()
1599 spin_lock_irq(&lp->lock); in amd8111e_suspend()
1600 if (lp->options & OPTION_DYN_IPG_ENABLE) in amd8111e_suspend()
1601 del_timer_sync(&lp->ipg_data.ipg_timer); in amd8111e_suspend()
1602 amd8111e_stop_chip(lp); in amd8111e_suspend()
1603 spin_unlock_irq(&lp->lock); in amd8111e_suspend()
1605 if (lp->options & OPTION_WOL_ENABLE) { in amd8111e_suspend()
1607 if (lp->options & OPTION_WAKE_MAGIC_ENABLE) in amd8111e_suspend()
1608 amd8111e_enable_magicpkt(lp); in amd8111e_suspend()
1609 if (lp->options & OPTION_WAKE_PHY_ENABLE) in amd8111e_suspend()
1610 amd8111e_enable_link_change(lp); in amd8111e_suspend()
1624 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_resume() local
1631 spin_lock_irq(&lp->lock); in amd8111e_resume()
1634 if (lp->options & OPTION_DYN_IPG_ENABLE) in amd8111e_resume()
1635 mod_timer(&lp->ipg_data.ipg_timer, in amd8111e_resume()
1637 spin_unlock_irq(&lp->lock); in amd8111e_resume()
1644 struct amd8111e_priv *lp = from_timer(lp, t, ipg_data.ipg_timer); in amd8111e_config_ipg() local
1645 struct ipg_info *ipg_data = &lp->ipg_data; in amd8111e_config_ipg()
1646 void __iomem *mmio = lp->mmio; in amd8111e_config_ipg()
1651 if (lp->link_config.duplex == DUPLEX_FULL) { in amd8111e_config_ipg()
1697 mod_timer(&lp->ipg_data.ipg_timer, jiffies + IPG_CONVERGE_JIFFIES); in amd8111e_config_ipg()
1704 struct amd8111e_priv *lp = netdev_priv(dev); in amd8111e_probe_ext_phy() local
1710 if (amd8111e_read_phy(lp, i, MII_PHYSID1, &id1)) in amd8111e_probe_ext_phy()
1712 if (amd8111e_read_phy(lp, i, MII_PHYSID2, &id2)) in amd8111e_probe_ext_phy()
1714 lp->ext_phy_id = (id1 << 16) | id2; in amd8111e_probe_ext_phy()
1715 lp->ext_phy_addr = i; in amd8111e_probe_ext_phy()
1718 lp->ext_phy_id = 0; in amd8111e_probe_ext_phy()
1719 lp->ext_phy_addr = 1; in amd8111e_probe_ext_phy()
1743 struct amd8111e_priv *lp; in amd8111e_probe_one() local
1796 lp = netdev_priv(dev); in amd8111e_probe_one()
1797 lp->pci_dev = pdev; in amd8111e_probe_one()
1798 lp->amd8111e_net_dev = dev; in amd8111e_probe_one()
1799 lp->pm_cap = pdev->pm_cap; in amd8111e_probe_one()
1801 spin_lock_init(&lp->lock); in amd8111e_probe_one()
1803 lp->mmio = devm_ioremap(&pdev->dev, reg_addr, reg_len); in amd8111e_probe_one()
1804 if (!lp->mmio) { in amd8111e_probe_one()
1812 addr[i] = readb(lp->mmio + PADR + i); in amd8111e_probe_one()
1816 lp->ext_phy_option = speed_duplex[card_idx]; in amd8111e_probe_one()
1818 lp->options |= OPTION_INTR_COAL_ENABLE; in amd8111e_probe_one()
1820 lp->options |= OPTION_DYN_IPG_ENABLE; in amd8111e_probe_one()
1830 netif_napi_add_weight(dev, &lp->napi, amd8111e_rx_poll, 32); in amd8111e_probe_one()
1836 lp->mii_if.dev = dev; in amd8111e_probe_one()
1837 lp->mii_if.mdio_read = amd8111e_mdio_read; in amd8111e_probe_one()
1838 lp->mii_if.mdio_write = amd8111e_mdio_write; in amd8111e_probe_one()
1839 lp->mii_if.phy_id = lp->ext_phy_addr; in amd8111e_probe_one()
1854 if (lp->options & OPTION_DYN_IPG_ENABLE) { in amd8111e_probe_one()
1855 timer_setup(&lp->ipg_data.ipg_timer, amd8111e_config_ipg, 0); in amd8111e_probe_one()
1856 lp->ipg_data.ipg_timer.expires = jiffies + in amd8111e_probe_one()
1858 lp->ipg_data.ipg = DEFAULT_IPG; in amd8111e_probe_one()
1859 lp->ipg_data.ipg_state = CSTATE; in amd8111e_probe_one()
1863 chip_version = (readl(lp->mmio + CHIPID) & 0xf0000000) >> 28; in amd8111e_probe_one()
1866 if (lp->ext_phy_id) in amd8111e_probe_one()
1868 lp->ext_phy_id, lp->ext_phy_addr); in amd8111e_probe_one()