common/cnxk: start and stop BPHY LMAC
Add support for starting or stopping specific lmac. Start enables Rx/Tx traffic while stop does the opposite. Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com> Signed-off-by: Jakub Palider <jpalider@marvell.com> Reviewed-by: Jerin Jacob <jerinj@marvell.com>
This commit is contained in:
parent
7fb5075a53
commit
2c19694c8e
@ -7,6 +7,9 @@
|
||||
#include "roc_api.h"
|
||||
#include "roc_priv.h"
|
||||
|
||||
#define CGX_CMRX_CONFIG 0x00
|
||||
#define CGX_CMRX_CONFIG_DATA_PKT_RX_EN BIT_ULL(54)
|
||||
#define CGX_CMRX_CONFIG_DATA_PKT_TX_EN BIT_ULL(53)
|
||||
#define CGX_CMRX_INT 0x40
|
||||
#define CGX_CMRX_INT_OVERFLW BIT_ULL(1)
|
||||
/*
|
||||
@ -214,6 +217,33 @@ roc_bphy_cgx_lmac_exists(struct roc_bphy_cgx *roc_cgx, unsigned int lmac)
|
||||
(roc_cgx->lmac_bmap & BIT_ULL(lmac));
|
||||
}
|
||||
|
||||
static int
|
||||
roc_bphy_cgx_start_stop_rxtx(struct roc_bphy_cgx *roc_cgx, unsigned int lmac,
|
||||
bool start)
|
||||
{
|
||||
uint64_t val;
|
||||
|
||||
if (!roc_cgx)
|
||||
return -EINVAL;
|
||||
|
||||
if (!roc_bphy_cgx_lmac_exists(roc_cgx, lmac))
|
||||
return -ENODEV;
|
||||
|
||||
pthread_mutex_lock(&roc_cgx->lock);
|
||||
val = roc_bphy_cgx_read(roc_cgx, lmac, CGX_CMRX_CONFIG);
|
||||
val &= ~(CGX_CMRX_CONFIG_DATA_PKT_RX_EN |
|
||||
CGX_CMRX_CONFIG_DATA_PKT_TX_EN);
|
||||
|
||||
if (start)
|
||||
val |= FIELD_PREP(CGX_CMRX_CONFIG_DATA_PKT_RX_EN, 1) |
|
||||
FIELD_PREP(CGX_CMRX_CONFIG_DATA_PKT_TX_EN, 1);
|
||||
|
||||
roc_bphy_cgx_write(roc_cgx, lmac, CGX_CMRX_CONFIG, val);
|
||||
pthread_mutex_unlock(&roc_cgx->lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
roc_bphy_cgx_intlbk_ena_dis(struct roc_bphy_cgx *roc_cgx, unsigned int lmac,
|
||||
bool enable)
|
||||
@ -253,6 +283,18 @@ roc_bphy_cgx_ptp_rx_ena_dis(struct roc_bphy_cgx *roc_cgx, unsigned int lmac,
|
||||
return roc_bphy_cgx_intf_req(roc_cgx, lmac, scr1, &scr0);
|
||||
}
|
||||
|
||||
int
|
||||
roc_bphy_cgx_start_rxtx(struct roc_bphy_cgx *roc_cgx, unsigned int lmac)
|
||||
{
|
||||
return roc_bphy_cgx_start_stop_rxtx(roc_cgx, lmac, true);
|
||||
}
|
||||
|
||||
int
|
||||
roc_bphy_cgx_stop_rxtx(struct roc_bphy_cgx *roc_cgx, unsigned int lmac)
|
||||
{
|
||||
return roc_bphy_cgx_start_stop_rxtx(roc_cgx, lmac, false);
|
||||
}
|
||||
|
||||
int
|
||||
roc_bphy_cgx_set_link_state(struct roc_bphy_cgx *roc_cgx, unsigned int lmac,
|
||||
bool state)
|
||||
|
@ -95,6 +95,10 @@ struct roc_bphy_cgx_link_info {
|
||||
__roc_api int roc_bphy_cgx_dev_init(struct roc_bphy_cgx *roc_cgx);
|
||||
__roc_api int roc_bphy_cgx_dev_fini(struct roc_bphy_cgx *roc_cgx);
|
||||
|
||||
__roc_api int roc_bphy_cgx_start_rxtx(struct roc_bphy_cgx *roc_cgx,
|
||||
unsigned int lmac);
|
||||
__roc_api int roc_bphy_cgx_stop_rxtx(struct roc_bphy_cgx *roc_cgx,
|
||||
unsigned int lmac);
|
||||
__roc_api int roc_bphy_cgx_set_link_state(struct roc_bphy_cgx *roc_cgx,
|
||||
unsigned int lmac, bool state);
|
||||
__roc_api int roc_bphy_cgx_get_linkinfo(struct roc_bphy_cgx *roc_cgx,
|
||||
|
@ -18,6 +18,8 @@ INTERNAL {
|
||||
roc_bphy_cgx_ptp_rx_enable;
|
||||
roc_bphy_cgx_set_link_mode;
|
||||
roc_bphy_cgx_set_link_state;
|
||||
roc_bphy_cgx_start_rxtx;
|
||||
roc_bphy_cgx_stop_rxtx;
|
||||
roc_clk_freq_get;
|
||||
roc_error_msg_get;
|
||||
roc_idev_lmt_base_addr_get;
|
||||
|
Loading…
x
Reference in New Issue
Block a user