aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig7
-rw-r--r--arch/sh/drivers/pci/Kconfig12
-rw-r--r--arch/sh/include/asm/pci.h20
-rw-r--r--arch/sh/kernel/dma-nommu.c4
4 files changed, 18 insertions, 25 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 2d3a69993858..e5ee3b159e50 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -169,6 +169,12 @@ config ARCH_HAS_CPU_IDLE_WAIT
169config IO_TRAPPED 169config IO_TRAPPED
170 bool 170 bool
171 171
172config DMA_COHERENT
173 bool
174
175config DMA_NONCOHERENT
176 def_bool !DMA_COHERENT
177
172source "init/Kconfig" 178source "init/Kconfig"
173 179
174source "kernel/Kconfig.freezer" 180source "kernel/Kconfig.freezer"
@@ -217,6 +223,7 @@ config CPU_SHX2
217 223
218config CPU_SHX3 224config CPU_SHX3
219 bool 225 bool
226 select DMA_COHERENT
220 227
221config ARCH_SHMOBILE 228config ARCH_SHMOBILE
222 bool 229 bool
diff --git a/arch/sh/drivers/pci/Kconfig b/arch/sh/drivers/pci/Kconfig
index e8db585a6638..78a3ce1e6c4d 100644
--- a/arch/sh/drivers/pci/Kconfig
+++ b/arch/sh/drivers/pci/Kconfig
@@ -5,15 +5,3 @@ config PCI
5 Find out whether you have a PCI motherboard. PCI is the name of a 5 Find out whether you have a PCI motherboard. PCI is the name of a
6 bus system, i.e. the way the CPU talks to the other stuff inside 6 bus system, i.e. the way the CPU talks to the other stuff inside
7 your box. If you have PCI, say Y, otherwise N. 7 your box. If you have PCI, say Y, otherwise N.
8
9config SH_PCIDMA_NONCOHERENT
10 bool "Cache and PCI noncoherent"
11 depends on PCI
12 default y
13 help
14 Enable this option if your platform does not have a CPU cache which
15 remains coherent with PCI DMA. It is safest to say 'Y', although you
16 will see better performance if you can say 'N', because the PCI DMA
17 code will not have to flush the CPU's caches. If you have a PCI host
18 bridge integrated with your SH CPU, refer carefully to the chip specs
19 to see if you can say 'N' here. Otherwise, leave it as 'Y'.
diff --git a/arch/sh/include/asm/pci.h b/arch/sh/include/asm/pci.h
index 6bf276b4f85d..67f3999b544e 100644
--- a/arch/sh/include/asm/pci.h
+++ b/arch/sh/include/asm/pci.h
@@ -57,19 +57,13 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
57/* pci_unmap_{single,page} being a nop depends upon the 57/* pci_unmap_{single,page} being a nop depends upon the
58 * configuration. 58 * configuration.
59 */ 59 */
60#ifdef CONFIG_SH_PCIDMA_NONCOHERENT 60#ifdef CONFIG_DMA_NONCOHERENT
61#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 61#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) dma_addr_t ADDR_NAME;
62 dma_addr_t ADDR_NAME; 62#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) __u32 LEN_NAME;
63#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ 63#define pci_unmap_addr(PTR, ADDR_NAME) ((PTR)->ADDR_NAME)
64 __u32 LEN_NAME; 64#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) (((PTR)->ADDR_NAME) = (VAL))
65#define pci_unmap_addr(PTR, ADDR_NAME) \ 65#define pci_unmap_len(PTR, LEN_NAME) ((PTR)->LEN_NAME)
66 ((PTR)->ADDR_NAME) 66#define pci_unmap_len_set(PTR, LEN_NAME, VAL) (((PTR)->LEN_NAME) = (VAL))
67#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
68 (((PTR)->ADDR_NAME) = (VAL))
69#define pci_unmap_len(PTR, LEN_NAME) \
70 ((PTR)->LEN_NAME)
71#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
72 (((PTR)->LEN_NAME) = (VAL))
73#else 67#else
74#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 68#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
75#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) 69#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index b336fcf40f12..3c55b87f8b63 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -44,6 +44,7 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
44 return nents; 44 return nents;
45} 45}
46 46
47#ifdef CONFIG_DMA_NONCOHERENT
47static void nommu_sync_single(struct device *dev, dma_addr_t addr, 48static void nommu_sync_single(struct device *dev, dma_addr_t addr,
48 size_t size, enum dma_data_direction dir) 49 size_t size, enum dma_data_direction dir)
49{ 50{
@@ -59,14 +60,17 @@ static void nommu_sync_sg(struct device *dev, struct scatterlist *sg,
59 for_each_sg(sg, s, nelems, i) 60 for_each_sg(sg, s, nelems, i)
60 dma_cache_sync(dev, sg_virt(s), s->length, dir); 61 dma_cache_sync(dev, sg_virt(s), s->length, dir);
61} 62}
63#endif
62 64
63struct dma_map_ops nommu_dma_ops = { 65struct dma_map_ops nommu_dma_ops = {
64 .alloc_coherent = dma_generic_alloc_coherent, 66 .alloc_coherent = dma_generic_alloc_coherent,
65 .free_coherent = dma_generic_free_coherent, 67 .free_coherent = dma_generic_free_coherent,
66 .map_page = nommu_map_page, 68 .map_page = nommu_map_page,
67 .map_sg = nommu_map_sg, 69 .map_sg = nommu_map_sg,
70#ifdef CONFIG_DMA_NONCOHERENT
68 .sync_single_for_device = nommu_sync_single, 71 .sync_single_for_device = nommu_sync_single,
69 .sync_sg_for_device = nommu_sync_sg, 72 .sync_sg_for_device = nommu_sync_sg,
73#endif
70 .is_phys = 1, 74 .is_phys = 1,
71}; 75};
72 76