MIPS: bmips: use generic dma noncoherent ops
Provide phys_to_dma/dma_to_phys helpers, and the special arch_sync_dma_for_cpu_all hook, everything else is generic Signed-off-by: Christoph Hellwig <hch@lst.de> Patchwork: https://patchwork.linux-mips.org/patch/19550/ Signed-off-by: Paul Burton <paul.burton@mips.com> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: David Daney <david.daney@cavium.com> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Tom Bogendoerfer <tsbogend@alpha.franken.de> Cc: Huacai Chen <chenhc@lemote.com> Cc: iommu@lists.linux-foundation.org Cc: linux-mips@linux-mips.org
This commit is contained in:

committed by
Paul Burton

parent
faef87723a
commit
d59098a0e9
@@ -17,7 +17,7 @@
|
||||
#include <linux/printk.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/types.h>
|
||||
#include <dma-coherence.h>
|
||||
#include <asm/bmips.h>
|
||||
|
||||
/*
|
||||
* BCM338x has configurable address translation windows which allow the
|
||||
@@ -40,7 +40,7 @@ static struct bmips_dma_range *bmips_dma_ranges;
|
||||
|
||||
#define FLUSH_RAC 0x100
|
||||
|
||||
static dma_addr_t bmips_phys_to_dma(struct device *dev, phys_addr_t pa)
|
||||
dma_addr_t __phys_to_dma(struct device *dev, phys_addr_t pa)
|
||||
{
|
||||
struct bmips_dma_range *r;
|
||||
|
||||
@@ -52,17 +52,7 @@ static dma_addr_t bmips_phys_to_dma(struct device *dev, phys_addr_t pa)
|
||||
return pa;
|
||||
}
|
||||
|
||||
dma_addr_t plat_map_dma_mem(struct device *dev, void *addr, size_t size)
|
||||
{
|
||||
return bmips_phys_to_dma(dev, virt_to_phys(addr));
|
||||
}
|
||||
|
||||
dma_addr_t plat_map_dma_mem_page(struct device *dev, struct page *page)
|
||||
{
|
||||
return bmips_phys_to_dma(dev, page_to_phys(page));
|
||||
}
|
||||
|
||||
unsigned long plat_dma_addr_to_phys(struct device *dev, dma_addr_t dma_addr)
|
||||
phys_addr_t __dma_to_phys(struct device *dev, dma_addr_t dma_addr)
|
||||
{
|
||||
struct bmips_dma_range *r;
|
||||
|
||||
@@ -74,6 +64,22 @@ unsigned long plat_dma_addr_to_phys(struct device *dev, dma_addr_t dma_addr)
|
||||
return dma_addr;
|
||||
}
|
||||
|
||||
void arch_sync_dma_for_cpu_all(struct device *dev)
|
||||
{
|
||||
void __iomem *cbr = BMIPS_GET_CBR();
|
||||
u32 cfg;
|
||||
|
||||
if (boot_cpu_type() != CPU_BMIPS3300 &&
|
||||
boot_cpu_type() != CPU_BMIPS4350 &&
|
||||
boot_cpu_type() != CPU_BMIPS4380)
|
||||
return;
|
||||
|
||||
/* Flush stale data out of the readahead cache */
|
||||
cfg = __raw_readl(cbr + BMIPS_RAC_CONFIG);
|
||||
__raw_writel(cfg | 0x100, cbr + BMIPS_RAC_CONFIG);
|
||||
__raw_readl(cbr + BMIPS_RAC_CONFIG);
|
||||
}
|
||||
|
||||
static int __init bmips_init_dma_ranges(void)
|
||||
{
|
||||
struct device_node *np =
|
||||
|
Reference in New Issue
Block a user