Lines Matching refs:lmac
42 struct lmac { struct
69 struct lmac lmac[MAX_LMAC_PER_BGX]; argument
82 static int bgx_xaui_check_link(struct lmac *lmac);
107 static u64 bgx_reg_read(struct bgx *bgx, u8 lmac, u64 offset) in bgx_reg_read() argument
109 void __iomem *addr = bgx->reg_base + ((u32)lmac << 20) + offset; in bgx_reg_read()
114 static void bgx_reg_write(struct bgx *bgx, u8 lmac, u64 offset, u64 val) in bgx_reg_write() argument
116 void __iomem *addr = bgx->reg_base + ((u32)lmac << 20) + offset; in bgx_reg_write()
121 static void bgx_reg_modify(struct bgx *bgx, u8 lmac, u64 offset, u64 val) in bgx_reg_modify() argument
123 void __iomem *addr = bgx->reg_base + ((u32)lmac << 20) + offset; in bgx_reg_modify()
128 static int bgx_poll_reg(struct bgx *bgx, u8 lmac, u64 reg, u64 mask, bool zero) in bgx_poll_reg() argument
134 reg_val = bgx_reg_read(bgx, lmac, reg); in bgx_poll_reg()
209 struct lmac *lmac; in bgx_get_lmac_link_state() local
215 lmac = &bgx->lmac[lmacid]; in bgx_get_lmac_link_state()
216 link->mac_type = lmac->lmac_type; in bgx_get_lmac_link_state()
217 link->link_up = lmac->link_up; in bgx_get_lmac_link_state()
218 link->duplex = lmac->last_duplex; in bgx_get_lmac_link_state()
219 link->speed = lmac->last_speed; in bgx_get_lmac_link_state()
228 return bgx->lmac[lmacid].mac; in bgx_get_lmac_mac()
241 ether_addr_copy(bgx->lmac[lmacid].mac, mac); in bgx_set_lmac_mac()
247 struct lmac *lmac = NULL; in bgx_flush_dmac_cam_filter() local
250 lmac = &bgx->lmac[lmacid]; in bgx_flush_dmac_cam_filter()
252 for (idx = 0; idx < lmac->dmacs_count; idx++) in bgx_flush_dmac_cam_filter()
254 ((lmacid * lmac->dmacs_count) + idx) * in bgx_flush_dmac_cam_filter()
258 static void bgx_lmac_remove_filters(struct lmac *lmac, u8 vf_id) in bgx_lmac_remove_filters() argument
262 if (!lmac) in bgx_lmac_remove_filters()
270 for (i = lmac->dmacs_cfg - 1; i >= 0; i--) { in bgx_lmac_remove_filters()
271 lmac->dmacs[i].vf_map &= ~BIT_ULL(vf_id); in bgx_lmac_remove_filters()
272 if (!lmac->dmacs[i].vf_map) { in bgx_lmac_remove_filters()
273 lmac->dmacs_cfg--; in bgx_lmac_remove_filters()
274 lmac->dmacs[i].dmac = 0; in bgx_lmac_remove_filters()
275 lmac->dmacs[i].vf_map = 0; in bgx_lmac_remove_filters()
280 static int bgx_lmac_save_filter(struct lmac *lmac, u64 dmac, u8 vf_id) in bgx_lmac_save_filter() argument
284 if (!lmac) in bgx_lmac_save_filter()
294 for (i = 0; i < lmac->dmacs_cfg; i++) { in bgx_lmac_save_filter()
295 if (lmac->dmacs[i].dmac == dmac) { in bgx_lmac_save_filter()
296 lmac->dmacs[i].vf_map |= BIT_ULL(vf_id); in bgx_lmac_save_filter()
301 if (!(lmac->dmacs_cfg < lmac->dmacs_count)) in bgx_lmac_save_filter()
305 lmac->dmacs[lmac->dmacs_cfg].dmac = dmac; in bgx_lmac_save_filter()
306 lmac->dmacs[lmac->dmacs_cfg].vf_map = BIT_ULL(vf_id); in bgx_lmac_save_filter()
307 lmac->dmacs_cfg++; in bgx_lmac_save_filter()
314 struct lmac *lmac = NULL; in bgx_set_dmac_cam_filter_mac() local
321 lmac = &bgx->lmac[lmacid]; in bgx_set_dmac_cam_filter_mac()
327 ((lmacid * lmac->dmacs_count) + idx) * sizeof(u64), cfg); in bgx_set_dmac_cam_filter_mac()
335 struct lmac *lmac = NULL; in bgx_set_dmac_cam_filter() local
340 lmac = &bgx->lmac[lmacid]; in bgx_set_dmac_cam_filter()
343 cam_dmac = ether_addr_to_u64(lmac->mac); in bgx_set_dmac_cam_filter()
350 bgx_lmac_save_filter(lmac, cam_dmac, vf_id); in bgx_set_dmac_cam_filter()
357 struct lmac *lmac = NULL; in bgx_set_xcast_mode() local
364 lmac = &bgx->lmac[lmacid]; in bgx_set_xcast_mode()
380 for (i = 0; i < lmac->dmacs_cfg; i++) in bgx_set_xcast_mode()
382 lmac->dmacs[i].dmac, i); in bgx_set_xcast_mode()
395 bgx_lmac_remove_filters(&bgx->lmac[lmacid], vf_id); in bgx_reset_xcast_mode()
405 struct lmac *lmac; in bgx_lmac_rx_tx_enable() local
410 lmac = &bgx->lmac[lmacid]; in bgx_lmac_rx_tx_enable()
429 xcv_setup_link(enable ? lmac->link_up : 0, lmac->last_speed); in bgx_lmac_rx_tx_enable()
437 struct lmac *lmac; in bgx_config_timestamping() local
443 lmac = &bgx->lmac[lmacid]; in bgx_config_timestamping()
445 if (lmac->lmac_type == BGX_MODE_SGMII || in bgx_config_timestamping()
446 lmac->lmac_type == BGX_MODE_QSGMII || in bgx_config_timestamping()
447 lmac->lmac_type == BGX_MODE_RGMII) in bgx_config_timestamping()
466 struct lmac *lmac; in bgx_lmac_get_pfc() local
471 lmac = &bgx->lmac[lmacid]; in bgx_lmac_get_pfc()
472 if (lmac->is_sgmii) in bgx_lmac_get_pfc()
486 struct lmac *lmac; in bgx_lmac_set_pfc() local
491 lmac = &bgx->lmac[lmacid]; in bgx_lmac_set_pfc()
492 if (lmac->is_sgmii) in bgx_lmac_set_pfc()
503 static void bgx_sgmii_change_link_state(struct lmac *lmac) in bgx_sgmii_change_link_state() argument
505 struct bgx *bgx = lmac->bgx; in bgx_sgmii_change_link_state()
511 cmr_cfg = bgx_reg_read(bgx, lmac->lmacid, BGX_CMRX_CFG); in bgx_sgmii_change_link_state()
515 bgx_reg_write(bgx, lmac->lmacid, BGX_CMRX_CFG, cmr_cfg); in bgx_sgmii_change_link_state()
518 if (bgx_poll_reg(bgx, lmac->lmacid, BGX_GMP_GMI_PRTX_CFG, in bgx_sgmii_change_link_state()
521 bgx->bgx_id, lmac->lmacid); in bgx_sgmii_change_link_state()
526 if (bgx_poll_reg(bgx, lmac->lmacid, BGX_GMP_GMI_PRTX_CFG, in bgx_sgmii_change_link_state()
529 bgx->bgx_id, lmac->lmacid); in bgx_sgmii_change_link_state()
533 port_cfg = bgx_reg_read(bgx, lmac->lmacid, BGX_GMP_GMI_PRTX_CFG); in bgx_sgmii_change_link_state()
534 misc_ctl = bgx_reg_read(bgx, lmac->lmacid, BGX_GMP_PCS_MISCX_CTL); in bgx_sgmii_change_link_state()
536 if (lmac->link_up) { in bgx_sgmii_change_link_state()
539 port_cfg |= (lmac->last_duplex << 2); in bgx_sgmii_change_link_state()
544 switch (lmac->last_speed) { in bgx_sgmii_change_link_state()
551 bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_GMI_TXX_SLOT, 64); in bgx_sgmii_change_link_state()
552 bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_GMI_TXX_BURST, 0); in bgx_sgmii_change_link_state()
560 bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_GMI_TXX_SLOT, 64); in bgx_sgmii_change_link_state()
561 bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_GMI_TXX_BURST, 0); in bgx_sgmii_change_link_state()
569 bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_GMI_TXX_SLOT, 512); in bgx_sgmii_change_link_state()
570 if (lmac->last_duplex) in bgx_sgmii_change_link_state()
571 bgx_reg_write(bgx, lmac->lmacid, in bgx_sgmii_change_link_state()
574 bgx_reg_write(bgx, lmac->lmacid, in bgx_sgmii_change_link_state()
580 bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_PCS_MISCX_CTL, misc_ctl); in bgx_sgmii_change_link_state()
581 bgx_reg_write(bgx, lmac->lmacid, BGX_GMP_GMI_PRTX_CFG, port_cfg); in bgx_sgmii_change_link_state()
585 bgx_reg_write(bgx, lmac->lmacid, BGX_CMRX_CFG, cmr_cfg); in bgx_sgmii_change_link_state()
588 xcv_setup_link(lmac->link_up, lmac->last_speed); in bgx_sgmii_change_link_state()
593 struct lmac *lmac = container_of(netdev, struct lmac, netdev); in bgx_lmac_handler() local
597 phydev = lmac->phydev; in bgx_lmac_handler()
599 if (!phydev->link && lmac->last_link) in bgx_lmac_handler()
603 (lmac->last_duplex != phydev->duplex || in bgx_lmac_handler()
604 lmac->last_link != phydev->link || in bgx_lmac_handler()
605 lmac->last_speed != phydev->speed)) { in bgx_lmac_handler()
609 lmac->last_link = phydev->link; in bgx_lmac_handler()
610 lmac->last_speed = phydev->speed; in bgx_lmac_handler()
611 lmac->last_duplex = phydev->duplex; in bgx_lmac_handler()
617 lmac->link_up = true; in bgx_lmac_handler()
619 lmac->link_up = false; in bgx_lmac_handler()
621 if (lmac->is_sgmii) in bgx_lmac_handler()
622 bgx_sgmii_change_link_state(lmac); in bgx_lmac_handler()
624 bgx_xaui_check_link(lmac); in bgx_lmac_handler()
627 u64 bgx_get_rx_stats(int node, int bgx_idx, int lmac, int idx) in bgx_get_rx_stats() argument
636 lmac = 0; in bgx_get_rx_stats()
637 return bgx_reg_read(bgx, lmac, BGX_CMRX_RX_STAT0 + (idx * 8)); in bgx_get_rx_stats()
641 u64 bgx_get_tx_stats(int node, int bgx_idx, int lmac, int idx) in bgx_get_tx_stats() argument
649 return bgx_reg_read(bgx, lmac, BGX_CMRX_TX_STAT0 + (idx * 8)); in bgx_get_tx_stats()
658 struct lmac *lmac; in bgx_lmac_internal_loopback() local
665 lmac = &bgx->lmac[lmac_idx]; in bgx_lmac_internal_loopback()
666 if (lmac->is_sgmii) { in bgx_lmac_internal_loopback()
684 static int bgx_lmac_sgmii_init(struct bgx *bgx, struct lmac *lmac) in bgx_lmac_sgmii_init() argument
686 int lmacid = lmac->lmacid; in bgx_lmac_sgmii_init()
713 if (lmac->phydev) { in bgx_lmac_sgmii_init()
721 lmac->autoneg = true; in bgx_lmac_sgmii_init()
725 if (lmac->lmac_type == BGX_MODE_QSGMII) { in bgx_lmac_sgmii_init()
733 if ((lmac->lmac_type == BGX_MODE_SGMII) && lmac->phydev) { in bgx_lmac_sgmii_init()
744 static int bgx_lmac_xaui_init(struct bgx *bgx, struct lmac *lmac) in bgx_lmac_xaui_init() argument
747 int lmacid = lmac->lmacid; in bgx_lmac_xaui_init()
763 if (lmac->lmac_type == BGX_MODE_RXAUI) in bgx_lmac_xaui_init()
780 if (lmac->use_training) { in bgx_lmac_xaui_init()
803 if (lmac->lmac_type == BGX_MODE_10G_KR) in bgx_lmac_xaui_init()
805 else if (lmac->lmac_type == BGX_MODE_40G_KR) in bgx_lmac_xaui_init()
848 static int bgx_xaui_check_link(struct lmac *lmac) in bgx_xaui_check_link() argument
850 struct bgx *bgx = lmac->bgx; in bgx_xaui_check_link()
851 int lmacid = lmac->lmacid; in bgx_xaui_check_link()
852 int lmac_type = lmac->lmac_type; in bgx_xaui_check_link()
855 if (lmac->use_training) { in bgx_xaui_check_link()
896 if (lmac->use_training) { in bgx_xaui_check_link()
934 bgx_lmac_xaui_init(bgx, lmac); in bgx_xaui_check_link()
939 static void bgx_poll_for_sgmii_link(struct lmac *lmac) in bgx_poll_for_sgmii_link() argument
944 pcs_link = bgx_reg_read(lmac->bgx, lmac->lmacid, in bgx_poll_for_sgmii_link()
949 pcs_link = bgx_reg_read(lmac->bgx, lmac->lmacid, in bgx_poll_for_sgmii_link()
952 if (bgx_poll_reg(lmac->bgx, lmac->lmacid, BGX_GMP_PCS_MRX_STATUS, in bgx_poll_for_sgmii_link()
954 lmac->link_up = false; in bgx_poll_for_sgmii_link()
955 lmac->last_speed = SPEED_UNKNOWN; in bgx_poll_for_sgmii_link()
956 lmac->last_duplex = DUPLEX_UNKNOWN; in bgx_poll_for_sgmii_link()
960 lmac->link_up = ((pcs_link & PCS_MRX_STATUS_LINK) != 0) ? true : false; in bgx_poll_for_sgmii_link()
961 an_result = bgx_reg_read(lmac->bgx, lmac->lmacid, in bgx_poll_for_sgmii_link()
965 lmac->last_duplex = (an_result >> 1) & 0x1; in bgx_poll_for_sgmii_link()
968 lmac->last_speed = SPEED_10; in bgx_poll_for_sgmii_link()
971 lmac->last_speed = SPEED_100; in bgx_poll_for_sgmii_link()
974 lmac->last_speed = SPEED_1000; in bgx_poll_for_sgmii_link()
977 lmac->link_up = false; in bgx_poll_for_sgmii_link()
978 lmac->last_speed = SPEED_UNKNOWN; in bgx_poll_for_sgmii_link()
979 lmac->last_duplex = DUPLEX_UNKNOWN; in bgx_poll_for_sgmii_link()
985 if (lmac->last_link != lmac->link_up) { in bgx_poll_for_sgmii_link()
986 if (lmac->link_up) in bgx_poll_for_sgmii_link()
987 bgx_sgmii_change_link_state(lmac); in bgx_poll_for_sgmii_link()
988 lmac->last_link = lmac->link_up; in bgx_poll_for_sgmii_link()
991 queue_delayed_work(lmac->check_link, &lmac->dwork, HZ * 3); in bgx_poll_for_sgmii_link()
996 struct lmac *lmac; in bgx_poll_for_link() local
999 lmac = container_of(work, struct lmac, dwork.work); in bgx_poll_for_link()
1000 if (lmac->is_sgmii) { in bgx_poll_for_link()
1001 bgx_poll_for_sgmii_link(lmac); in bgx_poll_for_link()
1006 bgx_reg_modify(lmac->bgx, lmac->lmacid, in bgx_poll_for_link()
1008 bgx_poll_reg(lmac->bgx, lmac->lmacid, BGX_SPUX_STATUS1, in bgx_poll_for_link()
1011 spu_link = bgx_reg_read(lmac->bgx, lmac->lmacid, BGX_SPUX_STATUS1); in bgx_poll_for_link()
1012 smu_link = bgx_reg_read(lmac->bgx, lmac->lmacid, BGX_SMUX_RX_CTL); in bgx_poll_for_link()
1016 lmac->link_up = true; in bgx_poll_for_link()
1017 if (lmac->lmac_type == BGX_MODE_XLAUI) in bgx_poll_for_link()
1018 lmac->last_speed = SPEED_40000; in bgx_poll_for_link()
1020 lmac->last_speed = SPEED_10000; in bgx_poll_for_link()
1021 lmac->last_duplex = DUPLEX_FULL; in bgx_poll_for_link()
1023 lmac->link_up = false; in bgx_poll_for_link()
1024 lmac->last_speed = SPEED_UNKNOWN; in bgx_poll_for_link()
1025 lmac->last_duplex = DUPLEX_UNKNOWN; in bgx_poll_for_link()
1028 if (lmac->last_link != lmac->link_up) { in bgx_poll_for_link()
1029 if (lmac->link_up) { in bgx_poll_for_link()
1030 if (bgx_xaui_check_link(lmac)) { in bgx_poll_for_link()
1032 lmac->link_up = false; in bgx_poll_for_link()
1033 lmac->last_speed = SPEED_UNKNOWN; in bgx_poll_for_link()
1034 lmac->last_duplex = DUPLEX_UNKNOWN; in bgx_poll_for_link()
1037 lmac->last_link = lmac->link_up; in bgx_poll_for_link()
1040 queue_delayed_work(lmac->check_link, &lmac->dwork, HZ * 2); in bgx_poll_for_link()
1055 struct lmac *lmac; in bgx_lmac_enable() local
1058 lmac = &bgx->lmac[lmacid]; in bgx_lmac_enable()
1059 lmac->bgx = bgx; in bgx_lmac_enable()
1061 if ((lmac->lmac_type == BGX_MODE_SGMII) || in bgx_lmac_enable()
1062 (lmac->lmac_type == BGX_MODE_QSGMII) || in bgx_lmac_enable()
1063 (lmac->lmac_type == BGX_MODE_RGMII)) { in bgx_lmac_enable()
1064 lmac->is_sgmii = true; in bgx_lmac_enable()
1065 if (bgx_lmac_sgmii_init(bgx, lmac)) in bgx_lmac_enable()
1068 lmac->is_sgmii = false; in bgx_lmac_enable()
1069 if (bgx_lmac_xaui_init(bgx, lmac)) in bgx_lmac_enable()
1073 if (lmac->is_sgmii) { in bgx_lmac_enable()
1086 lmac->dmacs_count = (RX_DMAC_COUNT / bgx->lmac_count); in bgx_lmac_enable()
1087 lmac->dmacs = kcalloc(lmac->dmacs_count, sizeof(*lmac->dmacs), in bgx_lmac_enable()
1089 if (!lmac->dmacs) in bgx_lmac_enable()
1098 if ((lmac->lmac_type != BGX_MODE_XFI) && in bgx_lmac_enable()
1099 (lmac->lmac_type != BGX_MODE_XLAUI) && in bgx_lmac_enable()
1100 (lmac->lmac_type != BGX_MODE_40G_KR) && in bgx_lmac_enable()
1101 (lmac->lmac_type != BGX_MODE_10G_KR)) { in bgx_lmac_enable()
1102 if (!lmac->phydev) { in bgx_lmac_enable()
1103 if (lmac->autoneg) { in bgx_lmac_enable()
1110 lmac->link_up = true; in bgx_lmac_enable()
1111 lmac->last_speed = SPEED_1000; in bgx_lmac_enable()
1112 lmac->last_duplex = DUPLEX_FULL; in bgx_lmac_enable()
1113 bgx_sgmii_change_link_state(lmac); in bgx_lmac_enable()
1117 lmac->phydev->dev_flags = 0; in bgx_lmac_enable()
1119 if (phy_connect_direct(&lmac->netdev, lmac->phydev, in bgx_lmac_enable()
1121 phy_interface_mode(lmac->lmac_type))) in bgx_lmac_enable()
1124 phy_start(lmac->phydev); in bgx_lmac_enable()
1129 lmac->check_link = alloc_workqueue("check_link", WQ_UNBOUND | in bgx_lmac_enable()
1131 if (!lmac->check_link) in bgx_lmac_enable()
1133 INIT_DELAYED_WORK(&lmac->dwork, bgx_poll_for_link); in bgx_lmac_enable()
1134 queue_delayed_work(lmac->check_link, &lmac->dwork, 0); in bgx_lmac_enable()
1141 struct lmac *lmac; in bgx_lmac_disable() local
1144 lmac = &bgx->lmac[lmacid]; in bgx_lmac_disable()
1145 if (lmac->check_link) { in bgx_lmac_disable()
1147 cancel_delayed_work_sync(&lmac->dwork); in bgx_lmac_disable()
1148 destroy_workqueue(lmac->check_link); in bgx_lmac_disable()
1166 if (!lmac->is_sgmii) in bgx_lmac_disable()
1179 kfree(lmac->dmacs); in bgx_lmac_disable()
1181 if ((lmac->lmac_type != BGX_MODE_XFI) && in bgx_lmac_disable()
1182 (lmac->lmac_type != BGX_MODE_XLAUI) && in bgx_lmac_disable()
1183 (lmac->lmac_type != BGX_MODE_40G_KR) && in bgx_lmac_disable()
1184 (lmac->lmac_type != BGX_MODE_10G_KR) && lmac->phydev) in bgx_lmac_disable()
1185 phy_disconnect(lmac->phydev); in bgx_lmac_disable()
1187 lmac->phydev = NULL; in bgx_lmac_disable()
1193 struct lmac *lmac; in bgx_init_hw() local
1201 lmac = &bgx->lmac[i]; in bgx_init_hw()
1203 (lmac->lmac_type << 8) | lmac->lane_to_sds); in bgx_init_hw()
1204 bgx->lmac[i].lmacid_bd = lmac_count; in bgx_init_hw()
1226 static u8 bgx_get_lane2sds_cfg(struct bgx *bgx, struct lmac *lmac) in bgx_get_lane2sds_cfg() argument
1228 return (u8)(bgx_reg_read(bgx, lmac->lmacid, BGX_CMRX_CFG) & 0xFF); in bgx_get_lane2sds_cfg()
1234 struct lmac *lmac; in bgx_print_qlm_mode() local
1240 lmac = &bgx->lmac[lmacid]; in bgx_print_qlm_mode()
1246 switch (lmac->lmac_type) { in bgx_print_qlm_mode()
1257 if (!lmac->use_training) in bgx_print_qlm_mode()
1263 if (!lmac->use_training) in bgx_print_qlm_mode()
1280 static void lmac_set_lane2sds(struct bgx *bgx, struct lmac *lmac) in lmac_set_lane2sds() argument
1282 switch (lmac->lmac_type) { in lmac_set_lane2sds()
1285 lmac->lane_to_sds = lmac->lmacid; in lmac_set_lane2sds()
1290 lmac->lane_to_sds = 0xE4; in lmac_set_lane2sds()
1293 lmac->lane_to_sds = (lmac->lmacid) ? 0xE : 0x4; in lmac_set_lane2sds()
1301 lmac->lane_to_sds = bgx_get_lane2sds_cfg(bgx, lmac); in lmac_set_lane2sds()
1304 lmac->lane_to_sds = 0; in lmac_set_lane2sds()
1309 static void lmac_set_training(struct bgx *bgx, struct lmac *lmac, int lmacid) in lmac_set_training() argument
1311 if ((lmac->lmac_type != BGX_MODE_10G_KR) && in lmac_set_training()
1312 (lmac->lmac_type != BGX_MODE_40G_KR)) { in lmac_set_training()
1313 lmac->use_training = false; in lmac_set_training()
1317 lmac->use_training = bgx_reg_read(bgx, lmacid, BGX_SPUX_BR_PMD_CRTL) & in lmac_set_training()
1323 struct lmac *lmac; in bgx_set_lmac_config() local
1328 lmac = &bgx->lmac[idx]; in bgx_set_lmac_config()
1335 lmac->lmac_type = (cmr_cfg >> 8) & 0x07; in bgx_set_lmac_config()
1337 lmac->lmac_type = BGX_MODE_RGMII; in bgx_set_lmac_config()
1338 lmac_set_training(bgx, lmac, 0); in bgx_set_lmac_config()
1339 lmac_set_lane2sds(bgx, lmac); in bgx_set_lmac_config()
1353 lmac->lmac_type = BGX_MODE_INVALID; in bgx_set_lmac_config()
1355 lmac->lmac_type = lmac_type; in bgx_set_lmac_config()
1356 lmac->lane_to_sds = lane_to_sds; in bgx_set_lmac_config()
1357 lmac_set_training(bgx, lmac, lmac->lmacid); in bgx_set_lmac_config()
1362 struct lmac *lmac; in bgx_get_qlm_mode() local
1367 lmac = &bgx->lmac[idx]; in bgx_get_qlm_mode()
1368 lmac->lmacid = idx; in bgx_get_qlm_mode()
1369 lmac->lmac_type = BGX_MODE_INVALID; in bgx_get_qlm_mode()
1370 lmac->use_training = false; in bgx_get_qlm_mode()
1416 acpi_get_mac_address(dev, adev, bgx->lmac[bgx->acpi_lmac_idx].mac); in bgx_acpi_register_phy()
1418 SET_NETDEV_DEV(&bgx->lmac[bgx->acpi_lmac_idx].netdev, dev); in bgx_acpi_register_phy()
1420 bgx->lmac[bgx->acpi_lmac_idx].lmacid = bgx->acpi_lmac_idx; in bgx_acpi_register_phy()
1472 u8 lmac = 0; in bgx_init_of_phy() local
1485 of_get_mac_address(node, bgx->lmac[lmac].mac); in bgx_init_of_phy()
1487 SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev); in bgx_init_of_phy()
1488 bgx->lmac[lmac].lmacid = lmac; in bgx_init_of_phy()
1501 bgx->lmac[lmac].phydev = pd; in bgx_init_of_phy()
1504 lmac++; in bgx_init_of_phy()
1505 if (lmac == bgx->max_lmac) { in bgx_init_of_phy()
1516 while (lmac) { in bgx_init_of_phy()
1517 if (bgx->lmac[lmac].phydev) { in bgx_init_of_phy()
1518 put_device(&bgx->lmac[lmac].phydev->mdio.dev); in bgx_init_of_phy()
1519 bgx->lmac[lmac].phydev = NULL; in bgx_init_of_phy()
1521 lmac--; in bgx_init_of_phy()
1548 int lmac; in bgx_intr_handler() local
1550 for (lmac = 0; lmac < bgx->lmac_count; lmac++) { in bgx_intr_handler()
1551 status = bgx_reg_read(bgx, lmac, BGX_GMP_GMI_TXX_INT); in bgx_intr_handler()
1554 bgx->bgx_id, lmac); in bgx_intr_handler()
1555 val = bgx_reg_read(bgx, lmac, BGX_CMRX_CFG); in bgx_intr_handler()
1557 bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val); in bgx_intr_handler()
1559 bgx_reg_write(bgx, lmac, BGX_CMRX_CFG, val); in bgx_intr_handler()
1562 bgx_reg_write(bgx, lmac, BGX_GMP_GMI_TXX_INT, status); in bgx_intr_handler()
1591 u8 lmac; in bgx_probe() local
1657 for (lmac = 0; lmac < bgx->lmac_count; lmac++) { in bgx_probe()
1658 err = bgx_lmac_enable(bgx, lmac); in bgx_probe()
1661 bgx->bgx_id, lmac); in bgx_probe()
1662 while (lmac) in bgx_probe()
1663 bgx_lmac_disable(bgx, --lmac); in bgx_probe()
1684 u8 lmac; in bgx_remove() local
1687 for (lmac = 0; lmac < bgx->lmac_count; lmac++) in bgx_remove()
1688 bgx_lmac_disable(bgx, lmac); in bgx_remove()