[U-Boot] [PATCH 05/31] powerpc: extract common config options for keymile boards.

Heiko Schocher hs at denx.de
Wed Jan 28 10:38:56 CET 2009


This patch extracts common config options for keymile boards
to the keymile-common.h file.
Additionally FLASH_PROTECTION is added.

Signed-off-by: Heiko Schocher <hs at denx.de>
---
 include/configs/keymile-common.h |   84 ++++++++++++++++++++++++++++++++++++++
 include/configs/kmeter1.h        |   58 ++++++++------------------
 include/configs/mgcoge.h         |   56 ++++++++++---------------
 include/configs/mgsuvd.h         |   44 ++++++++------------
 4 files changed, 141 insertions(+), 101 deletions(-)

diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h
index d70bc48..28cdf76 100644
--- a/include/configs/keymile-common.h
+++ b/include/configs/keymile-common.h
@@ -102,6 +102,8 @@
 #define CONFIG_SYS_SLOT_ID_OFF		(0x07)	/* register offset */
 #define CONFIG_SYS_SLOT_ID_MASK		(0x3f)	/* mask for slot ID bits */

+#define	CONFIG_SYS_FLASH_PROTECTION 1
+
 /*
  * BOOTP options
  */
@@ -110,4 +112,86 @@
 #define CONFIG_BOOTP_GATEWAY
 #define CONFIG_BOOTP_HOSTNAME

+#define xstr(s)	str(s)
+#define str(s)	#s
+
+#define CONFIG_KM_DEF_ENV	\
+	"netdev=eth0\0"							\
+	"baudrate=115200\0"						\
+	"u-boot_addr_r=100000\0"					\
+	"kernel_addr_r=200000\0"					\
+	"fdt_addr_r=600000\0"						\
+	"ram_ws=800000 \0"						\
+	"autoscr_ws=780000 \0"						\
+	"fdt_file=" xstr(CONFIG_HOSTNAME) "/" 				\
+		xstr(CONFIG_HOSTNAME) ".dtb\0"				\
+	"u-boot=" xstr(CONFIG_HOSTNAME) "/u-boot.bin \0" 		\
+	"kernel_file=" xstr(CONFIG_HOSTNAME) "/uImage \0" 		\
+	"load=tftp ${u-boot_addr_r} ${u-boot}\0"			\
+	"update=protect off " xstr(BOOTFLASH_START) " +${filesize};"	\
+		"erase " xstr(BOOTFLASH_START) "  +${filesize};"	\
+		"cp.b ${u-boot_addr_r} " xstr(BOOTFLASH_START) 		\
+		"  ${filesize};"					\
+		"protect on " xstr(BOOTFLASH_START) "  +${filesize}\0"	\
+	"ramargs=setenv bootargs root=/dev/ram rw\0"			\
+	"nfsargs=setenv bootargs root=/dev/nfs rw "			\
+		"nfsroot=${serverip}:${rootpath}\0"			\
+	"addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"		\
+	"addip=setenv bootargs ${bootargs} "				\
+		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
+		":${hostname}:${netdev}:off panic=1\0"			\
+	"addboardid=setenv bootargs ${bootargs} " 			\
+		"hwKey=${IVM_HWKey} boardId=0x${IVM_BoardId} \0" 	\
+	"net_nfs=tftp ${kernel_addr_r} ${kernel_file}; "		\
+		"tftp ${fdt_addr_r} ${fdt_file}; "			\
+		"run nfsargs addip addcon;"				\
+		"bootm ${kernel_addr_r} - ${fdt_addr_r}\0"		\
+	"net_self=tftp ${kernel_addr_r} ${kernel_file}; "		\
+		"tftp ${fdt_addr_r} ${fdt_file}; "			\
+		"tftp ${ramdisk_addr} ${ramdisk_file}; "		\
+		"run ramargs addip; "					\
+		"bootm ${kernel_addr_r} ${ramdisk_addr} ${fdt_addr_r}\0"\
+	"flash_nfs=run nfsargs addip addcon;"				\
+		"bootm ${kernel_addr} - ${fdt_addr}\0"			\
+	"flash_self=run ramargs addip addcon;"				\
+		"bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"	\
+	"bootcmd=run mtdargs addip addcon addboardid addpram; "		\
+		"bootm ${actual_kernel_addr} - ${actual_fdt_addr} \0"	\
+	"altbootcmd=run altmtdargs addip addcon addboardid addpram; "	\
+		"bootm ${backup_kernel_addr} - ${backup_fdt_addr} \0"	\
+	"actual0=setenv actual_bank 0; setenv actual_kernel_addr "	\
+		"${bank0_kernel_addr}; "				\
+		"setenv actual_fdt_addr ${bank0_fdt_addr}; "		\
+		"setenv actual_rootfs ${bank0_rootfs} \0" 		\
+	"actual1=setenv actual_bank 1; setenv actual_kernel_addr "	\
+		"${bank1_kernel_addr}; "				\
+		"setenv actual_fdt_addr ${bank1_fdt_addr}; "		\
+		"setenv actual_rootfs ${bank1_rootfs} \0" 		\
+	"backup0=setenv backup_bank 0; setenv backup_kernel_addr " 	\
+		"${bank0_kernel_addr}; "				\
+		"setenv backup_fdt_addr ${bank0_fdt_addr}; "		\
+		"setenv backup_rootfs ${bank0_rootfs} \0"		\
+	"backup1=setenv backup_bank 1; setenv backup_kernel_addr "	\
+		"${bank1_kernel_addr}; "				\
+		"setenv backup_fdt_addr ${bank1_fdt_addr}; " 		\
+		"setenv backup_rootfs ${bank1_rootfs} \0" 		\
+	"setbank0=run actual0 backup1 \0" 				\
+	"setbank1=run actual1 backup0 \0" 				\
+	"release=setenv bootcmd \'run mtdargs addip addcon addboardid;" \
+		"bootm ${actual_kernel_addr} - ${actual_fdt_addr} \'; "	\
+		"saveenv \0"						\
+	"develop=setenv bootcmd \'run nfsargs addip addcon addboardid;" \
+		"bootm ${actual_kernel_addr} - ${actual_fdt_addr} \'; "	\
+		"saveenv \0"						\
+	"developall=setenv bootcmd \'run load_fdt load_kernel nfsargs "	\
+		"addip addcon addboardid; "				\
+		"bootm ${actual_kernel_addr} - ${actual_fdt_addr} \'; "	\
+		"saveenv \0"						\
+	"new_esw_script=new_esw_0x${IVM_BoardId}_0x${IVM_HWKey}.scr \0"	\
+	"new_esw=tftp ${autoscr_ws} ${new_esw_script}; "		\
+		"iminfo ${autoscr_ws}; autoscr ${autoscr_ws} \0"	\
+	"bootlimit=0 \0" 						\
+	""
+
+
 #endif /* __CONFIG_KEYMILE_H */
diff --git a/include/configs/kmeter1.h b/include/configs/kmeter1.h
index 25b1c17..7b78a82 100644
--- a/include/configs/kmeter1.h
+++ b/include/configs/kmeter1.h
@@ -28,6 +28,7 @@
 #define CONFIG_MPC83XX		1 /* MPC83XX family */
 #define CONFIG_MPC8360		1 /* MPC8360 CPU specific */
 #define CONFIG_KMETER1		1 /* KMETER1 board specific */
+#define CONFIG_HOSTNAME		kmeter1

 /* include common defines/options for all Keymile boards */
 #include "keymile-common.h"
@@ -405,53 +406,30 @@
  * Environment Configuration
  */
 #define CONFIG_ENV_OVERWRITE
-
-#if defined(CONFIG_UEC_ETH)
-#define CONFIG_HAS_ETH0
+#ifndef CONFIG_KM_DEF_ENV		/* if not set by keymile-common.h */
+#define CONFIG_KM_DEF_ENV "km-common=empty\0"
 #endif

+#define BOOTFLASH_START	F0000000
+
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"netdev=eth0\0"							\
+       CONFIG_KM_DEF_ENV						\
 	"rootpath=/opt/eldk/ppc_82xx\0"					\
-	"nfsargs=setenv bootargs root=/dev/nfs rw "			\
-		"nfsroot=${serverip}:${rootpath}\0"			\
-	"ramargs=setenv bootargs root=/dev/ram rw\0"			\
-	"addip=setenv bootargs ${bootargs} "				\
-		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"	\
-		":${hostname}:${netdev}:off panic=1\0"			\
-	"addtty=setenv bootargs ${bootargs}"				\
-		" console=ttyS0,${baudrate}\0"				\
-	"fdt_addr=f0080000\0"						\
-	"kernel_addr=f00a0000\0"					\
-	"ramdisk_addr=f03a0000\0"					\
-	"kernel_addr_r=400000\0"					\
-	"fdt_addr_r=800000\0"						\
-	"ramdisk_addr_r=810000\0"					\
-	"flash_self=run ramargs addip addtty;"				\
-		"bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"	\
-	"flash_nfs=run nfsargs addip addtty;"				\
-		"bootm ${kernel_addr} - ${fdt_addr}\0"			\
-	"net_nfs=tftp ${kernel_addr_r} ${boot_file}; "			\
-		"tftp ${fdt_addr_r} ${fdt_file}; "			\
-		"run nfsargs addip addtty;"				\
-		"bootm ${kernel_addr_r} - ${fdt_addr_r}\0"		\
-	"fdt_file=/tftpboot/kmeter1/kmeter1.dtb\0"			\
-	"boot_file=/tftpboot/kmeter1/uImage\0"				\
+	"addcon=setenv bootargs ${bootargs} console=ttyS0,${baudrate}\0"\
 	"ramdisk_file=/tftpboot/kmeter1/uRamdisk\0"			\
-	"u-boot=/tftpboot/kmeter1/u-boot.bin\0"				\
-	"loadaddr=" MK_STR(CONFIG_SYS_LOAD_ADDR) "\0"			\
-	"load=tftp $loadaddr ${u-boot}\0"				\
-	"update=protect off " MK_STR(TEXT_BASE) " +$filesize;"		\
-		"erase " MK_STR(TEXT_BASE) " +$filesize;"		\
-		"cp.b $loadaddr " MK_STR(TEXT_BASE) " $filesize;"	\
-		"protect on " MK_STR(TEXT_BASE) " +$filesize;"		\
-		"cmp.b $loadaddr " MK_STR(TEXT_BASE) " $filesize;"	\
-		"setenv filesize;saveenv\0"				\
-	"upd=run load update\0"						\
 	"loadram=tftp ${ramdisk_addr_r} ${ramdisk_file}\0"		\
 	"loadfdt=tftp ${fdt_addr_r} ${fdt_file}\0"			\
-	"loadkernel=tftp ${kernel_addr_r} ${boot_file}\0"		\
+	"loadkernel=tftp ${kernel_addr_r} ${bootfile}\0"		\
 	"unlock=yes\0"							\
-   ""
+	"fdt_addr=F0080000\0"						\
+	"kernel_addr=F00a0000\0"					\
+	"ramdisk_addr=F03a0000\0"					\
+	"ramdisk_addr_r=F10000\0"					\
+	""
+
+
+#if defined(CONFIG_UEC_ETH)
+#define CONFIG_HAS_ETH0
+#endif

 #endif /* __CONFIG_H */
diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h
index ddb06aa..12be62a 100644
--- a/include/configs/mgcoge.h
+++ b/include/configs/mgcoge.h
@@ -32,6 +32,7 @@
 #define CONFIG_MPC8247		1
 #define CONFIG_MPC8272_FAMILY   1
 #define CONFIG_MGCOGE		1
+#define CONFIG_HOSTNAME		mgcoge

 #define CONFIG_CPM2		1	/* Has a CPM2 */

@@ -75,40 +76,27 @@
 #define CONFIG_8260_CLKIN	66000000	/* in Hz */
 #endif

-/*
- * Default environment settings
- */
-#define CONFIG_EXTRA_ENV_SETTINGS						\
-	"netdev=eth0\0"								\
-	"u-boot_addr=100000\0"							\
-	"kernel_addr=200000\0"							\
-	"fdt_addr=400000\0"							\
-	"rootpath=/opt/eldk-4.2/ppc_82xx\0"					\
-	"u-boot=/tftpboot/mgcoge/u-boot.bin\0"					\
-	"bootfile=/tftpboot/mgcoge/uImage\0"					\
-	"fdt_file=/tftpboot/mgcoge/mgcoge.dtb\0"				\
-	"load=tftp ${u-boot_addr} ${u-boot}\0"					\
-	"update=prot off fe000000 fe03ffff; era fe000000 fe03ffff; "		\
-		"cp.b ${u-boot_addr} fe000000 ${filesize};"			\
-		"prot on fe000000 fe03ffff\0"					\
-	"ramargs=setenv bootargs root=/dev/ram rw\0"				\
-	"nfsargs=setenv bootargs root=/dev/nfs rw "				\
-		"nfsroot=${serverip}:${rootpath}\0"				\
-	"addcons=setenv bootargs ${bootargs} console=ttyCPM0,${baudrate}\0"	\
-	"addmtd=setenv bootargs ${bootargs} ${mtdparts}\0"			\
-	"addip=setenv bootargs ${bootargs} "					\
-		"ip=${ipaddr}:${serverip}:${gatewayip}:"			\
-		"${netmask}:${hostname}:${netdev}:off panic=1\0"		\
-	"net_nfs=tftp ${kernel_addr} ${bootfile}; "				\
-		"tftp ${fdt_addr} ${fdt_file}; run nfsargs addip addcons;"	\
-		"bootm ${kernel_addr} - ${fdt_addr}\0"				\
-	"net_self=tftp ${kernel_addr} ${bootfile}; "				\
-		"tftp ${fdt_addr} ${fdt_file}; "				\
-		"tftp ${ramdisk_addr} ${ramdisk_file}; "			\
-		"run ramargs addip; "						\
-		"bootm ${kernel_addr} ${ramdisk_addr} ${fdt_addr}\0"		\
-	""
+#ifndef CONFIG_KM_DEF_ENV		/* if not set by keymile-common.h */
+#define CONFIG_KM_DEF_ENV "km-common=empty\0"
+#endif

+#define BOOTFLASH_START	FE000000
+
+#define	CONFIG_EXTRA_ENV_SETTINGS	 \
+	CONFIG_KM_DEF_ENV						\
+	"rootpath=/opt/eldk/ppc_82xx\0"					\
+	"addcon=setenv bootargs ${bootargs} "				\
+		"console=ttyCPM0,${baudrate}\0"				\
+	"tftpsrcp=69\0"							\
+	"tftpdstp=69\0"							\
+	"mtdids=nor0=boot,nor1=app \0"					\
+	"mtdparts=mtdparts=boot:384k(u-boot),128k(env),128k(envred),"	\
+		"3456k(free);app:3m(esw0),10m(rootfs0),3m(esw1),"	\
+		"10m(rootfs1),1m(var),5m(cfg) \0"			\
+	"partition=nor1,5 \0"						\
+	"new_env=prot off FE060000 FE09FFFF; era FE060000 FE09FFFF \0" 	\
+	""
+
 #define CONFIG_SYS_SDRAM_BASE		0x00000000
 #define CONFIG_SYS_FLASH_BASE		0xFE000000
 #define CONFIG_SYS_FLASH_SIZE		32
@@ -127,7 +115,7 @@
 #define CONFIG_SYS_RAMBOOT
 #endif

-#define CONFIG_SYS_MONITOR_LEN		(256 << 10)	/* Reserve 256KB for Monitor */
+#define CONFIG_SYS_MONITOR_LEN	(384 << 10)	/* Reserve 384KB for Monitor */

 #define CONFIG_ENV_IS_IN_FLASH

diff --git a/include/configs/mgsuvd.h b/include/configs/mgsuvd.h
index 698f0e7..ee1da02 100644
--- a/include/configs/mgsuvd.h
+++ b/include/configs/mgsuvd.h
@@ -35,6 +35,7 @@

 #define CONFIG_MPC866		1	/* This is a MPC866 CPU		*/
 #define CONFIG_MGSUVD		1	/* ...on a mgsuvd board	*/
+#define CONFIG_HOSTNAME		mgsuvd

 /* include common defines/options for all Keymile boards */
 #include "keymile-common.h"
@@ -53,34 +54,23 @@
 	"echo Type \\\"run flash_nfs\\\" to mount root filesystem over NFS;" \
 	"echo"

-#define CONFIG_EXTRA_ENV_SETTINGS						\
-	"netdev=eth0\0"								\
-	"addcons=setenv bootargs ${bootargs} console=ttyCPM0,${baudrate}\0"	\
-	"nfsargs=setenv bootargs root=/dev/nfs rw "				\
-		"nfsroot=${serverip}:${rootpath}\0"				\
-	"ramargs=setenv bootargs root=/dev/ram rw\0"				\
-	"addip=setenv bootargs ${bootargs} "					\
-		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}"		\
-		":${hostname}:${netdev}:off panic=1\0"				\
-	"flash_nfs=run nfsargs addip;"						\
-		"bootm ${kernel_addr}\0"					\
-	"flash_self=run ramargs addip;"						\
-		"bootm ${kernel_addr} ${ramdisk_addr}\0"			\
-	"net_nfs=tftp ${kernel_addr} ${bootfile}; "				\
-		"tftp ${fdt_addr} ${fdt_file}; run nfsargs addip addcons;"	\
-		"bootm ${kernel_addr} - ${fdt_addr}\0"				\
-	"rootpath=/opt/eldk/ppc_8xx\0"						\
-	"bootfile=/tftpboot/mgsuvd/uImage\0"					\
-	"fdt_addr=400000\0"							\
-	"kernel_addr=200000\0"							\
-	"fdt_file=/tftpboot/mgsuvd/mgsuvd.dtb\0"				\
-	"load=tftp 200000 ${u-boot}\0"						\
-	"update=protect off f0000000 +${filesize};"				\
-		"erase f0000000 +${filesize};"					\
-		"cp.b 200000 f0000000 ${filesize};"				\
-		"protect on f0000000 +${filesize}\0"				\
+#define BOOTFLASH_START	F0000000
+
+#define CONFIG_EXTRA_ENV_SETTINGS					\
+	CONFIG_KM_DEF_ENV						\
+	"rootpath=/opt/eldk/ppc_8xx\0"					\
+	"addcon=setenv bootargs ${bootargs} "				\
+		"console=ttyCPM0,${baudrate}\0"				\
+	"tftpsrcp=69\0"							\
+	"tftpdstp=69\0"							\
+	"mtdids=nor0=app \0"						\
+	"mtdparts=mtdparts=app:256k(u-boot),128k(env),128k(envred),"	\
+		"256k(free),1536k(esw0),8704k(rootfs0),1536k(esw1),"	\
+		"2432k(rootfs1),640k(var),768k(cfg)\0"			\
+	"partition=nor0,9 \0"						\
+	"new_env=prot off F0040000 F007FFFF; era F0040000 F007FFFF \0" 	\
 	""
-
+
 #undef CONFIG_RTC_MPC8xx		/* MPC866 does not support RTC	*/

 #define	CONFIG_TIMESTAMP		/* but print image timestmps	*/
-- 
1.6.0.6

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany


More information about the U-Boot mailing list