From: Timur Tabi <timur@codeaurora.org>
To: "David S. Miller" <davem@davemloft.net>, netdev@vger.kernel.org
Cc: timur@codeaurora.org
Subject: [PATCH 1/4] net: qcom/emac: specify the correct DMA mask
Date: Wed, 11 Oct 2017 14:52:23 -0500 [thread overview]
Message-ID: <1507751546-10265-2-git-send-email-timur@codeaurora.org> (raw)
In-Reply-To: <1507751546-10265-1-git-send-email-timur@codeaurora.org>
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>
---
drivers/net/ethernet/qualcomm/emac/emac.c | 17 ++++-------------
1 file 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)
u32 reg;
int ret;
- /* The EMAC itself is capable of 64-bit DMA, so try that first. */
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+ /* The TPD buffer address is limited to 45 bits. */
+ ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(45));
if (ret) {
- /* Some platforms may restrict the EMAC's address bus to less
- * then the size of DDR. In this case, we need to try a
- * smaller mask. We could try every possible smaller mask,
- * but that's overkill. Instead, just fall to 32-bit, which
- * should always work.
- */
- ret = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
- if (ret) {
- dev_err(&pdev->dev, "could not set DMA mask\n");
- return ret;
- }
+ dev_err(&pdev->dev, "could not set DMA mask\n");
+ return ret;
}
netdev = alloc_etherdev(sizeof(struct emac_adapter));
--
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm
Technologies, Inc. Qualcomm Technologies, Inc. is a member of the
Code Aurora Forum, a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2017-10-11 19:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 19:52 [PATCH 0/4] net: qcom/emac: various minor fixes Timur Tabi
2017-10-11 19:52 ` Timur Tabi [this message]
2017-10-11 19:52 ` [PATCH 2/4] net: qcom/emac: remove unused address arrays Timur Tabi
2017-10-11 19:52 ` [PATCH 3/4] net: qcom/emac: enforce DMA address restrictions Timur Tabi
2017-10-12 9:30 ` David Laight
2017-10-12 14:13 ` Timur Tabi
2017-10-12 16:20 ` David Laight
2017-10-12 16:52 ` Timur Tabi
2017-10-12 16:58 ` David Miller
2017-10-12 17:15 ` Timur Tabi
2017-10-12 17:20 ` David Miller
2017-10-11 19:52 ` [PATCH 4/4] net: qcom/emac: clean up some TX/RX error messages Timur Tabi
2017-10-11 23:02 ` [PATCH 0/4] net: qcom/emac: various minor fixes David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1507751546-10265-2-git-send-email-timur@codeaurora.org \
--to=timur@codeaurora.org \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).