[U-Boot] [PATCH 2/4] m68k: Make m548xevb config reusable for derived boards.

Philippe De Muyter phdm at macqel.be
Wed Jun 23 14:35:52 CEST 2010


Allow to redefine :
- CONFIG_BOARD_NAME_STRING and CONFIG_HOSTNAME,
- flash-model related constants :
    - TEXT_BASE (for loader) and CONFIG_SYS_CS0_BASE,
    - CONFIG_SYS_MAX_FLASH_SECT, CONFIG_ENV_OFFSET and CONFIG_ENV_SECT_SIZE,
- and CONFIG_CMD_PCI.
---
 board/freescale/m548xevb/config.mk  |    4 ++++
 board/freescale/m548xevb/m548xevb.c |    5 ++++-
 include/configs/M5485EVB.h          |   16 +++++++++++++---
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/board/freescale/m548xevb/config.mk b/board/freescale/m548xevb/config.mk
index fa66b75..10d9e3e 100644
--- a/board/freescale/m548xevb/config.mk
+++ b/board/freescale/m548xevb/config.mk
@@ -22,4 +22,8 @@
 # MA 02111-1307 USA
 #
 
+sinclude $(OBJTREE)/board/$(BOARDDIR)/config.tmp
+
+ifndef TEXT_BASE
 TEXT_BASE = 0xFF800000
+endif
diff --git a/board/freescale/m548xevb/m548xevb.c b/board/freescale/m548xevb/m548xevb.c
index 4a2a5c7..771bb35 100644
--- a/board/freescale/m548xevb/m548xevb.c
+++ b/board/freescale/m548xevb/m548xevb.c
@@ -34,7 +34,10 @@ DECLARE_GLOBAL_DATA_PTR;
 int checkboard(void)
 {
 	puts("Board: ");
-	puts("Freescale FireEngine 5485 EVB\n");
+#ifndef CONFIG_BOARD_NAME_STRING
+#define CONFIG_BOARD_NAME_STRING "Freescale FireEngine 5485 EVB\n"
+#endif
+	puts(CONFIG_BOARD_NAME_STRING);
 	return 0;
 };
 
diff --git a/include/configs/M5485EVB.h b/include/configs/M5485EVB.h
index f23b8b0..ceb3919 100644
--- a/include/configs/M5485EVB.h
+++ b/include/configs/M5485EVB.h
@@ -58,10 +58,12 @@
 #define CONFIG_CMD_MISC
 #define CONFIG_CMD_MII
 #define CONFIG_CMD_NET
+#ifndef CONFIG_NO_CMD_PCI
 #define CONFIG_CMD_PCI
+#define CONFIG_CMD_USB
+#endif
 #define CONFIG_CMD_PING
 #define CONFIG_CMD_REGINFO
-#define CONFIG_CMD_USB
 
 #define CONFIG_SLTTMR
 
@@ -149,7 +151,9 @@
 #define CONFIG_BOOTDELAY	1	/* autoboot after 5 seconds */
 #define CONFIG_UDP_CHECKSUM
 
+#ifndef CONFIG_HOSTNAME
 #define CONFIG_HOSTNAME		M548xEVB
+#endif
 #define CONFIG_EXTRA_ENV_SETTINGS		\
 	"netdev=eth0\0"				\
 	"loadaddr=10000\0"			\
@@ -247,7 +251,9 @@
 #	define CONFIG_SYS_FLASH_BASE		(CONFIG_SYS_CS0_BASE)
 #	define CONFIG_FLASH_CFI_DRIVER	1
 #	define CONFIG_SYS_FLASH_CFI_WIDTH	FLASH_CFI_16BIT
-#	define CONFIG_SYS_MAX_FLASH_SECT	137	/* max number of sectors on one chip */
+#	ifndef CONFIG_SYS_MAX_FLASH_SECT
+#		define CONFIG_SYS_MAX_FLASH_SECT	137	/* max number of sectors on one chip */
+#	endif
 #	define CONFIG_SYS_FLASH_PROTECTION	/* "Real" (hardware) sectors protection */
 #	define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
 #ifdef CONFIG_SYS_NOR1SZ
@@ -263,8 +269,10 @@
 /* Configuration for environment
  * Environment is embedded in u-boot in the second sector of the flash
  */
-#define CONFIG_ENV_OFFSET		0x2000
+#ifndef CONFIG_ENV_OFFSET
+#define CONFIG_ENV_OFFSET	0x2000
 #define CONFIG_ENV_SECT_SIZE	0x2000
+#endif
 #define CONFIG_ENV_IS_IN_FLASH	1
 
 /*-----------------------------------------------------------------------
@@ -299,7 +307,9 @@
  * CS4 - Available
  * CS5 - Available
  */
+#ifndef CONFIG_SYS_CS0_BASE
 #define CONFIG_SYS_CS0_BASE		0xFF800000
+#endif
 #define CONFIG_SYS_CS0_MASK		(((CONFIG_SYS_BOOTSZ << 20) - 1) & 0xFFFF0001)
 #define CONFIG_SYS_CS0_CTRL		0x00101980
 
-- 
1.6.3.3


More information about the U-Boot mailing list