Lines Matching refs:emac
61 static void prueth_cleanup_rx_chns(struct prueth_emac *emac, in prueth_cleanup_rx_chns() argument
72 static void prueth_cleanup_tx_chns(struct prueth_emac *emac) in prueth_cleanup_tx_chns() argument
76 for (i = 0; i < emac->tx_ch_num; i++) { in prueth_cleanup_tx_chns()
77 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_cleanup_tx_chns()
92 static void prueth_ndev_del_tx_napi(struct prueth_emac *emac, int num) in prueth_ndev_del_tx_napi() argument
97 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_ndev_del_tx_napi()
141 static int emac_tx_complete_packets(struct prueth_emac *emac, int chn, in emac_tx_complete_packets() argument
144 struct net_device *ndev = emac->ndev; in emac_tx_complete_packets()
154 tx_chn = &emac->tx_chns[chn]; in emac_tx_complete_packets()
163 if (atomic_dec_and_test(&emac->tdown_cnt)) in emac_tx_complete_packets()
164 complete(&emac->tdown_complete); in emac_tx_complete_packets()
207 struct prueth_emac *emac = tx_chn->emac; in emac_napi_tx_poll() local
210 num_tx_packets = emac_tx_complete_packets(emac, tx_chn->id, budget); in emac_napi_tx_poll()
231 static int prueth_ndev_add_tx_napi(struct prueth_emac *emac) in prueth_ndev_add_tx_napi() argument
233 struct prueth *prueth = emac->prueth; in prueth_ndev_add_tx_napi()
236 for (i = 0; i < emac->tx_ch_num; i++) { in prueth_ndev_add_tx_napi()
237 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_ndev_add_tx_napi()
239 netif_napi_add_tx(emac->ndev, &tx_chn->napi_tx, emac_napi_tx_poll); in prueth_ndev_add_tx_napi()
253 prueth_ndev_del_tx_napi(emac, i); in prueth_ndev_add_tx_napi()
257 static int prueth_init_tx_chns(struct prueth_emac *emac) in prueth_init_tx_chns() argument
266 struct device *dev = emac->prueth->dev; in prueth_init_tx_chns()
267 struct net_device *ndev = emac->ndev; in prueth_init_tx_chns()
271 slice = prueth_emac_slice(emac); in prueth_init_tx_chns()
275 init_completion(&emac->tdown_complete); in prueth_init_tx_chns()
284 for (i = 0; i < emac->tx_ch_num; i++) { in prueth_init_tx_chns()
285 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_init_tx_chns()
291 tx_chn->emac = emac; in prueth_init_tx_chns()
333 prueth_cleanup_tx_chns(emac); in prueth_init_tx_chns()
337 static int prueth_init_rx_chns(struct prueth_emac *emac, in prueth_init_rx_chns() argument
343 struct device *dev = emac->prueth->dev; in prueth_init_rx_chns()
344 struct net_device *ndev = emac->ndev; in prueth_init_rx_chns()
348 slice = prueth_emac_slice(emac); in prueth_init_rx_chns()
387 emac->rx_flow_id_base = k3_udma_glue_rx_get_flow_id_base(rx_chn->rx_chn); in prueth_init_rx_chns()
388 netdev_dbg(ndev, "flow id base = %d\n", emac->rx_flow_id_base); in prueth_init_rx_chns()
412 rx_flow_cfg.rxfdq_cfg.mode = emac->prueth->pdata.fdqring_mode; in prueth_init_rx_chns()
435 prueth_cleanup_rx_chns(emac, rx_chn, max_rflows); in prueth_init_rx_chns()
439 static int prueth_dma_rx_push(struct prueth_emac *emac, in prueth_dma_rx_push() argument
443 struct net_device *ndev = emac->ndev; in prueth_dma_rx_push()
491 static void emac_rx_timestamp(struct prueth_emac *emac, in emac_rx_timestamp() argument
497 u32 hi_sw = readl(emac->prueth->shram.va + in emac_rx_timestamp()
507 static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id) in emac_rx_packet() argument
509 struct prueth_rx_chn *rx_chn = &emac->rx_chns; in emac_rx_packet()
511 struct net_device *ndev = emac->ndev; in emac_rx_packet()
536 if (emac->rx_ts_enabled) in emac_rx_packet()
537 emac_rx_timestamp(emac, skb, psdata); in emac_rx_packet()
561 napi_gro_receive(&emac->napi_rx, skb); in emac_rx_packet()
567 ret = prueth_dma_rx_push(emac, new_skb, &emac->rx_chns); in emac_rx_packet()
599 static int emac_get_tx_ts(struct prueth_emac *emac, in emac_get_tx_ts() argument
602 struct prueth *prueth = emac->prueth; in emac_get_tx_ts()
603 int slice = prueth_emac_slice(emac); in emac_get_tx_ts()
619 static void tx_ts_work(struct prueth_emac *emac) in tx_ts_work() argument
630 ret = emac_get_tx_ts(emac, &tsr); in tx_ts_work()
635 !emac->tx_ts_skb[tsr.cookie]) { in tx_ts_work()
636 netdev_err(emac->ndev, "Invalid TX TS cookie 0x%x\n", in tx_ts_work()
641 skb = emac->tx_ts_skb[tsr.cookie]; in tx_ts_work()
642 emac->tx_ts_skb[tsr.cookie] = NULL; /* free slot */ in tx_ts_work()
644 netdev_err(emac->ndev, "Driver Bug! got NULL skb\n"); in tx_ts_work()
648 hi_sw = readl(emac->prueth->shram.va + in tx_ts_work()
659 if (atomic_dec_and_test(&emac->tx_ts_pending)) /* no more? */ in tx_ts_work()
664 static int prueth_tx_ts_cookie_get(struct prueth_emac *emac) in prueth_tx_ts_cookie_get() argument
670 if (!emac->tx_ts_skb[i]) { in prueth_tx_ts_cookie_get()
671 emac->tx_ts_skb[i] = ERR_PTR(-EBUSY); /* reserve slot */ in prueth_tx_ts_cookie_get()
694 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_start_xmit() local
708 tx_chn = &emac->tx_chns[q_idx]; in emac_ndo_start_xmit()
733 emac->tx_ts_enabled) { in emac_ndo_start_xmit()
734 tx_ts_cookie = prueth_tx_ts_cookie_get(emac); in emac_ndo_start_xmit()
740 emac->tx_ts_skb[tx_ts_cookie] = skb_get(skb); in emac_ndo_start_xmit()
749 cppi5_desc_set_tags_ids(&first_desc->hdr, 0, (emac->port_id | (q_idx << 8))); in emac_ndo_start_xmit()
807 atomic_inc(&emac->tx_ts_pending); in emac_ndo_start_xmit()
823 dev_kfree_skb_any(emac->tx_ts_skb[tx_ts_cookie]); in emac_ndo_start_xmit()
824 emac->tx_ts_skb[tx_ts_cookie] = NULL; in emac_ndo_start_xmit()
841 dev_kfree_skb_any(emac->tx_ts_skb[tx_ts_cookie]); in emac_ndo_start_xmit()
842 emac->tx_ts_skb[tx_ts_cookie] = NULL; in emac_ndo_start_xmit()
868 struct prueth_emac *emac = dev_id; in prueth_tx_ts_irq() local
871 tx_ts_work(emac); in prueth_tx_ts_irq()
878 struct prueth_emac *emac = dev_id; in prueth_rx_irq() local
881 napi_schedule(&emac->napi_rx); in prueth_rx_irq()
905 static int prueth_emac_start(struct prueth *prueth, struct prueth_emac *emac) in prueth_emac_start() argument
913 slice = prueth_emac_slice(emac); in prueth_emac_start()
915 netdev_err(emac->ndev, "invalid port\n"); in prueth_emac_start()
919 ret = icssg_config(prueth, emac, slice); in prueth_emac_start()
944 emac->fw_running = 1; in prueth_emac_start()
956 static void prueth_emac_stop(struct prueth_emac *emac) in prueth_emac_stop() argument
958 struct prueth *prueth = emac->prueth; in prueth_emac_stop()
961 switch (emac->port_id) { in prueth_emac_stop()
969 netdev_err(emac->ndev, "invalid port\n"); in prueth_emac_stop()
973 emac->fw_running = 0; in prueth_emac_stop()
979 static void prueth_cleanup_tx_ts(struct prueth_emac *emac) in prueth_cleanup_tx_ts() argument
984 if (emac->tx_ts_skb[i]) { in prueth_cleanup_tx_ts()
985 dev_kfree_skb_any(emac->tx_ts_skb[i]); in prueth_cleanup_tx_ts()
986 emac->tx_ts_skb[i] = NULL; in prueth_cleanup_tx_ts()
994 struct prueth_emac *emac = netdev_priv(ndev); in emac_adjust_link() local
996 struct prueth *prueth = emac->prueth; in emac_adjust_link()
1002 if (phydev->duplex != emac->duplex) { in emac_adjust_link()
1004 emac->duplex = phydev->duplex; in emac_adjust_link()
1006 if (phydev->speed != emac->speed) { in emac_adjust_link()
1008 emac->speed = phydev->speed; in emac_adjust_link()
1010 if (!emac->link) { in emac_adjust_link()
1012 emac->link = 1; in emac_adjust_link()
1014 } else if (emac->link) { in emac_adjust_link()
1016 emac->link = 0; in emac_adjust_link()
1019 emac->speed = SPEED_1000; in emac_adjust_link()
1022 emac->duplex = DUPLEX_FULL; in emac_adjust_link()
1031 if (emac->link) { in emac_adjust_link()
1033 icssg_update_rgmii_cfg(prueth->miig_rt, emac); in emac_adjust_link()
1036 spin_lock_irqsave(&emac->lock, flags); in emac_adjust_link()
1037 icssg_config_ipg(emac); in emac_adjust_link()
1038 spin_unlock_irqrestore(&emac->lock, flags); in emac_adjust_link()
1039 icssg_config_set_speed(emac); in emac_adjust_link()
1040 emac_set_port_state(emac, ICSSG_EMAC_PORT_FORWARD); in emac_adjust_link()
1043 emac_set_port_state(emac, ICSSG_EMAC_PORT_DISABLE); in emac_adjust_link()
1047 if (emac->link) { in emac_adjust_link()
1052 prueth_cleanup_tx_ts(emac); in emac_adjust_link()
1058 struct prueth_emac *emac = prueth_napi_to_emac(napi_rx); in emac_napi_rx_poll() local
1069 ret = emac_rx_packet(emac, flow); in emac_napi_rx_poll()
1080 enable_irq(emac->rx_chns.irq[rx_flow]); in emac_napi_rx_poll()
1085 static int prueth_prepare_rx_chan(struct prueth_emac *emac, in prueth_prepare_rx_chan() argument
1097 ret = prueth_dma_rx_push(emac, skb, chn); in prueth_prepare_rx_chan()
1099 netdev_err(emac->ndev, in prueth_prepare_rx_chan()
1110 static void prueth_reset_tx_chan(struct prueth_emac *emac, int ch_num, in prueth_reset_tx_chan() argument
1117 k3_udma_glue_reset_tx_chn(emac->tx_chns[i].tx_chn, in prueth_reset_tx_chan()
1118 &emac->tx_chns[i], in prueth_reset_tx_chan()
1120 k3_udma_glue_disable_tx_chn(emac->tx_chns[i].tx_chn); in prueth_reset_tx_chan()
1136 static int emac_phy_connect(struct prueth_emac *emac) in emac_phy_connect() argument
1138 struct prueth *prueth = emac->prueth; in emac_phy_connect()
1139 struct net_device *ndev = emac->ndev; in emac_phy_connect()
1141 ndev->phydev = of_phy_connect(emac->ndev, emac->phy_node, in emac_phy_connect()
1143 emac->phy_if); in emac_phy_connect()
1146 emac->phy_node->full_name); in emac_phy_connect()
1157 if (emac->phy_if == PHY_INTERFACE_MODE_MII) in emac_phy_connect()
1166 struct prueth_emac *emac = clockops_data; in prueth_iep_gettime() local
1167 struct prueth *prueth = emac->prueth; in prueth_iep_gettime()
1180 iepcount_hi = icss_iep_get_count_hi(emac->iep); in prueth_iep_gettime()
1184 iepcount_lo = icss_iep_get_count_low(emac->iep); in prueth_iep_gettime()
1187 iepcount_hi_r = icss_iep_get_count_hi(emac->iep); in prueth_iep_gettime()
1203 struct prueth_emac *emac = clockops_data; in prueth_iep_settime() local
1209 if (!emac->fw_running) in prueth_iep_settime()
1212 sc_descp = emac->prueth->shram.va + TIMESYNC_FW_WC_SETCLOCK_DESC_OFFSET; in prueth_iep_settime()
1236 dev_err(emac->prueth->dev, "settime timeout\n"); in prueth_iep_settime()
1243 struct prueth_emac *emac = clockops_data; in prueth_perout_enable() local
1281 writel(reduction_factor, emac->prueth->shram.va + in prueth_perout_enable()
1284 writel(0, emac->prueth->shram.va + in prueth_perout_enable()
1306 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_open() local
1307 int ret, i, num_data_chn = emac->tx_ch_num; in emac_ndo_open()
1308 struct prueth *prueth = emac->prueth; in emac_ndo_open()
1309 int slice = prueth_emac_slice(emac); in emac_ndo_open()
1321 ether_addr_copy(emac->mac_addr, ndev->dev_addr); in emac_ndo_open()
1323 icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
1324 icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
1335 init_completion(&emac->cmd_complete); in emac_ndo_open()
1336 ret = prueth_init_tx_chns(emac); in emac_ndo_open()
1343 ret = prueth_init_rx_chns(emac, &emac->rx_chns, "rx", in emac_ndo_open()
1350 ret = prueth_ndev_add_tx_napi(emac); in emac_ndo_open()
1356 ret = request_irq(emac->rx_chns.irq[rx_flow], prueth_rx_irq, in emac_ndo_open()
1357 IRQF_TRIGGER_HIGH, dev_name(dev), emac); in emac_ndo_open()
1364 ret = prueth_emac_start(prueth, emac); in emac_ndo_open()
1371 ret = icss_iep_init(emac->iep, &prueth_iep_clockops, in emac_ndo_open()
1372 emac, IEP_DEFAULT_CYCLE_TIME_NS); in emac_ndo_open()
1375 ret = request_threaded_irq(emac->tx_ts_irq, NULL, prueth_tx_ts_irq, in emac_ndo_open()
1376 IRQF_ONESHOT, dev_name(dev), emac); in emac_ndo_open()
1381 ret = prueth_prepare_rx_chan(emac, &emac->rx_chns, PRUETH_MAX_PKT_SIZE); in emac_ndo_open()
1385 ret = k3_udma_glue_enable_rx_chn(emac->rx_chns.rx_chn); in emac_ndo_open()
1389 for (i = 0; i < emac->tx_ch_num; i++) { in emac_ndo_open()
1390 ret = k3_udma_glue_enable_tx_chn(emac->tx_chns[i].tx_chn); in emac_ndo_open()
1396 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_open()
1397 napi_enable(&emac->tx_chns[i].napi_tx); in emac_ndo_open()
1398 napi_enable(&emac->napi_rx); in emac_ndo_open()
1405 queue_work(system_long_wq, &emac->stats_work.work); in emac_ndo_open()
1413 prueth_reset_tx_chan(emac, i, false); in emac_ndo_open()
1415 prueth_reset_rx_chan(&emac->rx_chns, max_rx_flows, false); in emac_ndo_open()
1417 free_irq(emac->tx_ts_irq, emac); in emac_ndo_open()
1419 prueth_emac_stop(emac); in emac_ndo_open()
1421 free_irq(emac->rx_chns.irq[rx_flow], emac); in emac_ndo_open()
1423 prueth_ndev_del_tx_napi(emac, emac->tx_ch_num); in emac_ndo_open()
1425 prueth_cleanup_rx_chns(emac, &emac->rx_chns, max_rx_flows); in emac_ndo_open()
1427 prueth_cleanup_tx_chns(emac); in emac_ndo_open()
1442 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_stop() local
1443 struct prueth *prueth = emac->prueth; in emac_ndo_stop()
1455 icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); in emac_ndo_stop()
1457 atomic_set(&emac->tdown_cnt, emac->tx_ch_num); in emac_ndo_stop()
1461 reinit_completion(&emac->tdown_complete); in emac_ndo_stop()
1462 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_stop()
1463 k3_udma_glue_tdown_tx_chn(emac->tx_chns[i].tx_chn, false); in emac_ndo_stop()
1465 ret = wait_for_completion_timeout(&emac->tdown_complete, in emac_ndo_stop()
1470 prueth_reset_tx_chan(emac, emac->tx_ch_num, true); in emac_ndo_stop()
1471 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_stop()
1472 napi_disable(&emac->tx_chns[i].napi_tx); in emac_ndo_stop()
1475 k3_udma_glue_tdown_rx_chn(emac->rx_chns.rx_chn, true); in emac_ndo_stop()
1477 prueth_reset_rx_chan(&emac->rx_chns, max_rx_flows, true); in emac_ndo_stop()
1479 napi_disable(&emac->napi_rx); in emac_ndo_stop()
1481 cancel_work_sync(&emac->rx_mode_work); in emac_ndo_stop()
1484 cancel_delayed_work_sync(&emac->stats_work); in emac_ndo_stop()
1487 prueth_emac_stop(emac); in emac_ndo_stop()
1490 icss_iep_exit(emac->iep); in emac_ndo_stop()
1493 prueth_emac_stop(emac); in emac_ndo_stop()
1495 free_irq(emac->tx_ts_irq, emac); in emac_ndo_stop()
1497 free_irq(emac->rx_chns.irq[rx_flow], emac); in emac_ndo_stop()
1498 prueth_ndev_del_tx_napi(emac, emac->tx_ch_num); in emac_ndo_stop()
1499 prueth_cleanup_tx_chns(emac); in emac_ndo_stop()
1501 prueth_cleanup_rx_chns(emac, &emac->rx_chns, max_rx_flows); in emac_ndo_stop()
1502 prueth_cleanup_tx_chns(emac); in emac_ndo_stop()
1516 struct prueth_emac *emac = container_of(work, struct prueth_emac, rx_mode_work); in emac_ndo_set_rx_mode_work() local
1517 struct net_device *ndev = emac->ndev; in emac_ndo_set_rx_mode_work()
1525 emac_set_port_state(emac, ICSSG_EMAC_PORT_UC_FLOODING_DISABLE); in emac_ndo_set_rx_mode_work()
1526 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_DISABLE); in emac_ndo_set_rx_mode_work()
1529 emac_set_port_state(emac, ICSSG_EMAC_PORT_UC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1530 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1535 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1540 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1554 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_set_rx_mode() local
1556 queue_work(emac->cmd_wq, &emac->rx_mode_work); in emac_ndo_set_rx_mode()
1561 struct prueth_emac *emac = netdev_priv(ndev); in emac_set_ts_config() local
1569 emac->tx_ts_enabled = 0; in emac_set_ts_config()
1572 emac->tx_ts_enabled = 1; in emac_set_ts_config()
1580 emac->rx_ts_enabled = 0; in emac_set_ts_config()
1597 emac->rx_ts_enabled = 1; in emac_set_ts_config()
1610 struct prueth_emac *emac = netdev_priv(ndev); in emac_get_ts_config() local
1614 config.tx_type = emac->tx_ts_enabled ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF; in emac_get_ts_config()
1615 config.rx_filter = emac->rx_ts_enabled ? HWTSTAMP_FILTER_ALL : HWTSTAMP_FILTER_NONE; in emac_get_ts_config()
1638 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_get_stats64() local
1640 emac_update_hardware_stats(emac); in emac_ndo_get_stats64()
1642 stats->rx_packets = emac_get_stat_by_name(emac, "rx_packets"); in emac_ndo_get_stats64()
1643 stats->rx_bytes = emac_get_stat_by_name(emac, "rx_bytes"); in emac_ndo_get_stats64()
1644 stats->tx_packets = emac_get_stat_by_name(emac, "tx_packets"); in emac_ndo_get_stats64()
1645 stats->tx_bytes = emac_get_stat_by_name(emac, "tx_bytes"); in emac_ndo_get_stats64()
1646 stats->rx_crc_errors = emac_get_stat_by_name(emac, "rx_crc_errors"); in emac_ndo_get_stats64()
1647 stats->rx_over_errors = emac_get_stat_by_name(emac, "rx_over_errors"); in emac_ndo_get_stats64()
1648 stats->multicast = emac_get_stat_by_name(emac, "rx_multicast_frames"); in emac_ndo_get_stats64()
1708 struct prueth_emac *emac; in prueth_netdev_init() local
1722 ndev = alloc_etherdev_mq(sizeof(*emac), num_tx_chn); in prueth_netdev_init()
1726 emac = netdev_priv(ndev); in prueth_netdev_init()
1727 emac->prueth = prueth; in prueth_netdev_init()
1728 emac->ndev = ndev; in prueth_netdev_init()
1729 emac->port_id = port; in prueth_netdev_init()
1730 emac->cmd_wq = create_singlethread_workqueue("icssg_cmd_wq"); in prueth_netdev_init()
1731 if (!emac->cmd_wq) { in prueth_netdev_init()
1735 INIT_WORK(&emac->rx_mode_work, emac_ndo_set_rx_mode_work); in prueth_netdev_init()
1737 INIT_DELAYED_WORK(&emac->stats_work, emac_stats_work_handler); in prueth_netdev_init()
1742 &emac->dram); in prueth_netdev_init()
1749 emac->tx_ch_num = 1; in prueth_netdev_init()
1752 if (emac->port_id == PRUETH_PORT_MII1) in prueth_netdev_init()
1754 emac->tx_ts_irq = platform_get_irq_byname_optional(prueth->pdev, irq_name); in prueth_netdev_init()
1755 if (emac->tx_ts_irq < 0) { in prueth_netdev_init()
1756 ret = dev_err_probe(prueth->dev, emac->tx_ts_irq, "could not get tx_ts_irq\n"); in prueth_netdev_init()
1761 spin_lock_init(&emac->lock); in prueth_netdev_init()
1762 mutex_init(&emac->cmd_lock); in prueth_netdev_init()
1764 emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0); in prueth_netdev_init()
1765 if (!emac->phy_node && !of_phy_is_fixed_link(eth_node)) { in prueth_netdev_init()
1777 emac->phy_node = eth_node; in prueth_netdev_init()
1780 ret = of_get_phy_mode(eth_node, &emac->phy_if); in prueth_netdev_init()
1786 if (emac->phy_if != PHY_INTERFACE_MODE_MII && in prueth_netdev_init()
1787 !phy_interface_mode_is_rgmii(emac->phy_if)) { in prueth_netdev_init()
1788 dev_err(prueth->dev, "PHY mode unsupported %s\n", phy_modes(emac->phy_if)); in prueth_netdev_init()
1798 switch (emac->phy_if) { in prueth_netdev_init()
1800 emac->phy_if = PHY_INTERFACE_MODE_RGMII_RXID; in prueth_netdev_init()
1803 emac->phy_if = PHY_INTERFACE_MODE_RGMII; in prueth_netdev_init()
1821 ether_addr_copy(emac->mac_addr, ndev->dev_addr); in prueth_netdev_init()
1830 netif_napi_add(ndev, &emac->napi_rx, emac_napi_rx_poll); in prueth_netdev_init()
1831 prueth->emac[mac] = emac; in prueth_netdev_init()
1836 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_init()
1838 destroy_workqueue(emac->cmd_wq); in prueth_netdev_init()
1840 emac->ndev = NULL; in prueth_netdev_init()
1841 prueth->emac[mac] = NULL; in prueth_netdev_init()
1850 struct prueth_emac *emac; in prueth_netdev_exit() local
1857 emac = prueth->emac[mac]; in prueth_netdev_exit()
1858 if (!emac) in prueth_netdev_exit()
1861 if (of_phy_is_fixed_link(emac->phy_node)) in prueth_netdev_exit()
1862 of_phy_deregister_fixed_link(emac->phy_node); in prueth_netdev_exit()
1864 netif_napi_del(&emac->napi_rx); in prueth_netdev_exit()
1866 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_exit()
1867 destroy_workqueue(emac->cmd_wq); in prueth_netdev_exit()
1868 free_netdev(emac->ndev); in prueth_netdev_exit()
1869 prueth->emac[mac] = NULL; in prueth_netdev_exit()
2113 prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; in prueth_probe()
2124 prueth->emac[PRUETH_MAC1]->iep = prueth->iep0; in prueth_probe()
2129 ret = register_netdev(prueth->emac[PRUETH_MAC0]->ndev); in prueth_probe()
2135 prueth->registered_netdevs[PRUETH_MAC0] = prueth->emac[PRUETH_MAC0]->ndev; in prueth_probe()
2137 emac_phy_connect(prueth->emac[PRUETH_MAC0]); in prueth_probe()
2138 phy_attached_info(prueth->emac[PRUETH_MAC0]->ndev->phydev); in prueth_probe()
2142 ret = register_netdev(prueth->emac[PRUETH_MAC1]->ndev); in prueth_probe()
2148 prueth->registered_netdevs[PRUETH_MAC1] = prueth->emac[PRUETH_MAC1]->ndev; in prueth_probe()
2149 emac_phy_connect(prueth->emac[PRUETH_MAC1]); in prueth_probe()
2150 phy_attached_info(prueth->emac[PRUETH_MAC1]->ndev->phydev); in prueth_probe()
2166 if (prueth->emac[i]->ndev->phydev) { in prueth_probe()
2167 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_probe()
2168 prueth->emac[i]->ndev->phydev = NULL; in prueth_probe()
2225 phy_stop(prueth->emac[i]->ndev->phydev); in prueth_remove()
2226 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_remove()
2227 prueth->emac[i]->ndev->phydev = NULL; in prueth_remove()