From 40edd785a74fc442bc5baef47695ab9741d4e52c Mon Sep 17 00:00:00 2001
From: Andy Green <andy@openmoko.com>
Date: Mon, 1 Dec 2008 01:26:06 +0000
Subject: [PATCH] qi-gta02-remap-steppingstone.patch

Despite what the docs say, steppingstone is always resident at
0x40000000 on s3c2442, this patch changes our linker script to
stick all steppingstone code there.  The mapping of steppingstone
at 0x0 is broken by OM[] bus change dynamically caused for example
by GTA02 AUX button actuation.

Signed-off-by: Andy Green <andy@openmoko.com>
---
 qiboot/src/cpu/s3c2442/qi.lds | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/qiboot/src/cpu/s3c2442/qi.lds b/qiboot/src/cpu/s3c2442/qi.lds
index c23b447..600f950 100644
--- a/qiboot/src/cpu/s3c2442/qi.lds
+++ b/qiboot/src/cpu/s3c2442/qi.lds
@@ -27,20 +27,21 @@ OUTPUT_ARCH(arm)
 ENTRY(_start)
 SECTIONS
 {
-	. = 0x00000000;
+	__steppingstone_always = 0x40000000;
+	__qi_sdram_copy = 0x33000000;
+
+	. = __steppingstone_always;
 
 	/* this is intended to take the first 4KBytes of stuff initially.
 	 * We have to make sure we have .rodata* in there for everything
 	 * because we do not compile PIC.
 	 */
 
-	. = ALIGN(4);
-	.text      :
+	.text __steppingstone_always : AT (0x0)
 	{
 	  src/cpu/s3c2442/start.o		(.text .rodata* .data .bss)
 	  src/cpu/s3c2442/lowlevel_init.o	(.text .rodata* .data .bss)
 	  src/cpu/s3c2442/start_qi.o		(.text .rodata* .data .bss)
-/*	  src/blink_led.o			(.text .rodata* .data .bss) */
 	  src/cpu/s3c2442/nand_read.o		(.text .rodata* .data .bss)
 	  src/cpu/s3c2442/serial-s3c24xx.o	(.text .rodata* .data .bss)
 	  src/memory-test.o			(.text .rodata* .data .bss)
@@ -50,10 +51,10 @@ SECTIONS
 	}
 
 	. = ALIGN(4);
-	.everything_else  ADDR (.text) + SIZEOF (.text) + 0x33000000 :
-		AT ( ADDR (.text) + SIZEOF (.text) ) { *(.text .rodata* .data) }
+	.everything_else  ADDR (.text) - __steppingstone_always + SIZEOF (.text) + __qi_sdram_copy :
+		AT ( ADDR (.text) - __steppingstone_always + SIZEOF (.text) ) { *(.text .rodata* .data) }
 
-	. = 0x33800000 ;
+	. = __qi_sdram_copy + 0x800000 ;
 	__bss_start = .;
 	.bss (NOLOAD) : 
     {