Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

microblaze: Moved __dma_sync() to dma-mapping.h

__dma_sync_page() was replaced by __dma_sync(), and parameters of calls to
the new function were adjusted to match __dma_sync()'s format.

Signed-off-by: Eli Billauer <eli.billauer@gmail.com>
Signed-off-by: Michal Simek <monstr@monstr.eu>

authored by

Eli Billauer and committed by
Michal Simek
cf560c18 2309f7cf

+21 -21
+18 -2
arch/microblaze/include/asm/dma-mapping.h
··· 28 28 #include <linux/dma-attrs.h> 29 29 #include <asm/io.h> 30 30 #include <asm-generic/dma-coherent.h> 31 + #include <asm/cacheflush.h> 31 32 32 33 #define DMA_ERROR_CODE (~(dma_addr_t)0x0) 33 34 34 35 #define __dma_alloc_coherent(dev, gfp, size, handle) NULL 35 36 #define __dma_free_coherent(size, addr) ((void)0) 36 - #define __dma_sync(addr, size, rw) ((void)0) 37 37 38 38 static inline unsigned long device_to_mask(struct device *dev) 39 39 { ··· 95 95 96 96 #include <asm-generic/dma-mapping-common.h> 97 97 98 + static inline void __dma_sync(unsigned long paddr, 99 + size_t size, enum dma_data_direction direction) 100 + { 101 + switch (direction) { 102 + case DMA_TO_DEVICE: 103 + case DMA_BIDIRECTIONAL: 104 + flush_dcache_range(paddr, paddr + size); 105 + break; 106 + case DMA_FROM_DEVICE: 107 + invalidate_dcache_range(paddr, paddr + size); 108 + break; 109 + default: 110 + BUG(); 111 + } 112 + } 113 + 98 114 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) 99 115 { 100 116 struct dma_map_ops *ops = get_dma_ops(dev); ··· 151 135 enum dma_data_direction direction) 152 136 { 153 137 BUG_ON(direction == DMA_NONE); 154 - __dma_sync(vaddr, size, (int)direction); 138 + __dma_sync(virt_to_phys(vaddr), size, (int)direction); 155 139 } 156 140 157 141 #endif /* _ASM_MICROBLAZE_DMA_MAPPING_H */
+3 -19
arch/microblaze/kernel/dma.c
··· 11 11 #include <linux/gfp.h> 12 12 #include <linux/dma-debug.h> 13 13 #include <asm/bug.h> 14 - #include <asm/cacheflush.h> 15 14 16 15 /* 17 16 * Generic direct DMA implementation ··· 20 21 * can set archdata.dma_data to an unsigned long holding the offset. By 21 22 * default the offset is PCI_DRAM_OFFSET. 22 23 */ 23 - static inline void __dma_sync_page(unsigned long paddr, unsigned long offset, 24 - size_t size, enum dma_data_direction direction) 25 - { 26 - switch (direction) { 27 - case DMA_TO_DEVICE: 28 - case DMA_BIDIRECTIONAL: 29 - flush_dcache_range(paddr + offset, paddr + offset + size); 30 - break; 31 - case DMA_FROM_DEVICE: 32 - invalidate_dcache_range(paddr + offset, paddr + offset + size); 33 - break; 34 - default: 35 - BUG(); 36 - } 37 - } 38 24 39 25 static unsigned long get_dma_direct_offset(struct device *dev) 40 26 { ··· 75 91 /* FIXME this part of code is untested */ 76 92 for_each_sg(sgl, sg, nents, i) { 77 93 sg->dma_address = sg_phys(sg) + get_dma_direct_offset(dev); 78 - __dma_sync_page(page_to_phys(sg_page(sg)), sg->offset, 94 + __dma_sync(page_to_phys(sg_page(sg)) + sg->offset, 79 95 sg->length, direction); 80 96 } 81 97 ··· 100 116 enum dma_data_direction direction, 101 117 struct dma_attrs *attrs) 102 118 { 103 - __dma_sync_page(page_to_phys(page), offset, size, direction); 119 + __dma_sync(page_to_phys(page) + offset, size, direction); 104 120 return page_to_phys(page) + offset + get_dma_direct_offset(dev); 105 121 } 106 122 ··· 115 131 * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and 116 132 * dma_address is physical address 117 133 */ 118 - __dma_sync_page(dma_address, 0 , size, direction); 134 + __dma_sync(dma_address, size, direction); 119 135 } 120 136 121 137 struct dma_map_ops dma_direct_ops = {