From: Marek Vasut Date: Mon, 23 Mar 2020 01:11:46 +0000 (+0100) Subject: net: dwc_eth_qos: Prevent DMA from writing updated RX DMA descriptor X-Git-Tag: v2020.07-rc2~18^2~26 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=24891dd8d40d71c034023d2a037c97df1714393b;p=oweals%2Fu-boot.git net: dwc_eth_qos: Prevent DMA from writing updated RX DMA descriptor The DMA may attempt to write a DMA descriptor in the ring while it is being updated. By writing the DMA descriptor buffer address to 0, it is assured the DMA will not use such a buffer and the buffer can be updated without any interference. Reviewed-by: Patrick Delaunay Signed-off-by: Marek Vasut Cc: Joe Hershberger Cc: Patrice Chotard Cc: Patrick Delaunay Cc: Ramon Fried Cc: Stephen Warren --- diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index a195fe5c27..60dfd17a74 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -1477,8 +1477,10 @@ static int eqos_free_pkt(struct udevice *dev, uchar *packet, int length) rx_desc = &(eqos->rx_descs[eqos->rx_desc_idx]); + rx_desc->des0 = 0; + mb(); + eqos->config->ops->eqos_flush_desc(rx_desc); eqos->config->ops->eqos_inval_buffer(packet, length); - rx_desc->des0 = (u32)(ulong)packet; rx_desc->des1 = 0; rx_desc->des2 = 0;