• Home
  • Raw
  • Download

Lines Matching refs:pdata

71 	struct xgene_enet_pdata *pdata;  in xgene_enet_refill_pagepool()  local
84 pdata = netdev_priv(ndev); in xgene_enet_refill_pagepool()
112 pdata->ring_ops->wr_cmd(buf_pool, nbuf); in xgene_enet_refill_pagepool()
123 struct xgene_enet_pdata *pdata; in xgene_enet_refill_bufpool() local
134 pdata = netdev_priv(ndev); in xgene_enet_refill_bufpool()
161 pdata->ring_ops->wr_cmd(buf_pool, nbuf); in xgene_enet_refill_bufpool()
228 struct xgene_enet_pdata *pdata = netdev_priv(cp_ring->ndev); in xgene_enet_tx_completion() local
255 spin_lock(&pdata->mss_lock); in xgene_enet_tx_completion()
256 pdata->mss_refcnt[mss_index]--; in xgene_enet_tx_completion()
257 spin_unlock(&pdata->mss_lock); in xgene_enet_tx_completion()
278 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_setup_mss() local
282 spin_lock(&pdata->mss_lock); in xgene_enet_setup_mss()
286 if (pdata->mss[i] == mss) { in xgene_enet_setup_mss()
287 pdata->mss_refcnt[i]++; in xgene_enet_setup_mss()
294 if (!pdata->mss_refcnt[i]) { in xgene_enet_setup_mss()
295 pdata->mss_refcnt[i]++; in xgene_enet_setup_mss()
296 pdata->mac_ops->set_mss(pdata, mss, i); in xgene_enet_setup_mss()
297 pdata->mss[i] = mss; in xgene_enet_setup_mss()
302 spin_unlock(&pdata->mss_lock); in xgene_enet_setup_mss()
410 struct xgene_enet_pdata *pdata = netdev_priv(tx_ring->ndev); in xgene_enet_setup_tx_desc() local
543 pdata->tx_level[tx_ring->cp_ring->index] += count; in xgene_enet_setup_tx_desc()
552 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_start_xmit() local
555 u32 tx_level = pdata->tx_level[index]; in xgene_enet_start_xmit()
558 tx_ring = pdata->tx_ring[index]; in xgene_enet_start_xmit()
559 if (tx_level < pdata->txc_level[index]) in xgene_enet_start_xmit()
560 tx_level += ((typeof(pdata->tx_level[index]))~0U); in xgene_enet_start_xmit()
562 if ((tx_level - pdata->txc_level[index]) > pdata->tx_qcnt_hi) { in xgene_enet_start_xmit()
584 pdata->ring_ops->wr_cmd(tx_ring, count); in xgene_enet_start_xmit()
674 struct xgene_enet_pdata *pdata; in xgene_enet_rx_frame() local
687 pdata = netdev_priv(ndev); in xgene_enet_rx_frame()
714 pdata->false_rflr++; in xgene_enet_rx_frame()
716 pdata->vlan_rjbr++; in xgene_enet_rx_frame()
787 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_process_ring() local
831 pdata->txc_level[ring->index] += desc_count; in xgene_enet_process_ring()
838 pdata->ring_ops->wr_cmd(ring, -count); in xgene_enet_process_ring()
866 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_timeout() local
870 pdata->mac_ops->reset(pdata); in xgene_enet_timeout()
872 for (i = 0; i < pdata->txq_cnt; i++) { in xgene_enet_timeout()
881 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_set_irq_name() local
885 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_set_irq_name()
886 ring = pdata->rx_ring[i]; in xgene_enet_set_irq_name()
887 if (!pdata->cq_cnt) { in xgene_enet_set_irq_name()
896 for (i = 0; i < pdata->cq_cnt; i++) { in xgene_enet_set_irq_name()
897 ring = pdata->tx_ring[i]->cp_ring; in xgene_enet_set_irq_name()
905 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_register_irq() local
911 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_register_irq()
912 ring = pdata->rx_ring[i]; in xgene_enet_register_irq()
922 for (i = 0; i < pdata->cq_cnt; i++) { in xgene_enet_register_irq()
923 ring = pdata->tx_ring[i]->cp_ring; in xgene_enet_register_irq()
938 struct xgene_enet_pdata *pdata; in xgene_enet_free_irq() local
943 pdata = netdev_priv(ndev); in xgene_enet_free_irq()
946 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_free_irq()
947 ring = pdata->rx_ring[i]; in xgene_enet_free_irq()
952 for (i = 0; i < pdata->cq_cnt; i++) { in xgene_enet_free_irq()
953 ring = pdata->tx_ring[i]->cp_ring; in xgene_enet_free_irq()
959 static void xgene_enet_napi_enable(struct xgene_enet_pdata *pdata) in xgene_enet_napi_enable() argument
964 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_napi_enable()
965 napi = &pdata->rx_ring[i]->napi; in xgene_enet_napi_enable()
969 for (i = 0; i < pdata->cq_cnt; i++) { in xgene_enet_napi_enable()
970 napi = &pdata->tx_ring[i]->cp_ring->napi; in xgene_enet_napi_enable()
975 static void xgene_enet_napi_disable(struct xgene_enet_pdata *pdata) in xgene_enet_napi_disable() argument
980 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_napi_disable()
981 napi = &pdata->rx_ring[i]->napi; in xgene_enet_napi_disable()
985 for (i = 0; i < pdata->cq_cnt; i++) { in xgene_enet_napi_disable()
986 napi = &pdata->tx_ring[i]->cp_ring->napi; in xgene_enet_napi_disable()
993 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_open() local
994 const struct xgene_mac_ops *mac_ops = pdata->mac_ops; in xgene_enet_open()
997 ret = netif_set_real_num_tx_queues(ndev, pdata->txq_cnt); in xgene_enet_open()
1001 ret = netif_set_real_num_rx_queues(ndev, pdata->rxq_cnt); in xgene_enet_open()
1005 xgene_enet_napi_enable(pdata); in xgene_enet_open()
1008 xgene_enet_napi_disable(pdata); in xgene_enet_open()
1015 schedule_delayed_work(&pdata->link_work, PHY_POLL_LINK_OFF); in xgene_enet_open()
1019 mac_ops->tx_enable(pdata); in xgene_enet_open()
1020 mac_ops->rx_enable(pdata); in xgene_enet_open()
1028 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_close() local
1029 const struct xgene_mac_ops *mac_ops = pdata->mac_ops; in xgene_enet_close()
1033 mac_ops->tx_disable(pdata); in xgene_enet_close()
1034 mac_ops->rx_disable(pdata); in xgene_enet_close()
1039 cancel_delayed_work_sync(&pdata->link_work); in xgene_enet_close()
1042 xgene_enet_napi_disable(pdata); in xgene_enet_close()
1043 for (i = 0; i < pdata->rxq_cnt; i++) in xgene_enet_close()
1044 xgene_enet_process_ring(pdata->rx_ring[i], -1); in xgene_enet_close()
1050 struct xgene_enet_pdata *pdata; in xgene_enet_delete_ring() local
1053 pdata = netdev_priv(ring->ndev); in xgene_enet_delete_ring()
1056 pdata->ring_ops->clear(ring); in xgene_enet_delete_ring()
1060 static void xgene_enet_delete_desc_rings(struct xgene_enet_pdata *pdata) in xgene_enet_delete_desc_rings() argument
1066 for (i = 0; i < pdata->txq_cnt; i++) { in xgene_enet_delete_desc_rings()
1067 ring = pdata->tx_ring[i]; in xgene_enet_delete_desc_rings()
1070 pdata->port_ops->clear(pdata, ring); in xgene_enet_delete_desc_rings()
1071 if (pdata->cq_cnt) in xgene_enet_delete_desc_rings()
1073 pdata->tx_ring[i] = NULL; in xgene_enet_delete_desc_rings()
1078 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_delete_desc_rings()
1079 ring = pdata->rx_ring[i]; in xgene_enet_delete_desc_rings()
1085 pdata->port_ops->clear(pdata, page_pool); in xgene_enet_delete_desc_rings()
1091 pdata->port_ops->clear(pdata, buf_pool); in xgene_enet_delete_desc_rings()
1094 pdata->rx_ring[i] = NULL; in xgene_enet_delete_desc_rings()
1131 struct xgene_enet_pdata *pdata; in xgene_enet_free_desc_ring() local
1138 pdata = netdev_priv(ring->ndev); in xgene_enet_free_desc_ring()
1141 pdata->ring_ops->clear(ring); in xgene_enet_free_desc_ring()
1147 static void xgene_enet_free_desc_rings(struct xgene_enet_pdata *pdata) in xgene_enet_free_desc_rings() argument
1150 struct device *dev = &pdata->pdev->dev; in xgene_enet_free_desc_rings()
1155 for (i = 0; i < pdata->txq_cnt; i++) { in xgene_enet_free_desc_rings()
1156 ring = pdata->tx_ring[i]; in xgene_enet_free_desc_rings()
1161 if (ring->cp_ring && pdata->cq_cnt) in xgene_enet_free_desc_rings()
1169 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_free_desc_rings()
1170 ring = pdata->rx_ring[i]; in xgene_enet_free_desc_rings()
1195 static bool is_irq_mbox_required(struct xgene_enet_pdata *pdata, in is_irq_mbox_required() argument
1198 if ((pdata->enet_id == XGENE_ENET2) && in is_irq_mbox_required()
1206 static void __iomem *xgene_enet_ring_cmd_base(struct xgene_enet_pdata *pdata, in xgene_enet_ring_cmd_base() argument
1209 u8 num_ring_id_shift = pdata->ring_ops->num_ring_id_shift; in xgene_enet_ring_cmd_base()
1211 return pdata->ring_cmd_addr + (ring->num << num_ring_id_shift); in xgene_enet_ring_cmd_base()
1218 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_create_desc_ring() local
1246 if (is_irq_mbox_required(pdata, ring)) { in xgene_enet_create_desc_ring()
1259 ring->cmd_base = xgene_enet_ring_cmd_base(pdata, ring); in xgene_enet_create_desc_ring()
1261 ring = pdata->ring_ops->setup(ring); in xgene_enet_create_desc_ring()
1294 static u8 xgene_start_cpu_bufnum(struct xgene_enet_pdata *pdata) in xgene_start_cpu_bufnum() argument
1296 struct device *dev = &pdata->pdev->dev; in xgene_start_cpu_bufnum()
1302 return (!ret) ? cpu_bufnum : pdata->cpu_bufnum; in xgene_start_cpu_bufnum()
1308 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_create_desc_rings() local
1312 u8 eth_bufnum = pdata->eth_bufnum; in xgene_enet_create_desc_rings()
1313 u8 bp_bufnum = pdata->bp_bufnum; in xgene_enet_create_desc_rings()
1314 u16 ring_num = pdata->ring_num; in xgene_enet_create_desc_rings()
1322 cpu_bufnum = xgene_start_cpu_bufnum(pdata); in xgene_enet_create_desc_rings()
1324 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_create_desc_rings()
1326 owner = xgene_derive_ring_owner(pdata); in xgene_enet_create_desc_rings()
1337 owner = xgene_derive_ring_owner(pdata); in xgene_enet_create_desc_rings()
1349 rx_ring->irq = pdata->irqs[i]; in xgene_enet_create_desc_rings()
1360 pdata->rx_ring[i] = rx_ring; in xgene_enet_create_desc_rings()
1362 if ((pdata->enet_id == XGENE_ENET1 && pdata->rxq_cnt > 4) || in xgene_enet_create_desc_rings()
1363 (pdata->enet_id == XGENE_ENET2 && pdata->rxq_cnt > 16)) { in xgene_enet_create_desc_rings()
1368 owner = xgene_derive_ring_owner(pdata); in xgene_enet_create_desc_rings()
1399 for (i = 0; i < pdata->txq_cnt; i++) { in xgene_enet_create_desc_rings()
1401 owner = xgene_derive_ring_owner(pdata); in xgene_enet_create_desc_rings()
1420 pdata->tx_ring[i] = tx_ring; in xgene_enet_create_desc_rings()
1422 if (!pdata->cq_cnt) { in xgene_enet_create_desc_rings()
1423 cp_ring = pdata->rx_ring[i]; in xgene_enet_create_desc_rings()
1436 cp_ring->irq = pdata->irqs[pdata->rxq_cnt + i]; in xgene_enet_create_desc_rings()
1461 if (pdata->ring_ops->coalesce) in xgene_enet_create_desc_rings()
1462 pdata->ring_ops->coalesce(pdata->tx_ring[0]); in xgene_enet_create_desc_rings()
1463 pdata->tx_qcnt_hi = pdata->tx_ring[0]->slots - 128; in xgene_enet_create_desc_rings()
1468 xgene_enet_free_desc_rings(pdata); in xgene_enet_create_desc_rings()
1476 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_get_stats64() local
1480 for (i = 0; i < pdata->txq_cnt; i++) { in xgene_enet_get_stats64()
1481 ring = pdata->tx_ring[i]; in xgene_enet_get_stats64()
1490 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_get_stats64()
1491 ring = pdata->rx_ring[i]; in xgene_enet_get_stats64()
1511 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_enet_set_mac_address() local
1517 pdata->mac_ops->set_mac_addr(pdata); in xgene_enet_set_mac_address()
1524 struct xgene_enet_pdata *pdata = netdev_priv(ndev); in xgene_change_mtu() local
1534 pdata->mac_ops->set_framesize(pdata, frame_size); in xgene_change_mtu()
1552 struct xgene_enet_pdata *pdata) in xgene_get_port_id_acpi() argument
1559 pdata->port_id = 0; in xgene_get_port_id_acpi()
1561 pdata->port_id = temp; in xgene_get_port_id_acpi()
1568 static void xgene_get_port_id_dt(struct device *dev, struct xgene_enet_pdata *pdata) in xgene_get_port_id_dt() argument
1574 pdata->port_id = id & BIT(0); in xgene_get_port_id_dt()
1579 static int xgene_get_tx_delay(struct xgene_enet_pdata *pdata) in xgene_get_tx_delay() argument
1581 struct device *dev = &pdata->pdev->dev; in xgene_get_tx_delay()
1586 pdata->tx_delay = 4; in xgene_get_tx_delay()
1595 pdata->tx_delay = delay; in xgene_get_tx_delay()
1600 static int xgene_get_rx_delay(struct xgene_enet_pdata *pdata) in xgene_get_rx_delay() argument
1602 struct device *dev = &pdata->pdev->dev; in xgene_get_rx_delay()
1607 pdata->rx_delay = 2; in xgene_get_rx_delay()
1616 pdata->rx_delay = delay; in xgene_get_rx_delay()
1621 static int xgene_enet_get_irqs(struct xgene_enet_pdata *pdata) in xgene_enet_get_irqs() argument
1623 struct platform_device *pdev = pdata->pdev; in xgene_enet_get_irqs()
1626 if (phy_interface_mode_is_rgmii(pdata->phy_mode)) in xgene_enet_get_irqs()
1628 else if (pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) in xgene_enet_get_irqs()
1636 if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { in xgene_enet_get_irqs()
1638 pdata->rxq_cnt = max_irqs / 2; in xgene_enet_get_irqs()
1639 pdata->txq_cnt = max_irqs / 2; in xgene_enet_get_irqs()
1640 pdata->cq_cnt = max_irqs / 2; in xgene_enet_get_irqs()
1645 pdata->irqs[i] = ret; in xgene_enet_get_irqs()
1651 static void xgene_enet_check_phy_handle(struct xgene_enet_pdata *pdata) in xgene_enet_check_phy_handle() argument
1655 if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) in xgene_enet_check_phy_handle()
1661 ret = xgene_enet_phy_connect(pdata->ndev); in xgene_enet_check_phy_handle()
1663 pdata->mdio_driver = true; in xgene_enet_check_phy_handle()
1666 static void xgene_enet_gpiod_get(struct xgene_enet_pdata *pdata) in xgene_enet_gpiod_get() argument
1668 struct device *dev = &pdata->pdev->dev; in xgene_enet_gpiod_get()
1670 pdata->sfp_gpio_en = false; in xgene_enet_gpiod_get()
1671 if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII || in xgene_enet_gpiod_get()
1676 pdata->sfp_gpio_en = true; in xgene_enet_gpiod_get()
1677 pdata->sfp_rdy = gpiod_get(dev, "rxlos", GPIOD_IN); in xgene_enet_gpiod_get()
1678 if (IS_ERR(pdata->sfp_rdy)) in xgene_enet_gpiod_get()
1679 pdata->sfp_rdy = gpiod_get(dev, "sfp", GPIOD_IN); in xgene_enet_gpiod_get()
1682 static int xgene_enet_get_resources(struct xgene_enet_pdata *pdata) in xgene_enet_get_resources() argument
1692 pdev = pdata->pdev; in xgene_enet_get_resources()
1694 ndev = pdata->ndev; in xgene_enet_get_resources()
1701 pdata->base_addr = devm_ioremap(dev, res->start, resource_size(res)); in xgene_enet_get_resources()
1702 if (!pdata->base_addr) { in xgene_enet_get_resources()
1712 pdata->ring_csr_addr = devm_ioremap(dev, res->start, in xgene_enet_get_resources()
1714 if (!pdata->ring_csr_addr) { in xgene_enet_get_resources()
1724 pdata->ring_cmd_addr = devm_ioremap(dev, res->start, in xgene_enet_get_resources()
1726 if (!pdata->ring_cmd_addr) { in xgene_enet_get_resources()
1732 xgene_get_port_id_dt(dev, pdata); in xgene_enet_get_resources()
1735 xgene_get_port_id_acpi(dev, pdata); in xgene_enet_get_resources()
1743 pdata->phy_mode = device_get_phy_mode(dev); in xgene_enet_get_resources()
1744 if (pdata->phy_mode < 0) { in xgene_enet_get_resources()
1746 return pdata->phy_mode; in xgene_enet_get_resources()
1748 if (!phy_interface_mode_is_rgmii(pdata->phy_mode) && in xgene_enet_get_resources()
1749 pdata->phy_mode != PHY_INTERFACE_MODE_SGMII && in xgene_enet_get_resources()
1750 pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) { in xgene_enet_get_resources()
1755 ret = xgene_get_tx_delay(pdata); in xgene_enet_get_resources()
1759 ret = xgene_get_rx_delay(pdata); in xgene_enet_get_resources()
1763 ret = xgene_enet_get_irqs(pdata); in xgene_enet_get_resources()
1767 xgene_enet_gpiod_get(pdata); in xgene_enet_get_resources()
1769 pdata->clk = devm_clk_get(&pdev->dev, NULL); in xgene_enet_get_resources()
1770 if (IS_ERR(pdata->clk)) { in xgene_enet_get_resources()
1771 if (pdata->phy_mode != PHY_INTERFACE_MODE_SGMII) { in xgene_enet_get_resources()
1776 if (PTR_ERR(pdata->clk) != -ENOENT || dev->of_node) in xgene_enet_get_resources()
1777 return PTR_ERR(pdata->clk); in xgene_enet_get_resources()
1783 if (pdata->phy_mode != PHY_INTERFACE_MODE_XGMII) in xgene_enet_get_resources()
1784 base_addr = pdata->base_addr - (pdata->port_id * MAC_OFFSET); in xgene_enet_get_resources()
1786 base_addr = pdata->base_addr; in xgene_enet_get_resources()
1787 pdata->eth_csr_addr = base_addr + BLOCK_ETH_CSR_OFFSET; in xgene_enet_get_resources()
1788 pdata->cle.base = base_addr + BLOCK_ETH_CLE_CSR_OFFSET; in xgene_enet_get_resources()
1789 pdata->eth_ring_if_addr = base_addr + BLOCK_ETH_RING_IF_OFFSET; in xgene_enet_get_resources()
1790 pdata->eth_diag_csr_addr = base_addr + BLOCK_ETH_DIAG_CSR_OFFSET; in xgene_enet_get_resources()
1791 if (phy_interface_mode_is_rgmii(pdata->phy_mode) || in xgene_enet_get_resources()
1792 pdata->phy_mode == PHY_INTERFACE_MODE_SGMII) { in xgene_enet_get_resources()
1793 pdata->mcx_mac_addr = pdata->base_addr + BLOCK_ETH_MAC_OFFSET; in xgene_enet_get_resources()
1794 pdata->mcx_stats_addr = in xgene_enet_get_resources()
1795 pdata->base_addr + BLOCK_ETH_STATS_OFFSET; in xgene_enet_get_resources()
1796 offset = (pdata->enet_id == XGENE_ENET1) ? in xgene_enet_get_resources()
1799 pdata->mcx_mac_csr_addr = base_addr + offset; in xgene_enet_get_resources()
1801 pdata->mcx_mac_addr = base_addr + BLOCK_AXG_MAC_OFFSET; in xgene_enet_get_resources()
1802 pdata->mcx_stats_addr = base_addr + BLOCK_AXG_STATS_OFFSET; in xgene_enet_get_resources()
1803 pdata->mcx_mac_csr_addr = base_addr + BLOCK_AXG_MAC_CSR_OFFSET; in xgene_enet_get_resources()
1804 pdata->pcs_addr = base_addr + BLOCK_PCS_OFFSET; in xgene_enet_get_resources()
1806 pdata->rx_buff_cnt = NUM_PKT_BUF; in xgene_enet_get_resources()
1811 static int xgene_enet_init_hw(struct xgene_enet_pdata *pdata) in xgene_enet_init_hw() argument
1813 struct xgene_enet_cle *enet_cle = &pdata->cle; in xgene_enet_init_hw()
1815 struct net_device *ndev = pdata->ndev; in xgene_enet_init_hw()
1821 ret = pdata->port_ops->reset(pdata); in xgene_enet_init_hw()
1832 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_init_hw()
1833 buf_pool = pdata->rx_ring[i]->buf_pool; in xgene_enet_init_hw()
1835 page_pool = pdata->rx_ring[i]->page_pool; in xgene_enet_init_hw()
1838 count = pdata->rx_buff_cnt; in xgene_enet_init_hw()
1849 dst_ring_num = xgene_enet_dst_ring_num(pdata->rx_ring[0]); in xgene_enet_init_hw()
1850 buf_pool = pdata->rx_ring[0]->buf_pool; in xgene_enet_init_hw()
1851 if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { in xgene_enet_init_hw()
1860 ret = pdata->cle_ops->cle_init(pdata); in xgene_enet_init_hw()
1867 dst_ring_num = xgene_enet_dst_ring_num(pdata->rx_ring[0]); in xgene_enet_init_hw()
1868 buf_pool = pdata->rx_ring[0]->buf_pool; in xgene_enet_init_hw()
1869 page_pool = pdata->rx_ring[0]->page_pool; in xgene_enet_init_hw()
1871 pdata->port_ops->cle_bypass(pdata, dst_ring_num, in xgene_enet_init_hw()
1876 pdata->phy_speed = SPEED_UNKNOWN; in xgene_enet_init_hw()
1877 pdata->mac_ops->init(pdata); in xgene_enet_init_hw()
1882 xgene_enet_delete_desc_rings(pdata); in xgene_enet_init_hw()
1886 static void xgene_enet_setup_ops(struct xgene_enet_pdata *pdata) in xgene_enet_setup_ops() argument
1888 switch (pdata->phy_mode) { in xgene_enet_setup_ops()
1893 pdata->mac_ops = &xgene_gmac_ops; in xgene_enet_setup_ops()
1894 pdata->port_ops = &xgene_gport_ops; in xgene_enet_setup_ops()
1895 pdata->rm = RM3; in xgene_enet_setup_ops()
1896 pdata->rxq_cnt = 1; in xgene_enet_setup_ops()
1897 pdata->txq_cnt = 1; in xgene_enet_setup_ops()
1898 pdata->cq_cnt = 0; in xgene_enet_setup_ops()
1901 pdata->mac_ops = &xgene_sgmac_ops; in xgene_enet_setup_ops()
1902 pdata->port_ops = &xgene_sgport_ops; in xgene_enet_setup_ops()
1903 pdata->rm = RM1; in xgene_enet_setup_ops()
1904 pdata->rxq_cnt = 1; in xgene_enet_setup_ops()
1905 pdata->txq_cnt = 1; in xgene_enet_setup_ops()
1906 pdata->cq_cnt = 1; in xgene_enet_setup_ops()
1909 pdata->mac_ops = &xgene_xgmac_ops; in xgene_enet_setup_ops()
1910 pdata->port_ops = &xgene_xgport_ops; in xgene_enet_setup_ops()
1911 pdata->cle_ops = &xgene_cle3in_ops; in xgene_enet_setup_ops()
1912 pdata->rm = RM0; in xgene_enet_setup_ops()
1913 if (!pdata->rxq_cnt) { in xgene_enet_setup_ops()
1914 pdata->rxq_cnt = XGENE_NUM_RX_RING; in xgene_enet_setup_ops()
1915 pdata->txq_cnt = XGENE_NUM_TX_RING; in xgene_enet_setup_ops()
1916 pdata->cq_cnt = XGENE_NUM_TXC_RING; in xgene_enet_setup_ops()
1921 if (pdata->enet_id == XGENE_ENET1) { in xgene_enet_setup_ops()
1922 switch (pdata->port_id) { in xgene_enet_setup_ops()
1924 if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { in xgene_enet_setup_ops()
1925 pdata->cpu_bufnum = X2_START_CPU_BUFNUM_0; in xgene_enet_setup_ops()
1926 pdata->eth_bufnum = X2_START_ETH_BUFNUM_0; in xgene_enet_setup_ops()
1927 pdata->bp_bufnum = X2_START_BP_BUFNUM_0; in xgene_enet_setup_ops()
1928 pdata->ring_num = START_RING_NUM_0; in xgene_enet_setup_ops()
1930 pdata->cpu_bufnum = START_CPU_BUFNUM_0; in xgene_enet_setup_ops()
1931 pdata->eth_bufnum = START_ETH_BUFNUM_0; in xgene_enet_setup_ops()
1932 pdata->bp_bufnum = START_BP_BUFNUM_0; in xgene_enet_setup_ops()
1933 pdata->ring_num = START_RING_NUM_0; in xgene_enet_setup_ops()
1937 if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { in xgene_enet_setup_ops()
1938 pdata->cpu_bufnum = XG_START_CPU_BUFNUM_1; in xgene_enet_setup_ops()
1939 pdata->eth_bufnum = XG_START_ETH_BUFNUM_1; in xgene_enet_setup_ops()
1940 pdata->bp_bufnum = XG_START_BP_BUFNUM_1; in xgene_enet_setup_ops()
1941 pdata->ring_num = XG_START_RING_NUM_1; in xgene_enet_setup_ops()
1943 pdata->cpu_bufnum = START_CPU_BUFNUM_1; in xgene_enet_setup_ops()
1944 pdata->eth_bufnum = START_ETH_BUFNUM_1; in xgene_enet_setup_ops()
1945 pdata->bp_bufnum = START_BP_BUFNUM_1; in xgene_enet_setup_ops()
1946 pdata->ring_num = START_RING_NUM_1; in xgene_enet_setup_ops()
1952 pdata->ring_ops = &xgene_ring1_ops; in xgene_enet_setup_ops()
1954 switch (pdata->port_id) { in xgene_enet_setup_ops()
1956 pdata->cpu_bufnum = X2_START_CPU_BUFNUM_0; in xgene_enet_setup_ops()
1957 pdata->eth_bufnum = X2_START_ETH_BUFNUM_0; in xgene_enet_setup_ops()
1958 pdata->bp_bufnum = X2_START_BP_BUFNUM_0; in xgene_enet_setup_ops()
1959 pdata->ring_num = X2_START_RING_NUM_0; in xgene_enet_setup_ops()
1962 pdata->cpu_bufnum = X2_START_CPU_BUFNUM_1; in xgene_enet_setup_ops()
1963 pdata->eth_bufnum = X2_START_ETH_BUFNUM_1; in xgene_enet_setup_ops()
1964 pdata->bp_bufnum = X2_START_BP_BUFNUM_1; in xgene_enet_setup_ops()
1965 pdata->ring_num = X2_START_RING_NUM_1; in xgene_enet_setup_ops()
1970 pdata->rm = RM0; in xgene_enet_setup_ops()
1971 pdata->ring_ops = &xgene_ring2_ops; in xgene_enet_setup_ops()
1975 static void xgene_enet_napi_add(struct xgene_enet_pdata *pdata) in xgene_enet_napi_add() argument
1980 for (i = 0; i < pdata->rxq_cnt; i++) { in xgene_enet_napi_add()
1981 napi = &pdata->rx_ring[i]->napi; in xgene_enet_napi_add()
1982 netif_napi_add(pdata->ndev, napi, xgene_enet_napi, in xgene_enet_napi_add()
1986 for (i = 0; i < pdata->cq_cnt; i++) { in xgene_enet_napi_add()
1987 napi = &pdata->tx_ring[i]->cp_ring->napi; in xgene_enet_napi_add()
1988 netif_napi_add(pdata->ndev, napi, xgene_enet_napi, in xgene_enet_napi_add()
2020 struct xgene_enet_pdata *pdata; in xgene_enet_probe() local
2031 pdata = netdev_priv(ndev); in xgene_enet_probe()
2033 pdata->pdev = pdev; in xgene_enet_probe()
2034 pdata->ndev = ndev; in xgene_enet_probe()
2036 platform_set_drvdata(pdev, pdata); in xgene_enet_probe()
2046 pdata->enet_id = (enum xgene_enet_id)of_id->data; in xgene_enet_probe()
2054 pdata->enet_id = (enum xgene_enet_id) acpi_id->driver_data; in xgene_enet_probe()
2057 if (!pdata->enet_id) { in xgene_enet_probe()
2062 ret = xgene_enet_get_resources(pdata); in xgene_enet_probe()
2066 xgene_enet_setup_ops(pdata); in xgene_enet_probe()
2067 spin_lock_init(&pdata->mac_lock); in xgene_enet_probe()
2069 if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { in xgene_enet_probe()
2071 spin_lock_init(&pdata->mss_lock); in xgene_enet_probe()
2081 xgene_enet_check_phy_handle(pdata); in xgene_enet_probe()
2083 ret = xgene_enet_init_hw(pdata); in xgene_enet_probe()
2087 link_state = pdata->mac_ops->link_state; in xgene_enet_probe()
2088 if (pdata->phy_mode == PHY_INTERFACE_MODE_XGMII) { in xgene_enet_probe()
2089 INIT_DELAYED_WORK(&pdata->link_work, link_state); in xgene_enet_probe()
2090 } else if (!pdata->mdio_driver) { in xgene_enet_probe()
2091 if (phy_interface_mode_is_rgmii(pdata->phy_mode)) in xgene_enet_probe()
2092 ret = xgene_enet_mdio_config(pdata); in xgene_enet_probe()
2094 INIT_DELAYED_WORK(&pdata->link_work, link_state); in xgene_enet_probe()
2100 spin_lock_init(&pdata->stats_lock); in xgene_enet_probe()
2101 ret = xgene_extd_stats_init(pdata); in xgene_enet_probe()
2105 xgene_enet_napi_add(pdata); in xgene_enet_probe()
2120 xgene_enet_delete_desc_rings(pdata); in xgene_enet_probe()
2123 if (pdata->mdio_driver) in xgene_enet_probe()
2124 xgene_enet_phy_disconnect(pdata); in xgene_enet_probe()
2125 else if (phy_interface_mode_is_rgmii(pdata->phy_mode)) in xgene_enet_probe()
2126 xgene_enet_mdio_remove(pdata); in xgene_enet_probe()
2134 struct xgene_enet_pdata *pdata; in xgene_enet_remove() local
2137 pdata = platform_get_drvdata(pdev); in xgene_enet_remove()
2138 ndev = pdata->ndev; in xgene_enet_remove()
2145 if (pdata->mdio_driver) in xgene_enet_remove()
2146 xgene_enet_phy_disconnect(pdata); in xgene_enet_remove()
2147 else if (phy_interface_mode_is_rgmii(pdata->phy_mode)) in xgene_enet_remove()
2148 xgene_enet_mdio_remove(pdata); in xgene_enet_remove()
2151 xgene_enet_delete_desc_rings(pdata); in xgene_enet_remove()
2152 pdata->port_ops->shutdown(pdata); in xgene_enet_remove()
2160 struct xgene_enet_pdata *pdata; in xgene_enet_shutdown() local
2162 pdata = platform_get_drvdata(pdev); in xgene_enet_shutdown()
2163 if (!pdata) in xgene_enet_shutdown()
2166 if (!pdata->ndev) in xgene_enet_shutdown()