Commit 453e9dc4 authored by Stefan Agner's avatar Stefan Agner Committed by David S. Miller

net: fec: check DMA addressing limitations

Check DMA addressing limitations as suggested by the DMA API
how-to. This does not fix a particular issue seen but is
considered good style.
Signed-off-by: default avatarStefan Agner <stefan@agner.ch>
Acked-by: default avatarFugang Duan <fugang.duan@nxp.com>
Reviewed-by: default avatarRobin Murphy <robin.murphy@arm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 770b26de
...@@ -3129,6 +3129,7 @@ static int fec_enet_init(struct net_device *ndev) ...@@ -3129,6 +3129,7 @@ static int fec_enet_init(struct net_device *ndev)
unsigned dsize = fep->bufdesc_ex ? sizeof(struct bufdesc_ex) : unsigned dsize = fep->bufdesc_ex ? sizeof(struct bufdesc_ex) :
sizeof(struct bufdesc); sizeof(struct bufdesc);
unsigned dsize_log2 = __fls(dsize); unsigned dsize_log2 = __fls(dsize);
int ret;
WARN_ON(dsize != (1 << dsize_log2)); WARN_ON(dsize != (1 << dsize_log2));
#if defined(CONFIG_ARM) || defined(CONFIG_ARM64) #if defined(CONFIG_ARM) || defined(CONFIG_ARM64)
...@@ -3139,6 +3140,13 @@ static int fec_enet_init(struct net_device *ndev) ...@@ -3139,6 +3140,13 @@ static int fec_enet_init(struct net_device *ndev)
fep->tx_align = 0x3; fep->tx_align = 0x3;
#endif #endif
/* Check mask of the streaming and coherent API */
ret = dma_set_mask_and_coherent(&fep->pdev->dev, DMA_BIT_MASK(32));
if (ret < 0) {
dev_warn(&fep->pdev->dev, "No suitable DMA available\n");
return ret;
}
fec_enet_alloc_queue(ndev); fec_enet_alloc_queue(ndev);
bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize; bd_size = (fep->total_tx_ring_size + fep->total_rx_ring_size) * dsize;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment