X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=include%2Fasm-sh64%2Fdma-mapping.h;h=e661857f98dc8e83bf60bc181e35c4464b343a57;hb=61d08a9ea3d5fd680213aa7a15fcda69ce11987d;hp=c7c0f059cdc4ff57e464d6beccef50e384dd2b17;hpb=36dbe4d6bffb90fcb2663ac50af00a942412e246;p=deliverable%2Flinux.git diff --git a/include/asm-sh64/dma-mapping.h b/include/asm-sh64/dma-mapping.h index c7c0f059cdc4..e661857f98dc 100644 --- a/include/asm-sh64/dma-mapping.h +++ b/include/asm-sh64/dma-mapping.h @@ -42,7 +42,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size, static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction dir) { - dma_cache_wback_inv((unsigned long)vaddr, size); + unsigned long s = (unsigned long) vaddr & L1_CACHE_ALIGN_MASK; + unsigned long e = (vaddr + size) & L1_CACHE_ALIGN_MASK; + + for (; s <= e; s += L1_CACHE_BYTES) + asm volatile ("ocbp %0, 0" : : "r" (s)); } static inline dma_addr_t dma_map_single(struct device *dev, @@ -51,11 +55,11 @@ static inline dma_addr_t dma_map_single(struct device *dev, { #if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT) if (dev->bus == &pci_bus_type) - return virt_to_bus(ptr); + return virt_to_phys(ptr); #endif dma_cache_sync(dev, ptr, size, dir); - return virt_to_bus(ptr); + return virt_to_phys(ptr); } #define dma_unmap_single(dev, addr, size, dir) do { } while (0) @@ -98,7 +102,7 @@ static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle, if (dev->bus == &pci_bus_type) return; #endif - dma_cache_sync(dev, bus_to_virt(dma_handle), size, dir); + dma_cache_sync(dev, phys_to_virt(dma_handle), size, dir); } static inline void dma_sync_single_range(struct device *dev, @@ -110,7 +114,7 @@ static inline void dma_sync_single_range(struct device *dev, if (dev->bus == &pci_bus_type) return; #endif - dma_cache_sync(dev, bus_to_virt(dma_handle) + offset, size, dir); + dma_cache_sync(dev, phys_to_virt(dma_handle) + offset, size, dir); } static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, @@ -141,6 +145,24 @@ static inline void dma_sync_single_for_device(struct device *dev, dma_sync_single(dev, dma_handle, size, dir); } +static inline void dma_sync_single_range_for_cpu(struct device *dev, + dma_addr_t dma_handle, + unsigned long offset, + size_t size, + enum dma_data_direction direction) +{ + dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction); +} + +static inline void dma_sync_single_range_for_device(struct device *dev, + dma_addr_t dma_handle, + unsigned long offset, + size_t size, + enum dma_data_direction direction) +{ + dma_sync_single_for_device(dev, dma_handle+offset, size, direction); +} + static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir)