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()
437 prueth_cleanup_rx_chns(emac, rx_chn, max_rflows); in prueth_init_rx_chns()
441 static int prueth_dma_rx_push(struct prueth_emac *emac, in prueth_dma_rx_push() argument
445 struct net_device *ndev = emac->ndev; in prueth_dma_rx_push()
493 static void emac_rx_timestamp(struct prueth_emac *emac, in emac_rx_timestamp() argument
499 u32 hi_sw = readl(emac->prueth->shram.va + in emac_rx_timestamp()
509 static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id) in emac_rx_packet() argument
511 struct prueth_rx_chn *rx_chn = &emac->rx_chns; in emac_rx_packet()
513 struct net_device *ndev = emac->ndev; in emac_rx_packet()
538 if (emac->rx_ts_enabled) in emac_rx_packet()
539 emac_rx_timestamp(emac, skb, psdata); in emac_rx_packet()
563 napi_gro_receive(&emac->napi_rx, skb); in emac_rx_packet()
569 ret = prueth_dma_rx_push(emac, new_skb, &emac->rx_chns); in emac_rx_packet()
601 static int emac_get_tx_ts(struct prueth_emac *emac, in emac_get_tx_ts() argument
604 struct prueth *prueth = emac->prueth; in emac_get_tx_ts()
605 int slice = prueth_emac_slice(emac); in emac_get_tx_ts()
621 static void tx_ts_work(struct prueth_emac *emac) in tx_ts_work() argument
632 ret = emac_get_tx_ts(emac, &tsr); in tx_ts_work()
637 !emac->tx_ts_skb[tsr.cookie]) { in tx_ts_work()
638 netdev_err(emac->ndev, "Invalid TX TS cookie 0x%x\n", in tx_ts_work()
643 skb = emac->tx_ts_skb[tsr.cookie]; in tx_ts_work()
644 emac->tx_ts_skb[tsr.cookie] = NULL; /* free slot */ in tx_ts_work()
646 netdev_err(emac->ndev, "Driver Bug! got NULL skb\n"); in tx_ts_work()
650 hi_sw = readl(emac->prueth->shram.va + in tx_ts_work()
661 if (atomic_dec_and_test(&emac->tx_ts_pending)) /* no more? */ in tx_ts_work()
666 static int prueth_tx_ts_cookie_get(struct prueth_emac *emac) in prueth_tx_ts_cookie_get() argument
672 if (!emac->tx_ts_skb[i]) { in prueth_tx_ts_cookie_get()
673 emac->tx_ts_skb[i] = ERR_PTR(-EBUSY); /* reserve slot */ in prueth_tx_ts_cookie_get()
696 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_start_xmit() local
710 tx_chn = &emac->tx_chns[q_idx]; in emac_ndo_start_xmit()
735 emac->tx_ts_enabled) { in emac_ndo_start_xmit()
736 tx_ts_cookie = prueth_tx_ts_cookie_get(emac); in emac_ndo_start_xmit()
742 emac->tx_ts_skb[tx_ts_cookie] = skb_get(skb); in emac_ndo_start_xmit()
751 cppi5_desc_set_tags_ids(&first_desc->hdr, 0, (emac->port_id | (q_idx << 8))); in emac_ndo_start_xmit()
809 atomic_inc(&emac->tx_ts_pending); in emac_ndo_start_xmit()
825 dev_kfree_skb_any(emac->tx_ts_skb[tx_ts_cookie]); in emac_ndo_start_xmit()
826 emac->tx_ts_skb[tx_ts_cookie] = NULL; in emac_ndo_start_xmit()
843 dev_kfree_skb_any(emac->tx_ts_skb[tx_ts_cookie]); in emac_ndo_start_xmit()
844 emac->tx_ts_skb[tx_ts_cookie] = NULL; in emac_ndo_start_xmit()
870 struct prueth_emac *emac = dev_id; in prueth_tx_ts_irq() local
873 tx_ts_work(emac); in prueth_tx_ts_irq()
880 struct prueth_emac *emac = dev_id; in prueth_rx_irq() local
883 napi_schedule(&emac->napi_rx); in prueth_rx_irq()
907 static int prueth_emac_start(struct prueth *prueth, struct prueth_emac *emac) in prueth_emac_start() argument
915 slice = prueth_emac_slice(emac); in prueth_emac_start()
917 netdev_err(emac->ndev, "invalid port\n"); in prueth_emac_start()
921 ret = icssg_config(prueth, emac, slice); in prueth_emac_start()
946 emac->fw_running = 1; in prueth_emac_start()
958 static void prueth_emac_stop(struct prueth_emac *emac) in prueth_emac_stop() argument
960 struct prueth *prueth = emac->prueth; in prueth_emac_stop()
963 switch (emac->port_id) { in prueth_emac_stop()
971 netdev_err(emac->ndev, "invalid port\n"); in prueth_emac_stop()
975 emac->fw_running = 0; in prueth_emac_stop()
981 static void prueth_cleanup_tx_ts(struct prueth_emac *emac) in prueth_cleanup_tx_ts() argument
986 if (emac->tx_ts_skb[i]) { in prueth_cleanup_tx_ts()
987 dev_kfree_skb_any(emac->tx_ts_skb[i]); in prueth_cleanup_tx_ts()
988 emac->tx_ts_skb[i] = NULL; in prueth_cleanup_tx_ts()
996 struct prueth_emac *emac = netdev_priv(ndev); in emac_adjust_link() local
998 struct prueth *prueth = emac->prueth; in emac_adjust_link()
1004 if (phydev->duplex != emac->duplex) { in emac_adjust_link()
1006 emac->duplex = phydev->duplex; in emac_adjust_link()
1008 if (phydev->speed != emac->speed) { in emac_adjust_link()
1010 emac->speed = phydev->speed; in emac_adjust_link()
1012 if (!emac->link) { in emac_adjust_link()
1014 emac->link = 1; in emac_adjust_link()
1016 } else if (emac->link) { in emac_adjust_link()
1018 emac->link = 0; in emac_adjust_link()
1021 emac->speed = SPEED_1000; in emac_adjust_link()
1024 emac->duplex = DUPLEX_FULL; in emac_adjust_link()
1033 if (emac->link) { in emac_adjust_link()
1035 icssg_update_rgmii_cfg(prueth->miig_rt, emac); in emac_adjust_link()
1038 spin_lock_irqsave(&emac->lock, flags); in emac_adjust_link()
1039 icssg_config_ipg(emac); in emac_adjust_link()
1040 spin_unlock_irqrestore(&emac->lock, flags); in emac_adjust_link()
1041 icssg_config_set_speed(emac); in emac_adjust_link()
1042 emac_set_port_state(emac, ICSSG_EMAC_PORT_FORWARD); in emac_adjust_link()
1045 emac_set_port_state(emac, ICSSG_EMAC_PORT_DISABLE); in emac_adjust_link()
1049 if (emac->link) { in emac_adjust_link()
1054 prueth_cleanup_tx_ts(emac); in emac_adjust_link()
1060 struct prueth_emac *emac = prueth_napi_to_emac(napi_rx); in emac_napi_rx_poll() local
1071 ret = emac_rx_packet(emac, flow); in emac_napi_rx_poll()
1082 enable_irq(emac->rx_chns.irq[rx_flow]); in emac_napi_rx_poll()
1087 static int prueth_prepare_rx_chan(struct prueth_emac *emac, in prueth_prepare_rx_chan() argument
1099 ret = prueth_dma_rx_push(emac, skb, chn); in prueth_prepare_rx_chan()
1101 netdev_err(emac->ndev, in prueth_prepare_rx_chan()
1112 static void prueth_reset_tx_chan(struct prueth_emac *emac, int ch_num, in prueth_reset_tx_chan() argument
1119 k3_udma_glue_reset_tx_chn(emac->tx_chns[i].tx_chn, in prueth_reset_tx_chan()
1120 &emac->tx_chns[i], in prueth_reset_tx_chan()
1122 k3_udma_glue_disable_tx_chn(emac->tx_chns[i].tx_chn); in prueth_reset_tx_chan()
1138 static int emac_phy_connect(struct prueth_emac *emac) in emac_phy_connect() argument
1140 struct prueth *prueth = emac->prueth; in emac_phy_connect()
1141 struct net_device *ndev = emac->ndev; in emac_phy_connect()
1143 ndev->phydev = of_phy_connect(emac->ndev, emac->phy_node, in emac_phy_connect()
1145 emac->phy_if); in emac_phy_connect()
1148 emac->phy_node->full_name); in emac_phy_connect()
1159 if (emac->phy_if == PHY_INTERFACE_MODE_MII) in emac_phy_connect()
1168 struct prueth_emac *emac = clockops_data; in prueth_iep_gettime() local
1169 struct prueth *prueth = emac->prueth; in prueth_iep_gettime()
1182 iepcount_hi = icss_iep_get_count_hi(emac->iep); in prueth_iep_gettime()
1186 iepcount_lo = icss_iep_get_count_low(emac->iep); in prueth_iep_gettime()
1189 iepcount_hi_r = icss_iep_get_count_hi(emac->iep); in prueth_iep_gettime()
1205 struct prueth_emac *emac = clockops_data; in prueth_iep_settime() local
1211 if (!emac->fw_running) in prueth_iep_settime()
1214 sc_descp = emac->prueth->shram.va + TIMESYNC_FW_WC_SETCLOCK_DESC_OFFSET; in prueth_iep_settime()
1238 dev_err(emac->prueth->dev, "settime timeout\n"); in prueth_iep_settime()
1245 struct prueth_emac *emac = clockops_data; in prueth_perout_enable() local
1283 writel(reduction_factor, emac->prueth->shram.va + in prueth_perout_enable()
1286 writel(0, emac->prueth->shram.va + in prueth_perout_enable()
1308 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_open() local
1309 int ret, i, num_data_chn = emac->tx_ch_num; in emac_ndo_open()
1310 struct prueth *prueth = emac->prueth; in emac_ndo_open()
1311 int slice = prueth_emac_slice(emac); in emac_ndo_open()
1323 ether_addr_copy(emac->mac_addr, ndev->dev_addr); in emac_ndo_open()
1325 icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
1326 icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
1337 init_completion(&emac->cmd_complete); in emac_ndo_open()
1338 ret = prueth_init_tx_chns(emac); in emac_ndo_open()
1345 ret = prueth_init_rx_chns(emac, &emac->rx_chns, "rx", in emac_ndo_open()
1352 ret = prueth_ndev_add_tx_napi(emac); in emac_ndo_open()
1358 ret = request_irq(emac->rx_chns.irq[rx_flow], prueth_rx_irq, in emac_ndo_open()
1359 IRQF_TRIGGER_HIGH, dev_name(dev), emac); in emac_ndo_open()
1366 ret = prueth_emac_start(prueth, emac); in emac_ndo_open()
1373 ret = icss_iep_init(emac->iep, &prueth_iep_clockops, in emac_ndo_open()
1374 emac, IEP_DEFAULT_CYCLE_TIME_NS); in emac_ndo_open()
1377 ret = request_threaded_irq(emac->tx_ts_irq, NULL, prueth_tx_ts_irq, in emac_ndo_open()
1378 IRQF_ONESHOT, dev_name(dev), emac); in emac_ndo_open()
1383 ret = prueth_prepare_rx_chan(emac, &emac->rx_chns, PRUETH_MAX_PKT_SIZE); in emac_ndo_open()
1387 ret = k3_udma_glue_enable_rx_chn(emac->rx_chns.rx_chn); in emac_ndo_open()
1391 for (i = 0; i < emac->tx_ch_num; i++) { in emac_ndo_open()
1392 ret = k3_udma_glue_enable_tx_chn(emac->tx_chns[i].tx_chn); in emac_ndo_open()
1398 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_open()
1399 napi_enable(&emac->tx_chns[i].napi_tx); in emac_ndo_open()
1400 napi_enable(&emac->napi_rx); in emac_ndo_open()
1407 queue_work(system_long_wq, &emac->stats_work.work); in emac_ndo_open()
1415 prueth_reset_tx_chan(emac, i, false); in emac_ndo_open()
1417 prueth_reset_rx_chan(&emac->rx_chns, max_rx_flows, false); in emac_ndo_open()
1419 free_irq(emac->tx_ts_irq, emac); in emac_ndo_open()
1421 prueth_emac_stop(emac); in emac_ndo_open()
1423 free_irq(emac->rx_chns.irq[rx_flow], emac); in emac_ndo_open()
1425 prueth_ndev_del_tx_napi(emac, emac->tx_ch_num); in emac_ndo_open()
1427 prueth_cleanup_rx_chns(emac, &emac->rx_chns, max_rx_flows); in emac_ndo_open()
1429 prueth_cleanup_tx_chns(emac); in emac_ndo_open()
1444 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_stop() local
1445 struct prueth *prueth = emac->prueth; in emac_ndo_stop()
1457 icssg_class_disable(prueth->miig_rt, prueth_emac_slice(emac)); in emac_ndo_stop()
1459 atomic_set(&emac->tdown_cnt, emac->tx_ch_num); in emac_ndo_stop()
1463 reinit_completion(&emac->tdown_complete); in emac_ndo_stop()
1464 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_stop()
1465 k3_udma_glue_tdown_tx_chn(emac->tx_chns[i].tx_chn, false); in emac_ndo_stop()
1467 ret = wait_for_completion_timeout(&emac->tdown_complete, in emac_ndo_stop()
1472 prueth_reset_tx_chan(emac, emac->tx_ch_num, true); in emac_ndo_stop()
1473 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_stop()
1474 napi_disable(&emac->tx_chns[i].napi_tx); in emac_ndo_stop()
1477 k3_udma_glue_tdown_rx_chn(emac->rx_chns.rx_chn, true); in emac_ndo_stop()
1479 prueth_reset_rx_chan(&emac->rx_chns, max_rx_flows, true); in emac_ndo_stop()
1481 napi_disable(&emac->napi_rx); in emac_ndo_stop()
1483 cancel_work_sync(&emac->rx_mode_work); in emac_ndo_stop()
1486 cancel_delayed_work_sync(&emac->stats_work); in emac_ndo_stop()
1489 prueth_emac_stop(emac); in emac_ndo_stop()
1492 icss_iep_exit(emac->iep); in emac_ndo_stop()
1495 prueth_emac_stop(emac); in emac_ndo_stop()
1497 free_irq(emac->tx_ts_irq, emac); in emac_ndo_stop()
1499 free_irq(emac->rx_chns.irq[rx_flow], emac); in emac_ndo_stop()
1500 prueth_ndev_del_tx_napi(emac, emac->tx_ch_num); in emac_ndo_stop()
1501 prueth_cleanup_tx_chns(emac); in emac_ndo_stop()
1503 prueth_cleanup_rx_chns(emac, &emac->rx_chns, max_rx_flows); in emac_ndo_stop()
1504 prueth_cleanup_tx_chns(emac); in emac_ndo_stop()
1518 struct prueth_emac *emac = container_of(work, struct prueth_emac, rx_mode_work); in emac_ndo_set_rx_mode_work() local
1519 struct net_device *ndev = emac->ndev; in emac_ndo_set_rx_mode_work()
1527 emac_set_port_state(emac, ICSSG_EMAC_PORT_UC_FLOODING_DISABLE); in emac_ndo_set_rx_mode_work()
1528 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_DISABLE); in emac_ndo_set_rx_mode_work()
1531 emac_set_port_state(emac, ICSSG_EMAC_PORT_UC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1532 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1537 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1542 emac_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
1556 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_set_rx_mode() local
1558 queue_work(emac->cmd_wq, &emac->rx_mode_work); in emac_ndo_set_rx_mode()
1563 struct prueth_emac *emac = netdev_priv(ndev); in emac_set_ts_config() local
1571 emac->tx_ts_enabled = 0; in emac_set_ts_config()
1574 emac->tx_ts_enabled = 1; in emac_set_ts_config()
1582 emac->rx_ts_enabled = 0; in emac_set_ts_config()
1599 emac->rx_ts_enabled = 1; in emac_set_ts_config()
1612 struct prueth_emac *emac = netdev_priv(ndev); in emac_get_ts_config() local
1616 config.tx_type = emac->tx_ts_enabled ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF; in emac_get_ts_config()
1617 config.rx_filter = emac->rx_ts_enabled ? HWTSTAMP_FILTER_ALL : HWTSTAMP_FILTER_NONE; in emac_get_ts_config()
1640 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_get_stats64() local
1642 emac_update_hardware_stats(emac); in emac_ndo_get_stats64()
1644 stats->rx_packets = emac_get_stat_by_name(emac, "rx_packets"); in emac_ndo_get_stats64()
1645 stats->rx_bytes = emac_get_stat_by_name(emac, "rx_bytes"); in emac_ndo_get_stats64()
1646 stats->tx_packets = emac_get_stat_by_name(emac, "tx_packets"); in emac_ndo_get_stats64()
1647 stats->tx_bytes = emac_get_stat_by_name(emac, "tx_bytes"); in emac_ndo_get_stats64()
1648 stats->rx_crc_errors = emac_get_stat_by_name(emac, "rx_crc_errors"); in emac_ndo_get_stats64()
1649 stats->rx_over_errors = emac_get_stat_by_name(emac, "rx_over_errors"); in emac_ndo_get_stats64()
1650 stats->multicast = emac_get_stat_by_name(emac, "rx_multicast_frames"); in emac_ndo_get_stats64()
1710 struct prueth_emac *emac; in prueth_netdev_init() local
1724 ndev = alloc_etherdev_mq(sizeof(*emac), num_tx_chn); in prueth_netdev_init()
1728 emac = netdev_priv(ndev); in prueth_netdev_init()
1729 emac->prueth = prueth; in prueth_netdev_init()
1730 emac->ndev = ndev; in prueth_netdev_init()
1731 emac->port_id = port; in prueth_netdev_init()
1732 emac->cmd_wq = create_singlethread_workqueue("icssg_cmd_wq"); in prueth_netdev_init()
1733 if (!emac->cmd_wq) { in prueth_netdev_init()
1737 INIT_WORK(&emac->rx_mode_work, emac_ndo_set_rx_mode_work); in prueth_netdev_init()
1739 INIT_DELAYED_WORK(&emac->stats_work, emac_stats_work_handler); in prueth_netdev_init()
1744 &emac->dram); in prueth_netdev_init()
1751 emac->tx_ch_num = 1; in prueth_netdev_init()
1754 if (emac->port_id == PRUETH_PORT_MII1) in prueth_netdev_init()
1756 emac->tx_ts_irq = platform_get_irq_byname_optional(prueth->pdev, irq_name); in prueth_netdev_init()
1757 if (emac->tx_ts_irq < 0) { in prueth_netdev_init()
1758 ret = dev_err_probe(prueth->dev, emac->tx_ts_irq, "could not get tx_ts_irq\n"); in prueth_netdev_init()
1763 spin_lock_init(&emac->lock); in prueth_netdev_init()
1764 mutex_init(&emac->cmd_lock); in prueth_netdev_init()
1766 emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0); in prueth_netdev_init()
1767 if (!emac->phy_node && !of_phy_is_fixed_link(eth_node)) { in prueth_netdev_init()
1779 emac->phy_node = eth_node; in prueth_netdev_init()
1782 ret = of_get_phy_mode(eth_node, &emac->phy_if); in prueth_netdev_init()
1788 if (emac->phy_if != PHY_INTERFACE_MODE_MII && in prueth_netdev_init()
1789 !phy_interface_mode_is_rgmii(emac->phy_if)) { in prueth_netdev_init()
1790 dev_err(prueth->dev, "PHY mode unsupported %s\n", phy_modes(emac->phy_if)); in prueth_netdev_init()
1800 switch (emac->phy_if) { in prueth_netdev_init()
1802 emac->phy_if = PHY_INTERFACE_MODE_RGMII_RXID; in prueth_netdev_init()
1805 emac->phy_if = PHY_INTERFACE_MODE_RGMII; in prueth_netdev_init()
1823 ether_addr_copy(emac->mac_addr, ndev->dev_addr); in prueth_netdev_init()
1832 netif_napi_add(ndev, &emac->napi_rx, emac_napi_rx_poll); in prueth_netdev_init()
1833 prueth->emac[mac] = emac; in prueth_netdev_init()
1838 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_init()
1840 destroy_workqueue(emac->cmd_wq); in prueth_netdev_init()
1842 emac->ndev = NULL; in prueth_netdev_init()
1843 prueth->emac[mac] = NULL; in prueth_netdev_init()
1852 struct prueth_emac *emac; in prueth_netdev_exit() local
1859 emac = prueth->emac[mac]; in prueth_netdev_exit()
1860 if (!emac) in prueth_netdev_exit()
1863 if (of_phy_is_fixed_link(emac->phy_node)) in prueth_netdev_exit()
1864 of_phy_deregister_fixed_link(emac->phy_node); in prueth_netdev_exit()
1866 netif_napi_del(&emac->napi_rx); in prueth_netdev_exit()
1868 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_exit()
1869 destroy_workqueue(emac->cmd_wq); in prueth_netdev_exit()
1870 free_netdev(emac->ndev); in prueth_netdev_exit()
1871 prueth->emac[mac] = NULL; in prueth_netdev_exit()
2115 prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; in prueth_probe()
2126 prueth->emac[PRUETH_MAC1]->iep = prueth->iep0; in prueth_probe()
2131 ret = register_netdev(prueth->emac[PRUETH_MAC0]->ndev); in prueth_probe()
2137 prueth->registered_netdevs[PRUETH_MAC0] = prueth->emac[PRUETH_MAC0]->ndev; in prueth_probe()
2139 ret = emac_phy_connect(prueth->emac[PRUETH_MAC0]); in prueth_probe()
2145 phy_attached_info(prueth->emac[PRUETH_MAC0]->ndev->phydev); in prueth_probe()
2149 ret = register_netdev(prueth->emac[PRUETH_MAC1]->ndev); in prueth_probe()
2155 prueth->registered_netdevs[PRUETH_MAC1] = prueth->emac[PRUETH_MAC1]->ndev; in prueth_probe()
2156 ret = emac_phy_connect(prueth->emac[PRUETH_MAC1]); in prueth_probe()
2162 phy_attached_info(prueth->emac[PRUETH_MAC1]->ndev->phydev); in prueth_probe()
2178 if (prueth->emac[i]->ndev->phydev) { in prueth_probe()
2179 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_probe()
2180 prueth->emac[i]->ndev->phydev = NULL; in prueth_probe()
2237 phy_stop(prueth->emac[i]->ndev->phydev); in prueth_remove()
2238 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_remove()
2239 prueth->emac[i]->ndev->phydev = NULL; in prueth_remove()