Skip to contentSkip to conversation

mpc7448_hpc2: Add storing env to flash as an option

PATCH New Paul Gortmaker 1 participant 1 message Jan 3, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mpc7448_hpc2: Add storing env to flash as an option

The default for the hpc2 has been to store env. in NVRAM, which is very limited in size. This patch adds the option to store the env. in flash, which allows for more (and more complex) env. settings. The default is to continue to use NVRAM, but a user can now switch to flash with a one line change in the config file.

---
 include/configs/mpc7448hpc2.h |   56 ++++++++++++++++++++++++++++++++++++++--
 1 files changed, 53 insertions(+), 3 deletions(-)
include/configs/mpc7448hpc2.h +53 -3
index bd3107a..f60c14c 100644
@@ -68,6 +68,10 @@
  * High Level Configuration Options
  * (easy to change)
  */
+ 
+/* NVRAM is a small amount of space.  Use flash if you have a big env. list */
+#define CFG_ENV_IS_IN_NVRAM
+#undef CFG_ENV_IS_IN_FLASH
 
 #define CONFIG_BAUDRATE		115200	/* console baudrate = 115000 */
 
@@ -120,8 +124,6 @@
 #define CONFIG_BOOTARGS "console=ttyS0,115200"
 #endif
 
-#undef CONFIG_EXTRA_ENV_SETTINGS
-
 #define CONFIG_SERIAL	"No. 1"
 
 /* Networking Configuration */
@@ -383,11 +385,59 @@
 #define PHYS_FLASH_SIZE		0x01000000
 #define CFG_MAX_FLASH_SECT	(128)
 
-#define CFG_ENV_IS_IN_NVRAM
+#ifdef CFG_ENV_IS_IN_NVRAM
+#undef CONFIG_EXTRA_ENV_SETTINGS
 #define CFG_ENV_ADDR		0xFC000000
 
 #define CFG_ENV_OFFSET	0x00000000	/* Offset of Environment Sector */
 #define CFG_ENV_SIZE	0x00000400	/* Total Size of Environment Space */
+#endif
+
+#ifdef CFG_ENV_IS_IN_FLASH
+#define CFG_ENV_ADDR		(CFG_MONITOR_BASE + 0x40000)
+
+#define CFG_ENV_SECT_SIZE	0x20000 /* 128K(one sector) for env */
+#define CFG_ENV_SIZE		0x2000
+
+#define CONFIG_EXTRA_ENV_SETTINGS				\
+	"netdev=eth0\0"						\
+	"consoledev=ttyS0\0"					\
+	"ramdiskaddr=2000000\0"					\
+	"ramdiskfile=your.ramdisk.u-boot\0"			\
+	"dtbaddr=c00000\0"					\
+	"dtbfile=mpc7448hpc2.dtb\0" 
+
+#define CONFIG_NFSBOOTCOMMAND					\
+	"setenv bootargs root=/dev/nfs rw "			\
+	"nfsroot=$serverip:$rootpath "				\
+	"ip=$ipaddr:$serverip:$gatewayip:$netmask:$hostname:$netdev:off " \
+	"console=$consoledev,$baudrate $othbootargs;"		\
+	"tftp $loadaddr $bootfile;"				\
+	"tftp $dtbaddr $dtbfile;"				\
+	"bootm $loadaddr - $dtbaddr"
+
+#define CONFIG_RAMBOOTCOMMAND					\
+	"setenv bootargs root=/dev/ram rw "			\
+	"console=$consoledev,$baudrate $othbootargs;"		\
+	"tftp $ramdiskaddr $ramdiskfile;"			\
+	"tftp $loadaddr $bootfile;"				\
+	"tftp $dtbaddr $dtbfile;"				\
+	"bootm $loadaddr $ramdiskaddr $dtbaddr"
+
+#undef	CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND	CONFIG_NFSBOOTCOMMAND
+#undef 	CONFIG_BOOTFILE
+#define CONFIG_BOOTFILE		uImage
+
+#define CONFIG_ETHADDR		00:E0:0C:00:00:FD
+#define CONFIG_ETH1ADDR		00:E0:0C:00:01:FD
+
+#define CONFIG_SERVERIP		192.168.1.1
+#define CONFIG_GATEWAYIP	192.168.1.1
+#define CONFIG_NETMASK		255.255.255.0
+
+#endif	/* ENV is in flash */
+
 
 /*-----------------------------------------------------------------------
  * Cache Configuration
Signature · 1 line
1.5.0.rc1.gf4b6c