Lines Matching refs:lmacid
55 int lmacid; /* ID within BGX */ member
205 void bgx_get_lmac_link_state(int node, int bgx_idx, int lmacid, void *status) in bgx_get_lmac_link_state() argument
215 lmac = &bgx->lmac[lmacid]; in bgx_get_lmac_link_state()
223 const u8 *bgx_get_lmac_mac(int node, int bgx_idx, int lmacid) in bgx_get_lmac_mac() argument
228 return bgx->lmac[lmacid].mac; in bgx_get_lmac_mac()
234 void bgx_set_lmac_mac(int node, int bgx_idx, int lmacid, const u8 *mac) in bgx_set_lmac_mac() argument
241 ether_addr_copy(bgx->lmac[lmacid].mac, mac); in bgx_set_lmac_mac()
245 static void bgx_flush_dmac_cam_filter(struct bgx *bgx, int lmacid) in bgx_flush_dmac_cam_filter() argument
250 lmac = &bgx->lmac[lmacid]; in bgx_flush_dmac_cam_filter()
254 ((lmacid * lmac->dmacs_count) + idx) * in bgx_flush_dmac_cam_filter()
311 static int bgx_set_dmac_cam_filter_mac(struct bgx *bgx, int lmacid, in bgx_set_dmac_cam_filter_mac() argument
321 lmac = &bgx->lmac[lmacid]; in bgx_set_dmac_cam_filter_mac()
324 cfg = RX_DMACX_CAM_LMACID(lmacid & LMAC_ID_MASK) | in bgx_set_dmac_cam_filter_mac()
327 ((lmacid * lmac->dmacs_count) + idx) * sizeof(u64), cfg); in bgx_set_dmac_cam_filter_mac()
331 void bgx_set_dmac_cam_filter(int node, int bgx_idx, int lmacid, in bgx_set_dmac_cam_filter() argument
340 lmac = &bgx->lmac[lmacid]; in bgx_set_dmac_cam_filter()
354 void bgx_set_xcast_mode(int node, int bgx_idx, int lmacid, u8 mode) in bgx_set_xcast_mode() argument
364 lmac = &bgx->lmac[lmacid]; in bgx_set_xcast_mode()
366 cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_RX_DMAC_CTL); in bgx_set_xcast_mode()
381 bgx_set_dmac_cam_filter_mac(bgx, lmacid, in bgx_set_xcast_mode()
384 bgx_reg_write(bgx, lmacid, BGX_CMRX_RX_DMAC_CTL, cfg); in bgx_set_xcast_mode()
388 void bgx_reset_xcast_mode(int node, int bgx_idx, int lmacid, u8 vf_id) in bgx_reset_xcast_mode() argument
395 bgx_lmac_remove_filters(&bgx->lmac[lmacid], vf_id); in bgx_reset_xcast_mode()
396 bgx_flush_dmac_cam_filter(bgx, lmacid); in bgx_reset_xcast_mode()
397 bgx_set_xcast_mode(node, bgx_idx, lmacid, in bgx_reset_xcast_mode()
402 void bgx_lmac_rx_tx_enable(int node, int bgx_idx, int lmacid, bool enable) in bgx_lmac_rx_tx_enable() argument
410 lmac = &bgx->lmac[lmacid]; in bgx_lmac_rx_tx_enable()
412 cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); in bgx_lmac_rx_tx_enable()
417 bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_INT_ENA_W1S, in bgx_lmac_rx_tx_enable()
423 bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_INT_ENA_W1C, in bgx_lmac_rx_tx_enable()
426 bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); in bgx_lmac_rx_tx_enable()
434 void bgx_config_timestamping(int node, int bgx_idx, int lmacid, bool enable) in bgx_config_timestamping() argument
443 lmac = &bgx->lmac[lmacid]; in bgx_config_timestamping()
452 cfg = bgx_reg_read(bgx, lmacid, csr_offset); in bgx_config_timestamping()
458 bgx_reg_write(bgx, lmacid, csr_offset, cfg); in bgx_config_timestamping()
462 void bgx_lmac_get_pfc(int node, int bgx_idx, int lmacid, void *pause) in bgx_lmac_get_pfc() argument
471 lmac = &bgx->lmac[lmacid]; in bgx_lmac_get_pfc()
475 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_CBFC_CTL); in bgx_lmac_get_pfc()
482 void bgx_lmac_set_pfc(int node, int bgx_idx, int lmacid, void *pause) in bgx_lmac_set_pfc() argument
491 lmac = &bgx->lmac[lmacid]; in bgx_lmac_set_pfc()
495 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_CBFC_CTL); in bgx_lmac_set_pfc()
499 bgx_reg_write(bgx, lmacid, BGX_SMUX_CBFC_CTL, cfg); in bgx_lmac_set_pfc()
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()
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()
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()
686 int lmacid = lmac->lmacid; in bgx_lmac_sgmii_init() local
689 bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_THRESH, 0x30); in bgx_lmac_sgmii_init()
691 bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_RXX_JABBER, MAX_FRAME_SIZE); in bgx_lmac_sgmii_init()
694 cfg = bgx_reg_read(bgx, lmacid, BGX_GMP_GMI_TXX_APPEND); in bgx_lmac_sgmii_init()
696 bgx_reg_write(bgx, lmacid, BGX_GMP_GMI_TXX_SGMII_CTL, 0); in bgx_lmac_sgmii_init()
699 bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN); in bgx_lmac_sgmii_init()
702 bgx_reg_modify(bgx, lmacid, BGX_GMP_PCS_MRX_CTL, PCS_MRX_CTL_RESET); in bgx_lmac_sgmii_init()
703 if (bgx_poll_reg(bgx, lmacid, BGX_GMP_PCS_MRX_CTL, in bgx_lmac_sgmii_init()
710 cfg = bgx_reg_read(bgx, lmacid, BGX_GMP_PCS_MRX_CTL); in bgx_lmac_sgmii_init()
723 bgx_reg_write(bgx, lmacid, BGX_GMP_PCS_MRX_CTL, cfg); in bgx_lmac_sgmii_init()
727 cfg = bgx_reg_read(bgx, lmacid, BGX_GMP_PCS_MISCX_CTL); in bgx_lmac_sgmii_init()
729 bgx_reg_write(bgx, lmacid, BGX_GMP_PCS_MISCX_CTL, cfg); in bgx_lmac_sgmii_init()
734 if (bgx_poll_reg(bgx, lmacid, BGX_GMP_PCS_MRX_STATUS, in bgx_lmac_sgmii_init()
747 int lmacid = lmac->lmacid; in bgx_lmac_xaui_init() local
750 bgx_reg_modify(bgx, lmacid, BGX_SPUX_CONTROL1, SPU_CTL_RESET); in bgx_lmac_xaui_init()
751 if (bgx_poll_reg(bgx, lmacid, BGX_SPUX_CONTROL1, SPU_CTL_RESET, true)) { in bgx_lmac_xaui_init()
757 cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); in bgx_lmac_xaui_init()
759 bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); in bgx_lmac_xaui_init()
761 bgx_reg_modify(bgx, lmacid, BGX_SPUX_CONTROL1, SPU_CTL_LOW_POWER); in bgx_lmac_xaui_init()
764 bgx_reg_modify(bgx, lmacid, BGX_SPUX_MISC_CONTROL, in bgx_lmac_xaui_init()
768 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_MISC_CONTROL); in bgx_lmac_xaui_init()
770 bgx_reg_write(bgx, lmacid, BGX_SPUX_MISC_CONTROL, cfg); in bgx_lmac_xaui_init()
773 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_RX_INT); in bgx_lmac_xaui_init()
774 bgx_reg_write(bgx, lmacid, BGX_SMUX_RX_INT, cfg); in bgx_lmac_xaui_init()
775 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_TX_INT); in bgx_lmac_xaui_init()
776 bgx_reg_write(bgx, lmacid, BGX_SMUX_TX_INT, cfg); in bgx_lmac_xaui_init()
777 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_INT); in bgx_lmac_xaui_init()
778 bgx_reg_write(bgx, lmacid, BGX_SPUX_INT, cfg); in bgx_lmac_xaui_init()
781 bgx_reg_write(bgx, lmacid, BGX_SPUX_BR_PMD_LP_CUP, 0x00); in bgx_lmac_xaui_init()
782 bgx_reg_write(bgx, lmacid, BGX_SPUX_BR_PMD_LD_CUP, 0x00); in bgx_lmac_xaui_init()
783 bgx_reg_write(bgx, lmacid, BGX_SPUX_BR_PMD_LD_REP, 0x00); in bgx_lmac_xaui_init()
785 bgx_reg_modify(bgx, lmacid, in bgx_lmac_xaui_init()
790 bgx_reg_modify(bgx, lmacid, BGX_SMUX_TX_APPEND, SMU_TX_APPEND_FCS_D); in bgx_lmac_xaui_init()
793 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_FEC_CONTROL); in bgx_lmac_xaui_init()
795 bgx_reg_write(bgx, lmacid, BGX_SPUX_FEC_CONTROL, cfg); in bgx_lmac_xaui_init()
798 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_AN_CONTROL); in bgx_lmac_xaui_init()
800 bgx_reg_write(bgx, lmacid, BGX_SPUX_AN_CONTROL, cfg); in bgx_lmac_xaui_init()
802 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_AN_ADV); in bgx_lmac_xaui_init()
810 bgx_reg_write(bgx, lmacid, BGX_SPUX_AN_ADV, cfg); in bgx_lmac_xaui_init()
817 bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN); in bgx_lmac_xaui_init()
819 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_CONTROL1); in bgx_lmac_xaui_init()
821 bgx_reg_write(bgx, lmacid, BGX_SPUX_CONTROL1, cfg); in bgx_lmac_xaui_init()
823 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_TX_CTL); in bgx_lmac_xaui_init()
826 bgx_reg_write(bgx, lmacid, BGX_SMUX_TX_CTL, cfg); in bgx_lmac_xaui_init()
829 bgx_reg_write(bgx, lmacid, BGX_SMUX_CBFC_CTL, ((0xffffULL << 32) | in bgx_lmac_xaui_init()
832 bgx_reg_write(bgx, lmacid, in bgx_lmac_xaui_init()
834 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_TX_PAUSE_PKT_INTERVAL); in bgx_lmac_xaui_init()
836 bgx_reg_write(bgx, lmacid, BGX_SMUX_TX_PAUSE_PKT_INTERVAL, in bgx_lmac_xaui_init()
838 bgx_reg_write(bgx, lmacid, BGX_SMUX_TX_PAUSE_ZERO, 0x01); in bgx_lmac_xaui_init()
841 bgx_reg_modify(bgx, lmacid, BGX_SMUX_TX_THRESH, (0x100 - 1)); in bgx_lmac_xaui_init()
843 bgx_reg_modify(bgx, lmacid, BGX_SMUX_RX_JABBER, MAX_FRAME_SIZE); in bgx_lmac_xaui_init()
851 int lmacid = lmac->lmacid; in bgx_xaui_check_link() local
856 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_INT); in bgx_xaui_check_link()
859 bgx_reg_write(bgx, lmacid, BGX_SPUX_INT, cfg); in bgx_xaui_check_link()
860 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_BR_PMD_CRTL); in bgx_xaui_check_link()
862 bgx_reg_write(bgx, lmacid, BGX_SPUX_BR_PMD_CRTL, cfg); in bgx_xaui_check_link()
868 if (bgx_poll_reg(bgx, lmacid, BGX_SPUX_CONTROL1, SPU_CTL_RESET, true)) { in bgx_xaui_check_link()
875 if (bgx_poll_reg(bgx, lmacid, BGX_SPUX_BR_STATUS1, in bgx_xaui_check_link()
882 if (bgx_poll_reg(bgx, lmacid, BGX_SPUX_BX_STATUS, in bgx_xaui_check_link()
891 if (bgx_reg_read(bgx, lmacid, BGX_SPUX_STATUS2) & SPU_STATUS2_RCVFLT) in bgx_xaui_check_link()
892 bgx_reg_modify(bgx, lmacid, in bgx_xaui_check_link()
894 if (bgx_reg_read(bgx, lmacid, BGX_SPUX_STATUS2) & SPU_STATUS2_RCVFLT) { in bgx_xaui_check_link()
897 cfg = bgx_reg_read(bgx, lmacid, BGX_SPUX_INT); in bgx_xaui_check_link()
900 bgx_reg_write(bgx, lmacid, BGX_SPUX_INT, cfg); in bgx_xaui_check_link()
901 cfg = bgx_reg_read(bgx, lmacid, in bgx_xaui_check_link()
904 bgx_reg_write(bgx, lmacid, in bgx_xaui_check_link()
913 if (bgx_poll_reg(bgx, lmacid, BGX_SMUX_CTL, SMU_CTL_RX_IDLE, false)) { in bgx_xaui_check_link()
919 if (bgx_poll_reg(bgx, lmacid, BGX_SMUX_CTL, SMU_CTL_TX_IDLE, false)) { in bgx_xaui_check_link()
925 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_RX_CTL); in bgx_xaui_check_link()
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()
961 an_result = bgx_reg_read(lmac->bgx, lmac->lmacid, in bgx_poll_for_sgmii_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()
1053 static int bgx_lmac_enable(struct bgx *bgx, u8 lmacid) in bgx_lmac_enable() argument
1058 lmac = &bgx->lmac[lmacid]; in bgx_lmac_enable()
1074 cfg = bgx_reg_read(bgx, lmacid, BGX_GMP_GMI_TXX_APPEND); in bgx_lmac_enable()
1076 bgx_reg_modify(bgx, lmacid, BGX_GMP_GMI_TXX_APPEND, cfg); in bgx_lmac_enable()
1077 bgx_reg_write(bgx, lmacid, BGX_GMP_GMI_TXX_MIN_PKT, 60 - 1); in bgx_lmac_enable()
1079 cfg = bgx_reg_read(bgx, lmacid, BGX_SMUX_TX_APPEND); in bgx_lmac_enable()
1081 bgx_reg_modify(bgx, lmacid, BGX_SMUX_TX_APPEND, cfg); in bgx_lmac_enable()
1082 bgx_reg_write(bgx, lmacid, BGX_SMUX_TX_MIN_PKT, 60 + 4); in bgx_lmac_enable()
1093 bgx_reg_modify(bgx, lmacid, BGX_CMRX_CFG, CMR_EN); in bgx_lmac_enable()
1096 bgx_reg_write(bgx, lmacid, BGX_CMRX_RX_DMAC_CTL, 0x03); in bgx_lmac_enable()
1104 bgx_reg_write(bgx, lmacid, in bgx_lmac_enable()
1139 static void bgx_lmac_disable(struct bgx *bgx, u8 lmacid) in bgx_lmac_disable() argument
1144 lmac = &bgx->lmac[lmacid]; in bgx_lmac_disable()
1152 cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); in bgx_lmac_disable()
1154 bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); in bgx_lmac_disable()
1157 bgx_poll_reg(bgx, lmacid, BGX_CMRX_RX_FIFO_LEN, (u64)0x1FFF, true); in bgx_lmac_disable()
1158 bgx_poll_reg(bgx, lmacid, BGX_CMRX_TX_FIFO_LEN, (u64)0x3FFF, true); in bgx_lmac_disable()
1161 cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); in bgx_lmac_disable()
1163 bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); in bgx_lmac_disable()
1167 bgx_reg_modify(bgx, lmacid, in bgx_lmac_disable()
1170 bgx_reg_modify(bgx, lmacid, in bgx_lmac_disable()
1174 cfg = bgx_reg_read(bgx, lmacid, BGX_CMRX_CFG); in bgx_lmac_disable()
1176 bgx_reg_write(bgx, lmacid, BGX_CMRX_CFG, cfg); in bgx_lmac_disable()
1178 bgx_flush_dmac_cam_filter(bgx, lmacid); in bgx_lmac_disable()
1228 return (u8)(bgx_reg_read(bgx, lmac->lmacid, BGX_CMRX_CFG) & 0xFF); in bgx_get_lane2sds_cfg()
1231 static void bgx_print_qlm_mode(struct bgx *bgx, u8 lmacid) in bgx_print_qlm_mode() argument
1237 if (!bgx->is_dlm && lmacid) in bgx_print_qlm_mode()
1240 lmac = &bgx->lmac[lmacid]; in bgx_print_qlm_mode()
1244 sprintf(str, "BGX%d LMAC%d mode", bgx->bgx_id, lmacid); in bgx_print_qlm_mode()
1285 lmac->lane_to_sds = lmac->lmacid; in lmac_set_lane2sds()
1293 lmac->lane_to_sds = (lmac->lmacid) ? 0xE : 0x4; in lmac_set_lane2sds()
1309 static void lmac_set_training(struct bgx *bgx, struct lmac *lmac, int lmacid) in lmac_set_training() argument
1317 lmac->use_training = bgx_reg_read(bgx, lmacid, BGX_SPUX_BR_PMD_CRTL) & in lmac_set_training()
1357 lmac_set_training(bgx, lmac, lmac->lmacid); in bgx_set_lmac_config()
1368 lmac->lmacid = idx; in bgx_get_qlm_mode()
1419 bgx->lmac[bgx->acpi_lmac_idx].lmacid = bgx->acpi_lmac_idx; in bgx_acpi_register_phy()
1485 bgx->lmac[lmac].lmacid = lmac; in bgx_init_of_phy()