net: ethernet: mediatek: Use NET_IP_ALIGN to judge if HW RX_2BYTE_OFFSET is enabled

Should only enable HW RX_2BYTE_OFFSET function in the case NET_IP_ALIGN
equals to 2.

Signed-off-by: Mark Lee <mark-mc.lee@mediatek.com>
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Sean Wang 2019-06-01 08:16:27 +08:00 committed by David S. Miller
parent 9e4f56f1a7
commit 880c2d4b2f

View File

@ -1778,6 +1778,7 @@ static void mtk_poll_controller(struct net_device *dev)
static int mtk_start_dma(struct mtk_eth *eth) static int mtk_start_dma(struct mtk_eth *eth)
{ {
u32 rx_2b_offset = (NET_IP_ALIGN == 2) ? MTK_RX_2B_OFFSET : 0;
int err; int err;
err = mtk_dma_init(eth); err = mtk_dma_init(eth);
@ -1794,7 +1795,7 @@ static int mtk_start_dma(struct mtk_eth *eth)
MTK_QDMA_GLO_CFG); MTK_QDMA_GLO_CFG);
mtk_w32(eth, mtk_w32(eth,
MTK_RX_DMA_EN | MTK_RX_2B_OFFSET | MTK_RX_DMA_EN | rx_2b_offset |
MTK_RX_BT_32DWORDS | MTK_MULTI_EN, MTK_RX_BT_32DWORDS | MTK_MULTI_EN,
MTK_PDMA_GLO_CFG); MTK_PDMA_GLO_CFG);