[U-Boot-Users] [PATCH/review] Blackfin: convert BFIN_CPU to CONFIG_BFIN_CPU

Mike Frysinger vapier at gentoo.org
Mon Feb 25 09:09:54 CET 2008


Stop tying things to the processor that should be tied to other defines and
change BFIN_CPU to CONFIG_BFIN_CPU so that it can be used in the build
system to select the -mcpu option.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 blackfin_config.mk              |    6 +++++-
 board/bf533-ezkit/bf533-ezkit.c |    7 -------
 board/bf533-stamp/bf533-stamp.c |    7 -------
 board/bf537-stamp/bf537-stamp.c |   11 -----------
 include/configs/bf533-ezkit.h   |    9 ++++-----
 include/configs/bf533-stamp.h   |   25 ++++---------------------
 include/configs/bf537-stamp.h   |   34 +++++++++-------------------------
 include/configs/bf561-ezkit.h   |    6 +++++-
 lib_blackfin/board.c            |    3 ++-
 9 files changed, 29 insertions(+), 79 deletions(-)

diff --git a/blackfin_config.mk b/blackfin_config.mk
index a7513ea..d90eb23 100644
--- a/blackfin_config.mk
+++ b/blackfin_config.mk
@@ -24,9 +24,13 @@
 PLATFORM_RELFLAGS += -ffixed-P5
 PLATFORM_CPPFLAGS += -DCONFIG_BLACKFIN
 
+ifneq (,$(CONFIG_BFIN_CPU))
+PLATFORM_RELFLAGS += -mcpu=$(CONFIG_BFIN_CPU)
+endif
+
 SYM_PREFIX = _
 
 LDR_FLAGS += --use-vmas
-ifeq (,$(findstring s,$(MAKEFLAGS)))
+ifneq (,$(findstring s,$(MAKEFLAGS)))
 LDR_FLAGS += --quiet
 endif
diff --git a/board/bf533-ezkit/bf533-ezkit.c b/board/bf533-ezkit/bf533-ezkit.c
index 98ed6f8..738f69c 100644
--- a/board/bf533-ezkit/bf533-ezkit.c
+++ b/board/bf533-ezkit/bf533-ezkit.c
@@ -34,13 +34,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int checkboard(void)
 {
-#if (BFIN_CPU == ADSP_BF531)
-	printf("CPU:   ADSP BF531 Rev.: 0.%d\n", *pCHIPID >> 28);
-#elif (BFIN_CPU == ADSP_BF532)
-	printf("CPU:   ADSP BF532 Rev.: 0.%d\n", *pCHIPID >> 28);
-#else
-	printf("CPU:   ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28);
-#endif
 	printf("Board: ADI BF533 EZ-Kit Lite board\n");
 	printf("       Support: http://blackfin.uclinux.org/\n");
 	return 0;
diff --git a/board/bf533-stamp/bf533-stamp.c b/board/bf533-stamp/bf533-stamp.c
index af03597..c4dde92 100644
--- a/board/bf533-stamp/bf533-stamp.c
+++ b/board/bf533-stamp/bf533-stamp.c
@@ -43,13 +43,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int checkboard(void)
 {
-#if (BFIN_CPU == ADSP_BF531)
-	printf("CPU:   ADSP BF531 Rev.: 0.%d\n", *pCHIPID >> 28);
-#elif (BFIN_CPU == ADSP_BF532)
-	printf("CPU:   ADSP BF532 Rev.: 0.%d\n", *pCHIPID >> 28);
-#else
-	printf("CPU:   ADSP BF533 Rev.: 0.%d\n", *pCHIPID >> 28);
-#endif
 	printf("Board: ADI BF533 Stamp board\n");
 	printf("       Support: http://blackfin.uclinux.org/\n");
 	return 0;
diff --git a/board/bf537-stamp/bf537-stamp.c b/board/bf537-stamp/bf537-stamp.c
index e36a1b6..6ca8e21 100644
--- a/board/bf537-stamp/bf537-stamp.c
+++ b/board/bf537-stamp/bf537-stamp.c
@@ -31,7 +31,6 @@
 #include <asm/blackfin.h>
 #include <asm/io.h>
 #include <net.h>
-#include "ether_bf537.h"
 #include <asm/mach-common/bits/bootrom.h>
 
 /**
@@ -56,13 +55,6 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int checkboard(void)
 {
-#if (BFIN_CPU == ADSP_BF534)
-	printf("CPU:   ADSP BF534 Rev.: 0.%d\n", *pCHIPID >> 28);
-#elif (BFIN_CPU == ADSP_BF536)
-	printf("CPU:   ADSP BF536 Rev.: 0.%d\n", *pCHIPID >> 28);
-#else
-	printf("CPU:   ADSP BF537 Rev.: 0.%d\n", *pCHIPID >> 28);
-#endif
 	printf("Board: ADI BF537 stamp board\n");
 	printf("       Support: http://blackfin.uclinux.org/\n");
 	return 0;
@@ -142,9 +134,6 @@ int misc_init_r(void)
 			pMACaddr[2], pMACaddr[3], pMACaddr[4], pMACaddr[5]);
 		setenv("ethaddr", nid);
 	}
-	if (getenv("ethaddr")) {
-		SetupMacAddr(SrcAddr);
-	}
 #endif
 #endif				/* BFIN_BOOT_MODE == BF537_BYPASS_BOOT */
 
diff --git a/include/configs/bf533-ezkit.h b/include/configs/bf533-ezkit.h
index 6cb6bc4..f2c8703 100644
--- a/include/configs/bf533-ezkit.h
+++ b/include/configs/bf533-ezkit.h
@@ -5,6 +5,8 @@
 #ifndef __CONFIG_EZKIT533_H__
 #define __CONFIG_EZKIT533_H__
 
+#include <asm/blackfin-config-pre.h>
+
 #define CONFIG_BAUDRATE		57600
 #define CONFIG_STAMP		1
 
@@ -41,10 +43,7 @@
 
 #define CONFIG_PANIC_HANG 1
 
-#define ADSP_BF531		0x31
-#define ADSP_BF532		0x32
-#define ADSP_BF533		0x33
-#define BFIN_CPU		ADSP_BF533
+#define CONFIG_BFIN_CPU	bf533-0.3
 
 /* This sets the default state of the cache on U-Boot's boot */
 #define CONFIG_ICACHE_ON
@@ -120,7 +119,7 @@
 
 #define CONFIG_BOOTARGS "root=/dev/mtdblock0 ip=192.168.0.15:192.168.0.2:192.168.0.1:255.255.255.0:ezkit:eth0:off console=ttyBF0,57600"
 
-#define	CFG_PROMPT		"ezkit> "	/* Monitor Command Prompt */
+#define	CFG_PROMPT		"bfin> "	/* Monitor Command Prompt */
 #if defined(CONFIG_CMD_KGDB)
 #define	CFG_CBSIZE		1024	/* Console I/O Buffer Size */
 #else
diff --git a/include/configs/bf533-stamp.h b/include/configs/bf533-stamp.h
index cce6ef7..76dd2fa 100644
--- a/include/configs/bf533-stamp.h
+++ b/include/configs/bf533-stamp.h
@@ -5,6 +5,8 @@
 #ifndef __CONFIG_STAMP_H__
 #define __CONFIG_STAMP_H__
 
+#include <asm/blackfin-config-pre.h>
+
 #define CONFIG_STAMP			1
 #define CONFIG_RTC_BFIN			1
 #define CONFIG_BF533			1
@@ -21,10 +23,7 @@
 
 #define CONFIG_PANIC_HANG 1
 
-#define ADSP_BF531		0x31
-#define ADSP_BF532		0x32
-#define ADSP_BF533		0x33
-#define BFIN_CPU		ADSP_BF533
+#define CONFIG_BFIN_CPU	bf533-0.3
 
 /* This sets the default state of the cache on U-Boot's boot */
 #define CONFIG_ICACHE_ON
@@ -329,23 +328,7 @@
 #define CONFIG_BAUDRATE		57600
 #define CFG_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
 
-#if (BFIN_BOOT_MODE == BF533_SPI_BOOT)
-#if (BFIN_CPU == ADSP_BF531)
-#define	CFG_PROMPT	"serial_bf531> "	/* Monitor Command Prompt */
-#elif (BFIN_CPU == ADSP_BF532)
-#define	CFG_PROMPT	"serial_bf532> "	/* Monitor Command Prompt */
-#else
-#define	CFG_PROMPT	"serial_bf533> "	/* Monitor Command Prompt */
-#endif
-#else
-#if (BFIN_CPU == ADSP_BF531)
-#define	CFG_PROMPT	"bf531> "	/* Monitor Command Prompt */
-#elif (BFIN_CPU == ADSP_BF532)
-#define	CFG_PROMPT	"bf532> "	/* Monitor Command Prompt */
-#else
-#define	CFG_PROMPT	"bf533> "	/* Monitor Command Prompt */
-#endif
-#endif
+#define	CFG_PROMPT		"bfin> "	/* Monitor Command Prompt */
 
 #if defined(CONFIG_CMD_KGDB)
 #define CFG_CBSIZE	1024		/* Console I/O Buffer Size */
diff --git a/include/configs/bf537-stamp.h b/include/configs/bf537-stamp.h
index b9a9e3c..0679f43 100644
--- a/include/configs/bf537-stamp.h
+++ b/include/configs/bf537-stamp.h
@@ -5,6 +5,8 @@
 #ifndef __CONFIG_BF537_H__
 #define __CONFIG_BF537_H__
 
+#include <asm/blackfin-config-pre.h>
+
 #define CFG_LONGHELP		1
 #define CONFIG_CMDLINE_EDITING	1
 #define CONFIG_BAUDRATE		57600
@@ -31,10 +33,8 @@
 
 #define CONFIG_PANIC_HANG 1
 
-#define ADSP_BF534		0x34
-#define ADSP_BF536		0x36
-#define ADSP_BF537		0x37
-#define BFIN_CPU		ADSP_BF537
+#define CONFIG_BFIN_CPU	bf537-0.2
+#define CONFIG_BFIN_MAC
 
 /* This sets the default state of the cache on U-Boot's boot */
 #define CONFIG_ICACHE_ON
@@ -113,7 +113,7 @@
  * Network Settings
  */
 /* network support */
-#if (BFIN_CPU != ADSP_BF534)
+#ifdef CONFIG_BFIN_MAC
 #define CONFIG_IPADDR		192.168.0.15
 #define CONFIG_NETMASK		255.255.255.0
 #define CONFIG_GATEWAYIP	192.168.0.1
@@ -186,7 +186,7 @@
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_DATE
 
-#if (BFIN_CPU == ADSP_BF534)
+#ifndef CONFIG_BFIN_MAC
 #undef CONFIG_CMD_NET
 #else
 #define CONFIG_CMD_PING
@@ -219,7 +219,7 @@
 #define CONFIG_LOADADDR	0x1000000
 
 #if (BFIN_BOOT_MODE == BF537_BYPASS_BOOT)
-#if (BFIN_CPU != ADSP_BF534)
+#ifdef CONFIG_BFIN_MAC
 #define CONFIG_EXTRA_ENV_SETTINGS				\
 	"ramargs=setenv bootargs root=/dev/mtdblock0 rw console=ttyBF0,57600\0"	\
 	"nfsargs=setenv bootargs root=/dev/nfs rw "		\
@@ -243,7 +243,7 @@
 	""
 #endif
 #elif (BFIN_BOOT_MODE == BF537_SPI_MASTER_BOOT)
-#if (BFIN_CPU != ADSP_BF534)
+#ifdef CONFIG_BFIN_MAC
 #define CONFIG_EXTRA_ENV_SETTINGS				\
 	"ramargs=setenv bootargs root=/dev/mtdblock0 rw console=ttyBF0,57600\0"	\
 	"nfsargs=setenv bootargs root=/dev/nfs rw "		\
@@ -267,23 +267,7 @@
 #endif
 #endif
 
-#if (BFIN_BOOT_MODE == BF537_SPI_MASTER_BOOT)
-#if (BFIN_CPU == ADSP_BF534)
-#define	CFG_PROMPT		"serial_bf534> "	/* Monitor Command Prompt */
-#elif (BFIN_CPU == ADSP_BF536)
-#define	CFG_PROMPT		"serial_bf536> "	/* Monitor Command Prompt */
-#else
-#define	CFG_PROMPT		"serial_bf537> "	/* Monitor Command Prompt */
-#endif
-#else
-#if (BFIN_CPU == ADSP_BF534)
-#define	CFG_PROMPT		"bf534> "	/* Monitor Command Prompt */
-#elif (BFIN_CPU == ADSP_BF536)
-#define	CFG_PROMPT		"bf536> "	/* Monitor Command Prompt */
-#else
-#define	CFG_PROMPT		"bf537> "	/* Monitor Command Prompt */
-#endif
-#endif
+#define	CFG_PROMPT		"bfin> "	/* Monitor Command Prompt */
 
 #if defined(CONFIG_CMD_KGDB)
 #define	CFG_CBSIZE		1024	/* Console I/O Buffer Size */
diff --git a/include/configs/bf561-ezkit.h b/include/configs/bf561-ezkit.h
index 2966260..c29555a 100644
--- a/include/configs/bf561-ezkit.h
+++ b/include/configs/bf561-ezkit.h
@@ -5,6 +5,8 @@
 #ifndef __CONFIG_EZKIT561_H__
 #define __CONFIG_EZKIT561_H__
 
+#include <asm/blackfin-config-pre.h>
+
 #define CONFIG_VDSP		1
 #define CONFIG_BF561		1
 
@@ -18,6 +20,8 @@
 
 #define CONFIG_PANIC_HANG 1
 
+#define CONFIG_BFIN_CPU	bf561-0.3
+
 /*
 * Boot Mode Set
 * Blackfin can support several boot modes
@@ -216,7 +220,7 @@
  */
 #define CFG_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
 
-#define	CFG_PROMPT		"ezkit> "	/* Monitor Command Prompt */
+#define	CFG_PROMPT		"bfin> "	/* Monitor Command Prompt */
 
 #if defined(CONFIG_CMD_KGDB)
 #define	CFG_CBSIZE		1024		/* Console I/O Buffer Size */
diff --git a/lib_blackfin/board.c b/lib_blackfin/board.c
index 86a3b67..2a5a2fc 100644
--- a/lib_blackfin/board.c
+++ b/lib_blackfin/board.c
@@ -116,6 +116,7 @@ static int display_banner(void)
 {
 	sprintf(version_string, VERSION_STRING_FORMAT, VERSION_STRING);
 	printf("%s\n", version_string);
+	printf("CPU:   ADSP " MK_STR(CONFIG_BFIN_CPU) " (Detected Rev: 0.%d)\n", bfin_revid());
 	return (0);
 }
 
@@ -404,7 +405,7 @@ void board_init_r(gd_t * id, ulong dest_addr)
 	misc_init_r();
 #endif
 
-#if ((BFIN_CPU == ADSP_BF537) || (BFIN_CPU == ADSP_BF536))
+#ifdef CONFIG_CMD_NET
 	printf("Net:    ");
 	eth_initialize(bd);
 #endif
-- 
1.5.4.2





More information about the U-Boot mailing list