From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Denis Orlov <denorl2009@gmail.com>,
Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 5/6] net: macb: fix DMA_ADDRESS_BROKEN in the coherent ring allocations
Date: Mon, 14 Oct 2024 14:58:42 +0200 [thread overview]
Message-ID: <20241014125843.2064532-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20241014125843.2064532-1-a.fatoum@pengutronix.de>
The driver already has defines struct macb_device::{rx_ring_phys,tx_ring_phys},
but never bothers to populate them. Let's make use of them and while at
it fix DMA_ADDRESS_BROKEN for the gem_q1_descs allocation as well.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
drivers/net/macb.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index c473525ecdaa..03fad3f20bd3 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -71,6 +71,7 @@ struct macb_device {
struct macb_dma_desc *tx_ring;
dma_addr_t tx_ring_phys;
struct macb_dma_desc *gem_q1_descs;
+ dma_addr_t gem_q1_descs_phys;
int rx_buffer_size;
int rx_ring_size;
@@ -367,7 +368,7 @@ static int gmac_init_dummy_tx_queues(struct macb_device *macb)
&macb->gem_q1_descs[0].ctrl);
for (i = 1; i < num_queues; i++)
- gem_writel_queue_TBQP(macb, (ulong)macb->gem_q1_descs, i - 1);
+ gem_writel_queue_TBQP(macb, macb->gem_q1_descs_phys, i - 1);
return 0;
}
@@ -388,7 +389,7 @@ static int macb_init(struct macb_device *macb)
return -EFAULT;
/* initialize DMA descriptors */
- paddr = (ulong)macb->rx_buffer;
+ paddr = macb->rx_buffer_phys;
for (i = 0; i < macb->rx_ring_size; i++) {
writel(paddr, &macb->rx_ring[i].addr);
writel(0, &macb->rx_ring[i].ctrl);
@@ -406,8 +407,8 @@ static int macb_init(struct macb_device *macb)
macb_configure_dma(macb);
- macb_writel(macb, RBQP, (ulong)macb->rx_ring);
- macb_writel(macb, TBQP, (ulong)macb->tx_ring);
+ macb_writel(macb, RBQP, macb->rx_ring_phys);
+ macb_writel(macb, TBQP, macb->tx_ring_phys);
if (macb->is_gem && macb->gem_q1_descs) {
gmac_init_dummy_tx_queues(macb);
@@ -903,8 +904,8 @@ static int macb_probe(struct device *dev)
macb->tx_ring = dma_alloc_coherent(TX_RING_BYTES, &macb->tx_ring_phys);
if (macb->is_gem)
- macb->gem_q1_descs = dma_alloc_coherent(GEM_Q1_DESC_BYTES,
- DMA_ADDRESS_BROKEN);
+ macb->gem_q1_descs = dma_alloc_coherent(
+ GEM_Q1_DESC_BYTES, &macb->gem_q1_descs_phys);
macb->rx_packet_buf = net_alloc_packet();
--
2.39.5
next prev parent reply other threads:[~2024-10-14 13:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-14 12:58 [PATCH 0/6] dma: give dma_alloc_coherent a device parameter Ahmad Fatoum
2024-10-14 12:58 ` [PATCH 1/6] dma: make DMA_ADDRESS_BROKEN type-safe Ahmad Fatoum
2024-10-14 12:58 ` [PATCH 2/6] video: stm: use DMA_ADDRESS_BROKEN instead of NULL Ahmad Fatoum
2024-10-14 12:58 ` [PATCH 3/6] crypto: caam - pbl-init: " Ahmad Fatoum
2024-10-14 12:58 ` [PATCH 4/6] net: designware: don't use dma_mapping_error for non-streaming DMA Ahmad Fatoum
2024-10-14 12:58 ` Ahmad Fatoum [this message]
2024-10-14 12:58 ` [PATCH 6/6] dma: give dma_alloc_coherent a device parameter Ahmad Fatoum
2024-10-15 7:41 ` [PATCH 0/6] " Sascha Hauer
2024-10-18 8:39 ` Sascha Hauer
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=20241014125843.2064532-6-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=denorl2009@gmail.com \
/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