Lines Matching refs:mac
83 static unsigned int read_mac_reg(const struct pasemi_mac *mac, unsigned int reg) in read_mac_reg() argument
85 return pasemi_read_mac_reg(mac->dma_if, reg); in read_mac_reg()
88 static void write_mac_reg(const struct pasemi_mac *mac, unsigned int reg, in write_mac_reg() argument
91 pasemi_write_mac_reg(mac->dma_if, reg, val); in write_mac_reg()
104 static struct pasemi_mac_rxring *rx_ring(const struct pasemi_mac *mac) in rx_ring() argument
106 return mac->rx; in rx_ring()
109 static struct pasemi_mac_txring *tx_ring(const struct pasemi_mac *mac) in tx_ring() argument
111 return mac->tx; in tx_ring()
124 static int mac_to_intf(struct pasemi_mac *mac) in mac_to_intf() argument
126 struct pci_dev *pdev = mac->pdev; in mac_to_intf()
152 static void pasemi_mac_intf_disable(struct pasemi_mac *mac) in pasemi_mac_intf_disable() argument
156 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_mac_intf_disable()
158 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_intf_disable()
161 static void pasemi_mac_intf_enable(struct pasemi_mac *mac) in pasemi_mac_intf_enable() argument
165 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_mac_intf_enable()
167 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_intf_enable()
170 static int pasemi_get_mac_addr(struct pasemi_mac *mac) in pasemi_get_mac_addr() argument
172 struct pci_dev *pdev = mac->pdev; in pasemi_get_mac_addr()
187 memcpy(mac->mac_addr, maddr, ETH_ALEN); in pasemi_get_mac_addr()
210 memcpy(mac->mac_addr, addr, ETH_ALEN); in pasemi_get_mac_addr()
217 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_set_mac_addr() local
230 adr1 = read_mac_reg(mac, PAS_MAC_CFG_ADR1); in pasemi_mac_set_mac_addr()
234 pasemi_mac_intf_disable(mac); in pasemi_mac_set_mac_addr()
235 write_mac_reg(mac, PAS_MAC_CFG_ADR0, adr0); in pasemi_mac_set_mac_addr()
236 write_mac_reg(mac, PAS_MAC_CFG_ADR1, adr1); in pasemi_mac_set_mac_addr()
237 pasemi_mac_intf_enable(mac); in pasemi_mac_set_mac_addr()
242 static int pasemi_mac_unmap_tx_skb(struct pasemi_mac *mac, in pasemi_mac_unmap_tx_skb() argument
248 struct pci_dev *pdev = mac->dma_pdev; in pasemi_mac_unmap_tx_skb()
265 static struct pasemi_mac_csring *pasemi_mac_setup_csring(struct pasemi_mac *mac) in pasemi_mac_setup_csring() argument
276 dev_err(&mac->pdev->dev, "Can't allocate checksum channel\n"); in pasemi_mac_setup_csring()
339 static void pasemi_mac_setup_csrings(struct pasemi_mac *mac) in pasemi_mac_setup_csrings() argument
342 mac->cs[0] = pasemi_mac_setup_csring(mac); in pasemi_mac_setup_csrings()
343 if (mac->type == MAC_TYPE_XAUI) in pasemi_mac_setup_csrings()
344 mac->cs[1] = pasemi_mac_setup_csring(mac); in pasemi_mac_setup_csrings()
346 mac->cs[1] = 0; in pasemi_mac_setup_csrings()
349 if (mac->cs[i]) in pasemi_mac_setup_csrings()
350 mac->num_cs++; in pasemi_mac_setup_csrings()
366 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_setup_rx_resources() local
374 dev_err(&mac->pdev->dev, "Can't allocate RX channel\n"); in pasemi_mac_setup_rx_resources()
393 ring->buffers = dma_alloc_coherent(&mac->dma_pdev->dev, in pasemi_mac_setup_rx_resources()
413 write_dma_reg(PAS_DMA_RXINT_BASEL(mac->dma_if), in pasemi_mac_setup_rx_resources()
416 write_dma_reg(PAS_DMA_RXINT_BASEU(mac->dma_if), in pasemi_mac_setup_rx_resources()
427 write_dma_reg(PAS_DMA_RXINT_CFG(mac->dma_if), cfg); in pasemi_mac_setup_rx_resources()
431 ring->mac = mac; in pasemi_mac_setup_rx_resources()
432 mac->rx = ring; in pasemi_mac_setup_rx_resources()
447 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_setup_tx_resources() local
457 dev_err(&mac->pdev->dev, "Can't allocate TX channel\n"); in pasemi_mac_setup_tx_resources()
484 PAS_DMA_TXCHAN_CFG_TATTR(mac->dma_if) | in pasemi_mac_setup_tx_resources()
495 ring->mac = mac; in pasemi_mac_setup_tx_resources()
507 static void pasemi_mac_free_tx_resources(struct pasemi_mac *mac) in pasemi_mac_free_tx_resources() argument
509 struct pasemi_mac_txring *txring = tx_ring(mac); in pasemi_mac_free_tx_resources()
530 freed = pasemi_mac_unmap_tx_skb(mac, nfrags, in pasemi_mac_free_tx_resources()
542 static void pasemi_mac_free_rx_buffers(struct pasemi_mac *mac) in pasemi_mac_free_rx_buffers() argument
544 struct pasemi_mac_rxring *rx = rx_ring(mac); in pasemi_mac_free_rx_buffers()
551 pci_unmap_single(mac->dma_pdev, in pasemi_mac_free_rx_buffers()
565 static void pasemi_mac_free_rx_resources(struct pasemi_mac *mac) in pasemi_mac_free_rx_resources() argument
567 pasemi_mac_free_rx_buffers(mac); in pasemi_mac_free_rx_resources()
569 dma_free_coherent(&mac->dma_pdev->dev, RX_RING_SIZE * sizeof(u64), in pasemi_mac_free_rx_resources()
570 rx_ring(mac)->buffers, rx_ring(mac)->buf_dma); in pasemi_mac_free_rx_resources()
572 kfree(rx_ring(mac)->ring_info); in pasemi_mac_free_rx_resources()
573 pasemi_dma_free_chan(&rx_ring(mac)->chan); in pasemi_mac_free_rx_resources()
574 mac->rx = NULL; in pasemi_mac_free_rx_resources()
580 const struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_replenish_rx_ring() local
581 struct pasemi_mac_rxring *rx = rx_ring(mac); in pasemi_mac_replenish_rx_ring()
587 fill = rx_ring(mac)->next_to_fill; in pasemi_mac_replenish_rx_ring()
597 skb = netdev_alloc_skb(dev, mac->bufsz); in pasemi_mac_replenish_rx_ring()
603 dma = pci_map_single(mac->dma_pdev, skb->data, in pasemi_mac_replenish_rx_ring()
604 mac->bufsz - LOCAL_SKB_ALIGN, in pasemi_mac_replenish_rx_ring()
607 if (unlikely(pci_dma_mapping_error(mac->dma_pdev, dma))) { in pasemi_mac_replenish_rx_ring()
614 *buff = XCT_RXB_LEN(mac->bufsz) | XCT_RXB_ADDR(dma); in pasemi_mac_replenish_rx_ring()
620 write_dma_reg(PAS_DMA_RXINT_INCR(mac->dma_if), count); in pasemi_mac_replenish_rx_ring()
622 rx_ring(mac)->next_to_fill = (rx_ring(mac)->next_to_fill + count) & in pasemi_mac_replenish_rx_ring()
626 static void pasemi_mac_restart_rx_intr(const struct pasemi_mac *mac) in pasemi_mac_restart_rx_intr() argument
628 struct pasemi_mac_rxring *rx = rx_ring(mac); in pasemi_mac_restart_rx_intr()
641 write_iob_reg(PAS_IOB_DMA_RXCH_RESET(mac->rx->chan.chno), reg); in pasemi_mac_restart_rx_intr()
644 static void pasemi_mac_restart_tx_intr(const struct pasemi_mac *mac) in pasemi_mac_restart_tx_intr() argument
649 pcnt = *tx_ring(mac)->chan.status & PAS_STATUS_PCNT_M; in pasemi_mac_restart_tx_intr()
653 write_iob_reg(PAS_IOB_DMA_TXCH_RESET(tx_ring(mac)->chan.chno), reg); in pasemi_mac_restart_tx_intr()
657 static inline void pasemi_mac_rx_error(const struct pasemi_mac *mac, in pasemi_mac_rx_error() argument
661 struct pasemi_dmachan *chan = &rx_ring(mac)->chan; in pasemi_mac_rx_error()
663 if (!netif_msg_rx_err(mac)) in pasemi_mac_rx_error()
666 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_rx_error()
676 static inline void pasemi_mac_tx_error(const struct pasemi_mac *mac, in pasemi_mac_tx_error() argument
680 struct pasemi_dmachan *chan = &tx_ring(mac)->chan; in pasemi_mac_tx_error()
682 if (!netif_msg_tx_err(mac)) in pasemi_mac_tx_error()
697 struct pasemi_mac *mac = rx->mac; in pasemi_mac_clean_rx() local
698 struct pci_dev *pdev = mac->dma_pdev; in pasemi_mac_clean_rx()
722 pasemi_mac_rx_error(mac, macrx); in pasemi_mac_clean_rx()
744 pci_unmap_single(pdev, dma, mac->bufsz - LOCAL_SKB_ALIGN, in pasemi_mac_clean_rx()
749 mac->netdev->stats.rx_errors++; in pasemi_mac_clean_rx()
750 mac->netdev->stats.rx_crc_errors++; in pasemi_mac_clean_rx()
772 skb->protocol = eth_type_trans(skb, mac->netdev); in pasemi_mac_clean_rx()
773 napi_gro_receive(&mac->napi, skb); in pasemi_mac_clean_rx()
793 rx_ring(mac)->next_to_clean = n; in pasemi_mac_clean_rx()
799 write_dma_reg(PAS_DMA_RXCHAN_INCR(mac->rx->chan.chno), count << 1); in pasemi_mac_clean_rx()
801 pasemi_mac_replenish_rx_ring(mac->netdev, count); in pasemi_mac_clean_rx()
803 mac->netdev->stats.rx_bytes += tot_bytes; in pasemi_mac_clean_rx()
804 mac->netdev->stats.rx_packets += packets; in pasemi_mac_clean_rx()
806 spin_unlock(&rx_ring(mac)->lock); in pasemi_mac_clean_rx()
817 struct pasemi_mac *mac = txring->mac; in pasemi_mac_clean_tx() local
853 pasemi_mac_tx_error(mac, mactx); in pasemi_mac_clean_tx()
891 netif_wake_queue(mac->netdev); in pasemi_mac_clean_tx()
894 pasemi_mac_unmap_tx_skb(mac, nf[i], skbs[i], dmas[i]); in pasemi_mac_clean_tx()
909 struct pasemi_mac *mac = rxring->mac; in pasemi_mac_rx_intr() local
926 napi_schedule(&mac->napi); in pasemi_mac_rx_intr()
938 struct pasemi_mac *mac = txring->mac; in pasemi_mac_tx_timer() local
944 pasemi_mac_restart_tx_intr(mac); in pasemi_mac_tx_timer()
951 struct pasemi_mac *mac = txring->mac; in pasemi_mac_tx_intr() local
966 napi_schedule(&mac->napi); in pasemi_mac_tx_intr()
976 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_adjust_link() local
985 if (mac->link && netif_msg_link(mac)) in pasemi_adjust_link()
989 pasemi_mac_intf_disable(mac); in pasemi_adjust_link()
990 mac->link = 0; in pasemi_adjust_link()
994 pasemi_mac_intf_enable(mac); in pasemi_adjust_link()
998 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_adjust_link()
1023 msg = mac->link != dev->phydev->link || flags != new_flags; in pasemi_adjust_link()
1025 mac->duplex = dev->phydev->duplex; in pasemi_adjust_link()
1026 mac->speed = dev->phydev->speed; in pasemi_adjust_link()
1027 mac->link = dev->phydev->link; in pasemi_adjust_link()
1030 write_mac_reg(mac, PAS_MAC_CFG_PCFG, new_flags); in pasemi_adjust_link()
1032 if (msg && netif_msg_link(mac)) in pasemi_adjust_link()
1034 dev->name, mac->speed, mac->duplex ? "full" : "half"); in pasemi_adjust_link()
1039 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_phy_init() local
1043 dn = pci_device_to_OF_node(mac->pdev); in pasemi_mac_phy_init()
1046 mac->link = 0; in pasemi_mac_phy_init()
1047 mac->speed = 0; in pasemi_mac_phy_init()
1048 mac->duplex = -1; in pasemi_mac_phy_init()
1065 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_open() local
1073 write_mac_reg(mac, PAS_MAC_CFG_TXP, flags); in pasemi_mac_open()
1079 mac->tx = pasemi_mac_setup_tx_resources(dev); in pasemi_mac_open()
1081 if (!mac->tx) { in pasemi_mac_open()
1089 if (dev->mtu > 1500 && !mac->num_cs) { in pasemi_mac_open()
1090 pasemi_mac_setup_csrings(mac); in pasemi_mac_open()
1091 if (!mac->num_cs) { in pasemi_mac_open()
1099 write_mac_reg(mac, PAS_MAC_RMON(i), 0); in pasemi_mac_open()
1105 write_iob_reg(PAS_IOB_DMA_RXCH_CFG(mac->rx->chan.chno), in pasemi_mac_open()
1108 write_iob_reg(PAS_IOB_DMA_TXCH_CFG(mac->tx->chan.chno), in pasemi_mac_open()
1111 write_mac_reg(mac, PAS_MAC_IPC_CHNL, in pasemi_mac_open()
1112 PAS_MAC_IPC_CHNL_DCHNO(mac->rx->chan.chno) | in pasemi_mac_open()
1113 PAS_MAC_IPC_CHNL_BCH(mac->rx->chan.chno)); in pasemi_mac_open()
1116 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), in pasemi_mac_open()
1124 pasemi_dma_start_chan(&rx_ring(mac)->chan, PAS_DMA_RXCHAN_CCMDSTA_DU | in pasemi_mac_open()
1130 pasemi_dma_start_chan(&tx_ring(mac)->chan, PAS_DMA_TXCHAN_TCMDSTA_SZ | in pasemi_mac_open()
1137 write_dma_reg(PAS_DMA_RXCHAN_INCR(rx_ring(mac)->chan.chno), in pasemi_mac_open()
1141 pasemi_mac_restart_rx_intr(mac); in pasemi_mac_open()
1142 pasemi_mac_restart_tx_intr(mac); in pasemi_mac_open()
1146 if (mac->type == MAC_TYPE_GMAC) in pasemi_mac_open()
1152 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_open()
1157 pasemi_mac_intf_enable(mac); in pasemi_mac_open()
1158 if (mac->type == MAC_TYPE_GMAC) { in pasemi_mac_open()
1160 dev_warn(&mac->pdev->dev, in pasemi_mac_open()
1162 dev_warn(&mac->pdev->dev, in pasemi_mac_open()
1168 napi_enable(&mac->napi); in pasemi_mac_open()
1170 snprintf(mac->tx_irq_name, sizeof(mac->tx_irq_name), "%s tx", in pasemi_mac_open()
1173 ret = request_irq(mac->tx->chan.irq, pasemi_mac_tx_intr, 0, in pasemi_mac_open()
1174 mac->tx_irq_name, mac->tx); in pasemi_mac_open()
1176 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", in pasemi_mac_open()
1177 mac->tx->chan.irq, ret); in pasemi_mac_open()
1181 snprintf(mac->rx_irq_name, sizeof(mac->rx_irq_name), "%s rx", in pasemi_mac_open()
1184 ret = request_irq(mac->rx->chan.irq, pasemi_mac_rx_intr, 0, in pasemi_mac_open()
1185 mac->rx_irq_name, mac->rx); in pasemi_mac_open()
1187 dev_err(&mac->pdev->dev, "request_irq of irq %d failed: %d\n", in pasemi_mac_open()
1188 mac->rx->chan.irq, ret); in pasemi_mac_open()
1195 timer_setup(&mac->tx->clean_timer, pasemi_mac_tx_timer, 0); in pasemi_mac_open()
1196 mod_timer(&mac->tx->clean_timer, jiffies + HZ); in pasemi_mac_open()
1201 free_irq(mac->tx->chan.irq, mac->tx); in pasemi_mac_open()
1203 napi_disable(&mac->napi); in pasemi_mac_open()
1206 if (mac->tx) in pasemi_mac_open()
1207 pasemi_mac_free_tx_resources(mac); in pasemi_mac_open()
1208 pasemi_mac_free_rx_resources(mac); in pasemi_mac_open()
1216 static void pasemi_mac_pause_txchan(struct pasemi_mac *mac) in pasemi_mac_pause_txchan() argument
1219 int txch = tx_ring(mac)->chan.chno; in pasemi_mac_pause_txchan()
1232 dev_err(&mac->dma_pdev->dev, in pasemi_mac_pause_txchan()
1238 static void pasemi_mac_pause_rxchan(struct pasemi_mac *mac) in pasemi_mac_pause_rxchan() argument
1241 int rxch = rx_ring(mac)->chan.chno; in pasemi_mac_pause_rxchan()
1253 dev_err(&mac->dma_pdev->dev, in pasemi_mac_pause_rxchan()
1258 static void pasemi_mac_pause_rxint(struct pasemi_mac *mac) in pasemi_mac_pause_rxint() argument
1262 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), in pasemi_mac_pause_rxint()
1265 sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_pause_rxint()
1272 dev_err(&mac->dma_pdev->dev, in pasemi_mac_pause_rxint()
1274 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), 0); in pasemi_mac_pause_rxint()
1279 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_close() local
1283 rxch = rx_ring(mac)->chan.chno; in pasemi_mac_close()
1284 txch = tx_ring(mac)->chan.chno; in pasemi_mac_close()
1291 del_timer_sync(&mac->tx->clean_timer); in pasemi_mac_close()
1294 napi_disable(&mac->napi); in pasemi_mac_close()
1296 sta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_close()
1315 pasemi_mac_clean_tx(tx_ring(mac)); in pasemi_mac_close()
1316 pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); in pasemi_mac_close()
1318 pasemi_mac_pause_txchan(mac); in pasemi_mac_close()
1319 pasemi_mac_pause_rxint(mac); in pasemi_mac_close()
1320 pasemi_mac_pause_rxchan(mac); in pasemi_mac_close()
1321 pasemi_mac_intf_disable(mac); in pasemi_mac_close()
1323 free_irq(mac->tx->chan.irq, mac->tx); in pasemi_mac_close()
1324 free_irq(mac->rx->chan.irq, mac->rx); in pasemi_mac_close()
1326 for (i = 0; i < mac->num_cs; i++) { in pasemi_mac_close()
1327 pasemi_mac_free_csring(mac->cs[i]); in pasemi_mac_close()
1328 mac->cs[i] = NULL; in pasemi_mac_close()
1331 mac->num_cs = 0; in pasemi_mac_close()
1334 pasemi_mac_free_rx_resources(mac); in pasemi_mac_close()
1335 pasemi_mac_free_tx_resources(mac); in pasemi_mac_close()
1428 struct pasemi_mac * const mac = netdev_priv(dev); in pasemi_mac_start_tx() local
1429 struct pasemi_mac_txring * const txring = tx_ring(mac); in pasemi_mac_start_tx()
1447 map[0] = pci_map_single(mac->dma_pdev, skb->data, skb_headlen(skb), in pasemi_mac_start_tx()
1450 if (pci_dma_mapping_error(mac->dma_pdev, map[0])) in pasemi_mac_start_tx()
1456 map[i + 1] = skb_frag_dma_map(&mac->dma_pdev->dev, frag, 0, in pasemi_mac_start_tx()
1459 if (dma_mapping_error(&mac->dma_pdev->dev, map[i + 1])) { in pasemi_mac_start_tx()
1497 if (mac->num_cs && skb->ip_summed == CHECKSUM_PARTIAL && skb->len > 1540) { in pasemi_mac_start_tx()
1498 csring = mac->cs[mac->last_cs]; in pasemi_mac_start_tx()
1499 mac->last_cs = (mac->last_cs + 1) % mac->num_cs; in pasemi_mac_start_tx()
1537 pci_unmap_single(mac->dma_pdev, map[nfrags], map_size[nfrags], in pasemi_mac_start_tx()
1545 const struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_set_rx_mode() local
1548 flags = read_mac_reg(mac, PAS_MAC_CFG_PCFG); in pasemi_mac_set_rx_mode()
1556 write_mac_reg(mac, PAS_MAC_CFG_PCFG, flags); in pasemi_mac_set_rx_mode()
1562 struct pasemi_mac *mac = container_of(napi, struct pasemi_mac, napi); in pasemi_mac_poll() local
1565 pasemi_mac_clean_tx(tx_ring(mac)); in pasemi_mac_poll()
1566 pkts = pasemi_mac_clean_rx(rx_ring(mac), budget); in pasemi_mac_poll()
1571 pasemi_mac_restart_rx_intr(mac); in pasemi_mac_poll()
1572 pasemi_mac_restart_tx_intr(mac); in pasemi_mac_poll()
1585 const struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_netpoll() local
1587 disable_irq(mac->tx->chan.irq); in pasemi_mac_netpoll()
1588 pasemi_mac_tx_intr(mac->tx->chan.irq, mac->tx); in pasemi_mac_netpoll()
1589 enable_irq(mac->tx->chan.irq); in pasemi_mac_netpoll()
1591 disable_irq(mac->rx->chan.irq); in pasemi_mac_netpoll()
1592 pasemi_mac_rx_intr(mac->rx->chan.irq, mac->rx); in pasemi_mac_netpoll()
1593 enable_irq(mac->rx->chan.irq); in pasemi_mac_netpoll()
1599 struct pasemi_mac *mac = netdev_priv(dev); in pasemi_mac_change_mtu() local
1614 napi_disable(&mac->napi); in pasemi_mac_change_mtu()
1616 pasemi_mac_intf_disable(mac); in pasemi_mac_change_mtu()
1618 rcmdsta = read_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if)); in pasemi_mac_change_mtu()
1619 pasemi_mac_pause_rxint(mac); in pasemi_mac_change_mtu()
1620 pasemi_mac_clean_rx(rx_ring(mac), RX_RING_SIZE); in pasemi_mac_change_mtu()
1621 pasemi_mac_free_rx_buffers(mac); in pasemi_mac_change_mtu()
1626 if (new_mtu > PE_DEF_MTU && !mac->num_cs) { in pasemi_mac_change_mtu()
1627 pasemi_mac_setup_csrings(mac); in pasemi_mac_change_mtu()
1628 if (!mac->num_cs) { in pasemi_mac_change_mtu()
1637 reg = read_mac_reg(mac, PAS_MAC_CFG_MACCFG); in pasemi_mac_change_mtu()
1640 write_mac_reg(mac, PAS_MAC_CFG_MACCFG, reg); in pasemi_mac_change_mtu()
1644 mac->bufsz = new_mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; in pasemi_mac_change_mtu()
1648 write_dma_reg(PAS_DMA_RXINT_RCMDSTA(mac->dma_if), in pasemi_mac_change_mtu()
1651 rx_ring(mac)->next_to_fill = 0; in pasemi_mac_change_mtu()
1654 napi_enable(&mac->napi); in pasemi_mac_change_mtu()
1656 pasemi_mac_intf_enable(mac); in pasemi_mac_change_mtu()
1679 struct pasemi_mac *mac; in pasemi_mac_probe() local
1695 mac = netdev_priv(dev); in pasemi_mac_probe()
1697 mac->pdev = pdev; in pasemi_mac_probe()
1698 mac->netdev = dev; in pasemi_mac_probe()
1700 netif_napi_add(dev, &mac->napi, pasemi_mac_poll, 64); in pasemi_mac_probe()
1705 mac->dma_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa007, NULL); in pasemi_mac_probe()
1706 if (!mac->dma_pdev) { in pasemi_mac_probe()
1707 dev_err(&mac->pdev->dev, "Can't find DMA Controller\n"); in pasemi_mac_probe()
1711 dma_set_mask(&mac->dma_pdev->dev, DMA_BIT_MASK(64)); in pasemi_mac_probe()
1713 mac->iob_pdev = pci_get_device(PCI_VENDOR_ID_PASEMI, 0xa001, NULL); in pasemi_mac_probe()
1714 if (!mac->iob_pdev) { in pasemi_mac_probe()
1715 dev_err(&mac->pdev->dev, "Can't find I/O Bridge\n"); in pasemi_mac_probe()
1721 if (pasemi_get_mac_addr(mac) || !is_valid_ether_addr(mac->mac_addr)) { in pasemi_mac_probe()
1725 memcpy(dev->dev_addr, mac->mac_addr, sizeof(mac->mac_addr)); in pasemi_mac_probe()
1727 ret = mac_to_intf(mac); in pasemi_mac_probe()
1729 dev_err(&mac->pdev->dev, "Can't map DMA interface\n"); in pasemi_mac_probe()
1733 mac->dma_if = ret; in pasemi_mac_probe()
1737 mac->type = MAC_TYPE_GMAC; in pasemi_mac_probe()
1740 mac->type = MAC_TYPE_XAUI; in pasemi_mac_probe()
1755 mac->bufsz = dev->mtu + ETH_HLEN + ETH_FCS_LEN + LOCAL_SKB_ALIGN + 128; in pasemi_mac_probe()
1762 mac->msg_enable = netif_msg_init(debug, DEFAULT_MSG_ENABLE); in pasemi_mac_probe()
1765 mac->msg_enable = (NETIF_MSG_IFUP << 1 ) - 1; in pasemi_mac_probe()
1770 dev_err(&mac->pdev->dev, "register_netdev failed with error %d\n", in pasemi_mac_probe()
1773 } else if (netif_msg_probe(mac)) { in pasemi_mac_probe()
1775 dev->name, mac->type == MAC_TYPE_GMAC ? "GMAC" : "XAUI", in pasemi_mac_probe()
1776 mac->dma_if, dev->dev_addr); in pasemi_mac_probe()
1782 pci_dev_put(mac->iob_pdev); in pasemi_mac_probe()
1783 pci_dev_put(mac->dma_pdev); in pasemi_mac_probe()
1795 struct pasemi_mac *mac; in pasemi_mac_remove() local
1800 mac = netdev_priv(netdev); in pasemi_mac_remove()
1805 pci_dev_put(mac->dma_pdev); in pasemi_mac_remove()
1806 pci_dev_put(mac->iob_pdev); in pasemi_mac_remove()
1808 pasemi_dma_free_chan(&mac->tx->chan); in pasemi_mac_remove()
1809 pasemi_dma_free_chan(&mac->rx->chan); in pasemi_mac_remove()