[U-Boot] [PATCH] sbc8548: reclaim wasted sector in boot flash

Paul Gortmaker paul.gortmaker at windriver.com
Fri Sep 25 17:14:11 CEST 2009


By nature of being based off the MPC8548CDS board, this
board inherited an ENV_SIZE setting of 256k.  But since
it has a smaller flash device (8MB soldered on), it has
a native sector size of 128k, and hence the ENV_SIZE was
causing 2 sectors to be used for the environment.

By removing the unused sector, we can push TEXT_BASE up
closer to the end of address space and reclaim that
sector for any other application.  This also fixes the
mismatch between TEXT_BASE and MONITOR_LEN reported by
Kumar earlier.

Since this board also supports the ability to boot off
the 64MB SODIMM flash, this change is forward looking
with that in mind; i.e. the settings for MONITOR_LEN
and ENV_SIZE will work when the 512k sectors of the
SODIMM flash are used for alternate boot in the future.

Signed-off-by: Paul Gortmaker <paul.gortmaker at windriver.com>
---
 board/sbc8548/config.mk   |    2 +-
 doc/README.sbc8548        |   24 ++++++++++++++++++++++++
 include/configs/sbc8548.h |   20 +++++++++++++++++---
 3 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/board/sbc8548/config.mk b/board/sbc8548/config.mk
index 440d650..b2013d6 100644
--- a/board/sbc8548/config.mk
+++ b/board/sbc8548/config.mk
@@ -24,5 +24,5 @@
 # sbc8548 board
 #
 ifndef TEXT_BASE
-TEXT_BASE = 0xfff80000
+TEXT_BASE = 0xfffa0000
 endif
diff --git a/doc/README.sbc8548 b/doc/README.sbc8548
index d72d97d..6cbe12f 100644
--- a/doc/README.sbc8548
+++ b/doc/README.sbc8548
@@ -63,6 +63,30 @@ a 33MHz PCI configuration is currently untested.)
     =>
 
 
+Updating U-boot with U-boot:
+============================
+
+Note that versions of u-boot up to and including 2009.08 had u-boot stored
+at 0xfff8_0000 -> 0xffff_ffff (512k).  Currently it is being stored from
+0xfffa_0000 -> 0xffff_ffff (384k).  If you use an old macro/script to
+update u-boot with u-boot and it uses the old address, you will render
+your board inoperable, and you will require JTAG recovery.
+
+The following steps list how to update with the current address:
+
+	tftp u-boot.bin
+	md 200000 10
+	protect off all
+	erase fffa0000 ffffffff
+	cp.b 200000 fffa0000 60000
+	md fffa0000 10
+	protect on all
+
+The "md" steps in the above are just a precautionary step that allow
+you to confirm the u-boot version that was downloaded, and then confirm
+that it was copied to flash.
+
+
 Hardware Reference:
 ===================
 
diff --git a/include/configs/sbc8548.h b/include/configs/sbc8548.h
index d10792a..aeac2de 100644
--- a/include/configs/sbc8548.h
+++ b/include/configs/sbc8548.h
@@ -330,7 +330,14 @@
 #define CONFIG_SYS_GBL_DATA_OFFSET	(CONFIG_SYS_INIT_RAM_END - CONFIG_SYS_GBL_DATA_SIZE)
 #define CONFIG_SYS_INIT_SP_OFFSET	CONFIG_SYS_GBL_DATA_OFFSET
 
-#define CONFIG_SYS_MONITOR_LEN		(256 * 1024) /* Reserve 256 kB for Mon */
+/*
+ * For soldered on flash, (128kB/sector) we use 2 sectors for u-boot and
+ * one for env+bootpg (TEXT_BASE=0xfffa_0000, 384kB total).  For SODIMM
+ * flash (512kB/sector) we use 1 sector for u-boot, and one for env+bootpg
+ * (TEXT_BASE=0xfff0_0000, 1MB total).  This dynamically sets the right
+ * thing for MONITOR_LEN in both cases.
+ */
+#define CONFIG_SYS_MONITOR_LEN		(~TEXT_BASE + 1)
 #define CONFIG_SYS_MALLOC_LEN		(128 * 1024)	/* Reserved for malloc */
 
 /* Serial Port */
@@ -448,9 +455,16 @@
  * Environment
  */
 #define CONFIG_ENV_IS_IN_FLASH	1
-#define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE + 0x40000)
-#define CONFIG_ENV_SECT_SIZE	0x40000	/* 256K(one sector) for env */
 #define CONFIG_ENV_SIZE		0x2000
+#if TEXT_BASE == 0xfff00000	/* Boot from 64MB SODIMM */
+#define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE + 0x80000)
+#define CONFIG_ENV_SECT_SIZE	0x80000	/* 512K(one sector) for env */
+#elif TEXT_BASE == 0xfffa0000	/* Boot from 8MB soldered flash */
+#define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE + 0x40000)
+#define CONFIG_ENV_SECT_SIZE	0x20000	/* 128K(one sector) for env */
+#else
+#warning undefined environment size/location.
+#endif
 
 #define CONFIG_LOADS_ECHO	1	/* echo on for serial download */
 #define CONFIG_SYS_LOADS_BAUD_CHANGE	1	/* allow baudrate change */
-- 
1.6.5.rc1



More information about the U-Boot mailing list