diff options
author | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-08-23 05:54:45 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2011-08-23 05:54:45 -0400 |
commit | 0cd21ebcc51e6d2500e303446f68d86a6f473ccb (patch) | |
tree | a8318a34fbbb373403239b12e4ac921ab375e9a9 /arch/arm | |
parent | fcb8ce5cfe30ca9ca5c9a79cdfe26d1993e65e0c (diff) | |
parent | 97fef8bda9f32a2b1919501122d6bd6871af06dc (diff) |
Merge branch 'dma-size' of git://git.yxit.co.uk/linux into devel-stable
Diffstat (limited to 'arch/arm')
30 files changed, 86 insertions, 82 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 7a21d0bf7134..7f27fab9d404 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -205,6 +205,13 @@ extern void *dma_alloc_writecombine(struct device *, size_t, dma_addr_t *, | |||
205 | int dma_mmap_writecombine(struct device *, struct vm_area_struct *, | 205 | int dma_mmap_writecombine(struct device *, struct vm_area_struct *, |
206 | void *, dma_addr_t, size_t); | 206 | void *, dma_addr_t, size_t); |
207 | 207 | ||
208 | /* | ||
209 | * This can be called during boot to increase the size of the consistent | ||
210 | * DMA region above it's default value of 2MB. It must be called before the | ||
211 | * memory allocator is initialised, i.e. before any core_initcall. | ||
212 | */ | ||
213 | extern void __init init_consistent_dma_size(unsigned long size); | ||
214 | |||
208 | 215 | ||
209 | #ifdef CONFIG_DMABOUNCE | 216 | #ifdef CONFIG_DMABOUNCE |
210 | /* | 217 | /* |
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index b8de516e600e..652fccca4952 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h | |||
@@ -77,16 +77,7 @@ | |||
77 | */ | 77 | */ |
78 | #define IOREMAP_MAX_ORDER 24 | 78 | #define IOREMAP_MAX_ORDER 24 |
79 | 79 | ||
80 | /* | ||
81 | * Size of DMA-consistent memory region. Must be multiple of 2M, | ||
82 | * between 2MB and 14MB inclusive. | ||
83 | */ | ||
84 | #ifndef CONSISTENT_DMA_SIZE | ||
85 | #define CONSISTENT_DMA_SIZE SZ_2M | ||
86 | #endif | ||
87 | |||
88 | #define CONSISTENT_END (0xffe00000UL) | 80 | #define CONSISTENT_END (0xffe00000UL) |
89 | #define CONSISTENT_BASE (CONSISTENT_END - CONSISTENT_DMA_SIZE) | ||
90 | 81 | ||
91 | #else /* CONFIG_MMU */ | 82 | #else /* CONFIG_MMU */ |
92 | 83 | ||
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index e04c5fb6f1ee..1532b508c814 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -12,6 +12,7 @@ | |||
12 | 12 | ||
13 | #include <linux/module.h> | 13 | #include <linux/module.h> |
14 | #include <linux/pm.h> | 14 | #include <linux/pm.h> |
15 | #include <linux/dma-mapping.h> | ||
15 | 16 | ||
16 | #include <asm/irq.h> | 17 | #include <asm/irq.h> |
17 | #include <asm/mach/arch.h> | 18 | #include <asm/mach/arch.h> |
@@ -319,6 +320,7 @@ static void at91sam9g45_poweroff(void) | |||
319 | static void __init at91sam9g45_map_io(void) | 320 | static void __init at91sam9g45_map_io(void) |
320 | { | 321 | { |
321 | at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE); | 322 | at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE); |
323 | init_consistent_dma_size(SZ_4M); | ||
322 | } | 324 | } |
323 | 325 | ||
324 | static void __init at91sam9g45_initialize(void) | 326 | static void __init at91sam9g45_initialize(void) |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h index 2c611b9a0138..406bb6496805 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h | |||
@@ -128,8 +128,6 @@ | |||
128 | #define AT91SAM9G45_EHCI_BASE 0x00800000 /* USB Host controller (EHCI) */ | 128 | #define AT91SAM9G45_EHCI_BASE 0x00800000 /* USB Host controller (EHCI) */ |
129 | #define AT91SAM9G45_VDEC_BASE 0x00900000 /* Video Decoder Controller */ | 129 | #define AT91SAM9G45_VDEC_BASE 0x00900000 /* Video Decoder Controller */ |
130 | 130 | ||
131 | #define CONSISTENT_DMA_SIZE SZ_4M | ||
132 | |||
133 | /* | 131 | /* |
134 | * DMA peripheral identifiers | 132 | * DMA peripheral identifiers |
135 | * for hardware handshaking interface | 133 | * for hardware handshaking interface |
diff --git a/arch/arm/mach-bcmring/include/mach/memory.h b/arch/arm/mach-bcmring/include/mach/memory.h index 15162e4c75f9..8848a5bb3445 100644 --- a/arch/arm/mach-bcmring/include/mach/memory.h +++ b/arch/arm/mach-bcmring/include/mach/memory.h | |||
@@ -25,9 +25,4 @@ | |||
25 | 25 | ||
26 | #define PLAT_PHYS_OFFSET CFG_GLOBAL_RAM_BASE | 26 | #define PLAT_PHYS_OFFSET CFG_GLOBAL_RAM_BASE |
27 | 27 | ||
28 | /* | ||
29 | * Maximum DMA memory allowed is 14M | ||
30 | */ | ||
31 | #define CONSISTENT_DMA_SIZE (SZ_16M - SZ_2M) | ||
32 | |||
33 | #endif | 28 | #endif |
diff --git a/arch/arm/mach-bcmring/mm.c b/arch/arm/mach-bcmring/mm.c index 0f1c37e4523a..8616876abb9f 100644 --- a/arch/arm/mach-bcmring/mm.c +++ b/arch/arm/mach-bcmring/mm.c | |||
@@ -13,6 +13,7 @@ | |||
13 | *****************************************************************************/ | 13 | *****************************************************************************/ |
14 | 14 | ||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/dma-mapping.h> | ||
16 | #include <asm/mach/map.h> | 17 | #include <asm/mach/map.h> |
17 | 18 | ||
18 | #include <mach/hardware.h> | 19 | #include <mach/hardware.h> |
@@ -53,4 +54,6 @@ void __init bcmring_map_io(void) | |||
53 | { | 54 | { |
54 | 55 | ||
55 | iotable_init(bcmring_io_desc, ARRAY_SIZE(bcmring_io_desc)); | 56 | iotable_init(bcmring_io_desc, ARRAY_SIZE(bcmring_io_desc)); |
57 | /* Maximum DMA memory allowed is 14M */ | ||
58 | init_consistent_dma_size(14 << 20); | ||
56 | } | 59 | } |
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c index 1d2557394235..865ffe5899ac 100644 --- a/arch/arm/mach-davinci/common.c +++ b/arch/arm/mach-davinci/common.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/io.h> | 12 | #include <linux/io.h> |
13 | #include <linux/etherdevice.h> | 13 | #include <linux/etherdevice.h> |
14 | #include <linux/davinci_emac.h> | 14 | #include <linux/davinci_emac.h> |
15 | #include <linux/dma-mapping.h> | ||
15 | 16 | ||
16 | #include <asm/tlb.h> | 17 | #include <asm/tlb.h> |
17 | #include <asm/mach/map.h> | 18 | #include <asm/mach/map.h> |
@@ -86,6 +87,8 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info) | |||
86 | iotable_init(davinci_soc_info.io_desc, | 87 | iotable_init(davinci_soc_info.io_desc, |
87 | davinci_soc_info.io_desc_num); | 88 | davinci_soc_info.io_desc_num); |
88 | 89 | ||
90 | init_consistent_dma_size(14 << 20); | ||
91 | |||
89 | /* | 92 | /* |
90 | * Normally devicemaps_init() would flush caches and tlb after | 93 | * Normally devicemaps_init() would flush caches and tlb after |
91 | * mdesc->map_io(), but we must also do it here because of the CPU | 94 | * mdesc->map_io(), but we must also do it here because of the CPU |
diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h index 78731944a70c..885d23319668 100644 --- a/arch/arm/mach-davinci/include/mach/memory.h +++ b/arch/arm/mach-davinci/include/mach/memory.h | |||
@@ -36,9 +36,4 @@ | |||
36 | #define DDR2_MCLKSTOPEN_BIT BIT(30) | 36 | #define DDR2_MCLKSTOPEN_BIT BIT(30) |
37 | #define DDR2_LPMODEN_BIT BIT(31) | 37 | #define DDR2_LPMODEN_BIT BIT(31) |
38 | 38 | ||
39 | /* | ||
40 | * Increase size of DMA-consistent memory region | ||
41 | */ | ||
42 | #define CONSISTENT_DMA_SIZE (14<<20) | ||
43 | |||
44 | #endif /* __ASM_ARCH_MEMORY_H */ | 39 | #endif /* __ASM_ARCH_MEMORY_H */ |
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c index 870886a29594..1cfa1b6bb62b 100644 --- a/arch/arm/mach-omap1/io.c +++ b/arch/arm/mach-omap1/io.c | |||
@@ -121,6 +121,7 @@ void __init omap1_map_common_io(void) | |||
121 | #endif | 121 | #endif |
122 | 122 | ||
123 | omap_sram_init(); | 123 | omap_sram_init(); |
124 | omap_init_consistent_dma_size(); | ||
124 | } | 125 | } |
125 | 126 | ||
126 | /* | 127 | /* |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 2ce1ce6fb4db..d6d01cb7f28a 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
@@ -16,7 +16,6 @@ | |||
16 | * it under the terms of the GNU General Public License version 2 as | 16 | * it under the terms of the GNU General Public License version 2 as |
17 | * published by the Free Software Foundation. | 17 | * published by the Free Software Foundation. |
18 | */ | 18 | */ |
19 | |||
20 | #include <linux/module.h> | 19 | #include <linux/module.h> |
21 | #include <linux/kernel.h> | 20 | #include <linux/kernel.h> |
22 | #include <linux/init.h> | 21 | #include <linux/init.h> |
@@ -250,6 +249,7 @@ static void __init _omap2_map_common_io(void) | |||
250 | 249 | ||
251 | omap2_check_revision(); | 250 | omap2_check_revision(); |
252 | omap_sram_init(); | 251 | omap_sram_init(); |
252 | omap_init_consistent_dma_size(); | ||
253 | } | 253 | } |
254 | 254 | ||
255 | #ifdef CONFIG_SOC_OMAP2420 | 255 | #ifdef CONFIG_SOC_OMAP2420 |
diff --git a/arch/arm/mach-s3c64xx/cpu.c b/arch/arm/mach-s3c64xx/cpu.c index 374e45e566b8..8dc05763a7eb 100644 --- a/arch/arm/mach-s3c64xx/cpu.c +++ b/arch/arm/mach-s3c64xx/cpu.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/serial_core.h> | 20 | #include <linux/serial_core.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/io.h> | 22 | #include <linux/io.h> |
23 | #include <linux/dma-mapping.h> | ||
23 | 24 | ||
24 | #include <mach/hardware.h> | 25 | #include <mach/hardware.h> |
25 | #include <mach/map.h> | 26 | #include <mach/map.h> |
@@ -145,6 +146,7 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size) | |||
145 | /* initialise the io descriptors we need for initialisation */ | 146 | /* initialise the io descriptors we need for initialisation */ |
146 | iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc)); | 147 | iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc)); |
147 | iotable_init(mach_desc, size); | 148 | iotable_init(mach_desc, size); |
149 | init_consistent_dma_size(SZ_8M); | ||
148 | 150 | ||
149 | idcode = __raw_readl(S3C_VA_SYS + 0x118); | 151 | idcode = __raw_readl(S3C_VA_SYS + 0x118); |
150 | if (!idcode) { | 152 | if (!idcode) { |
diff --git a/arch/arm/mach-s3c64xx/include/mach/memory.h b/arch/arm/mach-s3c64xx/include/mach/memory.h index 4760cdae1eb6..b704669f95ff 100644 --- a/arch/arm/mach-s3c64xx/include/mach/memory.h +++ b/arch/arm/mach-s3c64xx/include/mach/memory.h | |||
@@ -15,6 +15,4 @@ | |||
15 | 15 | ||
16 | #define PLAT_PHYS_OFFSET UL(0x50000000) | 16 | #define PLAT_PHYS_OFFSET UL(0x50000000) |
17 | 17 | ||
18 | #define CONSISTENT_DMA_SIZE SZ_8M | ||
19 | |||
20 | #endif | 18 | #endif |
diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c index a5c00952ea35..8a938542c54d 100644 --- a/arch/arm/mach-s5p64x0/cpu.c +++ b/arch/arm/mach-s5p64x0/cpu.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/serial_core.h> | 20 | #include <linux/serial_core.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/dma-mapping.h> | ||
23 | 24 | ||
24 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
@@ -111,6 +112,7 @@ void __init s5p6440_map_io(void) | |||
111 | 112 | ||
112 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | 113 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); |
113 | iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); | 114 | iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc)); |
115 | init_consistent_dma_size(SZ_8M); | ||
114 | } | 116 | } |
115 | 117 | ||
116 | void __init s5p6450_map_io(void) | 118 | void __init s5p6450_map_io(void) |
@@ -120,6 +122,7 @@ void __init s5p6450_map_io(void) | |||
120 | 122 | ||
121 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); | 123 | iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc)); |
122 | iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); | 124 | iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc)); |
125 | init_consistent_dma_size(SZ_8M); | ||
123 | } | 126 | } |
124 | 127 | ||
125 | /* | 128 | /* |
diff --git a/arch/arm/mach-s5p64x0/include/mach/memory.h b/arch/arm/mach-s5p64x0/include/mach/memory.h index 365a6eb4b88f..b14cbc3f521b 100644 --- a/arch/arm/mach-s5p64x0/include/mach/memory.h +++ b/arch/arm/mach-s5p64x0/include/mach/memory.h | |||
@@ -14,6 +14,5 @@ | |||
14 | #define __ASM_ARCH_MEMORY_H __FILE__ | 14 | #define __ASM_ARCH_MEMORY_H __FILE__ |
15 | 15 | ||
16 | #define PLAT_PHYS_OFFSET UL(0x20000000) | 16 | #define PLAT_PHYS_OFFSET UL(0x20000000) |
17 | #define CONSISTENT_DMA_SIZE SZ_8M | ||
18 | 17 | ||
19 | #endif /* __ASM_ARCH_MEMORY_H */ | 18 | #endif /* __ASM_ARCH_MEMORY_H */ |
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c index 79907ec78d43..91145720822c 100644 --- a/arch/arm/mach-s5pv210/cpu.c +++ b/arch/arm/mach-s5pv210/cpu.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/sysdev.h> | 20 | #include <linux/sysdev.h> |
21 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
22 | #include <linux/sched.h> | 22 | #include <linux/sched.h> |
23 | #include <linux/dma-mapping.h> | ||
23 | 24 | ||
24 | #include <asm/mach/arch.h> | 25 | #include <asm/mach/arch.h> |
25 | #include <asm/mach/map.h> | 26 | #include <asm/mach/map.h> |
@@ -119,6 +120,7 @@ static void s5pv210_sw_reset(void) | |||
119 | void __init s5pv210_map_io(void) | 120 | void __init s5pv210_map_io(void) |
120 | { | 121 | { |
121 | iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc)); | 122 | iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc)); |
123 | init_consistent_dma_size(14 << 20); | ||
122 | 124 | ||
123 | /* initialise device information early */ | 125 | /* initialise device information early */ |
124 | s5pv210_default_sdhci0(); | 126 | s5pv210_default_sdhci0(); |
diff --git a/arch/arm/mach-s5pv210/include/mach/memory.h b/arch/arm/mach-s5pv210/include/mach/memory.h index 7b5fcf0da0c4..2d3cfa221d5f 100644 --- a/arch/arm/mach-s5pv210/include/mach/memory.h +++ b/arch/arm/mach-s5pv210/include/mach/memory.h | |||
@@ -14,7 +14,6 @@ | |||
14 | #define __ASM_ARCH_MEMORY_H | 14 | #define __ASM_ARCH_MEMORY_H |
15 | 15 | ||
16 | #define PLAT_PHYS_OFFSET UL(0x20000000) | 16 | #define PLAT_PHYS_OFFSET UL(0x20000000) |
17 | #define CONSISTENT_DMA_SIZE (SZ_8M + SZ_4M + SZ_2M) | ||
18 | 17 | ||
19 | /* | 18 | /* |
20 | * Sparsemem support | 19 | * Sparsemem support |
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c index ce5c2513c6ce..167a67c5ca54 100644 --- a/arch/arm/mach-shmobile/board-ag5evm.c +++ b/arch/arm/mach-shmobile/board-ag5evm.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/mmc/sh_mobile_sdhi.h> | 37 | #include <linux/mmc/sh_mobile_sdhi.h> |
38 | #include <linux/mfd/tmio.h> | 38 | #include <linux/mfd/tmio.h> |
39 | #include <linux/sh_clk.h> | 39 | #include <linux/sh_clk.h> |
40 | #include <linux/dma-mapping.h> | ||
40 | #include <video/sh_mobile_lcdc.h> | 41 | #include <video/sh_mobile_lcdc.h> |
41 | #include <video/sh_mipi_dsi.h> | 42 | #include <video/sh_mipi_dsi.h> |
42 | #include <sound/sh_fsi.h> | 43 | #include <sound/sh_fsi.h> |
@@ -446,6 +447,8 @@ static struct map_desc ag5evm_io_desc[] __initdata = { | |||
446 | static void __init ag5evm_map_io(void) | 447 | static void __init ag5evm_map_io(void) |
447 | { | 448 | { |
448 | iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc)); | 449 | iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc)); |
450 | /* DMA memory at 0xf6000000 - 0xffdfffff */ | ||
451 | init_consistent_dma_size(158 << 20); | ||
449 | 452 | ||
450 | /* setup early devices and console here as well */ | 453 | /* setup early devices and console here as well */ |
451 | sh73a0_add_early_devices(); | 454 | sh73a0_add_early_devices(); |
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 9e0856b2f9e9..ec8f9d960e27 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/leds.h> | 42 | #include <linux/leds.h> |
43 | #include <linux/input/sh_keysc.h> | 43 | #include <linux/input/sh_keysc.h> |
44 | #include <linux/usb/r8a66597.h> | 44 | #include <linux/usb/r8a66597.h> |
45 | #include <linux/dma-mapping.h> | ||
45 | 46 | ||
46 | #include <media/sh_mobile_ceu.h> | 47 | #include <media/sh_mobile_ceu.h> |
47 | #include <media/sh_mobile_csi2.h> | 48 | #include <media/sh_mobile_csi2.h> |
@@ -1170,6 +1171,8 @@ static struct map_desc ap4evb_io_desc[] __initdata = { | |||
1170 | static void __init ap4evb_map_io(void) | 1171 | static void __init ap4evb_map_io(void) |
1171 | { | 1172 | { |
1172 | iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc)); | 1173 | iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc)); |
1174 | /* DMA memory at 0xf6000000 - 0xffdfffff */ | ||
1175 | init_consistent_dma_size(158 << 20); | ||
1173 | 1176 | ||
1174 | /* setup early devices and console here as well */ | 1177 | /* setup early devices and console here as well */ |
1175 | sh7372_add_early_devices(); | 1178 | sh7372_add_early_devices(); |
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c index ef4613b993a2..8b620bf06221 100644 --- a/arch/arm/mach-shmobile/board-g3evm.c +++ b/arch/arm/mach-shmobile/board-g3evm.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/gpio.h> | 32 | #include <linux/gpio.h> |
33 | #include <linux/input.h> | 33 | #include <linux/input.h> |
34 | #include <linux/input/sh_keysc.h> | 34 | #include <linux/input/sh_keysc.h> |
35 | #include <linux/dma-mapping.h> | ||
35 | #include <mach/sh7367.h> | 36 | #include <mach/sh7367.h> |
36 | #include <mach/common.h> | 37 | #include <mach/common.h> |
37 | #include <asm/mach-types.h> | 38 | #include <asm/mach-types.h> |
@@ -260,6 +261,8 @@ static struct map_desc g3evm_io_desc[] __initdata = { | |||
260 | static void __init g3evm_map_io(void) | 261 | static void __init g3evm_map_io(void) |
261 | { | 262 | { |
262 | iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc)); | 263 | iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc)); |
264 | /* DMA memory at 0xf6000000 - 0xffdfffff */ | ||
265 | init_consistent_dma_size(158 << 20); | ||
263 | 266 | ||
264 | /* setup early devices and console here as well */ | 267 | /* setup early devices and console here as well */ |
265 | sh7367_add_early_devices(); | 268 | sh7367_add_early_devices(); |
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c index 8e3c5559f27f..7719ddc5f591 100644 --- a/arch/arm/mach-shmobile/board-g4evm.c +++ b/arch/arm/mach-shmobile/board-g4evm.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/mmc/host.h> | 33 | #include <linux/mmc/host.h> |
34 | #include <linux/mmc/sh_mobile_sdhi.h> | 34 | #include <linux/mmc/sh_mobile_sdhi.h> |
35 | #include <linux/gpio.h> | 35 | #include <linux/gpio.h> |
36 | #include <linux/dma-mapping.h> | ||
36 | #include <mach/sh7377.h> | 37 | #include <mach/sh7377.h> |
37 | #include <mach/common.h> | 38 | #include <mach/common.h> |
38 | #include <asm/mach-types.h> | 39 | #include <asm/mach-types.h> |
@@ -274,6 +275,8 @@ static struct map_desc g4evm_io_desc[] __initdata = { | |||
274 | static void __init g4evm_map_io(void) | 275 | static void __init g4evm_map_io(void) |
275 | { | 276 | { |
276 | iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc)); | 277 | iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc)); |
278 | /* DMA memory at 0xf6000000 - 0xffdfffff */ | ||
279 | init_consistent_dma_size(158 << 20); | ||
277 | 280 | ||
278 | /* setup early devices and console here as well */ | 281 | /* setup early devices and console here as well */ |
279 | sh7377_add_early_devices(); | 282 | sh7377_add_early_devices(); |
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index d41c01f83f15..671925dcf5f9 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <linux/tca6416_keypad.h> | 45 | #include <linux/tca6416_keypad.h> |
46 | #include <linux/usb/r8a66597.h> | 46 | #include <linux/usb/r8a66597.h> |
47 | #include <linux/usb/renesas_usbhs.h> | 47 | #include <linux/usb/renesas_usbhs.h> |
48 | #include <linux/dma-mapping.h> | ||
48 | 49 | ||
49 | #include <video/sh_mobile_hdmi.h> | 50 | #include <video/sh_mobile_hdmi.h> |
50 | #include <video/sh_mobile_lcdc.h> | 51 | #include <video/sh_mobile_lcdc.h> |
@@ -1377,6 +1378,8 @@ static struct map_desc mackerel_io_desc[] __initdata = { | |||
1377 | static void __init mackerel_map_io(void) | 1378 | static void __init mackerel_map_io(void) |
1378 | { | 1379 | { |
1379 | iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc)); | 1380 | iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc)); |
1381 | /* DMA memory at 0xf6000000 - 0xffdfffff */ | ||
1382 | init_consistent_dma_size(158 << 20); | ||
1380 | 1383 | ||
1381 | /* setup early devices and console here as well */ | 1384 | /* setup early devices and console here as well */ |
1382 | sh7372_add_early_devices(); | 1385 | sh7372_add_early_devices(); |
diff --git a/arch/arm/mach-shmobile/include/mach/memory.h b/arch/arm/mach-shmobile/include/mach/memory.h index ad00c3c258f4..0ffbe8155c76 100644 --- a/arch/arm/mach-shmobile/include/mach/memory.h +++ b/arch/arm/mach-shmobile/include/mach/memory.h | |||
@@ -4,7 +4,4 @@ | |||
4 | #define PLAT_PHYS_OFFSET UL(CONFIG_MEMORY_START) | 4 | #define PLAT_PHYS_OFFSET UL(CONFIG_MEMORY_START) |
5 | #define MEM_SIZE UL(CONFIG_MEMORY_SIZE) | 5 | #define MEM_SIZE UL(CONFIG_MEMORY_SIZE) |
6 | 6 | ||
7 | /* DMA memory at 0xf6000000 - 0xffdfffff */ | ||
8 | #define CONSISTENT_DMA_SIZE (158 << 20) | ||
9 | |||
10 | #endif /* __ASM_MACH_MEMORY_H */ | 7 | #endif /* __ASM_MACH_MEMORY_H */ |
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c index 399c89f14dfb..376b6dfdfae9 100644 --- a/arch/arm/mach-u300/core.c +++ b/arch/arm/mach-u300/core.c | |||
@@ -25,6 +25,7 @@ | |||
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/mtd/nand.h> | 26 | #include <linux/mtd/nand.h> |
27 | #include <linux/mtd/fsmc.h> | 27 | #include <linux/mtd/fsmc.h> |
28 | #include <linux/dma-mapping.h> | ||
28 | 29 | ||
29 | #include <asm/types.h> | 30 | #include <asm/types.h> |
30 | #include <asm/setup.h> | 31 | #include <asm/setup.h> |
@@ -92,6 +93,8 @@ static struct map_desc u300_io_desc[] __initdata = { | |||
92 | void __init u300_map_io(void) | 93 | void __init u300_map_io(void) |
93 | { | 94 | { |
94 | iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc)); | 95 | iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc)); |
96 | /* We enable a real big DMA buffer if need be. */ | ||
97 | init_consistent_dma_size(SZ_4M); | ||
95 | } | 98 | } |
96 | 99 | ||
97 | /* | 100 | /* |
diff --git a/arch/arm/mach-u300/include/mach/memory.h b/arch/arm/mach-u300/include/mach/memory.h index 888e2e351ee1..38741da0d261 100644 --- a/arch/arm/mach-u300/include/mach/memory.h +++ b/arch/arm/mach-u300/include/mach/memory.h | |||
@@ -34,9 +34,4 @@ | |||
34 | (CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1))*1024*1024 + 0x100) | 34 | (CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1))*1024*1024 + 0x100) |
35 | #endif | 35 | #endif |
36 | 36 | ||
37 | /* | ||
38 | * We enable a real big DMA buffer if need be. | ||
39 | */ | ||
40 | #define CONSISTENT_DMA_SIZE SZ_4M | ||
41 | |||
42 | #endif | 37 | #endif |
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 0a0a1e7c20d2..50be842e89fd 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -18,12 +18,14 @@ | |||
18 | #include <linux/device.h> | 18 | #include <linux/device.h> |
19 | #include <linux/dma-mapping.h> | 19 | #include <linux/dma-mapping.h> |
20 | #include <linux/highmem.h> | 20 | #include <linux/highmem.h> |
21 | #include <linux/slab.h> | ||
21 | 22 | ||
22 | #include <asm/memory.h> | 23 | #include <asm/memory.h> |
23 | #include <asm/highmem.h> | 24 | #include <asm/highmem.h> |
24 | #include <asm/cacheflush.h> | 25 | #include <asm/cacheflush.h> |
25 | #include <asm/tlbflush.h> | 26 | #include <asm/tlbflush.h> |
26 | #include <asm/sizes.h> | 27 | #include <asm/sizes.h> |
28 | #include <asm/mach/arch.h> | ||
27 | 29 | ||
28 | #include "mm.h" | 30 | #include "mm.h" |
29 | 31 | ||
@@ -117,26 +119,37 @@ static void __dma_free_buffer(struct page *page, size_t size) | |||
117 | } | 119 | } |
118 | 120 | ||
119 | #ifdef CONFIG_MMU | 121 | #ifdef CONFIG_MMU |
120 | /* Sanity check size */ | ||
121 | #if (CONSISTENT_DMA_SIZE % SZ_2M) | ||
122 | #error "CONSISTENT_DMA_SIZE must be multiple of 2MiB" | ||
123 | #endif | ||
124 | 122 | ||
125 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT) | 123 | |
126 | #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT) | 124 | #define CONSISTENT_OFFSET(x) (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT) |
127 | #define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT) | 125 | #define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PGDIR_SHIFT) |
128 | 126 | ||
129 | /* | 127 | /* |
130 | * These are the page tables (2MB each) covering uncached, DMA consistent allocations | 128 | * These are the page tables (2MB each) covering uncached, DMA consistent allocations |
131 | */ | 129 | */ |
132 | static pte_t *consistent_pte[NUM_CONSISTENT_PTES]; | 130 | static pte_t **consistent_pte; |
131 | |||
132 | #define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M | ||
133 | |||
134 | unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE; | ||
135 | |||
136 | void __init init_consistent_dma_size(unsigned long size) | ||
137 | { | ||
138 | unsigned long base = CONSISTENT_END - ALIGN(size, SZ_2M); | ||
139 | |||
140 | BUG_ON(consistent_pte); /* Check we're called before DMA region init */ | ||
141 | BUG_ON(base < VMALLOC_END); | ||
142 | |||
143 | /* Grow region to accommodate specified size */ | ||
144 | if (base < consistent_base) | ||
145 | consistent_base = base; | ||
146 | } | ||
133 | 147 | ||
134 | #include "vmregion.h" | 148 | #include "vmregion.h" |
135 | 149 | ||
136 | static struct arm_vmregion_head consistent_head = { | 150 | static struct arm_vmregion_head consistent_head = { |
137 | .vm_lock = __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock), | 151 | .vm_lock = __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock), |
138 | .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), | 152 | .vm_list = LIST_HEAD_INIT(consistent_head.vm_list), |
139 | .vm_start = CONSISTENT_BASE, | ||
140 | .vm_end = CONSISTENT_END, | 153 | .vm_end = CONSISTENT_END, |
141 | }; | 154 | }; |
142 | 155 | ||
@@ -155,7 +168,17 @@ static int __init consistent_init(void) | |||
155 | pmd_t *pmd; | 168 | pmd_t *pmd; |
156 | pte_t *pte; | 169 | pte_t *pte; |
157 | int i = 0; | 170 | int i = 0; |
158 | u32 base = CONSISTENT_BASE; | 171 | unsigned long base = consistent_base; |
172 | unsigned long num_ptes = (CONSISTENT_END - base) >> PGDIR_SHIFT; | ||
173 | |||
174 | consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL); | ||
175 | if (!consistent_pte) { | ||
176 | pr_err("%s: no memory\n", __func__); | ||
177 | return -ENOMEM; | ||
178 | } | ||
179 | |||
180 | pr_debug("DMA memory: 0x%08lx - 0x%08lx:\n", base, CONSISTENT_END); | ||
181 | consistent_head.vm_start = base; | ||
159 | 182 | ||
160 | do { | 183 | do { |
161 | pgd = pgd_offset(&init_mm, base); | 184 | pgd = pgd_offset(&init_mm, base); |
@@ -198,7 +221,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) | |||
198 | size_t align; | 221 | size_t align; |
199 | int bit; | 222 | int bit; |
200 | 223 | ||
201 | if (!consistent_pte[0]) { | 224 | if (!consistent_pte) { |
202 | printk(KERN_ERR "%s: not initialised\n", __func__); | 225 | printk(KERN_ERR "%s: not initialised\n", __func__); |
203 | dump_stack(); | 226 | dump_stack(); |
204 | return NULL; | 227 | return NULL; |
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 91bca355cd31..64ab41348f30 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c | |||
@@ -653,9 +653,6 @@ void __init mem_init(void) | |||
653 | " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n" | 653 | " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n" |
654 | #endif | 654 | #endif |
655 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" | 655 | " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" |
656 | #ifdef CONFIG_MMU | ||
657 | " DMA : 0x%08lx - 0x%08lx (%4ld MB)\n" | ||
658 | #endif | ||
659 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" | 656 | " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" |
660 | " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" | 657 | " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n" |
661 | #ifdef CONFIG_HIGHMEM | 658 | #ifdef CONFIG_HIGHMEM |
@@ -674,9 +671,6 @@ void __init mem_init(void) | |||
674 | MLK(ITCM_OFFSET, (unsigned long) itcm_end), | 671 | MLK(ITCM_OFFSET, (unsigned long) itcm_end), |
675 | #endif | 672 | #endif |
676 | MLK(FIXADDR_START, FIXADDR_TOP), | 673 | MLK(FIXADDR_START, FIXADDR_TOP), |
677 | #ifdef CONFIG_MMU | ||
678 | MLM(CONSISTENT_BASE, CONSISTENT_END), | ||
679 | #endif | ||
680 | MLM(VMALLOC_START, VMALLOC_END), | 674 | MLM(VMALLOC_START, VMALLOC_END), |
681 | MLM(PAGE_OFFSET, (unsigned long)high_memory), | 675 | MLM(PAGE_OFFSET, (unsigned long)high_memory), |
682 | #ifdef CONFIG_HIGHMEM | 676 | #ifdef CONFIG_HIGHMEM |
@@ -699,9 +693,6 @@ void __init mem_init(void) | |||
699 | * be detected at build time already. | 693 | * be detected at build time already. |
700 | */ | 694 | */ |
701 | #ifdef CONFIG_MMU | 695 | #ifdef CONFIG_MMU |
702 | BUILD_BUG_ON(VMALLOC_END > CONSISTENT_BASE); | ||
703 | BUG_ON(VMALLOC_END > CONSISTENT_BASE); | ||
704 | |||
705 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); | 696 | BUILD_BUG_ON(TASK_SIZE > MODULES_VADDR); |
706 | BUG_ON(TASK_SIZE > MODULES_VADDR); | 697 | BUG_ON(TASK_SIZE > MODULES_VADDR); |
707 | #endif | 698 | #endif |
diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h index 11be5cdbdd1a..3ec84b902243 100644 --- a/arch/arm/plat-mxc/include/mach/memory.h +++ b/arch/arm/plat-mxc/include/mach/memory.h | |||
@@ -40,19 +40,4 @@ | |||
40 | # endif | 40 | # endif |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #if defined(CONFIG_MX3_VIDEO) | ||
44 | /* | ||
45 | * Increase size of DMA-consistent memory region. | ||
46 | * This is required for mx3 camera driver to capture at least two QXGA frames. | ||
47 | */ | ||
48 | #define CONSISTENT_DMA_SIZE SZ_8M | ||
49 | |||
50 | #elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT) | ||
51 | /* | ||
52 | * Increase size of DMA-consistent memory region. | ||
53 | * This is required for i.MX camera driver to capture at least four VGA frames. | ||
54 | */ | ||
55 | #define CONSISTENT_DMA_SIZE SZ_4M | ||
56 | #endif /* CONFIG_MX1_VIDEO || CONFIG_VIDEO_MX2_HOSTSUPPORT */ | ||
57 | |||
58 | #endif /* __ASM_ARCH_MXC_MEMORY_H__ */ | 43 | #endif /* __ASM_ARCH_MXC_MEMORY_H__ */ |
diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h index d72ec85c97e6..ebe67ea8d068 100644 --- a/arch/arm/plat-omap/include/plat/io.h +++ b/arch/arm/plat-omap/include/plat/io.h | |||
@@ -309,6 +309,8 @@ extern void omap2_init_common_devices(struct omap_sdrc_params *sdrc_cs0, | |||
309 | void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type); | 309 | void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type); |
310 | void omap_iounmap(volatile void __iomem *addr); | 310 | void omap_iounmap(volatile void __iomem *addr); |
311 | 311 | ||
312 | extern void __init omap_init_consistent_dma_size(void); | ||
313 | |||
312 | #endif | 314 | #endif |
313 | 315 | ||
314 | #endif | 316 | #endif |
diff --git a/arch/arm/plat-omap/include/plat/memory.h b/arch/arm/plat-omap/include/plat/memory.h index e6720aa2d553..7f9df6f1e113 100644 --- a/arch/arm/plat-omap/include/plat/memory.h +++ b/arch/arm/plat-omap/include/plat/memory.h | |||
@@ -85,18 +85,5 @@ | |||
85 | 85 | ||
86 | #endif /* CONFIG_ARCH_OMAP15XX */ | 86 | #endif /* CONFIG_ARCH_OMAP15XX */ |
87 | 87 | ||
88 | /* Override the ARM default */ | ||
89 | #ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE | ||
90 | |||
91 | #if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0) | ||
92 | #undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE | ||
93 | #define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2 | ||
94 | #endif | ||
95 | |||
96 | #define CONSISTENT_DMA_SIZE \ | ||
97 | (((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024) | ||
98 | |||
99 | #endif | ||
100 | |||
101 | #endif | 88 | #endif |
102 | 89 | ||
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c index f1ecfa9fc61d..e9b0e23edd0a 100644 --- a/arch/arm/plat-omap/io.c +++ b/arch/arm/plat-omap/io.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/module.h> | 12 | #include <linux/module.h> |
13 | #include <linux/io.h> | 13 | #include <linux/io.h> |
14 | #include <linux/mm.h> | 14 | #include <linux/mm.h> |
15 | #include <linux/dma-mapping.h> | ||
15 | 16 | ||
16 | #include <plat/omap7xx.h> | 17 | #include <plat/omap7xx.h> |
17 | #include <plat/omap1510.h> | 18 | #include <plat/omap1510.h> |
@@ -139,3 +140,10 @@ void omap_iounmap(volatile void __iomem *addr) | |||
139 | __iounmap(addr); | 140 | __iounmap(addr); |
140 | } | 141 | } |
141 | EXPORT_SYMBOL(omap_iounmap); | 142 | EXPORT_SYMBOL(omap_iounmap); |
143 | |||
144 | void __init omap_init_consistent_dma_size(void) | ||
145 | { | ||
146 | #ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE | ||
147 | init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20); | ||
148 | #endif | ||
149 | } | ||