diff mbox

[46/52] ARM: mach-u300: convert boot_params to atag_offset

Message ID 1309920457-21913-46-git-send-email-nicolas.pitre@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Nicolas Pitre July 6, 2011, 2:47 a.m. UTC
Someone was smoking good stuff with CONFIG_MACH_U300_2MB_ALIGNMENT_FIX here...

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-u300/include/mach/memory.h |    8 ++++----
 arch/arm/mach-u300/u300.c                |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Russell King - ARM Linux July 8, 2011, 9:20 p.m. UTC | #1
On Fri, Jul 08, 2011 at 03:12:06PM +0200, Linus Walleij wrote:
> 2011/7/6 Nicolas Pitre <nicolas.pitre@linaro.org>:
> 
> > Someone was smoking good stuff with CONFIG_MACH_U300_2MB_ALIGNMENT_FIX here...
> 
> Haha, it is a consequence of the PHYS_OFFSET having to align on a 2MB
> boundary, whereas the actual physical memory was at an odd MB address.
> We didn't really like the idea of loosing one megabyte of memory just to
> please PHYSOFFSET, so hence this fix.
> 
> What we do is round memory upwards to closest 2MB boundary, then we
> reserve the first MB. That's why we're having so much fun...
> 
> The reason why memory can be at an odd address is that we can
> dynamically alter (at boot time) how many MB are reserved for the
> accompanying modem CPU.

Can it be killed now that we have memblock with a proper reserve callback?
You could locate the kernel higher in memory (eg, 4MB+32K or even 1MB+32K)
keeping the real PHYS_OFFSET/PAGE_OFFSET, and arrange for the ->reserve
callback to mark the first 1MB as reserved, optionally freeing it from
memblock's idea of available memory if you don't want it mapped.
diff mbox

Patch

diff --git a/arch/arm/mach-u300/include/mach/memory.h b/arch/arm/mach-u300/include/mach/memory.h
index 888e2e3..f98acd9 100644
--- a/arch/arm/mach-u300/include/mach/memory.h
+++ b/arch/arm/mach-u300/include/mach/memory.h
@@ -16,7 +16,7 @@ 
 #ifdef CONFIG_MACH_U300_DUAL_RAM
 
 #define PLAT_PHYS_OFFSET		UL(0x48000000)
-#define BOOT_PARAMS_OFFSET	(PHYS_OFFSET + 0x100)
+#define BOOT_PARAMS_OFFSET		0x100
 
 #else
 
@@ -24,14 +24,14 @@ 
 #define PLAT_PHYS_OFFSET (0x28000000 + \
 	     (CONFIG_MACH_U300_ACCESS_MEM_SIZE - \
 	     (CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1))*1024*1024)
+#define BOOT_PARAMS_OFFSET (0x100 + \
+	     (CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1)*1024*1024*2)
 #else
 #define PLAT_PHYS_OFFSET (0x28000000 + \
 	     (CONFIG_MACH_U300_ACCESS_MEM_SIZE +	\
 	     (CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1))*1024*1024)
+#define BOOT_PARAMS_OFFSET 0x100
 #endif
-#define BOOT_PARAMS_OFFSET (0x28000000 + \
-	    (CONFIG_MACH_U300_ACCESS_MEM_SIZE +		\
-	    (CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1))*1024*1024 + 0x100)
 #endif
 
 /*
diff --git a/arch/arm/mach-u300/u300.c b/arch/arm/mach-u300/u300.c
index 48b3b7f..80e7305 100644
--- a/arch/arm/mach-u300/u300.c
+++ b/arch/arm/mach-u300/u300.c
@@ -61,7 +61,7 @@  static void __init u300_init_machine(void)
 
 MACHINE_START(U300, MACH_U300_STRING)
 	/* Maintainer: Linus Walleij <linus.walleij@stericsson.com> */
-	.boot_params	= BOOT_PARAMS_OFFSET,
+	.atag_offset	= BOOT_PARAMS_OFFSET,
 	.map_io		= u300_map_io,
 	.reserve	= u300_reserve,
 	.init_irq	= u300_init_irq,