linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE
@ 2011-08-08 14:28 Jon Medhurst
  2011-08-08 14:28 ` [PATCH 01/12] ARM: Add init_consistent_dma_size() Jon Medhurst
                   ` (12 more replies)
  0 siblings, 13 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

The size of the consistent DMA mapping region is given by the define
CONSISTENT_DMA_SIZE. This defaults to a value of 2MB but various
platforms increase this, usually to support larger frame buffers.

To enable support for building multiple ARM platforms into a single
kernel binary, we need to remove the compile time constant
CONSISTENT_DMA_SIZE and make it configured at boot time.

To implement this, this patch series provides a function to set the
size - init_consistent_dma_size() - then each platform which requires a
non-default value is modified to call this during the map_io callback.
(This call-site was chosen as it is platform specific, early enough, and
is somewhat related to the functions being performed.)

Future CMA work may make these changes obsolete, so this is probably a
near term solution to help progress the 'single zImage' work.

CC: Ben Dooks <ben-linux@fluff.org>
CC: Kukjin Kim <kgene.kim@samsung.com>
CC: Sascha Hauer <kernel@pengutronix.de>
CC: Amit Kucheria <amit.kucheria@canonical.com>
CC: Sekhar Nori <nsekhar@ti.com>
CC: Kevin Hilman <khilman@ti.com>
CC: Linus Walleij <linus.walleij@stericsson.com>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Jiandong Zheng <jdzheng@broadcom.com>
CC: Scott Branden <sbranden@broadcom.com>
CC: Paul Mundt <lethal@linux-sh.org>
CC: Magnus Damm <magnus.damm@gmail.com>

---
 arch/arm/include/asm/dma-mapping.h            |    3 ++
 arch/arm/include/asm/memory.h                 |    9 -----
 arch/arm/mach-at91/at91sam9g45.c              |    2 +
 arch/arm/mach-at91/include/mach/at91sam9g45.h |    2 -
 arch/arm/mach-bcmring/include/mach/memory.h   |    5 ---
 arch/arm/mach-bcmring/mm.c                    |    3 ++
 arch/arm/mach-davinci/common.c                |    3 ++
 arch/arm/mach-davinci/include/mach/memory.h   |    5 ---
 arch/arm/mach-imx/mm-imx1.c                   |    1 +
 arch/arm/mach-imx/mm-imx21.c                  |    1 +
 arch/arm/mach-imx/mm-imx25.c                  |    1 +
 arch/arm/mach-imx/mm-imx27.c                  |    1 +
 arch/arm/mach-imx/mm-imx31.c                  |    1 +
 arch/arm/mach-imx/mm-imx35.c                  |    1 +
 arch/arm/mach-mx5/mm-mx50.c                   |    1 +
 arch/arm/mach-mx5/mm.c                        |    2 +
 arch/arm/mach-omap1/io.c                      |    1 +
 arch/arm/mach-omap2/io.c                      |    2 +-
 arch/arm/mach-s3c64xx/cpu.c                   |    2 +
 arch/arm/mach-s3c64xx/include/mach/memory.h   |    2 -
 arch/arm/mach-s5p64x0/cpu.c                   |    3 ++
 arch/arm/mach-s5p64x0/include/mach/memory.h   |    1 -
 arch/arm/mach-s5pv210/cpu.c                   |    2 +
 arch/arm/mach-s5pv210/include/mach/memory.h   |    1 -
 arch/arm/mach-shmobile/board-ag5evm.c         |    3 ++
 arch/arm/mach-shmobile/board-ap4evb.c         |    3 ++
 arch/arm/mach-shmobile/board-g3evm.c          |    3 ++
 arch/arm/mach-shmobile/board-g4evm.c          |    3 ++
 arch/arm/mach-shmobile/board-mackerel.c       |    3 ++
 arch/arm/mach-shmobile/include/mach/memory.h  |    3 --
 arch/arm/mach-u300/core.c                     |    3 ++
 arch/arm/mach-u300/include/mach/memory.h      |    5 ---
 arch/arm/mm/dma-mapping.c                     |   45 +++++++++++++++++++------
 arch/arm/mm/init.c                            |    9 -----
 arch/arm/plat-mxc/include/mach/common.h       |    1 +
 arch/arm/plat-mxc/include/mach/memory.h       |   15 --------
 arch/arm/plat-mxc/system.c                    |   16 +++++++++
 arch/arm/plat-omap/include/plat/io.h          |    2 +
 arch/arm/plat-omap/include/plat/memory.h      |   13 -------
 arch/arm/plat-omap/io.c                       |    8 ++++
 40 files changed, 108 insertions(+), 82 deletions(-)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/12] ARM: Add init_consistent_dma_size()
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-18 13:02   ` Nicolas Pitre
  2011-08-08 14:28 ` [PATCH 02/12] ARM: omap: Setup consistent dma size at boot time Jon Medhurst
                   ` (11 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

This function can be called during boot to increase the size of the consistent
DMA region above it's default value of 2MB. It must be called before the memory
allocator is initialised, i.e. before any core_initcall.

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
 arch/arm/include/asm/dma-mapping.h |    3 ++
 arch/arm/include/asm/memory.h      |    9 ------
 arch/arm/mm/dma-mapping.c          |   49 +++++++++++++++++++++++++++--------
 arch/arm/mm/init.c                 |    9 ------
 4 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 7a21d0b..328416b 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -206,6 +206,9 @@ int dma_mmap_writecombine(struct device *, struct vm_area_struct *,
 		void *, dma_addr_t, size_t);
 
 
+extern void __init init_consistent_dma_size(unsigned long size);
+
+
 #ifdef CONFIG_DMABOUNCE
 /*
  * For SA-1111, IXP425, and ADI systems  the dma-mapping functions are "magic"
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index b8de516..652fccc 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -77,16 +77,7 @@
  */
 #define IOREMAP_MAX_ORDER	24
 
-/*
- * Size of DMA-consistent memory region.  Must be multiple of 2M,
- * between 2MB and 14MB inclusive.
- */
-#ifndef CONSISTENT_DMA_SIZE
-#define CONSISTENT_DMA_SIZE 	SZ_2M
-#endif
-
 #define CONSISTENT_END		(0xffe00000UL)
-#define CONSISTENT_BASE		(CONSISTENT_END - CONSISTENT_DMA_SIZE)
 
 #else /* CONFIG_MMU */
 
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 0a0a1e7..5b59ce5 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -18,12 +18,14 @@
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
 #include <linux/highmem.h>
+#include <linux/slab.h>
 
 #include <asm/memory.h>
 #include <asm/highmem.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/sizes.h>
+#include <asm/mach/arch.h>
 
 #include "mm.h"
 
@@ -117,26 +119,41 @@ static void __dma_free_buffer(struct page *page, size_t size)
 }
 
 #ifdef CONFIG_MMU
-/* Sanity check size */
-#if (CONSISTENT_DMA_SIZE % SZ_2M)
-#error "CONSISTENT_DMA_SIZE must be multiple of 2MiB"
-#endif
 
-#define CONSISTENT_OFFSET(x)	(((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)
-#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT)
-#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT)
+
+#define CONSISTENT_OFFSET(x)	(((unsigned long)(x) - consistent_base) >> PAGE_SHIFT)
+#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PGDIR_SHIFT)
 
 /*
  * These are the page tables (2MB each) covering uncached, DMA consistent allocations
  */
-static pte_t *consistent_pte[NUM_CONSISTENT_PTES];
+static pte_t **consistent_pte;
+
+#ifdef CONSISTENT_DMA_SIZE
+#define DEFAULT_CONSISTENT_DMA_SIZE CONSISTENT_DMA_SIZE
+#else
+#define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M
+#endif
+
+unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE;
+
+void __init init_consistent_dma_size(unsigned long size)
+{
+	unsigned long base = CONSISTENT_END - ALIGN(size, SZ_2M);
+
+	BUG_ON(consistent_pte); /* Check we're called before DMA region init */
+	BUG_ON(base < VMALLOC_END);
+
+	/* Grow region to accommodate specified size  */
+	if (base < consistent_base)
+		consistent_base = base;
+}
 
 #include "vmregion.h"
 
 static struct arm_vmregion_head consistent_head = {
 	.vm_lock	= __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock),
 	.vm_list	= LIST_HEAD_INIT(consistent_head.vm_list),
-	.vm_start	= CONSISTENT_BASE,
 	.vm_end		= CONSISTENT_END,
 };
 
@@ -155,7 +172,17 @@ static int __init consistent_init(void)
 	pmd_t *pmd;
 	pte_t *pte;
 	int i = 0;
-	u32 base = CONSISTENT_BASE;
+	unsigned long base = consistent_base;
+	unsigned long num_ptes = (CONSISTENT_END - base) >> PGDIR_SHIFT;
+
+	consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL);
+	if (!consistent_pte) {
+		pr_err("%s: no memory\n", __func__);
+		return -ENOMEM;
+	}
+
+	pr_debug("DMA memory: 0x%08lx - 0x%08lx:\n", base, CONSISTENT_END);
+	consistent_head.vm_start = base;
 
 	do {
 		pgd = pgd_offset(&init_mm, base);
@@ -198,7 +225,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
 	size_t align;
 	int bit;
 
-	if (!consistent_pte[0]) {
+	if (!consistent_pte) {
 		printk(KERN_ERR "%s: not initialised\n", __func__);
 		dump_stack();
 		return NULL;
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 2fee782..2a7c173 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -653,9 +653,6 @@ void __init mem_init(void)
 			"    ITCM    : 0x%08lx - 0x%08lx   (%4ld kB)\n"
 #endif
 			"    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
-#ifdef CONFIG_MMU
-			"    DMA     : 0x%08lx - 0x%08lx   (%4ld MB)\n"
-#endif
 			"    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
 			"    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
 #ifdef CONFIG_HIGHMEM
@@ -674,9 +671,6 @@ void __init mem_init(void)
 			MLK(ITCM_OFFSET, (unsigned long) itcm_end),
 #endif
 			MLK(FIXADDR_START, FIXADDR_TOP),
-#ifdef CONFIG_MMU
-			MLM(CONSISTENT_BASE, CONSISTENT_END),
-#endif
 			MLM(VMALLOC_START, VMALLOC_END),
 			MLM(PAGE_OFFSET, (unsigned long)high_memory),
 #ifdef CONFIG_HIGHMEM
@@ -699,9 +693,6 @@ void __init mem_init(void)
 	 * be detected at build time already.
 	 */
 #ifdef CONFIG_MMU
-	BUILD_BUG_ON(VMALLOC_END			> CONSISTENT_BASE);
-	BUG_ON(VMALLOC_END				> CONSISTENT_BASE);
-
 	BUILD_BUG_ON(TASK_SIZE				> MODULES_VADDR);
 	BUG_ON(TASK_SIZE 				> MODULES_VADDR);
 #endif
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 02/12] ARM: omap: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
  2011-08-08 14:28 ` [PATCH 01/12] ARM: Add init_consistent_dma_size() Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 14:28 ` [PATCH 03/12] ARM: mach-s3c64xx: " Jon Medhurst
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Tony Lindgren <tony@atomide.com>
---
 arch/arm/plat-omap/include/plat/io.h     |    2 ++
 arch/arm/plat-omap/include/plat/memory.h |   13 -------------
 arch/arm/mach-omap1/io.c                 |    1 +
 arch/arm/mach-omap2/io.c                 |    2 +-
 arch/arm/plat-omap/io.c                  |    8 ++++++++
 5 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/io.h b/arch/arm/plat-omap/include/plat/io.h
index d72ec85..ebe67ea 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,
 void __iomem *omap_ioremap(unsigned long phys, size_t size, unsigned int type);
 void omap_iounmap(volatile void __iomem *addr);
 
+extern void __init omap_init_consistent_dma_size(void);
+
 #endif
 
 #endif
diff --git a/arch/arm/plat-omap/include/plat/memory.h b/arch/arm/plat-omap/include/plat/memory.h
index e6720aa..7f9df6f 100644
--- a/arch/arm/plat-omap/include/plat/memory.h
+++ b/arch/arm/plat-omap/include/plat/memory.h
@@ -85,18 +85,5 @@
 
 #endif	/* CONFIG_ARCH_OMAP15XX */
 
-/* Override the ARM default */
-#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
-
-#if (CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE == 0)
-#undef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
-#define CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE 2
-#endif
-
-#define CONSISTENT_DMA_SIZE \
-	(((CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE + 1) & ~1) * 1024 * 1024)
-
-#endif
-
 #endif
 
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index 870886a..1cfa1b6 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)
 #endif
 
 	omap_sram_init();
+	omap_init_consistent_dma_size();
 }
 
 /*
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 2ce1ce6..d6d01cb 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -16,7 +16,6 @@
  * it under the terms of the GNU General Public License version 2 as
  * published by the Free Software Foundation.
  */
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
@@ -250,6 +249,7 @@ static void __init _omap2_map_common_io(void)
 
 	omap2_check_revision();
 	omap_sram_init();
+	omap_init_consistent_dma_size();
 }
 
 #ifdef CONFIG_SOC_OMAP2420
diff --git a/arch/arm/plat-omap/io.c b/arch/arm/plat-omap/io.c
index f1ecfa9..e9b0e23 100644
--- a/arch/arm/plat-omap/io.c
+++ b/arch/arm/plat-omap/io.c
@@ -12,6 +12,7 @@
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/mm.h>
+#include <linux/dma-mapping.h>
 
 #include <plat/omap7xx.h>
 #include <plat/omap1510.h>
@@ -139,3 +140,10 @@ void omap_iounmap(volatile void __iomem *addr)
 		__iounmap(addr);
 }
 EXPORT_SYMBOL(omap_iounmap);
+
+void __init omap_init_consistent_dma_size(void)
+{
+#ifdef CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE
+	init_consistent_dma_size(CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE << 20);
+#endif
+}
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 03/12] ARM: mach-s3c64xx: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
  2011-08-08 14:28 ` [PATCH 01/12] ARM: Add init_consistent_dma_size() Jon Medhurst
  2011-08-08 14:28 ` [PATCH 02/12] ARM: omap: Setup consistent dma size at boot time Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 14:28 ` [PATCH 04/12] ARM: mach-s5p64x0: " Jon Medhurst
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Ben Dooks <ben-linux@fluff.org>
---
 arch/arm/mach-s3c64xx/include/mach/memory.h |    2 --
 arch/arm/mach-s3c64xx/cpu.c                 |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-s3c64xx/include/mach/memory.h b/arch/arm/mach-s3c64xx/include/mach/memory.h
index 4760cda..b704669 100644
--- a/arch/arm/mach-s3c64xx/include/mach/memory.h
+++ b/arch/arm/mach-s3c64xx/include/mach/memory.h
@@ -15,6 +15,4 @@
 
 #define PLAT_PHYS_OFFSET     UL(0x50000000)
 
-#define CONSISTENT_DMA_SIZE	SZ_8M
-
 #endif
diff --git a/arch/arm/mach-s3c64xx/cpu.c b/arch/arm/mach-s3c64xx/cpu.c
index 374e45e..8dc0576 100644
--- a/arch/arm/mach-s3c64xx/cpu.c
+++ b/arch/arm/mach-s3c64xx/cpu.c
@@ -20,6 +20,7 @@
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
 #include <linux/io.h>
+#include <linux/dma-mapping.h>
 
 #include <mach/hardware.h>
 #include <mach/map.h>
@@ -145,6 +146,7 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size)
 	/* initialise the io descriptors we need for initialisation */
 	iotable_init(s3c_iodesc, ARRAY_SIZE(s3c_iodesc));
 	iotable_init(mach_desc, size);
+	init_consistent_dma_size(SZ_8M);
 
 	idcode = __raw_readl(S3C_VA_SYS + 0x118);
 	if (!idcode) {
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 04/12] ARM: mach-s5p64x0: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (2 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 03/12] ARM: mach-s3c64xx: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 14:28 ` [PATCH 05/12] ARM: mach-s5pv210: " Jon Medhurst
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/mach-s5p64x0/include/mach/memory.h |    1 -
 arch/arm/mach-s5p64x0/cpu.c                 |    3 +++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-s5p64x0/include/mach/memory.h b/arch/arm/mach-s5p64x0/include/mach/memory.h
index 365a6eb..b14cbc3 100644
--- a/arch/arm/mach-s5p64x0/include/mach/memory.h
+++ b/arch/arm/mach-s5p64x0/include/mach/memory.h
@@ -14,6 +14,5 @@
 #define __ASM_ARCH_MEMORY_H __FILE__
 
 #define PLAT_PHYS_OFFSET		UL(0x20000000)
-#define CONSISTENT_DMA_SIZE	SZ_8M
 
 #endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-s5p64x0/cpu.c b/arch/arm/mach-s5p64x0/cpu.c
index a5c0095..8a93854 100644
--- a/arch/arm/mach-s5p64x0/cpu.c
+++ b/arch/arm/mach-s5p64x0/cpu.c
@@ -20,6 +20,7 @@
 #include <linux/serial_core.h>
 #include <linux/platform_device.h>
 #include <linux/sched.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -111,6 +112,7 @@ void __init s5p6440_map_io(void)
 
 	iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
 	iotable_init(s5p6440_iodesc, ARRAY_SIZE(s5p6440_iodesc));
+	init_consistent_dma_size(SZ_8M);
 }
 
 void __init s5p6450_map_io(void)
@@ -120,6 +122,7 @@ void __init s5p6450_map_io(void)
 
 	iotable_init(s5p64x0_iodesc, ARRAY_SIZE(s5p64x0_iodesc));
 	iotable_init(s5p6450_iodesc, ARRAY_SIZE(s5p6450_iodesc));
+	init_consistent_dma_size(SZ_8M);
 }
 
 /*
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 05/12] ARM: mach-s5pv210: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (3 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 04/12] ARM: mach-s5p64x0: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-11 12:50   ` Pavel Machek
  2011-08-08 14:28 ` [PATCH 06/12] ARM: mxc: " Jon Medhurst
                   ` (7 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Kukjin Kim <kgene.kim@samsung.com>
---
 arch/arm/mach-s5pv210/include/mach/memory.h |    1 -
 arch/arm/mach-s5pv210/cpu.c                 |    2 ++
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-s5pv210/include/mach/memory.h b/arch/arm/mach-s5pv210/include/mach/memory.h
index 7b5fcf0..2d3cfa2 100644
--- a/arch/arm/mach-s5pv210/include/mach/memory.h
+++ b/arch/arm/mach-s5pv210/include/mach/memory.h
@@ -14,7 +14,6 @@
 #define __ASM_ARCH_MEMORY_H
 
 #define PLAT_PHYS_OFFSET		UL(0x20000000)
-#define CONSISTENT_DMA_SIZE	(SZ_8M + SZ_4M + SZ_2M)
 
 /*
  * Sparsemem support
diff --git a/arch/arm/mach-s5pv210/cpu.c b/arch/arm/mach-s5pv210/cpu.c
index 79907ec..9114572 100644
--- a/arch/arm/mach-s5pv210/cpu.c
+++ b/arch/arm/mach-s5pv210/cpu.c
@@ -20,6 +20,7 @@
 #include <linux/sysdev.h>
 #include <linux/platform_device.h>
 #include <linux/sched.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/mach/arch.h>
 #include <asm/mach/map.h>
@@ -119,6 +120,7 @@ static void s5pv210_sw_reset(void)
 void __init s5pv210_map_io(void)
 {
 	iotable_init(s5pv210_iodesc, ARRAY_SIZE(s5pv210_iodesc));
+	init_consistent_dma_size(14 << 20);
 
 	/* initialise device information early */
 	s5pv210_default_sdhci0();
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (4 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 05/12] ARM: mach-s5pv210: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 16:47   ` Sascha Hauer
  2011-08-08 14:28 ` [PATCH 07/12] ARM: mach-davinci: " Jon Medhurst
                   ` (6 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Sascha Hauer <kernel@pengutronix.de>
CC: Amit Kucheria <amit.kucheria@canonical.com>
---
 arch/arm/plat-mxc/include/mach/common.h |    1 +
 arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
 arch/arm/mach-imx/mm-imx1.c             |    1 +
 arch/arm/mach-imx/mm-imx21.c            |    1 +
 arch/arm/mach-imx/mm-imx25.c            |    1 +
 arch/arm/mach-imx/mm-imx27.c            |    1 +
 arch/arm/mach-imx/mm-imx31.c            |    1 +
 arch/arm/mach-imx/mm-imx35.c            |    1 +
 arch/arm/mach-mx5/mm-mx50.c             |    1 +
 arch/arm/mach-mx5/mm.c                  |    2 ++
 arch/arm/plat-mxc/system.c              |   16 ++++++++++++++++
 11 files changed, 26 insertions(+), 15 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
index 4e3d978..40fb4d8 100644
--- a/arch/arm/plat-mxc/include/mach/common.h
+++ b/arch/arm/plat-mxc/include/mach/common.h
@@ -72,4 +72,5 @@ extern void mxc_arch_reset_init(void __iomem *);
 extern void mx51_efikamx_reset(void);
 extern int mx53_revision(void);
 extern int mx53_display_revision(void);
+extern void __init mxc_init_consistent_dma_size(void);
 #endif
diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
index 11be5cd..3ec84b9 100644
--- a/arch/arm/plat-mxc/include/mach/memory.h
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -40,19 +40,4 @@
 # endif
 #endif
 
-#if defined(CONFIG_MX3_VIDEO)
-/*
- * Increase size of DMA-consistent memory region.
- * This is required for mx3 camera driver to capture at least two QXGA frames.
- */
-#define CONSISTENT_DMA_SIZE SZ_8M
-
-#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
-/*
- * Increase size of DMA-consistent memory region.
- * This is required for i.MX camera driver to capture at least four VGA frames.
- */
-#define CONSISTENT_DMA_SIZE SZ_4M
-#endif /* CONFIG_MX1_VIDEO || CONFIG_VIDEO_MX2_HOSTSUPPORT */
-
 #endif /* __ASM_ARCH_MXC_MEMORY_H__ */
diff --git a/arch/arm/mach-imx/mm-imx1.c b/arch/arm/mach-imx/mm-imx1.c
index 2bded59..f70e318 100644
--- a/arch/arm/mach-imx/mm-imx1.c
+++ b/arch/arm/mach-imx/mm-imx1.c
@@ -33,6 +33,7 @@ static struct map_desc imx_io_desc[] __initdata = {
 void __init mx1_map_io(void)
 {
 	iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx1_init_early(void)
diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index 3f05dfe..440816a 100644
--- a/arch/arm/mach-imx/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -60,6 +60,7 @@ static struct map_desc imx21_io_desc[] __initdata = {
 void __init mx21_map_io(void)
 {
 	iotable_init(imx21_io_desc, ARRAY_SIZE(imx21_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx21_init_early(void)
diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
index cc4d152..12f5759 100644
--- a/arch/arm/mach-imx/mm-imx25.c
+++ b/arch/arm/mach-imx/mm-imx25.c
@@ -48,6 +48,7 @@ static struct map_desc mx25_io_desc[] __initdata = {
 void __init mx25_map_io(void)
 {
 	iotable_init(mx25_io_desc, ARRAY_SIZE(mx25_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx25_init_early(void)
diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index 96dd1f5..8799265 100644
--- a/arch/arm/mach-imx/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -60,6 +60,7 @@ static struct map_desc imx27_io_desc[] __initdata = {
 void __init mx27_map_io(void)
 {
 	iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx27_init_early(void)
diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
index b7c55e7..b2331cf 100644
--- a/arch/arm/mach-imx/mm-imx31.c
+++ b/arch/arm/mach-imx/mm-imx31.c
@@ -45,6 +45,7 @@ static struct map_desc mx31_io_desc[] __initdata = {
 void __init mx31_map_io(void)
 {
 	iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx31_init_early(void)
diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
index f49bac7..eb60521 100644
--- a/arch/arm/mach-imx/mm-imx35.c
+++ b/arch/arm/mach-imx/mm-imx35.c
@@ -41,6 +41,7 @@ static struct map_desc mx35_io_desc[] __initdata = {
 void __init mx35_map_io(void)
 {
 	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx35_init_early(void)
diff --git a/arch/arm/mach-mx5/mm-mx50.c b/arch/arm/mach-mx5/mm-mx50.c
index 77e374c..04a02cc 100644
--- a/arch/arm/mach-mx5/mm-mx50.c
+++ b/arch/arm/mach-mx5/mm-mx50.c
@@ -46,6 +46,7 @@ static struct map_desc mx50_io_desc[] __initdata = {
 void __init mx50_map_io(void)
 {
 	iotable_init(mx50_io_desc, ARRAY_SIZE(mx50_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx50_init_early(void)
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
index baea6e5..e0ca2b5 100644
--- a/arch/arm/mach-mx5/mm.c
+++ b/arch/arm/mach-mx5/mm.c
@@ -49,6 +49,7 @@ static struct map_desc mx53_io_desc[] __initdata = {
 void __init mx51_map_io(void)
 {
 	iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx51_init_early(void)
@@ -61,6 +62,7 @@ void __init imx51_init_early(void)
 void __init mx53_map_io(void)
 {
 	iotable_init(mx53_io_desc, ARRAY_SIZE(mx53_io_desc));
+	mxc_init_consistent_dma_size();
 }
 
 void __init imx53_init_early(void)
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 8024f2a..75d1592 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -21,6 +21,7 @@
 #include <linux/io.h>
 #include <linux/err.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
 
 #include <mach/hardware.h>
 #include <mach/common.h>
@@ -74,3 +75,18 @@ void mxc_arch_reset_init(void __iomem *base)
 {
 	wdog_base = base;
 }
+
+void __init mxc_init_consistent_dma_size(void)
+{
+#if defined(CONFIG_MX3_VIDEO)
+
+	/* Required for mx3 camera driver to capture at least two QXGA frames */
+	init_consistent_dma_size(SZ_8M);
+
+#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
+
+	/* Required for i.MX camera driver to capture at least 4 VGA frames */
+	init_consistent_dma_size(SZ_4M);
+
+#endif
+}
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 07/12] ARM: mach-davinci: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (5 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 06/12] ARM: mxc: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 14:28 ` [PATCH 08/12] ARM: mach-u300: " Jon Medhurst
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Sekhar Nori <nsekhar@ti.com>
CC: Kevin Hilman <khilman@ti.com>
---
 arch/arm/mach-davinci/include/mach/memory.h |    5 -----
 arch/arm/mach-davinci/common.c              |    3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h
index 7873194..885d233 100644
--- a/arch/arm/mach-davinci/include/mach/memory.h
+++ b/arch/arm/mach-davinci/include/mach/memory.h
@@ -36,9 +36,4 @@
 #define DDR2_MCLKSTOPEN_BIT	BIT(30)
 #define DDR2_LPMODEN_BIT	BIT(31)
 
-/*
- * Increase size of DMA-consistent memory region
- */
-#define CONSISTENT_DMA_SIZE (14<<20)
-
 #endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-davinci/common.c b/arch/arm/mach-davinci/common.c
index 1d25573..865ffe5 100644
--- a/arch/arm/mach-davinci/common.c
+++ b/arch/arm/mach-davinci/common.c
@@ -12,6 +12,7 @@
 #include <linux/io.h>
 #include <linux/etherdevice.h>
 #include <linux/davinci_emac.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/tlb.h>
 #include <asm/mach/map.h>
@@ -86,6 +87,8 @@ void __init davinci_common_init(struct davinci_soc_info *soc_info)
 		iotable_init(davinci_soc_info.io_desc,
 				davinci_soc_info.io_desc_num);
 
+	init_consistent_dma_size(14 << 20);
+
 	/*
 	 * Normally devicemaps_init() would flush caches and tlb after
 	 * mdesc->map_io(), but we must also do it here because of the CPU
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 08/12] ARM: mach-u300: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (6 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 07/12] ARM: mach-davinci: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-09  9:31   ` Linus Walleij
  2011-08-08 14:28 ` [PATCH 09/12] ARM: mach-at91: " Jon Medhurst
                   ` (4 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Linus Walleij <linus.walleij@stericsson.com>
---
 arch/arm/mach-u300/include/mach/memory.h |    5 -----
 arch/arm/mach-u300/core.c                |    3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-u300/include/mach/memory.h b/arch/arm/mach-u300/include/mach/memory.h
index 888e2e3..38741da 100644
--- a/arch/arm/mach-u300/include/mach/memory.h
+++ b/arch/arm/mach-u300/include/mach/memory.h
@@ -34,9 +34,4 @@
 	    (CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1))*1024*1024 + 0x100)
 #endif
 
-/*
- * We enable a real big DMA buffer if need be.
- */
-#define CONSISTENT_DMA_SIZE SZ_4M
-
 #endif
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 399c89f..376b6df 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -25,6 +25,7 @@
 #include <linux/err.h>
 #include <linux/mtd/nand.h>
 #include <linux/mtd/fsmc.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/types.h>
 #include <asm/setup.h>
@@ -92,6 +93,8 @@ static struct map_desc u300_io_desc[] __initdata = {
 void __init u300_map_io(void)
 {
 	iotable_init(u300_io_desc, ARRAY_SIZE(u300_io_desc));
+	/* We enable a real big DMA buffer if need be. */
+	init_consistent_dma_size(SZ_4M);
 }
 
 /*
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 09/12] ARM: mach-at91: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (7 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 08/12] ARM: mach-u300: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 19:52   ` Nicolas Ferre
  2011-08-08 14:28 ` [PATCH 10/12] ARM: mach-bcmring: " Jon Medhurst
                   ` (3 subsequent siblings)
  12 siblings, 1 reply; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
---
 arch/arm/mach-at91/include/mach/at91sam9g45.h |    2 --
 arch/arm/mach-at91/at91sam9g45.c              |    2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
index 2c611b9..406bb64 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
@@ -128,8 +128,6 @@
 #define AT91SAM9G45_EHCI_BASE	0x00800000	/* USB Host controller (EHCI) */
 #define AT91SAM9G45_VDEC_BASE	0x00900000	/* Video Decoder Controller */
 
-#define CONSISTENT_DMA_SIZE	SZ_4M
-
 /*
  * DMA peripheral identifiers
  * for hardware handshaking interface
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index e04c5fb..1532b50 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -12,6 +12,7 @@
 
 #include <linux/module.h>
 #include <linux/pm.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
@@ -319,6 +320,7 @@ static void at91sam9g45_poweroff(void)
 static void __init at91sam9g45_map_io(void)
 {
 	at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE);
+	init_consistent_dma_size(SZ_4M);
 }
 
 static void __init at91sam9g45_initialize(void)
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 10/12] ARM: mach-bcmring: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (8 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 09/12] ARM: mach-at91: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 14:28 ` [PATCH 11/12] ARM: mach-shmobile: " Jon Medhurst
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Jiandong Zheng <jdzheng@broadcom.com>
CC: Scott Branden <sbranden@broadcom.com>
---
 arch/arm/mach-bcmring/include/mach/memory.h |    5 -----
 arch/arm/mach-bcmring/mm.c                  |    3 +++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/arm/mach-bcmring/include/mach/memory.h b/arch/arm/mach-bcmring/include/mach/memory.h
index 15162e4..8848a5b 100644
--- a/arch/arm/mach-bcmring/include/mach/memory.h
+++ b/arch/arm/mach-bcmring/include/mach/memory.h
@@ -25,9 +25,4 @@
 
 #define PLAT_PHYS_OFFSET CFG_GLOBAL_RAM_BASE
 
-/*
- * Maximum DMA memory allowed is 14M
- */
-#define CONSISTENT_DMA_SIZE (SZ_16M - SZ_2M)
-
 #endif
diff --git a/arch/arm/mach-bcmring/mm.c b/arch/arm/mach-bcmring/mm.c
index 0f1c37e..8616876 100644
--- a/arch/arm/mach-bcmring/mm.c
+++ b/arch/arm/mach-bcmring/mm.c
@@ -13,6 +13,7 @@
 *****************************************************************************/
 
 #include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
 #include <asm/mach/map.h>
 
 #include <mach/hardware.h>
@@ -53,4 +54,6 @@ void __init bcmring_map_io(void)
 {
 
 	iotable_init(bcmring_io_desc, ARRAY_SIZE(bcmring_io_desc));
+	/* Maximum DMA memory allowed is 14M */
+	init_consistent_dma_size(14 << 20);
 }
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 11/12] ARM: mach-shmobile: Setup consistent dma size at boot time
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (9 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 10/12] ARM: mach-bcmring: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-08 14:28 ` [PATCH 12/12] ARM: Remove support for macro CONSISTENT_DMA_SIZE Jon Medhurst
  2011-08-22 13:06 ` Submitting patchset: ARM: Remove define CONSISTENT_DMA_SIZE Tixy
  12 siblings, 0 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Paul Mundt <lethal@linux-sh.org>
CC: Magnus Damm <magnus.damm@gmail.com>
---
 arch/arm/mach-shmobile/include/mach/memory.h |    3 ---
 arch/arm/mach-shmobile/board-ag5evm.c        |    3 +++
 arch/arm/mach-shmobile/board-ap4evb.c        |    3 +++
 arch/arm/mach-shmobile/board-g3evm.c         |    3 +++
 arch/arm/mach-shmobile/board-g4evm.c         |    3 +++
 arch/arm/mach-shmobile/board-mackerel.c      |    3 +++
 6 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-shmobile/include/mach/memory.h b/arch/arm/mach-shmobile/include/mach/memory.h
index ad00c3c..0ffbe81 100644
--- a/arch/arm/mach-shmobile/include/mach/memory.h
+++ b/arch/arm/mach-shmobile/include/mach/memory.h
@@ -4,7 +4,4 @@
 #define PLAT_PHYS_OFFSET	UL(CONFIG_MEMORY_START)
 #define MEM_SIZE	UL(CONFIG_MEMORY_SIZE)
 
-/* DMA memory at 0xf6000000 - 0xffdfffff */
-#define CONSISTENT_DMA_SIZE (158 << 20)
-
 #endif /* __ASM_MACH_MEMORY_H */
diff --git a/arch/arm/mach-shmobile/board-ag5evm.c b/arch/arm/mach-shmobile/board-ag5evm.c
index ce5c251..167a67c 100644
--- a/arch/arm/mach-shmobile/board-ag5evm.c
+++ b/arch/arm/mach-shmobile/board-ag5evm.c
@@ -37,6 +37,7 @@
 #include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/mfd/tmio.h>
 #include <linux/sh_clk.h>
+#include <linux/dma-mapping.h>
 #include <video/sh_mobile_lcdc.h>
 #include <video/sh_mipi_dsi.h>
 #include <sound/sh_fsi.h>
@@ -446,6 +447,8 @@ static struct map_desc ag5evm_io_desc[] __initdata = {
 static void __init ag5evm_map_io(void)
 {
 	iotable_init(ag5evm_io_desc, ARRAY_SIZE(ag5evm_io_desc));
+	/* DMA memory at 0xf6000000 - 0xffdfffff */
+	init_consistent_dma_size(158 << 20);
 
 	/* setup early devices and console here as well */
 	sh73a0_add_early_devices();
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index 9e0856b..ec8f9d9 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -42,6 +42,7 @@
 #include <linux/leds.h>
 #include <linux/input/sh_keysc.h>
 #include <linux/usb/r8a66597.h>
+#include <linux/dma-mapping.h>
 
 #include <media/sh_mobile_ceu.h>
 #include <media/sh_mobile_csi2.h>
@@ -1170,6 +1171,8 @@ static struct map_desc ap4evb_io_desc[] __initdata = {
 static void __init ap4evb_map_io(void)
 {
 	iotable_init(ap4evb_io_desc, ARRAY_SIZE(ap4evb_io_desc));
+	/* DMA memory at 0xf6000000 - 0xffdfffff */
+	init_consistent_dma_size(158 << 20);
 
 	/* setup early devices and console here as well */
 	sh7372_add_early_devices();
diff --git a/arch/arm/mach-shmobile/board-g3evm.c b/arch/arm/mach-shmobile/board-g3evm.c
index ef4613b..8b620bf 100644
--- a/arch/arm/mach-shmobile/board-g3evm.c
+++ b/arch/arm/mach-shmobile/board-g3evm.c
@@ -32,6 +32,7 @@
 #include <linux/gpio.h>
 #include <linux/input.h>
 #include <linux/input/sh_keysc.h>
+#include <linux/dma-mapping.h>
 #include <mach/sh7367.h>
 #include <mach/common.h>
 #include <asm/mach-types.h>
@@ -260,6 +261,8 @@ static struct map_desc g3evm_io_desc[] __initdata = {
 static void __init g3evm_map_io(void)
 {
 	iotable_init(g3evm_io_desc, ARRAY_SIZE(g3evm_io_desc));
+	/* DMA memory at 0xf6000000 - 0xffdfffff */
+	init_consistent_dma_size(158 << 20);
 
 	/* setup early devices and console here as well */
 	sh7367_add_early_devices();
diff --git a/arch/arm/mach-shmobile/board-g4evm.c b/arch/arm/mach-shmobile/board-g4evm.c
index 8e3c555..7719ddc 100644
--- a/arch/arm/mach-shmobile/board-g4evm.c
+++ b/arch/arm/mach-shmobile/board-g4evm.c
@@ -33,6 +33,7 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/sh_mobile_sdhi.h>
 #include <linux/gpio.h>
+#include <linux/dma-mapping.h>
 #include <mach/sh7377.h>
 #include <mach/common.h>
 #include <asm/mach-types.h>
@@ -274,6 +275,8 @@ static struct map_desc g4evm_io_desc[] __initdata = {
 static void __init g4evm_map_io(void)
 {
 	iotable_init(g4evm_io_desc, ARRAY_SIZE(g4evm_io_desc));
+	/* DMA memory at 0xf6000000 - 0xffdfffff */
+	init_consistent_dma_size(158 << 20);
 
 	/* setup early devices and console here as well */
 	sh7377_add_early_devices();
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index d41c01f..671925d 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -45,6 +45,7 @@
 #include <linux/tca6416_keypad.h>
 #include <linux/usb/r8a66597.h>
 #include <linux/usb/renesas_usbhs.h>
+#include <linux/dma-mapping.h>
 
 #include <video/sh_mobile_hdmi.h>
 #include <video/sh_mobile_lcdc.h>
@@ -1377,6 +1378,8 @@ static struct map_desc mackerel_io_desc[] __initdata = {
 static void __init mackerel_map_io(void)
 {
 	iotable_init(mackerel_io_desc, ARRAY_SIZE(mackerel_io_desc));
+	/* DMA memory at 0xf6000000 - 0xffdfffff */
+	init_consistent_dma_size(158 << 20);
 
 	/* setup early devices and console here as well */
 	sh7372_add_early_devices();
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 12/12] ARM: Remove support for macro CONSISTENT_DMA_SIZE
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (10 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 11/12] ARM: mach-shmobile: " Jon Medhurst
@ 2011-08-08 14:28 ` Jon Medhurst
  2011-08-22 13:06 ` Submitting patchset: ARM: Remove define CONSISTENT_DMA_SIZE Tixy
  12 siblings, 0 replies; 30+ messages in thread
From: Jon Medhurst @ 2011-08-08 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

There are now no platforms which set this macro.

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
---
 arch/arm/mm/dma-mapping.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 5b59ce5..50be842 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -129,11 +129,7 @@ static void __dma_free_buffer(struct page *page, size_t size)
  */
 static pte_t **consistent_pte;
 
-#ifdef CONSISTENT_DMA_SIZE
-#define DEFAULT_CONSISTENT_DMA_SIZE CONSISTENT_DMA_SIZE
-#else
 #define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M
-#endif
 
 unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE;
 
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-08 14:28 ` [PATCH 06/12] ARM: mxc: " Jon Medhurst
@ 2011-08-08 16:47   ` Sascha Hauer
  2011-08-08 17:07     ` Tixy
  2011-08-18  3:12     ` Nicolas Pitre
  0 siblings, 2 replies; 30+ messages in thread
From: Sascha Hauer @ 2011-08-08 16:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jon,

On Mon, Aug 08, 2011 at 03:28:26PM +0100, Jon Medhurst wrote:
> Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> CC: Sascha Hauer <kernel@pengutronix.de>
> CC: Amit Kucheria <amit.kucheria@canonical.com>
> ---
>  arch/arm/plat-mxc/include/mach/common.h |    1 +
>  arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
>  arch/arm/mach-imx/mm-imx1.c             |    1 +
>  arch/arm/mach-imx/mm-imx21.c            |    1 +
>  arch/arm/mach-imx/mm-imx25.c            |    1 +
>  arch/arm/mach-imx/mm-imx27.c            |    1 +
>  arch/arm/mach-imx/mm-imx31.c            |    1 +
>  arch/arm/mach-imx/mm-imx35.c            |    1 +
>  arch/arm/mach-mx5/mm-mx50.c             |    1 +
>  arch/arm/mach-mx5/mm.c                  |    2 ++
>  arch/arm/plat-mxc/system.c              |   16 ++++++++++++++++
>  11 files changed, 26 insertions(+), 15 deletions(-)

Should the base patch be ok I'd like to rework this one. I want to
call init_consistent_dma_size on a per board base instead in a global
function with ifdeffery.

Sascha

> 
> diff --git a/arch/arm/plat-mxc/include/mach/common.h b/arch/arm/plat-mxc/include/mach/common.h
> index 4e3d978..40fb4d8 100644
> --- a/arch/arm/plat-mxc/include/mach/common.h
> +++ b/arch/arm/plat-mxc/include/mach/common.h
> @@ -72,4 +72,5 @@ extern void mxc_arch_reset_init(void __iomem *);
>  extern void mx51_efikamx_reset(void);
>  extern int mx53_revision(void);
>  extern int mx53_display_revision(void);
> +extern void __init mxc_init_consistent_dma_size(void);
>  #endif
> diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
> index 11be5cd..3ec84b9 100644
> --- a/arch/arm/plat-mxc/include/mach/memory.h
> +++ b/arch/arm/plat-mxc/include/mach/memory.h
> @@ -40,19 +40,4 @@
>  # endif
>  #endif
>  
> -#if defined(CONFIG_MX3_VIDEO)
> -/*
> - * Increase size of DMA-consistent memory region.
> - * This is required for mx3 camera driver to capture at least two QXGA frames.
> - */
> -#define CONSISTENT_DMA_SIZE SZ_8M
> -
> -#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
> -/*
> - * Increase size of DMA-consistent memory region.
> - * This is required for i.MX camera driver to capture at least four VGA frames.
> - */
> -#define CONSISTENT_DMA_SIZE SZ_4M
> -#endif /* CONFIG_MX1_VIDEO || CONFIG_VIDEO_MX2_HOSTSUPPORT */
> -
>  #endif /* __ASM_ARCH_MXC_MEMORY_H__ */
> diff --git a/arch/arm/mach-imx/mm-imx1.c b/arch/arm/mach-imx/mm-imx1.c
> index 2bded59..f70e318 100644
> --- a/arch/arm/mach-imx/mm-imx1.c
> +++ b/arch/arm/mach-imx/mm-imx1.c
> @@ -33,6 +33,7 @@ static struct map_desc imx_io_desc[] __initdata = {
>  void __init mx1_map_io(void)
>  {
>  	iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx1_init_early(void)
> diff --git a/arch/arm/mach-imx/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
> index 3f05dfe..440816a 100644
> --- a/arch/arm/mach-imx/mm-imx21.c
> +++ b/arch/arm/mach-imx/mm-imx21.c
> @@ -60,6 +60,7 @@ static struct map_desc imx21_io_desc[] __initdata = {
>  void __init mx21_map_io(void)
>  {
>  	iotable_init(imx21_io_desc, ARRAY_SIZE(imx21_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx21_init_early(void)
> diff --git a/arch/arm/mach-imx/mm-imx25.c b/arch/arm/mach-imx/mm-imx25.c
> index cc4d152..12f5759 100644
> --- a/arch/arm/mach-imx/mm-imx25.c
> +++ b/arch/arm/mach-imx/mm-imx25.c
> @@ -48,6 +48,7 @@ static struct map_desc mx25_io_desc[] __initdata = {
>  void __init mx25_map_io(void)
>  {
>  	iotable_init(mx25_io_desc, ARRAY_SIZE(mx25_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx25_init_early(void)
> diff --git a/arch/arm/mach-imx/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
> index 96dd1f5..8799265 100644
> --- a/arch/arm/mach-imx/mm-imx27.c
> +++ b/arch/arm/mach-imx/mm-imx27.c
> @@ -60,6 +60,7 @@ static struct map_desc imx27_io_desc[] __initdata = {
>  void __init mx27_map_io(void)
>  {
>  	iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx27_init_early(void)
> diff --git a/arch/arm/mach-imx/mm-imx31.c b/arch/arm/mach-imx/mm-imx31.c
> index b7c55e7..b2331cf 100644
> --- a/arch/arm/mach-imx/mm-imx31.c
> +++ b/arch/arm/mach-imx/mm-imx31.c
> @@ -45,6 +45,7 @@ static struct map_desc mx31_io_desc[] __initdata = {
>  void __init mx31_map_io(void)
>  {
>  	iotable_init(mx31_io_desc, ARRAY_SIZE(mx31_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx31_init_early(void)
> diff --git a/arch/arm/mach-imx/mm-imx35.c b/arch/arm/mach-imx/mm-imx35.c
> index f49bac7..eb60521 100644
> --- a/arch/arm/mach-imx/mm-imx35.c
> +++ b/arch/arm/mach-imx/mm-imx35.c
> @@ -41,6 +41,7 @@ static struct map_desc mx35_io_desc[] __initdata = {
>  void __init mx35_map_io(void)
>  {
>  	iotable_init(mx35_io_desc, ARRAY_SIZE(mx35_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx35_init_early(void)
> diff --git a/arch/arm/mach-mx5/mm-mx50.c b/arch/arm/mach-mx5/mm-mx50.c
> index 77e374c..04a02cc 100644
> --- a/arch/arm/mach-mx5/mm-mx50.c
> +++ b/arch/arm/mach-mx5/mm-mx50.c
> @@ -46,6 +46,7 @@ static struct map_desc mx50_io_desc[] __initdata = {
>  void __init mx50_map_io(void)
>  {
>  	iotable_init(mx50_io_desc, ARRAY_SIZE(mx50_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx50_init_early(void)
> diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
> index baea6e5..e0ca2b5 100644
> --- a/arch/arm/mach-mx5/mm.c
> +++ b/arch/arm/mach-mx5/mm.c
> @@ -49,6 +49,7 @@ static struct map_desc mx53_io_desc[] __initdata = {
>  void __init mx51_map_io(void)
>  {
>  	iotable_init(mx51_io_desc, ARRAY_SIZE(mx51_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx51_init_early(void)
> @@ -61,6 +62,7 @@ void __init imx51_init_early(void)
>  void __init mx53_map_io(void)
>  {
>  	iotable_init(mx53_io_desc, ARRAY_SIZE(mx53_io_desc));
> +	mxc_init_consistent_dma_size();
>  }
>  
>  void __init imx53_init_early(void)
> diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
> index 8024f2a..75d1592 100644
> --- a/arch/arm/plat-mxc/system.c
> +++ b/arch/arm/plat-mxc/system.c
> @@ -21,6 +21,7 @@
>  #include <linux/io.h>
>  #include <linux/err.h>
>  #include <linux/delay.h>
> +#include <linux/dma-mapping.h>
>  
>  #include <mach/hardware.h>
>  #include <mach/common.h>
> @@ -74,3 +75,18 @@ void mxc_arch_reset_init(void __iomem *base)
>  {
>  	wdog_base = base;
>  }
> +
> +void __init mxc_init_consistent_dma_size(void)
> +{
> +#if defined(CONFIG_MX3_VIDEO)
> +
> +	/* Required for mx3 camera driver to capture at least two QXGA frames */
> +	init_consistent_dma_size(SZ_8M);
> +
> +#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
> +
> +	/* Required for i.MX camera driver to capture at least 4 VGA frames */
> +	init_consistent_dma_size(SZ_4M);
> +
> +#endif
> +}
> -- 
> 1.7.2.5
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-08 16:47   ` Sascha Hauer
@ 2011-08-08 17:07     ` Tixy
  2011-08-18  3:12     ` Nicolas Pitre
  1 sibling, 0 replies; 30+ messages in thread
From: Tixy @ 2011-08-08 17:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2011-08-08 at 18:47 +0200, Sascha Hauer wrote:
> Hi Jon,
> 
> On Mon, Aug 08, 2011 at 03:28:26PM +0100, Jon Medhurst wrote:
> > Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> > CC: Sascha Hauer <kernel@pengutronix.de>
> > CC: Amit Kucheria <amit.kucheria@canonical.com>
> > ---
> >  arch/arm/plat-mxc/include/mach/common.h |    1 +
> >  arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
> >  arch/arm/mach-imx/mm-imx1.c             |    1 +
> >  arch/arm/mach-imx/mm-imx21.c            |    1 +
> >  arch/arm/mach-imx/mm-imx25.c            |    1 +
> >  arch/arm/mach-imx/mm-imx27.c            |    1 +
> >  arch/arm/mach-imx/mm-imx31.c            |    1 +
> >  arch/arm/mach-imx/mm-imx35.c            |    1 +
> >  arch/arm/mach-mx5/mm-mx50.c             |    1 +
> >  arch/arm/mach-mx5/mm.c                  |    2 ++
> >  arch/arm/plat-mxc/system.c              |   16 ++++++++++++++++
> >  11 files changed, 26 insertions(+), 15 deletions(-)
> 
> Should the base patch be ok I'd like to rework this one. I want to
> call init_consistent_dma_size on a per board base instead in a global
> function with ifdeffery.

Yes, that would be the a better way. I started down that route myself
but realised I didn't have the confidence to be certain which video
drivers and config options were valid with which platforms. So I played
safe and kept the existing behaviour.

-- 
Jon (often known as Tixy)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 09/12] ARM: mach-at91: Setup consistent dma size at boot time
  2011-08-08 14:28 ` [PATCH 09/12] ARM: mach-at91: " Jon Medhurst
@ 2011-08-08 19:52   ` Nicolas Ferre
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolas Ferre @ 2011-08-08 19:52 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/08/2011 03:28 PM, Jon Medhurst wrote:
> Signed-off-by: Jon Medhurst<tixy@yxit.co.uk>
> CC: Nicolas Ferre<nicolas.ferre@atmel.com>

Thanks,

Acked-by: Nicolas Ferre<nicolas.ferre@atmel.com>

> ---
>   arch/arm/mach-at91/include/mach/at91sam9g45.h |    2 --
>   arch/arm/mach-at91/at91sam9g45.c              |    2 ++
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h
> index 2c611b9..406bb64 100644
> --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h
> +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h
> @@ -128,8 +128,6 @@
>   #define AT91SAM9G45_EHCI_BASE	0x00800000	/* USB Host controller (EHCI) */
>   #define AT91SAM9G45_VDEC_BASE	0x00900000	/* Video Decoder Controller */
>
> -#define CONSISTENT_DMA_SIZE	SZ_4M
> -
>   /*
>    * DMA peripheral identifiers
>    * for hardware handshaking interface
> diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
> index e04c5fb..1532b50 100644
> --- a/arch/arm/mach-at91/at91sam9g45.c
> +++ b/arch/arm/mach-at91/at91sam9g45.c
> @@ -12,6 +12,7 @@
>
>   #include<linux/module.h>
>   #include<linux/pm.h>
> +#include<linux/dma-mapping.h>
>
>   #include<asm/irq.h>
>   #include<asm/mach/arch.h>
> @@ -319,6 +320,7 @@ static void at91sam9g45_poweroff(void)
>   static void __init at91sam9g45_map_io(void)
>   {
>   	at91_init_sram(0, AT91SAM9G45_SRAM_BASE, AT91SAM9G45_SRAM_SIZE);
> +	init_consistent_dma_size(SZ_4M);
>   }
>
>   static void __init at91sam9g45_initialize(void)


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 08/12] ARM: mach-u300: Setup consistent dma size at boot time
  2011-08-08 14:28 ` [PATCH 08/12] ARM: mach-u300: " Jon Medhurst
@ 2011-08-09  9:31   ` Linus Walleij
  0 siblings, 0 replies; 30+ messages in thread
From: Linus Walleij @ 2011-08-09  9:31 UTC (permalink / raw)
  To: linux-arm-kernel

On 08/08/2011 04:28 PM, Jon Medhurst wrote:
> Signed-off-by: Jon Medhurst<tixy@yxit.co.uk>
> CC: Linus Walleij<linus.walleij@stericsson.com>
>    
Acked-by: Linus Walleij <linus.walleij@stericsson.com>

Thanks!
Linus Walleij

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 05/12] ARM: mach-s5pv210: Setup consistent dma size at boot time
  2011-08-08 14:28 ` [PATCH 05/12] ARM: mach-s5pv210: " Jon Medhurst
@ 2011-08-11 12:50   ` Pavel Machek
  2011-08-11 13:08     ` Tixy
  0 siblings, 1 reply; 30+ messages in thread
From: Pavel Machek @ 2011-08-11 12:50 UTC (permalink / raw)
  To: linux-arm-kernel



> -#define CONSISTENT_DMA_SIZE	(SZ_8M + SZ_4M + SZ_2M)
...
> +	init_consistent_dma_size(14 << 20);

Are you sure that's equivalent?
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 05/12] ARM: mach-s5pv210: Setup consistent dma size at boot time
  2011-08-11 12:50   ` Pavel Machek
@ 2011-08-11 13:08     ` Tixy
  2011-08-12 15:09       ` Pavel Machek
  0 siblings, 1 reply; 30+ messages in thread
From: Tixy @ 2011-08-11 13:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2011-08-11 at 14:50 +0200, Pavel Machek wrote:
> 
> > -#define CONSISTENT_DMA_SIZE	(SZ_8M + SZ_4M + SZ_2M)
> ...
> > +	init_consistent_dma_size(14 << 20);
> 
> Are you sure that's equivalent?

Yes. From include/asm-generic/sizes.h

#define SZ_2M				0x00200000
#define SZ_4M				0x00400000
#define SZ_8M				0x00800000

The max DMA size seems to be have been defined as 14MB at some point and
several platforms define the size to be this value, but in different
ways:

	SZ_16M - SZ_2M
	SZ_8M + SZ_4M + SZ_2M
	14 << 20

I chose to use just one for consistency, and (14 << 20) seemed clearer
to me.

-- 
Jon (a.k.a. Tixy)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 05/12] ARM: mach-s5pv210: Setup consistent dma size at boot time
  2011-08-11 13:08     ` Tixy
@ 2011-08-12 15:09       ` Pavel Machek
  0 siblings, 0 replies; 30+ messages in thread
From: Pavel Machek @ 2011-08-12 15:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu 2011-08-11 14:08:09, Tixy wrote:
> On Thu, 2011-08-11 at 14:50 +0200, Pavel Machek wrote:
> > 
> > > -#define CONSISTENT_DMA_SIZE	(SZ_8M + SZ_4M + SZ_2M)
> > ...
> > > +	init_consistent_dma_size(14 << 20);
> > 
> > Are you sure that's equivalent?
> 
> Yes. From include/asm-generic/sizes.h
> 
> #define SZ_2M				0x00200000
> #define SZ_4M				0x00400000
> #define SZ_8M				0x00800000
> 
> The max DMA size seems to be have been defined as 14MB at some point and
> several platforms define the size to be this value, but in different
> ways:
> 
> 	SZ_16M - SZ_2M
> 	SZ_8M + SZ_4M + SZ_2M
> 	14 << 20
> 
> I chose to use just one for consistency, and (14 << 20) seemed clearer
> to me.

I missed the "4" in "14". Doing 14 *1024*1024 would be more usual way
of writing this...

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-08 16:47   ` Sascha Hauer
  2011-08-08 17:07     ` Tixy
@ 2011-08-18  3:12     ` Nicolas Pitre
  2011-08-18  8:13       ` Tixy
  1 sibling, 1 reply; 30+ messages in thread
From: Nicolas Pitre @ 2011-08-18  3:12 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 8 Aug 2011, Sascha Hauer wrote:

> Hi Jon,
> 
> On Mon, Aug 08, 2011 at 03:28:26PM +0100, Jon Medhurst wrote:
> > Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> > CC: Sascha Hauer <kernel@pengutronix.de>
> > CC: Amit Kucheria <amit.kucheria@canonical.com>
> > ---
> >  arch/arm/plat-mxc/include/mach/common.h |    1 +
> >  arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
> >  arch/arm/mach-imx/mm-imx1.c             |    1 +
> >  arch/arm/mach-imx/mm-imx21.c            |    1 +
> >  arch/arm/mach-imx/mm-imx25.c            |    1 +
> >  arch/arm/mach-imx/mm-imx27.c            |    1 +
> >  arch/arm/mach-imx/mm-imx31.c            |    1 +
> >  arch/arm/mach-imx/mm-imx35.c            |    1 +
> >  arch/arm/mach-mx5/mm-mx50.c             |    1 +
> >  arch/arm/mach-mx5/mm.c                  |    2 ++
> >  arch/arm/plat-mxc/system.c              |   16 ++++++++++++++++
> >  11 files changed, 26 insertions(+), 15 deletions(-)
> 
> Should the base patch be ok I'd like to rework this one. I want to
> call init_consistent_dma_size on a per board base instead in a global
> function with ifdeffery.

Hello Sascha,

Did you manage to work on this?  Ideally it would be nice to have a 
reworked patch from you that could be used in this series as some later 
patches depend on this series.

Thanks.


Nicolas

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-18  3:12     ` Nicolas Pitre
@ 2011-08-18  8:13       ` Tixy
  2011-08-18 18:51         ` Sascha Hauer
  0 siblings, 1 reply; 30+ messages in thread
From: Tixy @ 2011-08-18  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2011-08-17 at 23:12 -0400, Nicolas Pitre wrote:
> On Mon, 8 Aug 2011, Sascha Hauer wrote:
> 
> > Hi Jon,
> > 
> > On Mon, Aug 08, 2011 at 03:28:26PM +0100, Jon Medhurst wrote:
> > > Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> > > CC: Sascha Hauer <kernel@pengutronix.de>
> > > CC: Amit Kucheria <amit.kucheria@canonical.com>
> > > ---
> > >  arch/arm/plat-mxc/include/mach/common.h |    1 +
> > >  arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
> > >  arch/arm/mach-imx/mm-imx1.c             |    1 +
> > >  arch/arm/mach-imx/mm-imx21.c            |    1 +
> > >  arch/arm/mach-imx/mm-imx25.c            |    1 +
> > >  arch/arm/mach-imx/mm-imx27.c            |    1 +
> > >  arch/arm/mach-imx/mm-imx31.c            |    1 +
> > >  arch/arm/mach-imx/mm-imx35.c            |    1 +
> > >  arch/arm/mach-mx5/mm-mx50.c             |    1 +
> > >  arch/arm/mach-mx5/mm.c                  |    2 ++
> > >  arch/arm/plat-mxc/system.c              |   16 ++++++++++++++++
> > >  11 files changed, 26 insertions(+), 15 deletions(-)
> > 
> > Should the base patch be ok I'd like to rework this one. I want to
> > call init_consistent_dma_size on a per board base instead in a global
> > function with ifdeffery.
> 
> Hello Sascha,
> 
> Did you manage to work on this?  Ideally it would be nice to have a 
> reworked patch from you that could be used in this series as some later 
> patches depend on this series.

Are we happy with the base patch? Specifically, having
init_consistent_dma_size() declaired in include/asm/dma-mapping.h?

If so, I don't mind making the changes if Sascha can give me some rules
and pattern to apply. E.g. is it

In mach-imx/mm-imx2*.c

#if defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
	init_consistent_dma_size(SZ_4M);
#endif

And likewise with CONFIG_MX1_VIDEO in mach-imx/mm-imx1.c and
CONFIG_MX3_VIDEO in mach-imx/mm-imx3*.c.

What about mach-mx5?

-- 
Tixy

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 01/12] ARM: Add init_consistent_dma_size()
  2011-08-08 14:28 ` [PATCH 01/12] ARM: Add init_consistent_dma_size() Jon Medhurst
@ 2011-08-18 13:02   ` Nicolas Pitre
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolas Pitre @ 2011-08-18 13:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 8 Aug 2011, Jon Medhurst wrote:

> This function can be called during boot to increase the size of the consistent
> DMA region above it's default value of 2MB. It must be called before the memory
> allocator is initialised, i.e. before any core_initcall.
> 
> Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>

I'd add a comment above the declaration for init_consistent_dma_size() 
repeating the above commit message so it is clearer what this call does 
without having to look up the git history log.  Otherwise you can add:

Acked-by: Nicolas Pitre <nicolas.pitre@linaro.org>

> ---
>  arch/arm/include/asm/dma-mapping.h |    3 ++
>  arch/arm/include/asm/memory.h      |    9 ------
>  arch/arm/mm/dma-mapping.c          |   49 +++++++++++++++++++++++++++--------
>  arch/arm/mm/init.c                 |    9 ------
>  4 files changed, 41 insertions(+), 29 deletions(-)
> 
> diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
> index 7a21d0b..328416b 100644
> --- a/arch/arm/include/asm/dma-mapping.h
> +++ b/arch/arm/include/asm/dma-mapping.h
> @@ -206,6 +206,9 @@ int dma_mmap_writecombine(struct device *, struct vm_area_struct *,
>  		void *, dma_addr_t, size_t);
>  
>  
> +extern void __init init_consistent_dma_size(unsigned long size);
> +
> +
>  #ifdef CONFIG_DMABOUNCE
>  /*
>   * For SA-1111, IXP425, and ADI systems  the dma-mapping functions are "magic"
> diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
> index b8de516..652fccc 100644
> --- a/arch/arm/include/asm/memory.h
> +++ b/arch/arm/include/asm/memory.h
> @@ -77,16 +77,7 @@
>   */
>  #define IOREMAP_MAX_ORDER	24
>  
> -/*
> - * Size of DMA-consistent memory region.  Must be multiple of 2M,
> - * between 2MB and 14MB inclusive.
> - */
> -#ifndef CONSISTENT_DMA_SIZE
> -#define CONSISTENT_DMA_SIZE 	SZ_2M
> -#endif
> -
>  #define CONSISTENT_END		(0xffe00000UL)
> -#define CONSISTENT_BASE		(CONSISTENT_END - CONSISTENT_DMA_SIZE)
>  
>  #else /* CONFIG_MMU */
>  
> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
> index 0a0a1e7..5b59ce5 100644
> --- a/arch/arm/mm/dma-mapping.c
> +++ b/arch/arm/mm/dma-mapping.c
> @@ -18,12 +18,14 @@
>  #include <linux/device.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/highmem.h>
> +#include <linux/slab.h>
>  
>  #include <asm/memory.h>
>  #include <asm/highmem.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
>  #include <asm/sizes.h>
> +#include <asm/mach/arch.h>
>  
>  #include "mm.h"
>  
> @@ -117,26 +119,41 @@ static void __dma_free_buffer(struct page *page, size_t size)
>  }
>  
>  #ifdef CONFIG_MMU
> -/* Sanity check size */
> -#if (CONSISTENT_DMA_SIZE % SZ_2M)
> -#error "CONSISTENT_DMA_SIZE must be multiple of 2MiB"
> -#endif
>  
> -#define CONSISTENT_OFFSET(x)	(((unsigned long)(x) - CONSISTENT_BASE) >> PAGE_SHIFT)
> -#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - CONSISTENT_BASE) >> PGDIR_SHIFT)
> -#define NUM_CONSISTENT_PTES (CONSISTENT_DMA_SIZE >> PGDIR_SHIFT)
> +
> +#define CONSISTENT_OFFSET(x)	(((unsigned long)(x) - consistent_base) >> PAGE_SHIFT)
> +#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PGDIR_SHIFT)
>  
>  /*
>   * These are the page tables (2MB each) covering uncached, DMA consistent allocations
>   */
> -static pte_t *consistent_pte[NUM_CONSISTENT_PTES];
> +static pte_t **consistent_pte;
> +
> +#ifdef CONSISTENT_DMA_SIZE
> +#define DEFAULT_CONSISTENT_DMA_SIZE CONSISTENT_DMA_SIZE
> +#else
> +#define DEFAULT_CONSISTENT_DMA_SIZE SZ_2M
> +#endif
> +
> +unsigned long consistent_base = CONSISTENT_END - DEFAULT_CONSISTENT_DMA_SIZE;
> +
> +void __init init_consistent_dma_size(unsigned long size)
> +{
> +	unsigned long base = CONSISTENT_END - ALIGN(size, SZ_2M);
> +
> +	BUG_ON(consistent_pte); /* Check we're called before DMA region init */
> +	BUG_ON(base < VMALLOC_END);
> +
> +	/* Grow region to accommodate specified size  */
> +	if (base < consistent_base)
> +		consistent_base = base;
> +}
>  
>  #include "vmregion.h"
>  
>  static struct arm_vmregion_head consistent_head = {
>  	.vm_lock	= __SPIN_LOCK_UNLOCKED(&consistent_head.vm_lock),
>  	.vm_list	= LIST_HEAD_INIT(consistent_head.vm_list),
> -	.vm_start	= CONSISTENT_BASE,
>  	.vm_end		= CONSISTENT_END,
>  };
>  
> @@ -155,7 +172,17 @@ static int __init consistent_init(void)
>  	pmd_t *pmd;
>  	pte_t *pte;
>  	int i = 0;
> -	u32 base = CONSISTENT_BASE;
> +	unsigned long base = consistent_base;
> +	unsigned long num_ptes = (CONSISTENT_END - base) >> PGDIR_SHIFT;
> +
> +	consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL);
> +	if (!consistent_pte) {
> +		pr_err("%s: no memory\n", __func__);
> +		return -ENOMEM;
> +	}
> +
> +	pr_debug("DMA memory: 0x%08lx - 0x%08lx:\n", base, CONSISTENT_END);
> +	consistent_head.vm_start = base;
>  
>  	do {
>  		pgd = pgd_offset(&init_mm, base);
> @@ -198,7 +225,7 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
>  	size_t align;
>  	int bit;
>  
> -	if (!consistent_pte[0]) {
> +	if (!consistent_pte) {
>  		printk(KERN_ERR "%s: not initialised\n", __func__);
>  		dump_stack();
>  		return NULL;
> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> index 2fee782..2a7c173 100644
> --- a/arch/arm/mm/init.c
> +++ b/arch/arm/mm/init.c
> @@ -653,9 +653,6 @@ void __init mem_init(void)
>  			"    ITCM    : 0x%08lx - 0x%08lx   (%4ld kB)\n"
>  #endif
>  			"    fixmap  : 0x%08lx - 0x%08lx   (%4ld kB)\n"
> -#ifdef CONFIG_MMU
> -			"    DMA     : 0x%08lx - 0x%08lx   (%4ld MB)\n"
> -#endif
>  			"    vmalloc : 0x%08lx - 0x%08lx   (%4ld MB)\n"
>  			"    lowmem  : 0x%08lx - 0x%08lx   (%4ld MB)\n"
>  #ifdef CONFIG_HIGHMEM
> @@ -674,9 +671,6 @@ void __init mem_init(void)
>  			MLK(ITCM_OFFSET, (unsigned long) itcm_end),
>  #endif
>  			MLK(FIXADDR_START, FIXADDR_TOP),
> -#ifdef CONFIG_MMU
> -			MLM(CONSISTENT_BASE, CONSISTENT_END),
> -#endif
>  			MLM(VMALLOC_START, VMALLOC_END),
>  			MLM(PAGE_OFFSET, (unsigned long)high_memory),
>  #ifdef CONFIG_HIGHMEM
> @@ -699,9 +693,6 @@ void __init mem_init(void)
>  	 * be detected at build time already.
>  	 */
>  #ifdef CONFIG_MMU
> -	BUILD_BUG_ON(VMALLOC_END			> CONSISTENT_BASE);
> -	BUG_ON(VMALLOC_END				> CONSISTENT_BASE);
> -
>  	BUILD_BUG_ON(TASK_SIZE				> MODULES_VADDR);
>  	BUG_ON(TASK_SIZE 				> MODULES_VADDR);
>  #endif
> -- 
> 1.7.2.5
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-18  8:13       ` Tixy
@ 2011-08-18 18:51         ` Sascha Hauer
  2011-08-19  9:08           ` Tixy
  0 siblings, 1 reply; 30+ messages in thread
From: Sascha Hauer @ 2011-08-18 18:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Aug 18, 2011 at 09:13:36AM +0100, Tixy wrote:
> On Wed, 2011-08-17 at 23:12 -0400, Nicolas Pitre wrote:
> > On Mon, 8 Aug 2011, Sascha Hauer wrote:
> > 
> > > Hi Jon,
> > > 
> > > On Mon, Aug 08, 2011 at 03:28:26PM +0100, Jon Medhurst wrote:
> > > > Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> > > > CC: Sascha Hauer <kernel@pengutronix.de>
> > > > CC: Amit Kucheria <amit.kucheria@canonical.com>
> > > > ---
> > > >  arch/arm/plat-mxc/include/mach/common.h |    1 +
> > > >  arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
> > > >  arch/arm/mach-imx/mm-imx1.c             |    1 +
> > > >  arch/arm/mach-imx/mm-imx21.c            |    1 +
> > > >  arch/arm/mach-imx/mm-imx25.c            |    1 +
> > > >  arch/arm/mach-imx/mm-imx27.c            |    1 +
> > > >  arch/arm/mach-imx/mm-imx31.c            |    1 +
> > > >  arch/arm/mach-imx/mm-imx35.c            |    1 +
> > > >  arch/arm/mach-mx5/mm-mx50.c             |    1 +
> > > >  arch/arm/mach-mx5/mm.c                  |    2 ++
> > > >  arch/arm/plat-mxc/system.c              |   16 ++++++++++++++++
> > > >  11 files changed, 26 insertions(+), 15 deletions(-)
> > > 
> > > Should the base patch be ok I'd like to rework this one. I want to
> > > call init_consistent_dma_size on a per board base instead in a global
> > > function with ifdeffery.
> > 
> > Hello Sascha,
> > 
> > Did you manage to work on this?  Ideally it would be nice to have a 
> > reworked patch from you that could be used in this series as some later 
> > patches depend on this series.
> 
> Are we happy with the base patch? Specifically, having
> init_consistent_dma_size() declaired in include/asm/dma-mapping.h?
> 
> If so, I don't mind making the changes if Sascha can give me some rules
> and pattern to apply. E.g. is it
> 
> In mach-imx/mm-imx2*.c
> 
> #if defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
> 	init_consistent_dma_size(SZ_4M);
> #endif
> 
> And likewise with CONFIG_MX1_VIDEO in mach-imx/mm-imx1.c and
> CONFIG_MX3_VIDEO in mach-imx/mm-imx3*.c.
> 
> What about mach-mx5?

Sorry, I forgot about this issue. The solution is really simple: All
boards in tree using video use memblock_* functions to get their
coherent dma space for the camera. So we can just remove all
CONSISTENT_DMA_SIZE defines in arch/arm/plat-mxc/include/mach/memory.h.

If I understand your patch correctly we get a default size of 2MiB
when init_consistent_dma_size() is not called. That's fine for the other
i.MX boards.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-18 18:51         ` Sascha Hauer
@ 2011-08-19  9:08           ` Tixy
  2011-08-19 17:00             ` Sascha Hauer
  0 siblings, 1 reply; 30+ messages in thread
From: Tixy @ 2011-08-19  9:08 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2011-08-18 at 20:51 +0200, Sascha Hauer wrote:
> On Thu, Aug 18, 2011 at 09:13:36AM +0100, Tixy wrote:
> > On Wed, 2011-08-17 at 23:12 -0400, Nicolas Pitre wrote:
> > > On Mon, 8 Aug 2011, Sascha Hauer wrote:
> > > 
> > > > Hi Jon,
> > > > 
> > > > On Mon, Aug 08, 2011 at 03:28:26PM +0100, Jon Medhurst wrote:
> > > > > Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> > > > > CC: Sascha Hauer <kernel@pengutronix.de>
> > > > > CC: Amit Kucheria <amit.kucheria@canonical.com>
> > > > > ---
> > > > >  arch/arm/plat-mxc/include/mach/common.h |    1 +
> > > > >  arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
> > > > >  arch/arm/mach-imx/mm-imx1.c             |    1 +
> > > > >  arch/arm/mach-imx/mm-imx21.c            |    1 +
> > > > >  arch/arm/mach-imx/mm-imx25.c            |    1 +
> > > > >  arch/arm/mach-imx/mm-imx27.c            |    1 +
> > > > >  arch/arm/mach-imx/mm-imx31.c            |    1 +
> > > > >  arch/arm/mach-imx/mm-imx35.c            |    1 +
> > > > >  arch/arm/mach-mx5/mm-mx50.c             |    1 +
> > > > >  arch/arm/mach-mx5/mm.c                  |    2 ++
> > > > >  arch/arm/plat-mxc/system.c              |   16 ++++++++++++++++
> > > > >  11 files changed, 26 insertions(+), 15 deletions(-)
> > > > 
> > > > Should the base patch be ok I'd like to rework this one. I want to
> > > > call init_consistent_dma_size on a per board base instead in a global
> > > > function with ifdeffery.
> > > 
> > > Hello Sascha,
> > > 
> > > Did you manage to work on this?  Ideally it would be nice to have a 
> > > reworked patch from you that could be used in this series as some later 
> > > patches depend on this series.
> > 
> > Are we happy with the base patch? Specifically, having
> > init_consistent_dma_size() declaired in include/asm/dma-mapping.h?
> > 
> > If so, I don't mind making the changes if Sascha can give me some rules
> > and pattern to apply. E.g. is it
> > 
> > In mach-imx/mm-imx2*.c
> > 
> > #if defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
> > 	init_consistent_dma_size(SZ_4M);
> > #endif
> > 
> > And likewise with CONFIG_MX1_VIDEO in mach-imx/mm-imx1.c and
> > CONFIG_MX3_VIDEO in mach-imx/mm-imx3*.c.
> > 
> > What about mach-mx5?
> 
> Sorry, I forgot about this issue. The solution is really simple: All
> boards in tree using video use memblock_* functions to get their
> coherent dma space for the camera. So we can just remove all
> CONSISTENT_DMA_SIZE defines in arch/arm/plat-mxc/include/mach/memory.h.
> 
> If I understand your patch correctly we get a default size of 2MiB
> when init_consistent_dma_size() is not called. That's fine for the other
> i.MX boards.

Just to make sure I've understood. I see memblock_ calls in
	mach-mx31_3ds.c
	mach-pcm037.c
	mach-mx31moboard.c
these all seem to be mx3 related.

For mx1 and mx2, these currently increase CONSISTENT_DMA_SIZE to 4MB,
but the 2MB default is actually big enough for these?

Therefore, as you said, we can just delete the definitions of
CONSISTENT_DMA_SIZE from memory.h and leave all other imx and mx5 files
unchanged.

Thanks.

-- 
Tixy

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-19  9:08           ` Tixy
@ 2011-08-19 17:00             ` Sascha Hauer
  2011-08-22 11:05               ` Tixy
  0 siblings, 1 reply; 30+ messages in thread
From: Sascha Hauer @ 2011-08-19 17:00 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 19, 2011 at 10:08:21AM +0100, Tixy wrote:
> > Sorry, I forgot about this issue. The solution is really simple: All
> > boards in tree using video use memblock_* functions to get their
> > coherent dma space for the camera. So we can just remove all
> > CONSISTENT_DMA_SIZE defines in arch/arm/plat-mxc/include/mach/memory.h.
> > 
> > If I understand your patch correctly we get a default size of 2MiB
> > when init_consistent_dma_size() is not called. That's fine for the other
> > i.MX boards.
> 
> Just to make sure I've understood. I see memblock_ calls in
> 	mach-mx31_3ds.c
> 	mach-pcm037.c
> 	mach-mx31moboard.c
> these all seem to be mx3 related.
> 
> For mx1 and mx2, these currently increase CONSISTENT_DMA_SIZE to 4MB,
> but the 2MB default is actually big enough for these?

It should be bigger for boards which make use of the camera driver, but
no mx1/2 board in the tree currently registers the camera.

> 
> Therefore, as you said, we can just delete the definitions of
> CONSISTENT_DMA_SIZE from memory.h and leave all other imx and mx5 files
> unchanged.

Yes

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-19 17:00             ` Sascha Hauer
@ 2011-08-22 11:05               ` Tixy
  2011-08-22 11:37                 ` Sascha Hauer
  0 siblings, 1 reply; 30+ messages in thread
From: Tixy @ 2011-08-22 11:05 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sascha, does the following revised patch gain receive your
Acked-by?...

From: Jon Medhurst <tixy@yxit.co.uk>

All in tree MX boards using video use memblock_* functions to get their coherent
dma space for the camera, so there is no need to increase CONSISTENT_DMA_SIZE
beyond the default and we can simply remove the defines which do this.

Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
CC: Sascha Hauer <kernel@pengutronix.de>
---
 arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
 1 files changed, 0 insertions(+), 15 deletions(-)

diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
index 11be5cd..3ec84b9 100644
--- a/arch/arm/plat-mxc/include/mach/memory.h
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -40,19 +40,4 @@
 # endif
 #endif
 
-#if defined(CONFIG_MX3_VIDEO)
-/*
- * Increase size of DMA-consistent memory region.
- * This is required for mx3 camera driver to capture at least two QXGA frames.
- */
-#define CONSISTENT_DMA_SIZE SZ_8M
-
-#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
-/*
- * Increase size of DMA-consistent memory region.
- * This is required for i.MX camera driver to capture at least four VGA frames.
- */
-#define CONSISTENT_DMA_SIZE SZ_4M
-#endif /* CONFIG_MX1_VIDEO || CONFIG_VIDEO_MX2_HOSTSUPPORT */
-
 #endif /* __ASM_ARCH_MXC_MEMORY_H__ */
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 06/12] ARM: mxc: Setup consistent dma size at boot time
  2011-08-22 11:05               ` Tixy
@ 2011-08-22 11:37                 ` Sascha Hauer
  0 siblings, 0 replies; 30+ messages in thread
From: Sascha Hauer @ 2011-08-22 11:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Aug 22, 2011 at 12:05:50PM +0100, Tixy wrote:
> Hi Sascha, does the following revised patch gain receive your
> Acked-by?...
> 
> From: Jon Medhurst <tixy@yxit.co.uk>
> 
> All in tree MX boards using video use memblock_* functions to get their coherent
> dma space for the camera, so there is no need to increase CONSISTENT_DMA_SIZE
> beyond the default and we can simply remove the defines which do this.
> 
> Signed-off-by: Jon Medhurst <tixy@yxit.co.uk>
> CC: Sascha Hauer <kernel@pengutronix.de>

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

> ---
>  arch/arm/plat-mxc/include/mach/memory.h |   15 ---------------
>  1 files changed, 0 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
> index 11be5cd..3ec84b9 100644
> --- a/arch/arm/plat-mxc/include/mach/memory.h
> +++ b/arch/arm/plat-mxc/include/mach/memory.h
> @@ -40,19 +40,4 @@
>  # endif
>  #endif
>  
> -#if defined(CONFIG_MX3_VIDEO)
> -/*
> - * Increase size of DMA-consistent memory region.
> - * This is required for mx3 camera driver to capture at least two QXGA frames.
> - */
> -#define CONSISTENT_DMA_SIZE SZ_8M
> -
> -#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
> -/*
> - * Increase size of DMA-consistent memory region.
> - * This is required for i.MX camera driver to capture at least four VGA frames.
> - */
> -#define CONSISTENT_DMA_SIZE SZ_4M
> -#endif /* CONFIG_MX1_VIDEO || CONFIG_VIDEO_MX2_HOSTSUPPORT */
> -
>  #endif /* __ASM_ARCH_MXC_MEMORY_H__ */
> -- 
> 1.7.2.5
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Submitting patchset: ARM: Remove define CONSISTENT_DMA_SIZE
  2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
                   ` (11 preceding siblings ...)
  2011-08-08 14:28 ` [PATCH 12/12] ARM: Remove support for macro CONSISTENT_DMA_SIZE Jon Medhurst
@ 2011-08-22 13:06 ` Tixy
  2011-08-22 13:59   ` Nicolas Pitre
  12 siblings, 1 reply; 30+ messages in thread
From: Tixy @ 2011-08-22 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

I was wondering how I should submit the patches for removing
CONSISTENT_DMA_SIZE. Following on from the thread in linux-arm-kernel
titled "Patch Merging Path - RMK or Arnd?" [1], I'm guessing...

- Patch one, "ARM: Add init_consistent_dma_size()" to go into RMK's tree
- All the patches to go into the arm-soc tree

Or do we have a plan to bundle up the cleanup patches for the single
zImage work?

-- 
Tixy

[1] http://www.spinics.net/lists/arm-kernel/msg137059.html

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Submitting patchset: ARM: Remove define CONSISTENT_DMA_SIZE
  2011-08-22 13:06 ` Submitting patchset: ARM: Remove define CONSISTENT_DMA_SIZE Tixy
@ 2011-08-22 13:59   ` Nicolas Pitre
  0 siblings, 0 replies; 30+ messages in thread
From: Nicolas Pitre @ 2011-08-22 13:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 22 Aug 2011, Tixy wrote:

> I was wondering how I should submit the patches for removing
> CONSISTENT_DMA_SIZE. Following on from the thread in linux-arm-kernel
> titled "Patch Merging Path - RMK or Arnd?" [1], I'm guessing...
> 
> - Patch one, "ARM: Add init_consistent_dma_size()" to go into RMK's tree
> - All the patches to go into the arm-soc tree
> 
> Or do we have a plan to bundle up the cleanup patches for the single
> zImage work?

Even if this is touching mostly platform code, the concept is enforced 
in core code.  I would therefore recommend that you send RMK a pull 
request.  Either he'll just pull it, or he'll ask you to bounce it to 
Arnd.


Nicolas

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2011-08-22 13:59 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-08 14:28 [PATCH 0/12] ARM: Remove define CONSISTENT_DMA_SIZE Jon Medhurst
2011-08-08 14:28 ` [PATCH 01/12] ARM: Add init_consistent_dma_size() Jon Medhurst
2011-08-18 13:02   ` Nicolas Pitre
2011-08-08 14:28 ` [PATCH 02/12] ARM: omap: Setup consistent dma size at boot time Jon Medhurst
2011-08-08 14:28 ` [PATCH 03/12] ARM: mach-s3c64xx: " Jon Medhurst
2011-08-08 14:28 ` [PATCH 04/12] ARM: mach-s5p64x0: " Jon Medhurst
2011-08-08 14:28 ` [PATCH 05/12] ARM: mach-s5pv210: " Jon Medhurst
2011-08-11 12:50   ` Pavel Machek
2011-08-11 13:08     ` Tixy
2011-08-12 15:09       ` Pavel Machek
2011-08-08 14:28 ` [PATCH 06/12] ARM: mxc: " Jon Medhurst
2011-08-08 16:47   ` Sascha Hauer
2011-08-08 17:07     ` Tixy
2011-08-18  3:12     ` Nicolas Pitre
2011-08-18  8:13       ` Tixy
2011-08-18 18:51         ` Sascha Hauer
2011-08-19  9:08           ` Tixy
2011-08-19 17:00             ` Sascha Hauer
2011-08-22 11:05               ` Tixy
2011-08-22 11:37                 ` Sascha Hauer
2011-08-08 14:28 ` [PATCH 07/12] ARM: mach-davinci: " Jon Medhurst
2011-08-08 14:28 ` [PATCH 08/12] ARM: mach-u300: " Jon Medhurst
2011-08-09  9:31   ` Linus Walleij
2011-08-08 14:28 ` [PATCH 09/12] ARM: mach-at91: " Jon Medhurst
2011-08-08 19:52   ` Nicolas Ferre
2011-08-08 14:28 ` [PATCH 10/12] ARM: mach-bcmring: " Jon Medhurst
2011-08-08 14:28 ` [PATCH 11/12] ARM: mach-shmobile: " Jon Medhurst
2011-08-08 14:28 ` [PATCH 12/12] ARM: Remove support for macro CONSISTENT_DMA_SIZE Jon Medhurst
2011-08-22 13:06 ` Submitting patchset: ARM: Remove define CONSISTENT_DMA_SIZE Tixy
2011-08-22 13:59   ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).