aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxime Chevallier <maxime.chevallier@bootlin.com>2018-04-18 05:14:44 -0400
committerDavid S. Miller <davem@davemloft.net>2018-04-19 13:12:14 -0400
commitda42bb271305d68df6cbf99eed90542f1f1ee1c9 (patch)
tree39af312c2496a35997bc77faf4ea3596940759c6
parentbb9aaaa1849eed763c6b7f20227a8a03300d4421 (diff)
net: mvpp2: Fix DMA address mask size
PPv2 TX/RX descriptors uses 40bits DMA addresses, but 41 bits masks were used (GENMASK_ULL(40, 0)). This commit fixes that by using the correct mask. Fixes: e7c5359f2eed ("net: mvpp2: introduce PPv2.2 HW descriptors and adapt accessors") Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/marvell/mvpp2.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 9deb79b6dcc8..4202f9b5b966 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -916,6 +916,8 @@ static struct {
916 916
917#define MVPP2_MIB_COUNTERS_STATS_DELAY (1 * HZ) 917#define MVPP2_MIB_COUNTERS_STATS_DELAY (1 * HZ)
918 918
919#define MVPP2_DESC_DMA_MASK DMA_BIT_MASK(40)
920
919/* Definitions */ 921/* Definitions */
920 922
921/* Shared Packet Processor resources */ 923/* Shared Packet Processor resources */
@@ -1429,7 +1431,7 @@ static dma_addr_t mvpp2_txdesc_dma_addr_get(struct mvpp2_port *port,
1429 if (port->priv->hw_version == MVPP21) 1431 if (port->priv->hw_version == MVPP21)
1430 return tx_desc->pp21.buf_dma_addr; 1432 return tx_desc->pp21.buf_dma_addr;
1431 else 1433 else
1432 return tx_desc->pp22.buf_dma_addr_ptp & GENMASK_ULL(40, 0); 1434 return tx_desc->pp22.buf_dma_addr_ptp & MVPP2_DESC_DMA_MASK;
1433} 1435}
1434 1436
1435static void mvpp2_txdesc_dma_addr_set(struct mvpp2_port *port, 1437static void mvpp2_txdesc_dma_addr_set(struct mvpp2_port *port,
@@ -1447,7 +1449,7 @@ static void mvpp2_txdesc_dma_addr_set(struct mvpp2_port *port,
1447 } else { 1449 } else {
1448 u64 val = (u64)addr; 1450 u64 val = (u64)addr;
1449 1451
1450 tx_desc->pp22.buf_dma_addr_ptp &= ~GENMASK_ULL(40, 0); 1452 tx_desc->pp22.buf_dma_addr_ptp &= ~MVPP2_DESC_DMA_MASK;
1451 tx_desc->pp22.buf_dma_addr_ptp |= val; 1453 tx_desc->pp22.buf_dma_addr_ptp |= val;
1452 tx_desc->pp22.packet_offset = offset; 1454 tx_desc->pp22.packet_offset = offset;
1453 } 1455 }
@@ -1507,7 +1509,7 @@ static dma_addr_t mvpp2_rxdesc_dma_addr_get(struct mvpp2_port *port,
1507 if (port->priv->hw_version == MVPP21) 1509 if (port->priv->hw_version == MVPP21)
1508 return rx_desc->pp21.buf_dma_addr; 1510 return rx_desc->pp21.buf_dma_addr;
1509 else 1511 else
1510 return rx_desc->pp22.buf_dma_addr_key_hash & GENMASK_ULL(40, 0); 1512 return rx_desc->pp22.buf_dma_addr_key_hash & MVPP2_DESC_DMA_MASK;
1511} 1513}
1512 1514
1513static unsigned long mvpp2_rxdesc_cookie_get(struct mvpp2_port *port, 1515static unsigned long mvpp2_rxdesc_cookie_get(struct mvpp2_port *port,
@@ -1516,7 +1518,7 @@ static unsigned long mvpp2_rxdesc_cookie_get(struct mvpp2_port *port,
1516 if (port->priv->hw_version == MVPP21) 1518 if (port->priv->hw_version == MVPP21)
1517 return rx_desc->pp21.buf_cookie; 1519 return rx_desc->pp21.buf_cookie;
1518 else 1520 else
1519 return rx_desc->pp22.buf_cookie_misc & GENMASK_ULL(40, 0); 1521 return rx_desc->pp22.buf_cookie_misc & MVPP2_DESC_DMA_MASK;
1520} 1522}
1521 1523
1522static size_t mvpp2_rxdesc_size_get(struct mvpp2_port *port, 1524static size_t mvpp2_rxdesc_size_get(struct mvpp2_port *port,
@@ -8789,7 +8791,7 @@ static int mvpp2_probe(struct platform_device *pdev)
8789 } 8791 }
8790 8792
8791 if (priv->hw_version == MVPP22) { 8793 if (priv->hw_version == MVPP22) {
8792 err = dma_set_mask(&pdev->dev, DMA_BIT_MASK(40)); 8794 err = dma_set_mask(&pdev->dev, MVPP2_DESC_DMA_MASK);
8793 if (err) 8795 if (err)
8794 goto err_mg_clk; 8796 goto err_mg_clk;
8795 /* Sadly, the BM pools all share the same register to 8797 /* Sadly, the BM pools all share the same register to