Lines Matching +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0
81 return (rpm->pdev->device == PCI_DEVID_CN10KB_RPM); in is_dev_rpm2()
129 u64 cfg, last; in rpm_lmac_tx_enable() local
132 return -ENODEV; in rpm_lmac_tx_enable()
134 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_tx_enable()
135 last = cfg; in rpm_lmac_tx_enable()
137 cfg |= RPM_TX_EN; in rpm_lmac_tx_enable()
139 cfg &= ~(RPM_TX_EN); in rpm_lmac_tx_enable()
141 if (cfg != last) in rpm_lmac_tx_enable()
142 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_tx_enable()
149 u64 cfg; in rpm_lmac_rx_tx_enable() local
152 return -ENODEV; in rpm_lmac_rx_tx_enable()
154 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_rx_tx_enable()
156 cfg |= RPM_RX_EN | RPM_TX_EN; in rpm_lmac_rx_tx_enable()
158 cfg &= ~(RPM_RX_EN | RPM_TX_EN); in rpm_lmac_rx_tx_enable()
159 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_rx_tx_enable()
167 u64 cfg; in rpm_lmac_enadis_rx_pause_fwding() local
177 if (!bitmap_weight(lmac->rx_fc_pfvf_bmap.bmap, lmac->rx_fc_pfvf_bmap.max)) in rpm_lmac_enadis_rx_pause_fwding()
181 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_rx_pause_fwding()
182 cfg &= ~RPMX_MTI_MAC100X_COMMAND_CONFIG_PAUSE_IGNORE; in rpm_lmac_enadis_rx_pause_fwding()
183 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_rx_pause_fwding()
185 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_rx_pause_fwding()
186 cfg |= RPMX_MTI_MAC100X_COMMAND_CONFIG_PAUSE_IGNORE; in rpm_lmac_enadis_rx_pause_fwding()
187 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_rx_pause_fwding()
195 u64 cfg; in rpm_lmac_get_pause_frm_status() local
198 return -ENODEV; in rpm_lmac_get_pause_frm_status()
200 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_get_pause_frm_status()
201 if (!(cfg & RPMX_MTI_MAC100X_COMMAND_CONFIG_PFC_MODE)) { in rpm_lmac_get_pause_frm_status()
202 *rx_pause = !(cfg & RPMX_MTI_MAC100X_COMMAND_CONFIG_RX_P_DISABLE); in rpm_lmac_get_pause_frm_status()
203 *tx_pause = !(cfg & RPMX_MTI_MAC100X_COMMAND_CONFIG_TX_P_DISABLE); in rpm_lmac_get_pause_frm_status()
213 u64 quanta_offset = 0, quanta_thresh = 0, cfg; in rpm_cfg_pfc_quanta_thresh() local
265 cfg = rpm_read(rpm, lmac_id, quanta_offset); in rpm_cfg_pfc_quanta_thresh()
267 cfg |= ((u64)RPM_DEFAULT_PAUSE_TIME << shift * 16); in rpm_cfg_pfc_quanta_thresh()
270 cfg &= ~GENMASK_ULL(15, 0); in rpm_cfg_pfc_quanta_thresh()
272 cfg &= ~GENMASK_ULL(31, 16); in rpm_cfg_pfc_quanta_thresh()
274 rpm_write(rpm, lmac_id, quanta_offset, cfg); in rpm_cfg_pfc_quanta_thresh()
276 cfg = rpm_read(rpm, lmac_id, quanta_thresh); in rpm_cfg_pfc_quanta_thresh()
278 cfg |= ((u64)(RPM_DEFAULT_PAUSE_TIME / 2) << shift * 16); in rpm_cfg_pfc_quanta_thresh()
281 cfg &= ~GENMASK_ULL(15, 0); in rpm_cfg_pfc_quanta_thresh()
283 cfg &= ~GENMASK_ULL(31, 16); in rpm_cfg_pfc_quanta_thresh()
285 rpm_write(rpm, lmac_id, quanta_thresh, cfg); in rpm_cfg_pfc_quanta_thresh()
291 u64 cfg; in rpm2_lmac_cfg_bp() local
293 cfg = rpm_read(rpm, lmac_id, RPM2_CMR_RX_OVR_BP); in rpm2_lmac_cfg_bp()
299 cfg &= ~RPM2_CMR_RX_OVR_BP_EN; in rpm2_lmac_cfg_bp()
303 cfg |= RPM2_CMR_RX_OVR_BP_EN; in rpm2_lmac_cfg_bp()
304 cfg &= ~RPM2_CMR_RX_OVR_BP_BP; in rpm2_lmac_cfg_bp()
306 rpm_write(rpm, lmac_id, RPM2_CMR_RX_OVR_BP, cfg); in rpm2_lmac_cfg_bp()
311 u64 cfg; in rpm_lmac_cfg_bp() local
313 cfg = rpm_read(rpm, 0, RPMX_CMR_RX_OVR_BP); in rpm_lmac_cfg_bp()
319 cfg &= ~RPMX_CMR_RX_OVR_BP_EN(lmac_id); in rpm_lmac_cfg_bp()
323 cfg |= RPMX_CMR_RX_OVR_BP_EN(lmac_id); in rpm_lmac_cfg_bp()
324 cfg &= ~RPMX_CMR_RX_OVR_BP_BP(lmac_id); in rpm_lmac_cfg_bp()
326 rpm_write(rpm, 0, RPMX_CMR_RX_OVR_BP, cfg); in rpm_lmac_cfg_bp()
333 u64 cfg; in rpm_lmac_enadis_pause_frm() local
336 return -ENODEV; in rpm_lmac_enadis_pause_frm()
338 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_pause_frm()
339 cfg &= ~RPMX_MTI_MAC100X_COMMAND_CONFIG_RX_P_DISABLE; in rpm_lmac_enadis_pause_frm()
340 cfg |= rx_pause ? 0x0 : RPMX_MTI_MAC100X_COMMAND_CONFIG_RX_P_DISABLE; in rpm_lmac_enadis_pause_frm()
341 cfg &= ~RPMX_MTI_MAC100X_COMMAND_CONFIG_PAUSE_IGNORE; in rpm_lmac_enadis_pause_frm()
342 cfg |= rx_pause ? 0x0 : RPMX_MTI_MAC100X_COMMAND_CONFIG_PAUSE_IGNORE; in rpm_lmac_enadis_pause_frm()
343 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_pause_frm()
345 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_pause_frm()
346 cfg &= ~RPMX_MTI_MAC100X_COMMAND_CONFIG_TX_P_DISABLE; in rpm_lmac_enadis_pause_frm()
347 cfg |= tx_pause ? 0x0 : RPMX_MTI_MAC100X_COMMAND_CONFIG_TX_P_DISABLE; in rpm_lmac_enadis_pause_frm()
348 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_pause_frm()
360 u64 cfg, pfc_class_mask_cfg; in rpm_lmac_pause_frm_config() local
364 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
365 cfg |= RPMX_MTI_MAC100X_COMMAND_CONFIG_RX_P_DISABLE; in rpm_lmac_pause_frm_config()
366 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
369 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
370 cfg |= RPMX_MTI_MAC100X_COMMAND_CONFIG_PAUSE_IGNORE; in rpm_lmac_pause_frm_config()
371 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
374 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
375 cfg |= RPMX_MTI_MAC100X_COMMAND_CONFIG_TX_P_DISABLE; in rpm_lmac_pause_frm_config()
376 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
379 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
380 cfg &= ~RPMX_MTI_MAC100X_COMMAND_CONFIG_PAUSE_FWD; in rpm_lmac_pause_frm_config()
381 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
392 cfg = rpm_read(rpm, lmac_id, pfc_class_mask_cfg); in rpm_lmac_pause_frm_config()
393 cfg = FIELD_SET(RPM_PFC_CLASS_MASK, 0, cfg); in rpm_lmac_pause_frm_config()
394 rpm_write(rpm, lmac_id, pfc_class_mask_cfg, cfg); in rpm_lmac_pause_frm_config()
403 return -ENODEV; in rpm_get_rx_stats()
405 mutex_lock(&rpm->lock); in rpm_get_rx_stats()
408 idx += lmac_id * rpm->mac_ops->rx_stats_cnt; in rpm_get_rx_stats()
421 mutex_unlock(&rpm->lock); in rpm_get_rx_stats()
431 return -ENODEV; in rpm_get_tx_stats()
433 mutex_lock(&rpm->lock); in rpm_get_tx_stats()
436 idx += lmac_id * rpm->mac_ops->tx_stats_cnt; in rpm_get_tx_stats()
444 mutex_unlock(&rpm->lock); in rpm_get_tx_stats()
451 u64 cfg; in rpm_stats_reset() local
454 return -ENODEV; in rpm_stats_reset()
456 cfg = rpm_read(rpm, 0, RPMX_MTI_STAT_STATN_CONTROL); in rpm_stats_reset()
457 cfg |= RPMX_CMD_CLEAR_TX | RPMX_CMD_CLEAR_RX | BIT_ULL(lmac_id); in rpm_stats_reset()
458 rpm_write(rpm, 0, RPMX_MTI_STAT_STATN_CONTROL, cfg); in rpm_stats_reset()
483 fifo_len = rpm->mac_ops->fifo_len; in rpm_get_lmac_fifo_len()
484 num_lmacs = rpm->mac_ops->get_nr_lmacs(rpm); in rpm_get_lmac_fifo_len()
507 u64 cfg; in rpmusx_lmac_internal_loopback() local
509 cfg = rpm_read(rpm, lmac_id, RPM2_USX_PCSX_CONTROL1); in rpmusx_lmac_internal_loopback()
512 cfg |= RPM2_USX_PCS_LBK; in rpmusx_lmac_internal_loopback()
514 cfg &= ~RPM2_USX_PCS_LBK; in rpmusx_lmac_internal_loopback()
515 rpm_write(rpm, lmac_id, RPM2_USX_PCSX_CONTROL1, cfg); in rpmusx_lmac_internal_loopback()
536 fifo_len = rpm->mac_ops->fifo_len / 2; in rpm2_get_lmac_fifo_len()
538 fifo_len = rpm->mac_ops->fifo_len; in rpm2_get_lmac_fifo_len()
572 u64 cfg; in rpm_lmac_internal_loopback() local
575 return -ENODEV; in rpm_lmac_internal_loopback()
578 if (lmac->lmac_type == LMAC_MODE_QSGMII || in rpm_lmac_internal_loopback()
579 lmac->lmac_type == LMAC_MODE_SGMII) { in rpm_lmac_internal_loopback()
580 dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n"); in rpm_lmac_internal_loopback()
587 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); in rpm_lmac_internal_loopback()
590 cfg |= RPMX_MTI_PCS_LBK; in rpm_lmac_internal_loopback()
592 cfg &= ~RPMX_MTI_PCS_LBK; in rpm_lmac_internal_loopback()
593 rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); in rpm_lmac_internal_loopback()
601 u64 cfg; in rpm_lmac_ptp_config() local
606 cfg = rpm_read(rpm, lmac_id, RPMX_CMRX_CFG); in rpm_lmac_ptp_config()
608 cfg |= RPMX_RX_TS_PREPEND; in rpm_lmac_ptp_config()
609 cfg |= RPMX_TX_PTP_1S_SUPPORT; in rpm_lmac_ptp_config()
611 cfg &= ~RPMX_RX_TS_PREPEND; in rpm_lmac_ptp_config()
612 cfg &= ~RPMX_TX_PTP_1S_SUPPORT; in rpm_lmac_ptp_config()
615 rpm_write(rpm, lmac_id, RPMX_CMRX_CFG, cfg); in rpm_lmac_ptp_config()
617 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_XIF_MODE); in rpm_lmac_ptp_config()
620 cfg |= RPMX_ONESTEP_ENABLE; in rpm_lmac_ptp_config()
621 cfg &= ~RPMX_TS_BINARY_MODE; in rpm_lmac_ptp_config()
623 cfg &= ~RPMX_ONESTEP_ENABLE; in rpm_lmac_ptp_config()
626 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_XIF_MODE, cfg); in rpm_lmac_ptp_config()
631 u64 cfg, class_en, pfc_class_mask_cfg; in rpm_lmac_pfc_config() local
635 return -ENODEV; in rpm_lmac_pfc_config()
640 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pfc_config()
645 cfg &= ~(RPMX_MTI_MAC100X_COMMAND_CONFIG_RX_P_DISABLE | in rpm_lmac_pfc_config()
648 cfg |= (RPMX_MTI_MAC100X_COMMAND_CONFIG_RX_P_DISABLE | in rpm_lmac_pfc_config()
654 cfg &= ~RPMX_MTI_MAC100X_COMMAND_CONFIG_TX_P_DISABLE; in rpm_lmac_pfc_config()
658 cfg |= RPMX_MTI_MAC100X_COMMAND_CONFIG_TX_P_DISABLE; in rpm_lmac_pfc_config()
663 cfg &= ~RPMX_MTI_MAC100X_COMMAND_CONFIG_PFC_MODE; in rpm_lmac_pfc_config()
665 cfg |= RPMX_MTI_MAC100X_COMMAND_CONFIG_PFC_MODE; in rpm_lmac_pfc_config()
667 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pfc_config()
676 u64 cfg; in rpm_lmac_get_pfc_frm_cfg() local
679 return -ENODEV; in rpm_lmac_get_pfc_frm_cfg()
681 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_get_pfc_frm_cfg()
682 if (cfg & RPMX_MTI_MAC100X_COMMAND_CONFIG_PFC_MODE) { in rpm_lmac_get_pfc_frm_cfg()
683 *rx_pause = !(cfg & RPMX_MTI_MAC100X_COMMAND_CONFIG_RX_P_DISABLE); in rpm_lmac_get_pfc_frm_cfg()
684 *tx_pause = !(cfg & RPMX_MTI_MAC100X_COMMAND_CONFIG_TX_P_DISABLE); in rpm_lmac_get_pfc_frm_cfg()
694 u64 cfg; in rpm_get_fec_stats() local
697 return -ENODEV; in rpm_get_fec_stats()
699 if (rpm->lmac_idmap[lmac_id]->link_info.fec == OTX2_FEC_NONE) in rpm_get_fec_stats()
702 if (rpm->lmac_idmap[lmac_id]->link_info.fec == OTX2_FEC_BASER) { in rpm_get_fec_stats()
705 rsp->fec_corr_blks = (val_hi << 16 | val_lo); in rpm_get_fec_stats()
709 rsp->fec_uncorr_blks = (val_hi << 16 | val_lo); in rpm_get_fec_stats()
712 if (rpm->lmac_idmap[lmac_id]->link_info.lmac_type_id == in rpm_get_fec_stats()
718 rsp->fec_corr_blks += (val_hi << 16 | val_lo); in rpm_get_fec_stats()
724 rsp->fec_uncorr_blks += (val_hi << 16 | val_lo); in rpm_get_fec_stats()
727 /* enable RS-FEC capture */ in rpm_get_fec_stats()
728 cfg = rpm_read(rpm, 0, RPMX_MTI_STAT_STATN_CONTROL); in rpm_get_fec_stats()
729 cfg |= RPMX_RSFEC_RX_CAPTURE | BIT(lmac_id); in rpm_get_fec_stats()
730 rpm_write(rpm, 0, RPMX_MTI_STAT_STATN_CONTROL, cfg); in rpm_get_fec_stats()
735 rsp->fec_corr_blks = (val_hi << 32 | val_lo); in rpm_get_fec_stats()
740 rsp->fec_uncorr_blks = (val_hi << 32 | val_lo); in rpm_get_fec_stats()
748 u64 rx_logl_xon, cfg; in rpm_lmac_reset() local
752 return -ENODEV; in rpm_lmac_reset()
757 cfg = 0xff; in rpm_lmac_reset()
759 rpm_write(rpm, lmac_id, rx_logl_xon, cfg); in rpm_lmac_reset()