017-Add-cpu-dma-sync-function-for-coldfire-platform.patch 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From 04491155db32bc1a9c0b367a7cac0f4a9ea9c4d2 Mon Sep 17 00:00:00 2001
  2. From: Alison Wang <[email protected]>
  3. Date: Thu, 4 Aug 2011 09:59:43 +0800
  4. Subject: [PATCH 17/52] Add cpu dma sync function for coldfire platform
  5. This patch add dma_sync_sg_for_cpu() and dma_sync_single_for_cpu()
  6. for coldfire platform. The previous empty function do not flush the
  7. cache for the ram used for DMA.
  8. Signed-off-by: Alison Wang <[email protected]>
  9. ---
  10. arch/m68k/include/asm/dma-mapping.h | 10 ++++++++--
  11. 1 files changed, 8 insertions(+), 2 deletions(-)
  12. --- a/arch/m68k/include/asm/dma-mapping.h
  13. +++ b/arch/m68k/include/asm/dma-mapping.h
  14. @@ -21,6 +21,9 @@ extern void *dma_alloc_coherent(struct d
  15. extern void dma_free_coherent(struct device *, size_t,
  16. void *, dma_addr_t);
  17. +extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
  18. + enum dma_data_direction);
  19. +
  20. static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
  21. dma_addr_t *handle, gfp_t flag)
  22. {
  23. @@ -42,6 +45,7 @@ extern dma_addr_t dma_map_single(struct
  24. static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
  25. size_t size, enum dma_data_direction dir)
  26. {
  27. + dma_sync_single_for_device(dev, addr, size, dir);
  28. }
  29. extern dma_addr_t dma_map_page(struct device *, struct page *,
  30. @@ -50,6 +54,7 @@ extern dma_addr_t dma_map_page(struct de
  31. static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
  32. size_t size, enum dma_data_direction dir)
  33. {
  34. + dma_sync_single_for_device(dev, address, size, dir);
  35. }
  36. extern int dma_map_sg(struct device *, struct scatterlist *, int,
  37. @@ -57,10 +62,9 @@ extern int dma_map_sg(struct device *, s
  38. static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
  39. int nhwentries, enum dma_data_direction dir)
  40. {
  41. + dma_map_sg(dev, sg, nhwentries, dir);
  42. }
  43. -extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
  44. - enum dma_data_direction);
  45. extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
  46. enum dma_data_direction);
  47. @@ -75,11 +79,13 @@ static inline void dma_sync_single_range
  48. static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
  49. size_t size, enum dma_data_direction dir)
  50. {
  51. + dma_sync_single_for_device(dev, handle, size, dir);
  52. }
  53. static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
  54. int nents, enum dma_data_direction dir)
  55. {
  56. + dma_sync_sg_for_device(dev, sg, nents, dir);
  57. }
  58. static inline void dma_sync_single_range_for_cpu(struct device *dev,