aboutsummaryrefslogtreecommitdiffstats
path: root/arch/avr32
diff options
context:
space:
mode:
authorHaavard Skinnemoen <hskinnemoen@atmel.com>2007-03-20 09:41:13 -0400
committerHaavard Skinnemoen <hskinnemoen@atmel.com>2007-05-09 02:48:39 -0400
commita492dbb9e3d04db138f2841648d1904d38a5295d (patch)
tree6b2b433941c8a97c175b827796d47824831a7506 /arch/avr32
parente89b064a4fd18b9c57b7aecbe7101d782759cf81 (diff)
[AVR32] Implement dma_{alloc,free}_writecombine()
Implement dma_alloc_writecombine() and its dma_free_writecombine() counterpart. These will do basically the same thing as dma_alloc_coherent() except that the virtual mapping will allow write buffering, causing better performance for certain use cases like frame buffers. The same API is already available on ARM. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Diffstat (limited to 'arch/avr32')
-rw-r--r--arch/avr32/mm/dma-coherent.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/avr32/mm/dma-coherent.c b/arch/avr32/mm/dma-coherent.c
index b68d669f823d..099212d4567c 100644
--- a/arch/avr32/mm/dma-coherent.c
+++ b/arch/avr32/mm/dma-coherent.c
@@ -112,16 +112,21 @@ void dma_free_coherent(struct device *dev, size_t size,
112} 112}
113EXPORT_SYMBOL(dma_free_coherent); 113EXPORT_SYMBOL(dma_free_coherent);
114 114
115#if 0
116void *dma_alloc_writecombine(struct device *dev, size_t size, 115void *dma_alloc_writecombine(struct device *dev, size_t size,
117 dma_addr_t *handle, gfp_t gfp) 116 dma_addr_t *handle, gfp_t gfp)
118{ 117{
119 struct page *page; 118 struct page *page;
119 dma_addr_t phys;
120 120
121 page = __dma_alloc(dev, size, handle, gfp); 121 page = __dma_alloc(dev, size, handle, gfp);
122 if (!page)
123 return NULL;
124
125 phys = page_to_phys(page);
126 *handle = phys;
122 127
123 /* Now, map the page into P3 with write-combining turned on */ 128 /* Now, map the page into P3 with write-combining turned on */
124 return __ioremap(page_to_phys(page), size, _PAGE_BUFFER); 129 return __ioremap(phys, size, _PAGE_BUFFER);
125} 130}
126EXPORT_SYMBOL(dma_alloc_writecombine); 131EXPORT_SYMBOL(dma_alloc_writecombine);
127 132
@@ -132,8 +137,7 @@ void dma_free_writecombine(struct device *dev, size_t size,
132 137
133 iounmap(cpu_addr); 138 iounmap(cpu_addr);
134 139
135 page = bus_to_page(handle); 140 page = phys_to_page(handle);
136 __dma_free(dev, size, page, handle); 141 __dma_free(dev, size, page, handle);
137} 142}
138EXPORT_SYMBOL(dma_free_writecombine); 143EXPORT_SYMBOL(dma_free_writecombine);
139#endif