summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinyu Chen <Xinyu.Chen@freescale.com>2009-08-06 17:34:24 +0800
committerJustin Waters <justin.waters@timesys.com>2009-10-13 11:05:05 -0400
commitc85d29329ef5395fc3cb5ba0e5a68a85b491f20b (patch)
treea77d05d6f817e7f3a72c7d962c734ff57ccc6a0c
parent17b2e1d1c4cb8af0f54798b664b01dc17a6e89e2 (diff)
ENGR00114922 MX233 Bring DMA ZONE to kernel
Split memory zone to DMA and normal zone for dma allocation. Make the DMA zone size configurable. Signed-off-by: Xinyu Chen <xinyu.chen@freescale.com>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/mach-stmp3xxx/Kconfig7
-rw-r--r--arch/arm/mach-stmp3xxx/include/mach/memory.h30
-rw-r--r--drivers/media/video/videobuf-dma-contig.c2
4 files changed, 38 insertions, 2 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f9079d634bf5..d0666b09e6c5 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -557,6 +557,7 @@ config ARCH_STMP3XXX
select GENERIC_CLOCKEVENTS
select GENERIC_GPIO
select USB_ARCH_HAS_EHCI
+ select ZONE_DMA
help
Support for systems based on the SigmaTel 3xxx CPUs.
diff --git a/arch/arm/mach-stmp3xxx/Kconfig b/arch/arm/mach-stmp3xxx/Kconfig
index b1d4dd60ce47..d1579570efc5 100644
--- a/arch/arm/mach-stmp3xxx/Kconfig
+++ b/arch/arm/mach-stmp3xxx/Kconfig
@@ -81,4 +81,11 @@ config STMP378X_RAM_DDR
endchoice
+config DMA_ZONE_SIZE
+ int "DMA memory zone size"
+ range 0 32
+ default 12
+ help
+ This is the size in MB for the DMA zone. The DMA zone is used for
+ dedicated memory for large contiguous video buffers
endif
diff --git a/arch/arm/mach-stmp3xxx/include/mach/memory.h b/arch/arm/mach-stmp3xxx/include/mach/memory.h
index e6ea91270d62..591130440844 100644
--- a/arch/arm/mach-stmp3xxx/include/mach/memory.h
+++ b/arch/arm/mach-stmp3xxx/include/mach/memory.h
@@ -14,12 +14,40 @@
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H
+#include <asm/page.h>
+#include <asm/sizes.h>
+
/*
* Physical DRAM offset.
*/
#define PHYS_OFFSET UL(0x40000000)
#define BUS_OFFSET UL(0x40000000)
+#ifndef __ASSEMBLY__
+
+#ifdef CONFIG_DMA_ZONE_SIZE
+#define MXC_DMA_ZONE_SIZE ((CONFIG_DMA_ZONE_SIZE * SZ_1M) >> PAGE_SHIFT)
+#else
+#define MXC_DMA_ZONE_SIZE ((12 * SZ_1M) >> PAGE_SHIFT)
+#endif
+
+static inline void __arch_adjust_zones(int node, unsigned long *zone_size,
+ unsigned long *zhole_size)
+{
+ if (node != 0)
+ return;
+ /* Create separate zone to reserve memory for DMA */
+ zone_size[1] = zone_size[0] - MXC_DMA_ZONE_SIZE;
+ zone_size[0] = MXC_DMA_ZONE_SIZE;
+ zhole_size[1] = zhole_size[0];
+ zhole_size[0] = 0;
+}
+
+#define arch_adjust_zones(node, size, holes) \
+ __arch_adjust_zones(node, size, holes)
+
+#endif
+
/*
* Virtual view <-> DMA view memory address translations
* virt_to_bus: Used to translate the virtual address to an
@@ -32,6 +60,6 @@
#define ISA_DMA_THRESHOLD (0x0003ffffULL)
-#define CONSISTENT_DMA_SIZE SZ_4M
+#define CONSISTENT_DMA_SIZE SZ_32M
#endif
diff --git a/drivers/media/video/videobuf-dma-contig.c b/drivers/media/video/videobuf-dma-contig.c
index 31944b11e6ea..2d543552ae0d 100644
--- a/drivers/media/video/videobuf-dma-contig.c
+++ b/drivers/media/video/videobuf-dma-contig.c
@@ -255,7 +255,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q,
mem->size = PAGE_ALIGN(q->bufs[first]->bsize);
mem->vaddr = dma_alloc_coherent(q->dev, mem->size,
- &mem->dma_handle, GFP_KERNEL);
+ &mem->dma_handle, GFP_KERNEL | GFP_DMA);
if (!mem->vaddr) {
dev_err(q->dev, "dma_alloc_coherent size %ld failed\n",
mem->size);