[PATCH 8/133] [Jaunty SRU] ARM.imx51 Freescale:ENGR00109683 fec cache flush functions are incorrect

Brad Figg brad.figg at canonical.com
Thu Jul 9 16:47:58 UTC 2009


1. dma_sync_single will be removed in 2.7.x kernel. And the
dma_sync_single_for_cpu's implementation is changed.
All the calling of dma_sync_single should be changed to
dma_sync_single_for_device.
2. dma_sync_single_for_device will indirectly call inner and outer cache
operation:
flush for DMA_TO_DEVICE, invalid for DMA_FROM_DEVICE. But to the buffer which
is not aligned with cache line, invalid operation will call clean&invlaid to
sure the data out of buffer will be drained to external memory. for recevie
packet, it is dirty by such operation. So we should move the invalid operationi
before the buffer is added into FEC rx buffer.
3. disable copy function because there are the too many unalignement trap in
interrupt context.

Note: This is not the exact patch that Freescale submitted. Some parts of
      that patch were already applied. This commit leaves the file in the
      state the original patch intended.

Signed-off-by: Sam Yang <r52096 at freescale.com>
Signed-off-by: Brad Figg <brad.figg at canonical.com>
---
 drivers/net/fec.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index b771624..06dd9a6 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1430,7 +1430,10 @@ static void __inline__ fec_localhw_setup(struct net_device *dev)
  */
 static void __inline__ fec_dcache_inv_range(void * start, void * end)
 {
-	dmac_inv_range(start, end);
+        dma_sync_single_for_device(NULL, (unsigned long)__pa(start),
+                                   (unsigned long)(end - start),
+                                   DMA_FROM_DEVICE);
+	
 	return ;
 }
 
@@ -1439,7 +1442,9 @@ static void __inline__ fec_dcache_inv_range(void * start, void * end)
  */
 static void __inline__ fec_dcache_flush_range(void * start, void * end)
 {
-	dmac_flush_range(start, end);
+        dma_sync_single_for_device(NULL, (unsigned long)__pa(start),
+                                   (unsigned long)(end - start), DMA_TO_DEVICE);
+
 	return ;
 }
 
-- 
1.6.0.4





More information about the kernel-team mailing list