From 300ea25660a7b039aeafd24931307d120e1ec620 Mon Sep 17 00:00:00 2001 From: Eyal Harari Date: Thu, 27 Feb 2014 18:11:13 +0200 Subject: FMD: DSAR: added accumulate mode when entering deep sleep Change-Id: Iad7a7c608e738661c1a9205fa2da45681ab2bc84 Signed-off-by: Eyal Harari Reviewed-on: http://git.am.freescale.net:8181/9305 Reviewed-by: Mandy Lavi Reviewed-by: Sunil Kumar Kori Reviewed-by: Jose Rivera Tested-by: Jose Rivera Reviewed-on: http://git.am.freescale.net:8181/9446 diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c index 9924d3b..d4a3c9b 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.c @@ -5482,6 +5482,10 @@ t_Error FM_PORT_EnterDsar(t_Handle h_FmPortRx, t_FmPortDsarParams *params) struct arOffsets* of; uint8_t tmp = 0; t_Handle *h_FmPcd; + t_FmGetSetParams fmGetSetParams; + memset(&fmGetSetParams, 0, sizeof (t_FmGetSetParams)); + fmGetSetParams.setParams.type = UPDATE_FPM_BRKC_SLP; + fmGetSetParams.setParams.sleep = 1; err = DsarCheckParams(params, p_FmPort->deepSleepVars.autoResMaxSizes); if (err != E_OK) @@ -5778,7 +5782,10 @@ t_Error FM_PORT_EnterDsar(t_Handle h_FmPortRx, t_FmPortDsarParams *params) WRITE_UINT32(p_FmPort->p_FmPortBmiRegs->rxPortBmiRegs.fmbm_rfpne, 0x2E); // Stage 8: We don't support magic packet for now. // Stage 9: Accumulate mode -// WRITE_UINT32(p_FmPort->port.bmi_regs->rx.fmbm_rcfg, GET_UINT32(p_FmPort->port.bmi_regs->rx.fmbm_rcfg) | BMI_PORT_CFG_AM); + p_FmPort->deepSleepVars.fmbm_rcfg = GET_UINT32(p_FmPort->port.bmi_regs->rx.fmbm_rcfg); + WRITE_UINT32(p_FmPort->port.bmi_regs->rx.fmbm_rcfg, p_FmPort->deepSleepVars.fmbm_rcfg | BMI_PORT_CFG_AM); + FmGetSetParams(p_FmPort->h_Fm, &fmGetSetParams); + ARDesc = UINT_TO_PTR(XX_VirtToPhys(ArCommonDescPtr)); return E_OK; } @@ -5793,6 +5800,10 @@ void FM_PORT_ExitDsar(t_Handle h_FmPortRx, t_Handle h_FmPortTx) { t_FmPort *p_FmPort = (t_FmPort *)h_FmPortRx; t_FmPort *p_FmPortTx = (t_FmPort *)h_FmPortTx; + t_FmGetSetParams fmGetSetParams; + memset(&fmGetSetParams, 0, sizeof (t_FmGetSetParams)); + fmGetSetParams.setParams.type = UPDATE_FPM_BRKC_SLP; + fmGetSetParams.setParams.sleep = 0; if (p_FmPort->deepSleepVars.autoResOffsets) { XX_Free(p_FmPort->deepSleepVars.autoResOffsets); @@ -5808,6 +5819,8 @@ void FM_PORT_ExitDsar(t_Handle h_FmPortRx, t_Handle h_FmPortTx) PrsDisable(FmGetPcd(p_FmPort->h_Fm)); WRITE_UINT32(p_FmPort->p_FmPortBmiRegs->rxPortBmiRegs.fmbm_rfpne, p_FmPort->deepSleepVars.fmbm_rfpne); WRITE_UINT32(p_FmPort->p_FmPortBmiRegs->rxPortBmiRegs.fmbm_rfne, p_FmPort->deepSleepVars.fmbm_rfne); + WRITE_UINT32(p_FmPort->p_FmPortBmiRegs->rxPortBmiRegs.fmbm_rcfg, p_FmPort->deepSleepVars.fmbm_rcfg); + FmGetSetParams(p_FmPort->h_Fm, &fmGetSetParams); WRITE_UINT32(p_FmPortTx->p_FmPortBmiRegs->txPortBmiRegs.fmbm_tcmne, p_FmPort->deepSleepVars.fmbm_tcmne); WRITE_UINT32(p_FmPortTx->p_FmPortBmiRegs->txPortBmiRegs.fmbm_tcfg, p_FmPort->deepSleepVars.fmbm_tcfg); } diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h index 58369a8..75f117f 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/Port/fm_port.h @@ -495,6 +495,7 @@ typedef _Packed struct #define BMI_PORT_CFG_EN_MACSEC 0x00800000 #define BMI_PORT_CFG_FDOVR 0x02000000 #define BMI_PORT_CFG_IM 0x01000000 +#define BMI_PORT_CFG_AM 0x00000040 #define BMI_PORT_STATUS_BSY 0x80000000 #define BMI_COUNTERS_EN 0x80000000 @@ -861,6 +862,7 @@ typedef struct t_FmPortDsarVars { uint32_t fmbm_tcmne; uint32_t fmbm_rfne; uint32_t fmbm_rfpne; + uint32_t fmbm_rcfg; bool dsarEnabledParser; } t_FmPortDsarVars; typedef struct { diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c index a4ea833..dfc1cdb 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.c @@ -5207,3 +5207,18 @@ t_Handle FmGetPcd(t_Handle h_Fm) { return ((t_Fm*)h_Fm)->h_Pcd; } + +t_Error FmGetSetParams(t_Handle h_Fm, t_FmGetSetParams *p_Params) +{ + t_Fm* p_Fm = (t_Fm*)h_Fm; + if (p_Params->setParams.type == UPDATE_FPM_BRKC_SLP) + { + if (p_Params->setParams.sleep) + WRITE_UINT32(p_Fm->p_FmFpmRegs->fmfp_brkc, GET_UINT32( + p_Fm->p_FmFpmRegs->fmfp_brkc) | FPM_BRKC_SLP); + else + WRITE_UINT32(p_Fm->p_FmFpmRegs->fmfp_brkc, GET_UINT32( + p_Fm->p_FmFpmRegs->fmfp_brkc) & ~FPM_BRKC_SLP); + } + return E_OK; +} diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.h index 0d56be0..41ffc17 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/fm.h @@ -524,6 +524,7 @@ typedef _Packed struct t_FmTrbRegs *//***************************************************************************/ /* masks */ #define FPM_BRKC_RDBG 0x00000200 +#define FPM_BRKC_SLP 0x00000800 /**************************************************************************//** @Description BMI defines *//***************************************************************************/ @@ -632,6 +633,7 @@ typedef struct t_FmSp { } t_FmSp; #endif /* (DPAA_VERSION >= 11) */ + typedef struct t_Fm { /***************************/ diff --git a/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h b/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h index a015900..d693a51 100644 --- a/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h +++ b/drivers/net/ethernet/freescale/fman/Peripherals/FM/inc/fm_common.h @@ -258,6 +258,16 @@ typedef struct { t_SetCcParams setCcParams; } t_FmPortGetSetCcParams; +typedef struct { + uint32_t type; + bool sleep; +} t_FmSetParams; + +typedef struct { + t_FmSetParams setParams; +} t_FmGetSetParams; + +t_Error FmGetSetParams(t_Handle h_Fm, t_FmGetSetParams *p_Params); static __inline__ bool TRY_LOCK(t_Handle h_Spinlock, volatile bool *p_Flag) { @@ -324,6 +334,7 @@ static __inline__ bool TRY_LOCK(t_Handle h_Spinlock, volatile bool *p_Flag) #define UPDATE_KG_NIA 0x04000000 /* @} */ +#define UPDATE_FPM_BRKC_SLP 0x80000000 #define FM_MAX_NUM_OF_PORTS (FM_MAX_NUM_OF_OH_PORTS + \ FM_MAX_NUM_OF_1G_RX_PORTS + \ FM_MAX_NUM_OF_10G_RX_PORTS + \ @@ -768,6 +779,7 @@ typedef enum e_FmPortGprFuncType t_Error FmPortSetGprFunc(t_Handle h_FmPort, e_FmPortGprFuncType gprFunc, void **p_Value); #endif /* DPAA_VERSION >= 11) */ +t_Error FmGetSetParams(t_Handle h_Fm, t_FmGetSetParams *p_FmGetSetParams); t_Error FmPortGetSetCcParams(t_Handle h_FmPort, t_FmPortGetSetCcParams *p_FmPortGetSetCcParams); uint8_t FmPortGetNetEnvId(t_Handle h_FmPort); uint8_t FmPortGetHardwarePortId(t_Handle h_FmPort); -- cgit v0.10.2