Commit 01be5d63 authored by Paul Mundt's avatar Paul Mundt

sh: Revamp PCI DMA coherence Kconfig bits.

Leaving this configurable caused more trouble than it was ever worth, so
just make it explicit. Boards that are verified one way or the other can
fix up their selects accordingly. We presently default to non-coherent
for most platforms.
Signed-off-by: default avatarPaul Mundt <lethal@linux-sh.org>
parent 3f375f12
...@@ -169,6 +169,12 @@ config ARCH_HAS_CPU_IDLE_WAIT ...@@ -169,6 +169,12 @@ config ARCH_HAS_CPU_IDLE_WAIT
config IO_TRAPPED config IO_TRAPPED
bool bool
config DMA_COHERENT
bool
config DMA_NONCOHERENT
def_bool !DMA_COHERENT
source "init/Kconfig" source "init/Kconfig"
source "kernel/Kconfig.freezer" source "kernel/Kconfig.freezer"
...@@ -217,6 +223,7 @@ config CPU_SHX2 ...@@ -217,6 +223,7 @@ config CPU_SHX2
config CPU_SHX3 config CPU_SHX3
bool bool
select DMA_COHERENT
config ARCH_SHMOBILE config ARCH_SHMOBILE
bool bool
......
...@@ -5,15 +5,3 @@ config PCI ...@@ -5,15 +5,3 @@ config PCI
Find out whether you have a PCI motherboard. PCI is the name of a Find out whether you have a PCI motherboard. PCI is the name of a
bus system, i.e. the way the CPU talks to the other stuff inside bus system, i.e. the way the CPU talks to the other stuff inside
your box. If you have PCI, say Y, otherwise N. your box. If you have PCI, say Y, otherwise N.
config SH_PCIDMA_NONCOHERENT
bool "Cache and PCI noncoherent"
depends on PCI
default y
help
Enable this option if your platform does not have a CPU cache which
remains coherent with PCI DMA. It is safest to say 'Y', although you
will see better performance if you can say 'N', because the PCI DMA
code will not have to flush the CPU's caches. If you have a PCI host
bridge integrated with your SH CPU, refer carefully to the chip specs
to see if you can say 'N' here. Otherwise, leave it as 'Y'.
...@@ -57,19 +57,13 @@ static inline void pcibios_penalize_isa_irq(int irq, int active) ...@@ -57,19 +57,13 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
/* pci_unmap_{single,page} being a nop depends upon the /* pci_unmap_{single,page} being a nop depends upon the
* configuration. * configuration.
*/ */
#ifdef CONFIG_SH_PCIDMA_NONCOHERENT #ifdef CONFIG_DMA_NONCOHERENT
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
dma_addr_t ADDR_NAME; #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ #define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
__u32 LEN_NAME; #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
#define pci_unmap_addr(PTR, ADDR_NAME) \ #define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
((PTR)->ADDR_NAME) #define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
(((PTR)->ADDR_NAME) = (VAL))
#define pci_unmap_len(PTR, LEN_NAME) \
((PTR)->LEN_NAME)
#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
(((PTR)->LEN_NAME) = (VAL))
#else #else
#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) #define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
......
...@@ -44,6 +44,7 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg, ...@@ -44,6 +44,7 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
return nents; return nents;
} }
#ifdef CONFIG_DMA_NONCOHERENT
static void nommu_sync_single(struct device *dev, dma_addr_t addr, static void nommu_sync_single(struct device *dev, dma_addr_t addr,
size_t size, enum dma_data_direction dir) size_t size, enum dma_data_direction dir)
{ {
...@@ -59,14 +60,17 @@ static void nommu_sync_sg(struct device *dev, struct scatterlist *sg, ...@@ -59,14 +60,17 @@ static void nommu_sync_sg(struct device *dev, struct scatterlist *sg,
for_each_sg(sg, s, nelems, i) for_each_sg(sg, s, nelems, i)
dma_cache_sync(dev, sg_virt(s), s->length, dir); dma_cache_sync(dev, sg_virt(s), s->length, dir);
} }
#endif
struct dma_map_ops nommu_dma_ops = { struct dma_map_ops nommu_dma_ops = {
.alloc_coherent = dma_generic_alloc_coherent, .alloc_coherent = dma_generic_alloc_coherent,
.free_coherent = dma_generic_free_coherent, .free_coherent = dma_generic_free_coherent,
.map_page = nommu_map_page, .map_page = nommu_map_page,
.map_sg = nommu_map_sg, .map_sg = nommu_map_sg,
#ifdef CONFIG_DMA_NONCOHERENT
.sync_single_for_device = nommu_sync_single, .sync_single_for_device = nommu_sync_single,
.sync_sg_for_device = nommu_sync_sg, .sync_sg_for_device = nommu_sync_sg,
#endif
.is_phys = 1, .is_phys = 1,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment