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