Lines Matching full:rpm
2 /* Marvell CN10K RPM driver
12 .name = "rpm",
45 static void rpm_write(rpm_t *rpm, u64 lmac, u64 offset, u64 val) in rpm_write() argument
47 cgx_write(rpm, lmac, offset, val); in rpm_write()
50 static u64 rpm_read(rpm_t *rpm, u64 lmac, u64 offset) in rpm_read() argument
52 return cgx_read(rpm, lmac, offset); in rpm_read()
57 rpm_t *rpm = rpmd; in rpm_get_nr_lmacs() local
59 return hweight8(rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS) & 0xFULL); in rpm_get_nr_lmacs()
64 rpm_t *rpm = rpmd; in rpm_lmac_tx_enable() local
67 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_tx_enable()
70 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_tx_enable()
78 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_tx_enable()
84 rpm_t *rpm = rpmd; in rpm_lmac_rx_tx_enable() local
87 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_rx_tx_enable()
90 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_rx_tx_enable()
95 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_rx_tx_enable()
101 rpm_t *rpm = rpmd; in rpm_lmac_enadis_rx_pause_fwding() local
105 if (!rpm) in rpm_lmac_enadis_rx_pause_fwding()
108 lmac = lmac_pdata(lmac_id, rpm); in rpm_lmac_enadis_rx_pause_fwding()
117 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_rx_pause_fwding()
119 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_rx_pause_fwding()
121 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_rx_pause_fwding()
123 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_rx_pause_fwding()
130 rpm_t *rpm = rpmd; in rpm_lmac_get_pause_frm_status() local
133 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_get_pause_frm_status()
136 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_get_pause_frm_status()
145 static void rpm_cfg_pfc_quanta_thresh(rpm_t *rpm, int lmac_id, in rpm_cfg_pfc_quanta_thresh() argument
201 cfg = rpm_read(rpm, lmac_id, quanta_offset); in rpm_cfg_pfc_quanta_thresh()
210 rpm_write(rpm, lmac_id, quanta_offset, cfg); in rpm_cfg_pfc_quanta_thresh()
212 cfg = rpm_read(rpm, lmac_id, quanta_thresh); in rpm_cfg_pfc_quanta_thresh()
221 rpm_write(rpm, lmac_id, quanta_thresh, cfg); in rpm_cfg_pfc_quanta_thresh()
228 rpm_t *rpm = rpmd; in rpm_lmac_enadis_pause_frm() local
231 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_enadis_pause_frm()
234 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_pause_frm()
239 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_pause_frm()
241 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_enadis_pause_frm()
244 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_enadis_pause_frm()
246 cfg = rpm_read(rpm, 0, RPMX_CMR_RX_OVR_BP); in rpm_lmac_enadis_pause_frm()
249 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 1, true); in rpm_lmac_enadis_pause_frm()
253 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 0xffff, false); in rpm_lmac_enadis_pause_frm()
257 rpm_write(rpm, 0, RPMX_CMR_RX_OVR_BP, cfg); in rpm_lmac_enadis_pause_frm()
263 rpm_t *rpm = rpmd; in rpm_lmac_pause_frm_config() local
267 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
269 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
272 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
274 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
277 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pause_frm_config()
279 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pause_frm_config()
282 cfg = rpm_read(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL); in rpm_lmac_pause_frm_config()
284 rpm_write(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL, cfg); in rpm_lmac_pause_frm_config()
287 rpm_write(rpm, 0, RPMX_CMR_CHAN_MSK_OR, ~0ULL); in rpm_lmac_pause_frm_config()
292 rpm_t *rpm = rpmd; in rpm_get_rx_stats() local
295 if (!rpm || lmac_id >= rpm->lmac_count) in rpm_get_rx_stats()
298 mutex_lock(&rpm->lock); in rpm_get_rx_stats()
301 idx += lmac_id * rpm->mac_ops->rx_stats_cnt; in rpm_get_rx_stats()
304 val_lo = rpm_read(rpm, 0, RPMX_MTI_STAT_RX_STAT_PAGES_COUNTERX + in rpm_get_rx_stats()
310 val_hi = rpm_read(rpm, 0, RPMX_MTI_STAT_DATA_HI_CDC); in rpm_get_rx_stats()
314 mutex_unlock(&rpm->lock); in rpm_get_rx_stats()
320 rpm_t *rpm = rpmd; in rpm_get_tx_stats() local
323 if (!rpm || lmac_id >= rpm->lmac_count) in rpm_get_tx_stats()
326 mutex_lock(&rpm->lock); in rpm_get_tx_stats()
329 idx += lmac_id * rpm->mac_ops->tx_stats_cnt; in rpm_get_tx_stats()
331 val_lo = rpm_read(rpm, 0, RPMX_MTI_STAT_TX_STAT_PAGES_COUNTERX + in rpm_get_tx_stats()
333 val_hi = rpm_read(rpm, 0, RPMX_MTI_STAT_DATA_HI_CDC); in rpm_get_tx_stats()
337 mutex_unlock(&rpm->lock); in rpm_get_tx_stats()
343 rpm_t *rpm = rpmd; in rpm_get_lmac_type() local
348 err = cgx_fwi_cmd_generic(req, &resp, rpm, 0); in rpm_get_lmac_type()
356 rpm_t *rpm = rpmd; in rpm_get_lmac_fifo_len() local
361 fifo_len = rpm->mac_ops->fifo_len; in rpm_get_lmac_fifo_len()
362 num_lmacs = rpm->mac_ops->get_nr_lmacs(rpm); in rpm_get_lmac_fifo_len()
371 hi_perf_lmac = rpm_read(rpm, 0, CGXX_CMRX_RX_LMACS); in rpm_get_lmac_fifo_len()
385 rpm_t *rpm = rpmd; in rpm_lmac_internal_loopback() local
389 if (!rpm || lmac_id >= rpm->lmac_count) in rpm_lmac_internal_loopback()
391 lmac_type = rpm->mac_ops->get_lmac_type(rpm, lmac_id); in rpm_lmac_internal_loopback()
394 dev_err(&rpm->pdev->dev, "loopback not supported for LPC mode\n"); in rpm_lmac_internal_loopback()
398 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1); in rpm_lmac_internal_loopback()
404 rpm_write(rpm, lmac_id, RPMX_MTI_PCS100X_CONTROL1, cfg); in rpm_lmac_internal_loopback()
411 rpm_t *rpm = rpmd; in rpm_lmac_ptp_config() local
414 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_ptp_config()
417 cfg = rpm_read(rpm, lmac_id, RPMX_CMRX_CFG); in rpm_lmac_ptp_config()
426 rpm_write(rpm, lmac_id, RPMX_CMRX_CFG, cfg); in rpm_lmac_ptp_config()
428 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_XIF_MODE); in rpm_lmac_ptp_config()
437 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_XIF_MODE, cfg); in rpm_lmac_ptp_config()
442 rpm_t *rpm = rpmd; in rpm_lmac_pfc_config() local
445 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_pfc_config()
448 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_pfc_config()
449 class_en = rpm_read(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL); in rpm_lmac_pfc_config()
463 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, pfc_en, true); in rpm_lmac_pfc_config()
467 rpm_cfg_pfc_quanta_thresh(rpm, lmac_id, 0xfff, false); in rpm_lmac_pfc_config()
477 rpm_write(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG, cfg); in rpm_lmac_pfc_config()
479 rpm_write(rpm, lmac_id, RPMX_CMRX_PRT_CBFC_CTL, class_en); in rpm_lmac_pfc_config()
486 rpm_t *rpm = rpmd; in rpm_lmac_get_pfc_frm_cfg() local
489 if (!is_lmac_valid(rpm, lmac_id)) in rpm_lmac_get_pfc_frm_cfg()
492 cfg = rpm_read(rpm, lmac_id, RPMX_MTI_MAC100X_COMMAND_CONFIG); in rpm_lmac_get_pfc_frm_cfg()