* [PATCH] net: designware: eqos: keep virtual RX buffer address around
@ 2026-08-06 13:00 Sascha Hauer
0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2026-08-06 13:00 UTC (permalink / raw)
To: Barebox List
To free up the RX buffers in the remove and error paths we need their
virtual address. Instead of reading back the physical address back from
the descriptor ring and throwing phys_to_virt() at it, just keep the
virtual address returned from dma_alloc() around and use that directly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
drivers/net/designware_eqos.c | 6 ++++--
drivers/net/designware_eqos.h | 1 +
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index a6e9d8677f..78e52c68b1 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -817,6 +817,8 @@ static int eqos_init_resources(struct eqos *eqos)
if (!p)
goto err_free_desc;
+ eqos->rx_bufs = p;
+
for (i = 0; i < EQOS_DESCRIPTORS_RX; i++) {
struct eqos_desc *rx_rf_desc = &eqos->rx_descs[i];
dma_addr_t dma;
@@ -836,7 +838,7 @@ static int eqos_init_resources(struct eqos *eqos)
return 0;
err_free_rx_bufs:
- dma_free(phys_to_virt(eqos->rx_descs[0].des0));
+ dma_free(eqos->rx_bufs);
err_free_desc:
dma_free_coherent(DMA_DEVICE_BROKEN,
descs, 0, EQOS_DESCRIPTORS_SIZE);
@@ -948,7 +950,7 @@ void eqos_remove(struct device *dev)
mdiobus_unregister(&eqos->miibus);
- dma_free(phys_to_virt(eqos->rx_descs[0].des0));
+ dma_free(eqos->rx_bufs);
dma_free_coherent(DMA_DEVICE_BROKEN,
eqos->tx_descs, 0, EQOS_DESCRIPTORS_SIZE);
}
diff --git a/drivers/net/designware_eqos.h b/drivers/net/designware_eqos.h
index 9f2fc2fe6d..96b6fa71c8 100644
--- a/drivers/net/designware_eqos.h
+++ b/drivers/net/designware_eqos.h
@@ -54,6 +54,7 @@ struct eqos {
struct eqos_desc *tx_descs, *rx_descs;
dma_addr_t dma_rx_buf[EQOS_DESCRIPTORS_RX];
+ void *rx_bufs;
void __iomem *regs;
struct eqos_mac_regs __iomem *mac_regs;
--
2.47.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-08-06 13:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-06 13:00 [PATCH] net: designware: eqos: keep virtual RX buffer address around Sascha Hauer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox