drivers: net: xgene: Workaround for HW errata 10GE_4
authorQuan Nguyen <qnguyen@apm.com>
Wed, 10 May 2017 20:45:07 +0000 (13:45 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 May 2017 15:41:10 +0000 (11:41 -0400)
This patch adds workaround for HW errata 10GE_4:
"XGENET_ICM_ECM_DROP_COUNT_REG_0 reg not clear on read".

Signed-off-by: Quan Nguyen <qnguyen@apm.com>
Signed-off-by: Iyappan Subramanian <isubramanian@apm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c

index 5278d62d5b57c8cf6ae65f06f60b2f00d36c1e41..3235d0cf39428aecaf9b9d98a60a6174e4c185d7 100644 (file)
@@ -626,6 +626,8 @@ static void xgene_gmac_get_drop_cnt(struct xgene_enet_pdata *pdata,
        xgene_enet_rd_mcx_csr(pdata, ICM_ECM_DROP_COUNT_REG0_ADDR, &count);
        *rx = ICM_DROP_COUNT(count);
        *tx = ECM_DROP_COUNT(count);
+       /* Errata: 10GE_4 - Fix ICM_ECM_DROP_COUNT not clear-on-read */
+       xgene_enet_rd_mcx_csr(pdata, ECM_CONFIG0_REG_0_ADDR, &count);
 }
 
 static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *pdata)
index 2919d3e36fada99dcfa1d98382b1d929969dd5cd..31df8f32c214177e8a6708bfeb6a5e9511bdab6f 100644 (file)
@@ -106,6 +106,11 @@ static void xgene_sgmac_get_drop_cnt(struct xgene_enet_pdata *pdata,
        count = xgene_enet_rd_mcx_csr(pdata, addr);
        *rx = ICM_DROP_COUNT(count);
        *tx = ECM_DROP_COUNT(count);
+       /* Errata: 10GE_4 - ICM_ECM_DROP_COUNT not clear-on-read */
+       addr = (pdata->enet_id != XGENE_ENET1) ?
+               XG_MCX_ECM_CONFIG0_REG_0_ADDR :
+               ECM_CONFIG0_REG_0_ADDR + pdata->port_id * OFFSET_4;
+       xgene_enet_rd_mcx_csr(pdata, addr);
 }
 
 static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *p)
index 56dff380cbb7ac7e84687be2919a29f07b0e10c9..eab6f1c12f1cedcd192b2d72d187bc9668c9f567 100644 (file)
@@ -188,6 +188,8 @@ static void xgene_xgmac_get_drop_cnt(struct xgene_enet_pdata *pdata,
        xgene_enet_rd_axg_csr(pdata, XGENET_ICM_ECM_DROP_COUNT_REG0, &count);
        *rx = ICM_DROP_COUNT(count);
        *tx = ECM_DROP_COUNT(count);
+       /* Errata: 10GE_4 - ICM_ECM_DROP_COUNT not clear-on-read */
+       xgene_enet_rd_axg_csr(pdata, XGENET_ECM_CONFIG0_REG_0, &count);
 }
 
 static void xgene_enet_config_ring_if_assoc(struct xgene_enet_pdata *pdata)