From b106961c2e4e7f339485a401ebb06c936fc432ee Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Dec 2023 07:16:54 -0500 Subject: global: Restrict use of '#include ' In general terms, we -include include/linux/kconfig.h and so normal U-Boot code does not need to also #include it. However, for code which is shared with userspace we may need to add it so that either our full config is available or so that macros such as CONFIG_IS_ENABLED() can be evaluated. In this case make sure that we guard these includes with a test for USE_HOSTCC so that it clear as to why we're doing this. Reviewed-by: Simon Glass Signed-off-by: Tom Rini --- include/bootstage.h | 2 ++ include/configs/at91-sama5_common.h | 2 -- include/configs/tqma6.h | 1 - include/env_internal.h | 1 - include/u-boot/ecdsa.h | 1 - 5 files changed, 2 insertions(+), 5 deletions(-) (limited to 'include') diff --git a/include/bootstage.h b/include/bootstage.h index 59a76d0f0c4..f4e77b09d74 100644 --- a/include/bootstage.h +++ b/include/bootstage.h @@ -12,7 +12,9 @@ #define _BOOTSTAGE_H #include +#ifdef USE_HOSTCC #include +#endif /* Flags for each bootstage record */ enum bootstage_flags { diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index 4aa876a9f79..81c76ef52a7 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -9,8 +9,6 @@ #ifndef __AT91_SAMA5_COMMON_H #define __AT91_SAMA5_COMMON_H -#include - /* ARM asynchronous clock */ #define CFG_SYS_AT91_SLOW_CLOCK 32768 #define CFG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h index 8c75a75a9e5..2da76f15431 100644 --- a/include/configs/tqma6.h +++ b/include/configs/tqma6.h @@ -8,7 +8,6 @@ #ifndef __CONFIG_H #define __CONFIG_H -#include #include /* place code in last 4 MiB of RAM */ diff --git a/include/env_internal.h b/include/env_internal.h index 5c289d67f90..cbd1ef3e914 100644 --- a/include/env_internal.h +++ b/include/env_internal.h @@ -15,7 +15,6 @@ #ifndef _ENV_INTERNAL_H_ #define _ENV_INTERNAL_H_ -#include /************************************************************************** * diff --git a/include/u-boot/ecdsa.h b/include/u-boot/ecdsa.h index 6e0269e3aed..53490c6b287 100644 --- a/include/u-boot/ecdsa.h +++ b/include/u-boot/ecdsa.h @@ -8,7 +8,6 @@ #include #include -#include /** * crypto_algo API impementation for ECDSA; -- cgit v1.3.1 From 10be393cf0af497a7b71b87afc5a3e3eb8fecdd5 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Dec 2023 13:16:43 -0500 Subject: qe: Add to linux/immap_qe.h Given how we define QE_MURAM_SIZE today, this header needs to have added to it. Reviewed-by: Simon Glass Signed-off-by: Tom Rini --- include/linux/immap_qe.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/linux/immap_qe.h b/include/linux/immap_qe.h index 45307f51c10..a692f5dfb37 100644 --- a/include/linux/immap_qe.h +++ b/include/linux/immap_qe.h @@ -11,6 +11,8 @@ #ifndef __IMMAP_QE_H__ #define __IMMAP_QE_H__ +#include + #ifdef CONFIG_MPC83xx #if defined(CONFIG_ARCH_MPC8360) #define QE_MURAM_SIZE 0xc000UL -- cgit v1.3.1 From 28388f4ddbfa9a874e3c2d59217a14e51ce8e5e0 Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Dec 2023 13:16:44 -0500 Subject: arc: Cleanup and audit usage of We need to include directly when a file needs to have something such as CFG_SYS_SDRAM_SIZE referenced as this file is not automatically globally included and is most commonly indirectly included via common.h. Remove most cases of arc including config.h directly, but add it where needed. Further clean up the tb100 board config.h file so that we don't rely on config.h being included there for a value used in a single place. Reviewed-by: Simon Glass Signed-off-by: Tom Rini --- arch/arc/include/asm/arc-bcr.h | 2 -- arch/arc/include/asm/arcregs.h | 1 - arch/arc/include/asm/cache.h | 2 -- arch/arc/lib/cpu.c | 1 + board/abilis/tb100/tb100.c | 4 ++++ include/configs/tb100.h | 21 --------------------- 6 files changed, 5 insertions(+), 26 deletions(-) (limited to 'include') diff --git a/arch/arc/include/asm/arc-bcr.h b/arch/arc/include/asm/arc-bcr.h index 823906d946e..a6c972bf1e3 100644 --- a/arch/arc/include/asm/arc-bcr.h +++ b/arch/arc/include/asm/arc-bcr.h @@ -13,8 +13,6 @@ #define __ARC_BCR_H #ifndef __ASSEMBLY__ -#include - union bcr_di_cache { struct { #ifdef CONFIG_CPU_BIG_ENDIAN diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h index a9f54f61e0c..273fb8eed85 100644 --- a/arch/arc/include/asm/arcregs.h +++ b/arch/arc/include/asm/arcregs.h @@ -7,7 +7,6 @@ #define _ASM_ARC_ARCREGS_H #include -#include /* * ARC architecture has additional address space - auxiliary registers. diff --git a/arch/arc/include/asm/cache.h b/arch/arc/include/asm/cache.h index 74cff716ef6..65dff421483 100644 --- a/arch/arc/include/asm/cache.h +++ b/arch/arc/include/asm/cache.h @@ -6,8 +6,6 @@ #ifndef __ASM_ARC_CACHE_H #define __ASM_ARC_CACHE_H -#include - /* * As of today we may handle any L1 cache line length right in software. * For that essentially cache line length is a variable not constant. diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c index 803dfd42558..593950449f2 100644 --- a/arch/arc/lib/cpu.c +++ b/arch/arc/lib/cpu.c @@ -3,6 +3,7 @@ * Copyright (C) 2013-2014, 2018 Synopsys, Inc. All rights reserved. */ +#include #include #include #include diff --git a/board/abilis/tb100/tb100.c b/board/abilis/tb100/tb100.c index 3dc9e14ef8c..eb7d1290813 100644 --- a/board/abilis/tb100/tb100.c +++ b/board/abilis/tb100/tb100.c @@ -14,6 +14,10 @@ void reset_cpu(void) writel(0x1, (void *)CRM_SWRESET); } +/* + * Ethernet configuration + */ +#define ETH0_BASE_ADDRESS 0xFE100000 int board_eth_init(struct bd_info *bis) { if (designware_initialize(ETH0_BASE_ADDRESS, 0) >= 0) diff --git a/include/configs/tb100.h b/include/configs/tb100.h index 1318f5e5ee4..08b6f3219c3 100644 --- a/include/configs/tb100.h +++ b/include/configs/tb100.h @@ -21,25 +21,4 @@ */ #define CFG_SYS_NS16550_CLK 166666666 -/* - * Even though the board houses Realtek RTL8211E PHY - * corresponding PHY driver (drivers/net/phy/realtek.c) behaves unexpectedly. - * In particular "parse_status" reports link is down. - * - * Until Realtek PHY driver is fixed fall back to generic PHY driver - * which implements all required functionality and behaves much more stable. - * - * - */ - -/* - * Ethernet configuration - */ -#define ETH0_BASE_ADDRESS 0xFE100000 -#define ETH1_BASE_ADDRESS 0xFE110000 - -/* - * Console configuration - */ - #endif /* _CONFIG_TB100_H_ */ -- cgit v1.3.1 From 071cf2767f832ec89eff40a476903d4ac5240dcf Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Dec 2023 13:16:52 -0500 Subject: global: Rework architecture global_data.h to include In most cases, the architecture global data currently makes use of assorted linux types, but does not include to provide them. Add instead of relying on indirect inclusion. Reviewed-by: Simon Glass Signed-off-by: Tom Rini --- arch/mips/include/asm/global_data.h | 2 +- arch/nios2/include/asm/global_data.h | 2 ++ arch/powerpc/include/asm/global_data.h | 1 - arch/riscv/include/asm/global_data.h | 1 + arch/x86/include/asm/global_data.h | 1 + board/cssi/cmpc885/sdram.c | 1 + include/system-constants.h | 2 ++ 7 files changed, 8 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/arch/mips/include/asm/global_data.h b/arch/mips/include/asm/global_data.h index f0d3b07bf1e..34b7e0bed94 100644 --- a/arch/mips/include/asm/global_data.h +++ b/arch/mips/include/asm/global_data.h @@ -7,8 +7,8 @@ #ifndef __ASM_GBL_DATA_H #define __ASM_GBL_DATA_H +#include #include -#include struct octeon_eeprom_mac_addr { u8 mac_addr_base[6]; diff --git a/arch/nios2/include/asm/global_data.h b/arch/nios2/include/asm/global_data.h index 1a0e7d25fa3..b56e8a5078e 100644 --- a/arch/nios2/include/asm/global_data.h +++ b/arch/nios2/include/asm/global_data.h @@ -6,6 +6,8 @@ #ifndef __ASM_NIOS2_GLOBALDATA_H_ #define __ASM_NIOS2_GLOBALDATA_H_ +#include + /* Architecture-specific global data */ struct arch_global_data { u32 dcache_line_size; diff --git a/arch/powerpc/include/asm/global_data.h b/arch/powerpc/include/asm/global_data.h index 43d71f5caec..f7860122a00 100644 --- a/arch/powerpc/include/asm/global_data.h +++ b/arch/powerpc/include/asm/global_data.h @@ -8,7 +8,6 @@ #ifndef __ASM_GBL_DATA_H #define __ASM_GBL_DATA_H -#include #include /* Architecture-specific global data */ diff --git a/arch/riscv/include/asm/global_data.h b/arch/riscv/include/asm/global_data.h index 937fa4d1544..d00247ad953 100644 --- a/arch/riscv/include/asm/global_data.h +++ b/arch/riscv/include/asm/global_data.h @@ -10,6 +10,7 @@ #ifndef __ASM_GBL_DATA_H #define __ASM_GBL_DATA_H +#include #include #include #include diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h index 6f4a7130f1d..1ef7f1f0349 100644 --- a/arch/x86/include/asm/global_data.h +++ b/arch/x86/include/asm/global_data.h @@ -9,6 +9,7 @@ #ifndef __ASSEMBLY__ +#include #include #include diff --git a/board/cssi/cmpc885/sdram.c b/board/cssi/cmpc885/sdram.c index 11a50c3a52d..828784bd368 100644 --- a/board/cssi/cmpc885/sdram.c +++ b/board/cssi/cmpc885/sdram.c @@ -4,6 +4,7 @@ * Charles Frey */ +#include #include #include #include diff --git a/include/system-constants.h b/include/system-constants.h index d688629f119..e09fc418a47 100644 --- a/include/system-constants.h +++ b/include/system-constants.h @@ -3,6 +3,8 @@ #ifndef __SYSTEM_CONSTANTS_H__ #define __SYSTEM_CONSTANTS_H__ +#include + /* * The most common case for our initial stack pointer address is to * say that we have defined a static intiial ram address location and -- cgit v1.3.1 From 1e8ce11a0b94bb2fcf55590eeffa9c85886b89bc Mon Sep 17 00:00:00 2001 From: Tom Rini Date: Thu, 14 Dec 2023 13:16:57 -0500 Subject: include: Further cleanup includes Add some missing headers such as or or to header files that make direct usage of things provided by these headers. Reviewed-by: Simon Glass Signed-off-by: Tom Rini --- include/atmel_lcd.h | 2 ++ include/getopt.h | 2 ++ include/mapmem.h | 2 ++ include/memalign.h | 1 + include/net6.h | 1 + include/rtc.h | 1 + 6 files changed, 9 insertions(+) (limited to 'include') diff --git a/include/atmel_lcd.h b/include/atmel_lcd.h index 66436b9b277..a115d6c1701 100644 --- a/include/atmel_lcd.h +++ b/include/atmel_lcd.h @@ -9,6 +9,8 @@ #ifndef _ATMEL_LCD_H_ #define _ATMEL_LCD_H_ +#include + /** * struct atmel_lcd_plat - platform data for Atmel LCDs with driver model * diff --git a/include/getopt.h b/include/getopt.h index 6f5811e64be..8645082da2a 100644 --- a/include/getopt.h +++ b/include/getopt.h @@ -9,6 +9,8 @@ #ifndef __GETOPT_H #define __GETOPT_H +#include + /** * struct getopt_state - Saved state across getopt() calls */ diff --git a/include/mapmem.h b/include/mapmem.h index 2134c8004d9..bb68b4c11af 100644 --- a/include/mapmem.h +++ b/include/mapmem.h @@ -13,6 +13,8 @@ # ifdef CONFIG_ARCH_MAP_SYSMEM #include # else +#include + static inline void *map_sysmem(phys_addr_t paddr, unsigned long len) { return (void *)(uintptr_t)paddr; diff --git a/include/memalign.h b/include/memalign.h index f67f0a74f2e..eaa9f6b5cbd 100644 --- a/include/memalign.h +++ b/include/memalign.h @@ -11,6 +11,7 @@ * is used to align DMA buffers. */ #ifndef __ASSEMBLY__ +#include #include #include diff --git a/include/net6.h b/include/net6.h index 1e766aa7209..1ed989e584a 100644 --- a/include/net6.h +++ b/include/net6.h @@ -12,6 +12,7 @@ #include #include +#include /* struct in6_addr - 128 bits long IPv6 address */ struct in6_addr { diff --git a/include/rtc.h b/include/rtc.h index b6fdbb60dc2..22f6d370591 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -16,6 +16,7 @@ #include #include #include +#include typedef int64_t time64_t; struct udevice; -- cgit v1.3.1