[PATCH] MIPS: Rework BMIPS dma-coherence header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commits 0c8741360c6 ("MIPS: BMIPS: Create bmips-dma-coherence.h") and
6fb7566baa01 ("MIPS: BCM63xx: Utilize bmips-dma-coherence.h") have put a
tad too much into bmips-dma-coherence.h. mach-bmips overrides some of
the platform DMA operations to deal with a configurable translation
window address, whereas BCM63xx can use the default implementation from
asm/mach-generic/dma-coherence.c.

The only thing that is truly shareable by nature is the post DMA flush
hook, which is now renamed to bmips_post_dma_flush() and utilized by
both machines.

This fixes build failures on BCM63xx since we did not provide valid
plat_dma_* helper functions.

Fixes: 0c8741360c6 ("MIPS: BMIPS: Create bmips-dma-coherence.h")
Fixes: 6fb7566baa01 ("MIPS: BCM63xx: Utilize bmips-dma-coherence.h")
Reported-by: Guenter Roeck <linux@xxxxxxxxxxxx>
Signed-off-by: Florian Fainelli <f.fainelli@xxxxxxxxx>
---
Hi Ralf,

This applies on top of mips-for-linux-next, and fixes build failures
reported on linux-next.

Thanks!

 arch/mips/include/asm/bmips-dma-coherence.h        | 32 +--------------
 arch/mips/include/asm/mach-bcm63xx/dma-coherence.h | 45 ++++++++++++++++++++++
 arch/mips/include/asm/mach-bmips/dma-coherence.h   | 32 +++++++++++++++
 3 files changed, 78 insertions(+), 31 deletions(-)

diff --git a/arch/mips/include/asm/bmips-dma-coherence.h b/arch/mips/include/asm/bmips-dma-coherence.h
index bd4aac47b832..7ae0ea45fa70 100644
--- a/arch/mips/include/asm/bmips-dma-coherence.h
+++ b/arch/mips/include/asm/bmips-dma-coherence.h
@@ -19,37 +19,7 @@
 #include <asm/cpu-type.h>
 #include <asm/cpu.h>
 
-struct device;
-
-extern dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size);
-extern dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page);
-extern unsigned long plat_dma_addr_to_phys(struct device *dev,
-	dma_addr_t dma_addr);
-
-static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
-	size_t size, enum dma_data_direction direction)
-{
-}
-
-static inline int plat_dma_supported(struct device *dev, u64 mask)
-{
-	/*
-	 * we fall back to GFP_DMA when the mask isn't all 1s,
-	 * so we can't guarantee allocations that must be
-	 * within a tighter range than GFP_DMA..
-	 */
-	if (mask < DMA_BIT_MASK(24))
-		return 0;
-
-	return 1;
-}
-
-static inline int plat_device_is_coherent(struct device *dev)
-{
-	return 0;
-}
-
-static inline void plat_post_dma_flush(struct device *dev)
+static inline void bmips_post_dma_flush(struct device *dev)
 {
 	void __iomem *cbr = BMIPS_GET_CBR();
 	u32 cfg;
diff --git a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h b/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
index 932b2b38bbdf..8596525fcfd1 100644
--- a/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
+++ b/arch/mips/include/asm/mach-bcm63xx/dma-coherence.h
@@ -1,6 +1,51 @@
 #ifndef __ASM_MACH_BCM63XX_DMA_COHERENCE_H
 #define __ASM_MACH_BCM63XX_DMA_COHERENCE_H
 
+struct device;
+
+static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
+	size_t size)
+{
+	return virt_to_phys(addr);
+}
+
+static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
+	struct page *page)
+{
+	return page_to_phys(page);
+}
+
+static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
+	dma_addr_t dma_addr)
+{
+	return dma_addr;
+}
+
+static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
+	size_t size, enum dma_data_direction direction)
+{
+}
+
+static inline int plat_dma_supported(struct device *dev, u64 mask)
+{
+	/*
+	 * we fall back to GFP_DMA when the mask isn't all 1s,
+	 * so we can't guarantee allocations that must be
+	 * within a tighter range than GFP_DMA..
+	 */
+	if (mask < DMA_BIT_MASK(24))
+		return 0;
+
+	return 1;
+}
+
+static inline int plat_device_is_coherent(struct device *dev)
+{
+	return coherentio;
+}
+
 #include <asm/bmips-dma-coherence.h>
 
+#define plat_post_dma_flush	bmips_post_dma_flush
+
 #endif /* __ASM_MACH_BCM63XX_DMA_COHERENCE_H */
diff --git a/arch/mips/include/asm/mach-bmips/dma-coherence.h b/arch/mips/include/asm/mach-bmips/dma-coherence.h
index 4d88233a82fd..18b24064f469 100644
--- a/arch/mips/include/asm/mach-bmips/dma-coherence.h
+++ b/arch/mips/include/asm/mach-bmips/dma-coherence.h
@@ -3,4 +3,36 @@
 
 #include <asm/bmips-dma-coherence.h>
 
+struct device;
+
+extern dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size);
+extern dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page);
+extern unsigned long plat_dma_addr_to_phys(struct device *dev,
+	dma_addr_t dma_addr);
+
+static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
+	size_t size, enum dma_data_direction direction)
+{
+}
+
+static inline int plat_dma_supported(struct device *dev, u64 mask)
+{
+	/*
+	 * we fall back to GFP_DMA when the mask isn't all 1s,
+	 * so we can't guarantee allocations that must be
+	 * within a tighter range than GFP_DMA..
+	 */
+	if (mask < DMA_BIT_MASK(24))
+		return 0;
+
+	return 1;
+}
+
+static inline int plat_device_is_coherent(struct device *dev)
+{
+	return 0;
+}
+
+#define plat_post_dma_flush	bmips_post_dma_flush
+
 #endif /* __ASM_MACH_BMIPS_DMA_COHERENCE_H */
-- 
2.1.0






[Index of Archives]     [Linux MIPS Home]     [LKML Archive]     [Linux ARM Kernel]     [Linux ARM]     [Linux]     [Git]     [Yosemite News]     [Linux SCSI]     [Linux Hams]

  Powered by Linux