Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ccdc4f19 authored by Sascha Hauer's avatar Sascha Hauer Committed by David S. Miller
Browse files

fec: replace flush_dcache_range with dma_sync_single



flush_dcache_range is not portable across architectures. Use
dma_sync_single instead. Also, the memory must be synchronised in the
receive path aswell.

Signed-off-by: default avatarSascha Hauer <s.hauer@pengutronix.de>
Acked-by: default avatarGreg Ungerer <gerg@uclinux.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 43268dce
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -356,8 +356,8 @@ fec_enet_start_xmit(struct sk_buff *skb, struct net_device *dev)
	/* Push the data cache so the CPM does not get stale memory
	/* Push the data cache so the CPM does not get stale memory
	 * data.
	 * data.
	 */
	 */
	flush_dcache_range((unsigned long)skb->data,
	dma_sync_single(NULL, bdp->cbd_bufaddr,
			   (unsigned long)skb->data + skb->len);
			bdp->cbd_datlen, DMA_TO_DEVICE);


	/* Send it on its way.  Tell FEC it's ready, interrupt when done,
	/* Send it on its way.  Tell FEC it's ready, interrupt when done,
	 * it's the last BD of the frame, and to put the CRC on the end.
	 * it's the last BD of the frame, and to put the CRC on the end.
@@ -630,6 +630,9 @@ while (!((status = bdp->cbd_sc) & BD_ENET_RX_EMPTY)) {
	dev->stats.rx_bytes += pkt_len;
	dev->stats.rx_bytes += pkt_len;
	data = (__u8*)__va(bdp->cbd_bufaddr);
	data = (__u8*)__va(bdp->cbd_bufaddr);


	dma_sync_single(NULL, (unsigned long)__pa(data),
			pkt_len - 4, DMA_FROM_DEVICE);

	/* This does 16 byte alignment, exactly what we need.
	/* This does 16 byte alignment, exactly what we need.
	 * The packet length includes FCS, but we don't want to
	 * The packet length includes FCS, but we don't want to
	 * include that when passing upstream as it messes up
	 * include that when passing upstream as it messes up