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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Jan 2020 11:21:40 +0000 (12:21 +0100)
[ Upstream commit 11d55fd9975f8e46a0e5e19c14899544e81e1e15 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c

index 9d08a934fe4fc9e7c6defa1213cec8968d0c4c86..ff751ab3d7658ed358a6d47325bc0dbd72a64108 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 f70ca5300b82c8b64ad1e855f1eee33ce78b626d..4af7271cea5613f359898993e3897b407da63cd9 100644 (file)
@@ -489,7 +489,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));
 }