[U-Boot] [PATCH v8 07/31] __HAVE_ARCH_GENERIC_BOARD controls availabilty of generic board

We are introducing a new unified board setup. Add a check to make sure that board config files do not define CONFIG_SYS_GENERIC_BOARD unless their architecture defines __HAVE_ARCH_GENERIC_BOARD
__HAVE_ARCH_GENERIC_BOARD will currently not be the default setting, but we can switch this later when most architecture support generic board.
Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v8: - Switch polarity: !CONFIG_SYS_LEGACY_BOARD becomes __HAVE_ARCH_GENERIC_BOARD
Changes in v7: - Add description of CONFIG_SYS_LEGACY_BOARD to README
Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
README | 10 ++++++++++ config.mk | 8 ++++++++ 2 files changed, 18 insertions(+)
diff --git a/README b/README index 42544ce..2c36e00 100644 --- a/README +++ b/README @@ -3211,6 +3211,16 @@ Configuration Settings: If defined, don't allow the -f switch to env set override variable access flags.
+- CONFIG_SYS_GENERIC_BOARD + This selects the architecture-generic board system instead of the + architecture-specific board files. It is intended to move boards + to this new framework over time. Defining this will disable the + arch/foo/lib/board.c file and use common/board_f.c and + common/board_r.c instead. To use this option your architecture + must support it (i.e. must define __HAVE_ARCH_GENERIC_BOARD in + its config.mk file). If you find problems enabling this option on + your board please report the problem and send patches! + The following definitions that deal with the placement and management of environment data (variable area); in general, we support the following configurations: diff --git a/config.mk b/config.mk index b7cd481..9886415 100644 --- a/config.mk +++ b/config.mk @@ -221,6 +221,14 @@ ifeq ($(CONFIG_SPL_BUILD),y) CPPFLAGS += -DCONFIG_SPL_BUILD endif
+# Does this architecture support generic board init? +ifeq ($(__HAVE_ARCH_GENERIC_BOARD),) +ifneq ($(CONFIG_SYS_GENERIC_BOARD),) +$(error Your architecture does not support generic board. Please undefined \ +CONFIG_SYS_GENERIC_BOARD in your board config file) +endif +endif + ifneq ($(RESET_VECTOR_ADDRESS),) CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS) endif

This enables generic board support so that ARM boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v8: - Define __HAVE_ARCH_GENERIC_BOARD in ARM's config.mk
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/arm/config.mk | 3 +++ arch/arm/include/asm/u-boot.h | 9 +++++++++ arch/arm/lib/Makefile | 3 +++ 3 files changed, 15 insertions(+)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 24b9d7c..a0c89b7 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif
+# Support generic board on ARM +__HAVE_ARCH_GENERIC_BOARD := y + PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
# Choose between ARM/Thumb instruction sets diff --git a/arch/arm/include/asm/u-boot.h b/arch/arm/include/asm/u-boot.h index 2ba98bc..8e7e27b 100644 --- a/arch/arm/include/asm/u-boot.h +++ b/arch/arm/include/asm/u-boot.h @@ -36,6 +36,12 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + +#ifndef __ASSEMBLY__ typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ ulong bi_arch_number; /* unique id for this board */ @@ -49,6 +55,9 @@ typedef struct bd_info { ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif + +#endif /* nCONFIG_SYS_GENERIC_BOARD */
/* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_ARM diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 57111af..24c7e7a 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -39,7 +39,10 @@ GLCOBJS += div0.o SOBJS-y += crt0.o
ifndef CONFIG_SPL_BUILD +ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o +endif + COBJS-y += bootm.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o

On Fri, Mar 8, 2013 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
This enables generic board support so that ARM boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v8:
- Define __HAVE_ARCH_GENERIC_BOARD in ARM's config.mk
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/arm/config.mk | 3 +++ arch/arm/include/asm/u-boot.h | 9 +++++++++ arch/arm/lib/Makefile | 3 +++ 3 files changed, 15 insertions(+)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 24b9d7c..a0c89b7 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif
+# Support generic board on ARM +__HAVE_ARCH_GENERIC_BOARD := y
PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
# Choose between ARM/Thumb instruction sets diff --git a/arch/arm/include/asm/u-boot.h b/arch/arm/include/asm/u-boot.h index 2ba98bc..8e7e27b 100644 --- a/arch/arm/include/asm/u-boot.h +++ b/arch/arm/include/asm/u-boot.h @@ -36,6 +36,12 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else
+#ifndef __ASSEMBLY__ typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ ulong bi_arch_number; /* unique id for this board */ @@ -49,6 +55,9 @@ typedef struct bd_info { ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif
+#endif /* nCONFIG_SYS_GENERIC_BOARD */
Typo?
/* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_ARM diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 57111af..24c7e7a 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -39,7 +39,10 @@ GLCOBJS += div0.o SOBJS-y += crt0.o
ifndef CONFIG_SPL_BUILD +ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o +endif
COBJS-y += bootm.o COBJS-$(CONFIG_SYS_L2_PL310) += cache-pl310.o SOBJS-$(CONFIG_USE_ARCH_MEMSET) += memset.o -- 1.8.1.3
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Hi Otavio,
On Sat, Mar 9, 2013 at 4:31 AM, Otavio Salvador otavio@ossystems.com.brwrote:
On Fri, Mar 8, 2013 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
This enables generic board support so that ARM boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v8:
- Define __HAVE_ARCH_GENERIC_BOARD in ARM's config.mk
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/arm/config.mk | 3 +++ arch/arm/include/asm/u-boot.h | 9 +++++++++ arch/arm/lib/Makefile | 3 +++ 3 files changed, 15 insertions(+)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 24b9d7c..a0c89b7 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif
+# Support generic board on ARM +__HAVE_ARCH_GENERIC_BOARD := y
PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
# Choose between ARM/Thumb instruction sets diff --git a/arch/arm/include/asm/u-boot.h
b/arch/arm/include/asm/u-boot.h
index 2ba98bc..8e7e27b 100644 --- a/arch/arm/include/asm/u-boot.h +++ b/arch/arm/include/asm/u-boot.h @@ -36,6 +36,12 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else
+#ifndef __ASSEMBLY__ typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ ulong bi_arch_number; /* unique id for this board */ @@ -49,6 +55,9 @@ typedef struct bd_info { ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif
+#endif /* nCONFIG_SYS_GENERIC_BOARD */
Typo?
The 'n' is intended to mean 'not'. Perhaps I should use ! instead?
Regards, Simon

On Sat, Mar 9, 2013 at 3:30 PM, Simon Glass sjg@chromium.org wrote:
Hi Otavio,
On Sat, Mar 9, 2013 at 4:31 AM, Otavio Salvador otavio@ossystems.com.br wrote:
On Fri, Mar 8, 2013 at 8:45 PM, Simon Glass sjg@chromium.org wrote:
This enables generic board support so that ARM boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v8:
- Define __HAVE_ARCH_GENERIC_BOARD in ARM's config.mk
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/arm/config.mk | 3 +++ arch/arm/include/asm/u-boot.h | 9 +++++++++ arch/arm/lib/Makefile | 3 +++ 3 files changed, 15 insertions(+)
diff --git a/arch/arm/config.mk b/arch/arm/config.mk index 24b9d7c..a0c89b7 100644 --- a/arch/arm/config.mk +++ b/arch/arm/config.mk @@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif
+# Support generic board on ARM +__HAVE_ARCH_GENERIC_BOARD := y
PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
# Choose between ARM/Thumb instruction sets diff --git a/arch/arm/include/asm/u-boot.h b/arch/arm/include/asm/u-boot.h index 2ba98bc..8e7e27b 100644 --- a/arch/arm/include/asm/u-boot.h +++ b/arch/arm/include/asm/u-boot.h @@ -36,6 +36,12 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else
+#ifndef __ASSEMBLY__ typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ ulong bi_arch_number; /* unique id for this board */ @@ -49,6 +55,9 @@ typedef struct bd_info { ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif
+#endif /* nCONFIG_SYS_GENERIC_BOARD */
Typo?
The 'n' is intended to mean 'not'. Perhaps I should use ! instead?
I didn't see this use in rest of code; for me it is fine but something to think about.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 03/09/2013 01:30 PM, Simon Glass wrote:
Hi Otavio,
On Sat, Mar 9, 2013 at 4:31 AM, Otavio Salvador <otavio@ossystems.com.br mailto:otavio@ossystems.com.br> wrote:
On Fri, Mar 8, 2013 at 8:45 PM, Simon Glass <sjg@chromium.org mailto:sjg@chromium.org> wrote:
This enables generic board support so that ARM boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass <sjg@chromium.org
--- Changes in v8: - Define __HAVE_ARCH_GENERIC_BOARD in ARM's config.mk
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/arm/config.mk http://config.mk | 3 +++ arch/arm/include/asm/u-boot.h | 9 +++++++++ arch/arm/lib/Makefile | 3 +++ 3 files changed, 15 insertions(+)
diff --git a/arch/arm/config.mk http://config.mk
b/arch/arm/config.mk http://config.mk
index 24b9d7c..a0c89b7 100644 --- a/arch/arm/config.mk http://config.mk +++ b/arch/arm/config.mk http://config.mk @@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif
+# Support generic board on ARM +__HAVE_ARCH_GENERIC_BOARD := y
- PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
# Choose between ARM/Thumb instruction sets diff --git a/arch/arm/include/asm/u-boot.h
b/arch/arm/include/asm/u-boot.h
index 2ba98bc..8e7e27b 100644 --- a/arch/arm/include/asm/u-boot.h +++ b/arch/arm/include/asm/u-boot.h @@ -36,6 +36,12 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + +#ifndef __ASSEMBLY__ typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ ulong bi_arch_number; /* unique id for this board */ @@ -49,6 +55,9 @@ typedef struct bd_info { ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif + +#endif /* nCONFIG_SYS_GENERIC_BOARD */
Typo?
The 'n' is intended to mean 'not'. Perhaps I should use ! instead?
!CONFIG is the style of the rest of the codebase. Thanks.
- -- Tom

Hi Tom,
On Sun, Mar 10, 2013 at 6:27 AM, Tom Rini trini@ti.com wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 03/09/2013 01:30 PM, Simon Glass wrote:
Hi Otavio,
On Sat, Mar 9, 2013 at 4:31 AM, Otavio Salvador <otavio@ossystems.com.br mailto:otavio@ossystems.com.br> wrote:
On Fri, Mar 8, 2013 at 8:45 PM, Simon Glass <sjg@chromium.org mailto:sjg@chromium.org> wrote:
This enables generic board support so that ARM boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass <sjg@chromium.org
--- Changes in v8: - Define __HAVE_ARCH_GENERIC_BOARD in ARM's config.mk
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/arm/config.mk http://config.mk | 3 +++ arch/arm/include/asm/u-boot.h | 9 +++++++++ arch/arm/lib/Makefile | 3 +++ 3 files changed, 15 insertions(+)
diff --git a/arch/arm/config.mk http://config.mk
b/arch/arm/config.mk http://config.mk
index 24b9d7c..a0c89b7 100644 --- a/arch/arm/config.mk http://config.mk +++ b/arch/arm/config.mk http://config.mk @@ -31,6 +31,9 @@ CONFIG_STANDALONE_LOAD_ADDR = 0xc100000 endif endif
+# Support generic board on ARM +__HAVE_ARCH_GENERIC_BOARD := y
- PLATFORM_CPPFLAGS += -DCONFIG_ARM -D__ARM__
# Choose between ARM/Thumb instruction sets diff --git a/arch/arm/include/asm/u-boot.h
b/arch/arm/include/asm/u-boot.h
index 2ba98bc..8e7e27b 100644 --- a/arch/arm/include/asm/u-boot.h +++ b/arch/arm/include/asm/u-boot.h @@ -36,6 +36,12 @@ #ifndef _U_BOOT_H_ #define _U_BOOT_H_ 1
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + +#ifndef __ASSEMBLY__ typedef struct bd_info { unsigned int bi_baudrate; /* serial console baudrate */ ulong bi_arch_number; /* unique id for this board */ @@ -49,6 +55,9 @@ typedef struct bd_info { ulong size; } bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t; +#endif + +#endif /* nCONFIG_SYS_GENERIC_BOARD */
Typo?
The 'n' is intended to mean 'not'. Perhaps I should use ! instead?
!CONFIG is the style of the rest of the codebase. Thanks.
OK, I will resend the affected patch(es).
Regards, Simon

This enables generic board support so that ppc boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v8: - Define __HAVE_ARCH_GENERIC_BOARD in PPC's config.mk
Changes in v7: None Changes in v6: None Changes in v5: None Changes in v4: None Changes in v3: None Changes in v2: None
arch/powerpc/config.mk | 3 +++ arch/powerpc/include/asm/u-boot.h | 7 +++++++ arch/powerpc/lib/Makefile | 2 ++ 3 files changed, 12 insertions(+)
diff --git a/arch/powerpc/config.mk b/arch/powerpc/config.mk index b706281..e32d2bf 100644 --- a/arch/powerpc/config.mk +++ b/arch/powerpc/config.mk @@ -29,6 +29,9 @@ PLATFORM_RELFLAGS += -fpic -mrelocatable -ffunction-sections -fdata-sections PLATFORM_CPPFLAGS += -DCONFIG_PPC -D__powerpc__ PLATFORM_LDFLAGS += -n
+# Support generic board on PPC +__HAVE_ARCH_GENERIC_BOARD := y + # # When cross-compiling on NetBSD, we have to define __PPC__ or else we # will pick up a va_list declaration that is incompatible with the diff --git a/arch/powerpc/include/asm/u-boot.h b/arch/powerpc/include/asm/u-boot.h index 7229a98..951dd6a 100644 --- a/arch/powerpc/include/asm/u-boot.h +++ b/arch/powerpc/include/asm/u-boot.h @@ -34,6 +34,11 @@ * include/asm-ppc/u-boot.h */
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + #ifndef __ASSEMBLY__
typedef struct bd_info { @@ -144,6 +149,8 @@ typedef struct bd_info {
#endif /* __ASSEMBLY__ */
+#endif /* nCONFIG_SYS_GENERIC_BOARD */ + /* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_PPC
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 86cf02a..59c723b 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile @@ -59,8 +59,10 @@ SOBJS-y += reloc.o
COBJS-$(CONFIG_BAT_RW) += bat_rw.o ifndef CONFIG_SPL_BUILD +ifndef CONFIG_SYS_GENERIC_BOARD COBJS-y += board.o endif +endif COBJS-y += bootm.o COBJS-y += cache.o COBJS-y += extable.o

This enables generic board support so that x86 boards can define CONFIG_SYS_GENERIC_BOARD.
Signed-off-by: Simon Glass sjg@chromium.org --- Changes in v8: None Changes in v7: None Changes in v6: None Changes in v5: - Avoid setting up gd on x86 as it is already done
Changes in v4: None Changes in v3: None Changes in v2: None
arch/x86/include/asm/u-boot.h | 11 +++++++++++ arch/x86/lib/Makefile | 3 +++ common/board_r.c | 2 ++ 3 files changed, 16 insertions(+)
diff --git a/arch/x86/include/asm/u-boot.h b/arch/x86/include/asm/u-boot.h index 2f45c7b..19c038a 100644 --- a/arch/x86/include/asm/u-boot.h +++ b/arch/x86/include/asm/u-boot.h @@ -39,6 +39,13 @@ #include <config.h> #include <compiler.h>
+#ifdef CONFIG_SYS_GENERIC_BOARD +/* Use the generic board which requires a unified bd_info */ +#include <asm-generic/u-boot.h> +#else + +#ifndef __ASSEMBLY__ + typedef struct bd_info { unsigned long bi_memstart; /* start of DRAM memory */ phys_size_t bi_memsize; /* size of DRAM memory in bytes */ @@ -60,6 +67,10 @@ typedef struct bd_info { }bi_dram[CONFIG_NR_DRAM_BANKS]; } bd_t;
+#endif /* __ASSEMBLY__ */ + +#endif /* nCONFIG_SYS_GENERIC_BOARD */ + /* For image.h:image_check_target_arch() */ #define IH_ARCH_DEFAULT IH_ARCH_I386
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile index 9b24dc5..ee89354 100644 --- a/arch/x86/lib/Makefile +++ b/arch/x86/lib/Makefile @@ -25,7 +25,10 @@ include $(TOPDIR)/config.mk
LIB = $(obj)lib$(ARCH).o
+ifeq ($(CONFIG_SYS_GENERIC_BOARD),) COBJS-y += board.o +endif + COBJS-y += bootm.o COBJS-y += cmd_boot.o COBJS-y += gcc.o diff --git a/common/board_r.c b/common/board_r.c index 29eccdf..230887d 100644 --- a/common/board_r.c +++ b/common/board_r.c @@ -509,11 +509,13 @@ static int show_model_r(void) #endif
/* enable exceptions */ +#ifdef CONFIG_ARM static int initr_enable_interrupts(void) { enable_interrupts(); return 0; } +#endif
#ifdef CONFIG_CMD_NET static int initr_ethaddr(void)
participants (3)
-
Otavio Salvador
-
Simon Glass
-
Tom Rini