diff options
| author | Timur Tabi <timur@codeaurora.org> | 2017-10-11 15:52:23 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2017-10-11 19:01:56 -0400 |
| commit | d7e6b347560d1824d7bccfa307ad34bd3f133706 (patch) | |
| tree | cd2ead3cae16b5f09e9e8c4a0389607002f3b1ae /drivers/net/ethernet/qualcomm/emac | |
| parent | c7c64bca62f35351cf033a1dcea05cba522200a2 (diff) | |
net: qcom/emac: specify the correct DMA mask
The 64/32-bit DMA mask hackery in the EMAC driver is not actually necessary,
and is technically not accurate. The EMAC hardware is limted to a 45-bit
DMA address. Although no EMAC-enabled system can have that much DDR,
an IOMMU could possible provide a larger address. Rather than play games
with the DMA mappings, the driver should provide a correct value and
trust the DMA/IOMMU layers to do the right thing.
Signed-off-by: Timur Tabi <timur@codeaurora.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/qualcomm/emac')
| -rw-r--r-- | drivers/net/ethernet/qualcomm/emac/emac.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/drivers/net/ethernet/qualcomm/emac/emac.c b/drivers/net/ethernet/qualcomm/emac/emac.c index f477ba29c569..ee6f2d27502c 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac.c | |||
| @@ -615,20 +615,11 @@ static int emac_probe(struct platform_device *pdev) | |||
| 615 | u32 reg; | 615 | u32 reg; |
| 616 | int ret; | 616 | int ret; |
| 617 | 617 | ||
| 618 | /* The EMAC itself is capable of 64-bit DMA, so try that first. */ | 618 | /* The TPD buffer address is limited to 45 bits. */ |
| 619 | ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); | 619 | ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(45)); |
| 620 | if (ret) { | 620 | if (ret) { |
| 621 | /* Some platforms may restrict the EMAC's address bus to less | 621 | dev_err(&pdev->dev, "could not set DMA mask\n"); |
| 622 | * then the size of DDR. In this case, we need to try a | 622 | return ret; |
| 623 | * smaller mask. We could try every possible smaller mask, | ||
| 624 | * but that's overkill. Instead, just fall to 32-bit, which | ||
| 625 | * should always work. | ||
| 626 | */ | ||
| 627 | ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
| 628 | if (ret) { | ||
| 629 | dev_err(&pdev->dev, "could not set DMA mask\n"); | ||
| 630 | return ret; | ||
| 631 | } | ||
| 632 | } | 623 | } |
| 633 | 624 | ||
| 634 | netdev = alloc_etherdev(sizeof(struct emac_adapter)); | 625 | netdev = alloc_etherdev(sizeof(struct emac_adapter)); |
