From: Yann Vernier <yann.vernier@orsoc.se>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 06/11] arm: cm4008, cm41xx: Fix ROM relocation
Date: Fri, 5 Oct 2012 14:09:53 +0200 [thread overview]
Message-ID: <1349438998-10954-7-git-send-email-yann.vernier@orsoc.se> (raw)
In-Reply-To: <1349438998-10954-1-git-send-email-yann.vernier@orsoc.se>
Changed CONFIG_SYS_TEXT_BASE to actual address (required for
board_init_f) and moved it into cm4{008,1xx}.h, along with a warning
that it must match CONFIG_SYS_FLASH_BASE (since lowlevel_init
relocates there).
lowlevel_init now uses CONFIG_SYS_RCS0_BASE to map ROM.
---
Changes for v2:
- Update to use CONFIG_SYS_FLASH_ constants only (no PHYS_FLASH)
- Use tabs where appropriate
- Update cm41xx also
- Explain the lowlevel_init change
Changes for v3:
- Use memory mappings per defined macros
- Change the final adjustment of lr and ip
- Verified mapping flash at 0x3000000 on KS8695X demo board
---
arch/arm/cpu/arm920t/ks8695/lowlevel_init.S | 63 +++++++++++++++++++--------
board/cm4008/config.mk | 1 -
board/cm41xx/config.mk | 1 -
3 files changed, 45 insertions(+), 20 deletions(-)
diff --git a/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S b/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S
index 1bba571..74579ed 100644
--- a/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S
+++ b/arch/arm/cpu/arm920t/ks8695/lowlevel_init.S
@@ -25,6 +25,7 @@
#include <config.h>
#include <version.h>
#include <asm/arch/platform.h>
+#include <asm/arch/regvalues.h>
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
@@ -91,12 +92,31 @@ lowlevel_init:
* remap the memory and flash regions. we want to end up with
* ram from address 0, and flash at 32MB.
*/
+#if CONFIG_SYS_RCS0_BASE!=CONFIG_SYS_TEXT_BASE
+#error CONFIG_SYS_RCS0_BASE and CONFIG_SYS_TEXT_BASE must match for highflash address to work
+ /* Also needed for pointers in board_init_f() */
+#endif
+#if CONFIG_SYS_RCS0_BASE>=KS8695_IO_BASE
+#error Cannot relocate ROM past IO registers
+ /* Firstly, the IO registers are at the top supported address.
+ Secondly, as we grow the ROM region it must not overlap the registers. */
+#endif
+#if CONFIG_SYS_RCS0_BASE&0xffff
+#error Cannot map memory to addresses not divisible by 64K
+#endif
ldr r1, =(KS8695_IO_BASE+KS8695_MEM_CTRL0)
- ldr r2, =0xbfc00040
+ /* The default ROM mapping is at 0x0 - 0x01ffffff.
+ Remap it to 0x0 - 0x03feffff so that it covers 0x02000000,
+ where CONFIG_SYS_FLASH_BASE maps it, as well as 0.
+ Relies on the limited address lines to repeat ROM images
+ on every multiple of the real ROM size. */
+ ldr r2, =(KS8695_MEM_RANGE(0,0x03ff0000)|(CONFIG_KS8695_ROMCON0_VALUE&0xfff))
str r2, [r1] /* large flash map */
- ldr pc, =(highflash+0x02000000-0x00f00000) /* jump to high flash address */
+ /* Relies on CONFIG_SYS_RCS0_BASE==CONFIG_SYS_TEXT_BASE */
+ ldr pc, =(highflash) /* jump to high flash address */
highflash:
- ldr r2, =0x8fe00040
+ /* Move ROM to high address, and reconfigure to 4MiB size */
+ ldr r2, =CONFIG_KS8695_ROMCON0_VALUE
str r2, [r1] /* remap flash range */
/*
@@ -105,28 +125,35 @@ highflash:
* then you can have it all mapped nicely. Has no effect if you
* only have a 4Mb or smaller flash.
*/
+#if CONFIG_SYS_RCS1_WIDTH
ldr r1, =(KS8695_IO_BASE+KS8695_MEM_CTRL1)
- ldr r2, =0x9fe40040
+ ldr r2, =CONFIG_KS8695_ROMCON1_VALUE
str r2, [r1] /* remap flash2 region, contiguous */
- ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL)
- ldr r2, =0x30000005
- str r2, [r1] /* enable both flash selects */
+#endif
-#ifdef CONFIG_CM41xx
/*
- * map the second flash chip, using the external IO lines.
+ * map additional flash chip, using the external IO lines.
*/
+#if CONFIG_SYS_ECS0_WIDTH
ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL0)
- ldr r2, =0xafe80b6d
- str r2, [r1] /* remap io0 region, contiguous */
+ ldr r2, =CONFIG_KS8695_EXTACON0_VALUE
+ str r2, [r1] /* map io0 region */
+#endif
+#if CONFIG_SYS_ECS1_WIDTH
ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL1)
- ldr r2, =0xbfec0b6d
- str r2, [r1] /* remap io1 region, contiguous */
- ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL)
- ldr r2, =0x30050005
- str r2, [r1] /* enable second flash */
+ ldr r2, =CONFIG_KS8695_EXTACON1_VALUE
+ str r2, [r1] /* map io1 region */
+#endif
+#if CONFIG_SYS_ECS2_WIDTH
+ ldr r1, =(KS8695_IO_BASE+KS8695_IO_CTRL2)
+ ldr r2, =CONFIG_KS8695_EXTACON2_VALUE
+ str r2, [r1] /* map io2 region */
#endif
+ ldr r1, =(KS8695_IO_BASE+KS8695_MEM_GENERAL)
+ ldr r2, =CONFIG_KS8695_ERGCON_VALUE
+ str r2, [r1] /* enable relevant flash selects */
+
/*
* before relocating, we have to setup RAM timing
*/
@@ -198,8 +225,8 @@ highflash:
nobutton:
#endif
- add lr, lr, #0x02000000 /* flash is now mapped high */
- add ip, ip, #0x02000000 /* this is a hack */
+ add lr, lr, #CONFIG_SYS_TEXT_BASE /* flash is now mapped high */
+ add ip, ip, #CONFIG_SYS_TEXT_BASE /* this is a hack */
mov pc, lr /* all done, return */
#endif /* CONFIG_SKIP_LOWLEVEL_INIT */
diff --git a/board/cm4008/config.mk b/board/cm4008/config.mk
deleted file mode 100644
index 0d5923b..0000000
--- a/board/cm4008/config.mk
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x00f00000
diff --git a/board/cm41xx/config.mk b/board/cm41xx/config.mk
deleted file mode 100644
index 0d5923b..0000000
--- a/board/cm41xx/config.mk
+++ /dev/null
@@ -1 +0,0 @@
-CONFIG_SYS_TEXT_BASE = 0x00f00000
--
1.7.10.4
next prev parent reply other threads:[~2012-10-05 12:09 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-05 8:05 [U-Boot] [PATCH 3/3] cm4008: use common cfi_flash support Yann Vernier
2012-07-05 9:48 ` Andreas Bießmann
2012-07-05 13:11 ` [U-Boot] [PATCH v2] arm: cm4008, cm41xx: " Yann Vernier
2012-07-05 15:04 ` Andreas Bießmann
2012-07-06 8:27 ` [U-Boot] [PATCH v3] " Yann Vernier
2012-07-06 8:47 ` Andreas Bießmann
2012-07-06 11:33 ` Albert ARIBAUD
2012-08-09 13:33 ` [U-Boot] [PATCH 11/11] arm: cm4008, cm41xx: read MAC address from flash Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 00/11] ks8695 (cm4008, cm41xx) bugfixes, constant removals, configuration generalized Yann Vernier
2012-10-04 9:15 ` Albert ARIBAUD
2012-10-05 12:09 ` [U-Boot] [PATCH 00/11] ks8695 (cm4008, cm41xx) bugfixes, constant removals, configuration generalized (repost) Yann Vernier
2012-10-05 12:09 ` [U-Boot] [PATCH 01/11] arm: ks8695: use defined constants for UART Yann Vernier
2012-10-26 21:34 ` Albert ARIBAUD
2012-10-05 12:09 ` [U-Boot] [PATCH 02/11] arm: ks8695: more macros for register values Yann Vernier
2012-10-18 18:57 ` Albert ARIBAUD
2012-11-19 11:55 ` [U-Boot] [PATCH] " Yann Vernier
2012-11-19 12:29 ` Yann Vernier
2012-11-20 0:05 ` Marek Vasut
2012-10-05 12:09 ` [U-Boot] [PATCH 03/11] arm: ks8695eth: Use MAC address from environment Yann Vernier
2012-10-18 19:00 ` Albert ARIBAUD
2012-10-18 20:55 ` Joe Hershberger
2012-10-19 8:02 ` Yann Vernier
2012-10-26 21:37 ` Albert ARIBAUD
2012-11-19 11:42 ` Yann Vernier
2012-12-01 19:23 ` Joe Hershberger
2012-10-05 12:09 ` [U-Boot] [PATCH 04/11] arm: cm4008, cm41xx: use common cfi_flash support Yann Vernier
2012-10-05 12:09 ` [U-Boot] [PATCH 05/11] arm: cm4008, cm41xx: set gd->ram_size in dram_init Yann Vernier
2012-10-05 12:09 ` Yann Vernier [this message]
2012-10-18 19:09 ` [U-Boot] [PATCH 06/11] arm: cm4008, cm41xx: Fix ROM relocation Albert ARIBAUD
2012-10-19 8:08 ` Yann Vernier
2012-10-05 12:09 ` [U-Boot] [PATCH 07/11] arm: ks8695/cm4008/cm41xx: Parameterize SDRAM Yann Vernier
2012-10-18 19:11 ` Albert ARIBAUD
2012-10-05 12:09 ` [U-Boot] [PATCH 08/11] arm: cm4008, cm41xx: don't define to 1 Yann Vernier
2012-10-05 12:09 ` [U-Boot] [PATCH 09/11] arm: ks8695/cm4xxx: don't reconfigure switch Yann Vernier
2012-10-18 19:13 ` Albert ARIBAUD
2012-10-05 12:09 ` [U-Boot] [PATCH 10/11] arm: ks8695: document bus speed Yann Vernier
2012-10-05 12:09 ` [U-Boot] [PATCH 11/11] arm: cm4008, cm41xx: read MAC address from flash Yann Vernier
2012-10-18 19:14 ` Albert ARIBAUD
2012-11-10 8:03 ` [U-Boot] [PATCH 00/11] ks8695 (cm4008, cm41xx) bugfixes, constant removals, configuration generalized (repost) Albert ARIBAUD
2012-11-13 12:46 ` Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 10/11] arm: ks8695: document bus speed Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 07/11] arm: ks8695/cm4008/cm41xx: Parameterize SDRAM Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 08/11] arm: cm4008, cm41xx: don't define to 1 Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 09/11] arm: ks8695/cm4xxx: don't reconfigure switch Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 05/11] arm: cm4008, cm41xx: set gd->ram_size in dram_init Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 03/11] arm: ks8695eth: Use MAC address from environment Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 04/11] arm: cm4008, cm41xx: use common cfi_flash support Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 06/11] arm: cm4008, cm41xx: Fix ROM relocation Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 02/11] arm: ks8695: more macros for register values Yann Vernier
2012-08-09 13:33 ` [U-Boot] [PATCH 01/11] arm: ks8695: use defined constants for UART Yann Vernier
2012-07-05 13:22 ` [U-Boot] [PATCH v2] arm: cm4008, cm41xx: Fix ROM relocation Yann Vernier
2012-07-05 13:41 ` Yann Vernier
2012-07-05 15:19 ` Andreas Bießmann
2012-07-12 19:37 ` Albert ARIBAUD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349438998-10954-7-git-send-email-yann.vernier@orsoc.se \
--to=yann.vernier@orsoc.se \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.