aboutsummaryrefslogtreecommitdiffstats
path: root/arch/microblaze/kernel/dma.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/microblaze/kernel/dma.c')
-rw-r--r--arch/microblaze/kernel/dma.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index da68d00fd087..4633c36c1b32 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -13,23 +13,6 @@
13#include <linux/export.h> 13#include <linux/export.h>
14#include <linux/bug.h> 14#include <linux/bug.h>
15 15
16/*
17 * Generic direct DMA implementation
18 *
19 * This implementation supports a per-device offset that can be applied if
20 * the address at which memory is visible to devices is not 0. Platform code
21 * can set archdata.dma_data to an unsigned long holding the offset. By
22 * default the offset is PCI_DRAM_OFFSET.
23 */
24
25static unsigned long get_dma_direct_offset(struct device *dev)
26{
27 if (likely(dev))
28 return (unsigned long)dev->archdata.dma_data;
29
30 return PCI_DRAM_OFFSET; /* FIXME Not sure if is correct */
31}
32
33#define NOT_COHERENT_CACHE 16#define NOT_COHERENT_CACHE
34 17
35static void *dma_direct_alloc_coherent(struct device *dev, size_t size, 18static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
@@ -51,7 +34,7 @@ static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
51 return NULL; 34 return NULL;
52 ret = page_address(page); 35 ret = page_address(page);
53 memset(ret, 0, size); 36 memset(ret, 0, size);
54 *dma_handle = virt_to_phys(ret) + get_dma_direct_offset(dev); 37 *dma_handle = virt_to_phys(ret);
55 38
56 return ret; 39 return ret;
57#endif 40#endif
@@ -77,7 +60,7 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
77 60
78 /* FIXME this part of code is untested */ 61 /* FIXME this part of code is untested */
79 for_each_sg(sgl, sg, nents, i) { 62 for_each_sg(sgl, sg, nents, i) {
80 sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); 63 sg->dma_address = sg_phys(sg);
81 __dma_sync(page_to_phys(sg_page(sg)) + sg->offset, 64 __dma_sync(page_to_phys(sg_page(sg)) + sg->offset,
82 sg->length, direction); 65 sg->length, direction);
83 } 66 }
@@ -85,12 +68,6 @@ static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
85 return nents; 68 return nents;
86} 69}
87 70
88static void dma_direct_unmap_sg(struct device *dev, struct scatterlist *sg,
89 int nents, enum dma_data_direction direction,
90 struct dma_attrs *attrs)
91{
92}
93
94static int dma_direct_dma_supported(struct device *dev, u64 mask) 71static int dma_direct_dma_supported(struct device *dev, u64 mask)
95{ 72{
96 return 1; 73 return 1;
@@ -104,7 +81,7 @@ static inline dma_addr_t dma_direct_map_page(struct device *dev,
104 struct dma_attrs *attrs) 81 struct dma_attrs *attrs)
105{ 82{
106 __dma_sync(page_to_phys(page) + offset, size, direction); 83 __dma_sync(page_to_phys(page) + offset, size, direction);
107 return page_to_phys(page) + offset + get_dma_direct_offset(dev); 84 return page_to_phys(page) + offset;
108} 85}
109 86
110static inline void dma_direct_unmap_page(struct device *dev, 87static inline void dma_direct_unmap_page(struct device *dev,
@@ -181,7 +158,6 @@ struct dma_map_ops dma_direct_ops = {
181 .alloc = dma_direct_alloc_coherent, 158 .alloc = dma_direct_alloc_coherent,
182 .free = dma_direct_free_coherent, 159 .free = dma_direct_free_coherent,
183 .map_sg = dma_direct_map_sg, 160 .map_sg = dma_direct_map_sg,
184 .unmap_sg = dma_direct_unmap_sg,
185 .dma_supported = dma_direct_dma_supported, 161 .dma_supported = dma_direct_dma_supported,
186 .map_page = dma_direct_map_page, 162 .map_page = dma_direct_map_page,
187 .unmap_page = dma_direct_unmap_page, 163 .unmap_page = dma_direct_unmap_page,