Lines Matching full:emac

53 static int emac_get_tx_ts(struct prueth_emac *emac,  in emac_get_tx_ts()  argument
56 struct prueth *prueth = emac->prueth; in emac_get_tx_ts()
57 int slice = prueth_emac_slice(emac); in emac_get_tx_ts()
73 static void tx_ts_work(struct prueth_emac *emac) in tx_ts_work() argument
84 ret = emac_get_tx_ts(emac, &tsr); in tx_ts_work()
89 !emac->tx_ts_skb[tsr.cookie]) { in tx_ts_work()
90 netdev_err(emac->ndev, "Invalid TX TS cookie 0x%x\n", in tx_ts_work()
95 skb = emac->tx_ts_skb[tsr.cookie]; in tx_ts_work()
96 emac->tx_ts_skb[tsr.cookie] = NULL; /* free slot */ in tx_ts_work()
98 netdev_err(emac->ndev, "Driver Bug! got NULL skb\n"); in tx_ts_work()
102 hi_sw = readl(emac->prueth->shram.va + in tx_ts_work()
113 if (atomic_dec_and_test(&emac->tx_ts_pending)) /* no more? */ in tx_ts_work()
120 struct prueth_emac *emac = dev_id; in prueth_tx_ts_irq() local
123 tx_ts_work(emac); in prueth_tx_ts_irq()
243 struct prueth_emac *emac; in prueth_emac_common_start() local
247 if (!prueth->emac[ICSS_SLICE0] && !prueth->emac[ICSS_SLICE1]) in prueth_emac_common_start()
263 emac = prueth->emac[slice]; in prueth_emac_common_start()
264 if (!emac) in prueth_emac_common_start()
266 ret = icssg_config(prueth, emac, slice); in prueth_emac_common_start()
275 emac = prueth->emac[ICSS_SLICE0] ? prueth->emac[ICSS_SLICE0] : in prueth_emac_common_start()
276 prueth->emac[ICSS_SLICE1]; in prueth_emac_common_start()
277 ret = icss_iep_init(emac->iep, &prueth_iep_clockops, in prueth_emac_common_start()
278 emac, IEP_DEFAULT_CYCLE_TIME_NS); in prueth_emac_common_start()
298 struct prueth_emac *emac; in prueth_emac_common_stop() local
300 if (!prueth->emac[ICSS_SLICE0] && !prueth->emac[ICSS_SLICE1]) in prueth_emac_common_stop()
308 emac = prueth->emac[ICSS_SLICE0] ? prueth->emac[ICSS_SLICE0] : in prueth_emac_common_stop()
309 prueth->emac[ICSS_SLICE1]; in prueth_emac_common_stop()
310 icss_iep_exit(emac->iep); in prueth_emac_common_stop()
318 struct prueth_emac *emac = netdev_priv(ndev); in emac_adjust_link() local
320 struct prueth *prueth = emac->prueth; in emac_adjust_link()
326 if (phydev->duplex != emac->duplex) { in emac_adjust_link()
328 emac->duplex = phydev->duplex; in emac_adjust_link()
330 if (phydev->speed != emac->speed) { in emac_adjust_link()
332 emac->speed = phydev->speed; in emac_adjust_link()
334 if (!emac->link) { in emac_adjust_link()
336 emac->link = 1; in emac_adjust_link()
338 } else if (emac->link) { in emac_adjust_link()
340 emac->link = 0; in emac_adjust_link()
343 emac->speed = SPEED_1000; in emac_adjust_link()
346 emac->duplex = DUPLEX_FULL; in emac_adjust_link()
355 if (emac->link) { in emac_adjust_link()
356 if (emac->duplex == DUPLEX_HALF) in emac_adjust_link()
357 icssg_config_half_duplex(emac); in emac_adjust_link()
359 icssg_update_rgmii_cfg(prueth->miig_rt, emac); in emac_adjust_link()
362 spin_lock_irqsave(&emac->lock, flags); in emac_adjust_link()
363 icssg_config_ipg(emac); in emac_adjust_link()
364 spin_unlock_irqrestore(&emac->lock, flags); in emac_adjust_link()
365 icssg_config_set_speed(emac); in emac_adjust_link()
366 icssg_set_port_state(emac, ICSSG_EMAC_PORT_FORWARD); in emac_adjust_link()
369 icssg_set_port_state(emac, ICSSG_EMAC_PORT_DISABLE); in emac_adjust_link()
373 if (emac->link) { in emac_adjust_link()
378 prueth_cleanup_tx_ts(emac); in emac_adjust_link()
384 struct prueth_emac *emac = in emac_rx_timer_callback() local
388 enable_irq(emac->rx_chns.irq[rx_flow]); in emac_rx_timer_callback()
392 static int emac_phy_connect(struct prueth_emac *emac) in emac_phy_connect() argument
394 struct prueth *prueth = emac->prueth; in emac_phy_connect()
395 struct net_device *ndev = emac->ndev; in emac_phy_connect()
397 ndev->phydev = of_phy_connect(emac->ndev, emac->phy_node, in emac_phy_connect()
399 emac->phy_if); in emac_phy_connect()
402 emac->phy_node->full_name); in emac_phy_connect()
406 if (!emac->half_duplex) { in emac_phy_connect()
417 if (emac->phy_if == PHY_INTERFACE_MODE_MII) in emac_phy_connect()
426 struct prueth_emac *emac = clockops_data; in prueth_iep_gettime() local
427 struct prueth *prueth = emac->prueth; in prueth_iep_gettime()
440 iepcount_hi = icss_iep_get_count_hi(emac->iep); in prueth_iep_gettime()
444 iepcount_lo = icss_iep_get_count_low(emac->iep); in prueth_iep_gettime()
447 iepcount_hi_r = icss_iep_get_count_hi(emac->iep); in prueth_iep_gettime()
463 struct prueth_emac *emac = clockops_data; in prueth_iep_settime() local
469 sc_descp = emac->prueth->shram.va + TIMESYNC_FW_WC_SETCLOCK_DESC_OFFSET; in prueth_iep_settime()
479 /* Count from 0 to (cycle time) - emac->iep->def_inc */ in prueth_iep_settime()
480 sc_desc.CMP0_current = cycletime - emac->iep->def_inc; in prueth_iep_settime()
494 dev_err(emac->prueth->dev, "settime timeout\n"); in prueth_iep_settime()
501 struct prueth_emac *emac = clockops_data; in prueth_perout_enable() local
541 writel(reduction_factor, emac->prueth->shram.va + in prueth_perout_enable()
544 current_cycle = icssg_read_time(emac->prueth->shram.va + in prueth_perout_enable()
550 hi_lo_writeq(start_offset, emac->prueth->shram.va + in prueth_perout_enable()
562 static int prueth_create_xdp_rxqs(struct prueth_emac *emac) in prueth_create_xdp_rxqs() argument
564 struct xdp_rxq_info *rxq = &emac->rx_chns.xdp_rxq; in prueth_create_xdp_rxqs()
565 struct page_pool *pool = emac->rx_chns.pg_pool; in prueth_create_xdp_rxqs()
568 ret = xdp_rxq_info_reg(rxq, emac->ndev, 0, emac->napi_rx.napi_id); in prueth_create_xdp_rxqs()
579 static void prueth_destroy_xdp_rxqs(struct prueth_emac *emac) in prueth_destroy_xdp_rxqs() argument
581 struct xdp_rxq_info *rxq = &emac->rx_chns.xdp_rxq; in prueth_destroy_xdp_rxqs()
592 struct prueth_emac *emac; in icssg_prueth_add_mcast() local
598 emac = netdev_priv(real_dev); in icssg_prueth_add_mcast()
600 port_mask = BIT(emac->port_id) | icssg_fdb_lookup(emac, addr, vlan_id); in icssg_prueth_add_mcast()
601 icssg_fdb_add_del(emac, addr, vlan_id, port_mask, true); in icssg_prueth_add_mcast()
602 icssg_vtbl_modify(emac, vlan_id, port_mask, port_mask, true); in icssg_prueth_add_mcast()
610 struct prueth_emac *emac; in icssg_prueth_del_mcast() local
617 emac = netdev_priv(real_dev); in icssg_prueth_del_mcast()
619 port_mask = BIT(emac->port_id); in icssg_prueth_del_mcast()
620 other_port_mask = port_mask ^ icssg_fdb_lookup(emac, addr, vlan_id); in icssg_prueth_del_mcast()
622 icssg_fdb_add_del(emac, addr, vlan_id, port_mask, false); in icssg_prueth_del_mcast()
623 icssg_vtbl_modify(emac, vlan_id, port_mask, port_mask, false); in icssg_prueth_del_mcast()
626 icssg_fdb_add_del(emac, addr, vlan_id, other_port_mask, true); in icssg_prueth_del_mcast()
627 icssg_vtbl_modify(emac, vlan_id, other_port_mask, in icssg_prueth_del_mcast()
634 static void icssg_prueth_hsr_fdb_add_del(struct prueth_emac *emac, in icssg_prueth_hsr_fdb_add_del() argument
637 icssg_fdb_add_del(emac, addr, vid, in icssg_prueth_hsr_fdb_add_del()
644 icssg_vtbl_modify(emac, vid, BIT(emac->port_id), in icssg_prueth_hsr_fdb_add_del()
645 BIT(emac->port_id), add); in icssg_prueth_hsr_fdb_add_del()
651 struct prueth_emac *emac; in icssg_prueth_hsr_add_mcast() local
659 emac = netdev_priv(hsr_get_port_ndev(real_dev, i)); in icssg_prueth_hsr_add_mcast()
660 if (!emac) in icssg_prueth_hsr_add_mcast()
662 icssg_prueth_hsr_fdb_add_del(emac, addr, vlan_id, in icssg_prueth_hsr_add_mcast()
666 emac = netdev_priv(real_dev); in icssg_prueth_hsr_add_mcast()
667 icssg_prueth_hsr_fdb_add_del(emac, addr, vlan_id, true); in icssg_prueth_hsr_add_mcast()
676 struct prueth_emac *emac; in icssg_prueth_hsr_del_mcast() local
684 emac = netdev_priv(hsr_get_port_ndev(real_dev, i)); in icssg_prueth_hsr_del_mcast()
685 if (!emac) in icssg_prueth_hsr_del_mcast()
687 icssg_prueth_hsr_fdb_add_del(emac, addr, vlan_id, in icssg_prueth_hsr_del_mcast()
691 emac = netdev_priv(real_dev); in icssg_prueth_hsr_del_mcast()
692 icssg_prueth_hsr_fdb_add_del(emac, addr, vlan_id, false); in icssg_prueth_hsr_del_mcast()
701 struct prueth_emac *emac = args; in icssg_update_vlan_mcast() local
707 __hw_addr_sync_multiple(&emac->vlan_mcast_list[vid], &vdev->mc, in icssg_update_vlan_mcast()
711 if (emac->prueth->is_hsr_offload_mode) in icssg_update_vlan_mcast()
712 __hw_addr_sync_dev(&emac->vlan_mcast_list[vid], vdev, in icssg_update_vlan_mcast()
716 __hw_addr_sync_dev(&emac->vlan_mcast_list[vid], vdev, in icssg_update_vlan_mcast()
724 * emac_ndo_open - EMAC device open
733 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_open() local
734 int ret, i, num_data_chn = emac->tx_ch_num; in emac_ndo_open()
736 struct prueth *prueth = emac->prueth; in emac_ndo_open()
737 int slice = prueth_emac_slice(emac); in emac_ndo_open()
743 ether_addr_copy(emac->mac_addr, ndev->dev_addr); in emac_ndo_open()
745 icssg_class_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
746 icssg_ft1_set_mac_addr(prueth->miig_rt, slice, emac->mac_addr); in emac_ndo_open()
755 init_completion(&emac->cmd_complete); in emac_ndo_open()
756 ret = prueth_init_tx_chns(emac); in emac_ndo_open()
763 ret = prueth_init_rx_chns(emac, &emac->rx_chns, "rx", in emac_ndo_open()
770 ret = prueth_ndev_add_tx_napi(emac); in emac_ndo_open()
776 ret = request_irq(emac->rx_chns.irq[rx_flow], prueth_rx_irq, in emac_ndo_open()
777 IRQF_TRIGGER_HIGH, dev_name(dev), emac); in emac_ndo_open()
789 flow_cfg = emac->dram.va + ICSSG_CONFIG_OFFSET + PSI_L_REGULAR_FLOW_ID_BASE_OFFSET; in emac_ndo_open()
790 writew(emac->rx_flow_id_base, &flow_cfg->rx_base_flow); in emac_ndo_open()
791 ret = emac_fdb_flow_id_updated(emac); in emac_ndo_open()
800 ret = request_threaded_irq(emac->tx_ts_irq, NULL, prueth_tx_ts_irq, in emac_ndo_open()
801 IRQF_ONESHOT, dev_name(dev), emac); in emac_ndo_open()
806 ret = prueth_prepare_rx_chan(emac, &emac->rx_chns, PRUETH_MAX_PKT_SIZE); in emac_ndo_open()
810 ret = prueth_create_xdp_rxqs(emac); in emac_ndo_open()
814 ret = k3_udma_glue_enable_rx_chn(emac->rx_chns.rx_chn); in emac_ndo_open()
818 for (i = 0; i < emac->tx_ch_num; i++) { in emac_ndo_open()
819 ret = k3_udma_glue_enable_tx_chn(emac->tx_chns[i].tx_chn); in emac_ndo_open()
825 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_open()
826 napi_enable(&emac->tx_chns[i].napi_tx); in emac_ndo_open()
827 napi_enable(&emac->napi_rx); in emac_ndo_open()
834 queue_work(system_long_wq, &emac->stats_work.work); in emac_ndo_open()
842 prueth_reset_tx_chan(emac, i, false); in emac_ndo_open()
844 prueth_destroy_xdp_rxqs(emac); in emac_ndo_open()
846 prueth_reset_rx_chan(&emac->rx_chns, max_rx_flows, false); in emac_ndo_open()
848 free_irq(emac->tx_ts_irq, emac); in emac_ndo_open()
853 free_irq(emac->rx_chns.irq[rx_flow], emac); in emac_ndo_open()
855 prueth_ndev_del_tx_napi(emac, emac->tx_ch_num); in emac_ndo_open()
857 prueth_cleanup_rx_chns(emac, &emac->rx_chns, max_rx_flows); in emac_ndo_open()
859 prueth_cleanup_tx_chns(emac); in emac_ndo_open()
865 * emac_ndo_stop - EMAC device stop
874 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_stop() local
875 struct prueth *prueth = emac->prueth; in emac_ndo_stop()
887 if (emac->prueth->is_hsr_offload_mode) in emac_ndo_stop()
892 atomic_set(&emac->tdown_cnt, emac->tx_ch_num); in emac_ndo_stop()
896 reinit_completion(&emac->tdown_complete); in emac_ndo_stop()
897 for (i = 0; i < emac->tx_ch_num; i++) in emac_ndo_stop()
898 k3_udma_glue_tdown_tx_chn(emac->tx_chns[i].tx_chn, false); in emac_ndo_stop()
900 ret = wait_for_completion_timeout(&emac->tdown_complete, in emac_ndo_stop()
905 prueth_reset_tx_chan(emac, emac->tx_ch_num, true); in emac_ndo_stop()
906 for (i = 0; i < emac->tx_ch_num; i++) { in emac_ndo_stop()
907 napi_disable(&emac->tx_chns[i].napi_tx); in emac_ndo_stop()
908 hrtimer_cancel(&emac->tx_chns[i].tx_hrtimer); in emac_ndo_stop()
912 k3_udma_glue_tdown_rx_chn(emac->rx_chns.rx_chn, true); in emac_ndo_stop()
914 prueth_reset_rx_chan(&emac->rx_chns, max_rx_flows, true); in emac_ndo_stop()
915 prueth_destroy_xdp_rxqs(emac); in emac_ndo_stop()
916 napi_disable(&emac->napi_rx); in emac_ndo_stop()
917 hrtimer_cancel(&emac->rx_hrtimer); in emac_ndo_stop()
919 cancel_work_sync(&emac->rx_mode_work); in emac_ndo_stop()
922 cancel_delayed_work_sync(&emac->stats_work); in emac_ndo_stop()
928 free_irq(emac->tx_ts_irq, emac); in emac_ndo_stop()
930 free_irq(emac->rx_chns.irq[rx_flow], emac); in emac_ndo_stop()
931 prueth_ndev_del_tx_napi(emac, emac->tx_ch_num); in emac_ndo_stop()
933 prueth_cleanup_rx_chns(emac, &emac->rx_chns, max_rx_flows); in emac_ndo_stop()
934 prueth_cleanup_tx_chns(emac); in emac_ndo_stop()
943 struct prueth_emac *emac = container_of(work, struct prueth_emac, rx_mode_work); in emac_ndo_set_rx_mode_work() local
944 struct net_device *ndev = emac->ndev; in emac_ndo_set_rx_mode_work()
952 icssg_set_port_state(emac, ICSSG_EMAC_PORT_UC_FLOODING_DISABLE); in emac_ndo_set_rx_mode_work()
953 icssg_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_DISABLE); in emac_ndo_set_rx_mode_work()
956 icssg_set_port_state(emac, ICSSG_EMAC_PORT_UC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
957 icssg_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
962 icssg_set_port_state(emac, ICSSG_EMAC_PORT_MC_FLOODING_ENABLE); in emac_ndo_set_rx_mode_work()
966 if (emac->prueth->is_hsr_offload_mode) { in emac_ndo_set_rx_mode_work()
970 vlan_for_each(emac->prueth->hsr_dev, in emac_ndo_set_rx_mode_work()
971 icssg_update_vlan_mcast, emac); in emac_ndo_set_rx_mode_work()
978 vlan_for_each(ndev, icssg_update_vlan_mcast, emac); in emac_ndo_set_rx_mode_work()
985 * emac_ndo_set_rx_mode - EMAC set receive mode function
986 * @ndev: The EMAC network adapter
993 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_set_rx_mode() local
995 queue_work(emac->cmd_wq, &emac->rx_mode_work); in emac_ndo_set_rx_mode()
1024 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_vlan_rx_add_vid() local
1025 struct prueth *prueth = emac->prueth; in emac_ndo_vlan_rx_add_vid()
1026 int port_mask = BIT(emac->port_id); in emac_ndo_vlan_rx_add_vid()
1032 __hw_addr_init(&emac->vlan_mcast_list[vid]); in emac_ndo_vlan_rx_add_vid()
1033 netdev_dbg(emac->ndev, "VID add vid:%u port_mask:%X untag_mask %X\n", in emac_ndo_vlan_rx_add_vid()
1036 icssg_vtbl_modify(emac, vid, port_mask, untag_mask, true); in emac_ndo_vlan_rx_add_vid()
1037 icssg_set_pvid(emac->prueth, vid, emac->port_id); in emac_ndo_vlan_rx_add_vid()
1045 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_vlan_rx_del_vid() local
1046 struct prueth *prueth = emac->prueth; in emac_ndo_vlan_rx_del_vid()
1047 int port_mask = BIT(emac->port_id); in emac_ndo_vlan_rx_del_vid()
1053 netdev_dbg(emac->ndev, "VID del vid:%u port_mask:%X untag_mask %X\n", in emac_ndo_vlan_rx_del_vid()
1055 icssg_vtbl_modify(emac, vid, port_mask, untag_mask, false); in emac_ndo_vlan_rx_del_vid()
1076 struct prueth_emac *emac = netdev_priv(dev); in emac_xdp_xmit() local
1077 struct net_device *ndev = emac->ndev; in emac_xdp_xmit()
1086 q_idx = cpu % emac->tx_ch_num; in emac_xdp_xmit()
1095 err = emac_xmit_xdp_frame(emac, xdpf, NULL, q_idx); in emac_xdp_xmit()
1109 * @emac: emac device
1114 static int emac_xdp_setup(struct prueth_emac *emac, struct netdev_bpf *bpf) in emac_xdp_setup() argument
1118 if (!emac->xdpi.prog && !prog) in emac_xdp_setup()
1121 WRITE_ONCE(emac->xdp_prog, prog); in emac_xdp_setup()
1123 xdp_attachment_setup(&emac->xdpi, bpf); in emac_xdp_setup()
1137 struct prueth_emac *emac = netdev_priv(ndev); in emac_ndo_bpf() local
1141 return emac_xdp_setup(emac, bpf); in emac_ndo_bpf()
1169 struct prueth_emac *emac; in prueth_netdev_init() local
1183 ndev = alloc_etherdev_mq(sizeof(*emac), num_tx_chn); in prueth_netdev_init()
1187 emac = netdev_priv(ndev); in prueth_netdev_init()
1188 emac->prueth = prueth; in prueth_netdev_init()
1189 emac->ndev = ndev; in prueth_netdev_init()
1190 emac->port_id = port; in prueth_netdev_init()
1191 emac->xdp_prog = NULL; in prueth_netdev_init()
1192 emac->ndev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS; in prueth_netdev_init()
1193 emac->cmd_wq = create_singlethread_workqueue("icssg_cmd_wq"); in prueth_netdev_init()
1194 if (!emac->cmd_wq) { in prueth_netdev_init()
1198 INIT_WORK(&emac->rx_mode_work, emac_ndo_set_rx_mode_work); in prueth_netdev_init()
1200 INIT_DELAYED_WORK(&emac->stats_work, icssg_stats_work_handler); in prueth_netdev_init()
1205 &emac->dram); in prueth_netdev_init()
1212 emac->tx_ch_num = 1; in prueth_netdev_init()
1215 if (emac->port_id == PRUETH_PORT_MII1) in prueth_netdev_init()
1217 emac->tx_ts_irq = platform_get_irq_byname_optional(prueth->pdev, irq_name); in prueth_netdev_init()
1218 if (emac->tx_ts_irq < 0) { in prueth_netdev_init()
1219 ret = dev_err_probe(prueth->dev, emac->tx_ts_irq, "could not get tx_ts_irq\n"); in prueth_netdev_init()
1224 spin_lock_init(&emac->lock); in prueth_netdev_init()
1225 mutex_init(&emac->cmd_lock); in prueth_netdev_init()
1227 emac->phy_node = of_parse_phandle(eth_node, "phy-handle", 0); in prueth_netdev_init()
1228 if (!emac->phy_node && !of_phy_is_fixed_link(eth_node)) { in prueth_netdev_init()
1240 emac->phy_node = eth_node; in prueth_netdev_init()
1243 ret = of_get_phy_mode(eth_node, &emac->phy_if); in prueth_netdev_init()
1249 if (emac->phy_if != PHY_INTERFACE_MODE_MII && in prueth_netdev_init()
1250 !phy_interface_mode_is_rgmii(emac->phy_if)) { in prueth_netdev_init()
1251 dev_err(prueth->dev, "PHY mode unsupported %s\n", phy_modes(emac->phy_if)); in prueth_netdev_init()
1261 switch (emac->phy_if) { in prueth_netdev_init()
1263 emac->phy_if = PHY_INTERFACE_MODE_RGMII_RXID; in prueth_netdev_init()
1266 emac->phy_if = PHY_INTERFACE_MODE_RGMII; in prueth_netdev_init()
1284 ether_addr_copy(emac->mac_addr, ndev->dev_addr); in prueth_netdev_init()
1299 netif_napi_add(ndev, &emac->napi_rx, icssg_napi_rx_poll); in prueth_netdev_init()
1300 hrtimer_setup(&emac->rx_hrtimer, &emac_rx_timer_callback, CLOCK_MONOTONIC, in prueth_netdev_init()
1302 prueth->emac[mac] = emac; in prueth_netdev_init()
1307 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_init()
1309 destroy_workqueue(emac->cmd_wq); in prueth_netdev_init()
1311 emac->ndev = NULL; in prueth_netdev_init()
1312 prueth->emac[mac] = NULL; in prueth_netdev_init()
1321 struct prueth_emac *emac = netdev_priv(ndev); in prueth_dev_check() local
1323 return emac->prueth->is_switch_mode; in prueth_dev_check()
1340 struct prueth_emac *emac = prueth->emac[i]; in prueth_offload_fwd_mark_update() local
1342 if (!emac || !emac->ndev) in prueth_offload_fwd_mark_update()
1345 emac->offload_fwd_mark = set_val; in prueth_offload_fwd_mark_update()
1351 struct prueth_emac *emac0 = prueth->emac[PRUETH_MAC0]; in prueth_emac_restart()
1352 struct prueth_emac *emac1 = prueth->emac[PRUETH_MAC1]; in prueth_emac_restart()
1394 struct prueth_emac *emac; in icssg_change_mode() local
1404 emac = prueth->emac[mac]; in icssg_change_mode()
1406 if (emac->ndev->features & NETIF_F_HW_HSR_TAG_RM) in icssg_change_mode()
1407 icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_ENABLE); in icssg_change_mode()
1409 icssg_set_port_state(emac, ICSSG_EMAC_HSR_RX_OFFLOAD_DISABLE); in icssg_change_mode()
1412 if (netif_running(emac->ndev)) { in icssg_change_mode()
1413 icssg_fdb_add_del(emac, eth_stp_addr, prueth->default_vlan, in icssg_change_mode()
1419 icssg_vtbl_modify(emac, emac->port_vlan | DEFAULT_VID, in icssg_change_mode()
1420 BIT(emac->port_id) | DEFAULT_PORT_MASK, in icssg_change_mode()
1421 BIT(emac->port_id) | DEFAULT_UNTAG_MASK, in icssg_change_mode()
1424 icssg_vtbl_modify(emac, DEFAULT_VID, in icssg_change_mode()
1427 icssg_set_pvid(prueth, emac->port_vlan, emac->port_id); in icssg_change_mode()
1429 icssg_set_port_state(emac, ICSSG_EMAC_PORT_VLAN_AWARE_ENABLE); in icssg_change_mode()
1438 struct prueth_emac *emac = netdev_priv(ndev); in prueth_netdevice_port_link() local
1439 struct prueth *prueth = emac->prueth; in prueth_netdevice_port_link()
1452 err = switchdev_bridge_port_offload(br_ndev, ndev, emac, in prueth_netdevice_port_link()
1459 prueth->br_members |= BIT(emac->port_id); in prueth_netdevice_port_link()
1466 emac->port_vlan = prueth->default_vlan; in prueth_netdevice_port_link()
1478 struct prueth_emac *emac = netdev_priv(ndev); in prueth_netdevice_port_unlink() local
1479 struct prueth *prueth = emac->prueth; in prueth_netdevice_port_unlink()
1482 prueth->br_members &= ~BIT(emac->port_id); in prueth_netdevice_port_unlink()
1486 emac->port_vlan = 0; in prueth_netdevice_port_unlink()
1502 struct prueth_emac *emac = netdev_priv(ndev); in prueth_hsr_port_link() local
1503 struct prueth *prueth = emac->prueth; in prueth_hsr_port_link()
1507 emac0 = prueth->emac[PRUETH_MAC0]; in prueth_hsr_port_link()
1508 emac1 = prueth->emac[PRUETH_MAC1]; in prueth_hsr_port_link()
1513 prueth->hsr_members |= BIT(emac->port_id); in prueth_hsr_port_link()
1536 struct prueth_emac *emac = netdev_priv(ndev); in prueth_hsr_port_unlink() local
1537 struct prueth *prueth = emac->prueth; in prueth_hsr_port_unlink()
1542 emac0 = prueth->emac[PRUETH_MAC0]; in prueth_hsr_port_unlink()
1543 emac1 = prueth->emac[PRUETH_MAC1]; in prueth_hsr_port_unlink()
1545 prueth->hsr_members &= ~BIT(emac->port_id); in prueth_hsr_port_unlink()
1567 struct prueth_emac *emac = netdev_priv(ndev); in prueth_netdevice_event() local
1568 struct prueth *prueth = emac->prueth; in prueth_netdevice_event()
1822 prueth->emac[PRUETH_MAC0]->half_duplex = in prueth_probe()
1825 prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; in prueth_probe()
1836 prueth->emac[PRUETH_MAC1]->half_duplex = in prueth_probe()
1839 prueth->emac[PRUETH_MAC1]->iep = prueth->iep0; in prueth_probe()
1844 ret = register_netdev(prueth->emac[PRUETH_MAC0]->ndev); in prueth_probe()
1850 prueth->registered_netdevs[PRUETH_MAC0] = prueth->emac[PRUETH_MAC0]->ndev; in prueth_probe()
1852 ret = emac_phy_connect(prueth->emac[PRUETH_MAC0]); in prueth_probe()
1858 phy_attached_info(prueth->emac[PRUETH_MAC0]->ndev->phydev); in prueth_probe()
1862 ret = register_netdev(prueth->emac[PRUETH_MAC1]->ndev); in prueth_probe()
1868 prueth->registered_netdevs[PRUETH_MAC1] = prueth->emac[PRUETH_MAC1]->ndev; in prueth_probe()
1869 ret = emac_phy_connect(prueth->emac[PRUETH_MAC1]); in prueth_probe()
1875 phy_attached_info(prueth->emac[PRUETH_MAC1]->ndev->phydev); in prueth_probe()
1886 dev_info(dev, "TI PRU ethernet driver initialized: %s EMAC mode\n", in prueth_probe()
1899 if (prueth->emac[i]->ndev->phydev) { in prueth_probe()
1900 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_probe()
1901 prueth->emac[i]->ndev->phydev = NULL; in prueth_probe()
1958 phy_stop(prueth->emac[i]->ndev->phydev); in prueth_remove()
1959 phy_disconnect(prueth->emac[i]->ndev->phydev); in prueth_remove()
1960 prueth->emac[i]->ndev->phydev = NULL; in prueth_remove()