net: stmmac: xgmac: Clear previous RX buffer size
authorJose Abreu <Jose.Abreu@synopsys.com>
Wed, 18 Dec 2019 10:17:39 +0000 (11:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Dec 2019 20:04:17 +0000 (12:04 -0800)
When switching between buffer sizes we need to clear the previous value.

Fixes: d6ddfacd95c7 ("net: stmmac: Add DMA related callbacks for XGMAC2")
Signed-off-by: Jose Abreu <Jose.Abreu@synopsys.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c

index 3b6e559..ef8a07c 100644 (file)
 #define XGMAC_DMA_CH_RX_CONTROL(x)     (0x00003108 + (0x80 * (x)))
 #define XGMAC_RxPBL                    GENMASK(21, 16)
 #define XGMAC_RxPBL_SHIFT              16
+#define XGMAC_RBSZ                     GENMASK(14, 1)
+#define XGMAC_RBSZ_SHIFT               1
 #define XGMAC_RXST                     BIT(0)
 #define XGMAC_DMA_CH_TxDESC_HADDR(x)   (0x00003110 + (0x80 * (x)))
 #define XGMAC_DMA_CH_TxDESC_LADDR(x)   (0x00003114 + (0x80 * (x)))
index 22a7f0c..f3f08cc 100644 (file)
@@ -482,7 +482,8 @@ static void dwxgmac2_set_bfsize(void __iomem *ioaddr, int bfsize, u32 chan)
        u32 value;
 
        value = readl(ioaddr + XGMAC_DMA_CH_RX_CONTROL(chan));
-       value |= bfsize << 1;
+       value &= ~XGMAC_RBSZ;
+       value |= bfsize << XGMAC_RBSZ_SHIFT;
        writel(value, ioaddr + XGMAC_DMA_CH_RX_CONTROL(chan));
 }