[U-Boot] [PATCH 7/7] Save the env variables to SDcard and SPI flash for MPC8536DS

Mingkai Hu Mingkai.hu at freescale.com
Mon Mar 16 03:52:23 CET 2009


MPC8536DS offer booting from SDcard or SPI flash. When after
booting from SD card/SPI flash, the environment variables can
to be saved on it, so this patch should be used together with
the MMC driver and eSPI controller/SPI flash driver in u-boot.

Signed-off-by: Mingkai Hu <Mingkai.hu at freescale.com>
---
 include/configs/MPC8536DS.h |   43 +++++++++++++++++++++++++++++++++++++------
 1 files changed, 37 insertions(+), 6 deletions(-)

diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index b19f028..974e432 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -366,6 +366,19 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #define CONFIG_SYS_EEPROM_BUS_NUM	1
 
 /*
+ * eSPI - Enhanced SPI
+ */
+#define CONFIG_SPI_FLASH
+#define CONFIG_SPI_FLASH_SPANSION
+
+#define CONFIG_HARD_SPI
+#define CONFIG_FSL_ESPI
+
+#define CONFIG_CMD_SF
+#define CONFIG_SF_DEFAULT_SPEED		10000000
+#define CONFIG_SF_DEFAULT_MODE		0
+
+/*
  * General PCI
  * Memory space is mapped 1-1, but I/O space must start from 0.
  */
@@ -507,14 +520,32 @@ extern unsigned long get_board_ddr_clk(unsigned long dummy);
 /*
  * Environment
  */
-#define CONFIG_ENV_IS_IN_FLASH	1
-#if CONFIG_SYS_MONITOR_BASE > 0xfff80000
-#define CONFIG_ENV_ADDR		0xfff80000
+#if !defined(CONFIG_SDCARD_U_BOOT)
+	#define CONFIG_ENV_IS_IN_FLASH	1
+	#if CONFIG_SYS_MONITOR_BASE > 0xfff80000
+	#define CONFIG_ENV_ADDR		0xfff80000
+	#else
+	#define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)
+	#endif
+	#define CONFIG_ENV_SIZE		0x2000
+	#define CONFIG_ENV_SECT_SIZE	0x20000 /* 128K (one sector) */
 #else
-#define CONFIG_ENV_ADDR		(CONFIG_SYS_MONITOR_BASE - CONFIG_ENV_SECT_SIZE)
+#ifdef CONFIG_SPIFLASH_U_BOOT
+	#define CONFIG_ENV_IS_IN_SPI_FLASH	1
+	#define CONFIG_ENV_SPI_BUS		0
+	#define CONFIG_ENV_SPI_CS		0
+	#define CONFIG_ENV_SPI_MAX_HZ		10000000
+	#define CONFIG_ENV_SPI_MODE		0
+	#define CONFIG_ENV_SIZE			0x2000		/* 8KB */
+	#define CONFIG_ENV_OFFSET		0x100000	/* 1MB */
+	#define CONFIG_ENV_SECT_SIZE		0x10000
+#else
+	#define CONFIG_ENV_IS_IN_SDCARD		1
+	#define CONFIG_ENV_SIZE			0x2000
+	/*env located after the u-boot image, size is 8K*/
+	#define CONFIG_ENV_ADDR_IN_RAM	((TEXT_BASE - 0x1000) + 0x80000)
+#endif
 #endif
-#define CONFIG_ENV_SIZE		0x2000
-#define CONFIG_ENV_SECT_SIZE	0x20000 /* 128K (one sector) */
 
 #define CONFIG_LOADS_ECHO	1	/* echo on for serial download */
 #define CONFIG_SYS_LOADS_BAUD_CHANGE	1	/* allow baudrate change */
-- 
1.5.4



More information about the U-Boot mailing list