ARC: dma: reintroduce platform specific dma<->phys
authorVineet Gupta <vgupta@synopsys.com>
Wed, 16 Mar 2016 11:08:57 +0000 (16:38 +0530)
committerVineet Gupta <vgupta@synopsys.com>
Sat, 19 Mar 2016 09:04:09 +0000 (14:34 +0530)
Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
arch/arc/Kconfig
arch/arc/include/asm/dma-mapping.h
arch/arc/mm/dma.c

index 8ce09280122131177d3907c961b7ce5a59480f44..5c086d5eae5b444ba83738e8d2ff19357684456d 100644 (file)
@@ -468,6 +468,9 @@ config ARCH_PHYS_ADDR_T_64BIT
 config ARCH_DMA_ADDR_T_64BIT
        bool
 
+config ARC_PLAT_NEEDS_PHYS_TO_DMA
+       bool
+
 config ARC_CURR_IN_REG
        bool "Dedicate Register r25 for current_task pointer"
        default y
index 660205414f1da1c199461ccc2c2eee46ecacd3b9..266f11c9bd593e58775d12a5dac214817da3110e 100644 (file)
 #ifndef ASM_ARC_DMA_MAPPING_H
 #define ASM_ARC_DMA_MAPPING_H
 
+#ifndef CONFIG_ARC_PLAT_NEEDS_PHYS_TO_DMA
+#define plat_dma_to_phys(dev, dma_handle) ((phys_addr_t)(dma_handle))
+#define plat_phys_to_dma(dev, paddr) ((dma_addr_t)(paddr))
+#else
+#include <plat/dma.h>
+#endif
+
 extern struct dma_map_ops arc_dma_ops;
 
 static inline struct dma_map_ops *get_dma_ops(struct device *dev)
index 608c143e9d382e7737b0e317c68fdba1048fbf54..8c8e36fa5659411c6705e46d538e7c506fc42c96 100644 (file)
@@ -60,8 +60,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
        /* This is linear addr (0x8000_0000 based) */
        paddr = page_to_phys(page);
 
-       /* For now bus address is exactly same as paddr */
-       *dma_handle = paddr;
+       *dma_handle = plat_phys_to_dma(dev, paddr);
 
        /* This is kernel Virtual address (0x7000_0000 based) */
        if (need_kvaddr) {
@@ -134,7 +133,7 @@ static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
 {
        phys_addr_t paddr = page_to_phys(page) + offset;
        _dma_cache_sync(paddr, size, dir);
-       return (dma_addr_t)paddr;
+       return plat_phys_to_dma(dev, paddr);
 }
 
 static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
@@ -153,13 +152,13 @@ static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
 static void arc_dma_sync_single_for_cpu(struct device *dev,
                dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
 {
-       _dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE);
+       _dma_cache_sync(plat_dma_to_phys(dev, dma_handle), size, DMA_FROM_DEVICE);
 }
 
 static void arc_dma_sync_single_for_device(struct device *dev,
                dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
 {
-       _dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
+       _dma_cache_sync(plat_dma_to_phys(dev, dma_handle), size, DMA_TO_DEVICE);
 }
 
 static void arc_dma_sync_sg_for_cpu(struct device *dev,
This page took 0.028043 seconds and 5 git commands to generate.