[05/12] ARM: mach-s5pv210: Setup consistent dma size at boot time
diff mbox

Message ID 1312813712-22808-6-git-send-email-tixy@yxit.co.uk
State New, archived
Headers show

Commit Message

Tixy Aug. 8, 2011, 2:28 p.m. UTC
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(-)

Comments

Pavel Machek Aug. 11, 2011, 12:50 p.m. UTC | #1
> -#define CONSISTENT_DMA_SIZE	(SZ_8M + SZ_4M + SZ_2M)
...
> +	init_consistent_dma_size(14 << 20);

Are you sure that's equivalent?
Tixy Aug. 11, 2011, 1:08 p.m. UTC | #2
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.
Pavel Machek Aug. 12, 2011, 3:09 p.m. UTC | #3
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...

Patch
diff mbox

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();