Merge branch '2020-05-18-reduce-size-of-common.h'

Bring in the latest round of Simon's changes to reduce what's in
<common.h> overall.
diff --git a/api/api.c b/api/api.c
index 4fc451a..c7f5db7 100644
--- a/api/api.c
+++ b/api/api.c
@@ -11,6 +11,7 @@
 #include <env.h>
 #include <malloc.h>
 #include <env_internal.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <api_public.h>
 #include <u-boot/crc.h>
diff --git a/api/api_display.c b/api/api_display.c
index 8ae358a..4f2cdd7 100644
--- a/api/api_display.c
+++ b/api/api_display.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <api_public.h>
 #include <lcd.h>
+#include <log.h>
 #include <video_font.h> /* Get font width and height */
 
 /* lcd.h needs BMP_LOGO_HEIGHT to calculate CONSOLE_ROWS */
diff --git a/api/api_storage.c b/api/api_storage.c
index 7ae03ac..a0dacad 100644
--- a/api/api_storage.c
+++ b/api/api_storage.c
@@ -8,6 +8,7 @@
 #include <config.h>
 #include <common.h>
 #include <api_public.h>
+#include <part.h>
 
 #if defined(CONFIG_CMD_USB) && defined(CONFIG_USB_STORAGE)
 #include <usb.h>
diff --git a/arch/arc/include/asm/arcregs.h b/arch/arc/include/asm/arcregs.h
index 516c14e..a9f54f6 100644
--- a/arch/arc/include/asm/arcregs.h
+++ b/arch/arc/include/asm/arcregs.h
@@ -109,6 +109,8 @@
 #define ARC_AUX_SUBSYS_BUILD	0xF0
 
 #ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+
 /* Accessors for auxiliary registers */
 #define read_aux_reg(reg)	__builtin_arc_lr(reg)
 
diff --git a/arch/arc/lib/bootm.c b/arch/arc/lib/bootm.c
index d38c18e..63d6207 100644
--- a/arch/arc/lib/bootm.c
+++ b/arch/arc/lib/bootm.c
@@ -3,9 +3,14 @@
  * Copyright (C) 2013-2014 Synopsys, Inc. All rights reserved.
  */
 
+#include <common.h>
+#include <bootstage.h>
+#include <env.h>
+#include <image.h>
 #include <irq_func.h>
+#include <lmb.h>
+#include <log.h>
 #include <asm/cache.h>
-#include <common.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arc/lib/cache.c b/arch/arc/lib/cache.c
index 8a1d678..85651b2 100644
--- a/arch/arc/lib/cache.c
+++ b/arch/arc/lib/cache.c
@@ -6,6 +6,7 @@
 #include <config.h>
 #include <common.h>
 #include <cpu_func.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <linux/kernel.h>
 #include <linux/log2.h>
diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c
index 8324655..27b5832 100644
--- a/arch/arc/lib/cpu.c
+++ b/arch/arc/lib/cpu.c
@@ -4,10 +4,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <malloc.h>
 #include <vsprintf.h>
 #include <asm/arcregs.h>
 #include <asm/cache.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arc/lib/init_helpers.c b/arch/arc/lib/init_helpers.c
index c853f25..023eae1 100644
--- a/arch/arc/lib/init_helpers.c
+++ b/arch/arc/lib/init_helpers.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2013-2015 Synopsys, Inc. All rights reserved.
  */
 
+#include <init.h>
 #include <asm/cache.h>
 #include <common.h>
 
diff --git a/arch/arc/lib/relocate.c b/arch/arc/lib/relocate.c
index 4ffba84..6882ebe 100644
--- a/arch/arc/lib/relocate.c
+++ b/arch/arc/lib/relocate.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <elf.h>
+#include <log.h>
 #include <asm-generic/sections.h>
 
 extern ulong __image_copy_start;
diff --git a/arch/arc/lib/reset.c b/arch/arc/lib/reset.c
index 30dd4b5..fbb56ec 100644
--- a/arch/arc/lib/reset.c
+++ b/arch/arc/lib/reset.c
@@ -13,7 +13,7 @@
 	__builtin_arc_brk();
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	printf("Resetting the board...\n");
 
diff --git a/arch/arm/cpu/arm11/cpu.c b/arch/arm/cpu/arm11/cpu.c
index 177d1f4..ffe3511 100644
--- a/arch/arm/cpu/arm11/cpu.c
+++ b/arch/arm/cpu/arm11/cpu.c
@@ -18,6 +18,7 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <irq_func.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 
 static void cache_flush(void);
diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c
index 3f6af6f..a3d4f14 100644
--- a/arch/arm/cpu/arm1136/mx31/generic.c
+++ b/arch/arm/cpu/arm1136/mx31/generic.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <init.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/io.h>
diff --git a/arch/arm/cpu/arm1136/mx31/timer.c b/arch/arm/cpu/arm1136/mx31/timer.c
index 3d07ee6..a913860 100644
--- a/arch/arm/cpu/arm1136/mx31/timer.c
+++ b/arch/arm/cpu/arm1136/mx31/timer.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/io.h>
 
diff --git a/arch/arm/cpu/arm1136/mx35/generic.c b/arch/arm/cpu/arm1136/mx35/generic.c
index 45bf49b..e6fff5b 100644
--- a/arch/arm/cpu/arm1136/mx35/generic.c
+++ b/arch/arm/cpu/arm1136/mx35/generic.c
@@ -8,7 +8,10 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <command.h>
 #include <div64.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
@@ -377,8 +380,8 @@
 }
 #endif
 
-int do_mx35_showclocks(cmd_tbl_t *cmdtp,
-	int flag, int argc, char * const argv[])
+int do_mx35_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	u32 cpufreq = get_mcu_main_clk();
 	printf("mx35 cpu clock: %dMHz\n", cpufreq / 1000000);
diff --git a/arch/arm/cpu/arm1136/mx35/timer.c b/arch/arm/cpu/arm1136/mx35/timer.c
index c1cdf35..f2541c3 100644
--- a/arch/arm/cpu/arm1136/mx35/timer.c
+++ b/arch/arm/cpu/arm1136/mx35/timer.c
@@ -7,9 +7,11 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/crm_regs.h>
+#include <asm/ptrace.h>
 
 /* General purpose timers bitfields */
 #define GPTCR_SWR       (1<<15)	/* Software reset */
diff --git a/arch/arm/cpu/arm920t/ep93xx/timer.c b/arch/arm/cpu/arm920t/ep93xx/timer.c
index 4829c99..892bb06 100644
--- a/arch/arm/cpu/arm920t/ep93xx/timer.c
+++ b/arch/arm/cpu/arm920t/ep93xx/timer.c
@@ -12,7 +12,9 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <asm/arch/ep93xx.h>
 #include <asm/io.h>
diff --git a/arch/arm/cpu/arm920t/imx/timer.c b/arch/arm/cpu/arm920t/imx/timer.c
index 21129a7..e9d5577 100644
--- a/arch/arm/cpu/arm920t/imx/timer.c
+++ b/arch/arm/cpu/arm920t/imx/timer.c
@@ -18,6 +18,7 @@
 #if defined (CONFIG_IMX)
 
 #include <asm/arch/imx-regs.h>
+#include <linux/delay.h>
 
 int timer_init (void)
 {
@@ -48,7 +49,7 @@
 	return get_timer_masked() - base;
 }
 
-void __udelay (unsigned long usec)
+void __udelay(unsigned long usec)
 {
 	ulong endtime = get_timer_masked() + usec;
 	signed long diff;
diff --git a/arch/arm/cpu/arm926ejs/armada100/cpu.c b/arch/arm/cpu/arm926ejs/armada100/cpu.c
index 0c81de7..96726b3 100644
--- a/arch/arm/cpu/arm926ejs/armada100/cpu.c
+++ b/arch/arm/cpu/arm926ejs/armada100/cpu.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/armada100.h>
 
diff --git a/arch/arm/cpu/arm926ejs/armada100/dram.c b/arch/arm/cpu/arm926ejs/armada100/dram.c
index f4e1f0d..da0615f 100644
--- a/arch/arm/cpu/arm926ejs/armada100/dram.c
+++ b/arch/arm/cpu/arm926ejs/armada100/dram.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/armada100.h>
 
diff --git a/arch/arm/cpu/arm926ejs/armada100/timer.c b/arch/arm/cpu/arm926ejs/armada100/timer.c
index f4962ec..0f1e68c 100644
--- a/arch/arm/cpu/arm926ejs/armada100/timer.c
+++ b/arch/arm/cpu/arm926ejs/armada100/timer.c
@@ -8,9 +8,11 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <time.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/armada100.h>
+#include <linux/delay.h>
 
 /*
  * Timer registers
diff --git a/arch/arm/cpu/arm926ejs/cache.c b/arch/arm/cpu/arm926ejs/cache.c
index 7b7eaaf..acab9bc 100644
--- a/arch/arm/cpu/arm926ejs/cache.c
+++ b/arch/arm/cpu/arm926ejs/cache.c
@@ -4,6 +4,7 @@
  * Ilya Yanok, EmCraft Systems
  */
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <linux/types.h>
 #include <common.h>
 
diff --git a/arch/arm/cpu/arm926ejs/cpu.c b/arch/arm/cpu/arm926ejs/cpu.c
index 6ab320d..93d7a02 100644
--- a/arch/arm/cpu/arm926ejs/cpu.c
+++ b/arch/arm/cpu/arm926ejs/cpu.c
@@ -16,6 +16,7 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <irq_func.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 
 static void cache_flush(void);
diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 09bda0e..8f6cd4d 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -11,6 +11,8 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <div64.h>
+#include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <vsprintf.h>
 #include <asm/io.h>
diff --git a/arch/arm/cpu/arm926ejs/mx25/timer.c b/arch/arm/cpu/arm926ejs/mx25/timer.c
index 04698fe..4b726d5 100644
--- a/arch/arm/cpu/arm926ejs/mx25/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx25/timer.c
@@ -20,8 +20,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/ptrace.h>
 
 /* nothing really to do with interrupts, just starts up a counter. */
 /* The 32KHz 32-bit timer overruns in 134217 seconds */
diff --git a/arch/arm/cpu/arm926ejs/mx27/generic.c b/arch/arm/cpu/arm926ejs/mx27/generic.c
index 9bed0e9..a003ab8 100644
--- a/arch/arm/cpu/arm926ejs/mx27/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx27/generic.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <net.h>
 #include <netdev.h>
 #include <vsprintf.h>
 #include <asm/io.h>
diff --git a/arch/arm/cpu/arm926ejs/mx27/timer.c b/arch/arm/cpu/arm926ejs/mx27/timer.c
index f51f0df..408e88a 100644
--- a/arch/arm/cpu/arm926ejs/mx27/timer.c
+++ b/arch/arm/cpu/arm926ejs/mx27/timer.c
@@ -17,9 +17,12 @@
 
 #include <common.h>
 #include <div64.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
+#include <asm/ptrace.h>
+#include <linux/delay.h>
 
 /* General purpose timers bitfields */
 #define GPTCR_SWR		(1 << 15)	/* Software reset	*/
diff --git a/arch/arm/cpu/arm926ejs/mxs/clock.c b/arch/arm/cpu/arm926ejs/mxs/clock.c
index 43d044d..4e1cf3a 100644
--- a/arch/arm/cpu/arm926ejs/mxs/clock.c
+++ b/arch/arm/cpu/arm926ejs/mxs/clock.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
index 16c080a..12ebc1c 100644
--- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
+++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
@@ -10,8 +10,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
+#include <net.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
@@ -185,7 +189,8 @@
 }
 #endif
 
-int do_mx28_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_mx28_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	printf("CPU:   %3d MHz\n", mxc_get_clock(MXC_ARM_CLK) / 1000000);
 	printf("BUS:   %3d MHz\n", mxc_get_clock(MXC_AHB_CLK) / 1000000);
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
index 9168b91..565392e 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_boot.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <config.h>
+#include <init.h>
+#include <log.h>
 #include <serial.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c
index cfd6c4a..2cfbd78 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_lradc_init.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <config.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
index 542543c..a94803e 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_mem_init.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <config.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
index 7c57cab..35ea71a 100644
--- a/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
+++ b/arch/arm/cpu/arm926ejs/mxs/spl_power_init.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <config.h>
 #include <hang.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 
diff --git a/arch/arm/cpu/arm926ejs/mxs/timer.c b/arch/arm/cpu/arm926ejs/mxs/timer.c
index 226401d..5ab4ed0 100644
--- a/arch/arm/cpu/arm926ejs/mxs/timer.c
+++ b/arch/arm/cpu/arm926ejs/mxs/timer.c
@@ -10,10 +10,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 
 /* Maximum fixed count */
 #if defined(CONFIG_MX23)
diff --git a/arch/arm/cpu/arm926ejs/spear/cpu.c b/arch/arm/cpu/arm926ejs/spear/cpu.c
index 51c4a73..2106541 100644
--- a/arch/arm/cpu/arm926ejs/spear/cpu.c
+++ b/arch/arm/cpu/arm926ejs/spear/cpu.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_misc.h>
@@ -80,7 +82,7 @@
 #endif
 
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_NAND_ECC_BCH) && defined(CONFIG_NAND_FSMC)
-static int do_switch_ecc(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_switch_ecc(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	if (argc != 2)
diff --git a/arch/arm/cpu/arm926ejs/spear/reset.c b/arch/arm/cpu/arm926ejs/spear/reset.c
index 3b884cd..a316540 100644
--- a/arch/arm/cpu/arm926ejs/spear/reset.c
+++ b/arch/arm/cpu/arm926ejs/spear/reset.c
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_syscntl.h>
+#include <linux/delay.h>
 
 void reset_cpu(ulong ignored)
 {
diff --git a/arch/arm/cpu/arm926ejs/spear/spl.c b/arch/arm/cpu/arm926ejs/spear/spl.c
index a919a45..08b98a2 100644
--- a/arch/arm/cpu/arm926ejs/spear/spl.c
+++ b/arch/arm/cpu/arm926ejs/spear/spl.c
@@ -7,9 +7,11 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <version.h>
 #include <asm/io.h>
+#include <asm/ptrace.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_defs.h>
 #include <asm/arch/spr_misc.h>
diff --git a/arch/arm/cpu/arm926ejs/spear/spr_misc.c b/arch/arm/cpu/arm926ejs/spear/spr_misc.c
index d5be646..998423b 100644
--- a/arch/arm/cpu/arm926ejs/spear/spr_misc.c
+++ b/arch/arm/cpu/arm926ejs/spear/spr_misc.c
@@ -182,7 +182,8 @@
 }
 #endif
 
-int do_chip_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_chip_config(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	void (*sram_setfreq) (unsigned int, unsigned int);
 	unsigned int frequency;
diff --git a/arch/arm/cpu/arm926ejs/spear/timer.c b/arch/arm/cpu/arm926ejs/spear/timer.c
index 28c09e9..dd0f15c 100644
--- a/arch/arm/cpu/arm926ejs/spear/timer.c
+++ b/arch/arm/cpu/arm926ejs/spear/timer.c
@@ -5,11 +5,14 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_gpt.h>
 #include <asm/arch/spr_misc.h>
+#include <asm/ptrace.h>
+#include <linux/delay.h>
 
 #define GPT_RESOLUTION	(CONFIG_SPEAR_HZ_CLOCK / CONFIG_SPEAR_HZ)
 #define READ_TIMER()	(readl(&gpt_regs_p->count) & GPT_FREE_RUNNING)
diff --git a/arch/arm/cpu/armv7/arch_timer.c b/arch/arm/cpu/armv7/arch_timer.c
index 2eb5710..871629c 100644
--- a/arch/arm/cpu/armv7/arch_timer.c
+++ b/arch/arm/cpu/armv7/arch_timer.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <div64.h>
diff --git a/arch/arm/cpu/armv7/bcm235xx/clk-core.c b/arch/arm/cpu/armv7/bcm235xx/clk-core.c
index 72f8eb7..d7edefe 100644
--- a/arch/arm/cpu/armv7/bcm235xx/clk-core.c
+++ b/arch/arm/cpu/armv7/bcm235xx/clk-core.c
@@ -10,7 +10,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <bitfield.h>
 #include <asm/arch/sysmap.h>
diff --git a/arch/arm/cpu/armv7/bcm235xx/clk-core.h b/arch/arm/cpu/armv7/bcm235xx/clk-core.h
index ac475b6..ace384d 100644
--- a/arch/arm/cpu/armv7/bcm235xx/clk-core.h
+++ b/arch/arm/cpu/armv7/bcm235xx/clk-core.h
@@ -4,6 +4,7 @@
  */
 
 #include <linux/stddef.h>
+#include <linux/stringify.h>
 
 #ifdef CONFIG_CLK_DEBUG
 #undef writel
diff --git a/arch/arm/cpu/armv7/bcm235xx/clk-eth.c b/arch/arm/cpu/armv7/bcm235xx/clk-eth.c
index 618af70..209ceca 100644
--- a/arch/arm/cpu/armv7/bcm235xx/clk-eth.c
+++ b/arch/arm/cpu/armv7/bcm235xx/clk-eth.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sysmap.h>
 #include <asm/kona-common/clk.h>
diff --git a/arch/arm/cpu/armv7/bcm281xx/clk-core.c b/arch/arm/cpu/armv7/bcm281xx/clk-core.c
index 6a36f94..26b673a 100644
--- a/arch/arm/cpu/armv7/bcm281xx/clk-core.c
+++ b/arch/arm/cpu/armv7/bcm281xx/clk-core.c
@@ -10,7 +10,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <bitfield.h>
 #include <asm/arch/sysmap.h>
diff --git a/arch/arm/cpu/armv7/bcm281xx/clk-core.h b/arch/arm/cpu/armv7/bcm281xx/clk-core.h
index a736ae9..f0fbff0 100644
--- a/arch/arm/cpu/armv7/bcm281xx/clk-core.h
+++ b/arch/arm/cpu/armv7/bcm281xx/clk-core.h
@@ -4,6 +4,7 @@
  */
 
 #include <linux/stddef.h>
+#include <linux/stringify.h>
 
 #ifdef CONFIG_CLK_DEBUG
 #undef writel
diff --git a/arch/arm/cpu/armv7/bcm281xx/clk-eth.c b/arch/arm/cpu/armv7/bcm281xx/clk-eth.c
index 618af70..209ceca 100644
--- a/arch/arm/cpu/armv7/bcm281xx/clk-eth.c
+++ b/arch/arm/cpu/armv7/bcm281xx/clk-eth.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sysmap.h>
 #include <asm/kona-common/clk.h>
diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c
index 99eb7db..146cf52 100644
--- a/arch/arm/cpu/armv7/cache_v7.c
+++ b/arch/arm/cpu/armv7/cache_v7.c
@@ -5,6 +5,7 @@
  * Aneesh V <aneesh@ti.com>
  */
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <linux/types.h>
 #include <common.h>
 #include <asm/armv7.h>
diff --git a/arch/arm/cpu/armv7/exception_level.c b/arch/arm/cpu/armv7/exception_level.c
index 6648aed..f6d25bb 100644
--- a/arch/arm/cpu/armv7/exception_level.c
+++ b/arch/arm/cpu/armv7/exception_level.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <bootm.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/armv7.h>
 #include <asm/secure.h>
 #include <asm/setjmp.h>
diff --git a/arch/arm/cpu/armv7/iproc-common/hwinit-common.c b/arch/arm/cpu/armv7/iproc-common/hwinit-common.c
index a544533..896d2f9 100644
--- a/arch/arm/cpu/armv7/iproc-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/iproc-common/hwinit-common.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 
 #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
 void enable_caches(void)
diff --git a/arch/arm/cpu/armv7/iproc-common/timer.c b/arch/arm/cpu/armv7/iproc-common/timer.c
index 668b5e1..a4255a4 100644
--- a/arch/arm/cpu/armv7/iproc-common/timer.c
+++ b/arch/arm/cpu/armv7/iproc-common/timer.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <div64.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/iproc-common/timer.h>
 #include <asm/iproc-common/sysmap.h>
+#include <linux/delay.h>
 
 static inline uint64_t timer_global_read(void)
 {
diff --git a/arch/arm/cpu/armv7/kona-common/hwinit-common.c b/arch/arm/cpu/armv7/kona-common/hwinit-common.c
index 6bf89e0..cfc7c9f 100644
--- a/arch/arm/cpu/armv7/kona-common/hwinit-common.c
+++ b/arch/arm/cpu/armv7/kona-common/hwinit-common.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <linux/sizes.h>
 
 #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c
index 664c9c1..91e9882 100644
--- a/arch/arm/cpu/armv7/ls102xa/cpu.c
+++ b/arch/arm/cpu/armv7/ls102xa/cpu.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <asm/arch/clock.h>
 #include <asm/io.h>
@@ -16,6 +18,7 @@
 #include <fsl_esdhc.h>
 #include <config.h>
 #include <fsl_wdog.h>
+#include <linux/delay.h>
 
 #include "fsl_epu.h"
 
diff --git a/arch/arm/cpu/armv7/ls102xa/fdt.c b/arch/arm/cpu/armv7/ls102xa/fdt.c
index 16ab867..56ca7b0 100644
--- a/arch/arm/cpu/armv7/ls102xa/fdt.c
+++ b/arch/arm/cpu/armv7/ls102xa/fdt.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <net.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <asm/io.h>
diff --git a/arch/arm/cpu/armv7/ls102xa/soc.c b/arch/arm/cpu/armv7/ls102xa/soc.c
index a779d33..8a95ee8 100644
--- a/arch/arm/cpu/armv7/ls102xa/soc.c
+++ b/arch/arm/cpu/armv7/ls102xa/soc.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/io.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/arch/arm/cpu/armv7/ls102xa/timer.c b/arch/arm/cpu/armv7/ls102xa/timer.c
index a5f4e31..2a32b30 100644
--- a/arch/arm/cpu/armv7/ls102xa/timer.c
+++ b/arch/arm/cpu/armv7/ls102xa/timer.c
@@ -4,11 +4,13 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <div64.h>
 #include <asm/arch/immap_ls102xa.h>
 #include <asm/arch/clock.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/cpu/armv7/mpu_v7r.c b/arch/arm/cpu/armv7/mpu_v7r.c
index 6deecfd..57ab640 100644
--- a/arch/arm/cpu/armv7/mpu_v7r.c
+++ b/arch/arm/cpu/armv7/mpu_v7r.c
@@ -12,6 +12,7 @@
 #include <asm/armv7.h>
 #include <asm/system.h>
 #include <asm/barriers.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 
 #include <asm/armv7_mpu.h>
diff --git a/arch/arm/cpu/armv7/s5p-common/cpu_info.c b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
index 5f4076d..7790f08 100644
--- a/arch/arm/cpu/armv7/s5p-common/cpu_info.c
+++ b/arch/arm/cpu/armv7/s5p-common/cpu_info.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clk.h>
 
diff --git a/arch/arm/cpu/armv7/s5p-common/timer.c b/arch/arm/cpu/armv7/s5p-common/timer.c
index e54cfb0..3064fd2 100644
--- a/arch/arm/cpu/armv7/s5p-common/timer.c
+++ b/arch/arm/cpu/armv7/s5p-common/timer.c
@@ -8,10 +8,12 @@
 
 #include <common.h>
 #include <div64.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/pwm.h>
 #include <asm/arch/clk.h>
+#include <linux/delay.h>
 
 /* Use the old PWM interface for now */
 #undef CONFIG_DM_PWM
diff --git a/arch/arm/cpu/armv7/stv0991/reset.c b/arch/arm/cpu/armv7/stv0991/reset.c
index 008e271..fb67de1 100644
--- a/arch/arm/cpu/armv7/stv0991/reset.c
+++ b/arch/arm/cpu/armv7/stv0991/reset.c
@@ -8,6 +8,7 @@
 #include <cpu_func.h>
 #include <asm/io.h>
 #include <asm/arch/stv0991_wdru.h>
+#include <linux/delay.h>
 void reset_cpu(ulong ignored)
 {
 	puts("System is going to reboot ...\n");
diff --git a/arch/arm/cpu/armv7/stv0991/timer.c b/arch/arm/cpu/armv7/stv0991/timer.c
index 695bdd7..919529a 100644
--- a/arch/arm/cpu/armv7/stv0991/timer.c
+++ b/arch/arm/cpu/armv7/stv0991/timer.c
@@ -5,11 +5,13 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch-stv0991/hardware.h>
 #include <asm/arch-stv0991/stv0991_cgu.h>
 #include <asm/arch-stv0991/stv0991_gpt.h>
+#include <linux/delay.h>
 
 static struct stv0991_cgu_regs *const stv0991_cgu_regs = \
 				(struct stv0991_cgu_regs *) (CGU_BASE_ADDR);
diff --git a/arch/arm/cpu/armv7/sunxi/psci.c b/arch/arm/cpu/armv7/sunxi/psci.c
index 2c5d99e..1ac50f5 100644
--- a/arch/arm/cpu/armv7/sunxi/psci.c
+++ b/arch/arm/cpu/armv7/sunxi/psci.c
@@ -8,6 +8,7 @@
  */
 #include <config.h>
 #include <common.h>
+#include <asm/cache.h>
 
 #include <asm/arch/cpu.h>
 #include <asm/arch/cpucfg.h>
diff --git a/arch/arm/cpu/armv7/sunxi/timer.c b/arch/arm/cpu/armv7/sunxi/timer.c
index 6bda5fb..65b64b5 100644
--- a/arch/arm/cpu/armv7/sunxi/timer.c
+++ b/arch/arm/cpu/armv7/sunxi/timer.c
@@ -6,9 +6,11 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/timer.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/cpu/armv7/vf610/generic.c b/arch/arm/cpu/armv7/vf610/generic.c
index 6698b82..fd2ab37 100644
--- a/arch/arm/cpu/armv7/vf610/generic.c
+++ b/arch/arm/cpu/armv7/vf610/generic.c
@@ -5,7 +5,11 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <command.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
@@ -237,8 +241,8 @@
 }
 
 /* Dump some core clocks */
-int do_vf610_showclocks(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+int do_vf610_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	printf("\n");
 	printf("cpu clock : %8d MHz\n", mxc_get_clock(MXC_ARM_CLK) / 1000000);
diff --git a/arch/arm/cpu/armv7/vf610/timer.c b/arch/arm/cpu/armv7/vf610/timer.c
index f858de9..fa8f8fa 100644
--- a/arch/arm/cpu/armv7/vf610/timer.c
+++ b/arch/arm/cpu/armv7/vf610/timer.c
@@ -4,11 +4,13 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <div64.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
+#include <linux/delay.h>
 
 static struct pit_reg *cur_pit = (struct pit_reg *)PIT_BASE_ADDR;
 
diff --git a/arch/arm/cpu/armv7/virt-dt.c b/arch/arm/cpu/armv7/virt-dt.c
index 204187c..61c82f6 100644
--- a/arch/arm/cpu/armv7/virt-dt.c
+++ b/arch/arm/cpu/armv7/virt-dt.c
@@ -17,6 +17,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <stdio_dev.h>
 #include <linux/ctype.h>
 #include <linux/types.h>
diff --git a/arch/arm/cpu/armv7/virt-v7.c b/arch/arm/cpu/armv7/virt-v7.c
index 26c9339..5ffeca1 100644
--- a/arch/arm/cpu/armv7/virt-v7.c
+++ b/arch/arm/cpu/armv7/virt-v7.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <asm/armv7.h>
+#include <asm/cache.h>
 #include <asm/gic.h>
 #include <asm/io.h>
 #include <asm/secure.h>
diff --git a/arch/arm/cpu/armv7m/cache.c b/arch/arm/cpu/armv7m/cache.c
index 7353698..d1aecf6 100644
--- a/arch/arm/cpu/armv7m/cache.c
+++ b/arch/arm/cpu/armv7m/cache.c
@@ -7,8 +7,11 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/armv7m.h>
+#include <asm/cache.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /* Cache maintenance operation registers */
 
diff --git a/arch/arm/cpu/armv7m/systick-timer.c b/arch/arm/cpu/armv7m/systick-timer.c
index 5c310d3..d2672fd 100644
--- a/arch/arm/cpu/armv7m/systick-timer.c
+++ b/arch/arm/cpu/armv7m/systick-timer.c
@@ -22,8 +22,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/cpu/armv8/cache_v8.c b/arch/arm/cpu/armv8/cache_v8.c
index 6a5518f..7ebcaa2 100644
--- a/arch/arm/cpu/armv8/cache_v8.c
+++ b/arch/arm/cpu/armv8/cache_v8.c
@@ -10,6 +10,8 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 #include <asm/armv8/mmu.h>
 
diff --git a/arch/arm/cpu/armv8/cpu-dt.c b/arch/arm/cpu/armv8/cpu-dt.c
index 267abb8..97d4473 100644
--- a/arch/arm/cpu/armv8/cpu-dt.c
+++ b/arch/arm/cpu/armv8/cpu-dt.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <asm/cache.h>
 #include <asm/psci.h>
 #include <asm/system.h>
 #include <asm/armv8/sec_firmware.h>
diff --git a/arch/arm/cpu/armv8/cpu.c b/arch/arm/cpu/armv8/cpu.c
index 3575203..ea40c55 100644
--- a/arch/arm/cpu/armv8/cpu.c
+++ b/arch/arm/cpu/armv8/cpu.c
@@ -14,6 +14,7 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <irq_func.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 #include <asm/secure.h>
 #include <linux/compiler.h>
diff --git a/arch/arm/cpu/armv8/exception_level.c b/arch/arm/cpu/armv8/exception_level.c
index 9c1f4a8..b119365 100644
--- a/arch/arm/cpu/armv8/exception_level.c
+++ b/arch/arm/cpu/armv8/exception_level.c
@@ -11,6 +11,8 @@
 #include <common.h>
 #include <bootm.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/setjmp.h>
 
 /**
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index 2cf3f4b..3fcedd5 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -10,8 +10,12 @@
 #include <fsl_ddr_sdram.h>
 #include <init.h>
 #include <hang.h>
+#include <log.h>
+#include <net.h>
 #include <vsprintf.h>
+#include <asm/cache.h>
 #include <asm/io.h>
+#include <asm/ptrace.h>
 #include <linux/errno.h>
 #include <asm/system.h>
 #include <fm_eth.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
index 0696ea6..9c75460 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fdt.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <efi_loader.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <phy.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c
index cb64cc2..41c89b8 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch2_serdes.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/soc.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
index d143864..aa6fd6b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/fsl_lsch3_serdes.c
@@ -5,7 +5,11 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/soc.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c b/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c
index 8110412..49df8b3 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ls1028_ids.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <fdt_support.h>
+#include <log.h>
 #include <asm/arch-fsl-layerscape/immap_lsch3.h>
 #include <asm/arch-fsl-layerscape/fsl_icid.h>
 #include <asm/arch-fsl-layerscape/fsl_portals.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/mp.c b/arch/arm/cpu/armv8/fsl-layerscape/mp.c
index ca07c68..1ea887b 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/mp.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/mp.c
@@ -5,10 +5,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <image.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/arch/mp.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 #include "cpu.h"
 #include <asm/arch-fsl-layerscape/soc.h>
 
@@ -258,7 +261,7 @@
 	return 0;
 }
 
-int cpu_release(u32 nr, int argc, char * const argv[])
+int cpu_release(u32 nr, int argc, char *const argv[])
 {
 	u64 boot_addr;
 	u64 *table = (u64 *)get_spin_tbl_addr();
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/ppa.c b/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
index d391f93..1ddb267 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/ppa.c
@@ -3,9 +3,11 @@
  * Copyright 2016 NXP Semiconductor, Inc.
  */
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <config.h>
 #include <errno.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 #include <asm/types.h>
 #include <asm/arch/soc.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/soc.c b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
index 28bb1d7..ad7ea05 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/soc.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/soc.c
@@ -12,8 +12,10 @@
 #include <fsl_ifc.h>
 #include <init.h>
 #include <linux/sizes.h>
+#include <log.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/soc.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/global_data.h>
 #include <asm/arch-fsl-layerscape/config.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/spl.c b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
index accad6e..7772433 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/spl.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/spl.c
@@ -7,7 +7,11 @@
 #include <clock_legacy.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <fsl_ifc.h>
 #include <i2c.h>
diff --git a/arch/arm/cpu/armv8/fwcall.c b/arch/arm/cpu/armv8/fwcall.c
index cbd35b7..b29bc30 100644
--- a/arch/arm/cpu/armv8/fwcall.c
+++ b/arch/arm/cpu/armv8/fwcall.c
@@ -8,8 +8,10 @@
 #include <asm-offsets.h>
 #include <config.h>
 #include <version.h>
+#include <asm/cache.h>
 #include <asm/macro.h>
 #include <asm/psci.h>
+#include <asm/ptrace.h>
 #include <asm/system.h>
 
 /*
diff --git a/arch/arm/cpu/armv8/generic_timer.c b/arch/arm/cpu/armv8/generic_timer.c
index 46e6329..e23629a 100644
--- a/arch/arm/cpu/armv8/generic_timer.c
+++ b/arch/arm/cpu/armv8/generic_timer.c
@@ -5,9 +5,11 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <time.h>
 #include <asm/system.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/cpu/armv8/hisilicon/pinmux.c b/arch/arm/cpu/armv8/hisilicon/pinmux.c
index c549ddb..5183e00 100644
--- a/arch/arm/cpu/armv8/hisilicon/pinmux.c
+++ b/arch/arm/cpu/armv8/hisilicon/pinmux.c
@@ -6,9 +6,11 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/pinmux.h>
+#include <linux/bitops.h>
 
 struct hi6220_pinmux0_regs *pmx0 =
 	(struct hi6220_pinmux0_regs *)HI6220_PINMUX0_BASE;
diff --git a/arch/arm/cpu/armv8/s32v234/cpu.c b/arch/arm/cpu/armv8/s32v234/cpu.c
index b5a9513..8ee3adc 100644
--- a/arch/arm/cpu/armv8/s32v234/cpu.c
+++ b/arch/arm/cpu/armv8/s32v234/cpu.c
@@ -5,11 +5,14 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
 #include <asm/arch/mc_me_regs.h>
+#include <linux/bitops.h>
 #include "cpu.h"
 
 u32 cpu_mask(void)
diff --git a/arch/arm/cpu/armv8/s32v234/generic.c b/arch/arm/cpu/armv8/s32v234/generic.c
index ec4641d..bc07dae 100644
--- a/arch/arm/cpu/armv8/s32v234/generic.c
+++ b/arch/arm/cpu/armv8/s32v234/generic.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
diff --git a/arch/arm/cpu/armv8/sec_firmware.c b/arch/arm/cpu/armv8/sec_firmware.c
index 95ea57d..bfc0fac 100644
--- a/arch/arm/cpu/armv8/sec_firmware.c
+++ b/arch/arm/cpu/armv8/sec_firmware.c
@@ -6,6 +6,11 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <errno.h>
+#include <fdt_support.h>
+#include <image.h>
+#include <log.h>
+#include <asm/cache.h>
+#include <asm/ptrace.h>
 #include <linux/kernel.h>
 #include <asm/io.h>
 #include <asm/system.h>
diff --git a/arch/arm/cpu/pxa/cache.c b/arch/arm/cpu/pxa/cache.c
index d4dfe7f..a2ec5e2 100644
--- a/arch/arm/cpu/pxa/cache.c
+++ b/arch/arm/cpu/pxa/cache.c
@@ -4,6 +4,7 @@
  */
 
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <linux/types.h>
 #include <common.h>
 
diff --git a/arch/arm/cpu/pxa/cpuinfo.c b/arch/arm/cpu/pxa/cpuinfo.c
index 5379e13..0d9542f 100644
--- a/arch/arm/cpu/pxa/cpuinfo.c
+++ b/arch/arm/cpu/pxa/cpuinfo.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <linux/compiler.h>
diff --git a/arch/arm/cpu/pxa/pxa2xx.c b/arch/arm/cpu/pxa/pxa2xx.c
index 002ff79..ea91d8a 100644
--- a/arch/arm/cpu/pxa/pxa2xx.c
+++ b/arch/arm/cpu/pxa/pxa2xx.c
@@ -11,8 +11,10 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <irq_func.h>
 #include <asm/arch/pxa-regs.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/system.h>
 #include <command.h>
diff --git a/arch/arm/cpu/pxa/timer.c b/arch/arm/cpu/pxa/timer.c
index 169fed8..8e9d610 100644
--- a/arch/arm/cpu/pxa/timer.c
+++ b/arch/arm/cpu/pxa/timer.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 
 int timer_init(void)
diff --git a/arch/arm/cpu/pxa/usb.c b/arch/arm/cpu/pxa/usb.c
index 80a5977..13e010d 100644
--- a/arch/arm/cpu/pxa/usb.c
+++ b/arch/arm/cpu/pxa/usb.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_USB_OHCI_NEW) && defined(CONFIG_SYS_USB_OHCI_CPU_INIT)
 # if defined(CONFIG_CPU_MONAHANS) || defined(CONFIG_CPU_PXA27X)
diff --git a/arch/arm/cpu/sa1100/timer.c b/arch/arm/cpu/sa1100/timer.c
index 8e20c96..a5cdaf5 100644
--- a/arch/arm/cpu/sa1100/timer.c
+++ b/arch/arm/cpu/sa1100/timer.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <SA-1100.h>
 #include <time.h>
+#include <linux/delay.h>
 
 static ulong get_timer_masked (void)
 {
@@ -23,7 +24,7 @@
 	return get_timer_masked ();
 }
 
-void __udelay (unsigned long usec)
+void __udelay(unsigned long usec)
 {
 	ulong tmo;
 	ulong endtime;
diff --git a/arch/arm/include/asm/arch-am33xx/clk_synthesizer.h b/arch/arm/include/asm/arch-am33xx/clk_synthesizer.h
index 6579cc0..7bcafba 100644
--- a/arch/arm/include/asm/arch-am33xx/clk_synthesizer.h
+++ b/arch/arm/include/asm/arch-am33xx/clk_synthesizer.h
@@ -10,8 +10,6 @@
 #ifndef __CLK_SYNTHESIZER_H
 #define __CLK_SYNTHESIZER_H
 
-#include <common.h>
-
 #define CLK_SYNTHESIZER_ID_REG		0x0
 #define CLK_SYNTHESIZER_XCSEL		0x05
 #define CLK_SYNTHESIZER_MUX_REG		0x14
diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h b/arch/arm/include/asm/arch-am33xx/cpu.h
index 9b819b0..79081de 100644
--- a/arch/arm/include/asm/arch-am33xx/cpu.h
+++ b/arch/arm/include/asm/arch-am33xx/cpu.h
@@ -12,6 +12,7 @@
 
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
+#include <linux/bitops.h>
 #endif /* !(__KERNEL_STRICT_NAMES || __ASSEMBLY__) */
 
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
index 64809d5..0b73ebd 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
@@ -10,6 +10,10 @@
 #ifndef __AM43XX_HARDWARE_AM43XX_H
 #define __AM43XX_HARDWARE_AM43XX_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /* Module base addresses */
 
 /* L3 Fast Configuration Bandwidth Limiter Base Address */
diff --git a/arch/arm/include/asm/arch-am33xx/mux.h b/arch/arm/include/asm/arch-am33xx/mux.h
index d8bf872..b16b184 100644
--- a/arch/arm/include/asm/arch-am33xx/mux.h
+++ b/arch/arm/include/asm/arch-am33xx/mux.h
@@ -16,7 +16,6 @@
 #ifndef _MUX_H_
 #define _MUX_H_
 
-#include <common.h>
 #include <asm/io.h>
 
 #ifdef CONFIG_AM33XX
diff --git a/arch/arm/include/asm/arch-am33xx/mux_am33xx.h b/arch/arm/include/asm/arch-am33xx/mux_am33xx.h
index d5cab3e..26bd4b4 100644
--- a/arch/arm/include/asm/arch-am33xx/mux_am33xx.h
+++ b/arch/arm/include/asm/arch-am33xx/mux_am33xx.h
@@ -16,7 +16,6 @@
 #ifndef _MUX_AM33XX_H_
 #define _MUX_AM33XX_H_
 
-#include <common.h>
 #include <asm/io.h>
 
 #define MUX_CFG(value, offset)	\
diff --git a/arch/arm/include/asm/arch-am33xx/mux_am43xx.h b/arch/arm/include/asm/arch-am33xx/mux_am43xx.h
index 256c5e2..f74ae74 100644
--- a/arch/arm/include/asm/arch-am33xx/mux_am43xx.h
+++ b/arch/arm/include/asm/arch-am33xx/mux_am43xx.h
@@ -8,7 +8,6 @@
 #ifndef _MUX_AM43XX_H_
 #define _MUX_AM43XX_H_
 
-#include <common.h>
 #include <asm/io.h>
 
 #define MUX_CFG(value, offset)	\
diff --git a/arch/arm/include/asm/arch-am33xx/mux_ti816x.h b/arch/arm/include/asm/arch-am33xx/mux_ti816x.h
index e4e5a48..a6a8a98 100644
--- a/arch/arm/include/asm/arch-am33xx/mux_ti816x.h
+++ b/arch/arm/include/asm/arch-am33xx/mux_ti816x.h
@@ -17,7 +17,6 @@
 #ifndef _MUX_TI816X_H_
 #define _MUX_TI816X_H_
 
-#include <common.h>
 #include <asm/io.h>
 
 #define MUX_CFG(value, offset)  \
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/clock.h b/arch/arm/include/asm/arch-fsl-layerscape/clock.h
index 95d6156..d561691 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/clock.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/clock.h
@@ -8,8 +8,6 @@
 #ifndef __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_
 #define __ASM_ARCH_FSL_LAYERSCAPE_CLOCK_H_
 
-#include <common.h>
-
 enum mxc_clock {
 	MXC_ARM_CLK = 0,
 	MXC_BUS_CLK,
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/config.h b/arch/arm/include/asm/arch-fsl-layerscape/config.h
index ddd9390..908d860 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/config.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/config.h
@@ -10,6 +10,10 @@
 #include <linux/kconfig.h>
 #include <fsl_ddrc_version.h>
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define CONFIG_STANDALONE_LOAD_ADDR	0x80300000
 
 /*
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
index 862ec2e..c9be076 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch2.h
@@ -7,6 +7,9 @@
 #define __ARCH_FSL_LSCH2_IMMAP_H__
 
 #include <fsl_immap.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 #define CONFIG_SYS_IMMR				0x01000000
 #define CONFIG_SYS_DCSRBAR			0x20000000
diff --git a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
index c2fbc23..baa9fa8 100644
--- a/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
+++ b/arch/arm/include/asm/arch-fsl-layerscape/immap_lsch3.h
@@ -589,5 +589,5 @@
 	u8 res5[0x19fc - 0xa00];
 };
 
-#endif /*__ASSEMBLY__*/
+#endif /*__ASSEMBLY__ */
 #endif /* __ARCH_FSL_LSCH3_IMMAP_H_ */
diff --git a/arch/arm/include/asm/arch-hi3660/hi3660.h b/arch/arm/include/asm/arch-hi3660/hi3660.h
index 3ca0951..882262d 100644
--- a/arch/arm/include/asm/arch-hi3660/hi3660.h
+++ b/arch/arm/include/asm/arch-hi3660/hi3660.h
@@ -7,6 +7,10 @@
 #ifndef __HI3660_H__
 #define __HI3660_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define HI3660_UART6_BASE			0xfff32000
 
 #define PMU_REG_BASE                            0xfff34000
diff --git a/arch/arm/include/asm/arch-imx8/iomux.h b/arch/arm/include/asm/arch-imx8/iomux.h
index bedd01b..3acef1e 100644
--- a/arch/arm/include/asm/arch-imx8/iomux.h
+++ b/arch/arm/include/asm/arch-imx8/iomux.h
@@ -6,6 +6,10 @@
 #ifndef __ASM_ARCH_IMX8_IOMUX_H__
 #define __ASM_ARCH_IMX8_IOMUX_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /*
  * We use 64bits value for iomux settings.
  * High 32bits are used for padring register value,
diff --git a/arch/arm/include/asm/arch-imx8/sci/sci.h b/arch/arm/include/asm/arch-imx8/sci/sci.h
index 05f736f..f91f7cc 100644
--- a/arch/arm/include/asm/arch-imx8/sci/sci.h
+++ b/arch/arm/include/asm/arch-imx8/sci/sci.h
@@ -6,6 +6,7 @@
 #ifndef _SC_SCI_H
 #define _SC_SCI_H
 
+#include <log.h>
 #include <asm/arch/sci/types.h>
 #include <asm/arch/sci/svc/misc/api.h>
 #include <asm/arch/sci/svc/pad/api.h>
diff --git a/arch/arm/include/asm/arch-imx8m/clock_imx8mm.h b/arch/arm/include/asm/arch-imx8m/clock_imx8mm.h
index 140e8bb..63b14b9 100644
--- a/arch/arm/include/asm/arch-imx8m/clock_imx8mm.h
+++ b/arch/arm/include/asm/arch-imx8m/clock_imx8mm.h
@@ -8,6 +8,10 @@
 #ifndef _ASM_ARCH_IMX8MM_CLOCK_H
 #define _ASM_ARCH_IMX8MM_CLOCK_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define PLL_1443X_RATE(_rate, _m, _p, _s, _k)			\
 	{							\
 		.rate	=	(_rate),			\
diff --git a/arch/arm/include/asm/arch-imx8m/clock_imx8mq.h b/arch/arm/include/asm/arch-imx8m/clock_imx8mq.h
index 9dda6dd..742cbf3 100644
--- a/arch/arm/include/asm/arch-imx8m/clock_imx8mq.h
+++ b/arch/arm/include/asm/arch-imx8m/clock_imx8mq.h
@@ -8,6 +8,10 @@
 #ifndef _ASM_ARCH_IMX8M_CLOCK_H
 #define _ASM_ARCH_IMX8M_CLOCK_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 enum pll_clocks {
 	ANATOP_ARM_PLL,
 	ANATOP_GPU_PLL,
diff --git a/arch/arm/include/asm/arch-lpc32xx/dma.h b/arch/arm/include/asm/arch-lpc32xx/dma.h
index 8775491..d69e3c4 100644
--- a/arch/arm/include/asm/arch-lpc32xx/dma.h
+++ b/arch/arm/include/asm/arch-lpc32xx/dma.h
@@ -11,8 +11,6 @@
 #ifndef _LPC32XX_DMA_H
 #define _LPC32XX_DMA_H
 
-#include <common.h>
-
 /*
  * DMA linked list structure used with a channel's LLI register;
  * refer to UM10326, "LPC32x0 and LPC32x0/01 User manual" - Rev. 3
diff --git a/arch/arm/include/asm/arch-lpc32xx/i2c.h b/arch/arm/include/asm/arch-lpc32xx/i2c.h
index 5301d4c..f39b140 100644
--- a/arch/arm/include/asm/arch-lpc32xx/i2c.h
+++ b/arch/arm/include/asm/arch-lpc32xx/i2c.h
@@ -1,7 +1,6 @@
 #ifndef _LPC32XX_I2C_H
 #define _LPC32XX_I2C_H
 
-#include <common.h>
 #include <asm/types.h>
 
 /* i2c register set */
diff --git a/arch/arm/include/asm/arch-ls102xa/clock.h b/arch/arm/include/asm/arch-ls102xa/clock.h
index e66e57f..01978c0 100644
--- a/arch/arm/include/asm/arch-ls102xa/clock.h
+++ b/arch/arm/include/asm/arch-ls102xa/clock.h
@@ -7,8 +7,6 @@
 #ifndef __ASM_ARCH_LS102XA_CLOCK_H_
 #define __ASM_ARCH_LS102XA_CLOCK_H_
 
-#include <common.h>
-
 enum mxc_clock {
 	MXC_ARM_CLK = 0,
 	MXC_UART_CLK,
diff --git a/arch/arm/include/asm/arch-meson/axg.h b/arch/arm/include/asm/arch-meson/axg.h
index d293f2a..91c8769 100644
--- a/arch/arm/include/asm/arch-meson/axg.h
+++ b/arch/arm/include/asm/arch-meson/axg.h
@@ -7,6 +7,10 @@
 #ifndef __AXG_H__
 #define __AXG_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define AXG_AOBUS_BASE		0xff800000
 #define AXG_PERIPHS_BASE	0xff634400
 #define AXG_HIU_BASE		0xff63c000
diff --git a/arch/arm/include/asm/arch-meson/g12a.h b/arch/arm/include/asm/arch-meson/g12a.h
index b806667..db29cc3 100644
--- a/arch/arm/include/asm/arch-meson/g12a.h
+++ b/arch/arm/include/asm/arch-meson/g12a.h
@@ -7,6 +7,10 @@
 #ifndef __G12A_H__
 #define __G12A_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define G12A_AOBUS_BASE			0xff800000
 #define G12A_PERIPHS_BASE		0xff634400
 #define G12A_HIU_BASE			0xff63c000
diff --git a/arch/arm/include/asm/arch-meson/gx.h b/arch/arm/include/asm/arch-meson/gx.h
index b781ba9..743d2e8 100644
--- a/arch/arm/include/asm/arch-meson/gx.h
+++ b/arch/arm/include/asm/arch-meson/gx.h
@@ -6,6 +6,10 @@
 #ifndef __GX_H__
 #define __GX_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define GX_FIRMWARE_MEM_SIZE	0x1000000
 
 #define GX_AOBUS_BASE		0xc8100000
diff --git a/arch/arm/include/asm/arch-meson/sd_emmc.h b/arch/arm/include/asm/arch-meson/sd_emmc.h
index e3a72c8..1e9f8cf 100644
--- a/arch/arm/include/asm/arch-meson/sd_emmc.h
+++ b/arch/arm/include/asm/arch-meson/sd_emmc.h
@@ -7,6 +7,10 @@
 #define __SD_EMMC_H__
 
 #include <mmc.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 
 #define SDIO_PORT_A			0
 #define SDIO_PORT_B			1
diff --git a/arch/arm/include/asm/arch-mx25/clock.h b/arch/arm/include/asm/arch-mx25/clock.h
index 7eec731..3045b78 100644
--- a/arch/arm/include/asm/arch-mx25/clock.h
+++ b/arch/arm/include/asm/arch-mx25/clock.h
@@ -9,8 +9,6 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
-#include <common.h>
-
 #ifdef CONFIG_MX25_HCLK_FREQ
 #define MXC_HCLK	CONFIG_MX25_HCLK_FREQ
 #else
diff --git a/arch/arm/include/asm/arch-mx27/regs-rtc.h b/arch/arm/include/asm/arch-mx27/regs-rtc.h
index d373ab15..8434f4c 100644
--- a/arch/arm/include/asm/arch-mx27/regs-rtc.h
+++ b/arch/arm/include/asm/arch-mx27/regs-rtc.h
@@ -21,6 +21,6 @@
 	u32 dayr;
 	u32 dayalarm;
 };
-#endif /* __ASSEMBLY__*/
+#endif /* __ASSEMBLY__ */
 
 #endif	/* __MX28_REGS_RTC_H__ */
diff --git a/arch/arm/include/asm/arch-mx31/clock.h b/arch/arm/include/asm/arch-mx31/clock.h
index aafc2d6..e99e115 100644
--- a/arch/arm/include/asm/arch-mx31/clock.h
+++ b/arch/arm/include/asm/arch-mx31/clock.h
@@ -7,8 +7,6 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
-#include <common.h>
-
 #define MXC_HCLK	CONFIG_MX31_HCLK_FREQ
 
 #define MXC_CLK32	CONFIG_MX31_CLK32
diff --git a/arch/arm/include/asm/arch-mx35/clock.h b/arch/arm/include/asm/arch-mx35/clock.h
index 7885340..cb0b53a 100644
--- a/arch/arm/include/asm/arch-mx35/clock.h
+++ b/arch/arm/include/asm/arch-mx35/clock.h
@@ -7,8 +7,6 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
-#include <common.h>
-
 #ifdef CONFIG_MX35_HCLK_FREQ
 #define MXC_HCLK	CONFIG_MX35_HCLK_FREQ
 #else
diff --git a/arch/arm/include/asm/arch-mx5/clock.h b/arch/arm/include/asm/arch-mx5/clock.h
index 6f5ca58..63a51042 100644
--- a/arch/arm/include/asm/arch-mx5/clock.h
+++ b/arch/arm/include/asm/arch-mx5/clock.h
@@ -7,8 +7,6 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
-#include <common.h>
-
 #ifdef CONFIG_SYS_MX5_HCLK
 #define MXC_HCLK	CONFIG_SYS_MX5_HCLK
 #else
diff --git a/arch/arm/include/asm/arch-mx5/imx-regs.h b/arch/arm/include/asm/arch-mx5/imx-regs.h
index fbb6e59..3d1cc68 100644
--- a/arch/arm/include/asm/arch-mx5/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx5/imx-regs.h
@@ -557,6 +557,6 @@
 	u32	cnr;
 };
 
-#endif /* __ASSEMBLER__*/
+#endif /* __ASSEMBLY__ */
 
 #endif				/* __ASM_ARCH_MX5_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-mx6/clock.h b/arch/arm/include/asm/arch-mx6/clock.h
index f776054..8ae4971 100644
--- a/arch/arm/include/asm/arch-mx6/clock.h
+++ b/arch/arm/include/asm/arch-mx6/clock.h
@@ -7,7 +7,7 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
-#include <common.h>
+#include <linux/types.h>
 
 #ifdef CONFIG_SYS_MX6_HCLK
 #define MXC_HCLK	CONFIG_SYS_MX6_HCLK
@@ -21,6 +21,8 @@
 #define MXC_CLK32	32768
 #endif
 
+struct cmd_tbl;
+
 enum mxc_clock {
 	MXC_ARM_CLK = 0,
 	MXC_PER_CLK,
@@ -80,5 +82,6 @@
 void mxs_set_lcdclk(u32 base_addr, u32 freq);
 void select_ldb_di_clock_source(enum ldb_di_clock clk);
 void enable_eim_clk(unsigned char enable);
-int do_mx6_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_mx6_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[]);
 #endif /* __ASM_ARCH_CLOCK_H */
diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 4f01b20..ccd48e8 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -372,6 +372,7 @@
 #include <asm/mach-imx/regs-lcdif.h>
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 /* only for i.MX6SX/UL */
 #define WDOG3_BASE_ADDR (((is_mx6ul() || is_mx6ull()) ?	\
@@ -1003,5 +1004,5 @@
  */
 #define	is_boot_from_usb(void) (!(readl(USB_PHY0_BASE_ADDR) & (1<<20)))
 
-#endif /* __ASSEMBLER__*/
+#endif /* __ASSEMBLY__ */
 #endif /* __ASM_ARCH_MX6_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-mx7/clock.h b/arch/arm/include/asm/arch-mx7/clock.h
index 984bd3f..48c7c33 100644
--- a/arch/arm/include/asm/arch-mx7/clock.h
+++ b/arch/arm/include/asm/arch-mx7/clock.h
@@ -9,7 +9,6 @@
 #ifndef _ASM_ARCH_CLOCK_H
 #define _ASM_ARCH_CLOCK_H
 
-#include <common.h>
 #include <asm/arch/crm_regs.h>
 
 #ifdef CONFIG_SYS_MX7_HCLK
diff --git a/arch/arm/include/asm/arch-mx7/imx-regs.h b/arch/arm/include/asm/arch-mx7/imx-regs.h
index 6336514..95238dc 100644
--- a/arch/arm/include/asm/arch-mx7/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx7/imx-regs.h
@@ -225,6 +225,7 @@
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/mach-imx/regs-lcdif.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 extern void imx_get_mac_from_fuse(int dev_id, unsigned char *mac);
 
@@ -1223,5 +1224,5 @@
 	u32 reserved_3[3];
 };
 
-#endif /* __ASSEMBLER__*/
+#endif /* __ASSEMBLY__ */
 #endif /* __ASM_ARCH_MX7_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-mx7/mx7-ddr.h b/arch/arm/include/asm/arch-mx7/mx7-ddr.h
index 3c07904..37aaee0 100644
--- a/arch/arm/include/asm/arch-mx7/mx7-ddr.h
+++ b/arch/arm/include/asm/arch-mx7/mx7-ddr.h
@@ -10,6 +10,10 @@
 #ifndef __ASM_ARCH_MX7_DDR_H__
 #define __ASM_ARCH_MX7_DDR_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /* DDRC Registers (DDRC_IPS_BASE_ADDR) */
 struct ddrc {
 	u32 mstr;		/* 0x0000 */
diff --git a/arch/arm/include/asm/arch-mx7ulp/clock.h b/arch/arm/include/asm/arch-mx7ulp/clock.h
index eb02a20..92d4463 100644
--- a/arch/arm/include/asm/arch-mx7ulp/clock.h
+++ b/arch/arm/include/asm/arch-mx7ulp/clock.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_ARCH_CLOCK_H
 #define _ASM_ARCH_CLOCK_H
 
-#include <common.h>
 #include <asm/arch/pcc.h>
 #include <asm/arch/scg.h>
 
diff --git a/arch/arm/include/asm/arch-mx7ulp/pcc.h b/arch/arm/include/asm/arch-mx7ulp/pcc.h
index dee3cfc..8f0d700 100644
--- a/arch/arm/include/asm/arch-mx7ulp/pcc.h
+++ b/arch/arm/include/asm/arch-mx7ulp/pcc.h
@@ -6,7 +6,6 @@
 #ifndef _ASM_ARCH_PCC_H
 #define _ASM_ARCH_PCC_H
 
-#include <common.h>
 #include <asm/arch/scg.h>
 
 /* PCC2 */
diff --git a/arch/arm/include/asm/arch-mx7ulp/scg.h b/arch/arm/include/asm/arch-mx7ulp/scg.h
index b79bde3..3b5b7f6 100644
--- a/arch/arm/include/asm/arch-mx7ulp/scg.h
+++ b/arch/arm/include/asm/arch-mx7ulp/scg.h
@@ -6,8 +6,6 @@
 #ifndef _ASM_ARCH_SCG_H
 #define _ASM_ARCH_SCG_H
 
-#include <common.h>
-
 #ifdef CONFIG_CLK_DEBUG
 #define clk_debug(fmt, args...)	printf(fmt, ##args)
 #else
diff --git a/arch/arm/include/asm/arch-omap4/clock.h b/arch/arm/include/asm/arch-omap4/clock.h
index 037045c..0a626fe 100644
--- a/arch/arm/include/asm/arch-omap4/clock.h
+++ b/arch/arm/include/asm/arch-omap4/clock.h
@@ -7,7 +7,6 @@
  */
 #ifndef _CLOCKS_OMAP4_H_
 #define _CLOCKS_OMAP4_H_
-#include <common.h>
 #include <asm/omap_common.h>
 
 /*
diff --git a/arch/arm/include/asm/arch-omap5/clock.h b/arch/arm/include/asm/arch-omap5/clock.h
index e261bd4..87eb3f3 100644
--- a/arch/arm/include/asm/arch-omap5/clock.h
+++ b/arch/arm/include/asm/arch-omap5/clock.h
@@ -8,7 +8,6 @@
  */
 #ifndef _CLOCKS_OMAP5_H_
 #define _CLOCKS_OMAP5_H_
-#include <common.h>
 #include <asm/omap_common.h>
 
 /*
diff --git a/arch/arm/include/asm/arch-omap5/dra7xx_iodelay.h b/arch/arm/include/asm/arch-omap5/dra7xx_iodelay.h
index 09edfad..ea2f113 100644
--- a/arch/arm/include/asm/arch-omap5/dra7xx_iodelay.h
+++ b/arch/arm/include/asm/arch-omap5/dra7xx_iodelay.h
@@ -9,7 +9,6 @@
 #ifndef _DRA7_IODELAY_H_
 #define _DRA7_IODELAY_H_
 
-#include <common.h>
 #include <asm/arch/sys_proto.h>
 
 /* CONFIG_REG_0 */
diff --git a/arch/arm/include/asm/arch-rk3308/cru_rk3308.h b/arch/arm/include/asm/arch-rk3308/cru_rk3308.h
index a14b64c..86c906b 100644
--- a/arch/arm/include/asm/arch-rk3308/cru_rk3308.h
+++ b/arch/arm/include/asm/arch-rk3308/cru_rk3308.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_CRU_RK3308_H
 #define _ASM_ARCH_CRU_RK3308_H
 
-#include <common.h>
-
 #define MHz		1000000
 #define OSC_HZ		(24 * MHz)
 
diff --git a/arch/arm/include/asm/arch-rk3308/grf_rk3308.h b/arch/arm/include/asm/arch-rk3308/grf_rk3308.h
index 3e68626..a995bb9 100644
--- a/arch/arm/include/asm/arch-rk3308/grf_rk3308.h
+++ b/arch/arm/include/asm/arch-rk3308/grf_rk3308.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_GRF_rk3308_H
 #define _ASM_ARCH_GRF_rk3308_H
 
-#include <common.h>
-
 struct rk3308_grf {
 	unsigned int gpio0a_iomux;
 	unsigned int reserved0;
diff --git a/arch/arm/include/asm/arch-rockchip/cru.h b/arch/arm/include/asm/arch-rockchip/cru.h
index 5cf2aec..5eb17f9 100644
--- a/arch/arm/include/asm/arch-rockchip/cru.h
+++ b/arch/arm/include/asm/arch-rockchip/cru.h
@@ -7,6 +7,10 @@
 #ifndef _ROCKCHIP_CLOCK_H
 #define _ROCKCHIP_CLOCK_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #if defined(CONFIG_ROCKCHIP_RK3288)
 # include <asm/arch-rockchip/cru_rk3288.h>
 #elif defined(CONFIG_ROCKCHIP_RK3399)
diff --git a/arch/arm/include/asm/arch-rockchip/cru_px30.h b/arch/arm/include/asm/arch-rockchip/cru_px30.h
index 798444a..732ca37 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_px30.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_px30.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_CRU_PX30_H
 #define _ASM_ARCH_CRU_PX30_H
 
-#include <common.h>
-
 #define MHz		1000000
 #define KHz		1000
 #define OSC_HZ		(24 * MHz)
diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3036.h b/arch/arm/include/asm/arch-rockchip/cru_rk3036.h
index 4722522..5db0407 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3036.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3036.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_CRU_RK3036_H
 #define _ASM_ARCH_CRU_RK3036_H
 
-#include <common.h>
-
 #define OSC_HZ		(24 * 1000 * 1000)
 
 #define APLL_HZ		(600 * 1000000)
diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3128.h b/arch/arm/include/asm/arch-rockchip/cru_rk3128.h
index b856560..cca812d 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3128.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3128.h
@@ -6,7 +6,9 @@
 #ifndef _ASM_ARCH_CRU_RK3128_H
 #define _ASM_ARCH_CRU_RK3128_H
 
-#include <common.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 #define MHz		1000000
 #define OSC_HZ		(24 * MHz)
diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk322x.h b/arch/arm/include/asm/arch-rockchip/cru_rk322x.h
index c87c830..ee12fa8 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk322x.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk322x.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_CRU_RK322X_H
 #define _ASM_ARCH_CRU_RK322X_H
 
-#include <common.h>
-
 #define MHz		1000000
 #define OSC_HZ		(24 * MHz)
 
diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3328.h b/arch/arm/include/asm/arch-rockchip/cru_rk3328.h
index 4bf69db..226744d 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3328.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3328.h
@@ -6,8 +6,6 @@
 #ifndef __ASM_ARCH_CRU_RK3328_H_
 #define __ASM_ARCH_CRU_RK3328_H_
 
-#include <common.h>
-
 struct rk3328_clk_priv {
 	struct rk3328_cru *cru;
 	ulong rate;
diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3368.h b/arch/arm/include/asm/arch-rockchip/cru_rk3368.h
index 1fe1f01..316c67c 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3368.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3368.h
@@ -6,8 +6,9 @@
 #ifndef _ASM_ARCH_CRU_RK3368_H
 #define _ASM_ARCH_CRU_RK3368_H
 
-#include <common.h>
-
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 /* RK3368 clock numbers */
 enum rk3368_pll_id {
diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3399.h b/arch/arm/include/asm/arch-rockchip/cru_rk3399.h
index 789ca6a..d941a12 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3399.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3399.h
@@ -6,8 +6,6 @@
 #ifndef __ASM_ARCH_CRU_RK3399_H_
 #define __ASM_ARCH_CRU_RK3399_H_
 
-#include <common.h>
-
 /* Private data for the clock driver - used by rockchip_get_cru() */
 struct rk3399_clk_priv {
 	struct rockchip_cru *cru;
diff --git a/arch/arm/include/asm/arch-rockchip/cru_rv1108.h b/arch/arm/include/asm/arch-rockchip/cru_rv1108.h
index 7697e96..0ba5ff6 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rv1108.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rv1108.h
@@ -6,7 +6,9 @@
 #ifndef _ASM_ARCH_CRU_RV1108_H
 #define _ASM_ARCH_CRU_RV1108_H
 
-#include <common.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 #define OSC_HZ		(24 * 1000 * 1000)
 
diff --git a/arch/arm/include/asm/arch-rockchip/ddr_rk3368.h b/arch/arm/include/asm/arch-rockchip/ddr_rk3368.h
index 82234cf..40cdcf4 100644
--- a/arch/arm/include/asm/arch-rockchip/ddr_rk3368.h
+++ b/arch/arm/include/asm/arch-rockchip/ddr_rk3368.h
@@ -6,6 +6,10 @@
 #ifndef __ASM_ARCH_DDR_RK3368_H__
 #define __ASM_ARCH_DDR_RK3368_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /*
  * The RK3368 DDR PCTL differs from the incarnation in the RK3288 only
  * in a few details. Most notably, it has an additional field to track
diff --git a/arch/arm/include/asm/arch-rockchip/grf_px30.h b/arch/arm/include/asm/arch-rockchip/grf_px30.h
index 3d2a877..d51e29b 100644
--- a/arch/arm/include/asm/arch-rockchip/grf_px30.h
+++ b/arch/arm/include/asm/arch-rockchip/grf_px30.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_GRF_px30_H
 #define _ASM_ARCH_GRF_px30_H
 
-#include <common.h>
-
 struct px30_grf {
 	unsigned int gpio1al_iomux;
 	unsigned int gpio1ah_iomux;
diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk3036.h b/arch/arm/include/asm/arch-rockchip/grf_rk3036.h
index 5f12ebf..08348d8 100644
--- a/arch/arm/include/asm/arch-rockchip/grf_rk3036.h
+++ b/arch/arm/include/asm/arch-rockchip/grf_rk3036.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_GRF_RK3036_H
 #define _ASM_ARCH_GRF_RK3036_H
 
-#include <common.h>
-
 struct rk3036_grf {
 	unsigned int reserved[0x2a];
 	unsigned int gpio0a_iomux;
diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk3128.h b/arch/arm/include/asm/arch-rockchip/grf_rk3128.h
index 519b36a..fe07d69 100644
--- a/arch/arm/include/asm/arch-rockchip/grf_rk3128.h
+++ b/arch/arm/include/asm/arch-rockchip/grf_rk3128.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_GRF_RK3128_H
 #define _ASM_ARCH_GRF_RK3128_H
 
-#include <common.h>
-
 struct rk3128_grf {
 	unsigned int reserved[0x2a];
 	unsigned int gpio0a_iomux;
diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk322x.h b/arch/arm/include/asm/arch-rockchip/grf_rk322x.h
index a99d137..5f4d9d8 100644
--- a/arch/arm/include/asm/arch-rockchip/grf_rk322x.h
+++ b/arch/arm/include/asm/arch-rockchip/grf_rk322x.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_GRF_RK322X_H
 #define _ASM_ARCH_GRF_RK322X_H
 
-#include <common.h>
-
 struct rk322x_grf {
 	unsigned int gpio0a_iomux;
 	unsigned int gpio0b_iomux;
diff --git a/arch/arm/include/asm/arch-rockchip/grf_rk3368.h b/arch/arm/include/asm/arch-rockchip/grf_rk3368.h
index b70b08f..0079d20 100644
--- a/arch/arm/include/asm/arch-rockchip/grf_rk3368.h
+++ b/arch/arm/include/asm/arch-rockchip/grf_rk3368.h
@@ -6,7 +6,9 @@
 #ifndef _ASM_ARCH_GRF_RK3368_H
 #define _ASM_ARCH_GRF_RK3368_H
 
-#include <common.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 struct rk3368_grf {
 	u32 gpio1a_iomux;
diff --git a/arch/arm/include/asm/arch-rockchip/grf_rv1108.h b/arch/arm/include/asm/arch-rockchip/grf_rv1108.h
index 9f42fbd..92bbe34 100644
--- a/arch/arm/include/asm/arch-rockchip/grf_rv1108.h
+++ b/arch/arm/include/asm/arch-rockchip/grf_rv1108.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_GRF_RV1108_H
 #define _ASM_ARCH_GRF_RV1108_H
 
-#include <common.h>
-
 struct rv1108_grf {
 	u32 reserved[4];
 	u32 gpio1a_iomux;
diff --git a/arch/arm/include/asm/arch-rockchip/lvds_rk3288.h b/arch/arm/include/asm/arch-rockchip/lvds_rk3288.h
index 0f00df6..fb25504 100644
--- a/arch/arm/include/asm/arch-rockchip/lvds_rk3288.h
+++ b/arch/arm/include/asm/arch-rockchip/lvds_rk3288.h
@@ -6,6 +6,10 @@
 #ifndef _ASM_ARCH_LVDS_RK3288_H
 #define _ASM_ARCH_LVDS_RK3288_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define RK3288_LVDS_CH0_REG0			0x00
 #define RK3288_LVDS_CH0_REG0_LVDS_EN		BIT(7)
 #define RK3288_LVDS_CH0_REG0_TTL_EN		BIT(6)
diff --git a/arch/arm/include/asm/arch-rockchip/sdram_pctl_px30.h b/arch/arm/include/asm/arch-rockchip/sdram_pctl_px30.h
index 9781881..3a36577 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_pctl_px30.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_pctl_px30.h
@@ -7,6 +7,10 @@
 #define _ASM_ARCH_SDRAM_PCTL_PX30_H
 #include <asm/arch-rockchip/sdram_common.h>
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct ddr_pctl_regs {
 	u32 pctl[30][2];
 };
diff --git a/arch/arm/include/asm/arch-rockchip/sdram_phy_px30.h b/arch/arm/include/asm/arch-rockchip/sdram_phy_px30.h
index c75a633..a033a18 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_phy_px30.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_phy_px30.h
@@ -8,6 +8,10 @@
 #include <asm/arch-rockchip/sdram_common.h>
 #include <asm/arch-rockchip/sdram_phy_ron_rtt_px30.h>
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct ddr_phy_regs {
 	u32 phy[5][2];
 };
diff --git a/arch/arm/include/asm/arch-rockchip/sdram_rk3036.h b/arch/arm/include/asm/arch-rockchip/sdram_rk3036.h
index 5de3220..4629816 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_rk3036.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_rk3036.h
@@ -5,8 +5,6 @@
 #ifndef _ASM_ARCH_SDRAM_RK3036_H
 #define _ASM_ARCH_SDRAM_RK3036_H
 
-#include <common.h>
-
 struct rk3036_ddr_pctl {
 	u32 scfg;
 	u32 sctl;
diff --git a/arch/arm/include/asm/arch-rockchip/sdram_rk322x.h b/arch/arm/include/asm/arch-rockchip/sdram_rk322x.h
index 336c5d7..6f6c5c9 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_rk322x.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_rk322x.h
@@ -5,7 +5,9 @@
 #ifndef _ASM_ARCH_SDRAM_RK322X_H
 #define _ASM_ARCH_SDRAM_RK322X_H
 
-#include <common.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 struct rk322x_sdram_channel {
 	/*
diff --git a/arch/arm/include/asm/arch-rockchip/sdram_rk3399.h b/arch/arm/include/asm/arch-rockchip/sdram_rk3399.h
index 267649f..c76372e 100644
--- a/arch/arm/include/asm/arch-rockchip/sdram_rk3399.h
+++ b/arch/arm/include/asm/arch-rockchip/sdram_rk3399.h
@@ -7,6 +7,9 @@
 #define _ASM_ARCH_SDRAM_RK3399_H
 #include <asm/arch-rockchip/sdram_common.h>
 #include <asm/arch-rockchip/sdram_msch.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 struct rk3399_ddr_pctl_regs {
 	u32 denali_ctl[332];
diff --git a/arch/arm/include/asm/arch-s32v234/clock.h b/arch/arm/include/asm/arch-s32v234/clock.h
index c600654..7084609 100644
--- a/arch/arm/include/asm/arch-s32v234/clock.h
+++ b/arch/arm/include/asm/arch-s32v234/clock.h
@@ -6,8 +6,6 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
-#include <common.h>
-
 enum mxc_clock {
 	MXC_ARM_CLK = 0,
 	MXC_BUS_CLK,
diff --git a/arch/arm/include/asm/arch-s32v234/imx-regs.h b/arch/arm/include/asm/arch-s32v234/imx-regs.h
index 9a779cc..1472a43 100644
--- a/arch/arm/include/asm/arch-s32v234/imx-regs.h
+++ b/arch/arm/include/asm/arch-s32v234/imx-regs.h
@@ -323,6 +323,6 @@
 	u32 ipcie[4];		/* Interconnect Parity Checking Injection Enable Register       */
 };
 
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
 #endif /* __ASM_ARCH_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/arch-stih410/sdhci.h b/arch/arm/include/asm/arch-stih410/sdhci.h
index 105d358..d5557b8 100644
--- a/arch/arm/include/asm/arch-stih410/sdhci.h
+++ b/arch/arm/include/asm/arch-stih410/sdhci.h
@@ -7,6 +7,10 @@
 #ifndef __STI_SDHCI_H__
 #define __STI_SDHCI_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define FLASHSS_MMC_CORE_CONFIG_1			0x400
 #define FLASHSS_MMC_CORECFG_TIMEOUT_CLK_UNIT_MHZ	BIT(24)
 #define FLASHSS_MMC_CORECFG_TIMEOUT_CLK_FREQ_MIN	BIT(12)
diff --git a/arch/arm/include/asm/arch-stm32f4/stm32_pwr.h b/arch/arm/include/asm/arch-stm32f4/stm32_pwr.h
index de42996..8af6de2 100644
--- a/arch/arm/include/asm/arch-stm32f4/stm32_pwr.h
+++ b/arch/arm/include/asm/arch-stm32f4/stm32_pwr.h
@@ -5,6 +5,11 @@
  */
 
 #ifndef __STM32_PWR_H_
+#define __STM32_PWR_H_
+
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 /*
  * Offsets of some PWR registers
diff --git a/arch/arm/include/asm/arch-stm32f7/stm32_pwr.h b/arch/arm/include/asm/arch-stm32f7/stm32_pwr.h
index c93fc5a..02faaeb 100644
--- a/arch/arm/include/asm/arch-stm32f7/stm32_pwr.h
+++ b/arch/arm/include/asm/arch-stm32f7/stm32_pwr.h
@@ -5,6 +5,11 @@
  */
 
 #ifndef __STM32_PWR_H_
+#define __STM32_PWR_H_
+
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 /*
  * Offsets of some PWR registers
diff --git a/arch/arm/include/asm/arch-stm32f7/syscfg.h b/arch/arm/include/asm/arch-stm32f7/syscfg.h
index ce2a952..985ae25 100644
--- a/arch/arm/include/asm/arch-stm32f7/syscfg.h
+++ b/arch/arm/include/asm/arch-stm32f7/syscfg.h
@@ -7,6 +7,10 @@
 #ifndef _STM32_SYSCFG_H
 #define _STM32_SYSCFG_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct stm32_syscfg_regs {
 	u32 memrmp;
 	u32 pmc;
diff --git a/arch/arm/include/asm/arch-sunxi/ccu.h b/arch/arm/include/asm/arch-sunxi/ccu.h
index 5dd97ab..cac5c5f 100644
--- a/arch/arm/include/asm/arch-sunxi/ccu.h
+++ b/arch/arm/include/asm/arch-sunxi/ccu.h
@@ -7,6 +7,10 @@
 #ifndef _ASM_ARCH_CCU_H
 #define _ASM_ARCH_CCU_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /**
  * enum ccu_flags - ccu clock/reset flags
  *
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h b/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h
index e369370..426069f 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun50i_h6.h
@@ -9,6 +9,10 @@
 #ifndef _SUNXI_CLOCK_SUN50I_H6_H
 #define _SUNXI_CLOCK_SUN50I_H6_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct sunxi_ccm_reg {
 	u32 pll1_cfg;		/* 0x000 pll1 (cpux) control */
 	u8 reserved_0x004[12];
diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun9i.h b/arch/arm/include/asm/arch-sunxi/clock_sun9i.h
index 530e0dd..fe6b8ba 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun9i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun9i.h
@@ -8,6 +8,10 @@
 #ifndef _SUNXI_CLOCK_SUN9I_H
 #define _SUNXI_CLOCK_SUN9I_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct sunxi_ccm_reg {
 	u32 pll1_c0_cfg;	/* 0x00 c0cpu# pll configuration */
 	u32 pll2_c1_cfg;	/* 0x04 c1cpu# pll configuration */
diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h
index 49a8a66..be02655 100644
--- a/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h
+++ b/arch/arm/include/asm/arch-sunxi/dram_sun50i_h6.h
@@ -10,6 +10,9 @@
 #define _SUNXI_DRAM_SUN50I_H6_H
 
 #include <stdbool.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 enum sunxi_dram_type {
 	SUNXI_DRAM_TYPE_DDR3 = 3,
diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun6i.h b/arch/arm/include/asm/arch-sunxi/dram_sun6i.h
index 929450f..b66d58c 100644
--- a/arch/arm/include/asm/arch-sunxi/dram_sun6i.h
+++ b/arch/arm/include/asm/arch-sunxi/dram_sun6i.h
@@ -13,6 +13,10 @@
 #ifndef _SUNXI_DRAM_SUN6I_H
 #define _SUNXI_DRAM_SUN6I_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct sunxi_mctl_com_reg {
 	u32 cr;			/* 0x00 */
 	u32 ccr;		/* 0x04 controller configuration register */
diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun8i_a33.h b/arch/arm/include/asm/arch-sunxi/dram_sun8i_a33.h
index 49a6108..3f65306 100644
--- a/arch/arm/include/asm/arch-sunxi/dram_sun8i_a33.h
+++ b/arch/arm/include/asm/arch-sunxi/dram_sun8i_a33.h
@@ -11,6 +11,10 @@
 #ifndef _SUNXI_DRAM_SUN8I_A33_H
 #define _SUNXI_DRAM_SUN8I_A33_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct sunxi_mctl_com_reg {
 	u32 cr;			/* 0x00 */
 	u32 ccr;		/* 0x04 controller configuration register */
diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun8i_a83t.h b/arch/arm/include/asm/arch-sunxi/dram_sun8i_a83t.h
index d4634e5..2a87996 100644
--- a/arch/arm/include/asm/arch-sunxi/dram_sun8i_a83t.h
+++ b/arch/arm/include/asm/arch-sunxi/dram_sun8i_a83t.h
@@ -11,6 +11,10 @@
 #ifndef _SUNXI_DRAM_SUN8I_A83T_H
 #define _SUNXI_DRAM_SUN8I_A83T_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct sunxi_mctl_com_reg {
 	u32 cr;			/* 0x00 */
 	u32 ccr;		/* 0x04 controller configuration register */
diff --git a/arch/arm/include/asm/arch-sunxi/dram_sun9i.h b/arch/arm/include/asm/arch-sunxi/dram_sun9i.h
index 603850b..41df5fe 100644
--- a/arch/arm/include/asm/arch-sunxi/dram_sun9i.h
+++ b/arch/arm/include/asm/arch-sunxi/dram_sun9i.h
@@ -11,6 +11,10 @@
 #ifndef _SUNXI_DRAM_SUN9I_H
 #define _SUNXI_DRAM_SUN9I_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct sunxi_mctl_com_reg {
 	u32 cr;			/* 0x00 */
 	u32 ccr;		/* 0x04 controller configuration register */
diff --git a/arch/arm/include/asm/arch-sunxi/pwm.h b/arch/arm/include/asm/arch-sunxi/pwm.h
index dca283c..b89bddd 100644
--- a/arch/arm/include/asm/arch-sunxi/pwm.h
+++ b/arch/arm/include/asm/arch-sunxi/pwm.h
@@ -6,6 +6,10 @@
 #ifndef _SUNXI_PWM_H
 #define _SUNXI_PWM_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define SUNXI_PWM_CTRL_REG		(SUNXI_PWM_BASE + 0)
 #define SUNXI_PWM_CH0_PERIOD		(SUNXI_PWM_BASE + 4)
 
diff --git a/arch/arm/include/asm/arch-sunxi/rsb.h b/arch/arm/include/asm/arch-sunxi/rsb.h
index 616b6e2..8c64a99 100644
--- a/arch/arm/include/asm/arch-sunxi/rsb.h
+++ b/arch/arm/include/asm/arch-sunxi/rsb.h
@@ -11,7 +11,6 @@
 #ifndef __SUNXI_RSB_H
 #define __SUNXI_RSB_H
 
-#include <common.h>
 #include <asm/io.h>
 
 struct sunxi_rsb_reg {
diff --git a/arch/arm/include/asm/arch-tegra/cboot.h b/arch/arm/include/asm/arch-tegra/cboot.h
index 021c246..4e1da98 100644
--- a/arch/arm/include/asm/arch-tegra/cboot.h
+++ b/arch/arm/include/asm/arch-tegra/cboot.h
@@ -6,7 +6,10 @@
 #ifndef _TEGRA_CBOOT_H_
 #define _TEGRA_CBOOT_H_
 
+#include <net.h>
+
 #ifdef CONFIG_ARM64
+
 extern unsigned long cboot_boot_x0;
 
 void cboot_save_boot_params(unsigned long x0, unsigned long x1,
diff --git a/arch/arm/include/asm/arch-tegra/dc.h b/arch/arm/include/asm/arch-tegra/dc.h
index 59347dd..6444af2 100644
--- a/arch/arm/include/asm/arch-tegra/dc.h
+++ b/arch/arm/include/asm/arch-tegra/dc.h
@@ -7,6 +7,10 @@
 #ifndef __ASM_ARCH_TEGRA_DC_H
 #define __ASM_ARCH_TEGRA_DC_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /* Register definitions for the Tegra display controller */
 
 /* CMD register 0x000 ~ 0x43 */
diff --git a/arch/arm/include/asm/arch-tegra/ivc.h b/arch/arm/include/asm/arch-tegra/ivc.h
index 53cb56d..52c10b8 100644
--- a/arch/arm/include/asm/arch-tegra/ivc.h
+++ b/arch/arm/include/asm/arch-tegra/ivc.h
@@ -6,8 +6,6 @@
 #ifndef _ASM_ARCH_TEGRA_IVC_H
 #define _ASM_ARCH_TEGRA_IVC_H
 
-#include <common.h>
-
 /*
  * Tegra IVC is a communication protocol that transfers fixed-size frames
  * bi-directionally and in-order between the local CPU and some remote entity.
diff --git a/arch/arm/include/asm/arch-tegra/pmc.h b/arch/arm/include/asm/arch-tegra/pmc.h
index 1524bf2..e1f5a73 100644
--- a/arch/arm/include/asm/arch-tegra/pmc.h
+++ b/arch/arm/include/asm/arch-tegra/pmc.h
@@ -7,6 +7,10 @@
 #ifndef _PMC_H_
 #define _PMC_H_
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /* Power Management Controller (APBDEV_PMC_) registers */
 struct pmc_ctlr {
 	uint pmc_cntrl;			/* _CNTRL_0, offset 00 */
diff --git a/arch/arm/include/asm/arch-tegra/tegra_mmc.h b/arch/arm/include/asm/arch-tegra/tegra_mmc.h
index 70dcf4a..d6a5576 100644
--- a/arch/arm/include/asm/arch-tegra/tegra_mmc.h
+++ b/arch/arm/include/asm/arch-tegra/tegra_mmc.h
@@ -8,7 +8,6 @@
 #ifndef __TEGRA_MMC_H_
 #define __TEGRA_MMC_H_
 
-#include <common.h>
 #include <clk.h>
 #include <reset.h>
 #include <fdtdec.h>
diff --git a/arch/arm/include/asm/arch-tegra124/flow.h b/arch/arm/include/asm/arch-tegra124/flow.h
index 62947bf..ebcb22f 100644
--- a/arch/arm/include/asm/arch-tegra124/flow.h
+++ b/arch/arm/include/asm/arch-tegra124/flow.h
@@ -7,6 +7,10 @@
 #ifndef _TEGRA124_FLOW_H_
 #define _TEGRA124_FLOW_H_
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 struct flow_ctlr {
 	u32 halt_cpu_events;	/* offset 0x00 */
 	u32 halt_cop_events;	/* offset 0x04 */
diff --git a/arch/arm/include/asm/arch-vf610/clock.h b/arch/arm/include/asm/arch-vf610/clock.h
index 72184fd..ec9786c 100644
--- a/arch/arm/include/asm/arch-vf610/clock.h
+++ b/arch/arm/include/asm/arch-vf610/clock.h
@@ -6,8 +6,6 @@
 #ifndef __ASM_ARCH_CLOCK_H
 #define __ASM_ARCH_CLOCK_H
 
-#include <common.h>
-
 enum mxc_clock {
 	MXC_ARM_CLK = 0,
 	MXC_BUS_CLK,
diff --git a/arch/arm/include/asm/arch-vf610/imx-regs.h b/arch/arm/include/asm/arch-vf610/imx-regs.h
index ae0a187..97211f4 100644
--- a/arch/arm/include/asm/arch-vf610/imx-regs.h
+++ b/arch/arm/include/asm/arch-vf610/imx-regs.h
@@ -302,6 +302,7 @@
 
 #if !(defined(__KERNEL_STRICT_NAMES) || defined(__ASSEMBLY__))
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 /* System Reset Controller (SRC) */
 struct src {
@@ -474,6 +475,6 @@
 	u32 cpxcfg3;
 };
 
-#endif	/* __ASSEMBLER__*/
+#endif	/* __ASSEMBLY__ */
 
 #endif	/* __ASM_ARCH_IMX_REGS_H__ */
diff --git a/arch/arm/include/asm/armv7_mpu.h b/arch/arm/include/asm/armv7_mpu.h
index 8f77ec4..16b9d0d 100644
--- a/arch/arm/include/asm/armv7_mpu.h
+++ b/arch/arm/include/asm/armv7_mpu.h
@@ -7,6 +7,10 @@
 #ifndef _ASM_ARMV7_MPU_H
 #define _ASM_ARMV7_MPU_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #ifdef CONFIG_CPU_V7M
 #define AP_SHIFT			24
 #define XN_SHIFT			28
diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h
index b02c454..fa85486 100644
--- a/arch/arm/include/asm/bitops.h
+++ b/arch/arm/include/asm/bitops.h
@@ -16,9 +16,15 @@
 #define __ASM_ARM_BITOPS_H
 
 #include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/__fls.h>
+#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/fls64.h>
 
 #ifdef __KERNEL__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 #include <asm/proc-armv/system.h>
 
 #define smp_mb__before_clear_bit()	do { } while (0)
@@ -176,8 +182,4 @@
 
 #endif /* __KERNEL__ */
 
-#include <asm-generic/bitops/__fls.h>
-#include <asm-generic/bitops/fls.h>
-#include <asm-generic/bitops/fls64.h>
-
 #endif /* _ARM_BITOPS_H */
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 8bb3fa2..8af1ea0 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -7,10 +7,10 @@
 #ifndef __ASM_ARM_DMA_MAPPING_H
 #define __ASM_ARM_DMA_MAPPING_H
 
-#include <common.h>
 #include <asm/cache.h>
 #include <cpu_func.h>
 #include <linux/dma-direction.h>
+#include <linux/kernel.h>
 #include <linux/types.h>
 #include <malloc.h>
 
diff --git a/arch/arm/include/asm/emif.h b/arch/arm/include/asm/emif.h
index dc398ef..3542434 100644
--- a/arch/arm/include/asm/emif.h
+++ b/arch/arm/include/asm/emif.h
@@ -13,7 +13,6 @@
 #ifndef _EMIF_H_
 #define _EMIF_H_
 #include <asm/types.h>
-#include <common.h>
 #include <asm/io.h>
 
 /* Base address */
diff --git a/arch/arm/include/asm/gic-v3.h b/arch/arm/include/asm/gic-v3.h
index ac6c9e7..5131fab 100644
--- a/arch/arm/include/asm/gic-v3.h
+++ b/arch/arm/include/asm/gic-v3.h
@@ -6,6 +6,10 @@
 #ifndef __GIC_V3_H__
 #define __GIC_V3_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define GICR_CTLR_ENABLE_LPIS		BIT(0)
 #define GICR_CTLR_RWP			BIT(3)
 
diff --git a/arch/arm/include/asm/mach-imx/dma.h b/arch/arm/include/asm/mach-imx/dma.h
index 247a91a..55eb84c 100644
--- a/arch/arm/include/asm/mach-imx/dma.h
+++ b/arch/arm/include/asm/mach-imx/dma.h
@@ -13,6 +13,7 @@
 #ifndef __DMA_H__
 #define __DMA_H__
 
+#include <asm/cache.h>
 #include <linux/list.h>
 #include <linux/compiler.h>
 
diff --git a/arch/arm/include/asm/mach-imx/iomux-v3.h b/arch/arm/include/asm/mach-imx/iomux-v3.h
index 06dbd8d..1de7093 100644
--- a/arch/arm/include/asm/mach-imx/iomux-v3.h
+++ b/arch/arm/include/asm/mach-imx/iomux-v3.h
@@ -10,7 +10,7 @@
 #ifndef __MACH_IOMUX_V3_H__
 #define __MACH_IOMUX_V3_H__
 
-#include <common.h>
+#include <linux/types.h>
 
 /*
  *	build IOMUX_PAD structure
diff --git a/arch/arm/include/asm/mach-imx/sys_proto.h b/arch/arm/include/asm/mach-imx/sys_proto.h
index 927195f..0bc705d 100644
--- a/arch/arm/include/asm/mach-imx/sys_proto.h
+++ b/arch/arm/include/asm/mach-imx/sys_proto.h
@@ -10,9 +10,11 @@
 #include <asm/io.h>
 #include <asm/mach-imx/regs-common.h>
 #include <asm/mach-imx/module_fuse.h>
-#include <common.h>
+#include <linux/bitops.h>
 #include "../arch-imx/cpu.h"
 
+struct bd_info;
+
 #define soc_rev() (get_cpu_rev() & 0xFF)
 #define is_soc_rev(rev) (soc_rev() == rev)
 
@@ -182,7 +184,7 @@
  * Initializes on-chip ethernet controllers.
  * to override, implement board_eth_init()
  */
-int fecmxc_initialize(bd_t *bis);
+int fecmxc_initialize(struct bd_info *bis);
 u32 get_ahb_clk(void);
 u32 get_periph_clk(void);
 
diff --git a/arch/arm/include/asm/omap_common.h b/arch/arm/include/asm/omap_common.h
index 54b7cd1..de8fc99 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -10,10 +10,12 @@
 
 #ifndef __ASSEMBLY__
 
-#include <common.h>
+#include <linux/types.h>
 
 #define NUM_SYS_CLKS	7
 
+struct bd_info;
+
 struct prcm_regs {
 	/* cm1.ckgen */
 	u32 cm_clksel_core;
@@ -683,9 +685,9 @@
 void gpi2c_init(void);
 
 /* Common FDT Fixups */
-int ft_hs_disable_rng(void *fdt, bd_t *bd);
-int ft_hs_fixup_dram(void *fdt, bd_t *bd);
-int ft_hs_add_tee(void *fdt, bd_t *bd);
+int ft_hs_disable_rng(void *fdt, struct bd_info *bd);
+int ft_hs_fixup_dram(void *fdt, struct bd_info *bd);
+int ft_hs_add_tee(void *fdt, struct bd_info *bd);
 
 /* ABB */
 #define OMAP_ABB_NOMINAL_OPP		0
diff --git a/arch/arm/include/asm/omap_mmc.h b/arch/arm/include/asm/omap_mmc.h
index 6d31cc4..7933ad5 100644
--- a/arch/arm/include/asm/omap_mmc.h
+++ b/arch/arm/include/asm/omap_mmc.h
@@ -26,6 +26,9 @@
 #define OMAP_MMC_H_
 
 #include <mmc.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 struct hsmmc {
 #ifndef CONFIG_OMAP34XX
diff --git a/arch/arm/include/asm/omap_sec_common.h b/arch/arm/include/asm/omap_sec_common.h
index f10a41f..30f0a9f 100644
--- a/arch/arm/include/asm/omap_sec_common.h
+++ b/arch/arm/include/asm/omap_sec_common.h
@@ -8,8 +8,6 @@
 #ifndef	_OMAP_SEC_COMMON_H_
 #define	_OMAP_SEC_COMMON_H_
 
-#include <common.h>
-
 /*
  * Invoke secure ROM API on high-security (HS) device variants. It formats
  * the variable argument list into the format expected by the ROM code before
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index 3ddcd95..67e9234 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -18,6 +18,10 @@
 #ifndef __ARM_PSCI_H__
 #define __ARM_PSCI_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define ARM_PSCI_VER_1_0		(0x00010000)
 #define ARM_PSCI_VER_0_2		(0x00000002)
 
@@ -96,6 +100,7 @@
 
 #ifndef __ASSEMBLY__
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 /* These 3 helper functions assume cpu < CONFIG_ARMV7_PSCI_NR_CPUS */
 u32 psci_get_target_pc(int cpu);
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index a3147fd..1e3f574 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -1,7 +1,6 @@
 #ifndef __ASM_ARM_SYSTEM_H
 #define __ASM_ARM_SYSTEM_H
 
-#include <common.h>
 #include <linux/compiler.h>
 #include <asm/barriers.h>
 
@@ -110,6 +109,8 @@
 
 #ifndef __ASSEMBLY__
 
+struct pt_regs;
+
 u64 get_page_table_size(void);
 #define PGTABLE_SIZE	get_page_table_size()
 
diff --git a/arch/arm/include/asm/ti-common/keystone_net.h b/arch/arm/include/asm/ti-common/keystone_net.h
index bba1048..0852ce8 100644
--- a/arch/arm/include/asm/ti-common/keystone_net.h
+++ b/arch/arm/include/asm/ti-common/keystone_net.h
@@ -11,6 +11,9 @@
 
 #include <asm/io.h>
 #include <phy.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 /* EMAC */
 #ifdef CONFIG_KSNET_NETCP_V1_0
diff --git a/arch/arm/include/asm/ti-common/omap_wdt.h b/arch/arm/include/asm/ti-common/omap_wdt.h
index fbc421b..42d7e4c 100644
--- a/arch/arm/include/asm/ti-common/omap_wdt.h
+++ b/arch/arm/include/asm/ti-common/omap_wdt.h
@@ -10,6 +10,10 @@
 #ifndef __OMAP_WDT_H__
 #define __OMAP_WDT_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /*
  * Watchdog:
  * Using the prescaler, the OMAP watchdog could go for many
diff --git a/arch/arm/include/asm/ti-common/ti-edma3.h b/arch/arm/include/asm/ti-common/ti-edma3.h
index 96c8a31..9abdbc8 100644
--- a/arch/arm/include/asm/ti-common/ti-edma3.h
+++ b/arch/arm/include/asm/ti-common/ti-edma3.h
@@ -9,6 +9,9 @@
 #ifndef _EDMA3_H_
 #define _EDMA3_H_
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 #include <linux/stddef.h>
 
 #define EDMA3_PARSET_NULL_LINK			0xffff
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index f4b5ca6..2df98d3 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -12,10 +12,13 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <hang.h>
+#include <lmb.h>
+#include <log.h>
 #include <dm/root.h>
 #include <env.h>
 #include <image.h>
@@ -29,6 +32,7 @@
 #include <linux/compiler.h>
 #include <bootm.h>
 #include <vxworks.h>
+#include <asm/cache.h>
 
 #ifdef CONFIG_ARMV7_NONSEC
 #include <asm/armv7.h>
@@ -419,7 +423,7 @@
  * DIFFERENCE: Instead of calling prep and go at the end
  * they are called if subcommand is equal 0.
  */
-int do_bootm_linux(int flag, int argc, char * const argv[],
+int do_bootm_linux(int flag, int argc, char *const argv[],
 		   bootm_headers_t *images)
 {
 	/* No need for those on ARM */
diff --git a/arch/arm/lib/cache-cp15.c b/arch/arm/lib/cache-cp15.c
index f803d6f..1da2e92 100644
--- a/arch/arm/lib/cache-cp15.c
+++ b/arch/arm/lib/cache-cp15.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/system.h>
 #include <asm/cache.h>
 #include <linux/compiler.h>
diff --git a/arch/arm/lib/cache.c b/arch/arm/lib/cache.c
index 224f2ae..ee7d14b 100644
--- a/arch/arm/lib/cache.c
+++ b/arch/arm/lib/cache.c
@@ -8,7 +8,9 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
+#include <asm/cache.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/lib/cmd_boot.c b/arch/arm/lib/cmd_boot.c
index 03dde84..c905ecc 100644
--- a/arch/arm/lib/cmd_boot.c
+++ b/arch/arm/lib/cmd_boot.c
@@ -32,7 +32,7 @@
  *    instructions, otherwise a fault occurs."
  */
 unsigned long do_go_exec(ulong (*entry)(int, char * const []),
-			 int argc, char * const argv[])
+			 int argc, char *const argv[])
 {
 	ulong addr = (ulong)entry | 1;
 	entry = (void *)addr;
diff --git a/arch/arm/lib/gic-v3-its.c b/arch/arm/lib/gic-v3-its.c
index 6ee22d2..90f37a1 100644
--- a/arch/arm/lib/gic-v3-its.c
+++ b/arch/arm/lib/gic-v3-its.c
@@ -6,6 +6,7 @@
 #include <asm/gic.h>
 #include <asm/gic-v3.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/sizes.h>
 
 static u32 lpi_id_bits;
diff --git a/arch/arm/lib/image.c b/arch/arm/lib/image.c
index 699bf44..94590d3 100644
--- a/arch/arm/lib/image.c
+++ b/arch/arm/lib/image.c
@@ -5,7 +5,9 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <mapmem.h>
+#include <linux/bitops.h>
 #include <linux/sizes.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/lib/interrupts.c b/arch/arm/lib/interrupts.c
index 36299d6..703be5a 100644
--- a/arch/arm/lib/interrupts.c
+++ b/arch/arm/lib/interrupts.c
@@ -23,6 +23,7 @@
 #include <efi_loader.h>
 #include <irq_func.h>
 #include <asm/proc-armv/ptrace.h>
+#include <asm/ptrace.h>
 #include <asm/u-boot-arm.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/lib/interrupts_64.c b/arch/arm/lib/interrupts_64.c
index a2df7cf..5299489 100644
--- a/arch/arm/lib/interrupts_64.c
+++ b/arch/arm/lib/interrupts_64.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <asm/ptrace.h>
 #include <irq_func.h>
 #include <linux/compiler.h>
 #include <efi_loader.h>
diff --git a/arch/arm/lib/psci-dt.c b/arch/arm/lib/psci-dt.c
index 246f3c7..0ed29a4 100644
--- a/arch/arm/lib/psci-dt.c
+++ b/arch/arm/lib/psci-dt.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <asm/cache.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <linux/sizes.h>
diff --git a/arch/arm/lib/reset.c b/arch/arm/lib/reset.c
index 835a40e..4f1a768 100644
--- a/arch/arm/lib/reset.c
+++ b/arch/arm/lib/reset.c
@@ -21,18 +21,20 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <irq_func.h>
+#include <linux/delay.h>
 
 __weak void reset_misc(void)
 {
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	puts ("resetting ...\n");
 
-	udelay (50000);				/* wait 50 ms */
+	mdelay(50);				/* wait 50 ms */
 
 	disable_interrupts();
 
diff --git a/arch/arm/lib/semihosting.c b/arch/arm/lib/semihosting.c
index 2658026..904fddd 100644
--- a/arch/arm/lib/semihosting.c
+++ b/arch/arm/lib/semihosting.c
@@ -13,6 +13,8 @@
  */
 #include <common.h>
 #include <command.h>
+#include <env.h>
+#include <log.h>
 
 #define SYSOPEN		0x01
 #define SYSCLOSE	0x02
@@ -180,7 +182,8 @@
 	return 0;
 }
 
-static int do_smhload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_smhload(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	if (argc == 3 || argc == 4) {
 		ulong load_addr;
diff --git a/arch/arm/lib/spl.c b/arch/arm/lib/spl.c
index 33cc76b..af0c9ad 100644
--- a/arch/arm/lib/spl.c
+++ b/arch/arm/lib/spl.c
@@ -9,8 +9,11 @@
 
 #include <common.h>
 #include <config.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <image.h>
+#include <asm/cache.h>
 #include <linux/compiler.h>
 #include <asm/mach-types.h>
 
diff --git a/arch/arm/lib/stack.c b/arch/arm/lib/stack.c
index c89a219..96a248c 100644
--- a/arch/arm/lib/stack.c
+++ b/arch/arm/lib/stack.c
@@ -11,6 +11,7 @@
  * Marius Groeger <mgroeger@sysgo.de>
  */
 #include <common.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/lib/zimage.c b/arch/arm/lib/zimage.c
index 4930529..477ea94 100644
--- a/arch/arm/lib/zimage.c
+++ b/arch/arm/lib/zimage.c
@@ -7,6 +7,7 @@
  * Copyright (C) 2012 Marek Vasut <marek.vasut@gmail.com>
  */
 #include <common.h>
+#include <image.h>
 
 #define	LINUX_ARM_ZIMAGE_MAGIC	0x016f2818
 #define	BAREBOX_IMAGE_MAGIC	0x00786f62
diff --git a/arch/arm/mach-aspeed/ast2500-board.c b/arch/arm/mach-aspeed/ast2500-board.c
index e7edd54..f74dcbb 100644
--- a/arch/arm/mach-aspeed/ast2500-board.c
+++ b/arch/arm/mach-aspeed/ast2500-board.c
@@ -4,6 +4,8 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <timer.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-aspeed/ast2500/sdram_ast2500.c b/arch/arm/mach-aspeed/ast2500/sdram_ast2500.c
index 9498cbc..a3adaa8 100644
--- a/arch/arm/mach-aspeed/ast2500/sdram_ast2500.c
+++ b/arch/arm/mach-aspeed/ast2500/sdram_ast2500.c
@@ -9,6 +9,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <ram.h>
 #include <regmap.h>
 #include <reset.h>
diff --git a/arch/arm/mach-at91/arm920t/cpu.c b/arch/arm/mach-at91/arm920t/cpu.c
index 42d0d22..44c079c 100644
--- a/arch/arm/mach-at91/arm920t/cpu.c
+++ b/arch/arm/mach-at91/arm920t/cpu.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/clk.h>
diff --git a/arch/arm/mach-at91/arm920t/timer.c b/arch/arm/mach-at91/arm920t/timer.c
index 3aef953..dca2d2c 100644
--- a/arch/arm/mach-at91/arm920t/timer.c
+++ b/arch/arm/mach-at91/arm920t/timer.c
@@ -14,7 +14,9 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-at91/arm926ejs/cpu.c b/arch/arm/mach-at91/arm926ejs/cpu.c
index e9b4e06..761edb6 100644
--- a/arch/arm/mach-at91/arm926ejs/cpu.c
+++ b/arch/arm/mach-at91/arm926ejs/cpu.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-at91/arm926ejs/eflash.c b/arch/arm/mach-at91/arm926ejs/eflash.c
index 7b61fa7..23c2493 100644
--- a/arch/arm/mach-at91/arm926ejs/eflash.c
+++ b/arch/arm/mach-at91/arm926ejs/eflash.c
@@ -43,6 +43,8 @@
  * do a read-modify-write for partially programmed pages
  */
 #include <common.h>
+#include <flash.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_common.h>
@@ -58,7 +60,7 @@
 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
 static u32 pagesize;
 
-unsigned long flash_init (void)
+unsigned long flash_init(void)
 {
 	at91_eefc_t *eefc = (at91_eefc_t *) ATMEL_BASE_EEFC;
 	at91_dbu_t *dbu = (at91_dbu_t *) ATMEL_BASE_DBGU;
@@ -127,7 +129,7 @@
 	return size;
 }
 
-void flash_print_info (flash_info_t *info)
+void flash_print_info(flash_info_t *info)
 {
 	int i;
 
@@ -202,7 +204,7 @@
 		& (AT91_EEFC_FSR_FCMDE | AT91_EEFC_FSR_FLOCKE);
 }
 
-int flash_erase (flash_info_t *info, int s_first, int s_last)
+int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	debug("erase first=%d last=%d\n", s_first, s_last);
 	puts("this flash does not need and support erasing!\n");
@@ -215,7 +217,7 @@
  * 1 - write timeout
  */
 
-int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt)
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 {
 	u32 pagenum;
 	u32 *src32, *dst32;
diff --git a/arch/arm/mach-at91/arm926ejs/timer.c b/arch/arm/mach-at91/arm926ejs/timer.c
index 31ad0bf..42ef349 100644
--- a/arch/arm/mach-at91/arm926ejs/timer.c
+++ b/arch/arm/mach-at91/arm926ejs/timer.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-at91/armv7/clock.c b/arch/arm/mach-at91/armv7/clock.c
index 3640fce..3926896 100644
--- a/arch/arm/mach-at91/armv7/clock.c
+++ b/arch/arm/mach-at91/armv7/clock.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-at91/armv7/cpu.c b/arch/arm/mach-at91/armv7/cpu.c
index 4474a96..a8f4356 100644
--- a/arch/arm/mach-at91/armv7/cpu.c
+++ b/arch/arm/mach-at91/armv7/cpu.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-at91/armv7/timer.c b/arch/arm/mach-at91/armv7/timer.c
index 15c036c..a6346c0 100644
--- a/arch/arm/mach-at91/armv7/timer.c
+++ b/arch/arm/mach-at91/armv7/timer.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-at91/include/mach/at91_pmc.h b/arch/arm/mach-at91/include/mach/at91_pmc.h
index f423afd..2ce99d9 100644
--- a/arch/arm/mach-at91/include/mach/at91_pmc.h
+++ b/arch/arm/mach-at91/include/mach/at91_pmc.h
@@ -24,6 +24,7 @@
 #else
 
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 typedef struct at91_pmc {
 	u32	scer;		/* 0x00 System Clock Enable Register */
diff --git a/arch/arm/mach-at91/include/mach/at91_sfr.h b/arch/arm/mach-at91/include/mach/at91_sfr.h
index 0300c33..4517df4 100644
--- a/arch/arm/mach-at91/include/mach/at91_sfr.h
+++ b/arch/arm/mach-at91/include/mach/at91_sfr.h
@@ -9,6 +9,7 @@
 #ifndef __AT91_SFR_H
 #define __AT91_SFR_H
 
+#include <linux/bitops.h>
 struct atmel_sfr {
 	u32 reserved1;	/* 0x00 */
 	union {
diff --git a/arch/arm/mach-at91/include/mach/atmel_pio4.h b/arch/arm/mach-at91/include/mach/atmel_pio4.h
index 7a03d6d..f348b05 100644
--- a/arch/arm/mach-at91/include/mach/atmel_pio4.h
+++ b/arch/arm/mach-at91/include/mach/atmel_pio4.h
@@ -9,6 +9,7 @@
 
 #ifndef __ASSEMBLY__
 
+#include <linux/bitops.h>
 struct atmel_pio4_port {
 	u32 mskr;		/* 0x00 PIO Mask Register */
 	u32 cfgr;		/* 0x04 PIO Configuration Register */
diff --git a/arch/arm/mach-at91/mpddrc.c b/arch/arm/mach-at91/mpddrc.c
index 3df0ea7..5422c05 100644
--- a/arch/arm/mach-at91/mpddrc.c
+++ b/arch/arm/mach-at91/mpddrc.c
@@ -11,6 +11,7 @@
 #include <asm/io.h>
 #include <asm/arch/atmel_mpddrc.h>
 #include <asm/arch/at91_common.h>
+#include <linux/delay.h>
 
 #define SAMA5D3_MPDDRC_VERSION		0x140
 
diff --git a/arch/arm/mach-at91/phy.c b/arch/arm/mach-at91/phy.c
index a10c0ca..6101eee 100644
--- a/arch/arm/mach-at91/phy.c
+++ b/arch/arm/mach-at91/phy.c
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <asm/hardware.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <asm/arch/at91_rstc.h>
 #include <watchdog.h>
diff --git a/arch/arm/mach-at91/spl_at91.c b/arch/arm/mach-at91/spl_at91.c
index 822f877..35a3d51 100644
--- a/arch/arm/mach-at91/spl_at91.c
+++ b/arch/arm/mach-at91/spl_at91.c
@@ -10,6 +10,8 @@
 
 #include <common.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91sam9_matrix.h>
diff --git a/arch/arm/mach-at91/spl_atmel.c b/arch/arm/mach-at91/spl_atmel.c
index 6ee0e1c..23588e7 100644
--- a/arch/arm/mach-at91/spl_atmel.c
+++ b/arch/arm/mach-at91/spl_atmel.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/at91_pit.h>
diff --git a/arch/arm/mach-bcm283x/include/mach/timer.h b/arch/arm/mach-bcm283x/include/mach/timer.h
index 01c0eba..5567dbd 100644
--- a/arch/arm/mach-bcm283x/include/mach/timer.h
+++ b/arch/arm/mach-bcm283x/include/mach/timer.h
@@ -8,6 +8,7 @@
 
 #ifndef __ASSEMBLY__
 #include <asm/arch/base.h>
+#include <linux/bug.h>
 #endif
 
 #define BCM2835_TIMER_PHYSADDR ({ BUG_ON(!rpi_bcm283x_base); \
diff --git a/arch/arm/mach-bcm283x/init.c b/arch/arm/mach-bcm283x/init.c
index 9966d6c..f4d00d8 100644
--- a/arch/arm/mach-bcm283x/init.c
+++ b/arch/arm/mach-bcm283x/init.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <dm/device.h>
 #include <fdt_support.h>
 
diff --git a/arch/arm/mach-bcm283x/mbox.c b/arch/arm/mach-bcm283x/mbox.c
index 1785550..da9faaf 100644
--- a/arch/arm/mach-bcm283x/mbox.c
+++ b/arch/arm/mach-bcm283x/mbox.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/base.h>
 #include <asm/arch/mbox.h>
diff --git a/arch/arm/mach-davinci/cpu.c b/arch/arm/mach-davinci/cpu.c
index 9fd6564..40dd44a 100644
--- a/arch/arm/mach-davinci/cpu.c
+++ b/arch/arm/mach-davinci/cpu.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
 
diff --git a/arch/arm/mach-davinci/da850_lowlevel.c b/arch/arm/mach-davinci/da850_lowlevel.c
index 822e0dc..07bf19b 100644
--- a/arch/arm/mach-davinci/da850_lowlevel.c
+++ b/arch/arm/mach-davinci/da850_lowlevel.c
@@ -6,6 +6,7 @@
  * Heiko Schocher, DENX Software Engineering, hs@denx.de.
  */
 #include <common.h>
+#include <init.h>
 #include <nand.h>
 #include <ns16550.h>
 #include <post.h>
diff --git a/arch/arm/mach-davinci/misc.c b/arch/arm/mach-davinci/misc.c
index 3e51852..5bfc47d 100644
--- a/arch/arm/mach-davinci/misc.c
+++ b/arch/arm/mach-davinci/misc.c
@@ -12,6 +12,7 @@
 #include <env.h>
 #include <i2c.h>
 #include <init.h>
+#include <log.h>
 #include <net.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-davinci/spl.c b/arch/arm/mach-davinci/spl.c
index d44e840..5fea935 100644
--- a/arch/arm/mach-davinci/spl.c
+++ b/arch/arm/mach-davinci/spl.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <config.h>
 #include <hang.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <asm/utils.h>
diff --git a/arch/arm/mach-davinci/timer.c b/arch/arm/mach-davinci/timer.c
index 9846463..a668182 100644
--- a/arch/arm/mach-davinci/timer.c
+++ b/arch/arm/mach-davinci/timer.c
@@ -21,10 +21,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/timer_defs.h>
 #include <div64.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-exynos/clock.c b/arch/arm/mach-exynos/clock.c
index 73aa4cd..ef48d35 100644
--- a/arch/arm/mach-exynos/clock.c
+++ b/arch/arm/mach-exynos/clock.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clk.h>
diff --git a/arch/arm/mach-exynos/include/mach/clock.h b/arch/arm/mach-exynos/include/mach/clock.h
index e4c706a..9d23c47 100644
--- a/arch/arm/mach-exynos/include/mach/clock.h
+++ b/arch/arm/mach-exynos/include/mach/clock.h
@@ -8,6 +8,7 @@
 #define __ASM_ARM_ARCH_CLOCK_H_
 
 #ifndef __ASSEMBLY__
+#include <linux/bitops.h>
 struct exynos4_clock {
 	unsigned char	res1[0x4200];
 	unsigned int	src_leftbus;
diff --git a/arch/arm/mach-exynos/include/mach/dp_info.h b/arch/arm/mach-exynos/include/mach/dp_info.h
index d3a516f..3226eb9 100644
--- a/arch/arm/mach-exynos/include/mach/dp_info.h
+++ b/arch/arm/mach-exynos/include/mach/dp_info.h
@@ -197,4 +197,5 @@
 }
 #endif
 
+#include <linux/delay.h>
 #endif /* _DP_INFO_H */
diff --git a/arch/arm/mach-exynos/lowlevel_init.c b/arch/arm/mach-exynos/lowlevel_init.c
index 1e090fd..97d6ca8 100644
--- a/arch/arm/mach-exynos/lowlevel_init.c
+++ b/arch/arm/mach-exynos/lowlevel_init.c
@@ -26,6 +26,8 @@
 #include <common.h>
 #include <config.h>
 #include <debug_uart.h>
+#include <asm/system.h>
+#include <init.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/dmc.h>
 #include <asm/arch/power.h>
diff --git a/arch/arm/mach-exynos/pinmux.c b/arch/arm/mach-exynos/pinmux.c
index b24f1bb..ad3fbf2 100644
--- a/arch/arm/mach-exynos/pinmux.c
+++ b/arch/arm/mach-exynos/pinmux.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/sromc.h>
diff --git a/arch/arm/mach-exynos/soc.c b/arch/arm/mach-exynos/soc.c
index c4cf59d..810fa34 100644
--- a/arch/arm/mach-exynos/soc.c
+++ b/arch/arm/mach-exynos/soc.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/system.h>
 
diff --git a/arch/arm/mach-exynos/spl_boot.c b/arch/arm/mach-exynos/spl_boot.c
index 103bb38..9c7ca49 100644
--- a/arch/arm/mach-exynos/spl_boot.c
+++ b/arch/arm/mach-exynos/spl_boot.c
@@ -5,7 +5,10 @@
 
 #include <common.h>
 #include <config.h>
+#include <init.h>
+#include <log.h>
 
+#include <asm/cache.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/dmc.h>
diff --git a/arch/arm/mach-highbank/timer.c b/arch/arm/mach-highbank/timer.c
index cd08ff4..2423a0e 100644
--- a/arch/arm/mach-highbank/timer.c
+++ b/arch/arm/mach-highbank/timer.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch-armv7/systimer.h>
 
diff --git a/arch/arm/mach-imx/cache.c b/arch/arm/mach-imx/cache.c
index 4fd2e43..4e3b49a 100644
--- a/arch/arm/mach-imx/cache.c
+++ b/arch/arm/mach-imx/cache.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <asm/armv7.h>
+#include <asm/cache.h>
 #include <asm/pl310.h>
 #include <asm/io.h>
 #include <asm/mach-imx/sys_proto.h>
diff --git a/arch/arm/mach-imx/cmd_bmode.c b/arch/arm/mach-imx/cmd_bmode.c
index 2d4d6efe..19bfd9f 100644
--- a/arch/arm/mach-imx/cmd_bmode.c
+++ b/arch/arm/mach-imx/cmd_bmode.c
@@ -54,8 +54,8 @@
 	return size;
 }
 
-static int do_boot_mode(cmd_tbl_t *cmdtp, int flag, int argc,
-		char * const argv[])
+static int do_boot_mode(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	const struct boot_mode *p;
 	int reset_requested = 1;
@@ -87,7 +87,7 @@
 	int size;
 	char *dest;
 
-	cmd_tbl_t *entry = ll_entry_get(cmd_tbl_t, bmode, cmd);
+	struct cmd_tbl *entry = ll_entry_get(struct cmd_tbl, bmode, cmd);
 
 	if (entry->usage) {
 		free(entry->usage);
diff --git a/arch/arm/mach-imx/cmd_dek.c b/arch/arm/mach-imx/cmd_dek.c
index 1b111ba..49dd473 100644
--- a/arch/arm/mach-imx/cmd_dek.c
+++ b/arch/arm/mach-imx/cmd_dek.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
 #include <linux/compiler.h>
@@ -54,7 +55,8 @@
  * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
  * on error.
  */
-static int do_dek_blob(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_dek_blob(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	uint32_t src_addr, dst_addr, len;
 	uint8_t *src_ptr, *dst_ptr;
diff --git a/arch/arm/mach-imx/cmd_hdmidet.c b/arch/arm/mach-imx/cmd_hdmidet.c
index 6aa7d82..e2571ad 100644
--- a/arch/arm/mach-imx/cmd_hdmidet.c
+++ b/arch/arm/mach-imx/cmd_hdmidet.c
@@ -3,11 +3,13 @@
  * Copyright (C) 2012 Boundary Devices Inc.
  */
 #include <common.h>
+#include <command.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mxc_hdmi.h>
 #include <asm/io.h>
 
-static int do_hdmidet(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_hdmidet(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct hdmi_regs *hdmi	= (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
 	return (readb(&hdmi->phy_stat0) & HDMI_DVI_STAT) ? 0 : 1;
diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c
index 94cae14..44fc376 100644
--- a/arch/arm/mach-imx/cmd_nandbcb.c
+++ b/arch/arm/mach-imx/cmd_nandbcb.c
@@ -12,9 +12,12 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <malloc.h>
 #include <nand.h>
 #include <dm/devres.h>
+#include <linux/bug.h>
 
 #include <asm/io.h>
 #include <jffs2/jffs2.h>
@@ -1048,7 +1051,7 @@
 	return ret;
 }
 
-static int do_nandbcb_bcbonly(int argc, char * const argv[])
+static int do_nandbcb_bcbonly(int argc, char *const argv[])
 {
 	struct fcb_block *fcb;
 	struct dbbt_block *dbbt;
@@ -1458,8 +1461,8 @@
 	return ret == 0 ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
 }
 
-static int do_nandbcb(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_nandbcb(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	const char *cmd;
 	int ret = 0;
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c
index 515c1fe..f2070c9 100644
--- a/arch/arm/mach-imx/cpu.c
+++ b/arch/arm/mach-imx/cpu.c
@@ -8,6 +8,9 @@
 
 #include <bootm.h>
 #include <common.h>
+#include <init.h>
+#include <log.h>
+#include <net.h>
 #include <netdev.h>
 #include <linux/errno.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-imx/ddrmc-vf610-calibration.c b/arch/arm/mach-imx/ddrmc-vf610-calibration.c
index f29de74..cd7e95e 100644
--- a/arch/arm/mach-imx/ddrmc-vf610-calibration.c
+++ b/arch/arm/mach-imx/ddrmc-vf610-calibration.c
@@ -8,6 +8,7 @@
  */
 /* #define DEBUG */
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <linux/bitmap.h>
diff --git a/arch/arm/mach-imx/ddrmc-vf610.c b/arch/arm/mach-imx/ddrmc-vf610.c
index 461fba4..7895ee6 100644
--- a/arch/arm/mach-imx/ddrmc-vf610.c
+++ b/arch/arm/mach-imx/ddrmc-vf610.c
@@ -6,10 +6,12 @@
  * Copyright 2013 Freescale Semiconductor, Inc.
  */
 
+#include <common.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-vf610.h>
 #include <asm/arch/ddrmc-vf610.h>
+#include <linux/delay.h>
 #include "ddrmc-vf610-calibration.h"
 
 void ddrmc_setup_iomux(const iomux_v3_cfg_t *pads, int pads_count)
diff --git a/arch/arm/mach-imx/hab.c b/arch/arm/mach-imx/hab.c
index 30db820..d0757d8 100644
--- a/arch/arm/mach-imx/hab.c
+++ b/arch/arm/mach-imx/hab.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <config.h>
 #include <fuse.h>
 #include <mapmem.h>
@@ -291,8 +292,8 @@
 	return 0;
 }
 
-static int do_hab_status(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_hab_status(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	if ((argc != 1)) {
 		cmd_usage(cmdtp);
@@ -324,8 +325,8 @@
 	}
 }
 
-static int do_authenticate_image(cmd_tbl_t *cmdtp, int flag, int argc,
-				 char * const argv[])
+static int do_authenticate_image(struct cmd_tbl *cmdtp, int flag, int argc,
+				 char *const argv[])
 {
 	ulong	addr, length, ivt_offset;
 	int	rcode = 0;
@@ -349,8 +350,8 @@
 	return rcode;
 }
 
-static int do_hab_failsafe(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_hab_failsafe(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	hab_rvt_failsafe_t *hab_rvt_failsafe;
 
@@ -365,8 +366,8 @@
 	return 0;
 }
 
-static int do_hab_version(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_hab_version(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	struct hab_hdr *hdr = (struct hab_hdr *)HAB_RVT_BASE;
 
@@ -380,8 +381,8 @@
 	return 0;
 }
 
-static int do_authenticate_image_or_failover(cmd_tbl_t *cmdtp, int flag,
-					     int argc, char * const argv[])
+static int do_authenticate_image_or_failover(struct cmd_tbl *cmdtp, int flag,
+					     int argc, char *const argv[])
 {
 	int ret = CMD_RET_FAILURE;
 
diff --git a/arch/arm/mach-imx/i2c-mxv7.c b/arch/arm/mach-imx/i2c-mxv7.c
index 814d834..e6c74bf 100644
--- a/arch/arm/mach-imx/i2c-mxv7.c
+++ b/arch/arm/mach-imx/i2c-mxv7.c
@@ -6,6 +6,7 @@
 #include <malloc.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/arch/arm/mach-imx/imx8/ahab.c b/arch/arm/mach-imx/imx8/ahab.c
index 6d25abe..22e76d5 100644
--- a/arch/arm/mach-imx/imx8/ahab.c
+++ b/arch/arm/mach-imx/imx8/ahab.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/mach-imx/sys_proto.h>
@@ -149,8 +151,8 @@
 	return ret;
 }
 
-static int do_authenticate(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_authenticate(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	ulong addr;
 
@@ -250,8 +252,8 @@
 	}
 }
 
-static int do_ahab_status(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_ahab_status(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	int err;
 	u8 idx = 0U;
@@ -297,8 +299,8 @@
 	return 0;
 }
 
-static int do_ahab_close(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_ahab_close(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	int err;
 	u16 lc;
diff --git a/arch/arm/mach-imx/imx8/cpu.c b/arch/arm/mach-imx/imx8/cpu.c
index 6d7b17b..38b2c09 100644
--- a/arch/arm/mach-imx/imx8/cpu.c
+++ b/arch/arm/mach-imx/imx8/cpu.c
@@ -9,6 +9,8 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/uclass.h>
diff --git a/arch/arm/mach-imx/imx8/fdt.c b/arch/arm/mach-imx/imx8/fdt.c
index 9a6822a..7d70498 100644
--- a/arch/arm/mach-imx/imx8/fdt.c
+++ b/arch/arm/mach-imx/imx8/fdt.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/arch/sys_proto.h>
 #include <dm/ofnode.h>
diff --git a/arch/arm/mach-imx/imx8/image.c b/arch/arm/mach-imx/imx8/image.c
index e6b2996..5abc0d3 100644
--- a/arch/arm/mach-imx/imx8/image.c
+++ b/arch/arm/mach-imx/imx8/image.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <mmc.h>
diff --git a/arch/arm/mach-imx/imx8/iomux.c b/arch/arm/mach-imx/imx8/iomux.c
index 0ade85f..b8e6f48 100644
--- a/arch/arm/mach-imx/imx8/iomux.c
+++ b/arch/arm/mach-imx/imx8/iomux.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/sci/sci.h>
diff --git a/arch/arm/mach-imx/imx8/misc.c b/arch/arm/mach-imx/imx8/misc.c
index 76d6571..2cd794d 100644
--- a/arch/arm/mach-imx/imx8/misc.c
+++ b/arch/arm/mach-imx/imx8/misc.c
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 #include <common.h>
+#include <log.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/mach-imx/sys_proto.h>
 #include <imx_sip.h>
diff --git a/arch/arm/mach-imx/imx8/parse-container.c b/arch/arm/mach-imx/imx8/parse-container.c
index cc8a51a..3750989 100644
--- a/arch/arm/mach-imx/imx8/parse-container.c
+++ b/arch/arm/mach-imx/imx8/parse-container.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/arch/image.h>
 #include <asm/arch/sci/sci.h>
diff --git a/arch/arm/mach-imx/imx8/snvs_security_sc.c b/arch/arm/mach-imx/imx8/snvs_security_sc.c
index 73f5651..564d1bf 100644
--- a/arch/arm/mach-imx/imx8/snvs_security_sc.c
+++ b/arch/arm/mach-imx/imx8/snvs_security_sc.c
@@ -626,7 +626,8 @@
 	"ALL values should be in hexadecimal format";
 
 #define NB_REGISTERS 18
-static int do_snvs_cfg(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_snvs_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	int err = 0;
 	u32 idx = 0;
@@ -677,7 +678,7 @@
 	"\n"
 	"ALL values should be in hexadecimal format";
 
-static int do_snvs_dgo_cfg(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_snvs_dgo_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
 			   char *const argv[])
 {
 	int err = 0;
@@ -713,7 +714,7 @@
 	"\n"
 	"ALL values should be in hexadecimal format";
 
-static int do_tamper_pin_cfg(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_tamper_pin_cfg(struct cmd_tbl *cmdtp, int flag, int argc,
 			     char *const argv[])
 {
 	int err = 0;
@@ -748,8 +749,8 @@
 	"Write the status registers with the value provided,"
 	" clearing the status";
 
-static int do_snvs_clear_status(cmd_tbl_t *cmdtp, int flag, int argc,
-				  char *const argv[])
+static int do_snvs_clear_status(struct cmd_tbl *cmdtp, int flag, int argc,
+				char *const argv[])
 {
 	int scierr = 0;
 	u32 idx = 0;
@@ -788,7 +789,7 @@
 	"snvs_sec_status\n"
 	"Display information about the security related to tamper and secvio";
 
-static int do_snvs_sec_status(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_snvs_sec_status(struct cmd_tbl *cmdtp, int flag, int argc,
 			      char *const argv[])
 {
 	int scierr;
diff --git a/arch/arm/mach-imx/imx8m/clock_imx8mm.c b/arch/arm/mach-imx/imx8m/clock_imx8mm.c
index 91c827f..aafe2ed 100644
--- a/arch/arm/mach-imx/imx8m/clock_imx8mm.c
+++ b/arch/arm/mach-imx/imx8m/clock_imx8mm.c
@@ -12,6 +12,8 @@
 #include <asm/io.h>
 #include <div64.h>
 #include <errno.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-imx/imx8m/clock_imx8mq.c b/arch/arm/mach-imx/imx8m/clock_imx8mq.c
index ee18cde..759ec6d 100644
--- a/arch/arm/mach-imx/imx8m/clock_imx8mq.c
+++ b/arch/arm/mach-imx/imx8m/clock_imx8mq.c
@@ -6,11 +6,13 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include <errno.h>
+#include <linux/delay.h>
 #include <linux/iopoll.h>
 
 static struct anamix_pll *ana_pll = (struct anamix_pll *)ANATOP_BASE_ADDR;
@@ -755,8 +757,8 @@
  * Dump some clockes.
  */
 #ifndef CONFIG_SPL_BUILD
-static int do_imx8m_showclocks(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_imx8m_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+			       char *const argv[])
 {
 	u32 freq;
 
diff --git a/arch/arm/mach-imx/imx8m/soc.c b/arch/arm/mach-imx/imx8m/soc.c
index 347fd6d..1d2c8e6 100644
--- a/arch/arm/mach-imx/imx8m/soc.c
+++ b/arch/arm/mach-imx/imx8m/soc.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
@@ -20,6 +22,7 @@
 #include <fdt_support.h>
 #include <fsl_wdog.h>
 #include <imx_sip.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-imx/imx_bootaux.c b/arch/arm/mach-imx/imx_bootaux.c
index ec0da11..868633c 100644
--- a/arch/arm/mach-imx/imx_bootaux.c
+++ b/arch/arm/mach-imx/imx_bootaux.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/mach-imx/sys_proto.h>
 #include <command.h>
@@ -92,7 +93,8 @@
  * The TCMUL is mapped to (M4_BOOTROM_BASE_ADDR) at A core side for
  * accessing the M4 TCMUL.
  */
-static int do_bootaux(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_bootaux(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	ulong addr;
 	int ret, up;
diff --git a/arch/arm/mach-imx/imxrt/soc.c b/arch/arm/mach-imx/imxrt/soc.c
index e1eea23..8e7d151 100644
--- a/arch/arm/mach-imx/imxrt/soc.c
+++ b/arch/arm/mach-imx/imxrt/soc.c
@@ -5,8 +5,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/armv7_mpu.h>
+#include <linux/bitops.h>
 
 int arch_cpu_init(void)
 {
diff --git a/arch/arm/mach-imx/misc.c b/arch/arm/mach-imx/misc.c
index 31e95a9..818f38e 100644
--- a/arch/arm/mach-imx/misc.c
+++ b/arch/arm/mach-imx/misc.c
@@ -4,7 +4,10 @@
  */
 
 #include <common.h>
+#include <lmb.h>
+#include <log.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/mach-imx/regs-common.h>
diff --git a/arch/arm/mach-imx/mx5/clock.c b/arch/arm/mach-imx/mx5/clock.c
index 2fabdd2..bbaddd5 100644
--- a/arch/arm/mach-imx/mx5/clock.c
+++ b/arch/arm/mach-imx/mx5/clock.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
@@ -943,7 +945,8 @@
 /*
  * Dump some core clockes.
  */
-static int do_mx5_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mx5_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+			     char *const argv[])
 {
 	u32 freq;
 
diff --git a/arch/arm/mach-imx/mx5/soc.c b/arch/arm/mach-imx/mx5/soc.c
index b3a57bc..c61fcce 100644
--- a/arch/arm/mach-imx/mx5/soc.c
+++ b/arch/arm/mach-imx/mx5/soc.c
@@ -11,6 +11,7 @@
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/cache.h>
 
 #include <linux/errno.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-imx/mx6/clock.c b/arch/arm/mach-imx/mx6/clock.c
index 6a9e673..fb5e5b6 100644
--- a/arch/arm/mach-imx/mx6/clock.c
+++ b/arch/arm/mach-imx/mx6/clock.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <div64.h>
+#include <log.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
@@ -1305,7 +1307,8 @@
 /*
  * Dump some core clockes.
  */
-int do_mx6_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_mx6_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	u32 freq;
 	freq = decode_pll(PLL_SYS, MXC_HCLK);
diff --git a/arch/arm/mach-imx/mx6/ddr.c b/arch/arm/mach-imx/mx6/ddr.c
index 69fe756..16df710 100644
--- a/arch/arm/mach-imx/mx6/ddr.c
+++ b/arch/arm/mach-imx/mx6/ddr.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <hang.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mx6-ddr.h>
diff --git a/arch/arm/mach-imx/mx6/litesom.c b/arch/arm/mach-imx/mx6/litesom.c
index b0a6bd5..596773f 100644
--- a/arch/arm/mach-imx/mx6/litesom.c
+++ b/arch/arm/mach-imx/mx6/litesom.c
@@ -18,6 +18,7 @@
 #include <asm/io.h>
 #include <common.h>
 #include <fsl_esdhc_imx.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <mmc.h>
 
diff --git a/arch/arm/mach-imx/mx6/soc.c b/arch/arm/mach-imx/mx6/soc.c
index b8aaf3e..19ca382 100644
--- a/arch/arm/mach-imx/mx6/soc.c
+++ b/arch/arm/mach-imx/mx6/soc.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
diff --git a/arch/arm/mach-imx/mx7/clock.c b/arch/arm/mach-imx/mx7/clock.c
index 75be4f8..aba9461 100644
--- a/arch/arm/mach-imx/mx7/clock.c
+++ b/arch/arm/mach-imx/mx7/clock.c
@@ -8,7 +8,9 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <command.h>
 #include <div64.h>
+#include <log.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
@@ -1100,7 +1102,8 @@
 /*
  * Dump some core clockes.
  */
-int do_mx7_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_mx7_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	u32 freq;
 	freq = decode_pll(PLL_CORE, MXC_HCLK);
diff --git a/arch/arm/mach-imx/mx7/psci-mx7.c b/arch/arm/mach-imx/mx7/psci-mx7.c
index c8f6ca2..f32945e 100644
--- a/arch/arm/mach-imx/mx7/psci-mx7.c
+++ b/arch/arm/mach-imx/mx7/psci-mx7.c
@@ -5,6 +5,7 @@
  */
 
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/psci.h>
 #include <asm/secure.h>
diff --git a/arch/arm/mach-imx/mx7/soc.c b/arch/arm/mach-imx/mx7/soc.c
index 4aafeed..798fe74 100644
--- a/arch/arm/mach-imx/mx7/soc.c
+++ b/arch/arm/mach-imx/mx7/soc.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
@@ -18,6 +19,7 @@
 #include <imx_thermal.h>
 #include <fsl_sec.h>
 #include <asm/setup.h>
+#include <linux/delay.h>
 
 #define IOMUXC_GPR1		0x4
 #define BM_IOMUXC_GPR1_IRQ	0x1000
diff --git a/arch/arm/mach-imx/mx7ulp/clock.c b/arch/arm/mach-imx/mx7ulp/clock.c
index 3c0bccc..a987ff2 100644
--- a/arch/arm/mach-imx/mx7ulp/clock.c
+++ b/arch/arm/mach-imx/mx7ulp/clock.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <command.h>
 #include <div64.h>
 #include <asm/io.h>
 #include <errno.h>
@@ -329,7 +330,8 @@
 /*
  * Dump some core clockes.
  */
-int do_mx7_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_mx7_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	u32 addr = 0;
 	u32 freq;
diff --git a/arch/arm/mach-imx/mx7ulp/iomux.c b/arch/arm/mach-imx/mx7ulp/iomux.c
index 8c68655..05ddeed 100644
--- a/arch/arm/mach-imx/mx7ulp/iomux.c
+++ b/arch/arm/mach-imx/mx7ulp/iomux.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2016 Freescale Semiconductor, Inc.
  */
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
diff --git a/arch/arm/mach-imx/mx7ulp/pcc.c b/arch/arm/mach-imx/mx7ulp/pcc.c
index 234974b..aa7ea86 100644
--- a/arch/arm/mach-imx/mx7ulp/pcc.c
+++ b/arch/arm/mach-imx/mx7ulp/pcc.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <div64.h>
+#include <log.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <asm/arch/imx-regs.h>
diff --git a/arch/arm/mach-imx/mx7ulp/scg.c b/arch/arm/mach-imx/mx7ulp/scg.c
index c7bb7a1..4c06655 100644
--- a/arch/arm/mach-imx/mx7ulp/scg.c
+++ b/arch/arm/mach-imx/mx7ulp/scg.c
@@ -5,11 +5,13 @@
 
 #include <common.h>
 #include <div64.h>
+#include <log.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/pcc.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 
 scg_p scg1_regs = (scg_p)SCG1_RBASE;
 
diff --git a/arch/arm/mach-imx/mx7ulp/soc.c b/arch/arm/mach-imx/mx7ulp/soc.c
index 0d39dab..8dd6b4d 100644
--- a/arch/arm/mach-imx/mx7ulp/soc.c
+++ b/arch/arm/mach-imx/mx7ulp/soc.c
@@ -2,14 +2,18 @@
 /*
  * Copyright (C) 2016 Freescale Semiconductor, Inc.
  */
+
+#include <common.h>
 #include <cpu_func.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/hab.h>
+#include <linux/bitops.h>
 
 #define PMC0_BASE_ADDR		0x410a1000
 #define PMC0_CTRL		0x28
diff --git a/arch/arm/mach-imx/sata.c b/arch/arm/mach-imx/sata.c
index b9f6309..c4599aa 100644
--- a/arch/arm/mach-imx/sata.c
+++ b/arch/arm/mach-imx/sata.c
@@ -7,6 +7,7 @@
 #include <asm/arch/iomux.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
 
 int setup_sata(void)
diff --git a/arch/arm/mach-imx/sip.c b/arch/arm/mach-imx/sip.c
index fca520c..6cb8179 100644
--- a/arch/arm/mach-imx/sip.c
+++ b/arch/arm/mach-imx/sip.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/cache.h>
+#include <asm/ptrace.h>
 
 unsigned long call_imx_sip(unsigned long id, unsigned long reg0,
 			   unsigned long reg1, unsigned long reg2,
diff --git a/arch/arm/mach-imx/spl.c b/arch/arm/mach-imx/spl.c
index fd3fa04..1a231c6 100644
--- a/arch/arm/mach-imx/spl.c
+++ b/arch/arm/mach-imx/spl.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-imx/spl_imx_romapi.c b/arch/arm/mach-imx/spl_imx_romapi.c
index 5dc0f71..f588a5f 100644
--- a/arch/arm/mach-imx/spl_imx_romapi.c
+++ b/arch/arm/mach-imx/spl_imx_romapi.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <errno.h>
 #include <image.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <spl.h>
 
diff --git a/arch/arm/mach-imx/syscounter.c b/arch/arm/mach-imx/syscounter.c
index 5a292c3..7da43c3 100644
--- a/arch/arm/mach-imx/syscounter.c
+++ b/arch/arm/mach-imx/syscounter.c
@@ -6,12 +6,14 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <div64.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/syscounter.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-imx/timer.c b/arch/arm/mach-imx/timer.c
index 5fe5c51..fa1941a 100644
--- a/arch/arm/mach-imx/timer.c
+++ b/arch/arm/mach-imx/timer.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <div64.h>
diff --git a/arch/arm/mach-k3/am6_init.c b/arch/arm/mach-k3/am6_init.c
index b692806..ddc9f3c 100644
--- a/arch/arm/mach-k3/am6_init.c
+++ b/arch/arm/mach-k3/am6_init.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <spl.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
index 80dfa5f..0cd34ac 100644
--- a/arch/arm/mach-k3/common.c
+++ b/arch/arm/mach-k3/common.c
@@ -8,10 +8,14 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include "common.h"
 #include <dm.h>
 #include <remoteproc.h>
+#include <asm/cache.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <fdt_support.h>
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-k3/include/mach/am6_hardware.h b/arch/arm/mach-k3/include/mach/am6_hardware.h
index 6df7631..a91ef5f 100644
--- a/arch/arm/mach-k3/include/mach/am6_hardware.h
+++ b/arch/arm/mach-k3/include/mach/am6_hardware.h
@@ -8,6 +8,9 @@
 #define __ASM_ARCH_AM6_HARDWARE_H
 
 #include <config.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 #define CTRL_MMR0_BASE					0x00100000
 #define CTRLMMR_MAIN_DEVSTAT				(CTRL_MMR0_BASE + 0x30)
diff --git a/arch/arm/mach-k3/include/mach/j721e_hardware.h b/arch/arm/mach-k3/include/mach/j721e_hardware.h
index ead136e..0deed66 100644
--- a/arch/arm/mach-k3/include/mach/j721e_hardware.h
+++ b/arch/arm/mach-k3/include/mach/j721e_hardware.h
@@ -8,6 +8,9 @@
 #define __ASM_ARCH_J721E_HARDWARE_H
 
 #include <config.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 #define CTRL_MMR0_BASE					0x00100000
 #define CTRLMMR_MAIN_DEVSTAT				(CTRL_MMR0_BASE + 0x30)
diff --git a/arch/arm/mach-k3/include/mach/j721e_spl.h b/arch/arm/mach-k3/include/mach/j721e_spl.h
index 475278b..959bdd4 100644
--- a/arch/arm/mach-k3/include/mach/j721e_spl.h
+++ b/arch/arm/mach-k3/include/mach/j721e_spl.h
@@ -7,6 +7,7 @@
 #define _ASM_ARCH_J721E_SPL_H_
 
 /* With BootMode B = 0 */
+#include <linux/bitops.h>
 #define BOOT_DEVICE_HYPERFLASH		0x00
 #define BOOT_DEVICE_OSPI		0x01
 #define BOOT_DEVICE_QSPI		0x02
diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c
index 71fc20c..7a999f9 100644
--- a/arch/arm/mach-k3/j721e_init.c
+++ b/arch/arm/mach-k3/j721e_init.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/armv7_mpu.h>
diff --git a/arch/arm/mach-k3/security.c b/arch/arm/mach-k3/security.c
index 0d77d98..66f90a5 100644
--- a/arch/arm/mach-k3/security.c
+++ b/arch/arm/mach-k3/security.c
@@ -10,6 +10,9 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <hang.h>
+#include <image.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <mach/spl.h>
 #include <spl.h>
diff --git a/arch/arm/mach-k3/sysfw-loader.c b/arch/arm/mach-k3/sysfw-loader.c
index 4f5c848..513be09 100644
--- a/arch/arm/mach-k3/sysfw-loader.c
+++ b/arch/arm/mach-k3/sysfw-loader.c
@@ -7,9 +7,12 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <malloc.h>
 #include <remoteproc.h>
+#include <asm/cache.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <g_dnl.h>
 #include <usb.h>
diff --git a/arch/arm/mach-keystone/clock.c b/arch/arm/mach-keystone/clock.c
index 3c46824..0c59515 100644
--- a/arch/arm/mach-keystone/clock.c
+++ b/arch/arm/mach-keystone/clock.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clock_defs.h>
+#include <linux/bitops.h>
 
 /* DEV and ARM speed definitions as specified in DEVSPEED register */
 int __weak speeds[DEVSPEED_NUMSPDS] = {
diff --git a/arch/arm/mach-keystone/cmd_clock.c b/arch/arm/mach-keystone/cmd_clock.c
index 667826b..7165d66 100644
--- a/arch/arm/mach-keystone/cmd_clock.c
+++ b/arch/arm/mach-keystone/cmd_clock.c
@@ -19,7 +19,7 @@
 	.pll_od = 2,
 };
 
-int do_pll_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_pll_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc != 5)
 		goto pll_cmd_usage;
@@ -63,7 +63,8 @@
 	PLLSET_CMD_LIST " <mult> <div> <OD>\n"
 );
 
-int do_getclk_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_getclk_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
 {
 	unsigned int clk;
 	unsigned long freq;
@@ -92,7 +93,7 @@
 	CLOCK_INDEXES_LIST
 );
 
-int do_psc_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_psc_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int	psc_module;
 	int	res;
diff --git a/arch/arm/mach-keystone/cmd_mon.c b/arch/arm/mach-keystone/cmd_mon.c
index 8142039..049d573 100644
--- a/arch/arm/mach-keystone/cmd_mon.c
+++ b/arch/arm/mach-keystone/cmd_mon.c
@@ -12,8 +12,8 @@
 #include <mach/mon.h>
 asm(".arch_extension sec\n\t");
 
-static int do_mon_install(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_mon_install(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	u32 addr, dpsc_base = 0x1E80000, freq, load_addr, size;
 	int     rcode = 0;
@@ -65,8 +65,8 @@
 	}
 }
 
-int do_mon_power(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+int do_mon_power(struct cmd_tbl *cmdtp, int flag, int argc,
+		 char *const argv[])
 {
 	int     rcode = 0, core_id, on;
 	void (*fn)(void);
diff --git a/arch/arm/mach-keystone/cmd_poweroff.c b/arch/arm/mach-keystone/cmd_poweroff.c
index 89b1851..f0ad917 100644
--- a/arch/arm/mach-keystone/cmd_poweroff.c
+++ b/arch/arm/mach-keystone/cmd_poweroff.c
@@ -12,7 +12,7 @@
 #include <asm/arch/psc_defs.h>
 #include <asm/arch/hardware.h>
 
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	mon_power_off(0);
 
diff --git a/arch/arm/mach-keystone/ddr3.c b/arch/arm/mach-keystone/ddr3.c
index 23ff064..7dea600 100644
--- a/arch/arm/mach-keystone/ddr3.c
+++ b/arch/arm/mach-keystone/ddr3.c
@@ -7,11 +7,13 @@
  */
 
 #include <cpu_func.h>
+#include <env.h>
 #include <asm/io.h>
 #include <common.h>
 #include <asm/arch/msmc.h>
 #include <asm/arch/ddr3.h>
 #include <asm/arch/psc_defs.h>
+#include <linux/delay.h>
 
 #include <asm/ti-common/ti-edma3.h>
 
diff --git a/arch/arm/mach-keystone/ddr3_spd.c b/arch/arm/mach-keystone/ddr3_spd.c
index 6eee9ad..3803449 100644
--- a/arch/arm/mach-keystone/ddr3_spd.c
+++ b/arch/arm/mach-keystone/ddr3_spd.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 
 #include <i2c.h>
 #include <ddr_spd.h>
diff --git a/arch/arm/mach-keystone/include/mach/clock_defs.h b/arch/arm/mach-keystone/include/mach/clock_defs.h
index 42bd0ac..336b103 100644
--- a/arch/arm/mach-keystone/include/mach/clock_defs.h
+++ b/arch/arm/mach-keystone/include/mach/clock_defs.h
@@ -9,6 +9,9 @@
 #define _CLOCK_DEFS_H_
 
 #include <asm/arch/hardware.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 /* PLL Control Registers */
 struct pllctl_regs {
diff --git a/arch/arm/mach-keystone/include/mach/hardware-k2hk.h b/arch/arm/mach-keystone/include/mach/hardware-k2hk.h
index 7793cf1..3d078be 100644
--- a/arch/arm/mach-keystone/include/mach/hardware-k2hk.h
+++ b/arch/arm/mach-keystone/include/mach/hardware-k2hk.h
@@ -9,6 +9,10 @@
 #ifndef __ASM_ARCH_HARDWARE_K2HK_H
 #define __ASM_ARCH_HARDWARE_K2HK_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define KS2_ARM_PLL_EN			BIT(13)
 
 /* PA SS Registers */
diff --git a/arch/arm/mach-keystone/include/mach/hardware-k2l.h b/arch/arm/mach-keystone/include/mach/hardware-k2l.h
index f46a98c..0e710a3 100644
--- a/arch/arm/mach-keystone/include/mach/hardware-k2l.h
+++ b/arch/arm/mach-keystone/include/mach/hardware-k2l.h
@@ -9,6 +9,10 @@
 #ifndef __ASM_ARCH_HARDWARE_K2L_H
 #define __ASM_ARCH_HARDWARE_K2L_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define KS2_ARM_PLL_EN			BIT(13)
 
 /* PA SS Registers */
diff --git a/arch/arm/mach-keystone/include/mach/hardware.h b/arch/arm/mach-keystone/include/mach/hardware.h
index d2234dc..0c5dc6a 100644
--- a/arch/arm/mach-keystone/include/mach/hardware.h
+++ b/arch/arm/mach-keystone/include/mach/hardware.h
@@ -11,6 +11,7 @@
 #include <config.h>
 
 #ifndef __ASSEMBLY__
+#include <linux/bitops.h>
 
 #include <linux/sizes.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-keystone/include/mach/xhci-keystone.h b/arch/arm/mach-keystone/include/mach/xhci-keystone.h
index a053512..989b0c3 100644
--- a/arch/arm/mach-keystone/include/mach/xhci-keystone.h
+++ b/arch/arm/mach-keystone/include/mach/xhci-keystone.h
@@ -6,6 +6,10 @@
  *     Texas Instruments Incorporated, <www.ti.com>
  */
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define USB3_PHY_REF_SSP_EN		BIT(29)
 #define USB3_PHY_OTG_VBUSVLDECTSEL	BIT(16)
 
diff --git a/arch/arm/mach-keystone/init.c b/arch/arm/mach-keystone/init.c
index 3755888..88e8912 100644
--- a/arch/arm/mach-keystone/init.c
+++ b/arch/arm/mach-keystone/init.c
@@ -8,12 +8,15 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <ns16550.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/msmc.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/psc_defs.h>
+#include <linux/bitops.h>
 
 #define MAX_PCI_PORTS		2
 enum pci_mode	{
diff --git a/arch/arm/mach-keystone/keystone.c b/arch/arm/mach-keystone/keystone.c
index 7441052..efaabca 100644
--- a/arch/arm/mach-keystone/keystone.c
+++ b/arch/arm/mach-keystone/keystone.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/psc_defs.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-keystone/mon.c b/arch/arm/mach-keystone/mon.c
index b7de9ba..58995d7 100644
--- a/arch/arm/mach-keystone/mon.c
+++ b/arch/arm/mach-keystone/mon.c
@@ -6,6 +6,7 @@
  */
 
 #include <hang.h>
+#include <image.h>
 #include <asm/unaligned.h>
 #include <common.h>
 #include <command.h>
diff --git a/arch/arm/mach-keystone/psc.c b/arch/arm/mach-keystone/psc.c
index f87bcb3..145aff8 100644
--- a/arch/arm/mach-keystone/psc.c
+++ b/arch/arm/mach-keystone/psc.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/processor.h>
diff --git a/arch/arm/mach-kirkwood/cache.c b/arch/arm/mach-kirkwood/cache.c
index 6b12ea5..009b7de 100644
--- a/arch/arm/mach-kirkwood/cache.c
+++ b/arch/arm/mach-kirkwood/cache.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <asm/arch/cpu.h>
+#include <asm/cache.h>
 
 #define FEROCEON_EXTRA_FEATURE_L2C_EN (1<<22)
 
diff --git a/arch/arm/mach-kirkwood/cpu.c b/arch/arm/mach-kirkwood/cpu.c
index 5e964af..fa26903 100644
--- a/arch/arm/mach-kirkwood/cpu.c
+++ b/arch/arm/mach-kirkwood/cpu.c
@@ -9,6 +9,9 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <init.h>
+#include <log.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/cache.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index 7222504..4fdad99 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
diff --git a/arch/arm/mach-lpc32xx/cpu.c b/arch/arm/mach-lpc32xx/cpu.c
index 4c59a44..ee15a94 100644
--- a/arch/arm/mach-lpc32xx/cpu.c
+++ b/arch/arm/mach-lpc32xx/cpu.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clk.h>
diff --git a/arch/arm/mach-lpc32xx/dram.c b/arch/arm/mach-lpc32xx/dram.c
index 4f97569..1602237 100644
--- a/arch/arm/mach-lpc32xx/dram.c
+++ b/arch/arm/mach-lpc32xx/dram.c
@@ -17,6 +17,7 @@
 #include <asm/arch/wdt.h>
 #include <asm/arch/emc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 static struct clk_pm_regs *clk = (struct clk_pm_regs *)CLK_PM_BASE;
 static struct emc_regs *emc = (struct emc_regs *)EMC_BASE;
diff --git a/arch/arm/mach-lpc32xx/timer.c b/arch/arm/mach-lpc32xx/timer.c
index 3a896d1..90183e3 100644
--- a/arch/arm/mach-lpc32xx/timer.c
+++ b/arch/arm/mach-lpc32xx/timer.c
@@ -4,11 +4,13 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/timer.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 static struct timer_regs  *timer0 = (struct timer_regs *)TIMER0_BASE;
 static struct timer_regs  *timer1 = (struct timer_regs *)TIMER1_BASE;
diff --git a/arch/arm/mach-mediatek/cpu.c b/arch/arm/mach-mediatek/cpu.c
index 5e5f3f0..c329e7c 100644
--- a/arch/arm/mach-mediatek/cpu.c
+++ b/arch/arm/mach-mediatek/cpu.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <init.h>
 #include <wdt.h>
 #include <dm/uclass-internal.h>
 
diff --git a/arch/arm/mach-mediatek/mt7622/init.c b/arch/arm/mach-mediatek/mt7622/init.c
index 1e527c0..7f6ce80 100644
--- a/arch/arm/mach-mediatek/mt7622/init.c
+++ b/arch/arm/mach-mediatek/mt7622/init.c
@@ -6,7 +6,9 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <asm/armv8/mmu.h>
+#include <asm/cache.h>
 
 int print_cpuinfo(void)
 {
diff --git a/arch/arm/mach-mediatek/mt7629/init.c b/arch/arm/mach-mediatek/mt7629/init.c
index ba91a6e..c260413 100644
--- a/arch/arm/mach-mediatek/mt7629/init.c
+++ b/arch/arm/mach-mediatek/mt7629/init.c
@@ -8,10 +8,13 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <asm/arch/misc.h>
 #include <asm/sections.h>
 #include <dm/uclass.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 
 #include <dt-bindings/clock/mt7629-clk.h>
diff --git a/arch/arm/mach-mediatek/mt8512/init.c b/arch/arm/mach-mediatek/mt8512/init.c
index a38b5d1..aa779f4 100644
--- a/arch/arm/mach-mediatek/mt8512/init.c
+++ b/arch/arm/mach-mediatek/mt8512/init.c
@@ -10,10 +10,13 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <wdt.h>
 #include <asm/arch/misc.h>
 #include <asm/armv8/mmu.h>
+#include <asm/cache.h>
 #include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dt-bindings/clock/mt8512-clk.h>
diff --git a/arch/arm/mach-mediatek/mt8516/init.c b/arch/arm/mach-mediatek/mt8516/init.c
index 360d94a..13be391 100644
--- a/arch/arm/mach-mediatek/mt8516/init.c
+++ b/arch/arm/mach-mediatek/mt8516/init.c
@@ -10,9 +10,11 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <ram.h>
 #include <asm/arch/misc.h>
 #include <asm/armv8/mmu.h>
+#include <asm/cache.h>
 #include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dt-bindings/clock/mt8516-clk.h>
diff --git a/arch/arm/mach-mediatek/mt8518/init.c b/arch/arm/mach-mediatek/mt8518/init.c
index c2b1b76..531a403 100644
--- a/arch/arm/mach-mediatek/mt8518/init.c
+++ b/arch/arm/mach-mediatek/mt8518/init.c
@@ -11,9 +11,11 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <ram.h>
 #include <asm/arch/misc.h>
 #include <asm/armv8/mmu.h>
+#include <asm/cache.h>
 #include <asm/sections.h>
 #include <dm/uclass.h>
 #include <dt-bindings/clock/mt8518-clk.h>
diff --git a/arch/arm/mach-mediatek/spl.c b/arch/arm/mach-mediatek/spl.c
index 37f1f21..927175c 100644
--- a/arch/arm/mach-mediatek/spl.c
+++ b/arch/arm/mach-mediatek/spl.c
@@ -7,6 +7,7 @@
 #include <clk.h>
 #include <common.h>
 #include <hang.h>
+#include <init.h>
 #include <spl.h>
 
 #include "init.h"
diff --git a/arch/arm/mach-meson/board-axg.c b/arch/arm/mach-meson/board-axg.c
index 6874458..5e0b3f6 100644
--- a/arch/arm/mach-meson/board-axg.c
+++ b/arch/arm/mach-meson/board-axg.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/boot.h>
 #include <asm/arch/eth.h>
 #include <asm/arch/axg.h>
diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c
index 747791b..19e5bfd 100644
--- a/arch/arm/mach-meson/board-common.c
+++ b/arch/arm/mach-meson/board-common.c
@@ -6,8 +6,11 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/boot.h>
 #include <env.h>
+#include <asm/cache.h>
+#include <asm/ptrace.h>
 #include <linux/libfdt.h>
 #include <linux/err.h>
 #include <asm/arch/mem.h>
diff --git a/arch/arm/mach-meson/board-g12a.c b/arch/arm/mach-meson/board-g12a.c
index 26d6b90..14127ca 100644
--- a/arch/arm/mach-meson/board-g12a.c
+++ b/arch/arm/mach-meson/board-g12a.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/arch/boot.h>
 #include <asm/arch/eth.h>
 #include <asm/arch/g12a.h>
diff --git a/arch/arm/mach-meson/board-gx.c b/arch/arm/mach-meson/board-gx.c
index b591c92..c4cc11f 100644
--- a/arch/arm/mach-meson/board-gx.c
+++ b/arch/arm/mach-meson/board-gx.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/boot.h>
 #include <asm/arch/eth.h>
 #include <asm/arch/gx.h>
diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c
index 4b88afa..3abb27e 100644
--- a/arch/arm/mach-meson/board-info.c
+++ b/arch/arm/mach-meson/board-info.c
@@ -5,11 +5,13 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <dm.h>
 #include <linux/bitfield.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define AO_SEC_SD_CFG8		0xe0
diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c
index fac286b..ebbb880 100644
--- a/arch/arm/mach-meson/sm.c
+++ b/arch/arm/mach-meson/sm.c
@@ -6,7 +6,13 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <env.h>
+#include <log.h>
 #include <asm/arch/sm.h>
+#include <asm/cache.h>
+#include <asm/ptrace.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <dm.h>
@@ -116,7 +122,7 @@
 	return FIELD_GET(REBOOT_REASON_MASK, reason);
 }
 
-static int do_sm_serial(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_sm_serial(struct cmd_tbl *cmdtp, int flag, int argc,
 			char *const argv[])
 {
 	ulong address;
@@ -152,8 +158,8 @@
 	[REBOOT_REASON_WATCHDOG_REBOOT] = "watchdog_reboot",
 };
 
-static int do_sm_reboot_reason(cmd_tbl_t *cmdtp, int flag, int argc,
-			char *const argv[])
+static int do_sm_reboot_reason(struct cmd_tbl *cmdtp, int flag, int argc,
+			       char *const argv[])
 {
 	const char *reason_str;
 	char *destarg = NULL;
@@ -180,15 +186,15 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_sm_sub[] = {
+static struct cmd_tbl cmd_sm_sub[] = {
 	U_BOOT_CMD_MKENT(serial, 2, 1, do_sm_serial, "", ""),
 	U_BOOT_CMD_MKENT(reboot_reason, 1, 1, do_sm_reboot_reason, "", ""),
 };
 
-static int do_sm(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_sm(struct cmd_tbl *cmdtp, int flag, int argc,
 		 char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/arch/arm/mach-mvebu/arm64-common.c b/arch/arm/mach-mvebu/arm64-common.c
index 34cc047..c8c065e 100644
--- a/arch/arm/mach-mvebu/arm64-common.c
+++ b/arch/arm/mach-mvebu/arm64-common.c
@@ -7,6 +7,8 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <init.h>
+#include <asm/cache.h>
+#include <asm/ptrace.h>
 #include <linux/libfdt.h>
 #include <linux/sizes.h>
 #include <pci.h>
diff --git a/arch/arm/mach-mvebu/armada3700/cpu.c b/arch/arm/mach-mvebu/armada3700/cpu.c
index 17d2d43..e438b49 100644
--- a/arch/arm/mach-mvebu/armada3700/cpu.c
+++ b/arch/arm/mach-mvebu/armada3700/cpu.c
@@ -8,6 +8,8 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <linux/bitops.h>
 #include <linux/libfdt.h>
 #include <asm/io.h>
 #include <asm/system.h>
diff --git a/arch/arm/mach-mvebu/armada8k/dram.c b/arch/arm/mach-mvebu/armada8k/dram.c
index 265a8b0..3da9fa5 100644
--- a/arch/arm/mach-mvebu/armada8k/dram.c
+++ b/arch/arm/mach-mvebu/armada8k/dram.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <asm/ptrace.h>
 #include <asm/system.h>
 #include <linux/sizes.h>
 
diff --git a/arch/arm/mach-mvebu/cpu.c b/arch/arm/mach-mvebu/cpu.c
index fb241c7..3a63daf 100644
--- a/arch/arm/mach-mvebu/cpu.c
+++ b/arch/arm/mach-mvebu/cpu.c
@@ -6,6 +6,9 @@
 #include <common.h>
 #include <ahci.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/mbus.h>
 #include <asm/io.h>
 #include <asm/pl310.h>
diff --git a/arch/arm/mach-mvebu/efuse.c b/arch/arm/mach-mvebu/efuse.c
index 16ccfec..c79eee9 100644
--- a/arch/arm/mach-mvebu/efuse.c
+++ b/arch/arm/mach-mvebu/efuse.c
@@ -10,6 +10,8 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/efuse.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/mbus.h>
 
 #if defined(CONFIG_MVEBU_EFUSE_FAKE)
diff --git a/arch/arm/mach-mvebu/include/mach/soc.h b/arch/arm/mach-mvebu/include/mach/soc.h
index acb9257..3f3b15a 100644
--- a/arch/arm/mach-mvebu/include/mach/soc.h
+++ b/arch/arm/mach-mvebu/include/mach/soc.h
@@ -10,6 +10,10 @@
 #ifndef _MVEBU_SOC_H
 #define _MVEBU_SOC_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define SOC_MV78230_ID		0x7823
 #define SOC_MV78260_ID		0x7826
 #define SOC_MV78460_ID		0x7846
diff --git a/arch/arm/mach-mvebu/mbus.c b/arch/arm/mach-mvebu/mbus.c
index 39bd200..f29abe5 100644
--- a/arch/arm/mach-mvebu/mbus.c
+++ b/arch/arm/mach-mvebu/mbus.c
@@ -48,6 +48,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
index a1cef9f..adef333 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
+++ b/arch/arm/mach-mvebu/serdes/a38x/ctrl_pex.c
@@ -8,6 +8,8 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include "ctrl_pex.h"
 #include "sys_env_lib.h"
diff --git a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
index 66409a5..67a00cf 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
+++ b/arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "high_speed_env_spec.h"
 #include "sys_env_lib.h"
diff --git a/arch/arm/mach-mvebu/serdes/a38x/seq_exec.c b/arch/arm/mach-mvebu/serdes/a38x/seq_exec.c
index d9edfaa..2a51b71 100644
--- a/arch/arm/mach-mvebu/serdes/a38x/seq_exec.c
+++ b/arch/arm/mach-mvebu/serdes/a38x/seq_exec.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "seq_exec.h"
 #include "high_speed_env_spec.h"
diff --git a/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c b/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c
index c8c9298..ea3b4c7 100644
--- a/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c
+++ b/arch/arm/mach-mvebu/serdes/axp/high_speed_env_lib.c
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "high_speed_env_spec.h"
 #include "board_env_spec.h"
diff --git a/arch/arm/mach-mvebu/spl.c b/arch/arm/mach-mvebu/spl.c
index 70fef3b..f645bef 100644
--- a/arch/arm/mach-mvebu/spl.c
+++ b/arch/arm/mach-mvebu/spl.c
@@ -8,6 +8,8 @@
 #include <debug_uart.h>
 #include <fdtdec.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/arch/arm/mach-mvebu/timer.c b/arch/arm/mach-mvebu/timer.c
index 2f6b4d1..43b3ed1 100644
--- a/arch/arm/mach-mvebu/timer.c
+++ b/arch/arm/mach-mvebu/timer.c
@@ -7,8 +7,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 
 #define TIMER_LOAD_VAL			0xffffffff
 
diff --git a/arch/arm/mach-omap2/abb.c b/arch/arm/mach-omap2/abb.c
index 108c935..722e6db 100644
--- a/arch/arm/mach-omap2/abb.c
+++ b/arch/arm/mach-omap2/abb.c
@@ -13,6 +13,7 @@
 #include <asm/arch/clock.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/bitops.h>
 
 __weak s8 abb_setup_ldovbb(u32 fuse, u32 ldovbb)
 {
diff --git a/arch/arm/mach-omap2/am33xx/board.c b/arch/arm/mach-omap2/am33xx/board.c
index 283f735..ce58bf8 100644
--- a/arch/arm/mach-omap2/am33xx/board.c
+++ b/arch/arm/mach-omap2/am33xx/board.c
@@ -12,6 +12,7 @@
 #include <debug_uart.h>
 #include <errno.h>
 #include <init.h>
+#include <net.h>
 #include <ns16550.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
@@ -31,6 +32,7 @@
 #include <i2c.h>
 #include <miiphy.h>
 #include <cpsw.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/compiler.h>
 #include <linux/usb/ch9.h>
diff --git a/arch/arm/mach-omap2/am33xx/chilisom.c b/arch/arm/mach-omap2/am33xx/chilisom.c
index 3942305..15b6b35 100644
--- a/arch/arm/mach-omap2/am33xx/chilisom.c
+++ b/arch/arm/mach-omap2/am33xx/chilisom.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clk_synthesizer.h>
 #include <asm/arch/cpu.h>
diff --git a/arch/arm/mach-omap2/am33xx/clock.c b/arch/arm/mach-omap2/am33xx/clock.c
index 8c61547..8819062 100644
--- a/arch/arm/mach-omap2/am33xx/clock.c
+++ b/arch/arm/mach-omap2/am33xx/clock.c
@@ -9,6 +9,8 @@
  */
 #include <common.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-omap2/am33xx/clock_ti814x.c b/arch/arm/mach-omap2/am33xx/clock_ti814x.c
index aef090b..27abaff 100644
--- a/arch/arm/mach-omap2/am33xx/clock_ti814x.c
+++ b/arch/arm/mach-omap2/am33xx/clock_ti814x.c
@@ -12,6 +12,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 /* PRCM */
 #define PRCM_MOD_EN		0x2
diff --git a/arch/arm/mach-omap2/am33xx/clock_ti816x.c b/arch/arm/mach-omap2/am33xx/clock_ti816x.c
index e9c7b2d..ec4cc75 100644
--- a/arch/arm/mach-omap2/am33xx/clock_ti816x.c
+++ b/arch/arm/mach-omap2/am33xx/clock_ti816x.c
@@ -27,6 +27,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #include <asm/emif.h>
 
diff --git a/arch/arm/mach-omap2/am33xx/ddr.c b/arch/arm/mach-omap2/am33xx/ddr.c
index 3fd1d08..f8434ec 100644
--- a/arch/arm/mach-omap2/am33xx/ddr.c
+++ b/arch/arm/mach-omap2/am33xx/ddr.c
@@ -5,11 +5,14 @@
  * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
  */
 
+#include <common.h>
+#include <log.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/ddr_defs.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
 #include <asm/emif.h>
+#include <linux/delay.h>
 
 /**
  * Base address for EMIF instances
diff --git a/arch/arm/mach-omap2/am33xx/sys_info.c b/arch/arm/mach-omap2/am33xx/sys_info.c
index 17b4661..338f6af 100644
--- a/arch/arm/mach-omap2/am33xx/sys_info.c
+++ b/arch/arm/mach-omap2/am33xx/sys_info.c
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/cpu.h>
diff --git a/arch/arm/mach-omap2/am33xx/ti816x_emif4.c b/arch/arm/mach-omap2/am33xx/ti816x_emif4.c
index 9f59489..707ea80 100644
--- a/arch/arm/mach-omap2/am33xx/ti816x_emif4.c
+++ b/arch/arm/mach-omap2/am33xx/ti816x_emif4.c
@@ -15,6 +15,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
 #include <asm/emif.h>
+#include <linux/delay.h>
 
 /*********************************************************************
  * Init DDR3 on TI816X EVM
diff --git a/arch/arm/mach-omap2/boot-common.c b/arch/arm/mach-omap2/boot-common.c
index d57382a..cb9d7fd 100644
--- a/arch/arm/mach-omap2/boot-common.c
+++ b/arch/arm/mach-omap2/boot-common.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/omap_common.h>
 #include <asm/arch/omap.h>
diff --git a/arch/arm/mach-omap2/clocks-common.c b/arch/arm/mach-omap2/clocks-common.c
index 9aff83e..757fa38 100644
--- a/arch/arm/mach-omap2/clocks-common.c
+++ b/arch/arm/mach-omap2/clocks-common.c
@@ -15,6 +15,8 @@
 #include <common.h>
 #include <hang.h>
 #include <i2c.h>
+#include <init.h>
+#include <log.h>
 #include <asm/omap_common.h>
 #include <asm/gpio.h>
 #include <asm/arch/clock.h>
diff --git a/arch/arm/mach-omap2/emif-common.c b/arch/arm/mach-omap2/emif-common.c
index 4658f67..312f868 100644
--- a/arch/arm/mach-omap2/emif-common.c
+++ b/arch/arm/mach-omap2/emif-common.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
 #include <net.h>
 #include <asm/emif.h>
 #include <asm/arch/clock.h>
@@ -20,6 +21,7 @@
 #include <asm/utils.h>
 #include <linux/compiler.h>
 #include <asm/ti-common/ti-edma3.h>
+#include <linux/delay.h>
 
 static int emif1_enabled = -1, emif2_enabled = -1;
 
diff --git a/arch/arm/mach-omap2/fdt-common.c b/arch/arm/mach-omap2/fdt-common.c
index 3f42018..5f344f8 100644
--- a/arch/arm/mach-omap2/fdt-common.c
+++ b/arch/arm/mach-omap2/fdt-common.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
diff --git a/arch/arm/mach-omap2/hwinit-common.c b/arch/arm/mach-omap2/hwinit-common.c
index 772b4c4..7a70867 100644
--- a/arch/arm/mach-omap2/hwinit-common.c
+++ b/arch/arm/mach-omap2/hwinit-common.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <debug_uart.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/arch/sys_proto.h>
 #include <linux/sizes.h>
diff --git a/arch/arm/mach-omap2/omap-cache.c b/arch/arm/mach-omap2/omap-cache.c
index 1eff9be..2c9ada0 100644
--- a/arch/arm/mach-omap2/omap-cache.c
+++ b/arch/arm/mach-omap2/omap-cache.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/cache.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-omap2/omap3/am35x_musb.c b/arch/arm/mach-omap2/omap3/am35x_musb.c
index 5af6d28..026e5d2 100644
--- a/arch/arm/mach-omap2/omap3/am35x_musb.c
+++ b/arch/arm/mach-omap2/omap3/am35x_musb.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/am35x_def.h>
 
diff --git a/arch/arm/mach-omap2/omap3/board.c b/arch/arm/mach-omap2/omap3/board.c
index 60de0d6..f08c8ab 100644
--- a/arch/arm/mach-omap2/omap3/board.c
+++ b/arch/arm/mach-omap2/omap3/board.c
@@ -16,7 +16,9 @@
  *
  */
 #include <common.h>
+#include <command.h>
 #include <dm.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
@@ -279,7 +281,8 @@
 /******************************************************************************
  * OMAP3 specific command to switch between NAND HW and SW ecc
  *****************************************************************************/
-static int do_switch_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_switch_ecc(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	int hw, strength = 1;
 
diff --git a/arch/arm/mach-omap2/omap3/emac.c b/arch/arm/mach-omap2/omap3/emac.c
index fb0c918..eecc5d3 100644
--- a/arch/arm/mach-omap2/omap3/emac.c
+++ b/arch/arm/mach-omap2/omap3/emac.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/am35x_def.h>
 
diff --git a/arch/arm/mach-omap2/omap3/emif4.c b/arch/arm/mach-omap2/omap3/emif4.c
index a8bd428..4cfa132 100644
--- a/arch/arm/mach-omap2/omap3/emif4.c
+++ b/arch/arm/mach-omap2/omap3/emif4.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/mem.h>
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-omap2/omap3/sdrc.c b/arch/arm/mach-omap2/omap3/sdrc.c
index 861d01d..1d65ed6 100644
--- a/arch/arm/mach-omap2/omap3/sdrc.c
+++ b/arch/arm/mach-omap2/omap3/sdrc.c
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/mem.h>
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-omap2/omap4/sdram_elpida.c b/arch/arm/mach-omap2/omap4/sdram_elpida.c
index a29a264..2a18cf0 100644
--- a/arch/arm/mach-omap2/omap4/sdram_elpida.c
+++ b/arch/arm/mach-omap2/omap4/sdram_elpida.c
@@ -9,6 +9,7 @@
  * Aneesh V <aneesh@ti.com>
  */
 
+#include <common.h>
 #include <asm/emif.h>
 #include <asm/arch/sys_proto.h>
 
diff --git a/arch/arm/mach-omap2/omap5/abb.c b/arch/arm/mach-omap2/omap5/abb.c
index 446f99f..2f9f8e6 100644
--- a/arch/arm/mach-omap2/omap5/abb.c
+++ b/arch/arm/mach-omap2/omap5/abb.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <asm/omap_common.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /*
  * Setup LDOVBB for OMAP5.
diff --git a/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c b/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c
index 598074b..8569eff 100644
--- a/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c
+++ b/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <hang.h>
+#include <log.h>
 #include <asm/utils.h>
 #include <asm/arch/dra7xx_iodelay.h>
 #include <asm/arch/omap.h>
diff --git a/arch/arm/mach-omap2/omap5/emif.c b/arch/arm/mach-omap2/omap5/emif.c
index f3661a0..2de36b6 100644
--- a/arch/arm/mach-omap2/omap5/emif.c
+++ b/arch/arm/mach-omap2/omap5/emif.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/emif.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/utils.h>
diff --git a/arch/arm/mach-omap2/omap5/fdt.c b/arch/arm/mach-omap2/omap5/fdt.c
index c4adba3..3f8474b 100644
--- a/arch/arm/mach-omap2/omap5/fdt.c
+++ b/arch/arm/mach-omap2/omap5/fdt.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <hang.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <malloc.h>
diff --git a/arch/arm/mach-omap2/omap5/hwinit.c b/arch/arm/mach-omap2/omap5/hwinit.c
index 3b17330..47ac865 100644
--- a/arch/arm/mach-omap2/omap5/hwinit.c
+++ b/arch/arm/mach-omap2/omap5/hwinit.c
@@ -18,6 +18,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/clock.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <asm/utils.h>
 #include <asm/arch/gpio.h>
diff --git a/arch/arm/mach-omap2/omap5/sdram.c b/arch/arm/mach-omap2/omap5/sdram.c
index 6bf4cf4..786da45 100644
--- a/arch/arm/mach-omap2/omap5/sdram.c
+++ b/arch/arm/mach-omap2/omap5/sdram.c
@@ -10,6 +10,7 @@
  * Sricharan R <r.sricharan@ti.com>
  */
 
+#include <common.h>
 #include <asm/emif.h>
 #include <asm/arch/sys_proto.h>
 
diff --git a/arch/arm/mach-omap2/pipe3-phy.c b/arch/arm/mach-omap2/pipe3-phy.c
index 8808e35..35ec81d 100644
--- a/arch/arm/mach-omap2/pipe3-phy.c
+++ b/arch/arm/mach-omap2/pipe3-phy.c
@@ -11,6 +11,8 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include "pipe3-phy.h"
 
diff --git a/arch/arm/mach-omap2/sec-common.c b/arch/arm/mach-omap2/sec-common.c
index 28b929f..0551bc1 100644
--- a/arch/arm/mach-omap2/sec-common.c
+++ b/arch/arm/mach-omap2/sec-common.c
@@ -13,9 +13,11 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
 #include <stdarg.h>
 
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-omap2/timer.c b/arch/arm/mach-omap2/timer.c
index dbb68f7..bcfba16 100644
--- a/arch/arm/mach-omap2/timer.c
+++ b/arch/arm/mach-omap2/timer.c
@@ -16,10 +16,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clock.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-omap2/utils.c b/arch/arm/mach-omap2/utils.c
index 0d5ca20..6e6791f 100644
--- a/arch/arm/mach-omap2/utils.c
+++ b/arch/arm/mach-omap2/utils.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <env.h>
+#include <part.h>
 #include <asm/setup.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/omap_common.h>
@@ -90,7 +91,7 @@
 {
 	int res;
 	struct blk_desc *dev_desc;
-	disk_partition_t info;
+	struct disk_partition info;
 	u64 sz = 0;
 
 	dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
diff --git a/arch/arm/mach-orion5x/cpu.c b/arch/arm/mach-orion5x/cpu.c
index 5a693e2..d9abcac 100644
--- a/arch/arm/mach-orion5x/cpu.c
+++ b/arch/arm/mach-orion5x/cpu.c
@@ -10,6 +10,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/cache.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-orion5x/timer.c b/arch/arm/mach-orion5x/timer.c
index 077eb63..4926bb7 100644
--- a/arch/arm/mach-orion5x/timer.c
+++ b/arch/arm/mach-orion5x/timer.c
@@ -8,8 +8,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #define UBOOT_CNTR	0	/* counter to use for uboot timer */
 
diff --git a/arch/arm/mach-owl/soc.c b/arch/arm/mach-owl/soc.c
index 409cbd3..7d3f6f6 100644
--- a/arch/arm/mach-owl/soc.c
+++ b/arch/arm/mach-owl/soc.c
@@ -6,6 +6,8 @@
  */
 
 #include <cpu_func.h>
+#include <init.h>
+#include <asm/cache.h>
 #include <linux/arm-smccc.h>
 #include <linux/psci.h>
 #include <common.h>
diff --git a/arch/arm/mach-rmobile/board.c b/arch/arm/mach-rmobile/board.c
index 8a2d3ce..a10371f 100644
--- a/arch/arm/mach-rmobile/board.c
+++ b/arch/arm/mach-rmobile/board.c
@@ -4,6 +4,7 @@
  * (C) Copyright 2012 Renesas Solutions Corp.
  */
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 
 #ifdef CONFIG_ARCH_RMOBILE_BOARD_STRING
diff --git a/arch/arm/mach-rmobile/cpu_info.c b/arch/arm/mach-rmobile/cpu_info.c
index 2cc701c..fdbbd72 100644
--- a/arch/arm/mach-rmobile/cpu_info.c
+++ b/arch/arm/mach-rmobile/cpu_info.c
@@ -5,6 +5,8 @@
  */
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
+#include <init.h>
 #include <asm/io.h>
 #include <env.h>
 #include <linux/ctype.h>
diff --git a/arch/arm/mach-rmobile/emac.c b/arch/arm/mach-rmobile/emac.c
index f9cd89a..3211dfe 100644
--- a/arch/arm/mach-rmobile/emac.c
+++ b/arch/arm/mach-rmobile/emac.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <linux/errno.h>
 #include <netdev.h>
 
diff --git a/arch/arm/mach-rmobile/include/mach/rcar-gen3-base.h b/arch/arm/mach-rmobile/include/mach/rcar-gen3-base.h
index ecd02b9..5cd8a8c 100644
--- a/arch/arm/mach-rmobile/include/mach/rcar-gen3-base.h
+++ b/arch/arm/mach-rmobile/include/mach/rcar-gen3-base.h
@@ -79,6 +79,7 @@
 
 #ifndef __ASSEMBLY__
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 /* RWDT */
 struct rcar_rwdt {
diff --git a/arch/arm/mach-rmobile/include/mach/sh_sdhi.h b/arch/arm/mach-rmobile/include/mach/sh_sdhi.h
index be9b233..7741718 100644
--- a/arch/arm/mach-rmobile/include/mach/sh_sdhi.h
+++ b/arch/arm/mach-rmobile/include/mach/sh_sdhi.h
@@ -11,6 +11,7 @@
 #ifndef _SH_SDHI_H
 #define _SH_SDHI_H
 
+#include <linux/bitops.h>
 #define SDHI_CMD			(0x0000 >> 1)
 #define SDHI_PORTSEL			(0x0004 >> 1)
 #define SDHI_ARG0			(0x0008 >> 1)
diff --git a/arch/arm/mach-rmobile/timer.c b/arch/arm/mach-rmobile/timer.c
index 9fcab44..ba06535 100644
--- a/arch/arm/mach-rmobile/timer.c
+++ b/arch/arm/mach-rmobile/timer.c
@@ -6,10 +6,12 @@
 
 #include <common.h>
 #include <div64.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch-armv7/globaltimer.h>
 #include <asm/arch/rmobile.h>
+#include <linux/delay.h>
 
 static struct globaltimer *global_timer = \
 		(struct globaltimer *)GLOBAL_TIMER_BASE_ADDR;
diff --git a/arch/arm/mach-rockchip/board.c b/arch/arm/mach-rockchip/board.c
index 14b9e89..430c0cb 100644
--- a/arch/arm/mach-rockchip/board.c
+++ b/arch/arm/mach-rockchip/board.c
@@ -7,8 +7,10 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <syscon.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/boot_mode.h>
 #include <asm/arch-rockchip/clock.h>
diff --git a/arch/arm/mach-rockchip/boot_mode.c b/arch/arm/mach-rockchip/boot_mode.c
index 7598fe4..2158934 100644
--- a/arch/arm/mach-rockchip/boot_mode.c
+++ b/arch/arm/mach-rockchip/boot_mode.c
@@ -5,6 +5,9 @@
 
 #include <common.h>
 #include <adc.h>
+#include <command.h>
+#include <env.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/boot_mode.h>
 #include <dm/device.h>
diff --git a/arch/arm/mach-rockchip/bootrom.c b/arch/arm/mach-rockchip/bootrom.c
index 1524eca..b36e559 100644
--- a/arch/arm/mach-rockchip/bootrom.c
+++ b/arch/arm/mach-rockchip/bootrom.c
@@ -7,6 +7,7 @@
 #include <hang.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/boot_mode.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/setjmp.h>
 #include <asm/system.h>
diff --git a/arch/arm/mach-rockchip/cpu-info.c b/arch/arm/mach-rockchip/cpu-info.c
index 4b0e992..21ca9de 100644
--- a/arch/arm/mach-rockchip/cpu-info.c
+++ b/arch/arm/mach-rockchip/cpu-info.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/clock.h>
 #include <asm/arch-rockchip/cru.h>
diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
index 6dbb9bd..28c7c72 100644
--- a/arch/arm/mach-rockchip/misc.c
+++ b/arch/arm/mach-rockchip/misc.c
@@ -12,6 +12,8 @@
 #include <common.h>
 #include <env.h>
 #include <dm.h>
+#include <hash.h>
+#include <log.h>
 #include <dm/uclass-internal.h>
 #include <misc.h>
 #include <u-boot/crc.h>
diff --git a/arch/arm/mach-rockchip/px30-board-tpl.c b/arch/arm/mach-rockchip/px30-board-tpl.c
index 8c8976f..085e650 100644
--- a/arch/arm/mach-rockchip/px30-board-tpl.c
+++ b/arch/arm/mach-rockchip/px30-board-tpl.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <debug_uart.h>
 #include <dm.h>
+#include <init.h>
 #include <ram.h>
 #include <spl.h>
 #include <version.h>
diff --git a/arch/arm/mach-rockchip/px30/px30.c b/arch/arm/mach-rockchip/px30/px30.c
index 5014ee8..6fcef63 100644
--- a/arch/arm/mach-rockchip/px30/px30.c
+++ b/arch/arm/mach-rockchip/px30/px30.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <init.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/grf_px30.h>
diff --git a/arch/arm/mach-rockchip/px30/syscon_px30.c b/arch/arm/mach-rockchip/px30/syscon_px30.c
index 0331491..4672bdb 100644
--- a/arch/arm/mach-rockchip/px30/syscon_px30.c
+++ b/arch/arm/mach-rockchip/px30/syscon_px30.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
 
diff --git a/arch/arm/mach-rockchip/rk3036-board-spl.c b/arch/arm/mach-rockchip/rk3036-board-spl.c
index fbc89b6..6eb89e1 100644
--- a/arch/arm/mach-rockchip/rk3036-board-spl.c
+++ b/arch/arm/mach-rockchip/rk3036-board-spl.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/sdram_rk3036.h>
diff --git a/arch/arm/mach-rockchip/rk3036/rk3036.c b/arch/arm/mach-rockchip/rk3036/rk3036.c
index e9ada6d..e9e020f 100644
--- a/arch/arm/mach-rockchip/rk3036/rk3036.c
+++ b/arch/arm/mach-rockchip/rk3036/rk3036.c
@@ -2,6 +2,9 @@
 /*
  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
+
+#include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/grf_rk3036.h>
 #include <asm/arch-rockchip/hardware.h>
diff --git a/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c b/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
index c39cbb8..6ae254e 100644
--- a/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
+++ b/arch/arm/mach-rockchip/rk3036/sdram_rk3036.c
@@ -3,6 +3,7 @@
  * (C) Copyright 2015 Rockchip Electronics Co., Ltd
  */
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/types.h>
 #include <asm/arch-rockchip/cru_rk3036.h>
@@ -10,6 +11,7 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <asm/arch-rockchip/sdram_rk3036.h>
 #include <asm/arch-rockchip/uart.h>
+#include <linux/delay.h>
 
 /*
  * we can not fit the code to access the device tree in SPL
diff --git a/arch/arm/mach-rockchip/rk3128/rk3128.c b/arch/arm/mach-rockchip/rk3128/rk3128.c
index ee176de..740bd2b 100644
--- a/arch/arm/mach-rockchip/rk3128/rk3128.c
+++ b/arch/arm/mach-rockchip/rk3128/rk3128.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2017 Rockchip Electronics Co., Ltd
  */
 #include <common.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c
index e52466f..ef57dfd 100644
--- a/arch/arm/mach-rockchip/rk3188/rk3188.c
+++ b/arch/arm/mach-rockchip/rk3188/rk3188.c
@@ -5,6 +5,8 @@
 #include <common.h>
 #include <dm.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
diff --git a/arch/arm/mach-rockchip/rk3188/syscon_rk3188.c b/arch/arm/mach-rockchip/rk3188/syscon_rk3188.c
index 94f4ec7..ea7d7b5 100644
--- a/arch/arm/mach-rockchip/rk3188/syscon_rk3188.c
+++ b/arch/arm/mach-rockchip/rk3188/syscon_rk3188.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
 
diff --git a/arch/arm/mach-rockchip/rk322x/rk322x.c b/arch/arm/mach-rockchip/rk322x/rk322x.c
index 562117e..ad4ac62 100644
--- a/arch/arm/mach-rockchip/rk322x/rk322x.c
+++ b/arch/arm/mach-rockchip/rk322x/rk322x.c
@@ -2,6 +2,7 @@
 /*
  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/grf_rk322x.h>
diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c
index 812f3bd..804abe8 100644
--- a/arch/arm/mach-rockchip/rk3288/rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/rk3288.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2016 Rockchip Electronics Co., Ltd
  */
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <env.h>
 #include <clk.h>
@@ -114,8 +115,8 @@
 	return rk3288_board_late_init();
 }
 
-static int do_clock(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_clock(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	static const struct {
 		char *name;
diff --git a/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c b/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c
index dff2caa..e3da0a0 100644
--- a/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c
+++ b/arch/arm/mach-rockchip/rk3288/syscon_rk3288.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
 
diff --git a/arch/arm/mach-rockchip/rk3308/rk3308.c b/arch/arm/mach-rockchip/rk3308/rk3308.c
index edf5994..8e8214c 100644
--- a/arch/arm/mach-rockchip/rk3308/rk3308.c
+++ b/arch/arm/mach-rockchip/rk3308/rk3308.c
@@ -3,12 +3,14 @@
  *Copyright (c) 2018 Rockchip Electronics Co., Ltd
  */
 #include <common.h>
+#include <init.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <asm/arch/grf_rk3308.h>
 #include <asm/arch-rockchip/hardware.h>
 #include <asm/gpio.h>
 #include <debug_uart.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-rockchip/rk3328/rk3328.c b/arch/arm/mach-rockchip/rk3328/rk3328.c
index 8c81242e..7c85b26 100644
--- a/arch/arm/mach-rockchip/rk3328/rk3328.c
+++ b/arch/arm/mach-rockchip/rk3328/rk3328.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/arch-rockchip/hardware.h>
 #include <asm/arch-rockchip/grf_rk3328.h>
diff --git a/arch/arm/mach-rockchip/rk3368/rk3368.c b/arch/arm/mach-rockchip/rk3368/rk3368.c
index 20ae797..1c6d65a 100644
--- a/arch/arm/mach-rockchip/rk3368/rk3368.c
+++ b/arch/arm/mach-rockchip/rk3368/rk3368.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <syscon.h>
 #include <asm/armv8/mmu.h>
 #include <asm/io.h>
@@ -13,6 +14,8 @@
 #include <asm/arch-rockchip/cru_rk3368.h>
 #include <asm/arch-rockchip/grf_rk3368.h>
 #include <asm/arch-rockchip/hardware.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-rockchip/rk3368/syscon_rk3368.c b/arch/arm/mach-rockchip/rk3368/syscon_rk3368.c
index 4ba94f2..cba0dda 100644
--- a/arch/arm/mach-rockchip/rk3368/syscon_rk3368.c
+++ b/arch/arm/mach-rockchip/rk3368/syscon_rk3368.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
 
diff --git a/arch/arm/mach-rockchip/rk3399/rk3399.c b/arch/arm/mach-rockchip/rk3399/rk3399.c
index dafa142..09b0d6e 100644
--- a/arch/arm/mach-rockchip/rk3399/rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/rk3399.c
@@ -4,6 +4,9 @@
  */
 
 #include <common.h>
+#include <fdt_support.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <spl_gpio.h>
 #include <syscon.h>
@@ -14,6 +17,7 @@
 #include <asm/arch-rockchip/gpio.h>
 #include <asm/arch-rockchip/grf_rk3399.h>
 #include <asm/arch-rockchip/hardware.h>
+#include <linux/bitops.h>
 #include <power/regulator.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c b/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c
index 259ca44..6b02dc8 100644
--- a/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c
+++ b/arch/arm/mach-rockchip/rk3399/syscon_rk3399.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
 
diff --git a/arch/arm/mach-rockchip/sdram.c b/arch/arm/mach-rockchip/sdram.c
index 530644c..24fe6cc 100644
--- a/arch/arm/mach-rockchip/sdram.c
+++ b/arch/arm/mach-rockchip/sdram.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/sdram.h>
diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c
index c147d58..c2e4023 100644
--- a/arch/arm/mach-rockchip/spl-boot-order.c
+++ b/arch/arm/mach-rockchip/spl-boot-order.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <mmc.h>
 #include <spl.h>
 
diff --git a/arch/arm/mach-rockchip/spl.c b/arch/arm/mach-rockchip/spl.c
index 0b76af6..ec2f66d 100644
--- a/arch/arm/mach-rockchip/spl.c
+++ b/arch/arm/mach-rockchip/spl.c
@@ -7,10 +7,14 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <spl.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-rockchip/tpl.c b/arch/arm/mach-rockchip/tpl.c
index a2b8d31..88f80b0 100644
--- a/arch/arm/mach-rockchip/tpl.c
+++ b/arch/arm/mach-rockchip/tpl.c
@@ -7,11 +7,14 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <spl.h>
 #include <version.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/bootrom.h>
+#include <linux/bitops.h>
 
 #define TIMER_LOAD_COUNT_L	0x00
 #define TIMER_LOAD_COUNT_H	0x04
diff --git a/arch/arm/mach-s5pc1xx/cache.c b/arch/arm/mach-s5pc1xx/cache.c
index 7816ba1..b390bdf 100644
--- a/arch/arm/mach-s5pc1xx/cache.c
+++ b/arch/arm/mach-s5pc1xx/cache.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 
 #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
 void enable_caches(void)
diff --git a/arch/arm/mach-snapdragon/dram.c b/arch/arm/mach-snapdragon/dram.c
index 79eb199..2a161be 100644
--- a/arch/arm/mach-snapdragon/dram.c
+++ b/arch/arm/mach-snapdragon/dram.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <part.h>
 #include <smem.h>
 #include <fdt_support.h>
 #include <asm/arch/dram.h>
diff --git a/arch/arm/mach-snapdragon/pinctrl-snapdragon.c b/arch/arm/mach-snapdragon/pinctrl-snapdragon.c
index 9ba8fdd..442d236 100644
--- a/arch/arm/mach-snapdragon/pinctrl-snapdragon.c
+++ b/arch/arm/mach-snapdragon/pinctrl-snapdragon.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <asm/io.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include "pinctrl-snapdragon.h"
 
 struct msm_pinctrl_priv {
diff --git a/arch/arm/mach-socfpga/board.c b/arch/arm/mach-socfpga/board.c
index 7c8c05c..340abf9 100644
--- a/arch/arm/mach-socfpga/board.c
+++ b/arch/arm/mach-socfpga/board.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/arch/clock_manager.h>
 #include <asm/arch/misc.h>
diff --git a/arch/arm/mach-socfpga/clock_manager.c b/arch/arm/mach-socfpga/clock_manager.c
index dbb10ec..a4a97b6 100644
--- a/arch/arm/mach-socfpga/clock_manager.c
+++ b/arch/arm/mach-socfpga/clock_manager.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <init.h>
 #include <wait_bit.h>
 #include <asm/io.h>
 #include <asm/arch/clock_manager.h>
@@ -61,7 +63,8 @@
 }
 
 #ifndef CONFIG_SPL_BUILD
-static int do_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_showclocks(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	cm_print_clock_quick_summary();
 	return 0;
diff --git a/arch/arm/mach-socfpga/clock_manager_agilex.c b/arch/arm/mach-socfpga/clock_manager_agilex.c
index 4ee2b7b..6188a8c 100644
--- a/arch/arm/mach-socfpga/clock_manager_agilex.c
+++ b/arch/arm/mach-socfpga/clock_manager_agilex.c
@@ -7,6 +7,7 @@
 #include <clk.h>
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/arch/clock_manager.h>
 #include <asm/arch/system_manager.h>
diff --git a/arch/arm/mach-socfpga/clock_manager_arria10.c b/arch/arm/mach-socfpga/clock_manager_arria10.c
index d7c8eaf..58d5d3f 100644
--- a/arch/arm/mach-socfpga/clock_manager_arria10.c
+++ b/arch/arm/mach-socfpga/clock_manager_arria10.c
@@ -11,6 +11,7 @@
 #include <clk.h>
 #include <dm/device-internal.h>
 #include <asm/arch/clock_manager.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_SPL_BUILD
 
diff --git a/arch/arm/mach-socfpga/freeze_controller.c b/arch/arm/mach-socfpga/freeze_controller.c
index d48aeec..561d340 100644
--- a/arch/arm/mach-socfpga/freeze_controller.c
+++ b/arch/arm/mach-socfpga/freeze_controller.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/arch/clock_manager.h>
 #include <asm/arch/freeze_controller.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 
 static const struct socfpga_freeze_controller *freeze_controller_base =
diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager.h b/arch/arm/mach-socfpga/include/mach/clock_manager.h
index c683058..1f734bc 100644
--- a/arch/arm/mach-socfpga/include/mach/clock_manager.h
+++ b/arch/arm/mach-socfpga/include/mach/clock_manager.h
@@ -8,7 +8,7 @@
 
 phys_addr_t socfpga_get_clkmgr_addr(void);
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 void cm_wait_for_lock(u32 mask);
 int cm_wait_for_fsm(void);
 void cm_print_clock_quick_summary(void);
diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h b/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
index 23f280d..11ddee5 100644
--- a/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/clock_manager_arria10.h
@@ -6,7 +6,9 @@
 #ifndef CLOCK_MANAGER_ARRIA10
 #define CLOCK_MANAGER_ARRIA10
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
+
+#include <linux/bitops.h>
 
 /* Clock manager group */
 #define CLKMGR_A10_CTRL				0x00
@@ -64,12 +66,13 @@
 int cm_basic_init(const void *blob);
 #endif
 
+#include <linux/bitops.h>
 unsigned int cm_get_l4_sp_clk_hz(void);
 unsigned long cm_get_mpu_clk_hz(void);
 
 unsigned int cm_get_qspi_controller_clk_hz(void);
 
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
 #define LOCKED_MASK	(CLKMGR_CLKMGR_STAT_MAINPLLLOCKED_SET_MSK | \
 			 CLKMGR_CLKMGR_STAT_PERPLLLOCKED_SET_MSK)
diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h b/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
index 0865509..5c9abe6 100644
--- a/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
+++ b/arch/arm/mach-socfpga/include/mach/clock_manager_gen5.h
@@ -6,7 +6,9 @@
 #ifndef _CLOCK_MANAGER_GEN5_H_
 #define _CLOCK_MANAGER_GEN5_H_
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
+
+#include <linux/bitops.h>
 
 struct cm_config {
 	/* main group */
@@ -107,8 +109,9 @@
 /* Clock configuration accessors */
 int cm_basic_init(const struct cm_config * const cfg);
 const struct cm_config * const cm_get_default_config(void);
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
+#include <linux/bitops.h>
 #define LOCKED_MASK \
 	(CLKMGR_INTER_SDRPLLLOCKED_MASK  | \
 	CLKMGR_INTER_PERPLLLOCKED_MASK  | \
diff --git a/arch/arm/mach-socfpga/include/mach/clock_manager_s10.h b/arch/arm/mach-socfpga/include/mach/clock_manager_s10.h
index 9d2b3ba..cb7923b 100644
--- a/arch/arm/mach-socfpga/include/mach/clock_manager_s10.h
+++ b/arch/arm/mach-socfpga/include/mach/clock_manager_s10.h
@@ -8,6 +8,7 @@
 #define	_CLOCK_MANAGER_S10_
 
 #include <asm/arch/clock_manager_soc64.h>
+#include <linux/bitops.h>
 
 /* Clock speed accessors */
 unsigned long cm_get_mpu_clk_hz(void);
diff --git a/arch/arm/mach-socfpga/include/mach/firewall.h b/arch/arm/mach-socfpga/include/mach/firewall.h
index 430341b..adab65b 100644
--- a/arch/arm/mach-socfpga/include/mach/firewall.h
+++ b/arch/arm/mach-socfpga/include/mach/firewall.h
@@ -7,6 +7,8 @@
 #ifndef	_FIREWALL_H_
 #define	_FIREWALL_H_
 
+#include <linux/bitops.h>
+
 struct socfpga_firwall_l4_per {
 	u32	nand;		/* 0x00 */
 	u32	nand_data;
diff --git a/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h b/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
index 62249b3..0487082 100644
--- a/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/fpga_manager_arria10.h
@@ -7,6 +7,7 @@
 #include <asm/cache.h>
 #include <altera.h>
 #include <image.h>
+#include <linux/bitops.h>
 
 #ifndef _FPGA_MANAGER_ARRIA10_H_
 #define _FPGA_MANAGER_ARRIA10_H_
diff --git a/arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h b/arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h
index c8ec5d4..e08c005 100644
--- a/arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h
+++ b/arch/arm/mach-socfpga/include/mach/fpga_manager_gen5.h
@@ -7,6 +7,7 @@
 #ifndef _FPGA_MANAGER_GEN5_H_
 #define _FPGA_MANAGER_GEN5_H_
 
+#include <linux/bitops.h>
 #define FPGAMGRREGS_STAT_MODE_MASK		0x7
 #define FPGAMGRREGS_STAT_MSEL_MASK		0xf8
 #define FPGAMGRREGS_STAT_MSEL_LSB		3
diff --git a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
index ae728a5..55707ab 100644
--- a/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
+++ b/arch/arm/mach-socfpga/include/mach/mailbox_s10.h
@@ -8,6 +8,7 @@
 #define _MAILBOX_S10_H_
 
 /* user define Uboot ID */
+#include <linux/bitops.h>
 #define MBOX_CLIENT_ID_UBOOT	0xB
 #define MBOX_ID_UBOOT		0x1
 
diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
index 22e4eb3..19507c2 100644
--- a/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h
@@ -7,6 +7,7 @@
 #define _RESET_MANAGER_ARRIA10_H_
 
 #include <dt-bindings/reset/altr,rst-mgr-a10.h>
+#include <linux/bitops.h>
 
 void socfpga_watchdog_disable(void);
 void socfpga_reset_deassert_noc_ddr_scheduler(void);
diff --git a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
index 25b82fb..ff05994 100644
--- a/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
+++ b/arch/arm/mach-socfpga/include/mach/sdram_arria10.h
@@ -7,6 +7,7 @@
 #define _SOCFPGA_SDRAM_ARRIA10_H_
 
 #ifndef __ASSEMBLY__
+#include <linux/bitops.h>
 int ddr_calibration_sequence(void);
 
 struct socfpga_ecc_hmc {
@@ -205,7 +206,7 @@
 	u32 niosreserve2;
 };
 
-#endif /*__ASSEMBLY__*/
+#endif /*__ASSEMBLY__ */
 
 #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_MASK		0x1F000000
 #define IO48_MMR_CTRLCFG0_DB2_BURST_LENGTH_SHIFT	24
diff --git a/arch/arm/mach-socfpga/include/mach/system_manager.h b/arch/arm/mach-socfpga/include/mach/system_manager.h
index 6de0a08..f816954 100644
--- a/arch/arm/mach-socfpga/include/mach/system_manager.h
+++ b/arch/arm/mach-socfpga/include/mach/system_manager.h
@@ -94,5 +94,6 @@
 
 #define SYSMGR_GET_BOOTINFO_BSEL(bsel)		\
 		(((bsel) >> SYSMGR_BOOTINFO_BSEL_SHIFT) & 7)
+#include <linux/bitops.h>
 #endif
 #endif /* _SYSTEM_MANAGER_H_ */
diff --git a/arch/arm/mach-socfpga/include/mach/system_manager_soc64.h b/arch/arm/mach-socfpga/include/mach/system_manager_soc64.h
index 3a6c951..c90f63a 100644
--- a/arch/arm/mach-socfpga/include/mach/system_manager_soc64.h
+++ b/arch/arm/mach-socfpga/include/mach/system_manager_soc64.h
@@ -6,6 +6,7 @@
 #ifndef _SYSTEM_MANAGER_SOC64_H_
 #define _SYSTEM_MANAGER_SOC64_H_
 
+#include <linux/bitops.h>
 void sysmgr_pinmux_init(void);
 void populate_sysmgr_fpgaintf_module(void);
 void populate_sysmgr_pinmux(void);
diff --git a/arch/arm/mach-socfpga/misc.c b/arch/arm/mach-socfpga/misc.c
index 2901b7d..ac2b891 100644
--- a/arch/arm/mach-socfpga/misc.c
+++ b/arch/arm/mach-socfpga/misc.c
@@ -4,8 +4,11 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <asm/cache.h>
+#include <init.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <fdtdec.h>
@@ -176,7 +179,8 @@
 }
 
 #ifndef CONFIG_SPL_BUILD
-static int do_bridge(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_bridge(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	unsigned int mask = ~0;
 
diff --git a/arch/arm/mach-socfpga/misc_arria10.c b/arch/arm/mach-socfpga/misc_arria10.c
index d56349b..bf97805 100644
--- a/arch/arm/mach-socfpga/misc_arria10.c
+++ b/arch/arm/mach-socfpga/misc_arria10.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <ns16550.h>
diff --git a/arch/arm/mach-socfpga/misc_gen5.c b/arch/arm/mach-socfpga/misc_gen5.c
index 21eb934..7209e8d 100644
--- a/arch/arm/mach-socfpga/misc_gen5.c
+++ b/arch/arm/mach-socfpga/misc_gen5.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/io.h>
 #include <env.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
 #include <linux/libfdt.h>
 #include <altera.h>
 #include <miiphy.h>
diff --git a/arch/arm/mach-socfpga/misc_s10.c b/arch/arm/mach-socfpga/misc_s10.c
index a3f5b43..ccff78a 100644
--- a/arch/arm/mach-socfpga/misc_s10.c
+++ b/arch/arm/mach-socfpga/misc_s10.c
@@ -9,6 +9,8 @@
 #include <env.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <log.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-socfpga/pinmux_arria10.c b/arch/arm/mach-socfpga/pinmux_arria10.c
index 163bf27..f378fce 100644
--- a/arch/arm/mach-socfpga/pinmux_arria10.c
+++ b/arch/arm/mach-socfpga/pinmux_arria10.c
@@ -3,6 +3,7 @@
  *  Copyright (C) 2016-2017 Intel Corporation <www.intel.com>
  */
 
+#include <log.h>
 #include <asm/arch/pinmux.h>
 #include <asm/io.h>
 #include <common.h>
diff --git a/arch/arm/mach-socfpga/reset_manager_gen5.c b/arch/arm/mach-socfpga/reset_manager_gen5.c
index 1008a78..a65860e 100644
--- a/arch/arm/mach-socfpga/reset_manager_gen5.c
+++ b/arch/arm/mach-socfpga/reset_manager_gen5.c
@@ -9,6 +9,7 @@
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/arch/system_manager.h>
+#include <linux/bitops.h>
 
 /* Assert or de-assert SoCFPGA reset manager reset. */
 void socfpga_per_reset(u32 reset, int set)
diff --git a/arch/arm/mach-socfpga/scan_manager.c b/arch/arm/mach-socfpga/scan_manager.c
index f7ee289..36d6880 100644
--- a/arch/arm/mach-socfpga/scan_manager.c
+++ b/arch/arm/mach-socfpga/scan_manager.c
@@ -9,6 +9,7 @@
 #include <asm/arch/freeze_controller.h>
 #include <asm/arch/scan_manager.h>
 #include <asm/arch/system_manager.h>
+#include <linux/delay.h>
 
 /*
  * Maximum polling loop to wait for IO scan chain engine becomes idle
diff --git a/arch/arm/mach-socfpga/spl_a10.c b/arch/arm/mach-socfpga/spl_a10.c
index d2f52f2..45aea4a 100644
--- a/arch/arm/mach-socfpga/spl_a10.c
+++ b/arch/arm/mach-socfpga/spl_a10.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/pl310.h>
 #include <asm/u-boot.h>
diff --git a/arch/arm/mach-socfpga/spl_agilex.c b/arch/arm/mach-socfpga/spl_agilex.c
index aa9f3e6..bd971ec 100644
--- a/arch/arm/mach-socfpga/spl_agilex.c
+++ b/arch/arm/mach-socfpga/spl_agilex.c
@@ -4,6 +4,8 @@
  *
  */
 
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/u-boot.h>
 #include <asm/utils.h>
diff --git a/arch/arm/mach-socfpga/spl_gen5.c b/arch/arm/mach-socfpga/spl_gen5.c
index e9967ac..5a7c5ef 100644
--- a/arch/arm/mach-socfpga/spl_gen5.c
+++ b/arch/arm/mach-socfpga/spl_gen5.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/u-boot.h>
 #include <asm/utils.h>
@@ -22,6 +24,7 @@
 #include <fdtdec.h>
 #include <watchdog.h>
 #include <dm/uclass.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c
index 08427dd..b3c6f6a 100644
--- a/arch/arm/mach-socfpga/spl_s10.c
+++ b/arch/arm/mach-socfpga/spl_s10.c
@@ -5,6 +5,8 @@
  */
 
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/u-boot.h>
 #include <asm/utils.h>
diff --git a/arch/arm/mach-socfpga/timer.c b/arch/arm/mach-socfpga/timer.c
index f1c0262..a58f1cf 100644
--- a/arch/arm/mach-socfpga/timer.c
+++ b/arch/arm/mach-socfpga/timer.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/timer.h>
 
diff --git a/arch/arm/mach-socfpga/timer_s10.c b/arch/arm/mach-socfpga/timer_s10.c
index 5723789..3ad98bd 100644
--- a/arch/arm/mach-socfpga/timer_s10.c
+++ b/arch/arm/mach-socfpga/timer_s10.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/timer.h>
 
diff --git a/arch/arm/mach-stm32/soc.c b/arch/arm/mach-stm32/soc.c
index 41338a1..1f12da4 100644
--- a/arch/arm/mach-stm32/soc.c
+++ b/arch/arm/mach-stm32/soc.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/armv7_mpu.h>
 
diff --git a/arch/arm/mach-stm32mp/boot_params.c b/arch/arm/mach-stm32mp/boot_params.c
index e4351de..37ee9e1 100644
--- a/arch/arm/mach-stm32mp/boot_params.c
+++ b/arch/arm/mach-stm32mp/boot_params.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/sections.h>
 #include <asm/system.h>
 
diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c
index 0d5850b..fc39230 100644
--- a/arch/arm/mach-stm32mp/bsec.c
+++ b/arch/arm/mach-stm32mp/bsec.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <misc.h>
 #include <asm/io.h>
 #include <asm/arch/stm32mp1_smc.h>
diff --git a/arch/arm/mach-stm32mp/cmd_stm32key.c b/arch/arm/mach-stm32mp/cmd_stm32key.c
index f1f26e7..f191085 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32key.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32key.c
@@ -66,8 +66,8 @@
 	return 0;
 }
 
-static int do_stm32key(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_stm32key(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	u32 addr;
 	const char *op = argc >= 2 ? argv[1] : NULL;
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
index 6bebea7..0722e4a 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
@@ -38,7 +38,7 @@
 #endif
 }
 
-static int do_stm32prog(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
 			char * const argv[])
 {
 	ulong	addr, size;
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
index cc30321..c5b8841 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog.c
@@ -3,7 +3,7 @@
  * Copyright (C) 2020, STMicroelectronics - All Rights Reserved
  */
 
-#include <common.h>
+#include <command.h>
 #include <console.h>
 #include <dfu.h>
 #include <malloc.h>
@@ -727,7 +727,7 @@
 				pr_debug("\n");
 				continue;
 			}
-			disk_partition_t partinfo;
+			struct disk_partition partinfo;
 
 			ret = part_get_info(block_dev, part->part_id,
 					    &partinfo);
diff --git a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
index 5a16979..70940f0 100644
--- a/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
+++ b/arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_serial.c
@@ -11,6 +11,7 @@
 #include <watchdog.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
+#include <linux/delay.h>
 #include "stm32prog.h"
 
 /* - configuration part -----------------------------*/
diff --git a/arch/arm/mach-stm32mp/cpu.c b/arch/arm/mach-stm32mp/cpu.c
index 5a10808..472b140 100644
--- a/arch/arm/mach-stm32mp/cpu.c
+++ b/arch/arm/mach-stm32mp/cpu.c
@@ -7,12 +7,16 @@
 #include <cpu_func.h>
 #include <debug_uart.h>
 #include <env.h>
+#include <init.h>
+#include <log.h>
 #include <misc.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
 #include <asm/arch/sys_proto.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
+#include <linux/bitops.h>
 
 /* RCC register */
 #define RCC_TZCR		(STM32_RCC_BASE + 0x00)
diff --git a/arch/arm/mach-stm32mp/dram_init.c b/arch/arm/mach-stm32mp/dram_init.c
index 3233415..0e8ce63 100644
--- a/arch/arm/mach-stm32mp/dram_init.c
+++ b/arch/arm/mach-stm32mp/dram_init.c
@@ -5,7 +5,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <image.h>
+#include <init.h>
 #include <lmb.h>
+#include <log.h>
 #include <ram.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-stm32mp/fdt.c b/arch/arm/mach-stm32mp/fdt.c
index 21b5f09..c723b22 100644
--- a/arch/arm/mach-stm32mp/fdt.c
+++ b/arch/arm/mach-stm32mp/fdt.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <tee.h>
 #include <asm/arch/sys_proto.h>
 #include <dt-bindings/pinctrl/stm32-pinfunc.h>
diff --git a/arch/arm/mach-stm32mp/include/mach/stm32.h b/arch/arm/mach-stm32mp/include/mach/stm32.h
index 242bacc..5fdb893 100644
--- a/arch/arm/mach-stm32mp/include/mach/stm32.h
+++ b/arch/arm/mach-stm32mp/include/mach/stm32.h
@@ -6,6 +6,10 @@
 #ifndef _MACH_STM32_H_
 #define _MACH_STM32_H_
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /*
  * Peripheral memory map
  * only address used before device tree parsing
@@ -133,5 +137,5 @@
 #define BSEC_OTP_MAC	57
 #define BSEC_OTP_BOARD	59
 
-#endif /* __ASSEMBLY__*/
+#endif /* __ASSEMBLY__ */
 #endif /* _MACH_STM32_H_ */
diff --git a/arch/arm/mach-stm32mp/psci.c b/arch/arm/mach-stm32mp/psci.c
index 3fb038d..155aa79 100644
--- a/arch/arm/mach-stm32mp/psci.c
+++ b/arch/arm/mach-stm32mp/psci.c
@@ -6,10 +6,12 @@
 #include <config.h>
 #include <common.h>
 #include <asm/armv7.h>
+#include <asm/cache.h>
 #include <asm/gic.h>
 #include <asm/io.h>
 #include <asm/psci.h>
 #include <asm/secure.h>
+#include <linux/bitops.h>
 
 #define BOOT_API_A7_CORE0_MAGIC_NUMBER	0xCA7FACE0
 #define BOOT_API_A7_CORE1_MAGIC_NUMBER	0xCA7FACE1
diff --git a/arch/arm/mach-stm32mp/pwr_regulator.c b/arch/arm/mach-stm32mp/pwr_regulator.c
index b52e1e8..900dee4 100644
--- a/arch/arm/mach-stm32mp/pwr_regulator.c
+++ b/arch/arm/mach-stm32mp/pwr_regulator.c
@@ -9,6 +9,7 @@
 #include <syscon.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/arch/arm/mach-stm32mp/spl.c b/arch/arm/mach-stm32mp/spl.c
index b7e7e92..39413e9 100644
--- a/arch/arm/mach-stm32mp/spl.c
+++ b/arch/arm/mach-stm32mp/spl.c
@@ -7,7 +7,10 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include <linux/libfdt.h>
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c
index b487b26..f40fccd 100644
--- a/arch/arm/mach-sunxi/board.c
+++ b/arch/arm/mach-sunxi/board.c
@@ -11,10 +11,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <log.h>
 #include <mmc.h>
 #include <i2c.h>
 #include <serial.h>
 #include <spl.h>
+#include <asm/cache.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/arch/arm/mach-sunxi/clock_sun6i.c b/arch/arm/mach-sunxi/clock_sun6i.c
index 6ca38f7..8e84062 100644
--- a/arch/arm/mach-sunxi/clock_sun6i.c
+++ b/arch/arm/mach-sunxi/clock_sun6i.c
@@ -14,6 +14,8 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/prcm.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_SPL_BUILD
 void clock_init_safe(void)
diff --git a/arch/arm/mach-sunxi/clock_sun8i_a83t.c b/arch/arm/mach-sunxi/clock_sun8i_a83t.c
index a55a616..31e4281 100644
--- a/arch/arm/mach-sunxi/clock_sun8i_a83t.c
+++ b/arch/arm/mach-sunxi/clock_sun8i_a83t.c
@@ -14,6 +14,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/prcm.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_SPL_BUILD
 void clock_init_safe(void)
diff --git a/arch/arm/mach-sunxi/cpu_info.c b/arch/arm/mach-sunxi/cpu_info.c
index ae4745b..875e5a1 100644
--- a/arch/arm/mach-sunxi/cpu_info.c
+++ b/arch/arm/mach-sunxi/cpu_info.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clock.h>
diff --git a/arch/arm/mach-sunxi/dram_sun4i.c b/arch/arm/mach-sunxi/dram_sun4i.c
index 72de807..76d6982 100644
--- a/arch/arm/mach-sunxi/dram_sun4i.c
+++ b/arch/arm/mach-sunxi/dram_sun4i.c
@@ -27,6 +27,7 @@
 #include <asm/arch/dram.h>
 #include <asm/arch/timer.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 
 #define CPU_CFG_CHIP_VER(n) ((n) << 6)
 #define CPU_CFG_CHIP_VER_MASK CPU_CFG_CHIP_VER(0x3)
diff --git a/arch/arm/mach-sunxi/dram_sun50i_h6.c b/arch/arm/mach-sunxi/dram_sun50i_h6.c
index 9375db7..9e34da4 100644
--- a/arch/arm/mach-sunxi/dram_sun50i_h6.c
+++ b/arch/arm/mach-sunxi/dram_sun50i_h6.c
@@ -1,16 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * sun50i H6 platform dram controller init
  *
  * (C) Copyright 2017      Icenowy Zheng <icenowy@aosc.io>
  *
- * SPDX-License-Identifier:	GPL-2.0+
  */
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/cpu.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/kconfig.h>
 
 /*
diff --git a/arch/arm/mach-sunxi/dram_sun6i.c b/arch/arm/mach-sunxi/dram_sun6i.c
index f473230..0590110 100644
--- a/arch/arm/mach-sunxi/dram_sun6i.c
+++ b/arch/arm/mach-sunxi/dram_sun6i.c
@@ -11,10 +11,12 @@
  */
 #include <common.h>
 #include <errno.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/prcm.h>
+#include <linux/delay.h>
 
 #define DRAM_CLK (CONFIG_DRAM_CLK * 1000000)
 
diff --git a/arch/arm/mach-sunxi/dram_sun8i_a23.c b/arch/arm/mach-sunxi/dram_sun8i_a23.c
index 9f00fef..3ed97b5 100644
--- a/arch/arm/mach-sunxi/dram_sun8i_a23.c
+++ b/arch/arm/mach-sunxi/dram_sun8i_a23.c
@@ -21,10 +21,12 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/prcm.h>
+#include <linux/delay.h>
 
 static const struct dram_para dram_para = {
 	.clock = CONFIG_DRAM_CLK,
diff --git a/arch/arm/mach-sunxi/dram_sun8i_a33.c b/arch/arm/mach-sunxi/dram_sun8i_a33.c
index 5da0192..d99a38b 100644
--- a/arch/arm/mach-sunxi/dram_sun8i_a33.c
+++ b/arch/arm/mach-sunxi/dram_sun8i_a33.c
@@ -9,10 +9,12 @@
  */
 #include <common.h>
 #include <errno.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/prcm.h>
+#include <linux/delay.h>
 
 /* PLL runs at 2x dram-clk, controller runs at PLL / 4 (dram-clk / 2) */
 #define DRAM_CLK_MUL 2
diff --git a/arch/arm/mach-sunxi/dram_sun8i_a83t.c b/arch/arm/mach-sunxi/dram_sun8i_a83t.c
index 2c43b3c..a3f833d 100644
--- a/arch/arm/mach-sunxi/dram_sun8i_a83t.c
+++ b/arch/arm/mach-sunxi/dram_sun8i_a83t.c
@@ -9,10 +9,12 @@
  */
 #include <common.h>
 #include <errno.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/prcm.h>
+#include <linux/delay.h>
 
 #define DRAM_CLK_MUL 2
 #define DRAM_CLK_DIV 1
diff --git a/arch/arm/mach-sunxi/dram_sun9i.c b/arch/arm/mach-sunxi/dram_sun9i.c
index 77cc606..14be212 100644
--- a/arch/arm/mach-sunxi/dram_sun9i.c
+++ b/arch/arm/mach-sunxi/dram_sun9i.c
@@ -13,6 +13,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/arch/arm/mach-sunxi/dram_sunxi_dw.c b/arch/arm/mach-sunxi/dram_sunxi_dw.c
index 85e7a18..5d84798 100644
--- a/arch/arm/mach-sunxi/dram_sunxi_dw.c
+++ b/arch/arm/mach-sunxi/dram_sunxi_dw.c
@@ -9,10 +9,13 @@
  * (C) Copyright 2015      Jens Kuske <jenskuske@gmail.com>
  */
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/cpu.h>
+#include <linux/delay.h>
 #include <linux/kconfig.h>
 
 static void mctl_phy_init(u32 val)
diff --git a/arch/arm/mach-sunxi/spl_spi_sunxi.c b/arch/arm/mach-sunxi/spl_spi_sunxi.c
index a3997b2..15e86cb 100644
--- a/arch/arm/mach-sunxi/spl_spi_sunxi.c
+++ b/arch/arm/mach-sunxi/spl_spi_sunxi.c
@@ -4,9 +4,13 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 
 #ifdef CONFIG_SPL_OS_BOOT
diff --git a/arch/arm/mach-tegra/ap.c b/arch/arm/mach-tegra/ap.c
index 84c20a4..532730f 100644
--- a/arch/arm/mach-tegra/ap.c
+++ b/arch/arm/mach-tegra/ap.c
@@ -7,6 +7,7 @@
 /* Tegra AP (Application Processor) code */
 
 #include <common.h>
+#include <log.h>
 #include <linux/bug.h>
 #include <asm/io.h>
 #include <asm/arch/gp_padctrl.h>
diff --git a/arch/arm/mach-tegra/board.c b/arch/arm/mach-tegra/board.c
index 31c49a7..03faacb 100644
--- a/arch/arm/mach-tegra/board.c
+++ b/arch/arm/mach-tegra/board.c
@@ -8,8 +8,10 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <ns16550.h>
 #include <spl.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #if IS_ENABLED(CONFIG_TEGRA_CLKRST)
 #include <asm/arch/clock.h>
diff --git a/arch/arm/mach-tegra/board2.c b/arch/arm/mach-tegra/board2.c
index 224efc9..48c4f32 100644
--- a/arch/arm/mach-tegra/board2.c
+++ b/arch/arm/mach-tegra/board2.c
@@ -9,6 +9,7 @@
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 #include <ns16550.h>
 #include <usb.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c
index 3902294..16c4cf3 100644
--- a/arch/arm/mach-tegra/cboot.c
+++ b/arch/arm/mach-tegra/cboot.c
@@ -8,7 +8,10 @@
 #include <fdt_support.h>
 #include <fdtdec.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
+#include <net.h>
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/arch/arm/mach-tegra/clock.c b/arch/arm/mach-tegra/clock.c
index 31b6aa2..18c19db 100644
--- a/arch/arm/mach-tegra/clock.c
+++ b/arch/arm/mach-tegra/clock.c
@@ -9,6 +9,7 @@
 #include <div64.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
@@ -17,6 +18,7 @@
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/timer.h>
+#include <linux/delay.h>
 
 /*
  * This is our record of the current clock rate of each clock. We don't
diff --git a/arch/arm/mach-tegra/cmd_enterrcm.c b/arch/arm/mach-tegra/cmd_enterrcm.c
index b2252f3..25df31a 100644
--- a/arch/arm/mach-tegra/cmd_enterrcm.c
+++ b/arch/arm/mach-tegra/cmd_enterrcm.c
@@ -25,13 +25,15 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <irq_func.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch-tegra/pmc.h>
+#include <linux/delay.h>
 
-static int do_enterrcm(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_enterrcm(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	puts("Entering RCM...\n");
 	udelay(50000);
diff --git a/arch/arm/mach-tegra/cpu.c b/arch/arm/mach-tegra/cpu.c
index 3d14076..65b15b7 100644
--- a/arch/arm/mach-tegra/cpu.c
+++ b/arch/arm/mach-tegra/cpu.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/gp_padctrl.h>
@@ -12,6 +13,7 @@
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/scu.h>
+#include <linux/delay.h>
 #include "cpu.h"
 
 int get_num_cpus(void)
diff --git a/arch/arm/mach-tegra/gpu.c b/arch/arm/mach-tegra/gpu.c
index e047f67..13ffade 100644
--- a/arch/arm/mach-tegra/gpu.c
+++ b/arch/arm/mach-tegra/gpu.c
@@ -6,6 +6,7 @@
 /* Tegra vpr routines */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch/mc.h>
diff --git a/arch/arm/mach-tegra/ivc.c b/arch/arm/mach-tegra/ivc.c
index a448f2d..e7c6d78 100644
--- a/arch/arm/mach-tegra/ivc.c
+++ b/arch/arm/mach-tegra/ivc.c
@@ -7,6 +7,7 @@
 #include <cpu_func.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/ivc.h>
+#include <linux/bug.h>
 
 #define TEGRA_IVC_ALIGN 64
 
diff --git a/arch/arm/mach-tegra/pinmux-common.c b/arch/arm/mach-tegra/pinmux-common.c
index 1771991..16b03bf 100644
--- a/arch/arm/mach-tegra/pinmux-common.c
+++ b/arch/arm/mach-tegra/pinmux-common.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/pinmux.h>
 
diff --git a/arch/arm/mach-tegra/pmc.c b/arch/arm/mach-tegra/pmc.c
index 68a2112..cdc8493 100644
--- a/arch/arm/mach-tegra/pmc.c
+++ b/arch/arm/mach-tegra/pmc.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 
 #include <linux/arm-smccc.h>
 
diff --git a/arch/arm/mach-tegra/powergate.c b/arch/arm/mach-tegra/powergate.c
index 761c9ef..631bc04e 100644
--- a/arch/arm/mach-tegra/powergate.c
+++ b/arch/arm/mach-tegra/powergate.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/types.h>
diff --git a/arch/arm/mach-tegra/spl.c b/arch/arm/mach-tegra/spl.c
index 13ddbc3..ed897ef 100644
--- a/arch/arm/mach-tegra/spl.c
+++ b/arch/arm/mach-tegra/spl.c
@@ -7,6 +7,7 @@
  */
 #include <common.h>
 #include <debug_uart.h>
+#include <log.h>
 #include <spl.h>
 
 #include <asm/io.h>
diff --git a/arch/arm/mach-tegra/sys_info.c b/arch/arm/mach-tegra/sys_info.c
index 5dc998a..5ad586a 100644
--- a/arch/arm/mach-tegra/sys_info.c
+++ b/arch/arm/mach-tegra/sys_info.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <linux/ctype.h>
 #if defined(CONFIG_TEGRA124) || defined(CONFIG_TEGRA30)
 #include <asm/arch-tegra/pmc.h>
diff --git a/arch/arm/mach-tegra/tegra114/clock.c b/arch/arm/mach-tegra/tegra114/clock.c
index ad09cc5..167589d 100644
--- a/arch/arm/mach-tegra/tegra114/clock.c
+++ b/arch/arm/mach-tegra/tegra114/clock.c
@@ -7,6 +7,8 @@
 /* Tegra114 Clock control functions */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sysctr.h>
@@ -15,6 +17,7 @@
 #include <asm/arch-tegra/timer.h>
 #include <div64.h>
 #include <fdtdec.h>
+#include <linux/delay.h>
 
 /*
  * Clock types that we can use as a source. The Tegra114 has muxes for the
diff --git a/arch/arm/mach-tegra/tegra114/cpu.c b/arch/arm/mach-tegra/tegra114/cpu.c
index 09b52f5..62c1053 100644
--- a/arch/arm/mach-tegra/tegra114/cpu.c
+++ b/arch/arm/mach-tegra/tegra114/cpu.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/flow.h>
@@ -12,6 +13,7 @@
 #include <asm/arch/tegra.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
+#include <linux/delay.h>
 #include "../cpu.h"
 
 /* Tegra114-specific CPU init code */
diff --git a/arch/arm/mach-tegra/tegra114/funcmux.c b/arch/arm/mach-tegra/tegra114/funcmux.c
index 8fe5e9e..23a27c8 100644
--- a/arch/arm/mach-tegra/tegra114/funcmux.c
+++ b/arch/arm/mach-tegra/tegra114/funcmux.c
@@ -6,6 +6,7 @@
 /* Tegra114 high-level function multiplexing */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
diff --git a/arch/arm/mach-tegra/tegra124/clock.c b/arch/arm/mach-tegra/tegra124/clock.c
index 70916ea..79e67f5 100644
--- a/arch/arm/mach-tegra/tegra124/clock.c
+++ b/arch/arm/mach-tegra/tegra124/clock.c
@@ -7,6 +7,8 @@
 /* Tegra124 Clock control functions */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sysctr.h>
@@ -15,6 +17,7 @@
 #include <asm/arch-tegra/timer.h>
 #include <div64.h>
 #include <fdtdec.h>
+#include <linux/delay.h>
 
 /*
  * Clock types that we can use as a source. The Tegra124 has muxes for the
diff --git a/arch/arm/mach-tegra/tegra124/cpu.c b/arch/arm/mach-tegra/tegra124/cpu.c
index abc050c..d5f2683 100644
--- a/arch/arm/mach-tegra/tegra124/cpu.c
+++ b/arch/arm/mach-tegra/tegra124/cpu.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/ahb.h>
 #include <asm/arch/clock.h>
@@ -14,6 +15,7 @@
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/ap.h>
+#include <linux/delay.h>
 #include "../cpu.h"
 
 /* Tegra124-specific CPU init code */
diff --git a/arch/arm/mach-tegra/tegra124/funcmux.c b/arch/arm/mach-tegra/tegra124/funcmux.c
index a8fcac6..e7ad85f 100644
--- a/arch/arm/mach-tegra/tegra124/funcmux.c
+++ b/arch/arm/mach-tegra/tegra124/funcmux.c
@@ -7,6 +7,7 @@
 /* Tegra124 high-level function multiplexing */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
diff --git a/arch/arm/mach-tegra/tegra124/xusb-padctl.c b/arch/arm/mach-tegra/tegra124/xusb-padctl.c
index 09ab8c7..38afc3c 100644
--- a/arch/arm/mach-tegra/tegra124/xusb-padctl.c
+++ b/arch/arm/mach-tegra/tegra124/xusb-padctl.c
@@ -7,8 +7,10 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <dm/of_access.h>
 #include <dm/ofnode.h>
+#include <linux/delay.h>
 
 #include "../xusb-padctl-common.h"
 
diff --git a/arch/arm/mach-tegra/tegra20/clock.c b/arch/arm/mach-tegra/tegra20/clock.c
index 8f1bb4f..24e8a13 100644
--- a/arch/arm/mach-tegra/tegra20/clock.c
+++ b/arch/arm/mach-tegra/tegra20/clock.c
@@ -9,6 +9,8 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/tegra.h>
@@ -16,6 +18,7 @@
 #include <asm/arch-tegra/timer.h>
 #include <div64.h>
 #include <fdtdec.h>
+#include <linux/delay.h>
 
 /*
  * Clock types that we can use as a source. The Tegra20 has muxes for the
diff --git a/arch/arm/mach-tegra/tegra20/cpu.c b/arch/arm/mach-tegra/tegra20/cpu.c
index 2d14ac9..e5b6059 100644
--- a/arch/arm/mach-tegra/tegra20/cpu.c
+++ b/arch/arm/mach-tegra/tegra20/cpu.c
@@ -7,6 +7,7 @@
 #include <asm/io.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch-tegra/pmc.h>
+#include <linux/delay.h>
 #include "../cpu.h"
 
 static void enable_cpu_power_rail(void)
diff --git a/arch/arm/mach-tegra/tegra20/crypto.c b/arch/arm/mach-tegra/tegra20/crypto.c
index b91191e..1efaa5c 100644
--- a/arch/arm/mach-tegra/tegra20/crypto.c
+++ b/arch/arm/mach-tegra/tegra20/crypto.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/errno.h>
 #include "crypto.h"
 #include "uboot_aes.h"
diff --git a/arch/arm/mach-tegra/tegra20/emc.c b/arch/arm/mach-tegra/tegra20/emc.c
index dff9ac0..d55b09b 100644
--- a/arch/arm/mach-tegra/tegra20/emc.c
+++ b/arch/arm/mach-tegra/tegra20/emc.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/ap.h>
 #include <asm/arch-tegra/apb_misc.h>
diff --git a/arch/arm/mach-tegra/tegra20/funcmux.c b/arch/arm/mach-tegra/tegra20/funcmux.c
index 2ee0f6e..90fe0cb 100644
--- a/arch/arm/mach-tegra/tegra20/funcmux.c
+++ b/arch/arm/mach-tegra/tegra20/funcmux.c
@@ -5,6 +5,7 @@
 
 /* Tegra20 high-level function multiplexing */
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
diff --git a/arch/arm/mach-tegra/tegra20/pmu.c b/arch/arm/mach-tegra/tegra20/pmu.c
index d63db8a..05d0668 100644
--- a/arch/arm/mach-tegra/tegra20/pmu.c
+++ b/arch/arm/mach-tegra/tegra20/pmu.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <tps6586x.h>
 #include <asm/io.h>
 #include <asm/arch/tegra.h>
diff --git a/arch/arm/mach-tegra/tegra210/clock.c b/arch/arm/mach-tegra/tegra210/clock.c
index 00c65c2..ccc64eb 100644
--- a/arch/arm/mach-tegra/tegra210/clock.c
+++ b/arch/arm/mach-tegra/tegra210/clock.c
@@ -8,6 +8,9 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sysctr.h>
@@ -16,6 +19,8 @@
 #include <asm/arch-tegra/timer.h>
 #include <div64.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /*
  * Clock types that we can use as a source. The Tegra210 has muxes for the
diff --git a/arch/arm/mach-tegra/tegra210/funcmux.c b/arch/arm/mach-tegra/tegra210/funcmux.c
index 7f00d7b..30d994a 100644
--- a/arch/arm/mach-tegra/tegra210/funcmux.c
+++ b/arch/arm/mach-tegra/tegra210/funcmux.c
@@ -7,6 +7,7 @@
 /* Tegra210 high-level function multiplexing */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
diff --git a/arch/arm/mach-tegra/tegra210/xusb-padctl.c b/arch/arm/mach-tegra/tegra210/xusb-padctl.c
index 64dc297..d160ce4 100644
--- a/arch/arm/mach-tegra/tegra210/xusb-padctl.c
+++ b/arch/arm/mach-tegra/tegra210/xusb-padctl.c
@@ -7,8 +7,10 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <dm/of_access.h>
 #include <dm/ofnode.h>
+#include <linux/delay.h>
 
 #include "../xusb-padctl-common.h"
 
diff --git a/arch/arm/mach-tegra/tegra30/clock.c b/arch/arm/mach-tegra/tegra30/clock.c
index dd1193b..b0641c6 100644
--- a/arch/arm/mach-tegra/tegra30/clock.c
+++ b/arch/arm/mach-tegra/tegra30/clock.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/tegra.h>
@@ -15,6 +17,7 @@
 #include <asm/arch-tegra/timer.h>
 #include <div64.h>
 #include <fdtdec.h>
+#include <linux/delay.h>
 
 /*
  * Clock types that we can use as a source. The Tegra30 has muxes for the
diff --git a/arch/arm/mach-tegra/tegra30/cpu.c b/arch/arm/mach-tegra/tegra30/cpu.c
index 45a5c09..651edd2 100644
--- a/arch/arm/mach-tegra/tegra30/cpu.c
+++ b/arch/arm/mach-tegra/tegra30/cpu.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/flow.h>
@@ -11,6 +12,7 @@
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
 #include <asm/arch-tegra/tegra_i2c.h>
+#include <linux/delay.h>
 #include "../cpu.h"
 
 /* Tegra30-specific CPU init code */
diff --git a/arch/arm/mach-tegra/tegra30/funcmux.c b/arch/arm/mach-tegra/tegra30/funcmux.c
index b3de980..c3ee787 100644
--- a/arch/arm/mach-tegra/tegra30/funcmux.c
+++ b/arch/arm/mach-tegra/tegra30/funcmux.c
@@ -6,6 +6,7 @@
 /* Tegra30 high-level function multiplexing */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
diff --git a/arch/arm/mach-tegra/xusb-padctl-common.c b/arch/arm/mach-tegra/xusb-padctl-common.c
index c3fb30e..e56e27c 100644
--- a/arch/arm/mach-tegra/xusb-padctl-common.c
+++ b/arch/arm/mach-tegra/xusb-padctl-common.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 
 #include "xusb-padctl-common.h"
 
diff --git a/arch/arm/mach-u8500/cache.c b/arch/arm/mach-u8500/cache.c
index 3d96d09..f9fd4fe 100644
--- a/arch/arm/mach-u8500/cache.c
+++ b/arch/arm/mach-u8500/cache.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <asm/armv7.h>
+#include <asm/cache.h>
 #include <asm/pl310.h>
 
 #define PL310_WAY_MASK	0xff
diff --git a/arch/arm/mach-u8500/cpuinfo.c b/arch/arm/mach-u8500/cpuinfo.c
index 20f5ff3..ab05b8a 100644
--- a/arch/arm/mach-u8500/cpuinfo.c
+++ b/arch/arm/mach-u8500/cpuinfo.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 
 #define U8500_BOOTROM_BASE	0x90000000
diff --git a/arch/arm/mach-uniphier/arm32/psci.c b/arch/arm/mach-uniphier/arm32/psci.c
index 9a37933..e231e7b 100644
--- a/arch/arm/mach-uniphier/arm32/psci.c
+++ b/arch/arm/mach-uniphier/arm32/psci.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/io.h>
diff --git a/arch/arm/mach-uniphier/arm32/timer.c b/arch/arm/mach-uniphier/arm32/timer.c
index 899b539..b3c907b 100644
--- a/arch/arm/mach-uniphier/arm32/timer.c
+++ b/arch/arm/mach-uniphier/arm32/timer.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <linux/io.h>
 
 #include "arm-mpcore.h"
diff --git a/arch/arm/mach-uniphier/board_init.c b/arch/arm/mach-uniphier/board_init.c
index 4f9cd6e..6bf0811 100644
--- a/arch/arm/mach-uniphier/board_init.c
+++ b/arch/arm/mach-uniphier/board_init.c
@@ -5,6 +5,7 @@
  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  */
 
+#include <log.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 #include <linux/printk.h>
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c b/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c
index 2edf66d..4aee50f 100644
--- a/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c
+++ b/arch/arm/mach-uniphier/boot-device/boot-device-pxs3.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <spl.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
 
diff --git a/arch/arm/mach-uniphier/boot-device/boot-device.c b/arch/arm/mach-uniphier/boot-device/boot-device.c
index 83f8c6a..2fb6255 100644
--- a/arch/arm/mach-uniphier/boot-device/boot-device.c
+++ b/arch/arm/mach-uniphier/boot-device/boot-device.c
@@ -5,8 +5,11 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <spl.h>
 #include <stdio.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/io.h>
 #include <linux/log2.h>
 
@@ -205,7 +208,8 @@
 
 #ifndef CONFIG_SPL_BUILD
 
-static int do_pinmon(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_pinmon(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	const struct uniphier_boot_device_info *info;
 	u32 pinmon;
diff --git a/arch/arm/mach-uniphier/clk/clk-ld11.c b/arch/arm/mach-uniphier/clk/clk-ld11.c
index 0917b33..94b9d90 100644
--- a/arch/arm/mach-uniphier/clk/clk-ld11.c
+++ b/arch/arm/mach-uniphier/clk/clk-ld11.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <spl.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 
 #include "../init.h"
diff --git a/arch/arm/mach-uniphier/clk/dpll-ld4.c b/arch/arm/mach-uniphier/clk/dpll-ld4.c
index 72fe8db..fd77aa7 100644
--- a/arch/arm/mach-uniphier/clk/dpll-ld4.c
+++ b/arch/arm/mach-uniphier/clk/dpll-ld4.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 
diff --git a/arch/arm/mach-uniphier/clk/dpll-pro4.c b/arch/arm/mach-uniphier/clk/dpll-pro4.c
index 6259495..c86881d 100644
--- a/arch/arm/mach-uniphier/clk/dpll-pro4.c
+++ b/arch/arm/mach-uniphier/clk/dpll-pro4.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 
diff --git a/arch/arm/mach-uniphier/cpu-info.c b/arch/arm/mach-uniphier/cpu-info.c
index 6a7b203..1ede507 100644
--- a/arch/arm/mach-uniphier/cpu-info.c
+++ b/arch/arm/mach-uniphier/cpu-info.c
@@ -5,6 +5,7 @@
  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  */
 
+#include <init.h>
 #include <stdio.h>
 #include <linux/errno.h>
 #include <linux/io.h>
diff --git a/arch/arm/mach-uniphier/dram/cmd_ddrmphy.c b/arch/arm/mach-uniphier/dram/cmd_ddrmphy.c
index 9a25bba..a6c0735 100644
--- a/arch/arm/mach-uniphier/dram/cmd_ddrmphy.c
+++ b/arch/arm/mach-uniphier/dram/cmd_ddrmphy.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <stdio.h>
 #include <linux/io.h>
 #include <linux/printk.h>
@@ -291,7 +292,8 @@
 	}
 }
 
-static int do_ddrm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ddrm(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	const struct uniphier_ddrmphy_param *param;
 	char *cmd;
diff --git a/arch/arm/mach-uniphier/dram/cmd_ddrphy.c b/arch/arm/mach-uniphier/dram/cmd_ddrphy.c
index a616a2a..476c5b3 100644
--- a/arch/arm/mach-uniphier/dram/cmd_ddrphy.c
+++ b/arch/arm/mach-uniphier/dram/cmd_ddrphy.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <stdio.h>
 #include <linux/io.h>
 #include <linux/printk.h>
@@ -261,7 +262,8 @@
 	}
 }
 
-static int do_ddr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ddr(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
 {
 	const struct uniphier_ddrphy_param *param;
 	char *cmd;
diff --git a/arch/arm/mach-uniphier/dram/ddrphy-regs.h b/arch/arm/mach-uniphier/dram/ddrphy-regs.h
index 6a041c5..8b34292 100644
--- a/arch/arm/mach-uniphier/dram/ddrphy-regs.h
+++ b/arch/arm/mach-uniphier/dram/ddrphy-regs.h
@@ -9,6 +9,7 @@
 #ifndef ARCH_DDRPHY_REGS_H
 #define ARCH_DDRPHY_REGS_H
 
+#include <linux/bitops.h>
 #define PHY_REG_SHIFT		2
 
 #define PHY_RIDR		(0x000 << PHY_REG_SHIFT)
diff --git a/arch/arm/mach-uniphier/dram/ddrphy-training.c b/arch/arm/mach-uniphier/dram/ddrphy-training.c
index 1decdf1..c26f563 100644
--- a/arch/arm/mach-uniphier/dram/ddrphy-training.c
+++ b/arch/arm/mach-uniphier/dram/ddrphy-training.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2015-2016 Socionext Inc.
  */
 
+#include <log.h>
 #include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
diff --git a/arch/arm/mach-uniphier/dram/umc-pxs2.c b/arch/arm/mach-uniphier/dram/umc-pxs2.c
index 5392ffa..3f7e5f3 100644
--- a/arch/arm/mach-uniphier/dram/umc-pxs2.c
+++ b/arch/arm/mach-uniphier/dram/umc-pxs2.c
@@ -7,6 +7,9 @@
  * Copyright (C) 2015 Socionext Inc.
  */
 
+#include <init.h>
+#include <log.h>
+#include <linux/bitops.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/io.h>
diff --git a/arch/arm/mach-uniphier/dram_init.c b/arch/arm/mach-uniphier/dram_init.c
index 5f9d90f..1127373 100644
--- a/arch/arm/mach-uniphier/dram_init.c
+++ b/arch/arm/mach-uniphier/dram_init.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
diff --git a/arch/arm/mach-uniphier/init.h b/arch/arm/mach-uniphier/init.h
index 3c77f48..6223037 100644
--- a/arch/arm/mach-uniphier/init.h
+++ b/arch/arm/mach-uniphier/init.h
@@ -7,6 +7,7 @@
 #ifndef __MACH_INIT_H
 #define __MACH_INIT_H
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 
 #define UNIPHIER_MAX_NR_DRAM_CH		3
diff --git a/arch/arm/mach-uniphier/micro-support-card.c b/arch/arm/mach-uniphier/micro-support-card.c
index c71470a..18435dc 100644
--- a/arch/arm/mach-uniphier/micro-support-card.c
+++ b/arch/arm/mach-uniphier/micro-support-card.c
@@ -6,9 +6,12 @@
  */
 
 #include <common.h>
-#include <dm/of.h>
 #include <fdt_support.h>
+#include <log.h>
+#include <net.h>
+#include <dm/of.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 
 #include "micro-support-card.h"
diff --git a/arch/arm/mach-uniphier/mmc-first-dev.c b/arch/arm/mach-uniphier/mmc-first-dev.c
index e2f4f4e..7f29b6b 100644
--- a/arch/arm/mach-uniphier/mmc-first-dev.c
+++ b/arch/arm/mach-uniphier/mmc-first-dev.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <mmc.h>
 #include <linux/errno.h>
@@ -28,7 +29,8 @@
 	return find_first_mmc_device(false);
 }
 
-static int do_mmcsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mmcsetn(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int dev;
 
@@ -46,7 +48,8 @@
 	""
 );
 
-static int do_sdsetn(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sdsetn(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	int dev;
 
diff --git a/arch/arm/mach-uniphier/nand-reset.c b/arch/arm/mach-uniphier/nand-reset.c
index 11cadaa..dbf54aa 100644
--- a/arch/arm/mach-uniphier/nand-reset.c
+++ b/arch/arm/mach-uniphier/nand-reset.c
@@ -4,6 +4,7 @@
  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
  */
 
+#include <log.h>
 #include <linux/errno.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
diff --git a/arch/arm/mach-versal/clk.c b/arch/arm/mach-versal/clk.c
index 9184714..b1e3479 100644
--- a/arch/arm/mach-versal/clk.c
+++ b/arch/arm/mach-versal/clk.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-versal/cpu.c b/arch/arm/mach-versal/cpu.c
index 1b760ba..61c0b66 100644
--- a/arch/arm/mach-versal/cpu.c
+++ b/arch/arm/mach-versal/cpu.c
@@ -5,7 +5,9 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/armv8/mmu.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
diff --git a/arch/arm/mach-versal/include/mach/hardware.h b/arch/arm/mach-versal/include/mach/hardware.h
index e26beab..9af5afd 100644
--- a/arch/arm/mach-versal/include/mach/hardware.h
+++ b/arch/arm/mach-versal/include/mach/hardware.h
@@ -3,6 +3,10 @@
  * Copyright 2016 - 2018 Xilinx, Inc.
  */
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define VERSAL_CRL_APB_BASEADDR	0xFF5E0000
 
 #define CRL_APB_TIMESTAMP_REF_CTRL_CLKACT_BIT	BIT(25)
diff --git a/arch/arm/mach-zynq/clk.c b/arch/arm/mach-zynq/clk.c
index b578f65..1ace117 100644
--- a/arch/arm/mach-zynq/clk.c
+++ b/arch/arm/mach-zynq/clk.c
@@ -6,6 +6,7 @@
 #include <clk.h>
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <malloc.h>
 #include <asm/arch/clk.h>
 
diff --git a/arch/arm/mach-zynq/cpu.c b/arch/arm/mach-zynq/cpu.c
index aca44df..77b7cb1 100644
--- a/arch/arm/mach-zynq/cpu.c
+++ b/arch/arm/mach-zynq/cpu.c
@@ -5,7 +5,9 @@
  */
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <zynqpl.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-zynq/spl.c b/arch/arm/mach-zynq/spl.c
index 02a7dc9..239ce34 100644
--- a/arch/arm/mach-zynq/spl.c
+++ b/arch/arm/mach-zynq/spl.c
@@ -5,6 +5,9 @@
 #include <common.h>
 #include <debug_uart.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <generated/dt.h>
 
diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c
index d822e20..cc0e24c 100644
--- a/arch/arm/mach-zynq/timer.c
+++ b/arch/arm/mach-zynq/timer.c
@@ -31,6 +31,7 @@
 #include <common.h>
 #include <div64.h>
 #include <dm.h>
+#include <init.h>
 #include <time.h>
 #include <malloc.h>
 #include <asm/io.h>
diff --git a/arch/arm/mach-zynqmp-r5/cpu.c b/arch/arm/mach-zynqmp-r5/cpu.c
index aa5de86..b3402d7 100644
--- a/arch/arm/mach-zynqmp-r5/cpu.c
+++ b/arch/arm/mach-zynqmp-r5/cpu.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/armv7_mpu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/arm/mach-zynqmp/clk.c b/arch/arm/mach-zynqmp/clk.c
index db2b4a8..5067b33 100644
--- a/arch/arm/mach-zynqmp/clk.c
+++ b/arch/arm/mach-zynqmp/clk.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/hardware.h>
diff --git a/arch/arm/mach-zynqmp/cpu.c b/arch/arm/mach-zynqmp/cpu.c
index 811684a..3eb8e8f 100644
--- a/arch/arm/mach-zynqmp/cpu.c
+++ b/arch/arm/mach-zynqmp/cpu.c
@@ -5,10 +5,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/armv8/mmu.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <zynqmp_firmware.h>
 #include <asm/cache.h>
diff --git a/arch/arm/mach-zynqmp/include/mach/hardware.h b/arch/arm/mach-zynqmp/include/mach/hardware.h
index a0acfa2..c5ba421 100644
--- a/arch/arm/mach-zynqmp/include/mach/hardware.h
+++ b/arch/arm/mach-zynqmp/include/mach/hardware.h
@@ -7,6 +7,10 @@
 #ifndef _ASM_ARCH_HARDWARE_H
 #define _ASM_ARCH_HARDWARE_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define ZYNQMP_TCM_BASE_ADDR	0xFFE00000
 #define ZYNQMP_TCM_SIZE		0x40000
 
diff --git a/arch/arm/mach-zynqmp/mp.c b/arch/arm/mach-zynqmp/mp.c
index fbb5511..656678a 100644
--- a/arch/arm/mach-zynqmp/mp.c
+++ b/arch/arm/mach-zynqmp/mp.c
@@ -6,9 +6,11 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #define LOCK		0
 #define SPLIT		1
@@ -221,7 +223,7 @@
 	}
 }
 
-int cpu_release(u32 nr, int argc, char * const argv[])
+int cpu_release(u32 nr, int argc, char *const argv[])
 {
 	if (nr >= ZYNQMP_CORE_APU0 && nr <= ZYNQMP_CORE_APU3) {
 		u64 boot_addr = simple_strtoull(argv[0], NULL, 16);
diff --git a/arch/arm/mach-zynqmp/psu_spl_init.c b/arch/arm/mach-zynqmp/psu_spl_init.c
index b6abdfd..5c5c7d1 100644
--- a/arch/arm/mach-zynqmp/psu_spl_init.c
+++ b/arch/arm/mach-zynqmp/psu_spl_init.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/psu_init_gpl.h>
+#include <linux/delay.h>
 
 #define PSU_MASK_POLL_TIME 1100000
 
diff --git a/arch/arm/mach-zynqmp/spl.c b/arch/arm/mach-zynqmp/spl.c
index 68df0a7..9dd61e2 100644
--- a/arch/arm/mach-zynqmp/spl.c
+++ b/arch/arm/mach-zynqmp/spl.c
@@ -6,8 +6,11 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/spl.h>
diff --git a/arch/m68k/cpu/mcf5227x/cpu.c b/arch/m68k/cpu/mcf5227x/cpu.c
index 34534d8..5ea6158 100644
--- a/arch/m68k/cpu/mcf5227x/cpu.c
+++ b/arch/m68k/cpu/mcf5227x/cpu.c
@@ -9,16 +9,18 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
+#include <linux/delay.h>
 
 #include <asm/immap.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	rcm_t *rcm = (rcm_t *) (MMAP_RCM);
 	udelay(1000);
diff --git a/arch/m68k/cpu/mcf5227x/cpu_init.c b/arch/m68k/cpu/mcf5227x/cpu_init.c
index 7cde4c6..4ab13b4 100644
--- a/arch/m68k/cpu/mcf5227x/cpu_init.c
+++ b/arch/m68k/cpu/mcf5227x/cpu_init.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <watchdog.h>
 
 #include <asm/immap.h>
diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c
index 4297819..d521a8a 100644
--- a/arch/m68k/cpu/mcf523x/cpu.c
+++ b/arch/m68k/cpu/mcf523x/cpu.c
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
@@ -19,7 +21,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ccm_t *ccm = (ccm_t *) MMAP_CCM;
 
diff --git a/arch/m68k/cpu/mcf523x/cpu_init.c b/arch/m68k/cpu/mcf523x/cpu_init.c
index 8c6e12d..87effa7 100644
--- a/arch/m68k/cpu/mcf523x/cpu_init.c
+++ b/arch/m68k/cpu/mcf523x/cpu_init.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <watchdog.h>
 #include <asm/immap.h>
 #include <asm/io.h>
diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c
index b48a753..d3d4e30 100644
--- a/arch/m68k/cpu/mcf52x2/cpu.c
+++ b/arch/m68k/cpu/mcf52x2/cpu.c
@@ -14,18 +14,21 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 #include <netdev.h>
+#include <linux/delay.h>
 #include "cpu.h"
 
 DECLARE_GLOBAL_DATA_PTR;
 
 #ifdef	CONFIG_M5208
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	rcm_t *rcm = (rcm_t *)(MMAP_RCM);
 
@@ -138,7 +141,7 @@
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	/* Call the board specific reset actions first. */
 	if(board_reset) {
@@ -173,7 +176,7 @@
 #endif
 
 #ifdef	CONFIG_M5272
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	wdog_t *wdp = (wdog_t *) (MMAP_WDOG);
 
@@ -262,7 +265,7 @@
 #endif				/* #ifdef CONFIG_M5272 */
 
 #ifdef	CONFIG_M5275
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	rcm_t *rcm = (rcm_t *)(MMAP_RCM);
 
@@ -352,7 +355,7 @@
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	MCFRESET_RCR = MCFRESET_RCR_SOFTRST;
 	return 0;
@@ -371,7 +374,7 @@
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	/* enable watchdog, set timeout to 0 and wait */
 	mbar_writeByte(MCFSIM_SYPCR, 0xc0);
@@ -403,7 +406,7 @@
 }
 #endif /* CONFIG_DISPLAY_CPUINFO */
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	/* enable watchdog, set timeout to 0 and wait */
 	mbar_writeByte(SIM_SYPCR, 0xc0);
diff --git a/arch/m68k/cpu/mcf52x2/cpu_init.c b/arch/m68k/cpu/mcf52x2/cpu_init.c
index f39fe19..9d4a10f 100644
--- a/arch/m68k/cpu/mcf52x2/cpu_init.c
+++ b/arch/m68k/cpu/mcf52x2/cpu_init.c
@@ -19,6 +19,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <watchdog.h>
 #include <asm/immap.h>
 #include <asm/io.h>
diff --git a/arch/m68k/cpu/mcf52x2/speed.c b/arch/m68k/cpu/mcf52x2/speed.c
index 02ef5d8..751c83a 100644
--- a/arch/m68k/cpu/mcf52x2/speed.c
+++ b/arch/m68k/cpu/mcf52x2/speed.c
@@ -12,6 +12,7 @@
 #include <asm/processor.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/m68k/cpu/mcf530x/cpu.c b/arch/m68k/cpu/mcf530x/cpu.c
index a76deeb..0659bf6 100644
--- a/arch/m68k/cpu/mcf530x/cpu.c
+++ b/arch/m68k/cpu/mcf530x/cpu.c
@@ -5,12 +5,14 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <init.h>
 #include <vsprintf.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
 #ifdef CONFIG_M5307
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	sim_t *sim = (sim_t *)(MMAP_SIM);
 
diff --git a/arch/m68k/cpu/mcf530x/cpu_init.c b/arch/m68k/cpu/mcf530x/cpu_init.c
index 166720a..8352940 100644
--- a/arch/m68k/cpu/mcf530x/cpu_init.c
+++ b/arch/m68k/cpu/mcf530x/cpu_init.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <watchdog.h>
 #include <asm/immap.h>
 #include <asm/io.h>
diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c
index 6807992..72bfdf0 100644
--- a/arch/m68k/cpu/mcf532x/cpu.c
+++ b/arch/m68k/cpu/mcf532x/cpu.c
@@ -9,17 +9,20 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
+#include <linux/delay.h>
 
 #include <asm/immap.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	rcm_t *rcm = (rcm_t *) (MMAP_RCM);
 
diff --git a/arch/m68k/cpu/mcf532x/cpu_init.c b/arch/m68k/cpu/mcf532x/cpu_init.c
index bd130c1..1311f39 100644
--- a/arch/m68k/cpu/mcf532x/cpu_init.c
+++ b/arch/m68k/cpu/mcf532x/cpu_init.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <watchdog.h>
 #include <asm/immap.h>
 #include <asm/io.h>
diff --git a/arch/m68k/cpu/mcf5445x/cpu.c b/arch/m68k/cpu/mcf5445x/cpu.c
index 2f79380..886f29d 100644
--- a/arch/m68k/cpu/mcf5445x/cpu.c
+++ b/arch/m68k/cpu/mcf5445x/cpu.c
@@ -9,17 +9,20 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
+#include <linux/delay.h>
 
 #include <asm/immap.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	rcm_t *rcm = (rcm_t *) (MMAP_RCM);
 	udelay(1000);
diff --git a/arch/m68k/cpu/mcf5445x/cpu_init.c b/arch/m68k/cpu/mcf5445x/cpu_init.c
index 6ee23f0..9deab51 100644
--- a/arch/m68k/cpu/mcf5445x/cpu_init.c
+++ b/arch/m68k/cpu/mcf5445x/cpu_init.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <watchdog.h>
 #include <asm/immap.h>
 #include <asm/processor.h>
diff --git a/arch/m68k/cpu/mcf5445x/pci.c b/arch/m68k/cpu/mcf5445x/pci.c
index 09bd745..af02c49 100644
--- a/arch/m68k/cpu/mcf5445x/pci.c
+++ b/arch/m68k/cpu/mcf5445x/pci.c
@@ -11,6 +11,7 @@
 #include <pci.h>
 #include <asm/io.h>
 #include <asm/immap.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_PCI)
 /* System RAM mapped over PCI */
diff --git a/arch/m68k/cpu/mcf547x_8x/cpu.c b/arch/m68k/cpu/mcf547x_8x/cpu.c
index dc5ed1a..59cdfe7 100644
--- a/arch/m68k/cpu/mcf547x_8x/cpu.c
+++ b/arch/m68k/cpu/mcf547x_8x/cpu.c
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
@@ -19,7 +21,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	gptmr_t *gptmr = (gptmr_t *) (MMAP_GPTMR);
 
diff --git a/arch/m68k/cpu/mcf547x_8x/cpu_init.c b/arch/m68k/cpu/mcf547x_8x/cpu_init.c
index 8779384..8e42b63 100644
--- a/arch/m68k/cpu/mcf547x_8x/cpu_init.c
+++ b/arch/m68k/cpu/mcf547x_8x/cpu_init.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <MCD_dma.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf547x_8x/pci.c b/arch/m68k/cpu/mcf547x_8x/pci.c
index ac42cca..74ba681 100644
--- a/arch/m68k/cpu/mcf547x_8x/pci.c
+++ b/arch/m68k/cpu/mcf547x_8x/pci.c
@@ -11,6 +11,7 @@
 #include <pci.h>
 #include <asm/io.h>
 #include <asm/immap.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_PCI)
 /* System RAM mapped over PCI */
diff --git a/arch/m68k/cpu/mcf547x_8x/slicetimer.c b/arch/m68k/cpu/mcf547x_8x/slicetimer.c
index 885659e..33b4cff 100644
--- a/arch/m68k/cpu/mcf547x_8x/slicetimer.c
+++ b/arch/m68k/cpu/mcf547x_8x/slicetimer.c
@@ -5,7 +5,9 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <irq_func.h>
+#include <linux/delay.h>
 
 #include <asm/timer.h>
 #include <asm/immap.h>
diff --git a/arch/m68k/lib/bootm.c b/arch/m68k/lib/bootm.c
index 19445b3..aa17929 100644
--- a/arch/m68k/lib/bootm.c
+++ b/arch/m68k/lib/bootm.c
@@ -5,9 +5,12 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <env.h>
 #include <image.h>
+#include <lmb.h>
+#include <log.h>
 #include <u-boot/zlib.h>
 #include <bzlib.h>
 #include <watchdog.h>
@@ -47,7 +50,8 @@
 	lmb_reserve(lmb, sp, (CONFIG_SYS_SDRAM_BASE + gd->ram_size - sp));
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char *const argv[],
+		   bootm_headers_t *images)
 {
 	int ret;
 	bd_t  *kbd;
diff --git a/arch/m68k/lib/interrupts.c b/arch/m68k/lib/interrupts.c
index ddc9199..1caef61 100644
--- a/arch/m68k/lib/interrupts.c
+++ b/arch/m68k/lib/interrupts.c
@@ -12,6 +12,7 @@
 #include <watchdog.h>
 #include <asm/processor.h>
 #include <asm/immap.h>
+#include <asm/ptrace.h>
 
 #define	NR_IRQS		(CONFIG_SYS_NUM_IRQS)
 
diff --git a/arch/m68k/lib/time.c b/arch/m68k/lib/time.c
index bde1f4c..a3eb6db 100644
--- a/arch/m68k/lib/time.c
+++ b/arch/m68k/lib/time.c
@@ -7,8 +7,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <irq_func.h>
 #include <time.h>
+#include <linux/delay.h>
 
 #include <asm/timer.h>
 #include <asm/immap.h>
diff --git a/arch/m68k/lib/traps.c b/arch/m68k/lib/traps.c
index 2ccd55a..c49141f 100644
--- a/arch/m68k/lib/traps.c
+++ b/arch/m68k/lib/traps.c
@@ -12,6 +12,7 @@
 #include <watchdog.h>
 #include <command.h>
 #include <asm/processor.h>
+#include <asm/ptrace.h>
 
 
 extern void _exc_handler(void);
diff --git a/arch/microblaze/cpu/cache.c b/arch/microblaze/cpu/cache.c
index 02f66f9..aa832d6 100644
--- a/arch/microblaze/cpu/cache.c
+++ b/arch/microblaze/cpu/cache.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <asm/asm.h>
+#include <asm/cache.h>
 
 int dcache_status(void)
 {
diff --git a/arch/microblaze/cpu/interrupts.c b/arch/microblaze/cpu/interrupts.c
index 910c596..829ae26 100644
--- a/arch/microblaze/cpu/interrupts.c
+++ b/arch/microblaze/cpu/interrupts.c
@@ -11,6 +11,7 @@
 #include <command.h>
 #include <fdtdec.h>
 #include <irq_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/microblaze_intc.h>
 #include <asm/asm.h>
@@ -187,7 +188,7 @@
 }
 
 #if defined(CONFIG_CMD_IRQ)
-int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, const char *argv[])
+int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, const char *argv[])
 {
 	int i;
 	struct irq_action *act = vecs;
diff --git a/arch/microblaze/cpu/spl.c b/arch/microblaze/cpu/spl.c
index 070c12c..86522f8 100644
--- a/arch/microblaze/cpu/spl.c
+++ b/arch/microblaze/cpu/spl.c
@@ -6,7 +6,9 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/u-boot.h>
@@ -48,7 +50,7 @@
 	return 1;
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	__asm__ __volatile__ ("mts rmsr, r0;" \
 			      "bra r0");
diff --git a/arch/microblaze/cpu/timer.c b/arch/microblaze/cpu/timer.c
index 805eac7..1b46173 100644
--- a/arch/microblaze/cpu/timer.c
+++ b/arch/microblaze/cpu/timer.c
@@ -7,9 +7,12 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <log.h>
 #include <time.h>
 #include <asm/microblaze_timer.h>
 #include <asm/microblaze_intc.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/microblaze/lib/bootm.c b/arch/microblaze/lib/bootm.c
index 2d6a41b..d2ea145 100644
--- a/arch/microblaze/lib/bootm.c
+++ b/arch/microblaze/lib/bootm.c
@@ -8,12 +8,16 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <cpu_func.h>
 #include <env.h>
 #include <fdt_support.h>
 #include <hang.h>
 #include <image.h>
+#include <lmb.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <u-boot/zlib.h>
 #include <asm/byteorder.h>
 
@@ -105,7 +109,7 @@
 	}
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[],
+int do_bootm_linux(int flag, int argc, char *const argv[],
 		   bootm_headers_t *images)
 {
 	images->cmdline_start = (ulong)env_get("bootargs");
diff --git a/arch/mips/cpu/cpu.c b/arch/mips/cpu/cpu.c
index a403ff7..7d5c9fd 100644
--- a/arch/mips/cpu/cpu.c
+++ b/arch/mips/cpu/cpu.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <init.h>
 #include <linux/compiler.h>
 #include <asm/cache.h>
 #include <asm/mipsregs.h>
@@ -20,7 +21,7 @@
 		/* NOP */;
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	_machine_restart();
 
diff --git a/arch/mips/include/asm/cacheops.h b/arch/mips/include/asm/cacheops.h
index 98b67cc..641e2ad 100644
--- a/arch/mips/include/asm/cacheops.h
+++ b/arch/mips/include/asm/cacheops.h
@@ -8,6 +8,8 @@
 #ifndef	__ASM_CACHEOPS_H
 #define	__ASM_CACHEOPS_H
 
+#include <asm/cache.h>
+
 #ifndef __ASSEMBLY__
 
 static inline void mips_cache(int op, const volatile void *addr)
diff --git a/arch/mips/include/asm/cm.h b/arch/mips/include/asm/cm.h
index 8f37471..3878171 100644
--- a/arch/mips/include/asm/cm.h
+++ b/arch/mips/include/asm/cm.h
@@ -39,6 +39,7 @@
 #ifndef __ASSEMBLY__
 
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 static inline void *mips_cm_base(void)
 {
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index f80311e..7538e6b 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -27,6 +27,7 @@
 #ifdef __ASSEMBLY__
 #define _ULCAST_
 #else
+#include <linux/bitops.h>
 #define _ULCAST_ (unsigned long)
 #endif
 
diff --git a/arch/mips/lib/bootm.c b/arch/mips/lib/bootm.c
index f1db6d2..82f986c 100644
--- a/arch/mips/lib/bootm.c
+++ b/arch/mips/lib/bootm.c
@@ -5,9 +5,12 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <env.h>
 #include <image.h>
 #include <fdt_support.h>
+#include <lmb.h>
+#include <log.h>
 #include <asm/addrspace.h>
 #include <asm/io.h>
 
@@ -304,8 +307,8 @@
 			linux_extra);
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[],
-			bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char *const argv[],
+		   bootm_headers_t *images)
 {
 	/* No need for those on MIPS */
 	if (flag & BOOTM_STATE_OS_BD_T)
diff --git a/arch/mips/lib/cache.c b/arch/mips/lib/cache.c
index 1a8c87d..24f115e 100644
--- a/arch/mips/lib/cache.c
+++ b/arch/mips/lib/cache.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <asm/cacheops.h>
 #ifdef CONFIG_MIPS_L2_CACHE
 #include <asm/cm.h>
@@ -13,6 +14,7 @@
 #include <asm/io.h>
 #include <asm/mipsregs.h>
 #include <asm/system.h>
+#include <linux/bug.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/mips/lib/reloc.c b/arch/mips/lib/reloc.c
index 1e3cfad..ffc8c7a 100644
--- a/arch/mips/lib/reloc.c
+++ b/arch/mips/lib/reloc.c
@@ -31,6 +31,7 @@
 #include <init.h>
 #include <asm/relocs.h>
 #include <asm/sections.h>
+#include <linux/bitops.h>
 
 /**
  * read_uint() - Read an unsigned integer from the buffer
diff --git a/arch/mips/lib/spl.c b/arch/mips/lib/spl.c
index 7ba3e53..f96fda5 100644
--- a/arch/mips/lib/spl.c
+++ b/arch/mips/lib/spl.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <spl.h>
 
 void __noreturn jump_to_image_no_args(struct spl_image_info *spl_image)
diff --git a/arch/mips/lib/stack.c b/arch/mips/lib/stack.c
index 99fd056..8f523fd 100644
--- a/arch/mips/lib/stack.c
+++ b/arch/mips/lib/stack.c
@@ -1,6 +1,8 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/mips/lib/traps.c b/arch/mips/lib/traps.c
index 8fff754..b1ae02f 100644
--- a/arch/mips/lib/traps.c
+++ b/arch/mips/lib/traps.c
@@ -11,9 +11,11 @@
  */
 
 #include <common.h>
+#include <asm/ptrace.h>
 #include <cpu_func.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
 #include <asm/mipsregs.h>
 #include <asm/addrspace.h>
 #include <asm/system.h>
diff --git a/arch/mips/mach-ath79/ar933x/ddr.c b/arch/mips/mach-ath79/ar933x/ddr.c
index 2cf0b2c..09166ec 100644
--- a/arch/mips/mach-ath79/ar933x/ddr.c
+++ b/arch/mips/mach-ath79/ar933x/ddr.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
 #include <mach/ar71xx_regs.h>
 #include <mach/ath79.h>
 
diff --git a/arch/mips/mach-ath79/ar934x/clk.c b/arch/mips/mach-ath79/ar934x/clk.c
index 09bdc25..9fa2225 100644
--- a/arch/mips/mach-ath79/ar934x/clk.c
+++ b/arch/mips/mach-ath79/ar934x/clk.c
@@ -5,10 +5,13 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <command.h>
 #include <hang.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/ar71xx_regs.h>
 #include <mach/ath79.h>
 #include <wait_bit.h>
@@ -319,7 +322,8 @@
 	return gd->mem_clk;
 }
 
-int do_ar934x_showclk(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ar934x_showclk(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	ar934x_update_clock();
 	printf("CPU:       %8ld MHz\n", gd->cpu_clk / 1000000);
diff --git a/arch/mips/mach-ath79/ar934x/ddr.c b/arch/mips/mach-ath79/ar934x/ddr.c
index 289973e..218f60a 100644
--- a/arch/mips/mach-ath79/ar934x/ddr.c
+++ b/arch/mips/mach-ath79/ar934x/ddr.c
@@ -9,6 +9,8 @@
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/ar71xx_regs.h>
 #include <mach/ath79.h>
 
diff --git a/arch/mips/mach-ath79/cpu.c b/arch/mips/mach-ath79/cpu.c
index 9afc672..31e87d6 100644
--- a/arch/mips/mach-ath79/cpu.c
+++ b/arch/mips/mach-ath79/cpu.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
diff --git a/arch/mips/mach-ath79/qca953x/ddr.c b/arch/mips/mach-ath79/qca953x/ddr.c
index 268da73..78f2370 100644
--- a/arch/mips/mach-ath79/qca953x/ddr.c
+++ b/arch/mips/mach-ath79/qca953x/ddr.c
@@ -8,6 +8,8 @@
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/ar71xx_regs.h>
 #include <mach/ath79.h>
 
diff --git a/arch/mips/mach-ath79/qca956x/clk.c b/arch/mips/mach-ath79/qca956x/clk.c
index d71c94e..5adf6cd 100644
--- a/arch/mips/mach-ath79/qca956x/clk.c
+++ b/arch/mips/mach-ath79/qca956x/clk.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
diff --git a/arch/mips/mach-ath79/qca956x/ddr.c b/arch/mips/mach-ath79/qca956x/ddr.c
index fb22304..e61a368 100644
--- a/arch/mips/mach-ath79/qca956x/ddr.c
+++ b/arch/mips/mach-ath79/qca956x/ddr.c
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
+#include <linux/delay.h>
 #include <mach/ar71xx_regs.h>
 #include <mach/ath79.h>
 
diff --git a/arch/mips/mach-ath79/reset.c b/arch/mips/mach-ath79/reset.c
index 0ab3ab6..6cd5e77 100644
--- a/arch/mips/mach-ath79/reset.c
+++ b/arch/mips/mach-ath79/reset.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
diff --git a/arch/mips/mach-bmips/dram.c b/arch/mips/mach-bmips/dram.c
index 87ced7c..a772a65 100644
--- a/arch/mips/mach-bmips/dram.c
+++ b/arch/mips/mach-bmips/dram.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <dm.h>
 
diff --git a/arch/mips/mach-jz47xx/include/mach/jz4780_dram.h b/arch/mips/mach-jz47xx/include/mach/jz4780_dram.h
index 92d431b..61cc148 100644
--- a/arch/mips/mach-jz47xx/include/mach/jz4780_dram.h
+++ b/arch/mips/mach-jz47xx/include/mach/jz4780_dram.h
@@ -12,6 +12,7 @@
 /*
  * DDR
  */
+#include <linux/bitops.h>
 #define DDRC_ST				0x0
 #define DDRC_CFG			0x4
 #define DDRC_CTRL			0x8
diff --git a/arch/mips/mach-jz47xx/jz4780/gpio.c b/arch/mips/mach-jz47xx/jz4780/gpio.c
index cee2328..d4884e7 100644
--- a/arch/mips/mach-jz47xx/jz4780/gpio.c
+++ b/arch/mips/mach-jz47xx/jz4780/gpio.c
@@ -3,6 +3,7 @@
 #include <config.h>
 #include <common.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <mach/jz4780.h>
 
 int jz47xx_gpio_get_value(unsigned int gpio)
diff --git a/arch/mips/mach-jz47xx/jz4780/jz4780.c b/arch/mips/mach-jz47xx/jz4780/jz4780.c
index 015840d..26fcfc8 100644
--- a/arch/mips/mach-jz47xx/jz4780/jz4780.c
+++ b/arch/mips/mach-jz47xx/jz4780/jz4780.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <image.h>
 #include <init.h>
 #include <asm/io.h>
 #include <asm/sections.h>
diff --git a/arch/mips/mach-jz47xx/jz4780/pll.c b/arch/mips/mach-jz47xx/jz4780/pll.c
index 9a46198..323c634 100644
--- a/arch/mips/mach-jz47xx/jz4780/pll.c
+++ b/arch/mips/mach-jz47xx/jz4780/pll.c
@@ -9,6 +9,8 @@
 #include <config.h>
 #include <common.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/jz4780.h>
 
 #define CPM_CPCCR		0x00
diff --git a/arch/mips/mach-jz47xx/jz4780/reset.c b/arch/mips/mach-jz47xx/jz4780/reset.c
index 73af347..bf6addc 100644
--- a/arch/mips/mach-jz47xx/jz4780/reset.c
+++ b/arch/mips/mach-jz47xx/jz4780/reset.c
@@ -9,6 +9,7 @@
 #include <config.h>
 #include <common.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <mach/jz4780.h>
 
 /* WDT */
diff --git a/arch/mips/mach-jz47xx/jz4780/sdram.c b/arch/mips/mach-jz47xx/jz4780/sdram.c
index 65afefe..690f3c5 100644
--- a/arch/mips/mach-jz47xx/jz4780/sdram.c
+++ b/arch/mips/mach-jz47xx/jz4780/sdram.c
@@ -11,7 +11,10 @@
 
 #include <common.h>
 #include <hang.h>
+#include <init.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/jz4780.h>
 #include <mach/jz4780_dram.h>
 
diff --git a/arch/mips/mach-jz47xx/jz4780/timer.c b/arch/mips/mach-jz47xx/jz4780/timer.c
index b32a2f5..82bb9e8 100644
--- a/arch/mips/mach-jz47xx/jz4780/timer.c
+++ b/arch/mips/mach-jz47xx/jz4780/timer.c
@@ -9,10 +9,13 @@
 #include <config.h>
 #include <common.h>
 #include <div64.h>
+#include <init.h>
 #include <irq_func.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/mipsregs.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/jz4780.h>
 
 #define TCU_TSR		0x1C	/* Timer Stop Register */
diff --git a/arch/mips/mach-mscc/cpu.c b/arch/mips/mach-mscc/cpu.c
index 3ee5898..b4ffd44 100644
--- a/arch/mips/mach-mscc/cpu.c
+++ b/arch/mips/mach-mscc/cpu.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <linux/bitops.h>
 
 #include <asm/io.h>
 #include <asm/types.h>
diff --git a/arch/mips/mach-mscc/dram.c b/arch/mips/mach-mscc/dram.c
index 72c70c9..b12bac6 100644
--- a/arch/mips/mach-mscc/dram.c
+++ b/arch/mips/mach-mscc/dram.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 
 #include <asm/io.h>
 #include <asm/types.h>
diff --git a/arch/mips/mach-mscc/gpio.c b/arch/mips/mach-mscc/gpio.c
index 5e3a533..d6b4c5d 100644
--- a/arch/mips/mach-mscc/gpio.c
+++ b/arch/mips/mach-mscc/gpio.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 void mscc_gpio_set_alternate(int gpio, int mode)
 {
diff --git a/arch/mips/mach-mscc/include/mach/ddr.h b/arch/mips/mach-mscc/include/mach/ddr.h
index bf75e52..d52eabb 100644
--- a/arch/mips/mach-mscc/include/mach/ddr.h
+++ b/arch/mips/mach-mscc/include/mach/ddr.h
@@ -9,6 +9,7 @@
 #include <asm/cacheops.h>
 #include <asm/io.h>
 #include <asm/reboot.h>
+#include <linux/bitops.h>
 #include <mach/common.h>
 
 #define MIPS_VCOREIII_MEMORY_DDR3
diff --git a/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb.h b/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb.h
index 4a1228d..8d1d21b 100644
--- a/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb.h
+++ b/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb.h
@@ -6,6 +6,8 @@
 #ifndef _MSCC_JR2_DEVCPU_GCB_H_
 #define _MSCC_JR2_DEVCPU_GCB_H_
 
+#include <linux/bitops.h>
+
 #define PERF_GPR                                          0x4
 
 #define PERF_SOFT_RST                                     0x8
diff --git a/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb_miim_regs.h b/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb_miim_regs.h
index 3c84edc..e11ad87 100644
--- a/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb_miim_regs.h
+++ b/arch/mips/mach-mscc/include/mach/jr2/jr2_devcpu_gcb_miim_regs.h
@@ -6,6 +6,8 @@
 #ifndef _MSCC_JR2_DEVCPU_GCB_MIIM_REGS_H_
 #define _MSCC_JR2_DEVCPU_GCB_MIIM_REGS_H_
 
+#include <linux/bitops.h>
+
 #define MIIM_MII_STATUS(gi)  (0xc8 + (gi * 36))
 #define MIIM_MII_CMD(gi)     (0xd0 + (gi * 36))
 #define MIIM_MII_DATA(gi)    (0xd4 + (gi * 36))
diff --git a/arch/mips/mach-mscc/include/mach/jr2/jr2_icpu_cfg.h b/arch/mips/mach-mscc/include/mach/jr2/jr2_icpu_cfg.h
index 6e0bbe2..151bb3e 100644
--- a/arch/mips/mach-mscc/include/mach/jr2/jr2_icpu_cfg.h
+++ b/arch/mips/mach-mscc/include/mach/jr2/jr2_icpu_cfg.h
@@ -6,6 +6,8 @@
 #ifndef _MSCC_JR2_ICPU_CFG_H_
 #define _MSCC_JR2_ICPU_CFG_H_
 
+#include <linux/bitops.h>
+
 #define ICPU_GPR(x)                                       (0x4 * (x))
 #define ICPU_GPR_RSZ                                      0x4
 
diff --git a/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb.h b/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb.h
index a74a685..750a801 100644
--- a/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb.h
+++ b/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_OCELOT_DEVCPU_GCB_H_
 #define _MSCC_OCELOT_DEVCPU_GCB_H_
 
+#include <linux/bitops.h>
 #define PERF_SOFT_RST                                     0x90
 
 #define PERF_SOFT_RST_SOFT_SWC_RST                        BIT(1)
diff --git a/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb_miim_regs.h b/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb_miim_regs.h
index 2303734..07c4f9a 100644
--- a/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb_miim_regs.h
+++ b/arch/mips/mach-mscc/include/mach/luton/luton_devcpu_gcb_miim_regs.h
@@ -8,6 +8,7 @@
 #ifndef _MSCC_LUTON_MIIM_REGS_H_
 #define _MSCC_LUTON_MIIM_REGS_H_
 
+#include <linux/bitops.h>
 #define MIIM_MII_STATUS(gi) (0xa0 + (gi * 36))
 #define MIIM_MII_CMD(gi)    (0xa8 + (gi * 36))
 #define MIIM_MII_DATA(gi)   (0xac + (gi * 36))
diff --git a/arch/mips/mach-mscc/include/mach/luton/luton_icpu_cfg.h b/arch/mips/mach-mscc/include/mach/luton/luton_icpu_cfg.h
index 9233f03..ded7c5f 100644
--- a/arch/mips/mach-mscc/include/mach/luton/luton_icpu_cfg.h
+++ b/arch/mips/mach-mscc/include/mach/luton/luton_icpu_cfg.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_OCELOT_ICPU_CFG_H_
 #define _MSCC_OCELOT_ICPU_CFG_H_
 
+#include <linux/bitops.h>
 #define ICPU_GPR(x) (0x4 * (x))
 #define ICPU_GPR_RSZ                                      0x4
 
diff --git a/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb.h b/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb.h
index b2a4203..5715ec1 100644
--- a/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb.h
+++ b/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_OCELOT_DEVCPU_GCB_H_
 #define _MSCC_OCELOT_DEVCPU_GCB_H_
 
+#include <linux/bitops.h>
 #define PERF_SOFT_RST                                     0x8
 
 #define PERF_SOFT_RST_SOFT_NON_CFG_RST                    BIT(2)
diff --git a/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb_miim_regs.h b/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb_miim_regs.h
index 4ad9221..50cf073 100644
--- a/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb_miim_regs.h
+++ b/arch/mips/mach-mscc/include/mach/ocelot/ocelot_devcpu_gcb_miim_regs.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_OCELOT_DEVCPU_GCB_MIIM_REGS_H_
 #define _MSCC_OCELOT_DEVCPU_GCB_MIIM_REGS_H_
 
+#include <linux/bitops.h>
 #define MIIM_MII_STATUS(gi) (0x9c + (gi * 36))
 #define MIIM_MII_CMD(gi)    (0xa4 + (gi * 36))
 #define MIIM_MII_DATA(gi)   (0xa8 + (gi * 36))
diff --git a/arch/mips/mach-mscc/include/mach/ocelot/ocelot_icpu_cfg.h b/arch/mips/mach-mscc/include/mach/ocelot/ocelot_icpu_cfg.h
index 04cf70b..fb10bf2 100644
--- a/arch/mips/mach-mscc/include/mach/ocelot/ocelot_icpu_cfg.h
+++ b/arch/mips/mach-mscc/include/mach/ocelot/ocelot_icpu_cfg.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_OCELOT_ICPU_CFG_H_
 #define _MSCC_OCELOT_ICPU_CFG_H_
 
+#include <linux/bitops.h>
 #define ICPU_GPR(x) (0x4 * (x))
 #define ICPU_GPR_RSZ                                      0x4
 
diff --git a/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb.h b/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb.h
index 9b80fdb..43d40be 100644
--- a/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb.h
+++ b/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_SERVAL_DEVCPU_GCB_H_
 #define _MSCC_SERVAL_DEVCPU_GCB_H_
 
+#include <linux/bitops.h>
 #define CHIP_ID                                           0x0
 
 #define PERF_GPR                                          0x4
diff --git a/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb_miim_regs.h b/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb_miim_regs.h
index a3abbc40..e8cb1dc 100644
--- a/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb_miim_regs.h
+++ b/arch/mips/mach-mscc/include/mach/serval/serval_devcpu_gcb_miim_regs.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_SERVAL_DEVCPU_GCB_MIIM_REGS_H_
 #define _MSCC_SERVAL_DEVCPU_GCB_MIIM_REGS_H_
 
+#include <linux/bitops.h>
 #define MIIM_MII_STATUS(gi)  (0x5c + (gi * 36))
 #define MIIM_MII_CMD(gi)     (0x64 + (gi * 36))
 #define MIIM_MII_DATA(gi)    (0x68 + (gi * 36))
diff --git a/arch/mips/mach-mscc/include/mach/serval/serval_icpu_cfg.h b/arch/mips/mach-mscc/include/mach/serval/serval_icpu_cfg.h
index b8c9d5c..4d4151b 100644
--- a/arch/mips/mach-mscc/include/mach/serval/serval_icpu_cfg.h
+++ b/arch/mips/mach-mscc/include/mach/serval/serval_icpu_cfg.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_SERVAL_ICPU_CFG_H_
 #define _MSCC_SERVAL_ICPU_CFG_H_
 
+#include <linux/bitops.h>
 #define ICPU_GPR(x)                                       (0x4 * (x))
 #define ICPU_GPR_RSZ                                      0x8
 
diff --git a/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb.h b/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb.h
index 493eaad..7d6c64f 100644
--- a/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb.h
+++ b/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_SERVALT_DEVCPU_GCB_H_
 #define _MSCC_SERVALT_DEVCPU_GCB_H_
 
+#include <linux/bitops.h>
 #define PERF_GPR                                          0x4
 
 #define PERF_SOFT_RST                                     0x8
diff --git a/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb_miim_regs.h b/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb_miim_regs.h
index 8c67190..72d7c4d 100644
--- a/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb_miim_regs.h
+++ b/arch/mips/mach-mscc/include/mach/servalt/servalt_devcpu_gcb_miim_regs.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_SERVALT_DEVCPU_GCB_MIIM_REGS_H_
 #define _MSCC_SERVALT_DEVCPU_GCB_MIIM_REGS_H_
 
+#include <linux/bitops.h>
 #define MIIM_MII_STATUS(gi)  (0xc4 + (gi * 36))
 #define MIIM_MII_CMD(gi)     (0xcc + (gi * 36))
 #define MIIM_MII_DATA(gi)    (0xd0 + (gi * 36))
diff --git a/arch/mips/mach-mscc/include/mach/servalt/servalt_icpu_cfg.h b/arch/mips/mach-mscc/include/mach/servalt/servalt_icpu_cfg.h
index 491ead1..13967f6 100644
--- a/arch/mips/mach-mscc/include/mach/servalt/servalt_icpu_cfg.h
+++ b/arch/mips/mach-mscc/include/mach/servalt/servalt_icpu_cfg.h
@@ -6,6 +6,7 @@
 #ifndef _MSCC_SERVALT_ICPU_CFG_H_
 #define _MSCC_SERVALT_ICPU_CFG_H_
 
+#include <linux/bitops.h>
 #define ICPU_GPR(x)                                       (0x4 * (x))
 #define ICPU_GPR_RSZ                                      0x8
 
diff --git a/arch/mips/mach-mscc/include/mach/tlb.h b/arch/mips/mach-mscc/include/mach/tlb.h
index fdb554f..ebd8ad0 100644
--- a/arch/mips/mach-mscc/include/mach/tlb.h
+++ b/arch/mips/mach-mscc/include/mach/tlb.h
@@ -7,6 +7,7 @@
 #define __ASM_MACH_TLB_H
 
 #include <asm/mipsregs.h>
+#include <linux/bitops.h>
 #include <mach/common.h>
 #include <linux/sizes.h>
 
diff --git a/arch/mips/mach-mscc/phy.c b/arch/mips/mach-mscc/phy.c
index add6280..83d3e5b 100644
--- a/arch/mips/mach-mscc/phy.c
+++ b/arch/mips/mach-mscc/phy.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 
 int mscc_phy_rd_wr(u8 read,
diff --git a/arch/mips/mach-mtmips/cpu.c b/arch/mips/mach-mtmips/cpu.c
index 459a967..2ddf8cb 100644
--- a/arch/mips/mach-mtmips/cpu.c
+++ b/arch/mips/mach-mtmips/cpu.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
 
diff --git a/arch/mips/mach-mtmips/ddr_init.c b/arch/mips/mach-mtmips/ddr_init.c
index cd355cc..6c6d093 100644
--- a/arch/mips/mach-mtmips/ddr_init.c
+++ b/arch/mips/mach-mtmips/ddr_init.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
 #include <mach/ddr.h>
diff --git a/arch/mips/mach-mtmips/mt7628/ddr.c b/arch/mips/mach-mtmips/mt7628/ddr.c
index 06c0ca6..3df85cd 100644
--- a/arch/mips/mach-mtmips/mt7628/ddr.c
+++ b/arch/mips/mach-mtmips/mt7628/ddr.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <asm/addrspace.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <linux/io.h>
 #include <mach/ddr.h>
diff --git a/arch/mips/mach-mtmips/spl.c b/arch/mips/mach-mtmips/spl.c
index 2a24af7..38d9e91 100644
--- a/arch/mips/mach-mtmips/spl.c
+++ b/arch/mips/mach-mtmips/spl.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <fdt.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/sections.h>
 #include <linux/sizes.h>
diff --git a/arch/mips/mach-pic32/cpu.c b/arch/mips/mach-pic32/cpu.c
index 8075d93..1d8c397 100644
--- a/arch/mips/mach-pic32/cpu.c
+++ b/arch/mips/mach-pic32/cpu.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <init.h>
 #include <malloc.h>
 #include <mach/pic32.h>
 #include <mach/ddr.h>
diff --git a/arch/nds32/cpu/n1213/ae3xx/cpu.c b/arch/nds32/cpu/n1213/ae3xx/cpu.c
index 0660fff..c3efa31 100644
--- a/arch/nds32/cpu/n1213/ae3xx/cpu.c
+++ b/arch/nds32/cpu/n1213/ae3xx/cpu.c
@@ -39,7 +39,7 @@
 	return 0;
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	disable_interrupts();
 	panic("AE3XX wdt not support yet.\n");
diff --git a/arch/nds32/cpu/n1213/ag101/cpu.c b/arch/nds32/cpu/n1213/ag101/cpu.c
index 3ae87a2..9d99c83 100644
--- a/arch/nds32/cpu/n1213/ag101/cpu.c
+++ b/arch/nds32/cpu/n1213/ag101/cpu.c
@@ -39,7 +39,7 @@
 	return 0;
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	disable_interrupts();
 
diff --git a/arch/nds32/cpu/n1213/ag101/timer.c b/arch/nds32/cpu/n1213/ag101/timer.c
index f2e3621..394fc10 100644
--- a/arch/nds32/cpu/n1213/ag101/timer.c
+++ b/arch/nds32/cpu/n1213/ag101/timer.c
@@ -9,10 +9,13 @@
  */
 #ifndef CONFIG_TIMER
 #include <common.h>
+#include <init.h>
 #include <irq_func.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <faraday/fttmr010.h>
+#include <linux/delay.h>
 
 static ulong timestamp;
 static ulong lastdec;
diff --git a/arch/nds32/include/asm/u-boot-nds32.h b/arch/nds32/include/asm/u-boot-nds32.h
index 7d39320..f086f34 100644
--- a/arch/nds32/include/asm/u-boot-nds32.h
+++ b/arch/nds32/include/asm/u-boot-nds32.h
@@ -12,6 +12,8 @@
 #ifndef _U_BOOT_NDS32_H_
 #define _U_BOOT_NDS32_H_	1
 
+#include <linux/types.h>
+
 /* for the following variables, see start.S */
 extern ulong IRQ_STACK_START;	/* top of IRQ stack */
 extern ulong FIQ_STACK_START;	/* top of FIQ stack */
diff --git a/arch/nds32/lib/boot.c b/arch/nds32/lib/boot.c
index c50e8e5..da2fd36 100644
--- a/arch/nds32/lib/boot.c
+++ b/arch/nds32/lib/boot.c
@@ -9,7 +9,7 @@
 #include <command.h>
 
 unsigned long do_go_exec(ulong (*entry)(int, char * const []),
-			 int argc, char * const argv[])
+			 int argc, char *const argv[])
 {
 	cleanup_before_linux();
 
diff --git a/arch/nds32/lib/bootm.c b/arch/nds32/lib/bootm.c
index 1003bc8..ab539f4 100644
--- a/arch/nds32/lib/bootm.c
+++ b/arch/nds32/lib/bootm.c
@@ -6,10 +6,12 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <env.h>
 #include <hang.h>
 #include <image.h>
+#include <log.h>
 #include <u-boot/zlib.h>
 #include <asm/byteorder.h>
 #include <asm/bootm.h>
diff --git a/arch/nds32/lib/cache.c b/arch/nds32/lib/cache.c
index e11d300..21917e5 100644
--- a/arch/nds32/lib/cache.c
+++ b/arch/nds32/lib/cache.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+#include <asm/cache.h>
 static inline unsigned long CACHE_SET(unsigned char cache)
 {
 	if (cache == ICACHE)
diff --git a/arch/nios2/cpu/cpu.c b/arch/nios2/cpu/cpu.c
index 37ffa8f..7f5e731 100644
--- a/arch/nios2/cpu/cpu.c
+++ b/arch/nios2/cpu/cpu.c
@@ -5,12 +5,15 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
 #include <irq_func.h>
 #include <asm/cache.h>
+#include <asm/system.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -30,7 +33,7 @@
 }
 #endif
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	disable_interrupts();
 	/* indirect call to go beyond 256MB limitation of toolchain */
diff --git a/arch/nios2/cpu/interrupts.c b/arch/nios2/cpu/interrupts.c
index e9d1ff9..90cabb6 100644
--- a/arch/nios2/cpu/interrupts.c
+++ b/arch/nios2/cpu/interrupts.c
@@ -118,7 +118,7 @@
 
 /*************************************************************************/
 #if defined(CONFIG_CMD_IRQ)
-int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int i;
 	struct irq_action *act = vecs;
diff --git a/arch/nios2/lib/bootm.c b/arch/nios2/lib/bootm.c
index e189161..2c8f973 100644
--- a/arch/nios2/lib/bootm.c
+++ b/arch/nios2/lib/bootm.c
@@ -6,11 +6,15 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <env.h>
+#include <image.h>
 #include <irq_func.h>
+#include <log.h>
 
 #define NIOS_MAGIC 0x534f494e /* enable command line and initrd passing */
 
-int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char *const argv[],
+		   bootm_headers_t *images)
 {
 	void (*kernel)(int, int, int, char *) = (void *)images->ep;
 	char *commandline = env_get("bootargs");
diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index f4e25f1..cefbcf6 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -12,12 +12,14 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <irq_func.h>
+#include <net.h>
 #include <time.h>
 #include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <mpc83xx.h>
 #include <asm/processor.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <tsec.h>
 #include <netdev.h>
@@ -122,8 +124,7 @@
 #endif
 
 #ifndef CONFIG_SYSRESET
-int
-do_reset (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong msr;
 #ifndef MPC83xx_RESET
diff --git a/arch/powerpc/cpu/mpc83xx/cpu_init.c b/arch/powerpc/cpu/mpc83xx/cpu_init.c
index af8faca..438b14b 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu_init.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <asm-offsets.h>
 #include <mpc83xx.h>
 #include <ioports.h>
 #include <asm/io.h>
@@ -11,6 +12,7 @@
 #ifdef CONFIG_USB_EHCI_FSL
 #include <usb/ehci-ci.h>
 #endif
+#include <linux/delay.h>
 
 #include "lblaw/lblaw.h"
 #include "elbc/elbc.h"
diff --git a/arch/powerpc/cpu/mpc83xx/ecc.c b/arch/powerpc/cpu/mpc83xx/ecc.c
index a6eb7cb..1343dd3 100644
--- a/arch/powerpc/cpu/mpc83xx/ecc.c
+++ b/arch/powerpc/cpu/mpc83xx/ecc.c
@@ -96,7 +96,7 @@
 	       ddr->capture_attributes & ECC_CAPT_ATTR_VLD);
 }
 
-int do_ecc(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_ecc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	immap_t *immap = (immap_t *) CONFIG_SYS_IMMR;
 #ifdef CONFIG_SYS_FSL_DDR2
diff --git a/arch/powerpc/cpu/mpc83xx/interrupts.c b/arch/powerpc/cpu/mpc83xx/interrupts.c
index e83895d..d04f31d 100644
--- a/arch/powerpc/cpu/mpc83xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc83xx/interrupts.c
@@ -11,6 +11,7 @@
 #include <irq_func.h>
 #include <mpc83xx.h>
 #include <asm/processor.h>
+#include <asm/ptrace.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -71,8 +72,8 @@
  * irqinfo - print information about PCI devices
  */
 
-void
-do_irqinfo(cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char * const argv[])
+void do_irqinfo(struct cmd_tbl *cmdtp, bd_t *bd, int flag, int argc,
+		char *const argv[])
 {
 }
 
diff --git a/arch/powerpc/cpu/mpc83xx/law.c b/arch/powerpc/cpu/mpc83xx/law.c
index c49b4f7..5e02f40 100644
--- a/arch/powerpc/cpu/mpc83xx/law.c
+++ b/arch/powerpc/cpu/mpc83xx/law.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/fsl_law.h>
 #include <asm/mmu.h>
 #include <linux/log2.h>
diff --git a/arch/powerpc/cpu/mpc83xx/pci.c b/arch/powerpc/cpu/mpc83xx/pci.c
index 665ac37..f017985 100644
--- a/arch/powerpc/cpu/mpc83xx/pci.c
+++ b/arch/powerpc/cpu/mpc83xx/pci.c
@@ -7,7 +7,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <pci.h>
+#include <asm/bitops.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_OF_LIBFDT)
 #include <linux/libfdt.h>
diff --git a/arch/powerpc/cpu/mpc83xx/pcie.c b/arch/powerpc/cpu/mpc83xx/pcie.c
index b500ddd..785d480 100644
--- a/arch/powerpc/cpu/mpc83xx/pcie.c
+++ b/arch/powerpc/cpu/mpc83xx/pcie.c
@@ -11,6 +11,7 @@
 #include <pci.h>
 #include <mpc83xx.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/powerpc/cpu/mpc83xx/serdes.c b/arch/powerpc/cpu/mpc83xx/serdes.c
index 8242f95..bb963ee 100644
--- a/arch/powerpc/cpu/mpc83xx/serdes.c
+++ b/arch/powerpc/cpu/mpc83xx/serdes.c
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/fsl_mpc83xx_serdes.h>
+#include <linux/delay.h>
 
 /* SerDes registers */
 #define FSL_SRDSCR0_OFFS		0x0
diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
index 22506a5..aeff007 100644
--- a/arch/powerpc/cpu/mpc83xx/spd_sdram.c
+++ b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
@@ -14,6 +14,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <time.h>
 #include <vsprintf.h>
 #include <asm/processor.h>
@@ -22,6 +23,8 @@
 #include <spd.h>
 #include <asm/mmu.h>
 #include <spd_sdram.h>
+#include <asm/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index e2fc0b1..5c14aa1 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -523,7 +523,8 @@
 	return get_bus_freq(0);
 }
 
-static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_clocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	char buf[32];
 
diff --git a/arch/powerpc/cpu/mpc83xx/spl_minimal.c b/arch/powerpc/cpu/mpc83xx/spl_minimal.c
index 34c8187..2c61f2b 100644
--- a/arch/powerpc/cpu/mpc83xx/spl_minimal.c
+++ b/arch/powerpc/cpu/mpc83xx/spl_minimal.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <asm-offsets.h>
 #include <clock_legacy.h>
 #include <mpc83xx.h>
 #include <time.h>
diff --git a/arch/powerpc/cpu/mpc83xx/traps.c b/arch/powerpc/cpu/mpc83xx/traps.c
index 1c6c38b..c3cc119 100644
--- a/arch/powerpc/cpu/mpc83xx/traps.c
+++ b/arch/powerpc/cpu/mpc83xx/traps.c
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <asm/ptrace.h>
 #include <command.h>
 #include <kgdb.h>
 #include <asm/processor.h>
diff --git a/arch/powerpc/cpu/mpc85xx/bsc9132_serdes.c b/arch/powerpc/cpu/mpc85xx/bsc9132_serdes.c
index 8604f4a..b972cf3 100644
--- a/arch/powerpc/cpu/mpc85xx/bsc9132_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/bsc9132_serdes.c
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/c29x_serdes.c b/arch/powerpc/cpu/mpc85xx/c29x_serdes.c
index 97eeb48..34b58bb 100644
--- a/arch/powerpc/cpu/mpc85xx/c29x_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/c29x_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/cmd_errata.c b/arch/powerpc/cpu/mpc85xx/cmd_errata.c
index e455d8b..ff73596 100644
--- a/arch/powerpc/cpu/mpc85xx/cmd_errata.c
+++ b/arch/powerpc/cpu/mpc85xx/cmd_errata.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <init.h>
 #include <linux/compiler.h>
 #include <fsl_errata.h>
 #include <asm/processor.h>
@@ -128,7 +129,8 @@
 }
 #endif
 
-static int do_errata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_errata(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 #ifdef CONFIG_SYS_FSL_ERRATUM_NMG_CPU_A011
 	extern int enable_cpu_a011_workaround;
diff --git a/arch/powerpc/cpu/mpc85xx/commproc.c b/arch/powerpc/cpu/mpc85xx/commproc.c
index 37e7062..95215a0 100644
--- a/arch/powerpc/cpu/mpc85xx/commproc.c
+++ b/arch/powerpc/cpu/mpc85xx/commproc.c
@@ -22,6 +22,7 @@
  * currently no deallocator for this memory.
  */
 #include <common.h>
+#include <asm-offsets.h>
 #include <asm/cpm_85xx.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index 9f9eed1..9bd573d 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -11,7 +11,9 @@
 #include <config.h>
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <irq_func.h>
+#include <log.h>
 #include <time.h>
 #include <vsprintf.h>
 #include <watchdog.h>
@@ -27,6 +29,7 @@
 #include <asm/processor.h>
 #include <fsl_ddr_sdram.h>
 #include <asm/ppc.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -294,7 +297,7 @@
 
 /* ------------------------------------------------------------------------- */
 
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 /* Everything after the first generation of PQ3 parts has RSTCR */
 #if defined(CONFIG_ARCH_MPC8540) || defined(CONFIG_ARCH_MPC8541) || \
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init.c b/arch/powerpc/cpu/mpc85xx/cpu_init.c
index a9f39dc..4bca267 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <env.h>
 #include <init.h>
+#include <net.h>
 #include <watchdog.h>
 #include <asm/processor.h>
 #include <ioports.h>
@@ -32,6 +33,7 @@
 #include <fsl_usb.h>
 #include <hwconfig.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include "mp.h"
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
diff --git a/arch/powerpc/cpu/mpc85xx/cpu_init_early.c b/arch/powerpc/cpu/mpc85xx/cpu_init_early.c
index 40cb24d..c519e8b 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu_init_early.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu_init_early.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <asm-offsets.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/fsl_law.h>
diff --git a/arch/powerpc/cpu/mpc85xx/fdt.c b/arch/powerpc/cpu/mpc85xx/fdt.c
index 65f909f..55f191f 100644
--- a/arch/powerpc/cpu/mpc85xx/fdt.c
+++ b/arch/powerpc/cpu/mpc85xx/fdt.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <env.h>
+#include <log.h>
 #include <time.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
index d7a633d..ee5015e 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet2_serdes.c
@@ -4,11 +4,13 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/fsl_serdes.h>
 #include <asm/immap_85xx.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/fsl_law.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <fsl_errata.h>
 #include "fsl_corenet2_serdes.h"
diff --git a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
index ebdcd29..f5126e2 100644
--- a/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/fsl_corenet_serdes.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <time.h>
 #ifdef CONFIG_SYS_P4080_ERRATUM_SERDES8
 #include <hwconfig.h>
@@ -14,6 +15,7 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/fsl_law.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include "fsl_corenet_serdes.h"
 
diff --git a/arch/powerpc/cpu/mpc85xx/interrupts.c b/arch/powerpc/cpu/mpc85xx/interrupts.c
index 6f539d2..4ad7626 100644
--- a/arch/powerpc/cpu/mpc85xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc85xx/interrupts.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <irq_func.h>
+#include <log.h>
 #include <time.h>
 #include <watchdog.h>
 #include <command.h>
@@ -20,6 +21,7 @@
 #ifdef CONFIG_POST
 #include <post.h>
 #endif
+#include <asm/ptrace.h>
 
 void interrupt_init_cpu(unsigned *decrementer_count)
 {
@@ -102,7 +104,7 @@
 
 #if defined(CONFIG_CMD_IRQ)
 /* irqinfo - print information about PCI devices,not implemented. */
-int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc85xx/liodn.c b/arch/powerpc/cpu/mpc85xx/liodn.c
index e7703b8..e552378 100644
--- a/arch/powerpc/cpu/mpc85xx/liodn.c
+++ b/arch/powerpc/cpu/mpc85xx/liodn.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
diff --git a/arch/powerpc/cpu/mpc85xx/mp.c b/arch/powerpc/cpu/mpc85xx/mp.c
index 9757bff..8822cf2 100644
--- a/arch/powerpc/cpu/mpc85xx/mp.c
+++ b/arch/powerpc/cpu/mpc85xx/mp.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <log.h>
 #include <asm/processor.h>
 #include <env.h>
 #include <ioports.h>
@@ -14,6 +15,7 @@
 #include <asm/mmu.h>
 #include <asm/fsl_law.h>
 #include <fsl_ddr_sdram.h>
+#include <linux/delay.h>
 #include "mp.h"
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -140,7 +142,7 @@
 	BOOT_ENTRY_R3_LOWER,
 };
 
-int cpu_release(u32 nr, int argc, char * const argv[])
+int cpu_release(u32 nr, int argc, char *const argv[])
 {
 	u32 i, val, *table = (u32 *)&__spin_table + nr * NUM_BOOT_ENTRY;
 	u64 boot_addr;
diff --git a/arch/powerpc/cpu/mpc85xx/mpc8536_serdes.c b/arch/powerpc/cpu/mpc85xx/mpc8536_serdes.c
index c4c4154..111692f 100644
--- a/arch/powerpc/cpu/mpc85xx/mpc8536_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/mpc8536_serdes.c
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/mpc8544_serdes.c b/arch/powerpc/cpu/mpc85xx/mpc8544_serdes.c
index bdcf46e..f3b5450 100644
--- a/arch/powerpc/cpu/mpc85xx/mpc8544_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/mpc8544_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/mpc8548_serdes.c b/arch/powerpc/cpu/mpc85xx/mpc8548_serdes.c
index 99bab9e..2a5c3e3 100644
--- a/arch/powerpc/cpu/mpc85xx/mpc8548_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/mpc8548_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/mpc8568_serdes.c b/arch/powerpc/cpu/mpc85xx/mpc8568_serdes.c
index 414c058..81b66c3 100644
--- a/arch/powerpc/cpu/mpc85xx/mpc8568_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/mpc8568_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/mpc8569_serdes.c b/arch/powerpc/cpu/mpc85xx/mpc8569_serdes.c
index 6375228..eb54b82 100644
--- a/arch/powerpc/cpu/mpc85xx/mpc8569_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/mpc8569_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/mpc8572_serdes.c b/arch/powerpc/cpu/mpc85xx/mpc8572_serdes.c
index 0e0c63a..1b4e614 100644
--- a/arch/powerpc/cpu/mpc85xx/mpc8572_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/mpc8572_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/p1010_serdes.c b/arch/powerpc/cpu/mpc85xx/p1010_serdes.c
index cc907c5..8cba422 100644
--- a/arch/powerpc/cpu/mpc85xx/p1010_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/p1010_serdes.c
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/p1021_serdes.c b/arch/powerpc/cpu/mpc85xx/p1021_serdes.c
index 5090510..6b8e447 100644
--- a/arch/powerpc/cpu/mpc85xx/p1021_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/p1021_serdes.c
@@ -5,9 +5,11 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
+#include <linux/delay.h>
 
 typedef struct serdes_85xx {
 	u32	srdscr0;	/* 0x00 - SRDS Control Register 0 */
diff --git a/arch/powerpc/cpu/mpc85xx/p1022_serdes.c b/arch/powerpc/cpu/mpc85xx/p1022_serdes.c
index 4c51a72..719cb4f 100644
--- a/arch/powerpc/cpu/mpc85xx/p1022_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/p1022_serdes.c
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/p1023_serdes.c b/arch/powerpc/cpu/mpc85xx/p1023_serdes.c
index 482172d..bf5cac6 100644
--- a/arch/powerpc/cpu/mpc85xx/p1023_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/p1023_serdes.c
@@ -6,6 +6,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/p2020_serdes.c b/arch/powerpc/cpu/mpc85xx/p2020_serdes.c
index 1e7ed43..f36b1b6 100644
--- a/arch/powerpc/cpu/mpc85xx/p2020_serdes.c
+++ b/arch/powerpc/cpu/mpc85xx/p2020_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_85xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc85xx/pci.c b/arch/powerpc/cpu/mpc85xx/pci.c
index 1d0213a..9a6fc13 100644
--- a/arch/powerpc/cpu/mpc85xx/pci.c
+++ b/arch/powerpc/cpu/mpc85xx/pci.c
@@ -9,6 +9,7 @@
  * PCI Configuration space access support for MPC85xx PCI Bridge
  */
 #include <common.h>
+#include <asm/bitops.h>
 #include <asm/cpm_85xx.h>
 #include <pci.h>
 
diff --git a/arch/powerpc/cpu/mpc85xx/spl_minimal.c b/arch/powerpc/cpu/mpc85xx/spl_minimal.c
index 972049b..21b35db 100644
--- a/arch/powerpc/cpu/mpc85xx/spl_minimal.c
+++ b/arch/powerpc/cpu/mpc85xx/spl_minimal.c
@@ -8,6 +8,7 @@
 #include <asm/global_data.h>
 #include <fsl_ifc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/powerpc/cpu/mpc85xx/tlb.c b/arch/powerpc/cpu/mpc85xx/tlb.c
index 808d953..4465ae7 100644
--- a/arch/powerpc/cpu/mpc85xx/tlb.c
+++ b/arch/powerpc/cpu/mpc85xx/tlb.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <asm/bitops.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #ifdef CONFIG_ADDR_MAP
diff --git a/arch/powerpc/cpu/mpc85xx/traps.c b/arch/powerpc/cpu/mpc85xx/traps.c
index bc2fc93..f37a45e 100644
--- a/arch/powerpc/cpu/mpc85xx/traps.c
+++ b/arch/powerpc/cpu/mpc85xx/traps.c
@@ -20,6 +20,7 @@
  */
 
 #include <common.h>
+#include <asm/ptrace.h>
 #include <command.h>
 #include <init.h>
 #include <irq_func.h>
diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index 97b93f0..9f5bce3 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <time.h>
 #include <vsprintf.h>
 #include <watchdog.h>
@@ -107,7 +108,7 @@
 }
 
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	volatile immap_t *immap = (immap_t *)CONFIG_SYS_IMMR;
 	volatile ccsr_gur_t *gur = &immap->im_gur;
diff --git a/arch/powerpc/cpu/mpc86xx/cpu_init.c b/arch/powerpc/cpu/mpc86xx/cpu_init.c
index 89add62..a17091d 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu_init.c
@@ -9,8 +9,10 @@
  * cpu_init.c - low level cpu init
  */
 
+#include <asm-offsets.h>
 #include <config.h>
 #include <common.h>
+#include <init.h>
 #include <mpc86xx.h>
 #include <asm/mmu.h>
 #include <asm/fsl_law.h>
diff --git a/arch/powerpc/cpu/mpc86xx/interrupts.c b/arch/powerpc/cpu/mpc86xx/interrupts.c
index eb8e73e..5a91660 100644
--- a/arch/powerpc/cpu/mpc86xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc86xx/interrupts.c
@@ -16,6 +16,7 @@
 
 #include <common.h>
 #include <irq_func.h>
+#include <log.h>
 #include <mpc86xx.h>
 #include <command.h>
 #include <time.h>
@@ -23,6 +24,7 @@
 #ifdef CONFIG_POST
 #include <post.h>
 #endif
+#include <asm/ptrace.h>
 
 void interrupt_init_cpu(unsigned *decrementer_count)
 {
@@ -100,7 +102,7 @@
 /*
  * irqinfo - print information about PCI devices,not implemented.
  */
-int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return 0;
 }
diff --git a/arch/powerpc/cpu/mpc86xx/mp.c b/arch/powerpc/cpu/mpc86xx/mp.c
index 07c4c07..08d11ad 100644
--- a/arch/powerpc/cpu/mpc86xx/mp.c
+++ b/arch/powerpc/cpu/mpc86xx/mp.c
@@ -67,7 +67,7 @@
 	return 0;
 }
 
-int cpu_release(u32 nr, int argc, char * const argv[])
+int cpu_release(u32 nr, int argc, char *const argv[])
 {
 	/* dummy function so common/cmd_mp.c will build
 	 * should be implemented in the future */
diff --git a/arch/powerpc/cpu/mpc86xx/mpc8610_serdes.c b/arch/powerpc/cpu/mpc86xx/mpc8610_serdes.c
index 0e0a90e..ecc88ba 100644
--- a/arch/powerpc/cpu/mpc86xx/mpc8610_serdes.c
+++ b/arch/powerpc/cpu/mpc86xx/mpc8610_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_86xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc86xx/mpc8641_serdes.c b/arch/powerpc/cpu/mpc86xx/mpc8641_serdes.c
index d272d4b..4df4466 100644
--- a/arch/powerpc/cpu/mpc86xx/mpc8641_serdes.c
+++ b/arch/powerpc/cpu/mpc86xx/mpc8641_serdes.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/immap_86xx.h>
 #include <asm/fsl_serdes.h>
diff --git a/arch/powerpc/cpu/mpc86xx/traps.c b/arch/powerpc/cpu/mpc86xx/traps.c
index 79bab91..c0161e3 100644
--- a/arch/powerpc/cpu/mpc86xx/traps.c
+++ b/arch/powerpc/cpu/mpc86xx/traps.c
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <asm/ptrace.h>
 #include <command.h>
 #include <init.h>
 #include <kgdb.h>
diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 4a1698d..1b7c7fa 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -18,6 +18,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <net.h>
 #include <time.h>
 #include <vsprintf.h>
 #include <watchdog.h>
@@ -194,7 +195,7 @@
 
 /* ------------------------------------------------------------------------- */
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong msr, addr;
 
diff --git a/arch/powerpc/cpu/mpc8xx/cpu_init.c b/arch/powerpc/cpu/mpc8xx/cpu_init.c
index 8bd6d0f..c8d06b0 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu_init.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu_init.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <watchdog.h>
 
 #include <mpc8xx.h>
diff --git a/arch/powerpc/cpu/mpc8xx/immap.c b/arch/powerpc/cpu/mpc8xx/immap.c
index 442c01a..e5b62e9 100644
--- a/arch/powerpc/cpu/mpc8xx/immap.c
+++ b/arch/powerpc/cpu/mpc8xx/immap.c
@@ -18,7 +18,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int do_siuinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_siuinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	sysconf8xx_t __iomem *sc = &immap->im_siu_conf;
@@ -35,8 +36,8 @@
 	return 0;
 }
 
-static int do_memcinfo(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_memcinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	memctl8xx_t __iomem *memctl = &immap->im_memctl;
@@ -58,7 +59,8 @@
 	return 0;
 }
 
-static int do_carinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_carinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	car8xx_t __iomem *car = &immap->im_clkrst;
@@ -119,7 +121,8 @@
 #define PC_NBITS	12
 #define PD_NBITS	13
 
-static int do_iopinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_iopinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	iop8xx_t __iomem *iop = &immap->im_ioport;
@@ -172,7 +175,8 @@
  * this needs a clean up for smaller tighter code
  * use *uint and set the address based on cmd + port
  */
-static int do_iopset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_iopset(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	uint rcode = 0;
 	iopin_t iopin;
@@ -328,7 +332,8 @@
 	putc('\n');
 }
 
-static int do_brginfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_brginfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	immap_t __iomem *immap = (immap_t __iomem *)CONFIG_SYS_IMMR;
 	cpm8xx_t __iomem *cp = &immap->im_cpm;
diff --git a/arch/powerpc/cpu/mpc8xx/interrupts.c b/arch/powerpc/cpu/mpc8xx/interrupts.c
index 3efe895..eef1951 100644
--- a/arch/powerpc/cpu/mpc8xx/interrupts.c
+++ b/arch/powerpc/cpu/mpc8xx/interrupts.c
@@ -12,6 +12,7 @@
 #include <asm/cpm_8xx.h>
 #include <asm/processor.h>
 #include <asm/io.h>
+#include <asm/ptrace.h>
 
 /************************************************************************/
 
diff --git a/arch/powerpc/cpu/mpc8xx/traps.c b/arch/powerpc/cpu/mpc8xx/traps.c
index 899bcd8..56794b0 100644
--- a/arch/powerpc/cpu/mpc8xx/traps.c
+++ b/arch/powerpc/cpu/mpc8xx/traps.c
@@ -16,6 +16,7 @@
  */
 
 #include <common.h>
+#include <asm/ptrace.h>
 #include <command.h>
 #include <asm/processor.h>
 
diff --git a/arch/powerpc/cpu/mpc8xxx/cpu.c b/arch/powerpc/cpu/mpc8xxx/cpu.c
index ed482a9..da0a80e 100644
--- a/arch/powerpc/cpu/mpc8xxx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xxx/cpu.c
@@ -11,6 +11,8 @@
 #include <common.h>
 #include <command.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
 #include <tsec.h>
 #include <fm_eth.h>
 #include <netdev.h>
diff --git a/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c b/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c
index afcb75b..29489b4 100644
--- a/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c
+++ b/arch/powerpc/cpu/mpc8xxx/fsl_lbc.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <hang.h>
+#include <init.h>
 #include <asm/fsl_lbc.h>
 
 #ifdef CONFIG_MPC83xx
diff --git a/arch/powerpc/cpu/mpc8xxx/fsl_pamu.c b/arch/powerpc/cpu/mpc8xxx/fsl_pamu.c
index d81af70..2c378b7 100644
--- a/arch/powerpc/cpu/mpc8xxx/fsl_pamu.c
+++ b/arch/powerpc/cpu/mpc8xxx/fsl_pamu.c
@@ -6,6 +6,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/bitops.h>
 #include <linux/log2.h>
 #include <malloc.h>
 #include <asm/fsl_pamu.h>
diff --git a/arch/powerpc/cpu/mpc8xxx/law.c b/arch/powerpc/cpu/mpc8xxx/law.c
index ca9e6aa..e388386 100644
--- a/arch/powerpc/cpu/mpc8xxx/law.c
+++ b/arch/powerpc/cpu/mpc8xxx/law.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <asm/bitops.h>
 #include <linux/compiler.h>
 #include <asm/fsl_law.h>
 #include <asm/io.h>
diff --git a/arch/powerpc/cpu/mpc8xxx/pamu_table.c b/arch/powerpc/cpu/mpc8xxx/pamu_table.c
index 7b4690a..7dd71d2 100644
--- a/arch/powerpc/cpu/mpc8xxx/pamu_table.c
+++ b/arch/powerpc/cpu/mpc8xxx/pamu_table.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/fsl_pamu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/powerpc/cpu/mpc8xxx/srio.c b/arch/powerpc/cpu/mpc8xxx/srio.c
index a1f9403..c73cf93 100644
--- a/arch/powerpc/cpu/mpc8xxx/srio.c
+++ b/arch/powerpc/cpu/mpc8xxx/srio.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <config.h>
+#include <log.h>
 #include <time.h>
 #include <asm/fsl_law.h>
 #include <asm/fsl_serdes.h>
 #include <asm/fsl_srio.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 
 #ifdef CONFIG_SRIO_PCIE_BOOT_MASTER
diff --git a/arch/powerpc/include/asm/fsl_i2c.h b/arch/powerpc/include/asm/fsl_i2c.h
index fbf32b9..73105fa 100644
--- a/arch/powerpc/include/asm/fsl_i2c.h
+++ b/arch/powerpc/include/asm/fsl_i2c.h
@@ -14,6 +14,7 @@
 #define _ASM_FSL_I2C_H_
 
 #include <asm/types.h>
+#include <linux/compiler.h>
 
 typedef struct fsl_i2c_base {
 
diff --git a/arch/powerpc/include/asm/mmu.h b/arch/powerpc/include/asm/mmu.h
index 82e5f9f..353dc4e 100644
--- a/arch/powerpc/include/asm/mmu.h
+++ b/arch/powerpc/include/asm/mmu.h
@@ -7,6 +7,7 @@
 
 #ifndef __ASSEMBLY__
 /* Hardware Page Table Entry */
+#include <linux/bitops.h>
 typedef struct _PTE {
 #ifdef CONFIG_PPC64BRIDGE
 	unsigned long long vsid:52;
diff --git a/arch/powerpc/include/asm/u-boot.h b/arch/powerpc/include/asm/u-boot.h
index 1841565..19b3c0d 100644
--- a/arch/powerpc/include/asm/u-boot.h
+++ b/arch/powerpc/include/asm/u-boot.h
@@ -13,6 +13,8 @@
 #ifndef __U_BOOT_H__
 #define __U_BOOT_H__
 
+#include <config.h>
+
 /* For image.h:image_check_target_arch() */
 #define IH_ARCH_DEFAULT IH_ARCH_PPC
 
diff --git a/arch/powerpc/lib/bootm.c b/arch/powerpc/lib/bootm.c
index 390e8c0..cd92db0 100644
--- a/arch/powerpc/lib/bootm.c
+++ b/arch/powerpc/lib/bootm.c
@@ -8,9 +8,12 @@
 
 
 #include <common.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <env.h>
 #include <init.h>
+#include <lmb.h>
+#include <log.h>
 #include <watchdog.h>
 #include <command.h>
 #include <image.h>
@@ -51,8 +54,8 @@
 
 	kernel = (void (*)(bd_t *, ulong, ulong, ulong,
 			   ulong, ulong, ulong))images->ep;
-	debug ("## Transferring control to Linux (at address %08lx) ...\n",
-		(ulong)kernel);
+	debug("## Transferring control to Linux (at address %08lx) ...\n",
+	      (ulong)kernel);
 
 	bootstage_mark(BOOTSTAGE_ID_RUN_OS);
 
@@ -79,7 +82,7 @@
 		 *   r8: 0
 		 *   r9: 0
 		 */
-		debug ("   Booting using OF flat tree...\n");
+		debug("   Booting using OF flat tree...\n");
 		WATCHDOG_RESET ();
 		(*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
 			   env_get_bootm_mapsize(), 0, 0);
@@ -103,7 +106,7 @@
 		ulong initrd_end = images->initrd_end;
 		bd_t *kbd = images->kbd;
 
-		debug ("   Booting using board info...\n");
+		debug("   Booting using board info...\n");
 		WATCHDOG_RESET ();
 		(*kernel) (kbd, initrd_start, initrd_end,
 			   cmd_start, cmd_end, 0, 0);
@@ -147,7 +150,7 @@
 	 * pointer.
 	 */
 	sp = get_sp();
-	debug ("## Current stack ends at 0x%08lx\n", sp);
+	debug("## Current stack ends at 0x%08lx\n", sp);
 
 	/* adjust sp by 4K to be safe */
 	sp -= 4096;
@@ -230,8 +233,8 @@
 	return 0;
 }
 
-noinline
-int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
+noinline int do_bootm_linux(int flag, int argc, char *const argv[],
+			    bootm_headers_t *images)
 {
 	int	ret;
 
diff --git a/arch/powerpc/lib/extable.c b/arch/powerpc/lib/extable.c
index 683fd53..7e9d4f2 100644
--- a/arch/powerpc/lib/extable.c
+++ b/arch/powerpc/lib/extable.c
@@ -6,6 +6,7 @@
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  */
 #include <common.h>
+#include <log.h>
 
 /*
  * The exception table consists of pairs of addresses: the first is the
diff --git a/arch/powerpc/lib/interrupts.c b/arch/powerpc/lib/interrupts.c
index 64ee0cc..73f2700 100644
--- a/arch/powerpc/lib/interrupts.c
+++ b/arch/powerpc/lib/interrupts.c
@@ -14,6 +14,7 @@
 #ifdef CONFIG_LED_STATUS
 #include <status_led.h>
 #endif
+#include <asm/ptrace.h>
 
 #ifndef CONFIG_MPC83XX_TIMER
 #ifndef CONFIG_SYS_WATCHDOG_FREQ
diff --git a/arch/powerpc/lib/kgdb.c b/arch/powerpc/lib/kgdb.c
index f580c02..8727d18 100644
--- a/arch/powerpc/lib/kgdb.c
+++ b/arch/powerpc/lib/kgdb.c
@@ -1,6 +1,7 @@
 #include <common.h>
 #include <command.h>
 #include <kgdb.h>
+#include <asm/ptrace.h>
 #include <asm/signal.h>
 #include <asm/processor.h>
 
@@ -252,7 +253,7 @@
    the debugger. */
 
 void
-kgdb_breakpoint(int argc, char * const argv[])
+kgdb_breakpoint(int argc, char *const argv[])
 {
 	asm("	.globl breakinst\n\
 	     breakinst: .long 0x7d821008\n\
diff --git a/arch/powerpc/lib/spl.c b/arch/powerpc/lib/spl.c
index d90a6e2..d4a6057 100644
--- a/arch/powerpc/lib/spl.c
+++ b/arch/powerpc/lib/spl.c
@@ -4,6 +4,7 @@
  */
 #include <common.h>
 #include <config.h>
+#include <log.h>
 #include <spl.h>
 #include <image.h>
 #include <linux/compiler.h>
diff --git a/arch/powerpc/lib/stack.c b/arch/powerpc/lib/stack.c
index 9a956c2..5840fe6 100644
--- a/arch/powerpc/lib/stack.c
+++ b/arch/powerpc/lib/stack.c
@@ -11,6 +11,7 @@
  * Marius Groeger <mgroeger@sysgo.de>
  */
 #include <common.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/powerpc/lib/time.c b/arch/powerpc/lib/time.c
index e1494fa..8d6babf 100644
--- a/arch/powerpc/lib/time.c
+++ b/arch/powerpc/lib/time.c
@@ -5,8 +5,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 /* ------------------------------------------------------------------------- */
 
diff --git a/arch/riscv/cpu/ax25/cache.c b/arch/riscv/cpu/ax25/cache.c
index 9df629d..35f23c7 100644
--- a/arch/riscv/cpu/ax25/cache.c
+++ b/arch/riscv/cpu/ax25/cache.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <asm/cache.h>
 #include <dm/uclass-internal.h>
 #include <cache.h>
 #include <asm/csr.h>
diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
index e457f6a..5804aa8 100644
--- a/arch/riscv/cpu/cpu.c
+++ b/arch/riscv/cpu/cpu.c
@@ -6,9 +6,11 @@
 #include <common.h>
 #include <cpu.h>
 #include <dm.h>
+#include <init.h>
 #include <log.h>
 #include <asm/encoding.h>
 #include <dm/uclass-internal.h>
+#include <linux/bitops.h>
 
 /*
  * The variables here must be stored in the data section since they are used
diff --git a/arch/riscv/cpu/generic/cpu.c b/arch/riscv/cpu/generic/cpu.c
index 13a69ef..d78e1a3 100644
--- a/arch/riscv/cpu/generic/cpu.c
+++ b/arch/riscv/cpu/generic/cpu.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <irq_func.h>
+#include <asm/cache.h>
 
 /*
  * cleanup_before_linux() is called just before we call linux
diff --git a/arch/riscv/include/asm/encoding.h b/arch/riscv/include/asm/encoding.h
index a0695da..edafad3 100644
--- a/arch/riscv/include/asm/encoding.h
+++ b/arch/riscv/include/asm/encoding.h
@@ -8,6 +8,9 @@
 #define RISCV_CSR_ENCODING_H
 
 #include <asm/csr.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 #if CONFIG_IS_ENABLED(RISCV_SMODE)
 #define MODE_PREFIX(__suffix)	s##__suffix
diff --git a/arch/riscv/lib/boot.c b/arch/riscv/lib/boot.c
index 42b15a1..778d011 100644
--- a/arch/riscv/lib/boot.c
+++ b/arch/riscv/lib/boot.c
@@ -8,7 +8,7 @@
 #include <command.h>
 
 unsigned long do_go_exec(ulong (*entry)(int, char * const []),
-			 int argc, char * const argv[])
+			 int argc, char *const argv[])
 {
 	cleanup_before_linux();
 
diff --git a/arch/riscv/lib/bootm.c b/arch/riscv/lib/bootm.c
index 0d06095..c4137de 100644
--- a/arch/riscv/lib/bootm.c
+++ b/arch/riscv/lib/bootm.c
@@ -7,10 +7,12 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <dm.h>
 #include <fdt_support.h>
 #include <hang.h>
+#include <log.h>
 #include <dm/root.h>
 #include <image.h>
 #include <asm/byteorder.h>
@@ -105,7 +107,7 @@
 	}
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[],
+int do_bootm_linux(int flag, int argc, char *const argv[],
 		   bootm_headers_t *images)
 {
 	/* No need for those on RISC-V */
@@ -127,7 +129,7 @@
 	return 0;
 }
 
-int do_bootm_vxworks(int flag, int argc, char * const argv[],
+int do_bootm_vxworks(int flag, int argc, char *const argv[],
 		     bootm_headers_t *images)
 {
 	return do_bootm_linux(flag, argc, argv, images);
diff --git a/arch/riscv/lib/fdt_fixup.c b/arch/riscv/lib/fdt_fixup.c
index 20e0759..6db48ad 100644
--- a/arch/riscv/lib/fdt_fixup.c
+++ b/arch/riscv/lib/fdt_fixup.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <mapmem.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/riscv/lib/image.c b/arch/riscv/lib/image.c
index 7357d3b..91b7f16 100644
--- a/arch/riscv/lib/image.c
+++ b/arch/riscv/lib/image.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <mapmem.h>
 #include <errno.h>
 #include <linux/sizes.h>
diff --git a/arch/riscv/lib/reset.c b/arch/riscv/lib/reset.c
index ce3c1cf..8779c61 100644
--- a/arch/riscv/lib/reset.c
+++ b/arch/riscv/lib/reset.c
@@ -7,7 +7,7 @@
 #include <command.h>
 #include <hang.h>
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	printf("resetting ...\n");
 
diff --git a/arch/riscv/lib/spl.c b/arch/riscv/lib/spl.c
index 4ca038b..c47dcd4 100644
--- a/arch/riscv/lib/spl.c
+++ b/arch/riscv/lib/spl.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/smp.h>
 
diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 56ee3f5..fb857e5 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -4,9 +4,12 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <os.h>
 #include <asm/io.h>
diff --git a/arch/sandbox/cpu/spl.c b/arch/sandbox/cpu/spl.c
index d5f683b..7ab8919 100644
--- a/arch/sandbox/cpu/spl.c
+++ b/arch/sandbox/cpu/spl.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <os.h>
 #include <spl.h>
 #include <asm/spl.h>
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index b6ff5c3..c6a2bbe 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <errno.h>
+#include <init.h>
 #include <os.h>
 #include <cli.h>
 #include <sort.h>
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index a347cec..1f79412 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <os.h>
 #include <asm/malloc.h>
 #include <asm/state.h>
diff --git a/arch/sandbox/include/asm/eth.h b/arch/sandbox/include/asm/eth.h
index 477fa00..b313bf5 100644
--- a/arch/sandbox/include/asm/eth.h
+++ b/arch/sandbox/include/asm/eth.h
@@ -9,6 +9,8 @@
 #ifndef __ETH_H
 #define __ETH_H
 
+#include <net.h>
+
 void sandbox_eth_disable_response(int index, bool disable);
 
 void sandbox_eth_skip_timeout(void);
diff --git a/arch/sandbox/lib/bootm.c b/arch/sandbox/lib/bootm.c
index 2de03fb..d1d460b 100644
--- a/arch/sandbox/lib/bootm.c
+++ b/arch/sandbox/lib/bootm.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
+#include <image.h>
 #include <asm/io.h>
 
 #define	LINUX_ARM_ZIMAGE_MAGIC	0x016f2818
diff --git a/arch/sandbox/lib/pci_io.c b/arch/sandbox/lib/pci_io.c
index f22e47c..2038141 100644
--- a/arch/sandbox/lib/pci_io.c
+++ b/arch/sandbox/lib/pci_io.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/io.h>
 
 int pci_map_physmem(phys_addr_t paddr, unsigned long *lenp,
diff --git a/arch/sh/cpu/sh4/cache.c b/arch/sh/cpu/sh4/cache.c
index 2f49ce8..0f7dfdd 100644
--- a/arch/sh/cpu/sh4/cache.c
+++ b/arch/sh/cpu/sh4/cache.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <command.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/system.h>
diff --git a/arch/sh/cpu/sh4/cpu.c b/arch/sh/cpu/sh4/cpu.c
index a8d0590..f032d88 100644
--- a/arch/sh/cpu/sh4/cpu.c
+++ b/arch/sh/cpu/sh4/cpu.c
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <irq_func.h>
 #include <cpu_func.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/processor.h>
 
@@ -28,7 +29,7 @@
 	return 0;
 }
 
-int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	disable_interrupts();
 	reset_cpu(0);
diff --git a/arch/sh/lib/bootm.c b/arch/sh/lib/bootm.c
index 2896e45..dc94f83 100644
--- a/arch/sh/lib/bootm.c
+++ b/arch/sh/lib/bootm.c
@@ -9,6 +9,8 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
+#include <image.h>
 #include <asm/byteorder.h>
 #include <asm/zimage.h>
 
@@ -49,7 +51,8 @@
 	return val;
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char *const argv[],
+		   bootm_headers_t *images)
 {
 	/* Linux kernel load address */
 	void (*kernel) (void) = (void (*)(void))images->ep;
diff --git a/arch/sh/lib/time.c b/arch/sh/lib/time.c
index 51e1cc1..f951544 100644
--- a/arch/sh/lib/time.c
+++ b/arch/sh/lib/time.c
@@ -11,8 +11,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/processor.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_RMOBILE)
 #define TSTR	0x4
diff --git a/arch/sh/lib/time_sh2.c b/arch/sh/lib/time_sh2.c
index d82c1d2..5484c54 100644
--- a/arch/sh/lib/time_sh2.c
+++ b/arch/sh/lib/time_sh2.c
@@ -8,9 +8,11 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/processor.h>
+#include <linux/delay.h>
 
 #define CMT_CMCSR_INIT	0x0001	/* PCLK/32 */
 #define CMT_CMCSR_CALIB 0x0000
diff --git a/arch/sh/lib/zimageboot.c b/arch/sh/lib/zimageboot.c
index 602776a..c38f093 100644
--- a/arch/sh/lib/zimageboot.c
+++ b/arch/sh/lib/zimageboot.c
@@ -10,11 +10,14 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <env.h>
 #include <irq_func.h>
 #include <asm/io.h>
 #include <asm/zimage.h>
 
-int do_sh_zimageboot (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_sh_zimageboot(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	ulong (*zboot_entry)(int, char * const []) = NULL;
 	char *s0, *s1;
diff --git a/arch/x86/cpu/acpi_gpe.c b/arch/x86/cpu/acpi_gpe.c
index 5500545..8aa2009 100644
--- a/arch/x86/cpu/acpi_gpe.c
+++ b/arch/x86/cpu/acpi_gpe.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <irq.h>
+#include <log.h>
 #include <asm/io.h>
 
 /**
diff --git a/arch/x86/cpu/apollolake/cpu_spl.c b/arch/x86/cpu/apollolake/cpu_spl.c
index e2509e3..707ceb3 100644
--- a/arch/x86/cpu/apollolake/cpu_spl.c
+++ b/arch/x86/cpu/apollolake/cpu_spl.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <ec_commands.h>
+#include <init.h>
 #include <log.h>
 #include <spi_flash.h>
 #include <spl.h>
diff --git a/arch/x86/cpu/apollolake/fsp_m.c b/arch/x86/cpu/apollolake/fsp_m.c
index 5308af8..56ce59d 100644
--- a/arch/x86/cpu/apollolake/fsp_m.c
+++ b/arch/x86/cpu/apollolake/fsp_m.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/iomap.h>
 #include <asm/arch/fsp/fsp_configs.h>
 #include <asm/arch/fsp/fsp_m_upd.h>
diff --git a/arch/x86/cpu/apollolake/fsp_s.c b/arch/x86/cpu/apollolake/fsp_s.c
index 7ef169b..3e303f8 100644
--- a/arch/x86/cpu/apollolake/fsp_s.c
+++ b/arch/x86/cpu/apollolake/fsp_s.c
@@ -6,8 +6,11 @@
 
 #include <common.h>
 #include <binman.h>
+#include <bootstage.h>
 #include <dm.h>
+#include <init.h>
 #include <irq.h>
+#include <log.h>
 #include <malloc.h>
 #include <acpi/acpi_s3.h>
 #include <asm/intel_pinctrl.h>
@@ -20,6 +23,7 @@
 #include <asm/arch/systemagent.h>
 #include <asm/arch/fsp/fsp_configs.h>
 #include <asm/arch/fsp/fsp_s_upd.h>
+#include <linux/bitops.h>
 
 #define PCH_P2SB_E0		0xe0
 #define HIDE_BIT		BIT(0)
diff --git a/arch/x86/cpu/apollolake/hostbridge.c b/arch/x86/cpu/apollolake/hostbridge.c
index 793853d..cb46ec6 100644
--- a/arch/x86/cpu/apollolake/hostbridge.c
+++ b/arch/x86/cpu/apollolake/hostbridge.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <dt-structs.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/intel_pinctrl.h>
 #include <asm/intel_regs.h>
diff --git a/arch/x86/cpu/apollolake/lpc.c b/arch/x86/cpu/apollolake/lpc.c
index 45b2144..b81a458 100644
--- a/arch/x86/cpu/apollolake/lpc.c
+++ b/arch/x86/cpu/apollolake/lpc.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/lpc_common.h>
 #include <asm/pci.h>
diff --git a/arch/x86/cpu/apollolake/pmc.c b/arch/x86/cpu/apollolake/pmc.c
index 4ea7c74..192dec7 100644
--- a/arch/x86/cpu/apollolake/pmc.c
+++ b/arch/x86/cpu/apollolake/pmc.c
@@ -11,10 +11,12 @@
 #include <common.h>
 #include <dt-structs.h>
 #include <dm.h>
+#include <log.h>
 #include <spl.h>
 #include <acpi/acpi_s3.h>
 #include <asm/io.h>
 #include <asm/pci.h>
+#include <linux/bitops.h>
 #include <power/acpi_pmc.h>
 
 #define GPIO_GPE_CFG		0x1050
diff --git a/arch/x86/cpu/apollolake/punit.c b/arch/x86/cpu/apollolake/punit.c
index 1a131fb..e76f280 100644
--- a/arch/x86/cpu/apollolake/punit.c
+++ b/arch/x86/cpu/apollolake/punit.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/cpu.h>
 #include <asm/cpu_common.h>
@@ -12,6 +13,7 @@
 #include <asm/io.h>
 #include <asm/pci.h>
 #include <asm/arch/systemagent.h>
+#include <linux/delay.h>
 
 /*
  * Punit Initialisation code. This all isn't documented, but
diff --git a/arch/x86/cpu/apollolake/spl.c b/arch/x86/cpu/apollolake/spl.c
index d32f2a9..5a53831 100644
--- a/arch/x86/cpu/apollolake/spl.c
+++ b/arch/x86/cpu/apollolake/spl.c
@@ -5,7 +5,10 @@
 
 #include <common.h>
 #include <binman_sym.h>
+#include <bootstage.h>
 #include <dm.h>
+#include <image.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spl.h>
diff --git a/arch/x86/cpu/baytrail/acpi.c b/arch/x86/cpu/baytrail/acpi.c
index 5772310..65f2006 100644
--- a/arch/x86/cpu/baytrail/acpi.c
+++ b/arch/x86/cpu/baytrail/acpi.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu.h>
 #include <dm.h>
+#include <log.h>
 #include <acpi/acpi_s3.h>
 #include <acpi/acpi_table.h>
 #include <asm/io.h>
diff --git a/arch/x86/cpu/baytrail/cpu.c b/arch/x86/cpu/baytrail/cpu.c
index a9cfced..18e48ff 100644
--- a/arch/x86/cpu/baytrail/cpu.c
+++ b/arch/x86/cpu/baytrail/cpu.c
@@ -9,6 +9,7 @@
 #include <cpu.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/cpu.h>
 #include <asm/cpu_x86.h>
diff --git a/arch/x86/cpu/baytrail/fsp_configs.c b/arch/x86/cpu/baytrail/fsp_configs.c
index 1d1948c..21816ce 100644
--- a/arch/x86/cpu/baytrail/fsp_configs.c
+++ b/arch/x86/cpu/baytrail/fsp_configs.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/fsp1/fsp_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/baytrail/valleyview.c b/arch/x86/cpu/baytrail/valleyview.c
index f2e48f4..f73738c 100644
--- a/arch/x86/cpu/baytrail/valleyview.c
+++ b/arch/x86/cpu/baytrail/valleyview.c
@@ -11,6 +11,7 @@
 #include <asm/mrccache.h>
 #include <asm/post.h>
 #include <asm/arch/iomap.h>
+#include <linux/bitops.h>
 
 /* GPIO SUS */
 #define GPIO_SUS_PAD_BASE	(IO_BASE_ADDRESS + IO_BASE_OFFSET_GPSSUS)
diff --git a/arch/x86/cpu/braswell/braswell.c b/arch/x86/cpu/braswell/braswell.c
index 7a83b06..3345049 100644
--- a/arch/x86/cpu/braswell/braswell.c
+++ b/arch/x86/cpu/braswell/braswell.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/mrccache.h>
 #include <asm/post.h>
 
diff --git a/arch/x86/cpu/braswell/fsp_configs.c b/arch/x86/cpu/braswell/fsp_configs.c
index 60101d7..9e710a9 100644
--- a/arch/x86/cpu/braswell/fsp_configs.c
+++ b/arch/x86/cpu/braswell/fsp_configs.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/fsp1/fsp_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/broadwell/adsp.c b/arch/x86/cpu/broadwell/adsp.c
index 2ac8cea..41f7d5d 100644
--- a/arch/x86/cpu/broadwell/adsp.c
+++ b/arch/x86/cpu/broadwell/adsp.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/io.h>
 #include <asm/cpu.h>
diff --git a/arch/x86/cpu/broadwell/cpu.c b/arch/x86/cpu/broadwell/cpu.c
index 55a7439..b773011 100644
--- a/arch/x86/cpu/broadwell/cpu.c
+++ b/arch/x86/cpu/broadwell/cpu.c
@@ -8,6 +8,8 @@
 #include <common.h>
 #include <dm.h>
 #include <cpu.h>
+#include <init.h>
+#include <log.h>
 #include <asm/cpu.h>
 #include <asm/cpu_x86.h>
 #include <asm/cpu_common.h>
diff --git a/arch/x86/cpu/broadwell/cpu_from_spl.c b/arch/x86/cpu/broadwell/cpu_from_spl.c
index 2aa6f24..6567d50 100644
--- a/arch/x86/cpu/broadwell/cpu_from_spl.c
+++ b/arch/x86/cpu/broadwell/cpu_from_spl.c
@@ -9,6 +9,8 @@
 #include <cpu_func.h>
 #include <debug_uart.h>
 #include <handoff.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mtrr.h>
 
 int misc_init_r(void)
diff --git a/arch/x86/cpu/broadwell/cpu_full.c b/arch/x86/cpu/broadwell/cpu_full.c
index 895edeb..64a1cd4 100644
--- a/arch/x86/cpu/broadwell/cpu_full.c
+++ b/arch/x86/cpu/broadwell/cpu_full.c
@@ -8,6 +8,8 @@
 #include <common.h>
 #include <dm.h>
 #include <cpu.h>
+#include <init.h>
+#include <log.h>
 #include <asm/cpu.h>
 #include <asm/cpu_x86.h>
 #include <asm/cpu_common.h>
@@ -18,6 +20,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/pch.h>
 #include <asm/arch/rcb.h>
+#include <linux/delay.h>
 
 struct cpu_broadwell_priv {
 	bool ht_disabled;
diff --git a/arch/x86/cpu/broadwell/iobp.c b/arch/x86/cpu/broadwell/iobp.c
index 8a3ca6c..cb5595c 100644
--- a/arch/x86/cpu/broadwell/iobp.c
+++ b/arch/x86/cpu/broadwell/iobp.c
@@ -10,6 +10,7 @@
 #include <asm/intel_regs.h>
 #include <asm/io.h>
 #include <asm/arch/pch.h>
+#include <linux/delay.h>
 
 #define IOBP_RETRY 1000
 
diff --git a/arch/x86/cpu/broadwell/lpc.c b/arch/x86/cpu/broadwell/lpc.c
index 9dc9b63..5669a02 100644
--- a/arch/x86/cpu/broadwell/lpc.c
+++ b/arch/x86/cpu/broadwell/lpc.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pch.h>
 #include <asm/intel_regs.h>
 #include <asm/io.h>
diff --git a/arch/x86/cpu/broadwell/me.c b/arch/x86/cpu/broadwell/me.c
index adc656c..ae16ce2 100644
--- a/arch/x86/cpu/broadwell/me.c
+++ b/arch/x86/cpu/broadwell/me.c
@@ -7,7 +7,9 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/arch/me.h>
+#include <linux/delay.h>
 
 static inline void me_read_dword_ptr(struct udevice *dev, void *ptr, int offset)
 {
diff --git a/arch/x86/cpu/broadwell/pch.c b/arch/x86/cpu/broadwell/pch.c
index a48945a..9bcf211 100644
--- a/arch/x86/cpu/broadwell/pch.c
+++ b/arch/x86/cpu/broadwell/pch.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pch.h>
 #include <asm/cpu.h>
 #include <asm/gpio.h>
@@ -23,6 +24,7 @@
 #include <asm/arch/serialio.h>
 #include <asm/arch/spi.h>
 #include <dm/uclass-internal.h>
+#include <linux/delay.h>
 
 #define BIOS_CTRL	0xdc
 
diff --git a/arch/x86/cpu/broadwell/pinctrl_broadwell.c b/arch/x86/cpu/broadwell/pinctrl_broadwell.c
index aa83abb..0ead13a 100644
--- a/arch/x86/cpu/broadwell/pinctrl_broadwell.c
+++ b/arch/x86/cpu/broadwell/pinctrl_broadwell.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <pch.h>
 #include <pci.h>
 #include <asm/cpu.h>
diff --git a/arch/x86/cpu/broadwell/power_state.c b/arch/x86/cpu/broadwell/power_state.c
index 09fda48..99d6f72 100644
--- a/arch/x86/cpu/broadwell/power_state.c
+++ b/arch/x86/cpu/broadwell/power_state.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/io.h>
 #include <asm/intel_regs.h>
diff --git a/arch/x86/cpu/broadwell/refcode.c b/arch/x86/cpu/broadwell/refcode.c
index f016489..6c04dde 100644
--- a/arch/x86/cpu/broadwell/refcode.c
+++ b/arch/x86/cpu/broadwell/refcode.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/pei_data.h>
 
 #define RMODULE_MAGIC		0xf8fe
diff --git a/arch/x86/cpu/broadwell/sata.c b/arch/x86/cpu/broadwell/sata.c
index d89e0a1..641da51 100644
--- a/arch/x86/cpu/broadwell/sata.c
+++ b/arch/x86/cpu/broadwell/sata.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/intel_regs.h>
@@ -14,6 +15,7 @@
 #include <asm/pch_common.h>
 #include <asm/pch_common.h>
 #include <asm/arch/pch.h>
+#include <linux/delay.h>
 
 struct sata_platdata {
 	int port_map;
diff --git a/arch/x86/cpu/broadwell/sdram.c b/arch/x86/cpu/broadwell/sdram.c
index 15bfc58..72f59a0 100644
--- a/arch/x86/cpu/broadwell/sdram.c
+++ b/arch/x86/cpu/broadwell/sdram.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <syscon.h>
 #include <asm/cpu.h>
diff --git a/arch/x86/cpu/coreboot/coreboot.c b/arch/x86/cpu/coreboot/coreboot.c
index 624caf6..d44db13 100644
--- a/arch/x86/cpu/coreboot/coreboot.c
+++ b/arch/x86/cpu/coreboot/coreboot.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <usb.h>
 #include <asm/io.h>
 #include <asm/msr.h>
diff --git a/arch/x86/cpu/coreboot/timestamp.c b/arch/x86/cpu/coreboot/timestamp.c
index e8ccaf2..0162597 100644
--- a/arch/x86/cpu/coreboot/timestamp.c
+++ b/arch/x86/cpu/coreboot/timestamp.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <asm/arch/timestamp.h>
 #include <asm/arch/sysinfo.h>
 #include <linux/compiler.h>
diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index 2e5d0dd..a814e7d 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -19,11 +19,13 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <acpi/acpi_s3.h>
diff --git a/arch/x86/cpu/efi/app.c b/arch/x86/cpu/efi/app.c
index 1307741..10677ec 100644
--- a/arch/x86/cpu/efi/app.c
+++ b/arch/x86/cpu/efi/app.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <netdev.h>
 
 int arch_cpu_init(void)
diff --git a/arch/x86/cpu/efi/payload.c b/arch/x86/cpu/efi/payload.c
index 66df128..71619f6 100644
--- a/arch/x86/cpu/efi/payload.c
+++ b/arch/x86/cpu/efi/payload.c
@@ -9,6 +9,7 @@
 #include <efi.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 #include <usb.h>
 #include <asm/bootparam.h>
 #include <asm/e820.h>
diff --git a/arch/x86/cpu/i386/interrupt.c b/arch/x86/cpu/i386/interrupt.c
index e67a116..c0c4bc9 100644
--- a/arch/x86/cpu/i386/interrupt.c
+++ b/arch/x86/cpu/i386/interrupt.c
@@ -23,6 +23,7 @@
 #include <asm/io.h>
 #include <asm/lapic.h>
 #include <asm/processor-flags.h>
+#include <asm/ptrace.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/x86/cpu/intel_common/cpu.c b/arch/x86/cpu/intel_common/cpu.c
index 4d093a5..509730a 100644
--- a/arch/x86/cpu/intel_common/cpu.c
+++ b/arch/x86/cpu/intel_common/cpu.c
@@ -11,6 +11,7 @@
 #include <cpu.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/cpu.h>
 #include <asm/cpu_common.h>
 #include <asm/intel_regs.h>
diff --git a/arch/x86/cpu/intel_common/cpu_from_spl.c b/arch/x86/cpu/intel_common/cpu_from_spl.c
index b7bb524..e4157c5 100644
--- a/arch/x86/cpu/intel_common/cpu_from_spl.c
+++ b/arch/x86/cpu/intel_common/cpu_from_spl.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <handoff.h>
+#include <init.h>
 #include <asm/cpu_common.h>
 #include <asm/intel_regs.h>
 #include <asm/lapic.h>
diff --git a/arch/x86/cpu/intel_common/itss.c b/arch/x86/cpu/intel_common/itss.c
index e4f785c..963afa8 100644
--- a/arch/x86/cpu/intel_common/itss.c
+++ b/arch/x86/cpu/intel_common/itss.c
@@ -13,6 +13,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <irq.h>
+#include <log.h>
 #include <malloc.h>
 #include <p2sb.h>
 #include <spl.h>
diff --git a/arch/x86/cpu/intel_common/lpc.c b/arch/x86/cpu/intel_common/lpc.c
index 2a538cf..3420f03 100644
--- a/arch/x86/cpu/intel_common/lpc.c
+++ b/arch/x86/cpu/intel_common/lpc.c
@@ -12,6 +12,7 @@
 #include <asm/intel_regs.h>
 #include <asm/io.h>
 #include <asm/lpc_common.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/x86/cpu/intel_common/me_status.c b/arch/x86/cpu/intel_common/me_status.c
index fc9efbf..abc5f6f 100644
--- a/arch/x86/cpu/intel_common/me_status.c
+++ b/arch/x86/cpu/intel_common/me_status.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/me.h>
 
 /* HFS1[3:0] Current Working State Values */
diff --git a/arch/x86/cpu/intel_common/microcode.c b/arch/x86/cpu/intel_common/microcode.c
index c7a539d..0355d3c 100644
--- a/arch/x86/cpu/intel_common/microcode.c
+++ b/arch/x86/cpu/intel_common/microcode.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <asm/cpu.h>
 #include <asm/microcode.h>
diff --git a/arch/x86/cpu/intel_common/mrc.c b/arch/x86/cpu/intel_common/mrc.c
index 755670a..73bfd12 100644
--- a/arch/x86/cpu/intel_common/mrc.c
+++ b/arch/x86/cpu/intel_common/mrc.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <syscon.h>
 #include <asm/cpu.h>
 #include <asm/gpio.h>
diff --git a/arch/x86/cpu/intel_common/p2sb.c b/arch/x86/cpu/intel_common/p2sb.c
index 6f3c441..ec35d04 100644
--- a/arch/x86/cpu/intel_common/p2sb.c
+++ b/arch/x86/cpu/intel_common/p2sb.c
@@ -10,9 +10,11 @@
 #include <common.h>
 #include <dm.h>
 #include <dt-structs.h>
+#include <log.h>
 #include <p2sb.h>
 #include <spl.h>
 #include <asm/pci.h>
+#include <linux/bitops.h>
 
 struct p2sb_platdata {
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
diff --git a/arch/x86/cpu/intel_common/report_platform.c b/arch/x86/cpu/intel_common/report_platform.c
index 0f217c1..a361281 100644
--- a/arch/x86/cpu/intel_common/report_platform.c
+++ b/arch/x86/cpu/intel_common/report_platform.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/cpu.h>
 #include <asm/pci.h>
 #include <asm/report_platform.h>
diff --git a/arch/x86/cpu/ioapic.c b/arch/x86/cpu/ioapic.c
index 01ade76..4f99de6 100644
--- a/arch/x86/cpu/ioapic.c
+++ b/arch/x86/cpu/ioapic.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/ioapic.h>
 #include <asm/lapic.h>
diff --git a/arch/x86/cpu/irq.c b/arch/x86/cpu/irq.c
index bafa031..836a0e8 100644
--- a/arch/x86/cpu/irq.c
+++ b/arch/x86/cpu/irq.c
@@ -8,6 +8,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <irq.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <asm/irq.h>
diff --git a/arch/x86/cpu/ivybridge/bd82x6x.c b/arch/x86/cpu/ivybridge/bd82x6x.c
index 1cb6cec..5448f06 100644
--- a/arch/x86/cpu/ivybridge/bd82x6x.c
+++ b/arch/x86/cpu/ivybridge/bd82x6x.c
@@ -6,6 +6,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <pch.h>
 #include <asm/cpu.h>
@@ -17,6 +18,8 @@
 #include <asm/arch/model_206ax.h>
 #include <asm/arch/pch.h>
 #include <asm/arch/sandybridge.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/x86/cpu/ivybridge/cpu.c b/arch/x86/cpu/ivybridge/cpu.c
index 8f30cdb..cb6eded 100644
--- a/arch/x86/cpu/ivybridge/cpu.c
+++ b/arch/x86/cpu/ivybridge/cpu.c
@@ -15,6 +15,8 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <log.h>
 #include <pch.h>
 #include <asm/cpu.h>
 #include <asm/cpu_common.h>
diff --git a/arch/x86/cpu/ivybridge/early_me.c b/arch/x86/cpu/ivybridge/early_me.c
index 219d5be..bee1671 100644
--- a/arch/x86/cpu/ivybridge/early_me.c
+++ b/arch/x86/cpu/ivybridge/early_me.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <sysreset.h>
 #include <asm/pci.h>
 #include <asm/cpu.h>
@@ -15,6 +16,7 @@
 #include <asm/arch/me.h>
 #include <asm/arch/pch.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 static const char *const me_ack_values[] = {
 	[ME_HFS_ACK_NO_DID]	= "No DID Ack received",
diff --git a/arch/x86/cpu/ivybridge/fsp_configs.c b/arch/x86/cpu/ivybridge/fsp_configs.c
index 0e6453c..41d7d2a 100644
--- a/arch/x86/cpu/ivybridge/fsp_configs.c
+++ b/arch/x86/cpu/ivybridge/fsp_configs.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/fsp1/fsp_support.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/ivybridge/ivybridge.c b/arch/x86/cpu/ivybridge/ivybridge.c
index 8d10fd6..eb3f362 100644
--- a/arch/x86/cpu/ivybridge/ivybridge.c
+++ b/arch/x86/cpu/ivybridge/ivybridge.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/post.h>
 #include <asm/processor.h>
 
diff --git a/arch/x86/cpu/ivybridge/lpc.c b/arch/x86/cpu/ivybridge/lpc.c
index d9ddcdc..85fd2a9 100644
--- a/arch/x86/cpu/ivybridge/lpc.c
+++ b/arch/x86/cpu/ivybridge/lpc.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <rtc.h>
 #include <pci.h>
 #include <asm/intel_regs.h>
diff --git a/arch/x86/cpu/ivybridge/model_206ax.c b/arch/x86/cpu/ivybridge/model_206ax.c
index 56ab6bf..5954a24 100644
--- a/arch/x86/cpu/ivybridge/model_206ax.c
+++ b/arch/x86/cpu/ivybridge/model_206ax.c
@@ -10,6 +10,7 @@
 #include <cpu.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/cpu.h>
 #include <asm/cpu_common.h>
diff --git a/arch/x86/cpu/ivybridge/northbridge.c b/arch/x86/cpu/ivybridge/northbridge.c
index 0f427af..b713fcb 100644
--- a/arch/x86/cpu/ivybridge/northbridge.c
+++ b/arch/x86/cpu/ivybridge/northbridge.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/msr.h>
 #include <asm/cpu.h>
 #include <asm/intel_regs.h>
@@ -17,6 +18,7 @@
 #include <asm/arch/pch.h>
 #include <asm/arch/model_206ax.h>
 #include <asm/arch/sandybridge.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/x86/cpu/ivybridge/sata.c b/arch/x86/cpu/ivybridge/sata.c
index fc6c427..025b20b 100644
--- a/arch/x86/cpu/ivybridge/sata.c
+++ b/arch/x86/cpu/ivybridge/sata.c
@@ -8,6 +8,7 @@
 #include <ahci.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/pch_common.h>
 #include <asm/pci.h>
diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c
index cf34f94..99bc480 100644
--- a/arch/x86/cpu/ivybridge/sdram.c
+++ b/arch/x86/cpu/ivybridge/sdram.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <rtc.h>
diff --git a/arch/x86/cpu/ivybridge/sdram_nop.c b/arch/x86/cpu/ivybridge/sdram_nop.c
index c55213c..54e6acf 100644
--- a/arch/x86/cpu/ivybridge/sdram_nop.c
+++ b/arch/x86/cpu/ivybridge/sdram_nop.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/arch/x86/cpu/lapic.c b/arch/x86/cpu/lapic.c
index 44ed446..c069145 100644
--- a/arch/x86/cpu/lapic.c
+++ b/arch/x86/cpu/lapic.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/lapic.h>
 #include <asm/msr.h>
diff --git a/arch/x86/cpu/mp_init.c b/arch/x86/cpu/mp_init.c
index 7b09f90..7fde4ff 100644
--- a/arch/x86/cpu/mp_init.c
+++ b/arch/x86/cpu/mp_init.c
@@ -9,6 +9,7 @@
 #include <cpu.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <qfw.h>
 #include <asm/atomic.h>
@@ -25,6 +26,7 @@
 #include <dm/uclass-internal.h>
 #include <dm/lists.h>
 #include <dm/root.h>
+#include <linux/delay.h>
 #include <linux/linkage.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/mtrr.c b/arch/x86/cpu/mtrr.c
index a43cb7f..7ec0733 100644
--- a/arch/x86/cpu/mtrr.c
+++ b/arch/x86/cpu/mtrr.c
@@ -18,6 +18,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/msr.h>
 #include <asm/mtrr.h>
diff --git a/arch/x86/cpu/pci.c b/arch/x86/cpu/pci.c
index e1aae15..d4f9290 100644
--- a/arch/x86/cpu/pci.c
+++ b/arch/x86/cpu/pci.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <asm/io.h>
diff --git a/arch/x86/cpu/qemu/qemu.c b/arch/x86/cpu/qemu/qemu.c
index 716351a..044a429c 100644
--- a/arch/x86/cpu/qemu/qemu.c
+++ b/arch/x86/cpu/qemu/qemu.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <pci.h>
 #include <qfw.h>
 #include <asm/irq.h>
diff --git a/arch/x86/cpu/quark/dram.c b/arch/x86/cpu/quark/dram.c
index 2bf90dc..7293713 100644
--- a/arch/x86/cpu/quark/dram.c
+++ b/arch/x86/cpu/quark/dram.c
@@ -8,7 +8,9 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <asm/mrccache.h>
 #include <asm/mtrr.h>
 #include <asm/post.h>
diff --git a/arch/x86/cpu/quark/mrc_util.h b/arch/x86/cpu/quark/mrc_util.h
index 4a760a9..e6e69c4 100644
--- a/arch/x86/cpu/quark/mrc_util.h
+++ b/arch/x86/cpu/quark/mrc_util.h
@@ -10,6 +10,8 @@
 #ifndef _MRC_UTIL_H_
 #define _MRC_UTIL_H_
 
+#include <log.h>
+
 /* Turn on this macro to enable MRC debugging output */
 #undef  MRC_DEBUG
 
diff --git a/arch/x86/cpu/quark/quark.c b/arch/x86/cpu/quark/quark.c
index d6611ee..ddad02e 100644
--- a/arch/x86/cpu/quark/quark.c
+++ b/arch/x86/cpu/quark/quark.c
@@ -5,7 +5,9 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <mmc.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/ioapic.h>
 #include <asm/irq.h>
@@ -16,6 +18,7 @@
 #include <asm/arch/device.h>
 #include <asm/arch/msg_port.h>
 #include <asm/arch/quark.h>
+#include <linux/delay.h>
 
 static void quark_setup_mtrr(void)
 {
diff --git a/arch/x86/cpu/queensbay/tnc.c b/arch/x86/cpu/queensbay/tnc.c
index 66737e6..782ed86 100644
--- a/arch/x86/cpu/queensbay/tnc.c
+++ b/arch/x86/cpu/queensbay/tnc.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <dm/device-internal.h>
 #include <pci.h>
 #include <asm/io.h>
diff --git a/arch/x86/cpu/slimbootloader/serial.c b/arch/x86/cpu/slimbootloader/serial.c
index bab54b1..9813f79 100644
--- a/arch/x86/cpu/slimbootloader/serial.c
+++ b/arch/x86/cpu/slimbootloader/serial.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <ns16550.h>
 #include <serial.h>
 #include <asm/arch/slimbootloader.h>
diff --git a/arch/x86/cpu/slimbootloader/slimbootloader.c b/arch/x86/cpu/slimbootloader/slimbootloader.c
index 21dcfb2..f61fe81 100644
--- a/arch/x86/cpu/slimbootloader/slimbootloader.c
+++ b/arch/x86/cpu/slimbootloader/slimbootloader.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/slimbootloader.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/x86/cpu/tangier/pinmux.c b/arch/x86/cpu/tangier/pinmux.c
index fdd6530..5b0e106 100644
--- a/arch/x86/cpu/tangier/pinmux.c
+++ b/arch/x86/cpu/tangier/pinmux.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <dm/read.h>
 #include <regmap.h>
diff --git a/arch/x86/cpu/tangier/sdram.c b/arch/x86/cpu/tangier/sdram.c
index 8c7e1c1..df3b9e4 100644
--- a/arch/x86/cpu/tangier/sdram.c
+++ b/arch/x86/cpu/tangier/sdram.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
 #include <asm/e820.h>
 #include <asm/global_data.h>
 #include <asm/sfi.h>
diff --git a/arch/x86/cpu/tangier/tangier.c b/arch/x86/cpu/tangier/tangier.c
index 43bee1f..1e2f6cc 100644
--- a/arch/x86/cpu/tangier/tangier.c
+++ b/arch/x86/cpu/tangier/tangier.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/u-boot-x86.h>
 
 /*
diff --git a/arch/x86/cpu/turbo.c b/arch/x86/cpu/turbo.c
index be468d2..f8d85d5 100644
--- a/arch/x86/cpu/turbo.c
+++ b/arch/x86/cpu/turbo.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/cpu.h>
 #include <asm/msr.h>
 #include <asm/processor.h>
diff --git a/arch/x86/cpu/x86_64/cpu.c b/arch/x86/cpu/x86_64/cpu.c
index 4b64339..1b4d397 100644
--- a/arch/x86/cpu/x86_64/cpu.c
+++ b/arch/x86/cpu/x86_64/cpu.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <debug_uart.h>
+#include <init.h>
 
 /*
  * Global declaration of gd.
diff --git a/arch/x86/include/asm/arch-apollolake/lpc.h b/arch/x86/include/asm/arch-apollolake/lpc.h
index 5d2adad..977b7ec 100644
--- a/arch/x86/include/asm/arch-apollolake/lpc.h
+++ b/arch/x86/include/asm/arch-apollolake/lpc.h
@@ -7,6 +7,7 @@
 #ifndef _ASM_ARCH_LPC_H
 #define _ASM_ARCH_LPC_H
 
+#include <linux/bitops.h>
 #define LPC_SERIRQ_CTL			0x64
 #define  LPC_SCNT_EN			BIT(7)
 #define  LPC_SCNT_MODE			BIT(6)
diff --git a/arch/x86/include/asm/arch-apollolake/systemagent.h b/arch/x86/include/asm/arch-apollolake/systemagent.h
index 206d890..9e7bd62 100644
--- a/arch/x86/include/asm/arch-apollolake/systemagent.h
+++ b/arch/x86/include/asm/arch-apollolake/systemagent.h
@@ -8,6 +8,7 @@
 #define _ASM_ARCH_SYSTEMAGENT_H
 
 /* Device 0:0.0 PCI configuration space */
+#include <linux/bitops.h>
 #define MCHBAR		0x48
 
 /* RAPL Package Power Limit register under MCHBAR */
diff --git a/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h b/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
index a3bde3d..f2260ae 100644
--- a/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
+++ b/arch/x86/include/asm/arch-braswell/fsp/fsp_vpd.h
@@ -7,6 +7,8 @@
 #ifndef __FSP_VPD_H__
 #define __FSP_VPD_H__
 
+#include <stddef.h>
+
 struct __packed memory_upd {
 	u64 signature;				/* Offset 0x0020 */
 	u8 revision;				/* Offset 0x0028 */
diff --git a/arch/x86/include/asm/arch-broadwell/adsp.h b/arch/x86/include/asm/arch-broadwell/adsp.h
index eb825ce..a5a1f73 100644
--- a/arch/x86/include/asm/arch-broadwell/adsp.h
+++ b/arch/x86/include/asm/arch-broadwell/adsp.h
@@ -10,6 +10,7 @@
 #ifndef __ASM_ARCH_BROADWELL_ADSP_H
 #define __ASM_ARCH_BROADWELL_ADSP_H
 
+#include <linux/bitops.h>
 #define ADSP_PCI_IRQ			23
 #define ADSP_ACPI_IRQ			3
 #define  ADSP_ACPI_IRQEN		BIT(3)
diff --git a/arch/x86/include/asm/arch-broadwell/serialio.h b/arch/x86/include/asm/arch-broadwell/serialio.h
index 5e98eaf..ff09278 100644
--- a/arch/x86/include/asm/arch-broadwell/serialio.h
+++ b/arch/x86/include/asm/arch-broadwell/serialio.h
@@ -9,6 +9,7 @@
 #define __ARCH_BROADWELL_SERIALIO_H_
 
 /* Serial IO IOBP Registers */
+#include <linux/bitops.h>
 #define SIO_IOBP_PORTCTRL0	0xcb000000	/* SDIO D23:F0 */
 #define  SIO_IOBP_PORTCTRL0_ACPI_IRQ_EN		BIT(5)
 #define  SIO_IOBP_PORTCTRL0_PCI_CONF_DIS	BIT(4)
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 806f787..4ca0f79 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -1,6 +1,7 @@
 #ifndef _ASM_X86_ATOMIC_H
 #define _ASM_X86_ATOMIC_H
 
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
 #include <asm/processor.h>
diff --git a/arch/x86/include/asm/fast_spi.h b/arch/x86/include/asm/fast_spi.h
index 6894298..47c1da8 100644
--- a/arch/x86/include/asm/fast_spi.h
+++ b/arch/x86/include/asm/fast_spi.h
@@ -7,6 +7,7 @@
 #define ASM_FAST_SPI_H
 
 /* Register offsets from the MMIO region base (PCI_BASE_ADDRESS_0) */
+#include <linux/bitops.h>
 struct fast_spi_regs {
 	u32 bfp;
 	u32 hsfsts_ctl;
diff --git a/arch/x86/include/asm/fsp/fsp_api.h b/arch/x86/include/asm/fsp/fsp_api.h
index e9ac86b..4941e2d 100644
--- a/arch/x86/include/asm/fsp/fsp_api.h
+++ b/arch/x86/include/asm/fsp/fsp_api.h
@@ -6,6 +6,8 @@
 #ifndef __ASM_FSP_API_H
 #define __ASM_FSP_API_H
 
+#include <linux/linkage.h>
+
 enum fsp_phase {
 	/* Notification code for post PCI enuermation */
 	INIT_PHASE_PCI	= 0x20,
diff --git a/arch/x86/include/asm/fsp/fsp_fv.h b/arch/x86/include/asm/fsp/fsp_fv.h
index 511dfb7..7492c87 100644
--- a/arch/x86/include/asm/fsp/fsp_fv.h
+++ b/arch/x86/include/asm/fsp/fsp_fv.h
@@ -7,6 +7,8 @@
 #ifndef __FSP_FV___
 #define __FSP_FV___
 
+#include <efi.h>
+
 /* Value of EFI_FV_FILE_ATTRIBUTES */
 #define EFI_FV_FILE_ATTR_ALIGNMENT	0x0000001F
 #define EFI_FV_FILE_ATTR_FIXED		0x00000100
diff --git a/arch/x86/include/asm/intel_pinctrl.h b/arch/x86/include/asm/intel_pinctrl.h
index 72fd924..e2524b0 100644
--- a/arch/x86/include/asm/intel_pinctrl.h
+++ b/arch/x86/include/asm/intel_pinctrl.h
@@ -10,6 +10,7 @@
 #define __ASM_INTEL_PINCTRL_H
 
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 
 /**
  * struct pad_config - config for a pad
diff --git a/arch/x86/include/asm/mp.h b/arch/x86/include/asm/mp.h
index fb59e2f..9dddf88 100644
--- a/arch/x86/include/asm/mp.h
+++ b/arch/x86/include/asm/mp.h
@@ -9,6 +9,7 @@
 #define _X86_MP_H_
 
 #include <asm/atomic.h>
+#include <asm/cache.h>
 
 typedef int (*mp_callback_t)(struct udevice *cpu, void *arg);
 
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 246c14f..94e6b18 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -9,6 +9,10 @@
 #ifndef _ASM_X86_MSR_INDEX_H
 #define _ASM_X86_MSR_INDEX_H
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /* CPU model specific register (MSR) numbers */
 
 /* x86-64 specific MSRs */
diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index 6726172..212a699 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -57,7 +57,7 @@
 
 #define MTRR_FIX_TYPE(t)	((t << 24) | (t << 16) | (t << 8) | t)
 
-#if !defined(__ASSEMBLER__)
+#if !defined(__ASSEMBLY__)
 
 /**
  * Information about the previous MTRR state, set up by mtrr_open()
diff --git a/arch/x86/include/asm/sipi.h b/arch/x86/include/asm/sipi.h
index 1ab6c28..2483422 100644
--- a/arch/x86/include/asm/sipi.h
+++ b/arch/x86/include/asm/sipi.h
@@ -10,7 +10,7 @@
 #define AP_DEFAULT_BASE 0x30000
 #define AP_DEFAULT_SIZE 0x10000
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 
 /**
  * struct sipi_params_16bit - 16-bit SIPI entry-point parameters
@@ -81,6 +81,6 @@
 extern char sipi_params_16bit[];
 extern char sipi_params[];
 
-#endif /* __ASSEMBLER__ */
+#endif /* __ASSEMBLY__ */
 
 #endif
diff --git a/arch/x86/lib/acpi.c b/arch/x86/lib/acpi.c
index 7431458..155fffa 100644
--- a/arch/x86/lib/acpi.c
+++ b/arch/x86/lib/acpi.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <acpi/acpi_table.h>
 #include <asm/io.h>
 #include <asm/tables.h>
diff --git a/arch/x86/lib/acpi_table.c b/arch/x86/lib/acpi_table.c
index 13f1409..6985ef4 100644
--- a/arch/x86/lib/acpi_table.c
+++ b/arch/x86/lib/acpi_table.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <cpu.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/uclass-internal.h>
 #include <mapmem.h>
 #include <serial.h>
diff --git a/arch/x86/lib/bios.c b/arch/x86/lib/bios.c
index 30c0997..3ab432e 100644
--- a/arch/x86/lib/bios.c
+++ b/arch/x86/lib/bios.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <bios_emul.h>
 #include <irq_func.h>
+#include <log.h>
 #include <vbe.h>
 #include <linux/linkage.h>
 #include <asm/cache.h>
diff --git a/arch/x86/lib/bios_interrupts.c b/arch/x86/lib/bios_interrupts.c
index fdd966b..d6b4da7 100644
--- a/arch/x86/lib/bios_interrupts.c
+++ b/arch/x86/lib/bios_interrupts.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/pci.h>
 #include "bios_emul.h"
 
diff --git a/arch/x86/lib/bootm.c b/arch/x86/lib/bootm.c
index 07d8f1f..acc15cf 100644
--- a/arch/x86/lib/bootm.c
+++ b/arch/x86/lib/bootm.c
@@ -8,8 +8,10 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <hang.h>
+#include <log.h>
 #include <dm/device.h>
 #include <dm/root.h>
 #include <errno.h>
@@ -205,8 +207,8 @@
 				 images->os.arch == IH_ARCH_X86_64);
 }
 
-int do_bootm_linux(int flag, int argc, char * const argv[],
-		bootm_headers_t *images)
+int do_bootm_linux(int flag, int argc, char *const argv[],
+		   bootm_headers_t *images)
 {
 	/* No need for those on x86 */
 	if (flag & BOOTM_STATE_OS_BD_T || flag & BOOTM_STATE_OS_CMDLINE)
diff --git a/arch/x86/lib/cmd_boot.c b/arch/x86/lib/cmd_boot.c
index 9fce021..baaf3d1 100644
--- a/arch/x86/lib/cmd_boot.c
+++ b/arch/x86/lib/cmd_boot.c
@@ -22,7 +22,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 unsigned long do_go_exec(ulong (*entry)(int, char * const []),
-			 int argc, char * const argv[])
+			 int argc, char *const argv[])
 {
 	unsigned long ret = 0;
 	char **argv_tmp;
diff --git a/arch/x86/lib/coreboot_table.c b/arch/x86/lib/coreboot_table.c
index c996fc5..331c1b7 100644
--- a/arch/x86/lib/coreboot_table.c
+++ b/arch/x86/lib/coreboot_table.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <net.h>
 #include <vbe.h>
 #include <acpi/acpi_s3.h>
 #include <asm/coreboot_tables.h>
diff --git a/arch/x86/lib/fsp/fsp_common.c b/arch/x86/lib/fsp/fsp_common.c
index 267527e..cf32b3e 100644
--- a/arch/x86/lib/fsp/fsp_common.c
+++ b/arch/x86/lib/fsp/fsp_common.c
@@ -7,6 +7,8 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <rtc.h>
 #include <acpi/acpi_s3.h>
 #include <asm/cmos_layout.h>
diff --git a/arch/x86/lib/fsp/fsp_dram.c b/arch/x86/lib/fsp/fsp_dram.c
index 15e82de..ad5a0f7 100644
--- a/arch/x86/lib/fsp/fsp_dram.c
+++ b/arch/x86/lib/fsp/fsp_dram.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <handoff.h>
 #include <init.h>
+#include <log.h>
 #include <asm/fsp/fsp_support.h>
 #include <asm/e820.h>
 #include <asm/mrccache.h>
diff --git a/arch/x86/lib/fsp/fsp_graphics.c b/arch/x86/lib/fsp/fsp_graphics.c
index 98b7622..70224c1 100644
--- a/arch/x86/lib/fsp/fsp_graphics.c
+++ b/arch/x86/lib/fsp/fsp_graphics.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <vbe.h>
 #include <video.h>
 #include <asm/fsp/fsp_support.h>
diff --git a/arch/x86/lib/fsp/fsp_support.c b/arch/x86/lib/fsp/fsp_support.c
index ee22811..fd4d98e 100644
--- a/arch/x86/lib/fsp/fsp_support.c
+++ b/arch/x86/lib/fsp/fsp_support.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/fsp/fsp_support.h>
 #include <asm/post.h>
 
diff --git a/arch/x86/lib/fsp1/fsp_common.c b/arch/x86/lib/fsp1/fsp_common.c
index 0a72680..43d32b7 100644
--- a/arch/x86/lib/fsp1/fsp_common.c
+++ b/arch/x86/lib/fsp1/fsp_common.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <rtc.h>
 #include <acpi/acpi_s3.h>
diff --git a/arch/x86/lib/fsp1/fsp_dram.c b/arch/x86/lib/fsp1/fsp_dram.c
index 5ef8974..e3f9e30 100644
--- a/arch/x86/lib/fsp1/fsp_dram.c
+++ b/arch/x86/lib/fsp1/fsp_dram.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/fsp/fsp_support.h>
 
 int dram_init(void)
diff --git a/arch/x86/lib/fsp1/fsp_support.c b/arch/x86/lib/fsp1/fsp_support.c
index c7a2c73..d84c632 100644
--- a/arch/x86/lib/fsp1/fsp_support.c
+++ b/arch/x86/lib/fsp1/fsp_support.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/fsp1/fsp_support.h>
 #include <asm/post.h>
 
diff --git a/arch/x86/lib/fsp2/fsp_dram.c b/arch/x86/lib/fsp2/fsp_dram.c
index 3869c53..1c82b81 100644
--- a/arch/x86/lib/fsp2/fsp_dram.c
+++ b/arch/x86/lib/fsp2/fsp_dram.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <handoff.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <acpi/acpi_s3.h>
 #include <asm/arch/cpu.h>
diff --git a/arch/x86/lib/fsp2/fsp_init.c b/arch/x86/lib/fsp2/fsp_init.c
index c7dc2ea..8c57790 100644
--- a/arch/x86/lib/fsp2/fsp_init.c
+++ b/arch/x86/lib/fsp2/fsp_init.c
@@ -6,9 +6,11 @@
 #include <common.h>
 #include <binman.h>
 #include <binman_sym.h>
+#include <bootstage.h>
 #include <cbfs.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <spi.h>
 #include <spl.h>
 #include <spi_flash.h>
diff --git a/arch/x86/lib/fsp2/fsp_meminit.c b/arch/x86/lib/fsp2/fsp_meminit.c
index bf30c47..1a75814 100644
--- a/arch/x86/lib/fsp2/fsp_meminit.c
+++ b/arch/x86/lib/fsp2/fsp_meminit.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <binman.h>
+#include <bootstage.h>
+#include <log.h>
 #include <asm/mrccache.h>
 #include <asm/fsp/fsp_infoheader.h>
 #include <asm/fsp2/fsp_api.h>
@@ -79,10 +81,10 @@
 		return log_msg_ret("Could not setup config", ret);
 
 	debug("SDRAM init...");
-	bootstage_start(BOOTSTATE_ID_ACCUM_FSP_M, "fsp-m");
+	bootstage_start(BOOTSTAGE_ID_ACCUM_FSP_M, "fsp-m");
 	func = (fsp_memory_init_func)(hdr->img_base + hdr->fsp_mem_init);
 	ret = func(&upd, &hob);
-	bootstage_accum(BOOTSTATE_ID_ACCUM_FSP_M);
+	bootstage_accum(BOOTSTAGE_ID_ACCUM_FSP_M);
 	if (ret)
 		return log_msg_ret("SDRAM init fail\n", ret);
 
diff --git a/arch/x86/lib/fsp2/fsp_silicon_init.c b/arch/x86/lib/fsp2/fsp_silicon_init.c
index d7ce43e..45c0c7d 100644
--- a/arch/x86/lib/fsp2/fsp_silicon_init.c
+++ b/arch/x86/lib/fsp2/fsp_silicon_init.c
@@ -10,7 +10,9 @@
 
 #include <common.h>
 #include <binman.h>
+#include <bootstage.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/fsp/fsp_configs.h>
 #include <asm/arch/fsp/fsp_s_upd.h>
 #include <asm/fsp/fsp_infoheader.h>
@@ -42,10 +44,10 @@
 	if (ret)
 		return log_msg_ret("Could not setup config", ret);
 	log_debug("Silicon init...");
-	bootstage_start(BOOTSTATE_ID_ACCUM_FSP_S, "fsp-s");
+	bootstage_start(BOOTSTAGE_ID_ACCUM_FSP_S, "fsp-s");
 	func = (fsp_silicon_init_func)(hdr->img_base + hdr->fsp_silicon_init);
 	ret = func(&upd);
-	bootstage_accum(BOOTSTATE_ID_ACCUM_FSP_S);
+	bootstage_accum(BOOTSTAGE_ID_ACCUM_FSP_S);
 	if (ret)
 		return log_msg_ret("Silicon init fail\n", ret);
 	log_debug("done\n");
diff --git a/arch/x86/lib/fsp2/fsp_support.c b/arch/x86/lib/fsp2/fsp_support.c
index 0a04b44..3f2ca84 100644
--- a/arch/x86/lib/fsp2/fsp_support.c
+++ b/arch/x86/lib/fsp2/fsp_support.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <spi_flash.h>
 #include <asm/fsp/fsp_support.h>
 #include <asm/fsp2/fsp_internal.h>
diff --git a/arch/x86/lib/i8259.c b/arch/x86/lib/i8259.c
index 358cd1e..a0e3c09 100644
--- a/arch/x86/lib/i8259.c
+++ b/arch/x86/lib/i8259.c
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/i8259.h>
 #include <asm/ibmpc.h>
diff --git a/arch/x86/lib/interrupts.c b/arch/x86/lib/interrupts.c
index b23b8fd..a81e429 100644
--- a/arch/x86/lib/interrupts.c
+++ b/arch/x86/lib/interrupts.c
@@ -30,6 +30,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <irq_func.h>
 #include <asm/interrupt.h>
 
@@ -127,7 +128,7 @@
 #endif
 
 #if defined(CONFIG_CMD_IRQ)
-int do_irqinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 #if !CONFIG_IS_ENABLED(X86_64)
 	int irq;
diff --git a/arch/x86/lib/mpspec.c b/arch/x86/lib/mpspec.c
index b5ad113..1c49c41 100644
--- a/arch/x86/lib/mpspec.c
+++ b/arch/x86/lib/mpspec.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/cpu.h>
 #include <asm/irq.h>
 #include <asm/ioapic.h>
diff --git a/arch/x86/lib/mrccache.c b/arch/x86/lib/mrccache.c
index d1c44f2..21c71e0 100644
--- a/arch/x86/lib/mrccache.c
+++ b/arch/x86/lib/mrccache.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <spi.h>
diff --git a/arch/x86/lib/physmem.c b/arch/x86/lib/physmem.c
index c3c709e..4578046 100644
--- a/arch/x86/lib/physmem.c
+++ b/arch/x86/lib/physmem.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <physmem.h>
 #include <asm/cpu.h>
 #include <linux/compiler.h>
diff --git a/arch/x86/lib/pinctrl_ich6.c b/arch/x86/lib/pinctrl_ich6.c
index 5868d5b..4825994 100644
--- a/arch/x86/lib/pinctrl_ich6.c
+++ b/arch/x86/lib/pinctrl_ich6.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <pch.h>
 #include <pci.h>
 #include <asm/cpu.h>
diff --git a/arch/x86/lib/pirq_routing.c b/arch/x86/lib/pirq_routing.c
index 17bd2fc..eb6a7d9 100644
--- a/arch/x86/lib/pirq_routing.c
+++ b/arch/x86/lib/pirq_routing.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/pci.h>
 #include <asm/pirq_routing.h>
diff --git a/arch/x86/lib/pmu.c b/arch/x86/lib/pmu.c
index 08fbe99..3cd7b1f 100644
--- a/arch/x86/lib/pmu.c
+++ b/arch/x86/lib/pmu.c
@@ -8,6 +8,7 @@
 #include <syscon.h>
 #include <asm/cpu.h>
 #include <asm/pmu.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 
diff --git a/arch/x86/lib/relocate.c b/arch/x86/lib/relocate.c
index 4d09e4d..ecbd092 100644
--- a/arch/x86/lib/relocate.c
+++ b/arch/x86/lib/relocate.c
@@ -15,6 +15,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <relocate.h>
 #include <asm/u-boot-x86.h>
 #include <asm/sections.h>
diff --git a/arch/x86/lib/scu.c b/arch/x86/lib/scu.c
index a6f8297..d29d701 100644
--- a/arch/x86/lib/scu.c
+++ b/arch/x86/lib/scu.c
@@ -15,6 +15,8 @@
 #include <syscon.h>
 #include <asm/cpu.h>
 #include <asm/scu.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 #include <linux/kernel.h>
diff --git a/arch/x86/lib/spl.c b/arch/x86/lib/spl.c
index 212b4d5..b6f9a70 100644
--- a/arch/x86/lib/spl.c
+++ b/arch/x86/lib/spl.c
@@ -8,7 +8,10 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
 #include <irq_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <spl.h>
 #include <syscon.h>
diff --git a/arch/x86/lib/tpl.c b/arch/x86/lib/tpl.c
index 34804b5..6f7eb43 100644
--- a/arch/x86/lib/tpl.c
+++ b/arch/x86/lib/tpl.c
@@ -7,6 +7,9 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/cpu.h>
 #include <asm/mtrr.h>
diff --git a/arch/x86/lib/zimage.c b/arch/x86/lib/zimage.c
index ffc0963..64d14e8 100644
--- a/arch/x86/lib/zimage.c
+++ b/arch/x86/lib/zimage.c
@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <irq_func.h>
 #include <malloc.h>
@@ -310,7 +311,7 @@
 {
 }
 
-int do_zboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_zboot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct boot_params *base_ptr;
 	void *bzImage_addr = NULL;
diff --git a/arch/xtensa/cpu/cpu.c b/arch/xtensa/cpu/cpu.c
index 6f4b88f..85d3464 100644
--- a/arch/xtensa/cpu/cpu.c
+++ b/arch/xtensa/cpu/cpu.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <init.h>
 #include <vsprintf.h>
 #include <linux/stringify.h>
 #include <asm/global_data.h>
diff --git a/arch/xtensa/cpu/exceptions.c b/arch/xtensa/cpu/exceptions.c
index 3b8f4a3..cf9af43 100644
--- a/arch/xtensa/cpu/exceptions.c
+++ b/arch/xtensa/cpu/exceptions.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <command.h>
 #include <irq_func.h>
+#include <asm/ptrace.h>
 #include <asm/string.h>
 #include <asm/regs.h>
 
diff --git a/arch/xtensa/lib/bootm.c b/arch/xtensa/lib/bootm.c
index 057b229..458eaf9 100644
--- a/arch/xtensa/lib/bootm.c
+++ b/arch/xtensa/lib/bootm.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <cpu_func.h>
 #include <env.h>
diff --git a/arch/xtensa/lib/time.c b/arch/xtensa/lib/time.c
index 62bbe37..3a02c38 100644
--- a/arch/xtensa/lib/time.c
+++ b/arch/xtensa/lib/time.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <time.h>
 #include <asm/global_data.h>
+#include <linux/delay.h>
 #include <linux/stringify.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/AndesTech/adp-ae3xx/adp-ae3xx.c b/board/AndesTech/adp-ae3xx/adp-ae3xx.c
index a04415d..54f7178 100644
--- a/board/AndesTech/adp-ae3xx/adp-ae3xx.c
+++ b/board/AndesTech/adp-ae3xx/adp-ae3xx.c
@@ -6,8 +6,10 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/mach-types.h>
 #include <common.h>
+#include <flash.h>
 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
 #endif
diff --git a/board/AndesTech/adp-ag101p/adp-ag101p.c b/board/AndesTech/adp-ag101p/adp-ag101p.c
index faf39b4..23cdf4f 100644
--- a/board/AndesTech/adp-ag101p/adp-ag101p.c
+++ b/board/AndesTech/adp-ag101p/adp-ag101p.c
@@ -6,7 +6,9 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <init.h>
+#include <net.h>
 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
 #endif
diff --git a/board/AndesTech/ax25-ae350/ax25-ae350.c b/board/AndesTech/ax25-ae350/ax25-ae350.c
index f164073..da5bc5b 100644
--- a/board/AndesTech/ax25-ae350/ax25-ae350.c
+++ b/board/AndesTech/ax25-ae350/ax25-ae350.c
@@ -5,7 +5,10 @@
  */
 
 #include <common.h>
+#include <flash.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #if defined(CONFIG_FTMAC100) && !defined(CONFIG_DM_ETH)
 #include <netdev.h>
 #endif
diff --git a/board/Arcturus/ucp1020/cmd_arc.c b/board/Arcturus/ucp1020/cmd_arc.c
index b50de63..4b30b66 100644
--- a/board/Arcturus/ucp1020/cmd_arc.c
+++ b/board/Arcturus/ucp1020/cmd_arc.c
@@ -9,14 +9,17 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <div64.h>
 #include <env.h>
+#include <flash.h>
 #include <malloc.h>
 #include <spi_flash.h>
 #include <mmc.h>
 #include <version.h>
 #include <asm/io.h>
+#include <linux/stringify.h>
 
 static ulong fwenv_addr[MAX_FWENV_ADDR];
 const char mystrerr[] = "ERROR: Failed to save factory info";
@@ -375,7 +378,8 @@
 		do_get_arc_info();
 }
 
-static int do_arc_cmd(cmd_tbl_t * cmdtp, int flag, int argc, char *const argv[])
+static int do_arc_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	const char *cmd;
 	int ret = -1;
diff --git a/board/Arcturus/ucp1020/ucp1020.c b/board/Arcturus/ucp1020/ucp1020.c
index b641b72..240e804 100644
--- a/board/Arcturus/ucp1020/ucp1020.c
+++ b/board/Arcturus/ucp1020/ucp1020.c
@@ -12,7 +12,9 @@
 #include <command.h>
 #include <env.h>
 #include <hwconfig.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #include <i2c.h>
 #include <miiphy.h>
diff --git a/board/BuR/brppt2/board.c b/board/BuR/brppt2/board.c
index c91d2f9..f156b55 100644
--- a/board/BuR/brppt2/board.c
+++ b/board/BuR/brppt2/board.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
 #include <spl.h>
 #include <dm.h>
 #include <miiphy.h>
diff --git a/board/BuR/common/br_resetc.c b/board/BuR/common/br_resetc.c
index 70ad832..5006687 100644
--- a/board/BuR/common/br_resetc.c
+++ b/board/BuR/common/br_resetc.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <i2c.h>
 #include <dm/uclass.h>
+#include <linux/delay.h>
 #include "br_resetc.h"
 
 /* I2C Address of controller */
diff --git a/board/BuR/common/common.c b/board/BuR/common/common.c
index de8d455..3bc1d06 100644
--- a/board/BuR/common/common.c
+++ b/board/BuR/common/common.c
@@ -8,12 +8,14 @@
  * Bernecker & Rainer Industrieelektronik GmbH - http://www.br-automation.com
  *
  */
+#include <log.h>
 #include <version.h>
 #include <common.h>
 #include <env.h>
 #include <fdtdec.h>
 #include <i2c.h>
 #include <lcd.h>
+#include <linux/delay.h>
 #include "bur_common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/BuS/eb_cpu5282/eb_cpu5282.c b/board/BuS/eb_cpu5282/eb_cpu5282.c
index a667413..1d05e40 100644
--- a/board/BuS/eb_cpu5282/eb_cpu5282.c
+++ b/board/BuS/eb_cpu5282/eb_cpu5282.c
@@ -226,7 +226,7 @@
 /*---------------------------------------------------------------------------*/
 
 #ifdef CONFIG_VIDEO
-int do_brightness(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_brightness(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rcode = 0;
 	ulong side;
diff --git a/board/CZ.NIC/turris_mox/mox_sp.c b/board/CZ.NIC/turris_mox/mox_sp.c
index 3c23471..cc57b9f 100644
--- a/board/CZ.NIC/turris_mox/mox_sp.c
+++ b/board/CZ.NIC/turris_mox/mox_sp.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <asm/arch/soc.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define RWTM_BASE		(MVEBU_REGISTER(0xb0000))
 #define RWTM_CMD_PARAM(i)	(size_t)(RWTM_BASE + (i) * 4)
diff --git a/board/CZ.NIC/turris_mox/turris_mox.c b/board/CZ.NIC/turris_mox/turris_mox.c
index 470ea32..f3c3996 100644
--- a/board/CZ.NIC/turris_mox/turris_mox.c
+++ b/board/CZ.NIC/turris_mox/turris_mox.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <clk.h>
@@ -13,6 +14,7 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <init.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <linux/string.h>
 #include <miiphy.h>
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index e1775d3..2da878d 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -11,7 +11,9 @@
 #include <env.h>
 #include <i2c.h>
 #include <init.h>
+#include <log.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
@@ -19,6 +21,7 @@
 #include <dm/uclass.h>
 #include <fdt_support.h>
 #include <time.h>
+#include <linux/bitops.h>
 #include <u-boot/crc.h>
 # include <atsha204a-i2c.h>
 
diff --git a/board/CarMediaLab/flea3/flea3.c b/board/CarMediaLab/flea3/flea3.c
index fb66c9e..61d965f 100644
--- a/board/CarMediaLab/flea3/flea3.c
+++ b/board/CarMediaLab/flea3/flea3.c
@@ -11,6 +11,7 @@
 #include <init.h>
 #include <asm/io.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/LaCie/net2big_v2/net2big_v2.c b/board/LaCie/net2big_v2/net2big_v2.c
index 5030565..dbd8b57 100644
--- a/board/LaCie/net2big_v2/net2big_v2.c
+++ b/board/LaCie/net2big_v2/net2big_v2.c
@@ -12,6 +12,7 @@
 #include <command.h>
 #include <env.h>
 #include <i2c.h>
+#include <init.h>
 #include <net.h>
 #include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
@@ -245,7 +246,8 @@
 #if defined(CONFIG_KIRKWOOD_GPIO)
 /* Return GPIO push button status */
 static int
-do_read_push_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_read_push_button(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	return !kw_gpio_get_value(NET2BIG_V2_GPIO_PUSH_BUTTON);
 }
diff --git a/board/LaCie/netspace_v2/netspace_v2.c b/board/LaCie/netspace_v2/netspace_v2.c
index b7ae58c..011cc56 100644
--- a/board/LaCie/netspace_v2/netspace_v2.c
+++ b/board/LaCie/netspace_v2/netspace_v2.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <init.h>
 #include <net.h>
 #include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
@@ -109,7 +110,7 @@
 #if defined(CONFIG_KIRKWOOD_GPIO)
 /* Return GPIO button status */
 static int
-do_read_button(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_read_button(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return kw_gpio_get_value(NETSPACE_V2_GPIO_BUTTON);
 }
diff --git a/board/Marvell/aspenite/aspenite.c b/board/Marvell/aspenite/aspenite.c
index c4e506f..c1406d7 100644
--- a/board/Marvell/aspenite/aspenite.c
+++ b/board/Marvell/aspenite/aspenite.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <mvmfp.h>
 #include <asm/mach-types.h>
 #include <asm/arch/cpu.h>
diff --git a/board/Marvell/db-88f6281-bp/db-88f6281-bp.c b/board/Marvell/db-88f6281-bp/db-88f6281-bp.c
index 729516d..62027bd 100644
--- a/board/Marvell/db-88f6281-bp/db-88f6281-bp.c
+++ b/board/Marvell/db-88f6281-bp/db-88f6281-bp.c
@@ -1,7 +1,9 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include <common.h>
+#include <init.h>
 #include <net.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <miiphy.h>
 #include <netdev.h>
diff --git a/board/Marvell/db-88f6720/db-88f6720.c b/board/Marvell/db-88f6720/db-88f6720.c
index 94306b3..e9897b3 100644
--- a/board/Marvell/db-88f6720/db-88f6720.c
+++ b/board/Marvell/db-88f6720/db-88f6720.c
@@ -4,11 +4,14 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c
index 922576e..60ce940 100644
--- a/board/Marvell/db-88f6820-amc/db-88f6820-amc.c
+++ b/board/Marvell/db-88f6820-amc/db-88f6820-amc.c
@@ -5,11 +5,14 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 
 #include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include <../serdes/a38x/high_speed_env_spec.h>
diff --git a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c
index 1a0746b..08a3c1c 100644
--- a/board/Marvell/db-88f6820-gp/db-88f6820-gp.c
+++ b/board/Marvell/db-88f6820-gp/db-88f6820-gp.c
@@ -5,11 +5,14 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 
 #include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include <../serdes/a38x/high_speed_env_spec.h>
diff --git a/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c b/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
index 604e8c1..63bb771 100644
--- a/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
+++ b/board/Marvell/db-mv784mp-gp/db-mv784mp-gp.c
@@ -4,11 +4,14 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c b/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c
index cae428f..5f12a27 100644
--- a/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c
+++ b/board/Marvell/db-xc3-24g4xg/db-xc3-24g4xg.c
@@ -5,7 +5,9 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <linux/mbus.h>
 #include <linux/io.h>
 #include <asm/arch/cpu.h>
diff --git a/board/Marvell/dreamplug/dreamplug.c b/board/Marvell/dreamplug/dreamplug.c
index 887dd1e..7d188c3 100644
--- a/board/Marvell/dreamplug/dreamplug.c
+++ b/board/Marvell/dreamplug/dreamplug.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/arch/cpu.h>
diff --git a/board/Marvell/gplugd/gplugd.c b/board/Marvell/gplugd/gplugd.c
index fc2bc85..1e2f227 100644
--- a/board/Marvell/gplugd/gplugd.c
+++ b/board/Marvell/gplugd/gplugd.c
@@ -12,6 +12,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <mvmfp.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/mfp.h>
@@ -19,6 +21,7 @@
 #include <asm/gpio.h>
 #include <miiphy.h>
 #include <asm/mach-types.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_ARMADA100_FEC
 #include <net.h>
diff --git a/board/Marvell/guruplug/guruplug.c b/board/Marvell/guruplug/guruplug.c
index 71bee76..f3981c6 100644
--- a/board/Marvell/guruplug/guruplug.c
+++ b/board/Marvell/guruplug/guruplug.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/mach-types.h>
diff --git a/board/Marvell/mvebu_armada-37xx/board.c b/board/Marvell/mvebu_armada-37xx/board.c
index bef4e17..9bea198 100644
--- a/board/Marvell/mvebu_armada-37xx/board.c
+++ b/board/Marvell/mvebu_armada-37xx/board.c
@@ -6,10 +6,12 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <init.h>
 #include <phy.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/Marvell/mvebu_armada-8k/board.c b/board/Marvell/mvebu_armada-8k/board.c
index 499e893..60b0024 100644
--- a/board/Marvell/mvebu_armada-8k/board.c
+++ b/board/Marvell/mvebu_armada-8k/board.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/Marvell/openrd/openrd.c b/board/Marvell/openrd/openrd.c
index ae92028..d9b5b21 100644
--- a/board/Marvell/openrd/openrd.c
+++ b/board/Marvell/openrd/openrd.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/mach-types.h>
diff --git a/board/Marvell/sheevaplug/sheevaplug.c b/board/Marvell/sheevaplug/sheevaplug.c
index 6c6106c..6311ed3 100644
--- a/board/Marvell/sheevaplug/sheevaplug.c
+++ b/board/Marvell/sheevaplug/sheevaplug.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/mach-types.h>
diff --git a/board/Seagate/dockstar/dockstar.c b/board/Seagate/dockstar/dockstar.c
index 5a8c6e2..85dd10e 100644
--- a/board/Seagate/dockstar/dockstar.c
+++ b/board/Seagate/dockstar/dockstar.c
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/arch/soc.h>
diff --git a/board/Seagate/goflexhome/goflexhome.c b/board/Seagate/goflexhome/goflexhome.c
index 1e4477a..de1ec54 100644
--- a/board/Seagate/goflexhome/goflexhome.c
+++ b/board/Seagate/goflexhome/goflexhome.c
@@ -12,6 +12,8 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/mach-types.h>
diff --git a/board/Seagate/nas220/nas220.c b/board/Seagate/nas220/nas220.c
index 9946205..3a027d0 100644
--- a/board/Seagate/nas220/nas220.c
+++ b/board/Seagate/nas220/nas220.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/mach-types.h>
diff --git a/board/Synology/ds109/ds109.c b/board/Synology/ds109/ds109.c
index f2031ef..aa2987d 100644
--- a/board/Synology/ds109/ds109.c
+++ b/board/Synology/ds109/ds109.c
@@ -6,12 +6,14 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/setup.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/mpp.h>
+#include <linux/delay.h>
 #include "ds109.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/Synology/ds414/cmd_syno.c b/board/Synology/ds414/cmd_syno.c
index 777948f..a120c31 100644
--- a/board/Synology/ds414/cmd_syno.c
+++ b/board/Synology/ds414/cmd_syno.c
@@ -6,8 +6,10 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <div64.h>
 #include <env.h>
+#include <net.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <linux/mtd/mtd.h>
@@ -20,7 +22,7 @@
 #define SYNO_CHKSUM_TAG		"CHK="
 
 
-static int do_syno_populate(int argc, char * const argv[])
+static int do_syno_populate(int argc, char *const argv[])
 {
 	unsigned int bus = CONFIG_SF_DEFAULT_BUS;
 	unsigned int cs = CONFIG_SF_DEFAULT_CS;
@@ -151,7 +153,7 @@
 	NULL,
 };
 
-static int do_syno_clk_gate(int argc, char * const argv[])
+static int do_syno_clk_gate(int argc, char *const argv[])
 {
 	u32 pwr_mng_ctrl_reg = reg_read(POWER_MNG_CTRL_REG);
 	const char *func, *state;
@@ -194,8 +196,8 @@
 	return 0;
 }
 
-static int do_syno(cmd_tbl_t *cmdtp, int flag,
-                   int argc, char * const argv[])
+static int do_syno(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	const char *cmd;
 	int ret = 0;
diff --git a/board/Synology/ds414/ds414.c b/board/Synology/ds414/ds414.c
index d23e97c..6322051 100644
--- a/board/Synology/ds414/ds414.c
+++ b/board/Synology/ds414/ds414.c
@@ -5,10 +5,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 #include <linux/mbus.h>
 
 #include "../drivers/ddr/marvell/axp/ddr3_hw_training.h"
diff --git a/board/abilis/tb100/tb100.c b/board/abilis/tb100/tb100.c
index e3fbbba..47eb64d 100644
--- a/board/abilis/tb100/tb100.c
+++ b/board/abilis/tb100/tb100.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 
diff --git a/board/advantech/dms-ba16/dms-ba16.c b/board/advantech/dms-ba16/dms-ba16.c
index 299f2f1..28e505e 100644
--- a/board/advantech/dms-ba16/dms-ba16.c
+++ b/board/advantech/dms-ba16/dms-ba16.c
@@ -6,10 +6,12 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c b/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c
index bb79130..ea057d2 100644
--- a/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c
+++ b/board/advantech/imx8qm_rom7720_a1/imx8qm_rom7720_a1.c
@@ -6,7 +6,10 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <env.h>
 #include <errno.h>
+#include <init.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/board/advantech/imx8qm_rom7720_a1/spl.c b/board/advantech/imx8qm_rom7720_a1/spl.c
index 3f31a8f..54f48b9 100644
--- a/board/advantech/imx8qm_rom7720_a1/spl.c
+++ b/board/advantech/imx8qm_rom7720_a1/spl.c
@@ -4,6 +4,9 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <fsl_esdhc.h>
 
diff --git a/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c b/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c
index 8f4c587..8499fc5 100644
--- a/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c
+++ b/board/advantech/som-db5800-som-6867/som-db5800-som-6867.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/fsp1/fsp_support.h>
 
 /* ALC262 Verb Table - 10EC0262 */
diff --git a/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c b/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c
index 1f3f293..668484b 100644
--- a/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c
+++ b/board/alliedtelesis/SBx81LIFKW/sbx81lifkw.c
@@ -5,7 +5,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <net.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <miiphy.h>
 #include <netdev.h>
diff --git a/board/alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c b/board/alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c
index 889ce70..e4bf507 100644
--- a/board/alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c
+++ b/board/alliedtelesis/SBx81LIFXCAT/sbx81lifxcat.c
@@ -5,10 +5,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <netdev.h>
 #include <led.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
diff --git a/board/alliedtelesis/x530/x530.c b/board/alliedtelesis/x530/x530.c
index 04b053d..c7438ae 100644
--- a/board/alliedtelesis/x530/x530.c
+++ b/board/alliedtelesis/x530/x530.c
@@ -8,8 +8,10 @@
 #include <dm.h>
 #include <env.h>
 #include <i2c.h>
+#include <init.h>
 #include <wdt.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <linux/mbus.h>
 #include <linux/io.h>
 #include <asm/arch/cpu.h>
diff --git a/board/amazon/kc1/kc1.c b/board/amazon/kc1/kc1.c
index 9034c4f..fb1828f 100644
--- a/board/amazon/kc1/kc1.c
+++ b/board/amazon/kc1/kc1.c
@@ -8,6 +8,7 @@
 #include <config.h>
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <linux/ctype.h>
 #include <linux/usb/musb.h>
 #include <asm/omap_musb.h>
diff --git a/board/amlogic/p200/p200.c b/board/amlogic/p200/p200.c
index 41d331d..8f1bf8b 100644
--- a/board/amlogic/p200/p200.c
+++ b/board/amlogic/p200/p200.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
 #include <asm/arch/sm.h>
diff --git a/board/amlogic/p201/p201.c b/board/amlogic/p201/p201.c
index e46fcaea..597bb71 100644
--- a/board/amlogic/p201/p201.c
+++ b/board/amlogic/p201/p201.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
 #include <asm/arch/sm.h>
diff --git a/board/amlogic/p212/p212.c b/board/amlogic/p212/p212.c
index 094ab54..fbc49e9 100644
--- a/board/amlogic/p212/p212.c
+++ b/board/amlogic/p212/p212.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
 #include <asm/arch/sm.h>
diff --git a/board/amlogic/q200/q200.c b/board/amlogic/q200/q200.c
index f1faa74..62e6fa3 100644
--- a/board/amlogic/q200/q200.c
+++ b/board/amlogic/q200/q200.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/gx.h>
 #include <asm/arch/mem.h>
diff --git a/board/amlogic/s400/s400.c b/board/amlogic/s400/s400.c
index bdb4eca..7e2f0cd 100644
--- a/board/amlogic/s400/s400.c
+++ b/board/amlogic/s400/s400.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/axg.h>
 #include <asm/arch/sm.h>
diff --git a/board/amlogic/sei510/sei510.c b/board/amlogic/sei510/sei510.c
index 5de610d..5a5148e 100644
--- a/board/amlogic/sei510/sei510.c
+++ b/board/amlogic/sei510/sei510.c
@@ -6,7 +6,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <env_internal.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/axg.h>
 #include <asm/arch/sm.h>
diff --git a/board/amlogic/sei610/sei610.c b/board/amlogic/sei610/sei610.c
index b17eb9e..27dba93 100644
--- a/board/amlogic/sei610/sei610.c
+++ b/board/amlogic/sei610/sei610.c
@@ -6,7 +6,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <env_internal.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/axg.h>
 #include <asm/arch/sm.h>
diff --git a/board/amlogic/u200/u200.c b/board/amlogic/u200/u200.c
index 69fd29d..373235d 100644
--- a/board/amlogic/u200/u200.c
+++ b/board/amlogic/u200/u200.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/axg.h>
 #include <asm/arch/sm.h>
diff --git a/board/amlogic/w400/w400.c b/board/amlogic/w400/w400.c
index e60dc3a..47a5171 100644
--- a/board/amlogic/w400/w400.c
+++ b/board/amlogic/w400/w400.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env_internal.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/eth.h>
 
diff --git a/board/aristainetos/aristainetos.c b/board/aristainetos/aristainetos.c
index 7067103..1493112 100644
--- a/board/aristainetos/aristainetos.c
+++ b/board/aristainetos/aristainetos.c
@@ -9,6 +9,9 @@
  * Author: Fabio Estevam <fabio.estevam@freescale.com>
  */
 
+#include <command.h>
+#include <image.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
diff --git a/board/armadeus/apf27/fpga.c b/board/armadeus/apf27/fpga.c
index e9af8dd..9e2f39f 100644
--- a/board/armadeus/apf27/fpga.c
+++ b/board/armadeus/apf27/fpga.c
@@ -9,6 +9,8 @@
  * Keith Outwater, keith_outwater@mvis.com
  */
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 
 #include <asm/arch/imx-regs.h>
 #include <asm/gpio.h>
diff --git a/board/armltd/integrator/integrator.c b/board/armltd/integrator/integrator.c
index 1a472f5..ac6462d 100644
--- a/board/armltd/integrator/integrator.c
+++ b/board/armltd/integrator/integrator.c
@@ -17,10 +17,12 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <env.h>
 #include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <dm/platform_data/serial_pl01x.h>
diff --git a/board/armltd/integrator/pci.c b/board/armltd/integrator/pci.c
index c189d23..28efc33 100644
--- a/board/armltd/integrator/pci.c
+++ b/board/armltd/integrator/pci.c
@@ -21,8 +21,11 @@
  */
 #include <common.h>
 #include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/io.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include "integrator-sc.h"
 #include "pci_v3.h"
 
diff --git a/board/armltd/integrator/timer.c b/board/armltd/integrator/timer.c
index d701669..d220b87 100644
--- a/board/armltd/integrator/timer.c
+++ b/board/armltd/integrator/timer.c
@@ -19,6 +19,7 @@
 #include <common.h>
 #include <div64.h>
 #include <time.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_ARCH_CINTEGRATOR
 #define DIV_CLOCK_INIT	1
@@ -124,7 +125,7 @@
 }
 
 /* delay usec useconds */
-void __udelay (unsigned long usec)
+void __udelay(unsigned long usec)
 {
 	ulong tmo, tmp;
 
diff --git a/board/armltd/vexpress/vexpress_common.c b/board/armltd/vexpress/vexpress_common.c
index 14626c1..9dc26b9 100644
--- a/board/armltd/vexpress/vexpress_common.c
+++ b/board/armltd/vexpress/vexpress_common.c
@@ -16,10 +16,12 @@
  * Philippe Robin, <philippe.robin@arm.com>
  */
 #include <common.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <init.h>
 #include <malloc.h>
 #include <errno.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/mach-types.h>
diff --git a/board/armltd/vexpress64/pcie.c b/board/armltd/vexpress64/pcie.c
index 21156a4..02de58b 100644
--- a/board/armltd/vexpress64/pcie.c
+++ b/board/armltd/vexpress64/pcie.c
@@ -6,9 +6,12 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <pci_ids.h>
+#include <linux/delay.h>
 #include "pcie.h"
 
 /* XpressRICH3 support */
diff --git a/board/armltd/vexpress64/vexpress64.c b/board/armltd/vexpress64/vexpress64.c
index 5c7a8f5..fbfa7a1 100644
--- a/board/armltd/vexpress64/vexpress64.c
+++ b/board/armltd/vexpress64/vexpress64.c
@@ -7,8 +7,10 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <init.h>
 #include <malloc.h>
 #include <errno.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <linux/compiler.h>
diff --git a/board/astro/mcf5373l/mcf5373l.c b/board/astro/mcf5373l/mcf5373l.c
index 9adf58e..e7c2b90 100644
--- a/board/astro/mcf5373l/mcf5373l.c
+++ b/board/astro/mcf5373l/mcf5373l.c
@@ -13,6 +13,7 @@
 #include <asm/m5329.h>
 #include <asm/immap_5329.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 /* needed for astro bus: */
 #include <asm/uart.h>
diff --git a/board/atmel/at91rm9200ek/at91rm9200ek.c b/board/atmel/at91rm9200ek/at91rm9200ek.c
index e75d5b1..e4a6776 100644
--- a/board/atmel/at91rm9200ek/at91rm9200ek.c
+++ b/board/atmel/at91rm9200ek/at91rm9200ek.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mach-types.h>
 #include <asm/arch/hardware.h>
diff --git a/board/atmel/at91sam9260ek/led.c b/board/atmel/at91sam9260ek/led.c
index 2ea66b9..cc6d5d7 100644
--- a/board/atmel/at91sam9260ek/led.c
+++ b/board/atmel/at91sam9260ek/led.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/gpio.h>
 #include <status_led.h>
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
index b811d93..be132bc 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <flash.h>
 #include <init.h>
 #include <net.h>
 #include <vsprintf.h>
diff --git a/board/atmel/at91sam9n12ek/at91sam9n12ek.c b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
index 90d3235..f16c137 100644
--- a/board/atmel/at91sam9n12ek/at91sam9n12ek.c
+++ b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9x5_matrix.h>
diff --git a/board/atmel/common/mac-spi-nor.c b/board/atmel/common/mac-spi-nor.c
index 9634367..ced27b6 100644
--- a/board/atmel/common/mac-spi-nor.c
+++ b/board/atmel/common/mac-spi-nor.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <net.h>
 #include <linux/mtd/spi-nor.h>
 #include <netdev.h>
 
diff --git a/board/atmel/common/mac_eeprom.c b/board/atmel/common/mac_eeprom.c
index 050aa51..2205dd3 100644
--- a/board/atmel/common/mac_eeprom.c
+++ b/board/atmel/common/mac_eeprom.c
@@ -9,6 +9,7 @@
 #include <eeprom.h>
 #include <env.h>
 #include <i2c_eeprom.h>
+#include <net.h>
 #include <netdev.h>
 
 int at91_set_ethaddr(int offset)
diff --git a/board/atmel/common/video_display.c b/board/atmel/common/video_display.c
index 5cc5213..2666b0b 100644
--- a/board/atmel/common/video_display.c
+++ b/board/atmel/common/video_display.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <atmel_lcd.h>
 #include <dm.h>
+#include <init.h>
 #include <nand.h>
 #include <version.h>
 #include <video.h>
diff --git a/board/avionic-design/common/tamonten-ng.c b/board/avionic-design/common/tamonten-ng.c
index 10278de..29bde60 100644
--- a/board/avionic-design/common/tamonten-ng.c
+++ b/board/avionic-design/common/tamonten-ng.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/gp_padctrl.h>
 #include <asm/arch/gpio.h>
diff --git a/board/bachmann/ot1200/ot1200.c b/board/bachmann/ot1200/ot1200.c
index 36f3708..db0da0c 100644
--- a/board/bachmann/ot1200/ot1200.c
+++ b/board/bachmann/ot1200/ot1200.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
diff --git a/board/bachmann/ot1200/ot1200_spl.c b/board/bachmann/ot1200/ot1200_spl.c
index a3a822f..7fbd6f2 100644
--- a/board/bachmann/ot1200/ot1200_spl.c
+++ b/board/bachmann/ot1200/ot1200_spl.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/arch/mx6-ddr.h>
 
diff --git a/board/barco/platinum/platinum.c b/board/barco/platinum/platinum.c
index c2c7c09..7984647 100644
--- a/board/barco/platinum/platinum.c
+++ b/board/barco/platinum/platinum.c
@@ -9,6 +9,7 @@
 #include <mmc.h>
 #include <fsl_esdhc_imx.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/board/barco/platinum/platinum_picon.c b/board/barco/platinum/platinum_picon.c
index 7d99b16..3fc29f9 100644
--- a/board/barco/platinum/platinum_picon.c
+++ b/board/barco/platinum/platinum_picon.c
@@ -14,6 +14,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <i2c.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 
 #include "platinum.h"
 
diff --git a/board/barco/platinum/platinum_titanium.c b/board/barco/platinum/platinum_titanium.c
index 5758c14..9f7c93b 100644
--- a/board/barco/platinum/platinum_titanium.c
+++ b/board/barco/platinum/platinum_titanium.c
@@ -12,6 +12,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <miiphy.h>
 #include <micrel.h>
+#include <linux/delay.h>
 
 #include "platinum.h"
 
diff --git a/board/barco/platinum/spl_picon.c b/board/barco/platinum/spl_picon.c
index ec6de46..253a64d 100644
--- a/board/barco/platinum/spl_picon.c
+++ b/board/barco/platinum/spl_picon.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-ddr.h>
diff --git a/board/barco/platinum/spl_titanium.c b/board/barco/platinum/spl_titanium.c
index 263371a..8c91b752 100644
--- a/board/barco/platinum/spl_titanium.c
+++ b/board/barco/platinum/spl_titanium.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-ddr.h>
diff --git a/board/barco/titanium/titanium.c b/board/barco/titanium/titanium.c
index 6348f12..91c70a8 100644
--- a/board/barco/titanium/titanium.c
+++ b/board/barco/titanium/titanium.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
@@ -21,6 +22,7 @@
 #include <micrel.h>
 #include <miiphy.h>
 #include <netdev.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/beacon/imx8mm/spl.c b/board/beacon/imx8mm/spl.c
index 35be2e8..4ee10cf 100644
--- a/board/beacon/imx8mm/spl.c
+++ b/board/beacon/imx8mm/spl.c
@@ -3,6 +3,8 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/beckhoff/mx53cx9020/mx53cx9020.c b/board/beckhoff/mx53cx9020/mx53cx9020.c
index 398e4ed..617b545 100644
--- a/board/beckhoff/mx53cx9020/mx53cx9020.c
+++ b/board/beckhoff/mx53cx9020/mx53cx9020.c
@@ -16,6 +16,7 @@
 #include <asm/mach-imx/mx5_video.h>
 #include <ACEX1K.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 
 enum LED_GPIOS {
 	GPIO_SD1_CD = IMX_GPIO_NR(1, 1),
diff --git a/board/birdland/bav335x/board.c b/board/birdland/bav335x/board.c
index 9eb851c..5900e65 100644
--- a/board/birdland/bav335x/board.c
+++ b/board/birdland/bav335x/board.c
@@ -11,6 +11,7 @@
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <net.h>
 #include <serial.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/bluegiga/apx4devkit/apx4devkit.c b/board/bluegiga/apx4devkit/apx4devkit.c
index 9268aa0..be8eefb 100644
--- a/board/bluegiga/apx4devkit/apx4devkit.c
+++ b/board/bluegiga/apx4devkit/apx4devkit.c
@@ -14,6 +14,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/setup.h>
diff --git a/board/bluewater/gurnard/gurnard.c b/board/bluewater/gurnard/gurnard.c
index 4ae70e1..2bbb203 100644
--- a/board/bluewater/gurnard/gurnard.c
+++ b/board/bluewater/gurnard/gurnard.c
@@ -33,6 +33,7 @@
 #include <asm/arch/clk.h>
 #include <asm/arch/gpio.h>
 #include <dm/uclass-internal.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_GURNARD_SPLASH
 #include "splash_logo.h"
diff --git a/board/bluewater/snapper9260/snapper9260.c b/board/bluewater/snapper9260/snapper9260.c
index 47ce307..8e2b7e0 100644
--- a/board/bluewater/snapper9260/snapper9260.c
+++ b/board/bluewater/snapper9260/snapper9260.c
@@ -23,6 +23,7 @@
 #include <netdev.h>
 #include <i2c.h>
 #include <pca953x.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/bosch/guardian/board.c b/board/bosch/guardian/board.c
index 03ba9e8..1d8fa78 100644
--- a/board/bosch/guardian/board.c
+++ b/board/bosch/guardian/board.c
@@ -11,9 +11,11 @@
 #include <common.h>
 #include <cpsw.h>
 #include <dm.h>
+#include <env.h>
 #include <env_internal.h>
 #include <errno.h>
 #include <i2c.h>
+#include <init.h>
 #include <led.h>
 #include <miiphy.h>
 #include <panel.h>
diff --git a/board/bosch/shc/board.c b/board/bosch/shc/board.c
index d34f3ba..6a102d3 100644
--- a/board/bosch/shc/board.c
+++ b/board/bosch/shc/board.c
@@ -12,11 +12,13 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <env.h>
 #include <errno.h>
 #include <init.h>
 #include <irq_func.h>
+#include <net.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
@@ -33,6 +35,7 @@
 #include <i2c.h>
 #include <miiphy.h>
 #include <cpsw.h>
+#include <linux/delay.h>
 #include <power/tps65217.h>
 #include <env_internal.h>
 #include <watchdog.h>
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 5018167..d49725d 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -5,7 +5,10 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
@@ -13,6 +16,7 @@
 #include <asm/arch/sys_proto.h>
 #include <malloc.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
@@ -986,7 +990,7 @@
 	return numpressed;
 }
 
-static int do_kbd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_kbd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char envvalue[ARRAY_SIZE(buttons)+1];
 	int numpressed = read_keys(envvalue);
diff --git a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
index d83eb9b..cff9a68 100644
--- a/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
+++ b/board/broadcom/bcm23550_w1d/bcm23550_w1d.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/mach-types.h>
 #include <env.h>
diff --git a/board/broadcom/bcm28155_ap/bcm28155_ap.c b/board/broadcom/bcm28155_ap/bcm28155_ap.c
index 40ced1a..e3bf808 100644
--- a/board/broadcom/bcm28155_ap/bcm28155_ap.c
+++ b/board/broadcom/bcm28155_ap/bcm28155_ap.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/mach-types.h>
 #include <env.h>
diff --git a/board/broadcom/bcm963158/bcm963158.c b/board/broadcom/bcm963158/bcm963158.c
index db82cd5..9feaee3 100644
--- a/board/broadcom/bcm963158/bcm963158.c
+++ b/board/broadcom/bcm963158/bcm963158.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <linux/io.h>
 
 #ifdef CONFIG_ARM64
diff --git a/board/broadcom/bcm968360bg/bcm968360bg.c b/board/broadcom/bcm968360bg/bcm968360bg.c
index a5fbc1d..90af6b8 100644
--- a/board/broadcom/bcm968360bg/bcm968360bg.c
+++ b/board/broadcom/bcm968360bg/bcm968360bg.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <linux/io.h>
 
 #ifdef CONFIG_ARM64
diff --git a/board/broadcom/bcm968580xref/bcm968580xref.c b/board/broadcom/bcm968580xref/bcm968580xref.c
index 2e547f5..1bd723d 100644
--- a/board/broadcom/bcm968580xref/bcm968580xref.c
+++ b/board/broadcom/bcm968580xref/bcm968580xref.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
 #include <linux/io.h>
 
 #ifdef CONFIG_ARM64
diff --git a/board/broadcom/bcm_ep/board.c b/board/broadcom/bcm_ep/board.c
index e4dbe42..31cae47 100644
--- a/board/broadcom/bcm_ep/board.c
+++ b/board/broadcom/bcm_ep/board.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <init.h>
+#include <net.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <config.h>
 #include <netdev.h>
diff --git a/board/broadcom/bcmns2/northstar2.c b/board/broadcom/bcmns2/northstar2.c
index 6cbad9c..91f489a 100644
--- a/board/broadcom/bcmns2/northstar2.c
+++ b/board/broadcom/bcmns2/northstar2.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <init.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 #include <asm/armv8/mmu.h>
 
diff --git a/board/broadcom/bcmstb/bcmstb.c b/board/broadcom/bcmstb/bcmstb.c
index ee0cf8f..add4285 100644
--- a/board/broadcom/bcmstb/bcmstb.c
+++ b/board/broadcom/bcmstb/bcmstb.c
@@ -8,6 +8,7 @@
 
 #include <cpu_func.h>
 #include <init.h>
+#include <log.h>
 #include <time.h>
 #include <linux/types.h>
 #include <common.h>
diff --git a/board/bticino/mamoj/mamoj.c b/board/bticino/mamoj/mamoj.c
index 6ad7e31..b7d37b7 100644
--- a/board/bticino/mamoj/mamoj.c
+++ b/board/bticino/mamoj/mamoj.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/sys_proto.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/bticino/mamoj/spl.c b/board/bticino/mamoj/spl.c
index 620e4d1..a9bb2a5 100644
--- a/board/bticino/mamoj/spl.c
+++ b/board/bticino/mamoj/spl.c
@@ -6,8 +6,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <serial.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <linux/sizes.h>
diff --git a/board/buffalo/lsxl/lsxl.c b/board/buffalo/lsxl/lsxl.c
index 95d3a5e..64daa45 100644
--- a/board/buffalo/lsxl/lsxl.c
+++ b/board/buffalo/lsxl/lsxl.c
@@ -8,8 +8,12 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
+#include <command.h>
 #include <env.h>
 #include <env_internal.h>
+#include <flash.h>
+#include <init.h>
 #include <net.h>
 #include <malloc.h>
 #include <netdev.h>
@@ -20,6 +24,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/mpp.h>
 #include <asm/arch/gpio.h>
+#include <linux/delay.h>
 
 #include "lsxl.h"
 
diff --git a/board/cavium/thunderx/atf.c b/board/cavium/thunderx/atf.c
index 2e7ba69..64aa198 100644
--- a/board/cavium/thunderx/atf.c
+++ b/board/cavium/thunderx/atf.c
@@ -4,7 +4,10 @@
 **/
 
 #include <common.h>
+#include <command.h>
+#include <asm/cache.h>
 #include <asm/io.h>
+#include <asm/ptrace.h>
 
 #include <asm/system.h>
 #include <cavium/thunderx_svc.h>
@@ -223,7 +226,7 @@
 	}
 }
 
-int do_atf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_atf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ssize_t ret;
 	size_t size, offset;
diff --git a/board/cavium/thunderx/thunderx.c b/board/cavium/thunderx/thunderx.c
index 687ade5..1b1b9d5 100644
--- a/board/cavium/thunderx/thunderx.c
+++ b/board/cavium/thunderx/thunderx.c
@@ -9,6 +9,7 @@
 #include <init.h>
 #include <malloc.h>
 #include <errno.h>
+#include <net.h>
 #include <linux/compiler.h>
 
 #include <cavium/atf.h>
diff --git a/board/ccv/xpress/spl.c b/board/ccv/xpress/spl.c
index 90f655a..38bda8d 100644
--- a/board/ccv/xpress/spl.c
+++ b/board/ccv/xpress/spl.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/mx6-ddr.h>
diff --git a/board/ccv/xpress/xpress.c b/board/ccv/xpress/xpress.c
index 0caeea5..e41f063 100644
--- a/board/ccv/xpress/xpress.c
+++ b/board/ccv/xpress/xpress.c
@@ -4,6 +4,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/imx-regs.h>
@@ -24,6 +25,7 @@
 #include <mmc.h>
 #include <netdev.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include <usb/ehci-ci.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/cirrus/edb93xx/edb93xx.c b/board/cirrus/edb93xx/edb93xx.c
index dfebb7c..0318bf1 100644
--- a/board/cirrus/edb93xx/edb93xx.c
+++ b/board/cirrus/edb93xx/edb93xx.c
@@ -16,7 +16,9 @@
 #include <config.h>
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <irq_func.h>
+#include <net.h>
 #include <netdev.h>
 #include <status_led.h>
 #include <asm/io.h>
diff --git a/board/cloudengines/pogo_e02/pogo_e02.c b/board/cloudengines/pogo_e02/pogo_e02.c
index 835c327..8df0391 100644
--- a/board/cloudengines/pogo_e02/pogo_e02.c
+++ b/board/cloudengines/pogo_e02/pogo_e02.c
@@ -10,6 +10,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/arch/cpu.h>
diff --git a/board/cobra5272/flash.c b/board/cobra5272/flash.c
index 1d3c5ac..4337f48 100644
--- a/board/cobra5272/flash.c
+++ b/board/cobra5272/flash.c
@@ -7,14 +7,17 @@
 #include <common.h>
 #include <console.h>
 #include <cpu_func.h>
+#include <flash.h>
 #include <irq_func.h>
+#include <uuid.h>
+#include <linux/delay.h>
 
 #define PHYS_FLASH_1 CONFIG_SYS_FLASH_BASE
 #define FLASH_BANK_SIZE 0x200000
 
 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
 
-void flash_print_info (flash_info_t * info)
+void flash_print_info(flash_info_t *info)
 {
 	int i;
 
@@ -55,7 +58,7 @@
 }
 
 
-unsigned long flash_init (void)
+unsigned long flash_init(void)
 {
 	int i, j;
 	ulong size = 0;
@@ -98,9 +101,9 @@
 		size += flash_info[i].size;
 	}
 
-	flash_protect (FLAG_PROTECT_SET,
-		       CONFIG_SYS_FLASH_BASE,
-		       CONFIG_SYS_FLASH_BASE + 0x3ffff, &flash_info[0]);
+	flash_protect(FLAG_PROTECT_SET,
+		      CONFIG_SYS_FLASH_BASE,
+		      CONFIG_SYS_FLASH_BASE + 0x3ffff, &flash_info[0]);
 
 	return size;
 }
@@ -127,7 +130,7 @@
 #define TMO   4
 
 
-int flash_erase (flash_info_t * info, int s_first, int s_last)
+int flash_erase(flash_info_t *info, int s_first, int s_last)
 {
 	ulong result;
 	int iflag, cflag, prot, sect;
@@ -233,7 +236,7 @@
 
       outahere:
 	/* allow flash to settle - wait 10 ms */
-	udelay (10000);
+	mdelay(10);
 
 	if (iflag)
 		enable_interrupts();
@@ -244,7 +247,7 @@
 	return rc;
 }
 
-static int write_word (flash_info_t * info, ulong dest, ulong data)
+static int write_word(flash_info_t *info, ulong dest, ulong data)
 {
 	volatile u16 *addr = (volatile u16 *) dest;
 	ulong result;
@@ -311,7 +314,7 @@
 }
 
 
-int write_buff (flash_info_t * info, uchar * src, ulong addr, ulong cnt)
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt)
 {
 	ulong wp, data;
 	int rc;
diff --git a/board/compal/paz00/paz00.c b/board/compal/paz00/paz00.c
index a7a1be3..64d0860 100644
--- a/board/compal/paz00/paz00.c
+++ b/board/compal/paz00/paz00.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/tegra.h>
 #include <asm/arch/pinmux.h>
diff --git a/board/compulab/cl-som-imx7/cl-som-imx7.c b/board/compulab/cl-som-imx7/cl-som-imx7.c
index 9277094..8b3bd5e 100644
--- a/board/compulab/cl-som-imx7/cl-som-imx7.c
+++ b/board/compulab/cl-som-imx7/cl-som-imx7.c
@@ -11,9 +11,11 @@
 #include <env.h>
 #include <init.h>
 #include <mmc.h>
+#include <net.h>
 #include <phy.h>
 #include <netdev.h>
 #include <fsl_esdhc_imx.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/pfuze3000_pmic.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/compulab/cm_fx6/cm_fx6.c b/board/compulab/cm_fx6/cm_fx6.c
index 3e185ad..4d71bed 100644
--- a/board/compulab/cm_fx6/cm_fx6.c
+++ b/board/compulab/cm_fx6/cm_fx6.c
@@ -16,6 +16,7 @@
 #include <init.h>
 #include <miiphy.h>
 #include <mtd_node.h>
+#include <net.h>
 #include <netdev.h>
 #include <errno.h>
 #include <usb.h>
@@ -34,6 +35,7 @@
 #include <dm/platform_data/serial_mxc.h>
 #include <dm/device-internal.h>
 #include <jffs2/load_kernel.h>
+#include <linux/delay.h>
 #include "common.h"
 #include "../common/eeprom.h"
 #include "../common/common.h"
diff --git a/board/compulab/cm_fx6/spl.c b/board/compulab/cm_fx6/spl.c
index 592d741..7d82435 100644
--- a/board/compulab/cm_fx6/spl.c
+++ b/board/compulab/cm_fx6/spl.c
@@ -20,6 +20,7 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <fsl_esdhc_imx.h>
+#include <linux/delay.h>
 #include "common.h"
 
 enum ddr_config {
diff --git a/board/compulab/cm_t335/cm_t335.c b/board/compulab/cm_t335/cm_t335.c
index 561f2f3..75b56f7 100644
--- a/board/compulab/cm_t335/cm_t335.c
+++ b/board/compulab/cm_t335/cm_t335.c
@@ -11,8 +11,10 @@
 #include <env.h>
 #include <errno.h>
 #include <miiphy.h>
+#include <net.h>
 #include <status_led.h>
 #include <cpsw.h>
+#include <linux/delay.h>
 
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware_am33xx.h>
diff --git a/board/compulab/cm_t335/spl.c b/board/compulab/cm_t335/spl.c
index 39ca535..8662632 100644
--- a/board/compulab/cm_t335/spl.c
+++ b/board/compulab/cm_t335/spl.c
@@ -13,6 +13,7 @@
 #include <cpu_func.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 
 #include <asm/arch/ddr_defs.h>
 #include <asm/arch/clock.h>
diff --git a/board/compulab/cm_t35/cm_t35.c b/board/compulab/cm_t35/cm_t35.c
index b52358b..4b67df4 100644
--- a/board/compulab/cm_t35/cm_t35.c
+++ b/board/compulab/cm_t35/cm_t35.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <status_led.h>
 #include <netdev.h>
 #include <net.h>
@@ -22,6 +23,7 @@
 #include <splash.h>
 #include <twl4030.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <linux/errno.h>
diff --git a/board/compulab/cm_t43/cm_t43.c b/board/compulab/cm_t43/cm_t43.c
index 2aa4534..f26e42b 100644
--- a/board/compulab/cm_t43/cm_t43.c
+++ b/board/compulab/cm_t43/cm_t43.c
@@ -7,9 +7,11 @@
 #include <i2c.h>
 #include <miiphy.h>
 #include <cpsw.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/emif.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/tps65218.h>
 #include "board.h"
diff --git a/board/compulab/cm_t54/cm_t54.c b/board/compulab/cm_t54/cm_t54.c
index 811bbb5..413f3c9 100644
--- a/board/compulab/cm_t54/cm_t54.c
+++ b/board/compulab/cm_t54/cm_t54.c
@@ -10,10 +10,12 @@
 #include <common.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <net.h>
 #include <usb.h>
 #include <mmc.h>
 #include <palmas.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/compulab/cm_t54/mux.c b/board/compulab/cm_t54/mux.c
index 50d5821..ea90bc6 100644
--- a/board/compulab/cm_t54/mux.c
+++ b/board/compulab/cm_t54/mux.c
@@ -10,6 +10,7 @@
 #ifndef _CM_T54_MUX_DATA_H
 #define _CM_T54_MUX_DATA_H
 
+#include <common.h>
 #include <asm/arch/mux_omap5.h>
 #include <asm/arch/sys_proto.h>
 
diff --git a/board/compulab/common/common.c b/board/compulab/common/common.c
index 2f92c65..528c97d 100644
--- a/board/compulab/common/common.c
+++ b/board/compulab/common/common.c
@@ -10,6 +10,7 @@
 #include <asm/bootm.h>
 #include <asm/gpio.h>
 #include <asm/setup.h>
+#include <linux/delay.h>
 
 #include "common.h"
 #include "eeprom.h"
diff --git a/board/compulab/common/omap3_smc911x.c b/board/compulab/common/omap3_smc911x.c
index 4b869ec..f0d3652 100644
--- a/board/compulab/common/omap3_smc911x.c
+++ b/board/compulab/common/omap3_smc911x.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <netdev.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <linux/errno.h>
diff --git a/board/congatec/cgtqmx6eval/cgtqmx6eval.c b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
index 49c731f..044cefd 100644
--- a/board/congatec/cgtqmx6eval/cgtqmx6eval.c
+++ b/board/congatec/cgtqmx6eval/cgtqmx6eval.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
@@ -26,6 +27,7 @@
 #include <fsl_esdhc_imx.h>
 #include <i2c.h>
 #include <input.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/pfuze100_pmic.h>
 #include <linux/fb.h>
diff --git a/board/corscience/tricorder/tricorder-eeprom.c b/board/corscience/tricorder/tricorder-eeprom.c
index 23c2ea91..192af30 100644
--- a/board/corscience/tricorder/tricorder-eeprom.c
+++ b/board/corscience/tricorder/tricorder-eeprom.c
@@ -5,6 +5,7 @@
  * Andreas Bießmann <andreas.biessmann@corscience.de>
  */
 #include <common.h>
+#include <command.h>
 #include <eeprom.h>
 #include <i2c.h>
 #include <u-boot/crc.h>
@@ -186,7 +187,7 @@
 	return ret;
 }
 
-int do_tricorder_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_tricorder_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *argv[])
 {
 	if (argc == 3) {
 		ulong dev_addr = simple_strtoul(argv[2], NULL, 16);
diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c
index cec819b..30974e8 100644
--- a/board/corscience/tricorder/tricorder.c
+++ b/board/corscience/tricorder/tricorder.c
@@ -10,6 +10,7 @@
  * Frederik Kriewitz <frederik@kriewitz.eu>
  */
 #include <common.h>
+#include <init.h>
 #include <malloc.h>
 #include <twl4030.h>
 #include <status_led.h>
diff --git a/board/cortina/presidio-asic/presidio.c b/board/cortina/presidio-asic/presidio.c
index b4fa01f..3c132f1 100644
--- a/board/cortina/presidio-asic/presidio.c
+++ b/board/cortina/presidio-asic/presidio.c
@@ -4,10 +4,12 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <malloc.h>
 #include <errno.h>
 #include <netdev.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <configs/presidio_asic.h>
 #include <linux/psci.h>
diff --git a/board/creative/xfi3/xfi3.c b/board/creative/xfi3/xfi3.c
index 228a394..adc9081 100644
--- a/board/creative/xfi3/xfi3.c
+++ b/board/creative/xfi3/xfi3.c
@@ -11,12 +11,15 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/iomux-mx23.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/cssi/MCR3000/MCR3000.c b/board/cssi/MCR3000/MCR3000.c
index 138d0c6..570e846 100644
--- a/board/cssi/MCR3000/MCR3000.c
+++ b/board/cssi/MCR3000/MCR3000.c
@@ -17,6 +17,7 @@
 #include <asm/io.h>
 #include <dm/uclass.h>
 #include <wdt.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/d-link/dns325/dns325.c b/board/d-link/dns325/dns325.c
index dfdc683..0ae2e7d 100644
--- a/board/d-link/dns325/dns325.c
+++ b/board/d-link/dns325/dns325.c
@@ -10,6 +10,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <miiphy.h>
 #include <net.h>
 #include <netdev.h>
diff --git a/board/davinci/da8xxevm/da850evm.c b/board/davinci/da8xxevm/da850evm.c
index d9019de..a3b0f8b 100644
--- a/board/davinci/da8xxevm/da850evm.c
+++ b/board/davinci/da8xxevm/da850evm.c
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <env.h>
 #include <i2c.h>
+#include <init.h>
 #include <net.h>
 #include <spi.h>
 #include <spi_flash.h>
diff --git a/board/davinci/da8xxevm/omapl138_lcdk.c b/board/davinci/da8xxevm/omapl138_lcdk.c
index 608a7f2..adb56c6 100644
--- a/board/davinci/da8xxevm/omapl138_lcdk.c
+++ b/board/davinci/da8xxevm/omapl138_lcdk.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <env.h>
 #include <i2c.h>
+#include <init.h>
 #include <net.h>
 #include <asm/arch/hardware.h>
 #include <asm/ti-common/davinci_nand.h>
diff --git a/board/dfi/dfi-bt700/dfi-bt700.c b/board/dfi/dfi-bt700/dfi-bt700.c
index f4c4b1d..87506a7 100644
--- a/board/dfi/dfi-bt700/dfi-bt700.c
+++ b/board/dfi/dfi-bt700/dfi-bt700.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
 #include <nuvoton_nct6102d.h>
 #include <asm/gpio.h>
 #include <asm/ibmpc.h>
 #include <asm/pnp_def.h>
+#include <linux/delay.h>
 
 int board_early_init_f(void)
 {
diff --git a/board/dhelectronics/dh_imx6/dh_imx6.c b/board/dhelectronics/dh_imx6/dh_imx6.c
index b6f8b11..8f50433 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6.c
@@ -8,7 +8,9 @@
 #include <common.h>
 #include <dm.h>
 #include <eeprom.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <dm/device-internal.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
@@ -30,6 +32,7 @@
 #include <i2c_eeprom.h>
 #include <mmc.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include <usb/ehci-ci.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/dhelectronics/dh_imx6/dh_imx6_spl.c b/board/dhelectronics/dh_imx6/dh_imx6_spl.c
index f2c3ac3..ed4dea4 100644
--- a/board/dhelectronics/dh_imx6/dh_imx6_spl.c
+++ b/board/dhelectronics/dh_imx6/dh_imx6_spl.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/imx-regs.h>
@@ -24,6 +25,7 @@
 #include <i2c.h>
 #include <mmc.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #define ENET_PAD_CTRL							\
 	(PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm |	\
diff --git a/board/dhelectronics/dh_stm32mp1/board.c b/board/dhelectronics/dh_stm32mp1/board.c
index 85d56f6..26e827b 100644
--- a/board/dhelectronics/dh_stm32mp1/board.c
+++ b/board/dhelectronics/dh_stm32mp1/board.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <adc.h>
+#include <log.h>
+#include <net.h>
 #include <asm/arch/stm32.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
@@ -30,6 +32,8 @@
 #include <mtd_node.h>
 #include <netdev.h>
 #include <phy.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 #include <remoteproc.h>
 #include <reset.h>
diff --git a/board/ea/mx7ulp_com/mx7ulp_com.c b/board/ea/mx7ulp_com/mx7ulp_com.c
index 6fc1631..a9b8a32 100644
--- a/board/ea/mx7ulp_com/mx7ulp_com.c
+++ b/board/ea/mx7ulp_com/mx7ulp_com.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mx7ulp-pins.h>
diff --git a/board/eets/pdu001/board.c b/board/eets/pdu001/board.c
index fc4587e..a602b62 100644
--- a/board/eets/pdu001/board.c
+++ b/board/eets/pdu001/board.c
@@ -13,6 +13,7 @@
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <i2c.h>
 #include <watchdog.h>
diff --git a/board/egnite/ethernut5/ethernut5_pwrman.c b/board/egnite/ethernut5/ethernut5_pwrman.c
index aa99d29..81f1abf 100644
--- a/board/egnite/ethernut5/ethernut5_pwrman.c
+++ b/board/egnite/ethernut5/ethernut5_pwrman.c
@@ -32,11 +32,13 @@
  * http://www.ethernut.de/
  */
 #include <common.h>
+#include <command.h>
 #include <asm/arch/at91sam9260.h>
 #include <asm/arch/at91_common.h>
 #include <asm/arch/gpio.h>
 #include <asm/io.h>
 #include <i2c.h>
+#include <linux/delay.h>
 
 #include "ethernut5_pwrman.h"
 
@@ -215,7 +217,7 @@
 /*
  * Process the board specific 'pwrman' command.
  */
-int do_pwrman(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_pwrman(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	u8 val;
 	int i;
diff --git a/board/el/el6x/el6x.c b/board/el/el6x/el6x.c
index 9aa71b9..d3e2981 100644
--- a/board/el/el6x/el6x.c
+++ b/board/el/el6x/el6x.c
@@ -5,12 +5,15 @@
  * Based on other i.MX6 boards
  */
 
+#include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/elgin/elgin_rv1108/elgin_rv1108.c b/board/elgin/elgin_rv1108/elgin_rv1108.c
index c5a1cc9..5d8f622 100644
--- a/board/elgin/elgin_rv1108/elgin_rv1108.c
+++ b/board/elgin/elgin_rv1108/elgin_rv1108.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/clock.h>
diff --git a/board/embest/mx6boards/mx6boards.c b/board/embest/mx6boards/mx6boards.c
index bf5c020..e0834f0 100644
--- a/board/embest/mx6boards/mx6boards.c
+++ b/board/embest/mx6boards/mx6boards.c
@@ -12,12 +12,15 @@
  * Copyright (C) 2013 Jon Nettleton <jon.nettleton@gmail.com>.
  */
 
+#include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/emulation/qemu-arm/qemu-arm.c b/board/emulation/qemu-arm/qemu-arm.c
index 4e18733..69e8ef4 100644
--- a/board/emulation/qemu-arm/qemu-arm.c
+++ b/board/emulation/qemu-arm/qemu-arm.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <log.h>
 #include <virtio_types.h>
 #include <virtio.h>
 
diff --git a/board/emulation/qemu-riscv/qemu-riscv.c b/board/emulation/qemu-riscv/qemu-riscv.c
index c3f9698..dcfd3f2 100644
--- a/board/emulation/qemu-riscv/qemu-riscv.c
+++ b/board/emulation/qemu-riscv/qemu-riscv.c
@@ -7,6 +7,8 @@
 #include <dm.h>
 #include <env.h>
 #include <fdtdec.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <init.h>
 #include <virtio_types.h>
diff --git a/board/engicam/common/board.c b/board/engicam/common/board.c
index 9483516..5a2003d 100644
--- a/board/engicam/common/board.c
+++ b/board/engicam/common/board.c
@@ -10,6 +10,7 @@
 #include <env.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
 #include <mmc.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
diff --git a/board/engicam/common/spl.c b/board/engicam/common/spl.c
index a9820a9..6a06124 100644
--- a/board/engicam/common/spl.c
+++ b/board/engicam/common/spl.c
@@ -6,8 +6,11 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <init.h>
 #include <serial.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c
index 6c59927..fd7d6db 100644
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <env.h>
 #include <init.h>
+#include <net.h>
 #include <serial.h>
 #include <vsprintf.h>
 #include <asm/io.h>
diff --git a/board/esd/vme8349/caddy.c b/board/esd/vme8349/caddy.c
index db8d7bf..ba91f4b 100644
--- a/board/esd/vme8349/caddy.c
+++ b/board/esd/vme8349/caddy.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <console.h>
 #include <ioports.h>
 #include <mpc83xx.h>
@@ -36,7 +37,7 @@
 		caddy_interface->answer_in = ptr;
 }
 
-int do_caddy(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_caddy(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long base_addr;
 	uint32_t ptr;
diff --git a/board/esd/vme8349/pci.c b/board/esd/vme8349/pci.c
index 349e7b5..bf51d39 100644
--- a/board/esd/vme8349/pci.c
+++ b/board/esd/vme8349/pci.c
@@ -18,6 +18,7 @@
 #include <pci.h>
 #include <i2c.h>
 #include <asm/fsl_i2c.h>
+#include <linux/delay.h>
 #include "vme8349pin.h"
 
 static struct pci_region pci1_regions[] = {
diff --git a/board/esd/vme8349/vme8349.c b/board/esd/vme8349/vme8349.c
index ff81164..f54c89d 100644
--- a/board/esd/vme8349/vme8349.c
+++ b/board/esd/vme8349/vme8349.c
@@ -16,6 +16,7 @@
 #include <init.h>
 #include <ioports.h>
 #include <mpc83xx.h>
+#include <net.h>
 #include <asm/mpc8349_pci.h>
 #if defined(CONFIG_OF_LIBFDT)
 #include <linux/libfdt.h>
diff --git a/board/firefly/firefly-rk3288/firefly-rk3288.c b/board/firefly/firefly-rk3288/firefly-rk3288.c
index a2b0eb5..1965985 100644
--- a/board/firefly/firefly-rk3288/firefly-rk3288.c
+++ b/board/firefly/firefly-rk3288/firefly-rk3288.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <hang.h>
+#include <log.h>
 
 #ifdef CONFIG_SPL_BUILD
 static int setup_led(void)
diff --git a/board/firefly/firefly-rk3308/roc_cc_rk3308.c b/board/firefly/firefly-rk3308/roc_cc_rk3308.c
index 5f0a659..28dcc2a 100644
--- a/board/firefly/firefly-rk3308/roc_cc_rk3308.c
+++ b/board/firefly/firefly-rk3308/roc_cc_rk3308.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/arch/grf_rk3308.h>
 #include <asm/arch-rockchip/hardware.h>
+#include <linux/bitops.h>
 
 #if defined(CONFIG_DEBUG_UART)
 #define GRF_BASE	0xff000000
diff --git a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
index 0fe1914..7c3a803 100644
--- a/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
+++ b/board/firefly/roc-pc-rk3399/roc-pc-rk3399.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch-rockchip/periph.h>
 #include <power/regulator.h>
 #include <spl_gpio.h>
diff --git a/board/freescale/b4860qds/b4860qds.c b/board/freescale/b4860qds/b4860qds.c
index e7f684b..e10f948 100644
--- a/board/freescale/b4860qds/b4860qds.c
+++ b/board/freescale/b4860qds/b4860qds.c
@@ -8,12 +8,15 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
 #include <irq_func.h>
+#include <log.h>
 #include <netdev.h>
 #include <linux/compiler.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/cache.h>
 #include <asm/immap_85xx.h>
diff --git a/board/freescale/b4860qds/ddr.c b/board/freescale/b4860qds/ddr.c
index de9f5f5..d3aa349 100644
--- a/board/freescale/b4860qds/ddr.c
+++ b/board/freescale/b4860qds/ddr.c
@@ -7,6 +7,8 @@
 #include <i2c.h>
 #include <hwconfig.h>
 #include <fsl_ddr.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/freescale/b4860qds/eth_b4860qds.c b/board/freescale/b4860qds/eth_b4860qds.c
index 67fb1b9b..6d5f3d1 100644
--- a/board/freescale/b4860qds/eth_b4860qds.c
+++ b/board/freescale/b4860qds/eth_b4860qds.c
@@ -19,6 +19,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/fsl_serdes.h>
 #include <fm_eth.h>
diff --git a/board/freescale/bsc9131rdb/bsc9131rdb.c b/board/freescale/bsc9131rdb/bsc9131rdb.c
index 30e7a1f..75c2aec 100644
--- a/board/freescale/bsc9131rdb/bsc9131rdb.c
+++ b/board/freescale/bsc9131rdb/bsc9131rdb.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <init.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/cache.h>
diff --git a/board/freescale/bsc9131rdb/spl_minimal.c b/board/freescale/bsc9131rdb/spl_minimal.c
index 79df0f3..4ae9ba0 100644
--- a/board/freescale/bsc9131rdb/spl_minimal.c
+++ b/board/freescale/bsc9131rdb/spl_minimal.c
@@ -12,6 +12,7 @@
 #include <asm/fsl_law.h>
 #include <fsl_ddr_sdram.h>
 #include <asm/global_data.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/bsc9132qds/bsc9132qds.c b/board/freescale/bsc9132qds/bsc9132qds.c
index ab05d84..6870674 100644
--- a/board/freescale/bsc9132qds/bsc9132qds.c
+++ b/board/freescale/bsc9132qds/bsc9132qds.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/cache.h>
diff --git a/board/freescale/bsc9132qds/spl_minimal.c b/board/freescale/bsc9132qds/spl_minimal.c
index dc72b2e..dd56ad6 100644
--- a/board/freescale/bsc9132qds/spl_minimal.c
+++ b/board/freescale/bsc9132qds/spl_minimal.c
@@ -12,6 +12,7 @@
 #include <asm/fsl_law.h>
 #include <fsl_ddr_sdram.h>
 #include <asm/global_data.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/c29xpcie/c29xpcie.c b/board/freescale/c29xpcie/c29xpcie.c
index a9ea986..74502c6 100644
--- a/board/freescale/c29xpcie/c29xpcie.c
+++ b/board/freescale/c29xpcie/c29xpcie.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/cache.h>
diff --git a/board/freescale/c29xpcie/cpld.c b/board/freescale/c29xpcie/cpld.c
index f57047d..826af42 100644
--- a/board/freescale/c29xpcie/cpld.c
+++ b/board/freescale/c29xpcie/cpld.c
@@ -17,6 +17,7 @@
 #include <common.h>
 #include <command.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #include "cpld.h"
 /**
@@ -89,7 +90,7 @@
 #endif
 
 #ifndef CONFIG_SPL_BUILD
-int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int cpld_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 	unsigned char value;
diff --git a/board/freescale/common/arm_sleep.c b/board/freescale/common/arm_sleep.c
index d18b4fc..bb1ef99 100644
--- a/board/freescale/common/arm_sleep.c
+++ b/board/freescale/common/arm_sleep.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #ifndef CONFIG_ARMV7_NONSEC
 #error " Deep sleep needs non-secure mode support. "
diff --git a/board/freescale/common/cmd_esbc_validate.c b/board/freescale/common/cmd_esbc_validate.c
index 36b620c..638aa3c 100644
--- a/board/freescale/common/cmd_esbc_validate.c
+++ b/board/freescale/common/cmd_esbc_validate.c
@@ -8,8 +8,8 @@
 #include <env.h>
 #include <fsl_validate.h>
 
-int do_esbc_halt(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+int do_esbc_halt(struct cmd_tbl *cmdtp, int flag, int argc,
+		 char *const argv[])
 {
 	if (fsl_check_boot_mode_secure() == 0) {
 		printf("Boot Mode is Non-Secure. Not entering spin loop.\n");
@@ -24,8 +24,8 @@
 }
 
 #ifndef CONFIG_SPL_BUILD
-static int do_esbc_validate(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_esbc_validate(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	char *hash_str = NULL;
 	uintptr_t haddr;
diff --git a/board/freescale/common/diu_ch7301.c b/board/freescale/common/diu_ch7301.c
index 7f11123..02a2718 100644
--- a/board/freescale/common/diu_ch7301.c
+++ b/board/freescale/common/diu_ch7301.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <stdio_dev.h>
 #include <i2c.h>
+#include <linux/delay.h>
 
 #define I2C_DVI_INPUT_DATA_FORMAT_REG		0x1F
 #define I2C_DVI_PLL_CHARGE_CNTL_REG		0x33
diff --git a/board/freescale/common/fsl_chain_of_trust.c b/board/freescale/common/fsl_chain_of_trust.c
index a024e72..cafb249 100644
--- a/board/freescale/common/fsl_chain_of_trust.c
+++ b/board/freescale/common/fsl_chain_of_trust.c
@@ -9,6 +9,7 @@
 #include <fsl_validate.h>
 #include <fsl_secboot_err.h>
 #include <fsl_sfp.h>
+#include <log.h>
 #include <dm/root.h>
 
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_FRAMEWORK)
diff --git a/board/freescale/common/fsl_validate.c b/board/freescale/common/fsl_validate.c
index 2bf9d58..564a8b3 100644
--- a/board/freescale/common/fsl_validate.c
+++ b/board/freescale/common/fsl_validate.c
@@ -5,11 +5,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <flash.h>
 #include <fsl_validate.h>
 #include <fsl_secboot_err.h>
 #include <fsl_sfp.h>
 #include <fsl_sec.h>
 #include <command.h>
+#include <log.h>
 #include <malloc.h>
 #include <u-boot/rsa-mod-exp.h>
 #include <hash.h>
diff --git a/board/freescale/common/ics307_clk.c b/board/freescale/common/ics307_clk.c
index f1e60cf..2143395 100644
--- a/board/freescale/common/ics307_clk.c
+++ b/board/freescale/common/ics307_clk.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 
 #include "ics307_clk.h"
diff --git a/board/freescale/common/idt8t49n222a_serdes_clk.c b/board/freescale/common/idt8t49n222a_serdes_clk.c
index 4f8e8b7..bb3cdac 100644
--- a/board/freescale/common/idt8t49n222a_serdes_clk.c
+++ b/board/freescale/common/idt8t49n222a_serdes_clk.c
@@ -5,6 +5,8 @@
  */
 
 #include "idt8t49n222a_serdes_clk.h"
+#include <log.h>
+#include <linux/delay.h>
 
 #define DEVICE_ID_REG		0x00
 
diff --git a/board/freescale/common/mc34vr500.c b/board/freescale/common/mc34vr500.c
index d4f0f0c..d6b4c65 100644
--- a/board/freescale/common/mc34vr500.c
+++ b/board/freescale/common/mc34vr500.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/mc34vr500_pmic.h>
 
diff --git a/board/freescale/common/mpc85xx_sleep.c b/board/freescale/common/mpc85xx_sleep.c
index 739a416..6f6f4d4 100644
--- a/board/freescale/common/mpc85xx_sleep.c
+++ b/board/freescale/common/mpc85xx_sleep.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/immap_85xx.h>
 #include "sleep.h"
 #ifdef CONFIG_U_QE
diff --git a/board/freescale/common/ngpixis.c b/board/freescale/common/ngpixis.c
index d725401..37a6f77 100644
--- a/board/freescale/common/ngpixis.c
+++ b/board/freescale/common/ngpixis.c
@@ -171,7 +171,8 @@
 	PIXIS_WRITE(sclk[2], sclk2);
 }
 
-int pixis_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int pixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	unsigned int i;
 	unsigned long sysclk;
diff --git a/board/freescale/common/ns_access.c b/board/freescale/common/ns_access.c
index 0e6f213..ee8ed61 100644
--- a/board/freescale/common/ns_access.c
+++ b/board/freescale/common/ns_access.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <fsl_csu.h>
 #include <asm/arch/ns_access.h>
diff --git a/board/freescale/common/pixis.c b/board/freescale/common/pixis.c
index e9b7127..4127fbc 100644
--- a/board/freescale/common/pixis.c
+++ b/board/freescale/common/pixis.c
@@ -266,8 +266,8 @@
 /* Disable the watchdog
  *
  */
-static int pixis_disable_watchdog_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
-				      char * const argv[])
+static int pixis_disable_watchdog_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+				      char *const argv[])
 {
 	/* Disable the VELA sequencer and the watchdog */
 	clrbits_8(pixis_base + PIXIS_VCTL, 9);
@@ -285,7 +285,8 @@
 
 /* Enable or disable SGMII mode for a TSEC
  */
-static int pixis_set_sgmii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int pixis_set_sgmii(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	int which_tsec = -1;
 	unsigned char mask;
@@ -411,7 +412,8 @@
 	return intval + decval;
 }
 
-static int pixis_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int pixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	unsigned int i;
 	char *p_cf = NULL;
diff --git a/board/freescale/common/qixis.c b/board/freescale/common/qixis.c
index dd1ee90..5912031 100644
--- a/board/freescale/common/qixis.c
+++ b/board/freescale/common/qixis.c
@@ -233,7 +233,8 @@
 	puts("Reverse engineering switch is not implemented for this board\n");
 }
 
-static int qixis_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int qixis_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	int i;
 
diff --git a/board/freescale/common/sgmii_riser.c b/board/freescale/common/sgmii_riser.c
index f3e0fb2..2315793 100644
--- a/board/freescale/common/sgmii_riser.c
+++ b/board/freescale/common/sgmii_riser.c
@@ -14,6 +14,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <net.h>
 #include <linux/libfdt.h>
 #include <tsec.h>
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index c487e3a..728245d 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -10,7 +10,9 @@
 #include <command.h>
 #include <env.h>
 #include <i2c.h>
+#include <init.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <u-boot/crc.h>
 
 #ifdef CONFIG_SYS_I2C_EEPROM_CCID
@@ -382,7 +384,7 @@
 	update_crc();
 }
 
-int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char cmd;
 
diff --git a/board/freescale/common/vid.c b/board/freescale/common/vid.c
index 2085247..ed0d9b4 100644
--- a/board/freescale/common/vid.c
+++ b/board/freescale/common/vid.c
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <i2c.h>
 #include <irq_func.h>
+#include <log.h>
 #include <asm/io.h>
 #ifdef CONFIG_FSL_LSCH2
 #include <asm/arch/immap_lsch2.h>
@@ -16,6 +17,7 @@
 #else
 #include <asm/immap_85xx.h>
 #endif
+#include <linux/delay.h>
 #include "vid.h"
 
 int __weak i2c_multiplexer_select_vid_channel(u8 channel)
@@ -925,9 +927,9 @@
 
 }
 
-static int do_vdd_override(cmd_tbl_t *cmdtp,
+static int do_vdd_override(struct cmd_tbl *cmdtp,
 			   int flag, int argc,
-			   char * const argv[])
+			   char *const argv[])
 {
 	ulong override;
 
@@ -941,9 +943,8 @@
 	return 0;
 }
 
-static int do_vdd_read(cmd_tbl_t *cmdtp,
-			 int flag, int argc,
-			 char * const argv[])
+static int do_vdd_read(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	if (argc < 1)
 		return CMD_RET_USAGE;
diff --git a/board/freescale/common/vsc3316_3308.c b/board/freescale/common/vsc3316_3308.c
index f0d273c..8aceb8e 100644
--- a/board/freescale/common/vsc3316_3308.c
+++ b/board/freescale/common/vsc3316_3308.c
@@ -5,6 +5,7 @@
  */
 
 #include "vsc3316_3308.h"
+#include <log.h>
 
 #define REVISION_ID_REG		0x7E
 #define INTERFACE_MODE_REG		0x79
diff --git a/board/freescale/common/zm7300.c b/board/freescale/common/zm7300.c
index acd5343..03679e7 100644
--- a/board/freescale/common/zm7300.c
+++ b/board/freescale/common/zm7300.c
@@ -5,6 +5,7 @@
 
 /* Power-One ZM7300 DPM */
 #include "zm7300.h"
+#include <log.h>
 
 #define DPM_WP 0x96
 #define WRP_OPCODE 0x01
diff --git a/board/freescale/corenet_ds/corenet_ds.c b/board/freescale/corenet_ds/corenet_ds.c
index 66eea32..f0c7bed 100644
--- a/board/freescale/corenet_ds/corenet_ds.c
+++ b/board/freescale/corenet_ds/corenet_ds.c
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/freescale/corenet_ds/ddr.c b/board/freescale/corenet_ds/ddr.c
index 9c8731c..19f6e87 100644
--- a/board/freescale/corenet_ds/ddr.c
+++ b/board/freescale/corenet_ds/ddr.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <vsprintf.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
diff --git a/board/freescale/corenet_ds/eth_hydra.c b/board/freescale/corenet_ds/eth_hydra.c
index 45c23df..a17ca7a 100644
--- a/board/freescale/corenet_ds/eth_hydra.c
+++ b/board/freescale/corenet_ds/eth_hydra.c
@@ -48,6 +48,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/fsl_serdes.h>
 #include <fm_eth.h>
diff --git a/board/freescale/corenet_ds/eth_p4080.c b/board/freescale/corenet_ds/eth_p4080.c
index 0979c5f..801a6f4 100644
--- a/board/freescale/corenet_ds/eth_p4080.c
+++ b/board/freescale/corenet_ds/eth_p4080.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -20,6 +22,7 @@
 #include <fsl_mdio.h>
 #include <miiphy.h>
 #include <phy.h>
+#include <linux/delay.h>
 
 #include "../common/ngpixis.h"
 #include "../common/fman.h"
diff --git a/board/freescale/corenet_ds/eth_superhydra.c b/board/freescale/corenet_ds/eth_superhydra.c
index 1962b7e..8ca220b 100644
--- a/board/freescale/corenet_ds/eth_superhydra.c
+++ b/board/freescale/corenet_ds/eth_superhydra.c
@@ -48,6 +48,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/fsl_serdes.h>
 #include <fm_eth.h>
diff --git a/board/freescale/imx8mm_evk/imx8mm_evk.c b/board/freescale/imx8mm_evk/imx8mm_evk.c
index 53ebb94..c43af9b 100644
--- a/board/freescale/imx8mm_evk/imx8mm_evk.c
+++ b/board/freescale/imx8mm_evk/imx8mm_evk.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <init.h>
 #include <miiphy.h>
 #include <netdev.h>
 
diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c
index 4d34622..19c8a5a 100644
--- a/board/freescale/imx8mm_evk/spl.c
+++ b/board/freescale/imx8mm_evk/spl.c
@@ -4,8 +4,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/freescale/imx8mn_evk/imx8mn_evk.c b/board/freescale/imx8mn_evk/imx8mn_evk.c
index 4f33c0e..ea02bb7 100644
--- a/board/freescale/imx8mn_evk/imx8mn_evk.c
+++ b/board/freescale/imx8mn_evk/imx8mn_evk.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c
index 45417b2..dd38c10 100644
--- a/board/freescale/imx8mn_evk/spl.c
+++ b/board/freescale/imx8mn_evk/spl.c
@@ -5,8 +5,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/freescale/imx8mp_evk/imx8mp_evk.c b/board/freescale/imx8mp_evk/imx8mp_evk.c
index f004af6..97ba156 100644
--- a/board/freescale/imx8mp_evk/imx8mp_evk.c
+++ b/board/freescale/imx8mp_evk/imx8mp_evk.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <errno.h>
+#include <init.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm-generic/gpio.h>
 #include <asm/arch/imx8mp_pins.h>
diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c
index c5f640d..cd5b32c 100644
--- a/board/freescale/imx8mp_evk/spl.c
+++ b/board/freescale/imx8mp_evk/spl.c
@@ -5,8 +5,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <errno.h>
diff --git a/board/freescale/imx8mq_evk/imx8mq_evk.c b/board/freescale/imx8mq_evk/imx8mq_evk.c
index b2f464a..ae3be57 100644
--- a/board/freescale/imx8mq_evk/imx8mq_evk.c
+++ b/board/freescale/imx8mq_evk/imx8mq_evk.c
@@ -21,6 +21,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/arch/clock.h>
 #include <spl.h>
+#include <linux/bitops.h>
 #include <power/pmic.h>
 #include <power/pfuze100_pmic.h>
 #include "../common/pfuze.h"
diff --git a/board/freescale/imx8mq_evk/spl.c b/board/freescale/imx8mq_evk/spl.c
index 6ba6a52..2c6ae48 100644
--- a/board/freescale/imx8mq_evk/spl.c
+++ b/board/freescale/imx8mq_evk/spl.c
@@ -7,6 +7,9 @@
 
 #include <common.h>
 #include <hang.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <asm/io.h>
@@ -19,6 +22,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <fsl_esdhc_imx.h>
 #include <mmc.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/pfuze100_pmic.h>
 #include <spl.h>
diff --git a/board/freescale/imx8qm_mek/spl.c b/board/freescale/imx8qm_mek/spl.c
index ba99002..9dee12a 100644
--- a/board/freescale/imx8qm_mek/spl.c
+++ b/board/freescale/imx8qm_mek/spl.c
@@ -6,6 +6,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
diff --git a/board/freescale/imx8qxp_mek/imx8qxp_mek.c b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
index dc9ffaa..8b8a3c6 100644
--- a/board/freescale/imx8qxp_mek/imx8qxp_mek.c
+++ b/board/freescale/imx8qxp_mek/imx8qxp_mek.c
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fsl_esdhc_imx.h>
 #include <fdt_support.h>
diff --git a/board/freescale/imx8qxp_mek/spl.c b/board/freescale/imx8qxp_mek/spl.c
index eefee64..881d297 100644
--- a/board/freescale/imx8qxp_mek/spl.c
+++ b/board/freescale/imx8qxp_mek/spl.c
@@ -6,6 +6,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <spl.h>
 #include <dm/uclass.h>
 #include <dm/device.h>
diff --git a/board/freescale/imxrt1020-evk/imxrt1020-evk.c b/board/freescale/imxrt1020-evk/imxrt1020-evk.c
index 06ad524..0cef607 100644
--- a/board/freescale/imxrt1020-evk/imxrt1020-evk.c
+++ b/board/freescale/imxrt1020-evk/imxrt1020-evk.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <spl.h>
 #include <asm/io.h>
diff --git a/board/freescale/imxrt1050-evk/imxrt1050-evk.c b/board/freescale/imxrt1050-evk/imxrt1050-evk.c
index bda03b5..edc7fb1 100644
--- a/board/freescale/imxrt1050-evk/imxrt1050-evk.c
+++ b/board/freescale/imxrt1050-evk/imxrt1050-evk.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <spl.h>
 #include <asm/io.h>
diff --git a/board/freescale/ls1012afrdm/eth.c b/board/freescale/ls1012afrdm/eth.c
index bd1df09..eaea1c4 100644
--- a/board/freescale/ls1012afrdm/eth.c
+++ b/board/freescale/ls1012afrdm/eth.c
@@ -18,6 +18,7 @@
 #include <asm/arch-fsl-layerscape/config.h>
 #include <asm/arch-fsl-layerscape/immap_lsch2.h>
 #include <asm/arch/fsl_serdes.h>
+#include <linux/delay.h>
 #include <net/pfe_eth/pfe_eth.h>
 #include <dm/platform_data/pfe_dm_eth.h>
 
diff --git a/board/freescale/ls1012afrdm/ls1012afrdm.c b/board/freescale/ls1012afrdm/ls1012afrdm.c
index d138c93..f63377f 100644
--- a/board/freescale/ls1012afrdm/ls1012afrdm.c
+++ b/board/freescale/ls1012afrdm/ls1012afrdm.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <asm/cache.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1012aqds/eth.c b/board/freescale/ls1012aqds/eth.c
index b901844..b4ef607 100644
--- a/board/freescale/ls1012aqds/eth.c
+++ b/board/freescale/ls1012aqds/eth.c
@@ -17,6 +17,7 @@
 #include <asm/arch-fsl-layerscape/config.h>
 #include <asm/arch-fsl-layerscape/immap_lsch2.h>
 #include <asm/arch/fsl_serdes.h>
+#include <linux/delay.h>
 #include "../common/qixis.h"
 #include <net/pfe_eth/pfe_eth.h>
 #include <dm/platform_data/pfe_dm_eth.h>
diff --git a/board/freescale/ls1012aqds/ls1012aqds.c b/board/freescale/ls1012aqds/ls1012aqds.c
index 30bf104..2497831 100644
--- a/board/freescale/ls1012aqds/ls1012aqds.c
+++ b/board/freescale/ls1012aqds/ls1012aqds.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <fdt_support.h>
+#include <asm/cache.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1012ardb/eth.c b/board/freescale/ls1012ardb/eth.c
index 5edcfcf..63d40de 100644
--- a/board/freescale/ls1012ardb/eth.c
+++ b/board/freescale/ls1012ardb/eth.c
@@ -18,6 +18,7 @@
 #include <asm/arch-fsl-layerscape/config.h>
 #include <asm/arch-fsl-layerscape/immap_lsch2.h>
 #include <asm/arch/fsl_serdes.h>
+#include <linux/delay.h>
 #include <net/pfe_eth/pfe_eth.h>
 #include <dm/platform_data/pfe_dm_eth.h>
 #include <i2c.h>
diff --git a/board/freescale/ls1012ardb/ls1012ardb.c b/board/freescale/ls1012ardb/ls1012ardb.c
index ab83ef1..5b814f7 100644
--- a/board/freescale/ls1012ardb/ls1012ardb.c
+++ b/board/freescale/ls1012ardb/ls1012ardb.c
@@ -4,9 +4,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <fdt_support.h>
 #include <hang.h>
 #include <i2c.h>
+#include <asm/cache.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
@@ -392,8 +395,8 @@
 	return ret;
 }
 
-static int flash_bank_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int flash_bank_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	if (argc != 2)
 		return CMD_RET_USAGE;
diff --git a/board/freescale/ls1021aiot/ls1021aiot.c b/board/freescale/ls1021aiot/ls1021aiot.c
index b4201e7..fe97b82 100644
--- a/board/freescale/ls1021aiot/ls1021aiot.c
+++ b/board/freescale/ls1021aiot/ls1021aiot.c
@@ -7,10 +7,12 @@
 #include <clock_legacy.h>
 #include <fdt_support.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/immap_ls102xa.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/arch/ls102xa_stream_id.h>
+#include <linux/delay.h>
 
 #include <asm/arch/ls102xa_devdis.h>
 #include <asm/arch/ls102xa_soc.h>
diff --git a/board/freescale/ls1021aqds/ddr.c b/board/freescale/ls1021aqds/ddr.c
index d3e2e53..f84bce9 100644
--- a/board/freescale/ls1021aqds/ddr.c
+++ b/board/freescale/ls1021aqds/ddr.c
@@ -6,8 +6,11 @@
 #include <common.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <linux/delay.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/ls1021aqds/eth.c b/board/freescale/ls1021aqds/eth.c
index d0a9883..2de62cf 100644
--- a/board/freescale/ls1021aqds/eth.c
+++ b/board/freescale/ls1021aqds/eth.c
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/arch/fsl_serdes.h>
 #include <fsl_mdio.h>
diff --git a/board/freescale/ls1021aqds/ls1021aqds.c b/board/freescale/ls1021aqds/ls1021aqds.c
index 1ae822e..c03e96b 100644
--- a/board/freescale/ls1021aqds/ls1021aqds.c
+++ b/board/freescale/ls1021aqds/ls1021aqds.c
@@ -9,6 +9,7 @@
 #include <fdt_support.h>
 #include <i2c.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/immap_ls102xa.h>
 #include <asm/arch/clock.h>
diff --git a/board/freescale/ls1021atsn/ls1021atsn.c b/board/freescale/ls1021atsn/ls1021atsn.c
index 3876910..b05037d 100644
--- a/board/freescale/ls1021atsn/ls1021atsn.c
+++ b/board/freescale/ls1021atsn/ls1021atsn.c
@@ -5,11 +5,13 @@
 #include <clock_legacy.h>
 #include <fdt_support.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch-ls102xa/ls102xa_soc.h>
 #include <asm/arch/ls102xa_devdis.h>
 #include <asm/arch/immap_ls102xa.h>
 #include <asm/arch/ls102xa_soc.h>
 #include <asm/arch/fsl_serdes.h>
+#include <linux/delay.h>
 #include "../common/sleep.h"
 #include <fsl_validate.h>
 #include <fsl_immap.h>
diff --git a/board/freescale/ls1021atwr/ls1021atwr.c b/board/freescale/ls1021atwr/ls1021atwr.c
index d1ff7b8..6208a38 100644
--- a/board/freescale/ls1021atwr/ls1021atwr.c
+++ b/board/freescale/ls1021atwr/ls1021atwr.c
@@ -6,9 +6,11 @@
 
 #include <common.h>
 #include <clock_legacy.h>
+#include <command.h>
 #include <fdt_support.h>
 #include <i2c.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/immap_ls102xa.h>
 #include <asm/arch/clock.h>
@@ -26,6 +28,7 @@
 #include <fsl_sec.h>
 #include <fsl_devdis.h>
 #include <spl.h>
+#include <linux/delay.h>
 #include "../common/sleep.h"
 #ifdef CONFIG_U_QE
 #include <fsl_qe.h>
@@ -611,8 +614,8 @@
 	cpld_data->system_rst = CONFIG_RESET;
 }
 
-static int flash_bank_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int flash_bank_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	if (argc != 2)
 		return CMD_RET_USAGE;
@@ -632,8 +635,8 @@
 	"bank[0-upper bank/1-lower bank] (e.g. boot_bank 0)"
 );
 
-static int cpld_reset_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int cpld_reset_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	struct cpld_data *cpld_data = (void *)(CONFIG_SYS_CPLD_BASE);
 
@@ -691,8 +694,8 @@
 		printf("B.\n");
 }
 
-static int serdes_mux_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int serdes_mux_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	if (argc != 2)
 		return CMD_RET_USAGE;
diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c
index 1e2973f..fd7815e 100644
--- a/board/freescale/ls1028a/ls1028a.c
+++ b/board/freescale/ls1028a/ls1028a.c
@@ -4,9 +4,11 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <malloc.h>
 #include <errno.h>
 #include <fsl_ddr.h>
+#include <net.h>
 #include <asm/io.h>
 #include <hwconfig.h>
 #include <fdt_support.h>
diff --git a/board/freescale/ls1043aqds/ddr.c b/board/freescale/ls1043aqds/ddr.c
index d29a3ad..c0fc9aa 100644
--- a/board/freescale/ls1043aqds/ddr.c
+++ b/board/freescale/ls1043aqds/ddr.c
@@ -9,6 +9,7 @@
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
+#include <log.h>
 #include <asm/arch/clock.h>
 #include "ddr.h"
 
diff --git a/board/freescale/ls1043aqds/eth.c b/board/freescale/ls1043aqds/eth.c
index e1919d2..0012572 100644
--- a/board/freescale/ls1043aqds/eth.c
+++ b/board/freescale/ls1043aqds/eth.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <net.h>
 #include <asm/io.h>
 #include <netdev.h>
 #include <fdt_support.h>
diff --git a/board/freescale/ls1043aqds/ls1043aqds.c b/board/freescale/ls1043aqds/ls1043aqds.c
index 2d4b18c..6d923cc 100644
--- a/board/freescale/ls1043aqds/ls1043aqds.c
+++ b/board/freescale/ls1043aqds/ls1043aqds.c
@@ -8,6 +8,8 @@
 #include <i2c.h>
 #include <fdt_support.h>
 #include <fsl_ddr_sdram.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1043ardb/cpld.c b/board/freescale/ls1043ardb/cpld.c
index 00c70b1..5d2e801 100644
--- a/board/freescale/ls1043ardb/cpld.c
+++ b/board/freescale/ls1043ardb/cpld.c
@@ -133,7 +133,7 @@
 	*value = rev_val;
 }
 
-int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 
diff --git a/board/freescale/ls1043ardb/ddr.c b/board/freescale/ls1043ardb/ddr.c
index 2677b79..f16e036 100644
--- a/board/freescale/ls1043ardb/ddr.c
+++ b/board/freescale/ls1043ardb/ddr.c
@@ -7,6 +7,7 @@
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include "ddr.h"
+#include <log.h>
 #include <vsprintf.h>
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
diff --git a/board/freescale/ls1043ardb/eth.c b/board/freescale/ls1043ardb/eth.c
index a8d0c11..4b9f94a 100644
--- a/board/freescale/ls1043ardb/eth.c
+++ b/board/freescale/ls1043ardb/eth.c
@@ -3,6 +3,7 @@
  * Copyright 2015 Freescale Semiconductor, Inc.
  */
 #include <common.h>
+#include <net.h>
 #include <asm/io.h>
 #include <netdev.h>
 #include <fm_eth.h>
diff --git a/board/freescale/ls1043ardb/ls1043ardb.c b/board/freescale/ls1043ardb/ls1043ardb.c
index 26a1929..0b5f265 100644
--- a/board/freescale/ls1043ardb/ls1043ardb.c
+++ b/board/freescale/ls1043ardb/ls1043ardb.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1046afrwy/eth.c b/board/freescale/ls1046afrwy/eth.c
index d38e4d7..09a692b 100644
--- a/board/freescale/ls1046afrwy/eth.c
+++ b/board/freescale/ls1046afrwy/eth.c
@@ -3,6 +3,8 @@
  * Copyright 2019 NXP
  */
 #include <common.h>
+#include <fdt_support.h>
+#include <net.h>
 #include <asm/io.h>
 #include <netdev.h>
 #include <fm_eth.h>
diff --git a/board/freescale/ls1046afrwy/ls1046afrwy.c b/board/freescale/ls1046afrwy/ls1046afrwy.c
index 71ace19..e815bf8 100644
--- a/board/freescale/ls1046afrwy/ls1046afrwy.c
+++ b/board/freescale/ls1046afrwy/ls1046afrwy.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <i2c.h>
 #include <fdt_support.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1046aqds/ddr.c b/board/freescale/ls1046aqds/ddr.c
index 45b1f37..f3cfbc4 100644
--- a/board/freescale/ls1046aqds/ddr.c
+++ b/board/freescale/ls1046aqds/ddr.c
@@ -9,6 +9,7 @@
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
+#include <log.h>
 #include <asm/arch/clock.h>
 #include "ddr.h"
 
diff --git a/board/freescale/ls1046aqds/eth.c b/board/freescale/ls1046aqds/eth.c
index 1d40e8b..579e2da 100644
--- a/board/freescale/ls1046aqds/eth.c
+++ b/board/freescale/ls1046aqds/eth.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <net.h>
 #include <asm/io.h>
 #include <netdev.h>
 #include <fdt_support.h>
diff --git a/board/freescale/ls1046aqds/ls1046aqds.c b/board/freescale/ls1046aqds/ls1046aqds.c
index e6648e9..b77b2ed 100644
--- a/board/freescale/ls1046aqds/ls1046aqds.c
+++ b/board/freescale/ls1046aqds/ls1046aqds.c
@@ -8,6 +8,7 @@
 #include <i2c.h>
 #include <fdt_support.h>
 #include <fsl_ddr_sdram.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1046ardb/cpld.c b/board/freescale/ls1046ardb/cpld.c
index a657519..548601a 100644
--- a/board/freescale/ls1046ardb/cpld.c
+++ b/board/freescale/ls1046ardb/cpld.c
@@ -129,7 +129,7 @@
 	*value = rev_val;
 }
 
-int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 
diff --git a/board/freescale/ls1046ardb/ddr.c b/board/freescale/ls1046ardb/ddr.c
index 321222d..0e07df5 100644
--- a/board/freescale/ls1046ardb/ddr.c
+++ b/board/freescale/ls1046ardb/ddr.c
@@ -10,6 +10,7 @@
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
+#include <log.h>
 #include <asm/arch/clock.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/ls1046ardb/eth.c b/board/freescale/ls1046ardb/eth.c
index 7dbfcac..f3b1dcd 100644
--- a/board/freescale/ls1046ardb/eth.c
+++ b/board/freescale/ls1046ardb/eth.c
@@ -3,6 +3,8 @@
  * Copyright 2016 Freescale Semiconductor, Inc.
  */
 #include <common.h>
+#include <fdt_support.h>
+#include <net.h>
 #include <asm/io.h>
 #include <netdev.h>
 #include <fm_eth.h>
diff --git a/board/freescale/ls1046ardb/ls1046ardb.c b/board/freescale/ls1046ardb/ls1046ardb.c
index 5308cb2..27e213f 100644
--- a/board/freescale/ls1046ardb/ls1046ardb.c
+++ b/board/freescale/ls1046ardb/ls1046ardb.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <i2c.h>
 #include <fdt_support.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/fsl_serdes.h>
diff --git a/board/freescale/ls1088a/ddr.c b/board/freescale/ls1088a/ddr.c
index c21a2ce..fd9549b 100644
--- a/board/freescale/ls1088a/ddr.c
+++ b/board/freescale/ls1088a/ddr.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
+#include <log.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/clock.h>
 #include "ddr.h"
diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c
index 54ef753..8371c1c 100644
--- a/board/freescale/ls1088a/eth_ls1088aqds.c
+++ b/board/freescale/ls1088a/eth_ls1088aqds.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
@@ -19,6 +20,7 @@
 #include <miiphy.h>
 #include <fsl-mc/fsl_mc.h>
 #include <fsl-mc/ldpaa_wriop.h>
+#include <linux/delay.h>
 
 #include "../common/qixis.h"
 
diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index 225e787..3f758ce 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -5,6 +5,8 @@
 #include <common.h>
 #include <env.h>
 #include <i2c.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <errno.h>
 #include <netdev.h>
@@ -13,6 +15,7 @@
 #include <fsl_sec.h>
 #include <asm/io.h>
 #include <fdt_support.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fsl-mc/fsl_mc.h>
 #include <env_internal.h>
diff --git a/board/freescale/ls2080a/ddr.c b/board/freescale/ls2080a/ddr.c
index 26eada9..229fc9c 100644
--- a/board/freescale/ls2080a/ddr.c
+++ b/board/freescale/ls2080a/ddr.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
+#include <log.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/clock.h>
 #include "ddr.h"
diff --git a/board/freescale/ls2080a/ls2080a.c b/board/freescale/ls2080a/ls2080a.c
index f144bf6..95e99ea 100644
--- a/board/freescale/ls2080a/ls2080a.c
+++ b/board/freescale/ls2080a/ls2080a.c
@@ -3,6 +3,7 @@
  * Copyright 2014 Freescale Semiconductor
  */
 #include <common.h>
+#include <init.h>
 #include <malloc.h>
 #include <errno.h>
 #include <net.h>
diff --git a/board/freescale/ls2080aqds/ddr.c b/board/freescale/ls2080aqds/ddr.c
index fffe78c..3fb2c44 100644
--- a/board/freescale/ls2080aqds/ddr.c
+++ b/board/freescale/ls2080aqds/ddr.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
+#include <log.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/clock.h>
 #include "ddr.h"
diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c
index bbb70a8..81b5b9e 100644
--- a/board/freescale/ls2080aqds/eth.c
+++ b/board/freescale/ls2080aqds/eth.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
@@ -17,6 +18,7 @@
 #include <miiphy.h>
 #include <fsl-mc/fsl_mc.h>
 #include <fsl-mc/ldpaa_wriop.h>
+#include <linux/delay.h>
 
 #include "../common/qixis.h"
 
diff --git a/board/freescale/ls2080aqds/ls2080aqds.c b/board/freescale/ls2080aqds/ls2080aqds.c
index 4034bde..5f95f3c 100644
--- a/board/freescale/ls2080aqds/ls2080aqds.c
+++ b/board/freescale/ls2080aqds/ls2080aqds.c
@@ -4,6 +4,7 @@
  */
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <malloc.h>
 #include <errno.h>
 #include <netdev.h>
diff --git a/board/freescale/ls2080ardb/ddr.c b/board/freescale/ls2080ardb/ddr.c
index 72ce872..4571a22 100644
--- a/board/freescale/ls2080ardb/ddr.c
+++ b/board/freescale/ls2080ardb/ddr.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
+#include <log.h>
 #include <asm/arch/soc.h>
 #include <asm/arch/clock.h>
 #include "ddr.h"
diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c
index 5e2fc7c..b1fa329 100644
--- a/board/freescale/ls2080ardb/ls2080ardb.c
+++ b/board/freescale/ls2080ardb/ls2080ardb.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <malloc.h>
 #include <errno.h>
 #include <netdev.h>
diff --git a/board/freescale/lx2160a/eth_lx2160aqds.c b/board/freescale/lx2160a/eth_lx2160aqds.c
index 0e928eb..8240eaa 100644
--- a/board/freescale/lx2160a/eth_lx2160aqds.c
+++ b/board/freescale/lx2160a/eth_lx2160aqds.c
@@ -6,8 +6,10 @@
 
 #include <common.h>
 #include <env.h>
+#include <fdt_support.h>
 #include <hwconfig.h>
 #include <command.h>
+#include <log.h>
 #include <net.h>
 #include <netdev.h>
 #include <malloc.h>
@@ -20,6 +22,7 @@
 #include <asm/arch/fsl_serdes.h>
 #include <fsl-mc/fsl_mc.h>
 #include <fsl-mc/ldpaa_wriop.h>
+#include <linux/libfdt.h>
 
 #include "../common/qixis.h"
 
diff --git a/board/freescale/lx2160a/eth_lx2160ardb.c b/board/freescale/lx2160a/eth_lx2160ardb.c
index aeb989a..21fb559 100644
--- a/board/freescale/lx2160a/eth_lx2160ardb.c
+++ b/board/freescale/lx2160a/eth_lx2160ardb.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
 #include <net.h>
 #include <netdev.h>
 #include <malloc.h>
diff --git a/board/freescale/lx2160a/lx2160a.c b/board/freescale/lx2160a/lx2160a.c
index 0d94107..88eb66b 100644
--- a/board/freescale/lx2160a/lx2160a.c
+++ b/board/freescale/lx2160a/lx2160a.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <dm.h>
+#include <init.h>
 #include <dm/platform_data/serial_pl01x.h>
 #include <i2c.h>
 #include <malloc.h>
@@ -15,6 +16,7 @@
 #include <fsl_sec.h>
 #include <asm/io.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
 #include <linux/libfdt.h>
 #include <fsl-mc/fsl_mc.h>
 #include <env_internal.h>
diff --git a/board/freescale/m5208evbe/m5208evbe.c b/board/freescale/m5208evbe/m5208evbe.c
index e448a64..a950030 100644
--- a/board/freescale/m5208evbe/m5208evbe.c
+++ b/board/freescale/m5208evbe/m5208evbe.c
@@ -12,6 +12,7 @@
 #include <init.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m52277evb/m52277evb.c b/board/freescale/m52277evb/m52277evb.c
index a4b795f..144e490 100644
--- a/board/freescale/m52277evb/m52277evb.c
+++ b/board/freescale/m52277evb/m52277evb.c
@@ -11,6 +11,7 @@
 #include <init.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m5249evb/m5249evb.c b/board/freescale/m5249evb/m5249evb.c
index da3adc5..a89d510 100644
--- a/board/freescale/m5249evb/m5249evb.c
+++ b/board/freescale/m5249evb/m5249evb.c
@@ -9,6 +9,7 @@
 #include <init.h>
 #include <malloc.h>
 #include <asm/immap.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m5253demo/flash.c b/board/freescale/m5253demo/flash.c
index a5223ec..3197421 100644
--- a/board/freescale/m5253demo/flash.c
+++ b/board/freescale/m5253demo/flash.c
@@ -8,6 +8,8 @@
  */
 
 #include <common.h>
+#include <flash.h>
+#include <init.h>
 #include <irq_func.h>
 
 #include <asm/immap.h>
diff --git a/board/freescale/m5253demo/m5253demo.c b/board/freescale/m5253demo/m5253demo.c
index 76c18b8..50eb18b 100644
--- a/board/freescale/m5253demo/m5253demo.c
+++ b/board/freescale/m5253demo/m5253demo.c
@@ -9,9 +9,11 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/immap.h>
 #include <netdev.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m5282evb/m5282evb.c b/board/freescale/m5282evb/m5282evb.c
index 065e3e7..251be66 100644
--- a/board/freescale/m5282evb/m5282evb.c
+++ b/board/freescale/m5282evb/m5282evb.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/immap.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/m53017evb/m53017evb.c b/board/freescale/m53017evb/m53017evb.c
index 8bdb4ad..f13b693 100644
--- a/board/freescale/m53017evb/m53017evb.c
+++ b/board/freescale/m53017evb/m53017evb.c
@@ -12,6 +12,7 @@
 #include <init.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m5329evb/m5329evb.c b/board/freescale/m5329evb/m5329evb.c
index d93800b..531894f 100644
--- a/board/freescale/m5329evb/m5329evb.c
+++ b/board/freescale/m5329evb/m5329evb.c
@@ -12,6 +12,7 @@
 #include <init.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m5373evb/m5373evb.c b/board/freescale/m5373evb/m5373evb.c
index 1d52ce0..29ff55f 100644
--- a/board/freescale/m5373evb/m5373evb.c
+++ b/board/freescale/m5373evb/m5373evb.c
@@ -12,6 +12,7 @@
 #include <init.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m54418twr/m54418twr.c b/board/freescale/m54418twr/m54418twr.c
index 8c90cfe..a418fba 100644
--- a/board/freescale/m54418twr/m54418twr.c
+++ b/board/freescale/m54418twr/m54418twr.c
@@ -11,6 +11,7 @@
 #include <asm/immap.h>
 #include <mmc.h>
 #include <fsl_esdhc_imx.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m54451evb/m54451evb.c b/board/freescale/m54451evb/m54451evb.c
index 82a2b90..1298bd3 100644
--- a/board/freescale/m54451evb/m54451evb.c
+++ b/board/freescale/m54451evb/m54451evb.c
@@ -12,6 +12,7 @@
 #include <spi.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m54455evb/m54455evb.c b/board/freescale/m54455evb/m54455evb.c
index 146cd91..2863006 100644
--- a/board/freescale/m54455evb/m54455evb.c
+++ b/board/freescale/m54455evb/m54455evb.c
@@ -12,6 +12,7 @@
 #include <pci.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m547xevb/m547xevb.c b/board/freescale/m547xevb/m547xevb.c
index e8d8611..908a500 100644
--- a/board/freescale/m547xevb/m547xevb.c
+++ b/board/freescale/m547xevb/m547xevb.c
@@ -13,6 +13,7 @@
 #include <pci.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/m548xevb/m548xevb.c b/board/freescale/m548xevb/m548xevb.c
index 40e01c6..796b808 100644
--- a/board/freescale/m548xevb/m548xevb.c
+++ b/board/freescale/m548xevb/m548xevb.c
@@ -13,6 +13,7 @@
 #include <pci.h>
 #include <asm/immap.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/mpc8308rdb/mpc8308rdb.c b/board/freescale/mpc8308rdb/mpc8308rdb.c
index ae73246..259d6aa 100644
--- a/board/freescale/mpc8308rdb/mpc8308rdb.c
+++ b/board/freescale/mpc8308rdb/mpc8308rdb.c
@@ -8,7 +8,9 @@
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
+#include <net.h>
 #include <spi.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <pci.h>
diff --git a/board/freescale/mpc8313erdb/sdram.c b/board/freescale/mpc8313erdb/sdram.c
index c8e30a0..99f6bcd 100644
--- a/board/freescale/mpc8313erdb/sdram.c
+++ b/board/freescale/mpc8313erdb/sdram.c
@@ -8,8 +8,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <mpc83xx.h>
 #include <spd_sdram.h>
+#include <linux/delay.h>
 
 #include <asm/bitops.h>
 #include <asm/io.h>
diff --git a/board/freescale/mpc8315erdb/mpc8315erdb.c b/board/freescale/mpc8315erdb/mpc8315erdb.c
index 93e0fca..aa2e7fe 100644
--- a/board/freescale/mpc8315erdb/mpc8315erdb.c
+++ b/board/freescale/mpc8315erdb/mpc8315erdb.c
@@ -10,6 +10,8 @@
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
+#include <net.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <pci.h>
diff --git a/board/freescale/mpc8315erdb/sdram.c b/board/freescale/mpc8315erdb/sdram.c
index 2f0f29a..8a82820 100644
--- a/board/freescale/mpc8315erdb/sdram.c
+++ b/board/freescale/mpc8315erdb/sdram.c
@@ -8,8 +8,10 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <mpc83xx.h>
 #include <spd_sdram.h>
+#include <linux/delay.h>
 
 #include <asm/bitops.h>
 #include <asm/io.h>
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index e513d0b..1dc1c98 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -19,6 +19,7 @@
 #include <i2c.h>
 #include <miiphy.h>
 #include <command.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <u-boot/crc.h>
 #if defined(CONFIG_PCI)
diff --git a/board/freescale/mpc832xemds/mpc832xemds.c b/board/freescale/mpc832xemds/mpc832xemds.c
index d4922fe..afcd457 100644
--- a/board/freescale/mpc832xemds/mpc832xemds.c
+++ b/board/freescale/mpc832xemds/mpc832xemds.c
@@ -23,6 +23,7 @@
 #if defined(CONFIG_PQ_MDS_PIB)
 #include "../common/pq-mds-pib.h"
 #endif
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/mpc832xemds/pci.c b/board/freescale/mpc832xemds/pci.c
index 45c7294..944108f 100644
--- a/board/freescale/mpc832xemds/pci.c
+++ b/board/freescale/mpc832xemds/pci.c
@@ -14,6 +14,7 @@
 #include <pci.h>
 #include <i2c.h>
 #include <asm/fsl_i2c.h>
+#include <linux/delay.h>
 #include "../common/pq-mds-pib.h"
 
 static struct pci_region pci1_regions[] = {
diff --git a/board/freescale/mpc8349emds/mpc8349emds.c b/board/freescale/mpc8349emds/mpc8349emds.c
index 0996b87..576f04c 100644
--- a/board/freescale/mpc8349emds/mpc8349emds.c
+++ b/board/freescale/mpc8349emds/mpc8349emds.c
@@ -6,8 +6,10 @@
 
 #include <common.h>
 #include <fdt_support.h>
+#include <init.h>
 #include <ioports.h>
 #include <mpc83xx.h>
+#include <asm/bitops.h>
 #include <asm/mpc8349_pci.h>
 #include <i2c.h>
 #include <spi.h>
@@ -17,6 +19,7 @@
 #else
 #include <spd_sdram.h>
 #endif
+#include <linux/delay.h>
 
 #if defined(CONFIG_OF_LIBFDT)
 #include <linux/libfdt.h>
diff --git a/board/freescale/mpc8349emds/pci.c b/board/freescale/mpc8349emds/pci.c
index 7615a1d..3ddbe71 100644
--- a/board/freescale/mpc8349emds/pci.c
+++ b/board/freescale/mpc8349emds/pci.c
@@ -11,6 +11,7 @@
 #include <pci.h>
 #include <i2c.h>
 #include <asm/fsl_i2c.h>
+#include <linux/delay.h>
 
 static struct pci_region pci1_regions[] = {
 	{
diff --git a/board/freescale/mpc8349itx/mpc8349itx.c b/board/freescale/mpc8349itx/mpc8349itx.c
index a2e284f..3993d58 100644
--- a/board/freescale/mpc8349itx/mpc8349itx.c
+++ b/board/freescale/mpc8349itx/mpc8349itx.c
@@ -5,7 +5,9 @@
 
 #include <common.h>
 #include <fdt_support.h>
+#include <init.h>
 #include <ioports.h>
+#include <log.h>
 #include <mpc83xx.h>
 #include <i2c.h>
 #include <miiphy.h>
@@ -15,10 +17,12 @@
 #include <pci.h>
 #endif
 #include <spd_sdram.h>
+#include <asm/bitops.h>
 #include <asm/mmu.h>
 #if defined(CONFIG_OF_LIBFDT)
 #include <linux/libfdt.h>
 #endif
+#include <linux/delay.h>
 
 #include "../../../arch/powerpc/cpu/mpc83xx/hrcw/hrcw.h"
 #include "../../../arch/powerpc/cpu/mpc83xx/elbc/elbc.h"
diff --git a/board/freescale/mpc8349itx/pci.c b/board/freescale/mpc8349itx/pci.c
index 550a2af..a09b658 100644
--- a/board/freescale/mpc8349itx/pci.c
+++ b/board/freescale/mpc8349itx/pci.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <linux/delay.h>
 
 #include <asm/mmu.h>
 #include <asm/io.h>
diff --git a/board/freescale/mpc837xemds/mpc837xemds.c b/board/freescale/mpc837xemds/mpc837xemds.c
index 1ae2308..182391c 100644
--- a/board/freescale/mpc837xemds/mpc837xemds.c
+++ b/board/freescale/mpc837xemds/mpc837xemds.c
@@ -8,10 +8,13 @@
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
+#include <net.h>
+#include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/fsl_mpc83xx_serdes.h>
 #include <spd_sdram.h>
 #include <tsec.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <fsl_esdhc.h>
diff --git a/board/freescale/mpc837xemds/pci.c b/board/freescale/mpc837xemds/pci.c
index c72e49f..30e8b25 100644
--- a/board/freescale/mpc837xemds/pci.c
+++ b/board/freescale/mpc837xemds/pci.c
@@ -14,6 +14,7 @@
 #include <fdt_support.h>
 #include <asm/fsl_i2c.h>
 #include <asm/fsl_mpc83xx_serdes.h>
+#include <linux/delay.h>
 
 static struct pci_region pci_regions[] = {
 	{
diff --git a/board/freescale/mpc837xerdb/mpc837xerdb.c b/board/freescale/mpc837xerdb/mpc837xerdb.c
index 45038ac..94cb93a 100644
--- a/board/freescale/mpc837xerdb/mpc837xerdb.c
+++ b/board/freescale/mpc837xerdb/mpc837xerdb.c
@@ -10,12 +10,14 @@
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
+#include <asm/bitops.h>
 #include <asm/io.h>
 #include <asm/fsl_mpc83xx_serdes.h>
 #include <fdt_support.h>
 #include <spd_sdram.h>
 #include <vsc7385.h>
 #include <fsl_esdhc.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/mpc837xerdb/pci.c b/board/freescale/mpc837xerdb/pci.c
index 07471e0..dccf8c5 100644
--- a/board/freescale/mpc837xerdb/pci.c
+++ b/board/freescale/mpc837xerdb/pci.c
@@ -8,6 +8,7 @@
 #include <mpc83xx.h>
 #include <pci.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 static struct pci_region pci_regions[] = {
 	{
diff --git a/board/freescale/mpc8536ds/mpc8536ds.c b/board/freescale/mpc8536ds/mpc8536ds.c
index e55ee40..5907a7b 100644
--- a/board/freescale/mpc8536ds/mpc8536ds.c
+++ b/board/freescale/mpc8536ds/mpc8536ds.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <command.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
@@ -17,6 +19,7 @@
 #include <asm/fsl_serdes.h>
 #include <spd.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <spd_sdram.h>
 #include <fdt_support.h>
diff --git a/board/freescale/mpc8541cds/mpc8541cds.c b/board/freescale/mpc8541cds/mpc8541cds.c
index cb130b4..d470fd1 100644
--- a/board/freescale/mpc8541cds/mpc8541cds.c
+++ b/board/freescale/mpc8541cds/mpc8541cds.c
@@ -15,6 +15,7 @@
 #include <fsl_ddr_sdram.h>
 #include <ioports.h>
 #include <spd_sdram.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
diff --git a/board/freescale/mpc8544ds/mpc8544ds.c b/board/freescale/mpc8544ds/mpc8544ds.c
index 2d4aace..85d370f 100644
--- a/board/freescale/mpc8544ds/mpc8544ds.c
+++ b/board/freescale/mpc8544ds/mpc8544ds.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
diff --git a/board/freescale/mpc8548cds/mpc8548cds.c b/board/freescale/mpc8548cds/mpc8548cds.c
index a4455d3..e11ed2e 100644
--- a/board/freescale/mpc8548cds/mpc8548cds.c
+++ b/board/freescale/mpc8548cds/mpc8548cds.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #include <vsprintf.h>
 #include <asm/processor.h>
@@ -16,6 +17,7 @@
 #include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <tsec.h>
diff --git a/board/freescale/mpc8555cds/mpc8555cds.c b/board/freescale/mpc8555cds/mpc8555cds.c
index 47193dd..8e27e73 100644
--- a/board/freescale/mpc8555cds/mpc8555cds.c
+++ b/board/freescale/mpc8555cds/mpc8555cds.c
@@ -13,6 +13,7 @@
 #include <fsl_ddr_sdram.h>
 #include <ioports.h>
 #include <spd_sdram.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
diff --git a/board/freescale/mpc8568mds/bcsr.c b/board/freescale/mpc8568mds/bcsr.c
index 28e2a94..b1e638a 100644
--- a/board/freescale/mpc8568mds/bcsr.c
+++ b/board/freescale/mpc8568mds/bcsr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <asm/io.h>
 
 #include "bcsr.h"
diff --git a/board/freescale/mpc8568mds/mpc8568mds.c b/board/freescale/mpc8568mds/mpc8568mds.c
index 5167f81..2871636 100644
--- a/board/freescale/mpc8568mds/mpc8568mds.c
+++ b/board/freescale/mpc8568mds/mpc8568mds.c
@@ -6,7 +6,9 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
@@ -17,6 +19,7 @@
 #include <spd_sdram.h>
 #include <i2c.h>
 #include <ioports.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
@@ -302,7 +305,7 @@
 	porpllsr = in_be32(&gur->porpllsr);
 	io_sel = (pordevsr & MPC85xx_PORDEVSR_IO_SEL) >> 19;
 
-	debug ("   pci_init_board: devdisr=%x, io_sel=%x\n", devdisr, io_sel);
+	debug("   %s: devdisr=%x, io_sel=%x\n", __func__, devdisr, io_sel);
 
 	pci_speed = 66666000;
 	pci_32 = 1;
diff --git a/board/freescale/mpc8569mds/bcsr.c b/board/freescale/mpc8569mds/bcsr.c
index 57cea0a..9ed00f6 100644
--- a/board/freescale/mpc8569mds/bcsr.c
+++ b/board/freescale/mpc8569mds/bcsr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <asm/io.h>
 
 #include "bcsr.h"
diff --git a/board/freescale/mpc8569mds/mpc8569mds.c b/board/freescale/mpc8569mds/mpc8569mds.c
index cf5d8a5..90b9c72 100644
--- a/board/freescale/mpc8569mds/mpc8569mds.c
+++ b/board/freescale/mpc8569mds/mpc8569mds.c
@@ -7,8 +7,10 @@
 
 #include <common.h>
 #include <console.h>
+#include <flash.h>
 #include <hwconfig.h>
 #include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
@@ -21,6 +23,7 @@
 #include <spd_sdram.h>
 #include <i2c.h>
 #include <ioports.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <fsl_esdhc.h>
diff --git a/board/freescale/mpc8572ds/mpc8572ds.c b/board/freescale/mpc8572ds/mpc8572ds.c
index 4111d69..b43032c 100644
--- a/board/freescale/mpc8572ds/mpc8572ds.c
+++ b/board/freescale/mpc8572ds/mpc8572ds.c
@@ -6,7 +6,10 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
@@ -17,6 +20,7 @@
 #include <asm/io.h>
 #include <asm/fsl_serdes.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <tsec.h>
diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd.c b/board/freescale/mpc8610hpcd/mpc8610hpcd.c
index 86edd66..c060fd9 100644
--- a/board/freescale/mpc8610hpcd/mpc8610hpcd.c
+++ b/board/freescale/mpc8610hpcd/mpc8610hpcd.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <command.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/immap_86xx.h>
@@ -14,6 +16,7 @@
 #include <asm/fsl_serdes.h>
 #include <i2c.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <spd_sdram.h>
diff --git a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
index 42b8cab..9b96d0d 100644
--- a/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
+++ b/board/freescale/mpc8610hpcd/mpc8610hpcd_diu.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <command.h>
+#include <log.h>
 #include <asm/io.h>
 #include <fsl_diu_fb.h>
 #include "../common/pixis.h"
diff --git a/board/freescale/mpc8641hpcn/mpc8641hpcn.c b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
index d9e538b..cd505df 100644
--- a/board/freescale/mpc8641hpcn/mpc8641hpcn.c
+++ b/board/freescale/mpc8641hpcn/mpc8641hpcn.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/immap_86xx.h>
@@ -12,6 +14,7 @@
 #include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <netdev.h>
diff --git a/board/freescale/mx23evk/mx23evk.c b/board/freescale/mx23evk/mx23evk.c
index 6f4d34b..6cfff04 100644
--- a/board/freescale/mx23evk/mx23evk.c
+++ b/board/freescale/mx23evk/mx23evk.c
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
diff --git a/board/freescale/mx25pdk/mx25pdk.c b/board/freescale/mx25pdk/mx25pdk.c
index 6898e9c..ec56acb 100644
--- a/board/freescale/mx25pdk/mx25pdk.c
+++ b/board/freescale/mx25pdk/mx25pdk.c
@@ -15,6 +15,7 @@
 #include <mmc.h>
 #include <fsl_esdhc_imx.h>
 #include <i2c.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <fsl_pmic.h>
 #include <mc34704.h>
diff --git a/board/freescale/mx28evk/mx28evk.c b/board/freescale/mx28evk/mx28evk.c
index cfbe89e..e50b7db 100644
--- a/board/freescale/mx28evk/mx28evk.c
+++ b/board/freescale/mx28evk/mx28evk.c
@@ -12,12 +12,15 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx28.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <miiphy.h>
 #include <netdev.h>
diff --git a/board/freescale/mx31pdk/mx31pdk.c b/board/freescale/mx31pdk/mx31pdk.c
index fb57f26..06fe51d 100644
--- a/board/freescale/mx31pdk/mx31pdk.c
+++ b/board/freescale/mx31pdk/mx31pdk.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
diff --git a/board/freescale/mx35pdk/mx35pdk.c b/board/freescale/mx35pdk/mx35pdk.c
index d0f7f04..63fea37 100644
--- a/board/freescale/mx35pdk/mx35pdk.c
+++ b/board/freescale/mx35pdk/mx35pdk.c
@@ -7,7 +7,9 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/freescale/mx51evk/mx51evk.c b/board/freescale/mx51evk/mx51evk.c
index 3314bad..46037ac 100644
--- a/board/freescale/mx51evk/mx51evk.c
+++ b/board/freescale/mx51evk/mx51evk.c
@@ -9,6 +9,7 @@
 #include <asm/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx51.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/freescale/mx53ard/mx53ard.c b/board/freescale/mx53ard/mx53ard.c
index 33d056b..fabcb03 100644
--- a/board/freescale/mx53ard/mx53ard.c
+++ b/board/freescale/mx53ard/mx53ard.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/freescale/mx53loco/mx53loco.c b/board/freescale/mx53loco/mx53loco.c
index 381c1ca..ba74592 100644
--- a/board/freescale/mx53loco/mx53loco.c
+++ b/board/freescale/mx53loco/mx53loco.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/freescale/mx6memcal/mx6memcal.c b/board/freescale/mx6memcal/mx6memcal.c
index d01127e..ea7a563 100644
--- a/board/freescale/mx6memcal/mx6memcal.c
+++ b/board/freescale/mx6memcal/mx6memcal.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/sys_proto.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/mx6memcal/spl.c b/board/freescale/mx6memcal/spl.c
index be551bc..c11eee5 100644
--- a/board/freescale/mx6memcal/spl.c
+++ b/board/freescale/mx6memcal/spl.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/clock.h>
diff --git a/board/freescale/mx6qarm2/mx6qarm2.c b/board/freescale/mx6qarm2/mx6qarm2.c
index 3957c09..5c08ecb 100644
--- a/board/freescale/mx6qarm2/mx6qarm2.c
+++ b/board/freescale/mx6qarm2/mx6qarm2.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx6-pins.h>
diff --git a/board/freescale/mx6sabreauto/mx6sabreauto.c b/board/freescale/mx6sabreauto/mx6sabreauto.c
index de19a56..829e42f 100644
--- a/board/freescale/mx6sabreauto/mx6sabreauto.c
+++ b/board/freescale/mx6sabreauto/mx6sabreauto.c
@@ -6,7 +6,9 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 07d3b0e..8d24af0 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -5,7 +5,9 @@
  * Author: Fabio Estevam <fabio.estevam@freescale.com>
  */
 
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index 43029e4..7dd00bd 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -5,6 +5,8 @@
  * Author: Fabio Estevam <fabio.estevam@freescale.com>
  */
 
+#include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c
index 0c79042..522b840 100644
--- a/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c
+++ b/board/freescale/mx6sxsabreauto/mx6sxsabreauto.c
@@ -6,6 +6,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
@@ -16,6 +17,7 @@
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <fsl_esdhc_imx.h>
diff --git a/board/freescale/mx6sxsabresd/mx6sxsabresd.c b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
index 4f1d660..b092ea8 100644
--- a/board/freescale/mx6sxsabresd/mx6sxsabresd.c
+++ b/board/freescale/mx6sxsabresd/mx6sxsabresd.c
@@ -6,6 +6,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
@@ -17,6 +18,7 @@
 #include <asm/io.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <fsl_esdhc_imx.h>
diff --git a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
index 07941fb..b03c9c9 100644
--- a/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
+++ b/board/freescale/mx6ul_14x14_evk/mx6ul_14x14_evk.c
@@ -4,6 +4,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/imx-regs.h>
@@ -21,6 +22,7 @@
 #include <fsl_esdhc_imx.h>
 #include <i2c.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <mmc.h>
 #include <netdev.h>
diff --git a/board/freescale/mx7dsabresd/mx7dsabresd.c b/board/freescale/mx7dsabresd/mx7dsabresd.c
index 41c6207..f12e9d4 100644
--- a/board/freescale/mx7dsabresd/mx7dsabresd.c
+++ b/board/freescale/mx7dsabresd/mx7dsabresd.c
@@ -4,6 +4,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx7-pins.h>
@@ -11,6 +12,7 @@
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <fsl_esdhc_imx.h>
diff --git a/board/freescale/mx7ulp_evk/mx7ulp_evk.c b/board/freescale/mx7ulp_evk/mx7ulp_evk.c
index c939514..1594285 100644
--- a/board/freescale/mx7ulp_evk/mx7ulp_evk.c
+++ b/board/freescale/mx7ulp_evk/mx7ulp_evk.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdt_support.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mx7ulp-pins.h>
diff --git a/board/freescale/p1010rdb/p1010rdb.c b/board/freescale/p1010rdb/p1010rdb.c
index 314646d..66ccc0b 100644
--- a/board/freescale/p1010rdb/p1010rdb.c
+++ b/board/freescale/p1010rdb/p1010rdb.c
@@ -5,7 +5,10 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/cache.h>
@@ -706,8 +709,8 @@
 }
 
 #ifndef CONFIG_SPL_BUILD
-static int pin_mux_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int pin_mux_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/board/freescale/p1022ds/diu.c b/board/freescale/p1022ds/diu.c
index 7f72510..918b4b9 100644
--- a/board/freescale/p1022ds/diu.c
+++ b/board/freescale/p1022ds/diu.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <command.h>
+#include <log.h>
 #include <linux/ctype.h>
 #include <asm/io.h>
 #include <stdio_dev.h>
diff --git a/board/freescale/p1022ds/p1022ds.c b/board/freescale/p1022ds/p1022ds.c
index ebf822a..d10160d 100644
--- a/board/freescale/p1022ds/p1022ds.c
+++ b/board/freescale/p1022ds/p1022ds.c
@@ -8,7 +8,10 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
diff --git a/board/freescale/p1023rdb/p1023rdb.c b/board/freescale/p1023rdb/p1023rdb.c
index eeb13cc..13df3e8 100644
--- a/board/freescale/p1023rdb/p1023rdb.c
+++ b/board/freescale/p1023rdb/p1023rdb.c
@@ -9,7 +9,9 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/io.h>
 #include <asm/cache.h>
diff --git a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
index f668d7e..1353deb 100644
--- a/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
+++ b/board/freescale/p1_p2_rdb_pc/p1_p2_rdb_pc.c
@@ -9,7 +9,9 @@
 #include <env.h>
 #include <hang.h>
 #include <hwconfig.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #include <i2c.h>
 #include <asm/processor.h>
@@ -23,6 +25,7 @@
 #include <asm/fsl_lbc.h>
 #include <asm/mp.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <fsl_mdio.h>
diff --git a/board/freescale/p1_twr/p1_twr.c b/board/freescale/p1_twr/p1_twr.c
index 72fe1b4..8e1522a 100644
--- a/board/freescale/p1_twr/p1_twr.c
+++ b/board/freescale/p1_twr/p1_twr.c
@@ -7,7 +7,9 @@
 #include <command.h>
 #include <env.h>
 #include <hwconfig.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #include <i2c.h>
 #include <asm/processor.h>
diff --git a/board/freescale/p2041rdb/cpld.c b/board/freescale/p2041rdb/cpld.c
index 3037ef8..b042fe3 100644
--- a/board/freescale/p2041rdb/cpld.c
+++ b/board/freescale/p2041rdb/cpld.c
@@ -87,7 +87,7 @@
 }
 #endif
 
-int cpld_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int cpld_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 
diff --git a/board/freescale/p2041rdb/ddr.c b/board/freescale/p2041rdb/ddr.c
index 8bcd2fb..7a06c7a 100644
--- a/board/freescale/p2041rdb/ddr.c
+++ b/board/freescale/p2041rdb/ddr.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/freescale/p2041rdb/eth.c b/board/freescale/p2041rdb/eth.c
index 854a839..32c68f2 100644
--- a/board/freescale/p2041rdb/eth.c
+++ b/board/freescale/p2041rdb/eth.c
@@ -13,6 +13,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/fsl_serdes.h>
 #include <fm_eth.h>
diff --git a/board/freescale/p2041rdb/p2041rdb.c b/board/freescale/p2041rdb/p2041rdb.c
index 95ed0ef..076e63a 100644
--- a/board/freescale/p2041rdb/p2041rdb.c
+++ b/board/freescale/p2041rdb/p2041rdb.c
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/freescale/qemu-ppce500/qemu-ppce500.c b/board/freescale/qemu-ppce500/qemu-ppce500.c
index e804cfe..61a9226 100644
--- a/board/freescale/qemu-ppce500/qemu-ppce500.c
+++ b/board/freescale/qemu-ppce500/qemu-ppce500.c
@@ -8,6 +8,8 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <pci.h>
 #include <time.h>
 #include <asm/processor.h>
diff --git a/board/freescale/t102xqds/ddr.c b/board/freescale/t102xqds/ddr.c
index 998a2a5..c27cecd 100644
--- a/board/freescale/t102xqds/ddr.c
+++ b/board/freescale/t102xqds/ddr.c
@@ -6,11 +6,14 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 #include <asm/mpc85xx_gpio.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/t102xqds/eth_t102xqds.c b/board/freescale/t102xqds/eth_t102xqds.c
index 5b65818..49ea21a 100644
--- a/board/freescale/t102xqds/eth_t102xqds.c
+++ b/board/freescale/t102xqds/eth_t102xqds.c
@@ -7,6 +7,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
+#include <log.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
diff --git a/board/freescale/t102xqds/t102xqds.c b/board/freescale/t102xqds/t102xqds.c
index 32b4780..84db2fa 100644
--- a/board/freescale/t102xqds/t102xqds.c
+++ b/board/freescale/t102xqds/t102xqds.c
@@ -9,7 +9,9 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
 #include <netdev.h>
 #include <linux/compiler.h>
 #include <asm/mmu.h>
diff --git a/board/freescale/t102xrdb/cpld.c b/board/freescale/t102xrdb/cpld.c
index 2b640e0..47c3b16 100644
--- a/board/freescale/t102xrdb/cpld.c
+++ b/board/freescale/t102xrdb/cpld.c
@@ -72,7 +72,7 @@
 	putc('\n');
 }
 
-int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 
diff --git a/board/freescale/t102xrdb/ddr.c b/board/freescale/t102xrdb/ddr.c
index 043f0b5..3640a47 100644
--- a/board/freescale/t102xrdb/ddr.c
+++ b/board/freescale/t102xrdb/ddr.c
@@ -6,11 +6,14 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 #include <asm/mpc85xx_gpio.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/freescale/t102xrdb/eth_t102xrdb.c b/board/freescale/t102xrdb/eth_t102xrdb.c
index 299b859..dbf25a2 100644
--- a/board/freescale/t102xrdb/eth_t102xrdb.c
+++ b/board/freescale/t102xrdb/eth_t102xrdb.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
diff --git a/board/freescale/t102xrdb/t102xrdb.c b/board/freescale/t102xrdb/t102xrdb.c
index a34490c..754fcb0 100644
--- a/board/freescale/t102xrdb/t102xrdb.c
+++ b/board/freescale/t102xrdb/t102xrdb.c
@@ -9,6 +9,7 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
@@ -367,8 +368,8 @@
 	return 0;
 }
 
-static int switch_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
-		    char * const argv[])
+static int switch_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/board/freescale/t1040qds/ddr.c b/board/freescale/t1040qds/ddr.c
index 2b1d768..0a817d0 100644
--- a/board/freescale/t1040qds/ddr.c
+++ b/board/freescale/t1040qds/ddr.c
@@ -6,11 +6,14 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 #include <asm/mpc85xx_gpio.h>
+#include <linux/delay.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/t1040qds/eth.c b/board/freescale/t1040qds/eth.c
index 4185cfa..b349b77 100644
--- a/board/freescale/t1040qds/eth.c
+++ b/board/freescale/t1040qds/eth.c
@@ -10,6 +10,8 @@
  */
 
 #include <common.h>
+#include <fdt_support.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/fsl_serdes.h>
 #include <asm/immap_85xx.h>
diff --git a/board/freescale/t1040qds/t1040qds.c b/board/freescale/t1040qds/t1040qds.c
index 9e253fd..c166403 100644
--- a/board/freescale/t1040qds/t1040qds.c
+++ b/board/freescale/t1040qds/t1040qds.c
@@ -9,6 +9,7 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/freescale/t104xrdb/cpld.c b/board/freescale/t104xrdb/cpld.c
index f9c8ab3..ac34095 100644
--- a/board/freescale/t104xrdb/cpld.c
+++ b/board/freescale/t104xrdb/cpld.c
@@ -82,7 +82,7 @@
 }
 #endif
 
-int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 
diff --git a/board/freescale/t104xrdb/ddr.c b/board/freescale/t104xrdb/ddr.c
index 2b1b28d..e313bf9 100644
--- a/board/freescale/t104xrdb/ddr.c
+++ b/board/freescale/t104xrdb/ddr.c
@@ -6,11 +6,14 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include <asm/fsl_law.h>
 #include <asm/mpc85xx_gpio.h>
+#include <linux/delay.h>
 #include "ddr.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/freescale/t104xrdb/eth.c b/board/freescale/t104xrdb/eth.c
index 107d28d..9cbc875 100644
--- a/board/freescale/t104xrdb/eth.c
+++ b/board/freescale/t104xrdb/eth.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/fsl_serdes.h>
 #include <asm/immap_85xx.h>
diff --git a/board/freescale/t104xrdb/t104xrdb.c b/board/freescale/t104xrdb/t104xrdb.c
index dc3b59d..6a4b351 100644
--- a/board/freescale/t104xrdb/t104xrdb.c
+++ b/board/freescale/t104xrdb/t104xrdb.c
@@ -8,7 +8,9 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <hwconfig.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
 #include <netdev.h>
 #include <linux/compiler.h>
 #include <asm/mmu.h>
diff --git a/board/freescale/t208xqds/ddr.c b/board/freescale/t208xqds/ddr.c
index a2a5654..3317f99 100644
--- a/board/freescale/t208xqds/ddr.c
+++ b/board/freescale/t208xqds/ddr.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/freescale/t208xqds/eth_t208xqds.c b/board/freescale/t208xqds/eth_t208xqds.c
index 697c23b..938e606 100644
--- a/board/freescale/t208xqds/eth_t208xqds.c
+++ b/board/freescale/t208xqds/eth_t208xqds.c
@@ -8,6 +8,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
+#include <log.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -27,6 +30,7 @@
 #include "../common/qixis.h"
 #include "../common/fman.h"
 #include "t208xqds_qixis.h"
+#include <linux/libfdt.h>
 
 #define EMI_NONE	0xFFFFFFFF
 #define EMI1_RGMII1	0
diff --git a/board/freescale/t208xqds/t208xqds.c b/board/freescale/t208xqds/t208xqds.c
index 9100401..4979085 100644
--- a/board/freescale/t208xqds/t208xqds.c
+++ b/board/freescale/t208xqds/t208xqds.c
@@ -9,7 +9,9 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
 #include <netdev.h>
 #include <linux/compiler.h>
 #include <asm/mmu.h>
diff --git a/board/freescale/t208xrdb/cpld.c b/board/freescale/t208xrdb/cpld.c
index 9a9b9d8..b9ba62a 100644
--- a/board/freescale/t208xrdb/cpld.c
+++ b/board/freescale/t208xrdb/cpld.c
@@ -43,7 +43,7 @@
 	CPLD_WRITE(reset_ctl, CPLD_LBMAP_RESET);
 }
 
-int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 
diff --git a/board/freescale/t208xrdb/ddr.c b/board/freescale/t208xrdb/ddr.c
index 0b16982..6a09d1c 100644
--- a/board/freescale/t208xrdb/ddr.c
+++ b/board/freescale/t208xrdb/ddr.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/freescale/t208xrdb/eth_t208xrdb.c b/board/freescale/t208xrdb/eth_t208xrdb.c
index 6894947..db47181 100644
--- a/board/freescale/t208xrdb/eth_t208xrdb.c
+++ b/board/freescale/t208xrdb/eth_t208xrdb.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
diff --git a/board/freescale/t208xrdb/t208xrdb.c b/board/freescale/t208xrdb/t208xrdb.c
index b5c2011..24f0d07 100644
--- a/board/freescale/t208xrdb/t208xrdb.c
+++ b/board/freescale/t208xrdb/t208xrdb.c
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/freescale/t4qds/ddr.c b/board/freescale/t4qds/ddr.c
index 08656b4..4fdd69d 100644
--- a/board/freescale/t4qds/ddr.c
+++ b/board/freescale/t4qds/ddr.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/freescale/t4qds/eth.c b/board/freescale/t4qds/eth.c
index b341c82..810868f 100644
--- a/board/freescale/t4qds/eth.c
+++ b/board/freescale/t4qds/eth.c
@@ -5,6 +5,9 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
+#include <log.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -25,6 +28,7 @@
 #include <hwconfig.h>
 #include "../common/qixis.h"
 #include "../common/fman.h"
+#include <linux/libfdt.h>
 
 #include "t4240qds_qixis.h"
 
diff --git a/board/freescale/t4qds/t4240emu.c b/board/freescale/t4qds/t4240emu.c
index 104b40a..8f2032a 100644
--- a/board/freescale/t4qds/t4240emu.c
+++ b/board/freescale/t4qds/t4240emu.c
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/freescale/t4qds/t4240qds.c b/board/freescale/t4qds/t4240qds.c
index 869c01d..8d1a66f 100644
--- a/board/freescale/t4qds/t4240qds.c
+++ b/board/freescale/t4qds/t4240qds.c
@@ -9,8 +9,10 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
 #include <irq_func.h>
+#include <log.h>
 #include <netdev.h>
 #include <linux/compiler.h>
 #include <asm/mmu.h>
@@ -21,6 +23,7 @@
 #include <asm/fsl_serdes.h>
 #include <asm/fsl_liodn.h>
 #include <fm_eth.h>
+#include <linux/delay.h>
 
 #include "../common/qixis.h"
 #include "../common/vsc3316_3308.h"
@@ -901,9 +904,9 @@
 	}
 }
 
-static int do_vdd_adjust(cmd_tbl_t *cmdtp,
+static int do_vdd_adjust(struct cmd_tbl *cmdtp,
 			 int flag, int argc,
-			 char * const argv[])
+			 char *const argv[])
 {
 	ulong override;
 
diff --git a/board/freescale/t4rdb/cpld.c b/board/freescale/t4rdb/cpld.c
index 470b5f9..d484509 100644
--- a/board/freescale/t4rdb/cpld.c
+++ b/board/freescale/t4rdb/cpld.c
@@ -95,7 +95,7 @@
 #endif
 
 #ifndef CONFIG_SPL_BUILD
-int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int rc = 0;
 
diff --git a/board/freescale/t4rdb/ddr.c b/board/freescale/t4rdb/ddr.c
index 787de6d..5b7d10c 100644
--- a/board/freescale/t4rdb/ddr.c
+++ b/board/freescale/t4rdb/ddr.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/freescale/t4rdb/eth.c b/board/freescale/t4rdb/eth.c
index 2ef192c..4c896c8 100644
--- a/board/freescale/t4rdb/eth.c
+++ b/board/freescale/t4rdb/eth.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <command.h>
+#include <fdt_support.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/mmu.h>
 #include <asm/processor.h>
diff --git a/board/freescale/t4rdb/t4240rdb.c b/board/freescale/t4rdb/t4240rdb.c
index 8015666..d801f2c 100644
--- a/board/freescale/t4rdb/t4240rdb.c
+++ b/board/freescale/t4rdb/t4240rdb.c
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
index 776afa4..8a3a6e3 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -4,14 +4,19 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <env_internal.h>
+#include <flash.h>
 #include <init.h>
 #include <led.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <spi.h>
 #include <spi_flash.h>
+#include <linux/delay.h>
+#include <linux/stringify.h>
 #include <u-boot/crc.h>
 #include <uuid.h>
 #include <linux/ctype.h>
@@ -205,7 +210,7 @@
  * Helper function to provide some sane factory-data values for testing
  * purpose, when these values are not programmed correctly
  */
-int do_fd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct factory_data_values *fd;
 	struct spi_flash *sf;
diff --git a/board/gateworks/gw_ventana/common.c b/board/gateworks/gw_ventana/common.c
index 1240a9d..1a35249 100644
--- a/board/gateworks/gw_ventana/common.c
+++ b/board/gateworks/gw_ventana/common.c
@@ -5,6 +5,8 @@
  * Author: Tim Harvey <tharvey@gateworks.com>
  */
 
+#include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/sys_proto.h>
@@ -13,6 +15,7 @@
 #include <env.h>
 #include <fsl_esdhc_imx.h>
 #include <hwconfig.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/ltc3676_pmic.h>
 #include <power/pfuze100_pmic.h>
diff --git a/board/gateworks/gw_ventana/eeprom.c b/board/gateworks/gw_ventana/eeprom.c
index 5e9cf11..a5a151d 100644
--- a/board/gateworks/gw_ventana/eeprom.c
+++ b/board/gateworks/gw_ventana/eeprom.c
@@ -5,11 +5,14 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <errno.h>
 #include <hexdump.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/bitops.h>
+#include <linux/delay.h>
 
 #include "gsc.h"
 #include "ventana_eeprom.h"
@@ -158,7 +161,8 @@
 static u8 econfig_bytes[sizeof(ventana_info.config)];
 static int econfig_init = -1;
 
-static int do_econfig(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_econfig(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct ventana_eeprom_config *cfg;
 	struct ventana_board_info *info = &ventana_info;
diff --git a/board/gateworks/gw_ventana/gsc.c b/board/gateworks/gw_ventana/gsc.c
index 068f8cd..bcb6bca 100644
--- a/board/gateworks/gw_ventana/gsc.c
+++ b/board/gateworks/gw_ventana/gsc.c
@@ -5,6 +5,10 @@
  * Author: Tim Harvey <tharvey@gateworks.com>
  */
 
+#include <common.h>
+#include <command.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <common.h>
 #include <i2c.h>
@@ -176,8 +180,8 @@
 }
 
 #if defined(CONFIG_CMD_GSC) && !defined(CONFIG_SPL_BUILD)
-static int do_gsc_sleep(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_gsc_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	unsigned char reg;
 	unsigned long secs = 0;
@@ -218,7 +222,8 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_gsc_wd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_gsc_wd(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	unsigned char reg;
 
@@ -257,7 +262,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_gsc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_gsc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc < 2)
 		return gsc_info(1);
diff --git a/board/gateworks/gw_ventana/gw_ventana.c b/board/gateworks/gw_ventana/gw_ventana.c
index 8a694a7..649e622 100644
--- a/board/gateworks/gw_ventana/gw_ventana.c
+++ b/board/gateworks/gw_ventana/gw_ventana.c
@@ -6,6 +6,9 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
@@ -32,6 +35,8 @@
 #include <mtd_node.h>
 #include <netdev.h>
 #include <pci.h>
+#include <linux/delay.h>
+#include <linux/libfdt.h>
 #include <power/pmic.h>
 #include <power/ltc3676_pmic.h>
 #include <power/pfuze100_pmic.h>
diff --git a/board/gateworks/gw_ventana/gw_ventana_spl.c b/board/gateworks/gw_ventana/gw_ventana_spl.c
index 80fec5f..e0e4bac 100644
--- a/board/gateworks/gw_ventana/gw_ventana_spl.c
+++ b/board/gateworks/gw_ventana/gw_ventana_spl.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <env.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/mx6-ddr.h>
diff --git a/board/gdsys/a38x/controlcenterdc.c b/board/gdsys/a38x/controlcenterdc.c
index 4eb7d76..a2287f9 100644
--- a/board/gdsys/a38x/controlcenterdc.c
+++ b/board/gdsys/a38x/controlcenterdc.c
@@ -5,13 +5,16 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <tpm-v1.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm-generic/gpio.h>
+#include <linux/delay.h>
 
 #include "../drivers/ddr/marvell/a38x/ddr3_init.h"
 #include "../arch/arm/mach-mvebu/serdes/a38x/high_speed_env_spec.h"
diff --git a/board/gdsys/a38x/hre.c b/board/gdsys/a38x/hre.c
index 027ad1f..699241b 100644
--- a/board/gdsys/a38x/hre.c
+++ b/board/gdsys/a38x/hre.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <fs.h>
 #include <i2c.h>
diff --git a/board/gdsys/a38x/hydra.c b/board/gdsys/a38x/hydra.c
index fa50ad2..daade6d 100644
--- a/board/gdsys/a38x/hydra.c
+++ b/board/gdsys/a38x/hydra.c
@@ -1,4 +1,5 @@
 #include <common.h>
+#include <command.h>
 #include <console.h> /* ctrlc */
 #include <asm/io.h>
 
@@ -89,7 +90,7 @@
 #define REFL_PATTERN (0xdededede)
 #define REFL_PATTERN_INV (~REFL_PATTERN)
 
-int do_hydrate(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_hydrate(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	uint k = 0;
 	void __iomem *pcie2_base = (void __iomem *)(MVEBU_REG_PCIE_BASE +
diff --git a/board/gdsys/a38x/ihs_phys.c b/board/gdsys/a38x/ihs_phys.c
index 494de18..c23d150 100644
--- a/board/gdsys/a38x/ihs_phys.c
+++ b/board/gdsys/a38x/ihs_phys.c
@@ -2,6 +2,8 @@
 #include <dm.h>
 #include <miiphy.h>
 #include <asm-generic/gpio.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include "ihs_phys.h"
 #include "dt_helpers.h"
diff --git a/board/gdsys/common/cmd_ioloop.c b/board/gdsys/common/cmd_ioloop.c
index 05a14ff..3ea2bec 100644
--- a/board/gdsys/common/cmd_ioloop.c
+++ b/board/gdsys/common/cmd_ioloop.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <command.h>
 #include <console.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <gdsys_fpga.h>
 
@@ -264,7 +266,7 @@
  * Syntax:
  *	ioreflect {fpga} {reportrate}
  */
-int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	uint fpga;
 	uint rate = 0;
@@ -321,7 +323,7 @@
  * Syntax:
  *	ioreflect {reportrate}
  */
-int do_ioreflect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ioreflect(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct udevice *fpga;
 	struct regmap *map;
@@ -374,7 +376,7 @@
  * Syntax:
  *	ioloop {fpga} {size} {rate}
  */
-int do_ioloop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	uint fpga;
 	uint size;
@@ -440,7 +442,7 @@
  * Syntax:
  *	ioloop {size} {rate}
  */
-int do_ioloop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ioloop(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	uint size;
 	uint rate = 0;
@@ -501,7 +503,7 @@
 #endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
 
 #ifndef CONFIG_GDSYS_LEGACY_DRIVERS
-int do_iodev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_iodev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct udevice *ioep = NULL;
 	struct udevice *board;
diff --git a/board/gdsys/common/ihs_mdio.c b/board/gdsys/common/ihs_mdio.c
index f160a57..5f1215e 100644
--- a/board/gdsys/common/ihs_mdio.c
+++ b/board/gdsys/common/ihs_mdio.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 
 #include <miiphy.h>
 #ifdef CONFIG_GDSYS_LEGACY_DRIVERS
diff --git a/board/gdsys/common/ioep-fpga.c b/board/gdsys/common/ioep-fpga.c
index 066222c..7292d7a 100644
--- a/board/gdsys/common/ioep-fpga.c
+++ b/board/gdsys/common/ioep-fpga.c
@@ -9,6 +9,7 @@
 #include <common.h>
 
 #include <gdsys_fpga.h>
+#include <linux/bitops.h>
 
 enum pcb_video_type {
 	PCB_DVI_SL,
@@ -443,6 +444,7 @@
 	return 0;
 }
 
+#include <linux/bitops.h>
 #endif
 
 bool ioep_fpga_has_osd(unsigned int fpga)
diff --git a/board/gdsys/common/mclink.c b/board/gdsys/common/mclink.c
index c43d24b..6147fbf 100644
--- a/board/gdsys/common/mclink.c
+++ b/board/gdsys/common/mclink.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 
 #include <gdsys_fpga.h>
+#include <linux/delay.h>
 
 enum {
 	MCINT_SLAVE_LINK_CHANGED_EV = 1 << 7,
diff --git a/board/gdsys/common/osd.c b/board/gdsys/common/osd.c
index 10c4329..679f8f3 100644
--- a/board/gdsys/common/osd.c
+++ b/board/gdsys/common/osd.c
@@ -7,8 +7,10 @@
 #ifdef CONFIG_GDSYS_LEGACY_DRIVERS
 
 #include <common.h>
+#include <command.h>
 #include <i2c.h>
 #include <malloc.h>
+#include <linux/stringify.h>
 
 #include "ch7301.h"
 #include "dp501.h"
@@ -259,7 +261,8 @@
 	return charcount;
 }
 
-static int osd_print(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	unsigned screen;
 
@@ -396,7 +399,7 @@
 	return 0;
 }
 
-int osd_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int osd_write(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned screen;
 
@@ -449,7 +452,7 @@
 	return 0;
 }
 
-int osd_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int osd_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned screen;
 	unsigned x;
@@ -500,4 +503,4 @@
 	") size_y(max. " __stringify(MAX_Y_CHARS) ")\n"
 );
 
-#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
\ No newline at end of file
+#endif /* CONFIG_GDSYS_LEGACY_DRIVERS */
diff --git a/board/gdsys/common/osd_cmd.c b/board/gdsys/common/osd_cmd.c
index 53179b9..fe62497 100644
--- a/board/gdsys/common/osd_cmd.c
+++ b/board/gdsys/common/osd_cmd.c
@@ -10,13 +10,14 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <hexdump.h>
 #include <video_osd.h>
 #include <malloc.h>
 
-static int do_osd_write(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	struct udevice *dev;
 	uint x, y;
@@ -68,8 +69,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_osd_print(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	struct udevice *dev;
 	uint x, y;
@@ -99,8 +100,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_osd_size(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct udevice *dev;
 	uint x, y;
diff --git a/board/gdsys/common/phy.c b/board/gdsys/common/phy.c
index d40c08d..516f4e8 100644
--- a/board/gdsys/common/phy.c
+++ b/board/gdsys/common/phy.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 
 #include <miiphy.h>
 
diff --git a/board/gdsys/mpc8308/gazerbeam.c b/board/gdsys/mpc8308/gazerbeam.c
index 8c9636d..b64a6d9 100644
--- a/board/gdsys/mpc8308/gazerbeam.c
+++ b/board/gdsys/mpc8308/gazerbeam.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <board.h>
+#include <command.h>
 #include <dm.h>
 #include <env.h>
 #include <fdt_support.h>
diff --git a/board/gdsys/mpc8308/hrcon.c b/board/gdsys/mpc8308/hrcon.c
index d111015..d206f8f 100644
--- a/board/gdsys/mpc8308/hrcon.c
+++ b/board/gdsys/mpc8308/hrcon.c
@@ -6,10 +6,13 @@
 
 #include <common.h>
 #include <env.h>
+#include <flash.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
 #include <spi.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <pci.h>
diff --git a/board/gdsys/mpc8308/mpc8308.c b/board/gdsys/mpc8308/mpc8308.c
index d410845..0f90f8a 100644
--- a/board/gdsys/mpc8308/mpc8308.c
+++ b/board/gdsys/mpc8308/mpc8308.c
@@ -10,6 +10,7 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/global_data.h>
+#include <linux/delay.h>
 
 #include "mpc8308.h"
 #include <gdsys_fpga.h>
diff --git a/board/gdsys/mpc8308/strider.c b/board/gdsys/mpc8308/strider.c
index 9ba9e42..b3af8fe 100644
--- a/board/gdsys/mpc8308/strider.c
+++ b/board/gdsys/mpc8308/strider.c
@@ -6,10 +6,13 @@
 
 #include <common.h>
 #include <env.h>
+#include <flash.h>
 #include <hwconfig.h>
 #include <i2c.h>
 #include <init.h>
 #include <spi.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <pci.h>
diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c
index ad56dd7..1b5aa90 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -11,15 +11,18 @@
 #endif
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <dm.h>
 #include <env.h>
 #include <hang.h>
+#include <log.h>
 #include <malloc.h>
 #include <fs.h>
 #include <i2c.h>
 #include <mmc.h>
 #include <tpm-v1.h>
+#include <linux/delay.h>
 #include <u-boot/crc.h>
 #include <u-boot/sha1.h>
 #include <asm/byteorder.h>
diff --git a/board/gdsys/p1022/controlcenterd.c b/board/gdsys/p1022/controlcenterd.c
index 8e86816..73ce985 100644
--- a/board/gdsys/p1022/controlcenterd.c
+++ b/board/gdsys/p1022/controlcenterd.c
@@ -24,7 +24,9 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
@@ -34,6 +36,7 @@
 #include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <fsl_mdio.h>
@@ -221,7 +224,7 @@
 }
 
 #ifdef CONFIG_TRAILBLAZER
-int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return run_command(env_get("bootcmd"), flag);
 }
diff --git a/board/gdsys/p1022/ddr.c b/board/gdsys/p1022/ddr.c
index 591e08f..eb06d22 100644
--- a/board/gdsys/p1022/ddr.c
+++ b/board/gdsys/p1022/ddr.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/gdsys/p1022/diu.c b/board/gdsys/p1022/diu.c
index 7e1e6ce..9a5d3c1 100644
--- a/board/gdsys/p1022/diu.c
+++ b/board/gdsys/p1022/diu.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <command.h>
+#include <log.h>
 #include <linux/ctype.h>
 #include <asm/io.h>
 #include <stdio_dev.h>
diff --git a/board/ge/bx50v3/bx50v3.c b/board/ge/bx50v3/bx50v3.c
index 69cd0a1..edccfd0 100644
--- a/board/ge/bx50v3/bx50v3.c
+++ b/board/ge/bx50v3/bx50v3.c
@@ -5,12 +5,14 @@
  * Copyright 2012 Freescale Semiconductor, Inc.
  */
 
+#include <image.h>
 #include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/libfdt.h>
 #include <asm/gpio.h>
diff --git a/board/google/chromebook_coral/coral.c b/board/google/chromebook_coral/coral.c
index 4e34710..12d4fe6 100644
--- a/board/google/chromebook_coral/coral.c
+++ b/board/google/chromebook_coral/coral.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 
 int arch_misc_init(void)
 {
diff --git a/board/google/gru/gru.c b/board/google/gru/gru.c
index b6b4f19..7dfbc3a 100644
--- a/board/google/gru/gru.c
+++ b/board/google/gru/gru.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 
 #ifdef CONFIG_SPL_BUILD
 /* provided to defeat compiler optimisation in board_init_f() */
diff --git a/board/google/imx8mq_phanbell/spl.c b/board/google/imx8mq_phanbell/spl.c
index b6afdfc..6f39599 100644
--- a/board/google/imx8mq_phanbell/spl.c
+++ b/board/google/imx8mq_phanbell/spl.c
@@ -8,6 +8,8 @@
 #include <hang.h>
 #include <asm/io.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/ddr.h>
 #include <asm/arch/imx8mq_pins.h>
@@ -17,6 +19,7 @@
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/sections.h>
+#include <linux/delay.h>
 #include <fsl_esdhc_imx.h>
 #include <mmc.h>
 #include <spl.h>
diff --git a/board/google/veyron/veyron.c b/board/google/veyron/veyron.c
index 6b9c348..6d84a32 100644
--- a/board/google/veyron/veyron.c
+++ b/board/google/veyron/veyron.c
@@ -6,8 +6,11 @@
 #include <clk.h>
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch-rockchip/clock.h>
 #include <dt-bindings/clock/rk3288-cru.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <power/regulator.h>
 
diff --git a/board/grinn/chiliboard/board.c b/board/grinn/chiliboard/board.c
index 7f0de5e..8cc9278 100644
--- a/board/grinn/chiliboard/board.c
+++ b/board/grinn/chiliboard/board.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/chilisom.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
diff --git a/board/grinn/liteboard/board.c b/board/grinn/liteboard/board.c
index 5d71b63..df32e12 100644
--- a/board/grinn/liteboard/board.c
+++ b/board/grinn/liteboard/board.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2016 Grinn
  */
 
+#include <common.h>
 #include <command.h>
 #include <init.h>
 #include <asm/arch/clock.h>
diff --git a/board/gumstix/duovero/duovero.c b/board/gumstix/duovero/duovero.c
index 78fb98e..0df03a5 100644
--- a/board/gumstix/duovero/duovero.c
+++ b/board/gumstix/duovero/duovero.c
@@ -5,6 +5,8 @@
  * Maintainer: Ash Charles  <ash@gumstix.com>
  */
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mmc_host_def.h>
@@ -14,6 +16,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
 #include <asm/mach-types.h>
+#include <linux/delay.h>
 
 #include "duovero_mux_data.h"
 
diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
index 65e5e1e..ebb5a56 100644
--- a/board/gumstix/pepper/board.c
+++ b/board/gumstix/pepper/board.c
@@ -9,6 +9,8 @@
 #include <common.h>
 #include <env.h>
 #include <errno.h>
+#include <init.h>
+#include <net.h>
 #include <serial.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/highbank/ahci.c b/board/highbank/ahci.c
index 49cd117..9c05727 100644
--- a/board/highbank/ahci.c
+++ b/board/highbank/ahci.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <ahci.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #define CPHY_MAP(dev, addr) ((((dev) & 0x1f) << 7) | (((addr) >> 9) & 0x7f))
 #define CPHY_ADDR(base, dev, addr) ((base) | (((addr) & 0x1ff) << 2))
diff --git a/board/highbank/highbank.c b/board/highbank/highbank.c
index 3e0edd4..063831d 100644
--- a/board/highbank/highbank.c
+++ b/board/highbank/highbank.c
@@ -7,6 +7,9 @@
 #include <ahci.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <fdt_support.h>
+#include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <scsi.h>
 
diff --git a/board/hisilicon/hikey/hikey.c b/board/hisilicon/hikey/hikey.c
index 8440009..6eea939 100644
--- a/board/hisilicon/hikey/hikey.c
+++ b/board/hisilicon/hikey/hikey.c
@@ -7,12 +7,15 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <fdt_support.h>
+#include <init.h>
+#include <log.h>
 #include <dm/platform_data/serial_pl01x.h>
 #include <errno.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include <power/hi6553_pmic.h>
 #include <asm-generic/gpio.h>
 #include <asm/arch/dwmmc.h>
diff --git a/board/hisilicon/hikey960/hikey960.c b/board/hisilicon/hikey960/hikey960.c
index 84c26e0..db485db 100644
--- a/board/hisilicon/hikey960/hikey960.c
+++ b/board/hisilicon/hikey960/hikey960.c
@@ -8,11 +8,14 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <asm/cache.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/hi3660.h>
 #include <asm/armv8/mmu.h>
 #include <asm/psci.h>
 #include <linux/arm-smccc.h>
+#include <linux/delay.h>
 #include <linux/psci.h>
 
 #define PMIC_REG_TO_BUS_ADDR(x) (x << 2)
diff --git a/board/hisilicon/poplar/poplar.c b/board/hisilicon/poplar/poplar.c
index 4937dc3..371c3c3 100644
--- a/board/hisilicon/poplar/poplar.c
+++ b/board/hisilicon/poplar/poplar.c
@@ -8,10 +8,13 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <init.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <dm/platform_data/serial_pl01x.h>
 #include <asm/arch/hi3798cv200.h>
 #include <asm/armv8/mmu.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/ids/ids8313/ids8313.c b/board/ids/ids8313/ids8313.c
index 6e74e93..d0d3401 100644
--- a/board/ids/ids8313/ids8313.c
+++ b/board/ids/ids8313/ids8313.c
@@ -16,6 +16,8 @@
 #include <init.h>
 #include <mpc83xx.h>
 #include <spi.h>
+#include <asm/bitops.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/imgtec/boston/checkboard.c b/board/imgtec/boston/checkboard.c
index 46ec1e8..1b8a47d 100644
--- a/board/imgtec/boston/checkboard.c
+++ b/board/imgtec/boston/checkboard.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 
 #include <asm/io.h>
 #include <asm/mipsregs.h>
diff --git a/board/imgtec/ci20/ci20.c b/board/imgtec/ci20/ci20.c
index 170ea12..5339b9e 100644
--- a/board/imgtec/ci20/ci20.c
+++ b/board/imgtec/ci20/ci20.c
@@ -8,10 +8,13 @@
 
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/jz4780.h>
 #include <mach/jz4780_dram.h>
 #include <mach/jz4780_gpio.h>
diff --git a/board/imgtec/malta/malta.c b/board/imgtec/malta/malta.c
index 77ce75e..88a1a63 100644
--- a/board/imgtec/malta/malta.c
+++ b/board/imgtec/malta/malta.c
@@ -7,11 +7,13 @@
 #include <common.h>
 #include <ide.h>
 #include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <pci.h>
 #include <pci_gt64120.h>
 #include <pci_msc01.h>
 #include <rtc.h>
+#include <linux/delay.h>
 
 #include <asm/addrspace.h>
 #include <asm/io.h>
diff --git a/board/imgtec/xilfpga/xilfpga.c b/board/imgtec/xilfpga/xilfpga.c
index 8664515..0b68bbd 100644
--- a/board/imgtec/xilfpga/xilfpga.c
+++ b/board/imgtec/xilfpga/xilfpga.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/intel/cougarcanyon2/cougarcanyon2.c b/board/intel/cougarcanyon2/cougarcanyon2.c
index 7aadd9e..ce11eae 100644
--- a/board/intel/cougarcanyon2/cougarcanyon2.c
+++ b/board/intel/cougarcanyon2/cougarcanyon2.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
 #include <pci.h>
 #include <smsc_sio1007.h>
 #include <asm/ibmpc.h>
diff --git a/board/intel/crownbay/crownbay.c b/board/intel/crownbay/crownbay.c
index 57dce41..55095de 100644
--- a/board/intel/crownbay/crownbay.c
+++ b/board/intel/crownbay/crownbay.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/ibmpc.h>
 #include <asm/pnp_def.h>
 #include <smsc_lpc47m.h>
diff --git a/board/intel/minnowmax/minnowmax.c b/board/intel/minnowmax/minnowmax.c
index e5fc939..b02e3f0 100644
--- a/board/intel/minnowmax/minnowmax.c
+++ b/board/intel/minnowmax/minnowmax.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
diff --git a/board/inversepath/usbarmory/usbarmory.c b/board/inversepath/usbarmory/usbarmory.c
index 4fa34e1..02a5148 100644
--- a/board/inversepath/usbarmory/usbarmory.c
+++ b/board/inversepath/usbarmory/usbarmory.c
@@ -17,6 +17,7 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux-mx53.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <i2c.h>
 #include <mmc.h>
diff --git a/board/iomega/iconnect/iconnect.c b/board/iomega/iconnect/iconnect.c
index fc7847b..79c794b 100644
--- a/board/iomega/iconnect/iconnect.c
+++ b/board/iomega/iconnect/iconnect.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c
index b0f8d8a..a28d447 100644
--- a/board/isee/igep003x/board.c
+++ b/board/isee/igep003x/board.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <serial.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/isee/igep00x0/common.c b/board/isee/igep00x0/common.c
index f5d62ff..2c26977 100644
--- a/board/isee/igep00x0/common.c
+++ b/board/isee/igep00x0/common.c
@@ -7,6 +7,7 @@
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
 #include <jffs2/load_kernel.h>
+#include <linux/delay.h>
 #include <linux/mtd/rawnand.h>
 #include "igep00x0.h"
 
diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 1b871fd..af0bce6 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -5,7 +5,9 @@
  */
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <status_led.h>
 #include <dm.h>
 #include <ns16550.h>
@@ -18,6 +20,7 @@
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/mux.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/onenand.h>
diff --git a/board/k+p/kp_imx53/kp_id_rev.c b/board/k+p/kp_imx53/kp_id_rev.c
index 9dae54d..7103a3e 100644
--- a/board/k+p/kp_imx53/kp_id_rev.c
+++ b/board/k+p/kp_imx53/kp_id_rev.c
@@ -13,6 +13,7 @@
 #include <env.h>
 #include <i2c.h>
 #include "kp_id_rev.h"
+#include <net.h>
 
 static int eeprom_has_been_read;
 static struct id_eeprom eeprom;
diff --git a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
index 25a5e4b..75fb6ac 100644
--- a/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
+++ b/board/k+p/kp_imx6q_tpc/kp_imx6q_tpc_spl.c
@@ -6,6 +6,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/imx-regs.h>
@@ -14,6 +16,7 @@
 #include <asm/io.h>
 #include <errno.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index 08f7f8d..9c9e159 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -17,6 +17,7 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_POST)
 #include "post.h"
@@ -157,8 +158,8 @@
  * read out the board id and the hw key from the intventory EEPROM and set
  * this values as environment variables.
  */
-static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc,
-				char *const argv[])
+static int do_setboardid(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	unsigned char buf[32];
 	char *p;
@@ -203,8 +204,8 @@
  *				application and in the init scripts (?)
  *	return 0 in case of match, 1 if not match or error
  */
-static int do_checkboardidhwk(cmd_tbl_t *cmdtp, int flag, int argc,
-			char *const argv[])
+static int do_checkboardidhwk(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	unsigned long ivmbid = 0, ivmhwkey = 0;
 	unsigned long envbid = 0, envhwkey = 0;
@@ -344,8 +345,8 @@
  *  if the testpin of the board is asserted, return 1
  *  *	else return 0
  */
-static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, int argc,
-			char *const argv[])
+static int do_checktestboot(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	int testpin = 0;
 	char *s = NULL;
diff --git a/board/keymile/common/qrio.c b/board/keymile/common/qrio.c
index 0cb3366..06a4e67 100644
--- a/board/keymile/common/qrio.c
+++ b/board/keymile/common/qrio.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <linux/bitops.h>
 
 #include "common.h"
 #include "qrio.h"
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 8f7e7f0..29514d8 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -18,6 +18,7 @@
 #include <fdt_support.h>
 #include <init.h>
 #include <ioports.h>
+#include <log.h>
 #include <mpc83xx.h>
 #include <i2c.h>
 #include <miiphy.h>
@@ -25,6 +26,7 @@
 #include <asm/mmu.h>
 #include <asm/processor.h>
 #include <pci.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <post.h>
 
diff --git a/board/keymile/km83xx/km83xx_i2c.c b/board/keymile/km83xx/km83xx_i2c.c
index 113ca70..62100b1 100644
--- a/board/keymile/km83xx/km83xx_i2c.c
+++ b/board/keymile/km83xx/km83xx_i2c.c
@@ -8,6 +8,7 @@
 #include <i2c.h>
 #include <asm/io.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include "../common/common.h"
 
 static void i2c_write_start_seq(void)
diff --git a/board/keymile/km_arm/fpga_config.c b/board/keymile/km_arm/fpga_config.c
index 8bb0470..abb5b7d 100644
--- a/board/keymile/km_arm/fpga_config.c
+++ b/board/keymile/km_arm/fpga_config.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 
 /* GPIO Pin from kirkwood connected to PROGRAM_B pin of the xilinx FPGA */
diff --git a/board/keymile/kmp204x/ddr.c b/board/keymile/kmp204x/ddr.c
index ee2e3d6..d9c9ddf 100644
--- a/board/keymile/kmp204x/ddr.c
+++ b/board/keymile/kmp204x/ddr.c
@@ -9,6 +9,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/keymile/kmp204x/eth.c b/board/keymile/kmp204x/eth.c
index 7499d20..8635a54 100644
--- a/board/keymile/kmp204x/eth.c
+++ b/board/keymile/kmp204x/eth.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <netdev.h>
 #include <fm_eth.h>
 #include <fsl_mdio.h>
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 0a6cf1f..21afbc7 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -10,6 +10,7 @@
 #include <command.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/keymile/kmp204x/pci.c b/board/keymile/kmp204x/pci.c
index 15bbc81..87bf168 100644
--- a/board/keymile/kmp204x/pci.c
+++ b/board/keymile/kmp204x/pci.c
@@ -11,6 +11,7 @@
 #include <init.h>
 #include <pci.h>
 #include <asm/fsl_pci.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <asm/fsl_serdes.h>
diff --git a/board/kmc/kzm9g/kzm9g.c b/board/kmc/kzm9g/kzm9g.c
index 6ef960b..7bc66af 100644
--- a/board/kmc/kzm9g/kzm9g.c
+++ b/board/kmc/kzm9g/kzm9g.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/kobol/helios4/helios4.c b/board/kobol/helios4/helios4.c
index 3c3592e..97b1526 100644
--- a/board/kobol/helios4/helios4.c
+++ b/board/kobol/helios4/helios4.c
@@ -6,7 +6,9 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/board/kosagi/novena/novena.c b/board/kosagi/novena/novena.c
index 4bec2be..b1939f8 100644
--- a/board/kosagi/novena/novena.c
+++ b/board/kosagi/novena/novena.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <eeprom.h>
 #include <init.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <ahci.h>
 #include <env.h>
diff --git a/board/kosagi/novena/novena_spl.c b/board/kosagi/novena/novena_spl.c
index bc52b91..9926285 100644
--- a/board/kosagi/novena/novena_spl.c
+++ b/board/kosagi/novena/novena_spl.c
@@ -23,6 +23,7 @@
 #include <mmc.h>
 #include <fsl_esdhc_imx.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #include <asm/arch/mx6-ddr.h>
 
diff --git a/board/kosagi/novena/video.c b/board/kosagi/novena/video.c
index 7083b6e..a96a877 100644
--- a/board/kosagi/novena/video.c
+++ b/board/kosagi/novena/video.c
@@ -10,6 +10,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/board/lego/ev3/legoev3.c b/board/lego/ev3/legoev3.c
index fa099e9..51b669a 100644
--- a/board/lego/ev3/legoev3.c
+++ b/board/lego/ev3/legoev3.c
@@ -14,6 +14,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <asm/arch/hardware.h>
diff --git a/board/lg/sniper/sniper.c b/board/lg/sniper/sniper.c
index b4205d6..2825ecc 100644
--- a/board/lg/sniper/sniper.c
+++ b/board/lg/sniper/sniper.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
 #include <linux/ctype.h>
 #include <linux/usb/musb.h>
 #include <asm/omap_musb.h>
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c
index 85ca777..ec55fdf 100644
--- a/board/liebherr/display5/display5.c
+++ b/board/liebherr/display5/display5.c
@@ -6,6 +6,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <fdt_support.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
@@ -22,6 +25,7 @@
 #include <miiphy.h>
 #include <netdev.h>
 #include <i2c.h>
+#include <linux/delay.h>
 
 #include <dm.h>
 #include <dm/platform_data/serial_mxc.h>
diff --git a/board/liebherr/display5/spl.c b/board/liebherr/display5/spl.c
index 765463e..ac4f23f 100644
--- a/board/liebherr/display5/spl.c
+++ b/board/liebherr/display5/spl.c
@@ -7,8 +7,12 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <serial.h>
 #include <spl.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/board/liebherr/mccmon6/spl.c b/board/liebherr/mccmon6/spl.c
index 08d2b56..b234f06 100644
--- a/board/liebherr/mccmon6/spl.c
+++ b/board/liebherr/mccmon6/spl.c
@@ -5,6 +5,8 @@
  *         Richard Hu <hakahu@gmail.com>
  */
 
+#include <image.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
@@ -20,6 +22,7 @@
 #include <asm/arch/sys_proto.h>
 #include <serial.h>
 #include <spl.h>
+#include <linux/delay.h>
 
 #include <asm/arch/mx6-ddr.h>
 /*
diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
index df5d316..8159f3a 100644
--- a/board/liebherr/xea/xea.c
+++ b/board/liebherr/xea/xea.c
@@ -14,12 +14,17 @@
  */
 
 #include <common.h>
+#include <fdt_support.h>
+#include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx28.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <miiphy.h>
 #include <netdev.h>
diff --git a/board/logicpd/am3517evm/am3517evm.c b/board/logicpd/am3517evm/am3517evm.c
index 18f3c3f..b25b02b 100644
--- a/board/logicpd/am3517evm/am3517evm.c
+++ b/board/logicpd/am3517evm/am3517evm.c
@@ -12,6 +12,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <net.h>
 #include <ns16550.h>
 #include <serial.h>
 #include <asm/io.h>
diff --git a/board/logicpd/omap3som/omap3logic.c b/board/logicpd/omap3som/omap3logic.c
index 21d8a21..5c178a2 100644
--- a/board/logicpd/omap3som/omap3logic.c
+++ b/board/logicpd/omap3som/omap3logic.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <net.h>
 #include <ns16550.h>
 #include <netdev.h>
 #include <flash.h>
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index 6bfa417..53dc976 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -16,6 +16,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <ns16550.h>
 #include <netdev.h>
 #include <twl4030.h>
diff --git a/board/maxbcm/maxbcm.c b/board/maxbcm/maxbcm.c
index 395904f..3c64222 100644
--- a/board/maxbcm/maxbcm.c
+++ b/board/maxbcm/maxbcm.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/board/mediatek/mt7622/mt7622_rfb.c b/board/mediatek/mt7622/mt7622_rfb.c
index b9296be..6a5f936 100644
--- a/board/mediatek/mt7622/mt7622_rfb.c
+++ b/board/mediatek/mt7622/mt7622_rfb.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <config.h>
+#include <env.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/mediatek/mt8512/mt8512.c b/board/mediatek/mt8512/mt8512.c
index 726111d..4ad62b7 100644
--- a/board/mediatek/mt8512/mt8512.c
+++ b/board/mediatek/mt8512/mt8512.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <wdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/mediatek/mt8518/mt8518_ap1.c b/board/mediatek/mt8518/mt8518_ap1.c
index 2ac7c6c..c9acfcb 100644
--- a/board/mediatek/mt8518/mt8518_ap1.c
+++ b/board/mediatek/mt8518/mt8518_ap1.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c
index 70a13aa..58a564a 100644
--- a/board/menlo/m53menlo/m53menlo.c
+++ b/board/menlo/m53menlo/m53menlo.c
@@ -26,6 +26,7 @@
 #include <gzip.h>
 #include <i2c.h>
 #include <ipu_pixfmt.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <linux/fb.h>
 #include <mmc.h>
diff --git a/board/microchip/mpfs_icicle/mpfs_icicle.c b/board/microchip/mpfs_icicle/mpfs_icicle.c
index 0ef2431..8381361 100644
--- a/board/microchip/mpfs_icicle/mpfs_icicle.c
+++ b/board/microchip/mpfs_icicle/mpfs_icicle.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <asm/io.h>
 
 #define MPFS_SYSREG_SOFT_RESET	((unsigned int *)0x20002088)
diff --git a/board/microchip/pic32mzda/pic32mzda.c b/board/microchip/pic32mzda/pic32mzda.c
index aa8aab3..e7337de 100644
--- a/board/microchip/pic32mzda/pic32mzda.c
+++ b/board/microchip/pic32mzda/pic32mzda.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <clk.h>
+#include <init.h>
 #include <malloc.h>
 #include <dt-bindings/clock/microchip,clock.h>
 #include <mach/pic32.h>
diff --git a/board/mikrotik/crs305-1g-4s/crs305-1g-4s.c b/board/mikrotik/crs305-1g-4s/crs305-1g-4s.c
index d1d1f40..8b419ef 100644
--- a/board/mikrotik/crs305-1g-4s/crs305-1g-4s.c
+++ b/board/mikrotik/crs305-1g-4s/crs305-1g-4s.c
@@ -5,7 +5,9 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <init.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <linux/mbus.h>
 #include <linux/io.h>
 #include <asm/arch/cpu.h>
diff --git a/board/mpc8308_p1m/mpc8308_p1m.c b/board/mpc8308_p1m/mpc8308_p1m.c
index 5b2fd9c..6014420 100644
--- a/board/mpc8308_p1m/mpc8308_p1m.c
+++ b/board/mpc8308_p1m/mpc8308_p1m.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <init.h>
+#include <net.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <pci.h>
diff --git a/board/mscc/common/spi.c b/board/mscc/common/spi.c
index 0566fcb..45b9649 100644
--- a/board/mscc/common/spi.c
+++ b/board/mscc/common/spi.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <spi.h>
+#include <linux/bitops.h>
 
 void external_cs_manage(struct udevice *dev, bool enable)
 {
diff --git a/board/mscc/jr2/jr2.c b/board/mscc/jr2/jr2.c
index 067907b..51700f4 100644
--- a/board/mscc/jr2/jr2.c
+++ b/board/mscc/jr2/jr2.c
@@ -4,10 +4,13 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
 #include <asm/io.h>
 #include <led.h>
 #include <miiphy.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 enum {
 	BOARD_TYPE_PCB110 = 0xAABBCE00,
diff --git a/board/mscc/luton/luton.c b/board/mscc/luton/luton.c
index e614058..acc2615 100644
--- a/board/mscc/luton/luton.c
+++ b/board/mscc/luton/luton.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
 #include <asm/io.h>
 #include <led.h>
diff --git a/board/mscc/ocelot/ocelot.c b/board/mscc/ocelot/ocelot.c
index ad227a4..74e8bfc 100644
--- a/board/mscc/ocelot/ocelot.c
+++ b/board/mscc/ocelot/ocelot.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
@@ -12,6 +14,7 @@
 #include <led.h>
 #include <wait_bit.h>
 #include <miiphy.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/mscc/serval/serval.c b/board/mscc/serval/serval.c
index 6c6dbf2..ed1aea5 100644
--- a/board/mscc/serval/serval.c
+++ b/board/mscc/serval/serval.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
 #include <asm/io.h>
 #include <led.h>
diff --git a/board/mscc/servalt/servalt.c b/board/mscc/servalt/servalt.c
index 71891f6..d0e6016 100644
--- a/board/mscc/servalt/servalt.c
+++ b/board/mscc/servalt/servalt.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <init.h>
 #include <asm/io.h>
 #include <led.h>
diff --git a/board/netgear/dgnd3700v2/dgnd3700v2.c b/board/netgear/dgnd3700v2/dgnd3700v2.c
index 6840a21..cfc3529 100644
--- a/board/netgear/dgnd3700v2/dgnd3700v2.c
+++ b/board/netgear/dgnd3700v2/dgnd3700v2.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define GPIO_BASE_6362			0x10000080
 
diff --git a/board/nokia/rx51/rx51.c b/board/nokia/rx51/rx51.c
index a282fe6..60a2e36 100644
--- a/board/nokia/rx51/rx51.c
+++ b/board/nokia/rx51/rx51.c
@@ -23,6 +23,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <watchdog.h>
 #include <malloc.h>
 #include <twl4030.h>
diff --git a/board/novtech/meerkat96/meerkat96.c b/board/novtech/meerkat96/meerkat96.c
index 5fb4d43..b13e7ce 100644
--- a/board/novtech/meerkat96/meerkat96.c
+++ b/board/novtech/meerkat96/meerkat96.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2016 NXP Semiconductors
  */
 
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx7-pins.h>
diff --git a/board/nvidia/cardhu/cardhu.c b/board/nvidia/cardhu/cardhu.c
index 2ae64b1..6848e34 100644
--- a/board/nvidia/cardhu/cardhu.c
+++ b/board/nvidia/cardhu/cardhu.c
@@ -6,10 +6,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/gp_padctrl.h>
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 #include "pinmux-config-cardhu.h"
 #include <i2c.h>
 
diff --git a/board/nvidia/dalmore/dalmore.c b/board/nvidia/dalmore/dalmore.c
index fcee217..72511e4 100644
--- a/board/nvidia/dalmore/dalmore.c
+++ b/board/nvidia/dalmore/dalmore.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/gp_padctrl.h>
 #include "pinmux-config-dalmore.h"
diff --git a/board/nvidia/e2220-1170/e2220-1170.c b/board/nvidia/e2220-1170/e2220-1170.c
index 5aac040..b819b04 100644
--- a/board/nvidia/e2220-1170/e2220-1170.c
+++ b/board/nvidia/e2220-1170/e2220-1170.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
 #include "../p2571/max77620_init.h"
diff --git a/board/nvidia/jetson-tk1/jetson-tk1.c b/board/nvidia/jetson-tk1/jetson-tk1.c
index aed08b4..9eccdc4 100644
--- a/board/nvidia/jetson-tk1/jetson-tk1.c
+++ b/board/nvidia/jetson-tk1/jetson-tk1.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <power/as3722.h>
 #include <power/pmic.h>
 
diff --git a/board/nvidia/nyan-big/nyan-big.c b/board/nvidia/nyan-big/nyan-big.c
index 3c7bfea..71c71ed 100644
--- a/board/nvidia/nyan-big/nyan-big.c
+++ b/board/nvidia/nyan-big/nyan-big.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/pinmux.h>
@@ -14,6 +15,7 @@
 #include <asm/arch/mc.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <asm/arch-tegra/pmc.h>
+#include <linux/delay.h>
 #include <power/as3722.h>
 #include <power/pmic.h>
 #include "pinmux-config-nyan-big.h"
diff --git a/board/nvidia/p2371-0000/p2371-0000.c b/board/nvidia/p2371-0000/p2371-0000.c
index 5aac040..b819b04 100644
--- a/board/nvidia/p2371-0000/p2371-0000.c
+++ b/board/nvidia/p2371-0000/p2371-0000.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
 #include "../p2571/max77620_init.h"
diff --git a/board/nvidia/p2371-2180/p2371-2180.c b/board/nvidia/p2371-2180/p2371-2180.c
index 1756bbc..4aeec47 100644
--- a/board/nvidia/p2371-2180/p2371-2180.c
+++ b/board/nvidia/p2371-2180/p2371-2180.c
@@ -8,6 +8,9 @@
 #include <env.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
+#include <net.h>
+#include <linux/bitops.h>
 #include <linux/libfdt.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
diff --git a/board/nvidia/p2571/p2571.c b/board/nvidia/p2571/p2571.c
index a9e4d21..a4c4259 100644
--- a/board/nvidia/p2571/p2571.c
+++ b/board/nvidia/p2571/p2571.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pinmux.h>
 #include <asm/gpio.h>
diff --git a/board/nvidia/p2771-0000/p2771-0000.c b/board/nvidia/p2771-0000/p2771-0000.c
index 63cdb3a..3f0e594 100644
--- a/board/nvidia/p2771-0000/p2771-0000.c
+++ b/board/nvidia/p2771-0000/p2771-0000.c
@@ -7,6 +7,8 @@
 #include <env.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
+#include <net.h>
 #include <linux/libfdt.h>
 #include <asm/arch-tegra/cboot.h>
 #include "../p2571/max77620_init.h"
diff --git a/board/nvidia/p3450-0000/p3450-0000.c b/board/nvidia/p3450-0000/p3450-0000.c
index f4212ab..45f9bac 100644
--- a/board/nvidia/p3450-0000/p3450-0000.c
+++ b/board/nvidia/p3450-0000/p3450-0000.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <linux/bitops.h>
 #include <linux/libfdt.h>
 #include <pca953x.h>
 #include <asm/arch-tegra/cboot.h>
diff --git a/board/nvidia/venice2/as3722_init.c b/board/nvidia/venice2/as3722_init.c
index 5ebd6a0..ba67654 100644
--- a/board/nvidia/venice2/as3722_init.c
+++ b/board/nvidia/venice2/as3722_init.c
@@ -5,8 +5,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/tegra_i2c.h>
+#include <linux/delay.h>
 #include "as3722_init.h"
 
 /* AS3722-PMIC-specific early init code - get CPU rails up, etc */
diff --git a/board/olimex/mx23_olinuxino/mx23_olinuxino.c b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
index f1d7cb8..808d221 100644
--- a/board/olimex/mx23_olinuxino/mx23_olinuxino.c
+++ b/board/olimex/mx23_olinuxino/mx23_olinuxino.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/iomux-mx23.h>
@@ -15,6 +16,7 @@
 #ifdef CONFIG_LED_STATUS
 #include <status_led.h>
 #endif
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/overo/overo.c b/board/overo/overo.c
index baa7997..5450f5d 100644
--- a/board/overo/overo.c
+++ b/board/overo/overo.c
@@ -14,10 +14,13 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <ns16550.h>
 #include <netdev.h>
 #include <twl4030.h>
+#include <linux/delay.h>
 #include <linux/mtd/rawnand.h>
 #include <asm/io.h>
 #include <asm/arch/mmc_host_def.h>
diff --git a/board/overo/spl.c b/board/overo/spl.c
index d577e00..91d8091 100644
--- a/board/overo/spl.c
+++ b/board/overo/spl.c
@@ -11,6 +11,8 @@
  * (C) Copyright 2004-2008
  * Texas Instruments, <www.ti.com>
  */
+
+#include <common.h>
 #include <asm/io.h>
 #include <asm/arch/mem.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/pandora/pandora.c b/board/pandora/pandora.c
index a9aae79..a938486 100644
--- a/board/pandora/pandora.c
+++ b/board/pandora/pandora.c
@@ -14,6 +14,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <ns16550.h>
 #include <twl4030.h>
 #include <asm/io.h>
@@ -23,6 +24,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-types.h>
+#include <linux/delay.h>
 #include "pandora.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/phytec/pcl063/spl.c b/board/phytec/pcl063/spl.c
index b5e080c..48cb2e2 100644
--- a/board/phytec/pcl063/spl.c
+++ b/board/phytec/pcl063/spl.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/arch/clock.h>
 #include <asm/io.h>
diff --git a/board/phytec/pcm051/board.c b/board/phytec/pcm051/board.c
index 43f6c5a..6f1ada8 100644
--- a/board/phytec/pcm051/board.c
+++ b/board/phytec/pcm051/board.c
@@ -11,6 +11,8 @@
 #include <common.h>
 #include <env.h>
 #include <errno.h>
+#include <init.h>
+#include <net.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
diff --git a/board/phytec/pcm052/pcm052.c b/board/phytec/pcm052/pcm052.c
index c40dc05..b0c56a2 100644
--- a/board/phytec/pcm052/pcm052.c
+++ b/board/phytec/pcm052/pcm052.c
@@ -17,6 +17,7 @@
 #include <env.h>
 #include <led.h>
 #include <miiphy.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/phytec/pcm058/pcm058.c b/board/phytec/pcm058/pcm058.c
index 820b5fd..096425c 100644
--- a/board/phytec/pcm058/pcm058.c
+++ b/board/phytec/pcm058/pcm058.c
@@ -11,6 +11,7 @@
  */
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
@@ -22,6 +23,7 @@
 #include <asm/mach-imx/boot_mode.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/spi.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <mmc.h>
diff --git a/board/phytec/pfla02/pfla02.c b/board/phytec/pfla02/pfla02.c
index a3af823..fed8f52 100644
--- a/board/phytec/pfla02/pfla02.c
+++ b/board/phytec/pfla02/pfla02.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
@@ -18,6 +20,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/spi.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <mmc.h>
diff --git a/board/phytec/phycore_rk3288/phycore-rk3288.c b/board/phytec/phycore_rk3288/phycore-rk3288.c
index 039ed0f..ecc7322 100644
--- a/board/phytec/phycore_rk3288/phycore-rk3288.c
+++ b/board/phytec/phycore_rk3288/phycore-rk3288.c
@@ -6,6 +6,8 @@
 
 #include <eeprom.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
@@ -14,6 +16,7 @@
 #include <i2c.h>
 #include <i2c_eeprom.h>
 #include <netdev.h>
+#include <linux/bitops.h>
 #include "som.h"
 #include <power/regulator.h>
 #include <power/rk8xx_pmic.h>
diff --git a/board/phytium/durian/durian.c b/board/phytium/durian/durian.c
index 40dd27a..b80688a 100644
--- a/board/phytium/durian/durian.c
+++ b/board/phytium/durian/durian.c
@@ -6,8 +6,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <log.h>
 #include <asm/armv8/mmu.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <linux/arm-smccc.h>
diff --git a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
index 3f60235..d790846 100644
--- a/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
+++ b/board/pine64/rockpro64_rk3399/rockpro64-rk3399.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/clock.h>
diff --git a/board/ppcag/bg0900/bg0900.c b/board/ppcag/bg0900/bg0900.c
index e3e8e74..9150748 100644
--- a/board/ppcag/bg0900/bg0900.c
+++ b/board/ppcag/bg0900/bg0900.c
@@ -6,12 +6,15 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx28.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <miiphy.h>
 #include <netdev.h>
diff --git a/board/qca/ap121/ap121.c b/board/qca/ap121/ap121.c
index 24acdcb..60a2e19 100644
--- a/board/qca/ap121/ap121.c
+++ b/board/qca/ap121/ap121.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
diff --git a/board/qca/ap143/ap143.c b/board/qca/ap143/ap143.c
index 8ee26ab..ac65054 100644
--- a/board/qca/ap143/ap143.c
+++ b/board/qca/ap143/ap143.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
diff --git a/board/qca/ap152/ap152.c b/board/qca/ap152/ap152.c
index 30cd565..1064705 100644
--- a/board/qca/ap152/ap152.c
+++ b/board/qca/ap152/ap152.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
diff --git a/board/qemu-mips/qemu-mips.c b/board/qemu-mips/qemu-mips.c
index 414a9c0..cf22ed5 100644
--- a/board/qemu-mips/qemu-mips.c
+++ b/board/qemu-mips/qemu-mips.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <command.h>
+#include <init.h>
+#include <net.h>
 #include <asm/mipsregs.h>
 #include <asm/io.h>
 #include <netdev.h>
diff --git a/board/qualcomm/dragonboard410c/dragonboard410c.c b/board/qualcomm/dragonboard410c/dragonboard410c.c
index 81bd8bd..672bd46 100644
--- a/board/qualcomm/dragonboard410c/dragonboard410c.c
+++ b/board/qualcomm/dragonboard410c/dragonboard410c.c
@@ -10,11 +10,14 @@
 #include <dm.h>
 #include <env.h>
 #include <init.h>
+#include <net.h>
 #include <usb.h>
+#include <asm/cache.h>
 #include <asm/gpio.h>
 #include <fdt_support.h>
 #include <asm/arch/dram.h>
 #include <asm/arch/misc.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/qualcomm/dragonboard820c/dragonboard820c.c b/board/qualcomm/dragonboard820c/dragonboard820c.c
index 6c096b4..c1ade5c 100644
--- a/board/qualcomm/dragonboard820c/dragonboard820c.c
+++ b/board/qualcomm/dragonboard820c/dragonboard820c.c
@@ -6,8 +6,10 @@
  */
 
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/arch/sysmap-apq8096.h>
 #include <env.h>
+#include <asm/cache.h>
 #include <linux/arm-smccc.h>
 #include <linux/psci.h>
 #include <common.h>
diff --git a/board/raidsonic/ib62x0/ib62x0.c b/board/raidsonic/ib62x0/ib62x0.c
index e8aae4c..db1b0ad 100644
--- a/board/raidsonic/ib62x0/ib62x0.c
+++ b/board/raidsonic/ib62x0/ib62x0.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/board/renesas/MigoR/migo_r.c b/board/renesas/MigoR/migo_r.c
index 767c45c..f8bdb4d 100644
--- a/board/renesas/MigoR/migo_r.c
+++ b/board/renesas/MigoR/migo_r.c
@@ -10,6 +10,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/processor.h>
diff --git a/board/renesas/alt/alt.c b/board/renesas/alt/alt.c
index a6d7cb4..279ed48 100644
--- a/board/renesas/alt/alt.c
+++ b/board/renesas/alt/alt.c
@@ -9,6 +9,7 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
@@ -16,6 +17,8 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/alt/alt_spl.c b/board/renesas/alt/alt_spl.c
index dbb2105..2de236f 100644
--- a/board/renesas/alt/alt_spl.c
+++ b/board/renesas/alt/alt_spl.c
@@ -7,11 +7,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm/platform_data/serial_sh.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/blanche/blanche.c b/board/renesas/blanche/blanche.c
index c153873..5fa1087 100644
--- a/board/renesas/blanche/blanche.c
+++ b/board/renesas/blanche/blanche.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <net.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/rcar-mstp.h>
 #include <asm/arch/rmobile.h>
@@ -22,6 +24,7 @@
 #include <env.h>
 #include <hang.h>
 #include <i2c.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <malloc.h>
 #include <miiphy.h>
diff --git a/board/renesas/condor/condor.c b/board/renesas/condor/condor.c
index 6505bed..91afcdd 100644
--- a/board/renesas/condor/condor.c
+++ b/board/renesas/condor/condor.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
diff --git a/board/renesas/draak/draak.c b/board/renesas/draak/draak.c
index 2f9364c..c8f4b21 100644
--- a/board/renesas/draak/draak.c
+++ b/board/renesas/draak/draak.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
@@ -16,6 +17,7 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/eagle/eagle.c b/board/renesas/eagle/eagle.c
index cf06a17..6228f22 100644
--- a/board/renesas/eagle/eagle.c
+++ b/board/renesas/eagle/eagle.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
diff --git a/board/renesas/ebisu/ebisu.c b/board/renesas/ebisu/ebisu.c
index 81d7f8e..d164a36 100644
--- a/board/renesas/ebisu/ebisu.c
+++ b/board/renesas/ebisu/ebisu.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
diff --git a/board/renesas/gose/gose.c b/board/renesas/gose/gose.c
index eb6ee6f..c6a93c2 100644
--- a/board/renesas/gose/gose.c
+++ b/board/renesas/gose/gose.c
@@ -9,6 +9,7 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
@@ -16,6 +17,8 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/gose/gose_spl.c b/board/renesas/gose/gose_spl.c
index 42a6758..624ba5d 100644
--- a/board/renesas/gose/gose_spl.c
+++ b/board/renesas/gose/gose_spl.c
@@ -7,11 +7,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm/platform_data/serial_sh.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/grpeach/grpeach.c b/board/renesas/grpeach/grpeach.c
index ba90460..b92e01c 100644
--- a/board/renesas/grpeach/grpeach.c
+++ b/board/renesas/grpeach/grpeach.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
 
diff --git a/board/renesas/koelsch/koelsch.c b/board/renesas/koelsch/koelsch.c
index e09d3d0..1b3acc8 100644
--- a/board/renesas/koelsch/koelsch.c
+++ b/board/renesas/koelsch/koelsch.c
@@ -10,6 +10,7 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
@@ -17,6 +18,8 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/koelsch/koelsch_spl.c b/board/renesas/koelsch/koelsch_spl.c
index b3530d7..449bbfa 100644
--- a/board/renesas/koelsch/koelsch_spl.c
+++ b/board/renesas/koelsch/koelsch_spl.c
@@ -7,11 +7,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm/platform_data/serial_sh.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/lager/lager.c b/board/renesas/lager/lager.c
index 9ac9515..36a35a9 100644
--- a/board/renesas/lager/lager.c
+++ b/board/renesas/lager/lager.c
@@ -12,6 +12,7 @@
 #include <env.h>
 #include <env_internal.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
@@ -19,6 +20,8 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/lager/lager_spl.c b/board/renesas/lager/lager_spl.c
index d7db361..1ca857c 100644
--- a/board/renesas/lager/lager_spl.c
+++ b/board/renesas/lager/lager_spl.c
@@ -7,11 +7,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm/platform_data/serial_sh.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/porter/porter.c b/board/renesas/porter/porter.c
index 097710b..793e02c 100644
--- a/board/renesas/porter/porter.c
+++ b/board/renesas/porter/porter.c
@@ -10,6 +10,7 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
@@ -17,6 +18,8 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/porter/porter_spl.c b/board/renesas/porter/porter_spl.c
index 026220d..f10c6cf 100644
--- a/board/renesas/porter/porter_spl.c
+++ b/board/renesas/porter/porter_spl.c
@@ -7,11 +7,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm/platform_data/serial_sh.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/r2dplus/r2dplus.c b/board/renesas/r2dplus/r2dplus.c
index f2da468..e4d0967 100644
--- a/board/renesas/r2dplus/r2dplus.c
+++ b/board/renesas/r2dplus/r2dplus.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <ide.h>
 #include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/processor.h>
 #include <asm/io.h>
diff --git a/board/renesas/r7780mp/r7780mp.c b/board/renesas/r7780mp/r7780mp.c
index 8dbeeb6..120464c 100644
--- a/board/renesas/r7780mp/r7780mp.c
+++ b/board/renesas/r7780mp/r7780mp.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <ide.h>
 #include <init.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/pci.h>
diff --git a/board/renesas/rcar-common/common.c b/board/renesas/rcar-common/common.c
index 37f8a46..b9e8cb4 100644
--- a/board/renesas/rcar-common/common.c
+++ b/board/renesas/rcar-common/common.c
@@ -9,8 +9,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <dm/uclass-internal.h>
 #include <asm/arch/rmobile.h>
+#include <linux/libfdt.h>
 
 #ifdef CONFIG_RCAR_GEN3
 
diff --git a/board/renesas/rcar-common/gen3-spl.c b/board/renesas/rcar-common/gen3-spl.c
index d9741c1..fd6e505 100644
--- a/board/renesas/rcar-common/gen3-spl.c
+++ b/board/renesas/rcar-common/gen3-spl.c
@@ -7,8 +7,12 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <spl.h>
+#include <linux/bitops.h>
 
 #define RCAR_CNTC_BASE	0xE6080000
 #define CNTCR_EN	BIT(0)
diff --git a/board/renesas/salvator-x/salvator-x.c b/board/renesas/salvator-x/salvator-x.c
index 91c3728..947bdae 100644
--- a/board/renesas/salvator-x/salvator-x.c
+++ b/board/renesas/salvator-x/salvator-x.c
@@ -9,6 +9,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <image.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
@@ -16,6 +18,7 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/sh7752evb/sh7752evb.c b/board/renesas/sh7752evb/sh7752evb.c
index 203eecf..a005029 100644
--- a/board/renesas/sh7752evb/sh7752evb.c
+++ b/board/renesas/sh7752evb/sh7752evb.c
@@ -4,14 +4,18 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/mmc.h>
 #include <spi.h>
 #include <spi_flash.h>
+#include <linux/delay.h>
 
 int checkboard(void)
 {
@@ -243,7 +247,7 @@
 }
 
 #ifdef CONFIG_DEPRECATED
-int do_write_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_write_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int i, ret;
 	char mac_string[256];
diff --git a/board/renesas/sh7753evb/sh7753evb.c b/board/renesas/sh7753evb/sh7753evb.c
index 0b118b2..3b4a3ce 100644
--- a/board/renesas/sh7753evb/sh7753evb.c
+++ b/board/renesas/sh7753evb/sh7753evb.c
@@ -4,14 +4,18 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/mmc.h>
 #include <spi.h>
 #include <spi_flash.h>
+#include <linux/delay.h>
 
 int checkboard(void)
 {
@@ -259,7 +263,7 @@
 }
 
 #ifdef CONFIG_DEPRECATED
-int do_write_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_write_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int i, ret;
 	char mac_string[256];
diff --git a/board/renesas/sh7757lcr/sh7757lcr.c b/board/renesas/sh7757lcr/sh7757lcr.c
index e8d1fdd..5e76b9e 100644
--- a/board/renesas/sh7757lcr/sh7757lcr.c
+++ b/board/renesas/sh7757lcr/sh7757lcr.c
@@ -4,9 +4,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/mmc.h>
@@ -342,7 +345,7 @@
 	return 0;
 }
 
-int do_sh_g200(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_sh_g200(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct gctrl_regs *gctrl = GCTRL_BASE;
 	unsigned long graofst;
@@ -361,7 +364,7 @@
 );
 
 #ifdef CONFIG_DEPRECATED
-int do_write_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_write_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int i, ret;
 	char mac_string[256];
diff --git a/board/renesas/sh7763rdp/sh7763rdp.c b/board/renesas/sh7763rdp/sh7763rdp.c
index 9bc2c55..73a53c1 100644
--- a/board/renesas/sh7763rdp/sh7763rdp.c
+++ b/board/renesas/sh7763rdp/sh7763rdp.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 
diff --git a/board/renesas/silk/silk.c b/board/renesas/silk/silk.c
index e7cbd75..171d06f 100644
--- a/board/renesas/silk/silk.c
+++ b/board/renesas/silk/silk.c
@@ -10,6 +10,7 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <hang.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm.h>
 #include <dm/platform_data/serial_sh.h>
@@ -17,6 +18,8 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/silk/silk_spl.c b/board/renesas/silk/silk_spl.c
index a2c397f..f10f84a 100644
--- a/board/renesas/silk/silk_spl.c
+++ b/board/renesas/silk/silk_spl.c
@@ -7,11 +7,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm/platform_data/serial_sh.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/stout/cpld.c b/board/renesas/stout/cpld.c
index e6c2051..b56ed17 100644
--- a/board/renesas/stout/cpld.c
+++ b/board/renesas/stout/cpld.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
@@ -124,7 +125,8 @@
 #endif
 }
 
-static int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	u32 addr, val;
 
diff --git a/board/renesas/stout/stout.c b/board/renesas/stout/stout.c
index 0a0ff5f..babcce9 100644
--- a/board/renesas/stout/stout.c
+++ b/board/renesas/stout/stout.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
@@ -18,6 +19,8 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/stout/stout_spl.c b/board/renesas/stout/stout_spl.c
index 8d01efc..57c1fab 100644
--- a/board/renesas/stout/stout_spl.c
+++ b/board/renesas/stout/stout_spl.c
@@ -7,11 +7,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dm/platform_data/serial_sh.h>
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/renesas/ulcb/cpld.c b/board/renesas/ulcb/cpld.c
index 5286756..a20a34a 100644
--- a/board/renesas/ulcb/cpld.c
+++ b/board/renesas/ulcb/cpld.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <dm.h>
@@ -82,7 +83,8 @@
 	dm_gpio_set_value(&priv->sstbz, 1);
 }
 
-static int do_cpld(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_cpld(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct udevice *dev;
 	u32 addr, val;
diff --git a/board/renesas/ulcb/ulcb.c b/board/renesas/ulcb/ulcb.c
index b91f940..07bc1ec 100644
--- a/board/renesas/ulcb/ulcb.c
+++ b/board/renesas/ulcb/ulcb.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <dm.h>
@@ -14,6 +16,7 @@
 #include <asm/processor.h>
 #include <asm/mach-types.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/gpio.h>
diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c b/board/rockchip/evb_rk3399/evb-rk3399.c
index b9049ab..abb7658 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch-rockchip/periph.h>
 #include <power/regulator.h>
 
diff --git a/board/rockchip/evb_rv1108/evb_rv1108.c b/board/rockchip/evb_rv1108/evb_rv1108.c
index 5d622c3..c579138 100644
--- a/board/rockchip/evb_rv1108/evb_rv1108.c
+++ b/board/rockchip/evb_rv1108/evb_rv1108.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/clock.h>
diff --git a/board/rockchip/kylin_rk3036/kylin_rk3036.c b/board/rockchip/kylin_rk3036/kylin_rk3036.c
index c5e28df..0ca91cd 100644
--- a/board/rockchip/kylin_rk3036/kylin_rk3036.c
+++ b/board/rockchip/kylin_rk3036/kylin_rk3036.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
 #include <init.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/uart.h>
diff --git a/board/rockchip/tinker_rk3288/tinker-rk3288.c b/board/rockchip/tinker_rk3288/tinker-rk3288.c
index 7af39e1..f85209c 100644
--- a/board/rockchip/tinker_rk3288/tinker-rk3288.c
+++ b/board/rockchip/tinker_rk3288/tinker-rk3288.c
@@ -9,6 +9,7 @@
 #include <env.h>
 #include <i2c_eeprom.h>
 #include <init.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/arch-rockchip/bootrom.h>
 #include <asm/io.h>
diff --git a/board/samsung/arndale/arndale.c b/board/samsung/arndale/arndale.c
index 9abad3f..7a8e57b 100644
--- a/board/samsung/arndale/arndale.c
+++ b/board/samsung/arndale/arndale.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <init.h>
+#include <log.h>
 #include <usb.h>
 #include <asm/gpio.h>
 #include <asm/arch/pinmux.h>
diff --git a/board/samsung/common/board.c b/board/samsung/common/board.c
index 390060e..029a0cc 100644
--- a/board/samsung/common/board.c
+++ b/board/samsung/common/board.c
@@ -6,10 +6,13 @@
 
 #include <common.h>
 #include <cros_ec.h>
+#include <env.h>
 #include <errno.h>
 #include <fdtdec.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <spi.h>
 #include <tmu.h>
 #include <netdev.h>
@@ -29,6 +32,7 @@
 #include <stdio_dev.h>
 #include <usb.h>
 #include <dwc3-uboot.h>
+#include <linux/delay.h>
 #include <samsung/misc.h>
 #include <dm/pinctrl.h>
 #include <dm.h>
diff --git a/board/samsung/common/exynos5-dt-types.c b/board/samsung/common/exynos5-dt-types.c
index 1413dc8..f1ecb7d 100644
--- a/board/samsung/common/exynos5-dt-types.c
+++ b/board/samsung/common/exynos5-dt-types.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/s2mps11.h>
diff --git a/board/samsung/common/exynos5-dt.c b/board/samsung/common/exynos5-dt.c
index eef46b0..69aa212 100644
--- a/board/samsung/common/exynos5-dt.c
+++ b/board/samsung/common/exynos5-dt.c
@@ -8,6 +8,7 @@
 #include <dwc3-uboot.h>
 #include <env.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <i2c.h>
diff --git a/board/samsung/common/misc.c b/board/samsung/common/misc.c
index 9117669..837463b 100644
--- a/board/samsung/common/misc.c
+++ b/board/samsung/common/misc.c
@@ -9,6 +9,7 @@
 #include <env.h>
 #include <lcd.h>
 #include <libtizen.h>
+#include <linux/delay.h>
 #include <samsung/misc.h>
 #include <errno.h>
 #include <version.h>
@@ -262,7 +263,7 @@
 	char *exit_option;
 	char *exit_reset = "reset";
 	char *exit_back = "back";
-	cmd_tbl_t *cmd;
+	struct cmd_tbl *cmd;
 	int cmd_result;
 	int leave;
 
diff --git a/board/samsung/goni/goni.c b/board/samsung/goni/goni.c
index 623e4ab..40a94d5 100644
--- a/board/samsung/goni/goni.c
+++ b/board/samsung/goni/goni.c
@@ -6,9 +6,12 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/arch/mmc.h>
 #include <dm.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <usb/dwc2_udc.h>
 #include <asm/arch/cpu.h>
diff --git a/board/samsung/odroid/odroid.c b/board/samsung/odroid/odroid.c
index 9aa97f0..7d7e722 100644
--- a/board/samsung/odroid/odroid.c
+++ b/board/samsung/odroid/odroid.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/power.h>
 #include <asm/arch/clock.h>
diff --git a/board/samsung/smdkc100/smdkc100.c b/board/samsung/smdkc100/smdkc100.c
index a80300b..fc2c2a9 100644
--- a/board/samsung/smdkc100/smdkc100.c
+++ b/board/samsung/smdkc100/smdkc100.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/sromc.h>
diff --git a/board/samsung/smdkv310/smdkv310.c b/board/samsung/smdkv310/smdkv310.c
index 05369d2..0a57736 100644
--- a/board/samsung/smdkv310/smdkv310.c
+++ b/board/samsung/smdkv310/smdkv310.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <netdev.h>
diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index ec85f70..2e80dbb 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <env.h>
 #include <lcd.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/cpu.h>
@@ -17,6 +18,7 @@
 #include <asm/arch/mipi_dsim.h>
 #include <asm/arch/watchdog.h>
 #include <asm/arch/power.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <usb/dwc2_udc.h>
 #include <power/max8997_pmic.h>
diff --git a/board/samsung/trats2/trats2.c b/board/samsung/trats2/trats2.c
index 84ff936..69e0ef1 100644
--- a/board/samsung/trats2/trats2.c
+++ b/board/samsung/trats2/trats2.c
@@ -7,10 +7,12 @@
 
 #include <common.h>
 #include <lcd.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/power.h>
 #include <asm/arch/mipi_dsim.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/max77686_pmic.h>
 #include <power/battery.h>
diff --git a/board/samsung/universal_c210/universal.c b/board/samsung/universal_c210/universal.c
index ed9c5b5..f50da6b 100644
--- a/board/samsung/universal_c210/universal.c
+++ b/board/samsung/universal_c210/universal.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <spi.h>
 #include <lcd.h>
 #include <asm/io.h>
@@ -15,6 +16,7 @@
 #include <asm/arch/pinmux.h>
 #include <asm/arch/watchdog.h>
 #include <ld9040.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <usb.h>
 #include <usb/dwc2_udc.h>
diff --git a/board/sandisk/sansa_fuze_plus/sfp.c b/board/sandisk/sansa_fuze_plus/sfp.c
index 663edda..04f8678 100644
--- a/board/sandisk/sansa_fuze_plus/sfp.c
+++ b/board/sandisk/sansa_fuze_plus/sfp.c
@@ -11,12 +11,15 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/iomux-mx23.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/sbc8349/pci.c b/board/sbc8349/pci.c
index b6435f3..26c4f24 100644
--- a/board/sbc8349/pci.c
+++ b/board/sbc8349/pci.c
@@ -15,6 +15,7 @@
 #include <pci.h>
 #include <i2c.h>
 #include <asm/fsl_i2c.h>
+#include <linux/delay.h>
 
 static struct pci_region pci1_regions[] = {
 	{
diff --git a/board/sbc8349/sbc8349.c b/board/sbc8349/sbc8349.c
index 9051392..1e3529f 100644
--- a/board/sbc8349/sbc8349.c
+++ b/board/sbc8349/sbc8349.c
@@ -9,8 +9,10 @@
 
 #include <common.h>
 #include <fdt_support.h>
+#include <init.h>
 #include <ioports.h>
 #include <mpc83xx.h>
+#include <asm/bitops.h>
 #include <asm/mpc8349_pci.h>
 #include <i2c.h>
 #include <spd_sdram.h>
@@ -18,6 +20,7 @@
 #if defined(CONFIG_OF_LIBFDT)
 #include <linux/libfdt.h>
 #endif
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/sbc8548/ddr.c b/board/sbc8548/ddr.c
index f7af1e3..61bc77c 100644
--- a/board/sbc8548/ddr.c
+++ b/board/sbc8548/ddr.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <linux/delay.h>
 
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/sbc8548/sbc8548.c b/board/sbc8548/sbc8548.c
index d246dce..24782c7 100644
--- a/board/sbc8548/sbc8548.c
+++ b/board/sbc8548/sbc8548.c
@@ -11,6 +11,8 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/immap_85xx.h>
@@ -21,6 +23,7 @@
 #include <netdev.h>
 #include <tsec.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
diff --git a/board/sbc8641d/sbc8641d.c b/board/sbc8641d/sbc8641d.c
index d053eae..3375cd6 100644
--- a/board/sbc8641d/sbc8641d.c
+++ b/board/sbc8641d/sbc8641d.c
@@ -14,12 +14,14 @@
 #include <common.h>
 #include <command.h>
 #include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/processor.h>
 #include <asm/immap_86xx.h>
 #include <asm/fsl_pci.h>
 #include <fsl_ddr_sdram.h>
 #include <asm/fsl_serdes.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
@@ -49,7 +51,7 @@
 	dram_size = fixed_sdram ();
 #endif
 
-	debug ("    DDR: ");
+	debug("    DDR: ");
 	gd->ram_size = dram_size;
 
 	return 0;
@@ -122,12 +124,12 @@
 
 	asm ("sync;isync");
 
-	udelay (500);
+	udelay(500);
 
 	ddr->sdram_cfg = CONFIG_SYS_DDR_CFG_1B;
 	asm ("sync; isync");
 
-	udelay (500);
+	udelay(500);
 	ddr = &immap->im_ddr2;
 
 	ddr->cs0_bnds = CONFIG_SYS_DDR2_CS0_BNDS;
@@ -153,12 +155,12 @@
 
 	asm ("sync;isync");
 
-	udelay (500);
+	udelay(500);
 
 	ddr->sdram_cfg = CONFIG_SYS_DDR2_CFG_1B;
 	asm ("sync; isync");
 
-	udelay (500);
+	udelay(500);
 #endif
 	return CONFIG_SYS_SDRAM_SIZE * 1024 * 1024;
 }
diff --git a/board/schulercontrol/sc_sps_1/sc_sps_1.c b/board/schulercontrol/sc_sps_1/sc_sps_1.c
index 41090dd..d2c5f80 100644
--- a/board/schulercontrol/sc_sps_1/sc_sps_1.c
+++ b/board/schulercontrol/sc_sps_1/sc_sps_1.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
diff --git a/board/seco/mx6quq7/mx6quq7.c b/board/seco/mx6quq7/mx6quq7.c
index fabc348..4fa0dab 100644
--- a/board/seco/mx6quq7/mx6quq7.c
+++ b/board/seco/mx6quq7/mx6quq7.c
@@ -8,10 +8,12 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/seeed/linkit-smart-7688/board.c b/board/seeed/linkit-smart-7688/board.c
index d3d3d50..bf7c69e 100644
--- a/board/seeed/linkit-smart-7688/board.c
+++ b/board/seeed/linkit-smart-7688/board.c
@@ -4,7 +4,9 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define MT76XX_GPIO1_MODE	0x10000060
 
diff --git a/board/siemens/capricorn/board.c b/board/siemens/capricorn/board.c
index 00fd4b9..c46e4ff 100644
--- a/board/siemens/capricorn/board.c
+++ b/board/siemens/capricorn/board.c
@@ -6,8 +6,12 @@
  *
  */
 #include <common.h>
+#include <command.h>
 #include <dm.h>
+#include <env.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <netdev.h>
 #include <env_internal.h>
 #include <fsl_esdhc_imx.h>
@@ -23,6 +27,7 @@
 #ifndef CONFIG_SPL
 #include <asm/arch-imx8/clock.h>
 #endif
+#include <linux/delay.h>
 #include "../common/factoryset.h"
 
 #define GPIO_PAD_CTRL \
@@ -410,7 +415,7 @@
  *		0 if button is not held down
  */
 static int
-do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_userbutton(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int button = 0;
 
@@ -431,7 +436,7 @@
 #define ERST	IMX_GPIO_NR(0, 3)
 
 static int
-do_eth_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_eth_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	gpio_request(ERST, "ERST");
 	gpio_direction_output(ERST, 0);
diff --git a/board/siemens/capricorn/spl.c b/board/siemens/capricorn/spl.c
index 47fe86c..8435bd3 100644
--- a/board/siemens/capricorn/spl.c
+++ b/board/siemens/capricorn/spl.c
@@ -6,6 +6,7 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <dm.h>
 #include <dm/uclass.h>
diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c
index 24429d2..e0bd859 100644
--- a/board/siemens/common/board.c
+++ b/board/siemens/common/board.c
@@ -10,8 +10,10 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <errno.h>
+#include <init.h>
 #include <malloc.h>
 #include <serial.h>
 #include <spl.h>
@@ -150,7 +152,7 @@
  *		0 if button is not held down
  */
 static int
-do_userbutton(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_userbutton(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int button = 0;
 	button = get_button_state("button_dfu0", BOARD_DFU_BUTTON_GPIO);
@@ -166,7 +168,7 @@
 #endif
 
 static int
-do_usertestwdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_usertestwdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	printf("\n\n\n Go into infinite loop\n\n\n");
 	while (1)
@@ -250,8 +252,8 @@
 	} /* loop through defined led in environment */
 }
 
-static int do_board_led(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char *const argv[])
+static int do_board_led(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	if (argc != 2)
 		return CMD_RET_USAGE;
diff --git a/board/siemens/common/factoryset.c b/board/siemens/common/factoryset.c
index 0d3701c..2e3ae1a 100644
--- a/board/siemens/common/factoryset.c
+++ b/board/siemens/common/factoryset.c
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <env_internal.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/io.h>
 #if !CONFIG_IS_ENABLED(TARGET_GIEDI) && !CONFIG_IS_ENABLED(TARGET_DENEB)
 #include <asm/arch/cpu.h>
diff --git a/board/siemens/corvus/board.c b/board/siemens/corvus/board.c
index 0376820..28a974d 100644
--- a/board/siemens/corvus/board.c
+++ b/board/siemens/corvus/board.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9g45_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
diff --git a/board/siemens/draco/board.c b/board/siemens/draco/board.c
index 94bd71a..5ac73c0 100644
--- a/board/siemens/draco/board.c
+++ b/board/siemens/draco/board.c
@@ -13,9 +13,11 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <net.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
@@ -33,6 +35,7 @@
 #include <miiphy.h>
 #include <cpsw.h>
 #include <watchdog.h>
+#include <linux/delay.h>
 #include "board.h"
 #include "../common/factoryset.h"
 #include <nand.h>
@@ -342,8 +345,8 @@
 	return n;
 }
 
-static int do_switch_reset(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char *const argv[])
+static int do_switch_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	/* Reset SMSC LAN9303 switch for default configuration */
 	gpio_request(GPIO_LAN9303_NRST, "nRST");
diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c
index 58bb5ba..d86a913 100644
--- a/board/siemens/pxm2/board.c
+++ b/board/siemens/pxm2/board.c
@@ -16,7 +16,9 @@
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
+#include <net.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c
index bd4eaa4..3b109e9 100644
--- a/board/siemens/rut/board.c
+++ b/board/siemens/rut/board.c
@@ -15,6 +15,7 @@
 #include <errno.h>
 #include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <spi.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
@@ -33,6 +34,7 @@
 #include <cpsw.h>
 #include <video.h>
 #include <watchdog.h>
+#include <linux/delay.h>
 #include "board.h"
 #include "../common/factoryset.h"
 #include "../../../drivers/video/da8xx-fb.h"
diff --git a/board/siemens/smartweb/smartweb.c b/board/siemens/smartweb/smartweb.c
index cb7206a..40c9c7e 100644
--- a/board/siemens/smartweb/smartweb.c
+++ b/board/siemens/smartweb/smartweb.c
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9_sdramc.h>
 #include <asm/arch/at91sam9260_matrix.h>
diff --git a/board/siemens/taurus/taurus.c b/board/siemens/taurus/taurus.c
index 0979df5..927ef59 100644
--- a/board/siemens/taurus/taurus.c
+++ b/board/siemens/taurus/taurus.c
@@ -15,6 +15,7 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <flash.h>
 #include <init.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9260_matrix.h>
@@ -385,8 +386,8 @@
 	return 0;
 }
 
-static int do_upgrade_available(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_upgrade_available(struct cmd_tbl *cmdtp, int flag, int argc,
+				char *const argv[])
 {
 	unsigned long upgrade_available = 0;
 	unsigned long boot_retry = 0;
diff --git a/board/sifive/fu540/fu540.c b/board/sifive/fu540/fu540.c
index 47a2090..df57b6e 100644
--- a/board/sifive/fu540/fu540.c
+++ b/board/sifive/fu540/fu540.c
@@ -8,6 +8,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <linux/bug.h>
 #include <linux/delay.h>
 #include <linux/io.h>
 
diff --git a/board/silica/pengwyn/board.c b/board/silica/pengwyn/board.c
index c0496c5..e3c9d9e 100644
--- a/board/silica/pengwyn/board.c
+++ b/board/silica/pengwyn/board.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <serial.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
diff --git a/board/sks-kinkel/sksimx6/sksimx6.c b/board/sks-kinkel/sksimx6/sksimx6.c
index 59a07a9..772c179 100644
--- a/board/sks-kinkel/sksimx6/sksimx6.c
+++ b/board/sks-kinkel/sksimx6/sksimx6.c
@@ -3,10 +3,15 @@
  * Copyright (C) 2016 Stefano Babic <sbabic@denx.de>
  */
 
+#include <common.h>
+#include <command.h>
+#include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/socrates/sdram.c b/board/socrates/sdram.c
index 8eb4f8f..d358a20 100644
--- a/board/socrates/sdram.c
+++ b/board/socrates/sdram.c
@@ -12,6 +12,7 @@
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <spd_sdram.h>
+#include <linux/delay.h>
 
 
 #if !defined(CONFIG_SPD_EEPROM)
diff --git a/board/socrates/socrates.c b/board/socrates/socrates.c
index b0ddee7..58c5f75 100644
--- a/board/socrates/socrates.c
+++ b/board/socrates/socrates.c
@@ -13,11 +13,14 @@
 #include <common.h>
 #include <clock_legacy.h>
 #include <env.h>
+#include <init.h>
 #include <pci.h>
+#include <uuid.h>
 #include <asm/processor.h>
 #include <asm/immap_85xx.h>
 #include <ioports.h>
 #include <flash.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 #include <asm/io.h>
@@ -105,25 +108,26 @@
 		/*
 		 * Re-do flash protection upon new addresses
 		 */
-		flash_protect (FLAG_PROTECT_CLEAR,
-			       gd->bd->bi_flashstart, 0xffffffff,
-			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
+		flash_protect(FLAG_PROTECT_CLEAR,
+			      gd->bd->bi_flashstart, 0xffffffff,
+			      &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 
 		/* Monitor protection ON by default */
-		flash_protect (FLAG_PROTECT_SET,
-			       CONFIG_SYS_MONITOR_BASE, CONFIG_SYS_MONITOR_BASE + monitor_flash_len - 1,
-			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
+		flash_protect(FLAG_PROTECT_SET,
+			      CONFIG_SYS_MONITOR_BASE, CONFIG_SYS_MONITOR_BASE +
+			      monitor_flash_len - 1,
+			      &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 
 		/* Environment protection ON by default */
-		flash_protect (FLAG_PROTECT_SET,
-			       CONFIG_ENV_ADDR,
-			       CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1,
-			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
+		flash_protect(FLAG_PROTECT_SET,
+			      CONFIG_ENV_ADDR,
+			      CONFIG_ENV_ADDR + CONFIG_ENV_SECT_SIZE - 1,
+			      &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 
 		/* Redundant environment protection ON by default */
-		flash_protect (FLAG_PROTECT_SET,
-			       CONFIG_ENV_ADDR_REDUND,
-			       CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
+		flash_protect(FLAG_PROTECT_SET,
+			      CONFIG_ENV_ADDR_REDUND,
+			      CONFIG_ENV_ADDR_REDUND + CONFIG_ENV_SECT_SIZE - 1,
 			       &flash_info[CONFIG_SYS_MAX_FLASH_BANKS - 1]);
 	}
 
diff --git a/board/softing/vining_2000/vining_2000.c b/board/softing/vining_2000/vining_2000.c
index c74c06e..e5e33dc 100644
--- a/board/softing/vining_2000/vining_2000.c
+++ b/board/softing/vining_2000/vining_2000.c
@@ -7,6 +7,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
@@ -18,6 +19,8 @@
 #include <asm/io.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <env.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <fsl_esdhc_imx.h>
diff --git a/board/softing/vining_fpga/socfpga.c b/board/softing/vining_fpga/socfpga.c
index 5a88b6c..7e311b7 100644
--- a/board/softing/vining_fpga/socfpga.c
+++ b/board/softing/vining_fpga/socfpga.c
@@ -7,11 +7,13 @@
 #include <eeprom.h>
 #include <env.h>
 #include <init.h>
+#include <net.h>
 #include <status_led.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <i2c.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/solidrun/clearfog/clearfog.c b/board/solidrun/clearfog/clearfog.c
index 443751b..4184754 100644
--- a/board/solidrun/clearfog/clearfog.c
+++ b/board/solidrun/clearfog/clearfog.c
@@ -4,12 +4,17 @@
  */
 
 #include <common.h>
+#include <env.h>
 #include <i2c.h>
+#include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "../common/tlv_data.h"
 
 #include "../drivers/ddr/marvell/a38x/ddr3_init.h"
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 6a96f9e..94707bc 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -13,13 +13,18 @@
  * Ported to SolidRun microSOM by Rabeeh Khoury <rabeeh@solid-run.com>
  */
 
+#include <common.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/mxc_hdmi.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/spear/spear300/spear300.c b/board/spear/spear300/spear300.c
index 83fdf02..c531eb3 100644
--- a/board/spear/spear300/spear300.c
+++ b/board/spear/spear300/spear300.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <nand.h>
 #include <asm/io.h>
diff --git a/board/spear/spear310/spear310.c b/board/spear/spear310/spear310.c
index 1b3478a..6e88547 100644
--- a/board/spear/spear310/spear310.c
+++ b/board/spear/spear310/spear310.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <nand.h>
 #include <asm/io.h>
diff --git a/board/spear/spear320/spear320.c b/board/spear/spear320/spear320.c
index 640242e..d8b1e7d 100644
--- a/board/spear/spear320/spear320.c
+++ b/board/spear/spear320/spear320.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <nand.h>
 #include <asm/io.h>
diff --git a/board/spear/spear600/spear600.c b/board/spear/spear600/spear600.c
index 91c2691..241f123 100644
--- a/board/spear/spear600/spear600.c
+++ b/board/spear/spear600/spear600.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <miiphy.h>
+#include <net.h>
 #include <netdev.h>
 #include <nand.h>
 #include <asm/io.h>
diff --git a/board/spear/x600/fpga.c b/board/spear/x600/fpga.c
index d124d96..5140694 100644
--- a/board/spear/x600/fpga.c
+++ b/board/spear/x600/fpga.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <spartan3.h>
 #include <command.h>
 #include <asm/gpio.h>
@@ -11,6 +12,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_misc.h>
 #include <asm/arch/spr_ssp.h>
+#include <linux/delay.h>
 
 /*
  * FPGA program pin configuration on X600:
diff --git a/board/spear/x600/x600.c b/board/spear/x600/x600.c
index e1232ed..e6f8dc9 100644
--- a/board/spear/x600/x600.c
+++ b/board/spear/x600/x600.c
@@ -7,9 +7,11 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <init.h>
 #include <micrel.h>
 #include <nand.h>
+#include <net.h>
 #include <netdev.h>
 #include <phy.h>
 #include <rtc.h>
diff --git a/board/sr1500/socfpga.c b/board/sr1500/socfpga.c
index c9e32e3..d9125a7 100644
--- a/board/sr1500/socfpga.c
+++ b/board/sr1500/socfpga.c
@@ -4,9 +4,11 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 int board_early_init_f(void)
 {
diff --git a/board/st/common/cmd_stboard.c b/board/st/common/cmd_stboard.c
index 915164a..e103861 100644
--- a/board/st/common/cmd_stboard.c
+++ b/board/st/common/cmd_stboard.c
@@ -31,6 +31,7 @@
 
 #ifndef CONFIG_SPL_BUILD
 #include <common.h>
+#include <command.h>
 #include <console.h>
 #include <misc.h>
 #include <dm/device.h>
@@ -67,8 +68,8 @@
 	       otp & 0xF);
 }
 
-static int do_stboard(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_stboard(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int ret;
 	u32 otp, lock;
diff --git a/board/st/common/stm32mp_dfu.c b/board/st/common/stm32mp_dfu.c
index 3bd005b..0cda919 100644
--- a/board/st/common/stm32mp_dfu.c
+++ b/board/st/common/stm32mp_dfu.c
@@ -17,7 +17,7 @@
 
 static void board_get_alt_info_mmc(struct udevice *dev, char *buf)
 {
-	disk_partition_t info;
+	struct disk_partition info;
 	int p, len, devnum;
 	bool first = true;
 	const char *name;
diff --git a/board/st/stih410-b2260/board.c b/board/st/stih410-b2260/board.c
index 5d9fdf2..b1147f2 100644
--- a/board/st/stih410-b2260/board.c
+++ b/board/st/stih410-b2260/board.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
+#include <asm/cache.h>
 #include <linux/usb/otg.h>
 #include <dwc3-sti-glue.h>
 #include <dwc3-uboot.h>
diff --git a/board/st/stm32f429-discovery/stm32f429-discovery.c b/board/st/stm32f429-discovery/stm32f429-discovery.c
index 500dc5f..ee6a90c 100644
--- a/board/st/stm32f429-discovery/stm32f429-discovery.c
+++ b/board/st/stm32f429-discovery/stm32f429-discovery.c
@@ -12,6 +12,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <log.h>
 
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
diff --git a/board/st/stm32f429-evaluation/stm32f429-evaluation.c b/board/st/stm32f429-evaluation/stm32f429-evaluation.c
index 8ab2fa5..92e3d40 100644
--- a/board/st/stm32f429-evaluation/stm32f429-evaluation.c
+++ b/board/st/stm32f429-evaluation/stm32f429-evaluation.c
@@ -6,6 +6,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <log.h>
 
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
diff --git a/board/st/stm32f469-discovery/stm32f469-discovery.c b/board/st/stm32f469-discovery/stm32f469-discovery.c
index 70d23d9..85988ac 100644
--- a/board/st/stm32f469-discovery/stm32f469-discovery.c
+++ b/board/st/stm32f469-discovery/stm32f469-discovery.c
@@ -6,6 +6,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <log.h>
 
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
diff --git a/board/st/stm32f746-disco/stm32f746-disco.c b/board/st/stm32f746-disco/stm32f746-disco.c
index df90742..0f728fd 100644
--- a/board/st/stm32f746-disco/stm32f746-disco.c
+++ b/board/st/stm32f746-disco/stm32f746-disco.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <init.h>
 #include <lcd.h>
+#include <log.h>
 #include <miiphy.h>
 #include <phy_interface.h>
 #include <ram.h>
@@ -22,6 +23,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/syscfg.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/st/stm32h743-disco/stm32h743-disco.c b/board/st/stm32h743-disco/stm32h743-disco.c
index 6aab2e2..0484c3c 100644
--- a/board/st/stm32h743-disco/stm32h743-disco.c
+++ b/board/st/stm32h743-disco/stm32h743-disco.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/st/stm32h743-eval/stm32h743-eval.c b/board/st/stm32h743-eval/stm32h743-eval.c
index 6aab2e2..0484c3c 100644
--- a/board/st/stm32h743-eval/stm32h743-eval.c
+++ b/board/st/stm32h743-eval/stm32h743-eval.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/st/stm32mp1/board.c b/board/st/stm32mp1/board.c
index 4e35d36..c218d37 100644
--- a/board/st/stm32mp1/board.c
+++ b/board/st/stm32mp1/board.c
@@ -7,6 +7,8 @@
 #include <dm.h>
 #include <asm/io.h>
 #include <asm/arch/ddr.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/stpmic1.h>
 
diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c
index 33cb7f6..4553329 100644
--- a/board/st/stm32mp1/stm32mp1.c
+++ b/board/st/stm32mp1/stm32mp1.c
@@ -10,15 +10,18 @@
 #include <dm.h>
 #include <env.h>
 #include <env_internal.h>
+#include <fdt_support.h>
 #include <g_dnl.h>
 #include <generic-phy.h>
 #include <hang.h>
 #include <i2c.h>
 #include <init.h>
 #include <led.h>
+#include <log.h>
 #include <malloc.h>
 #include <misc.h>
 #include <mtd_node.h>
+#include <net.h>
 #include <netdev.h>
 #include <phy.h>
 #include <remoteproc.h>
@@ -31,6 +34,8 @@
 #include <asm/arch/stm32.h>
 #include <asm/arch/sys_proto.h>
 #include <jffs2/load_kernel.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/iopoll.h>
 #include <power/regulator.h>
diff --git a/board/st/stv0991/stv0991.c b/board/st/stv0991/stv0991.c
index 33b29e6..d5a9f13 100644
--- a/board/st/stv0991/stv0991.c
+++ b/board/st/stv0991/stv0991.c
@@ -5,8 +5,11 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
+#include <init.h>
 #include <miiphy.h>
+#include <net.h>
 #include <asm/arch/stv0991_periph.h>
 #include <asm/arch/stv0991_defs.h>
 #include <asm/arch/hardware.h>
diff --git a/board/ste/stemmy/stemmy.c b/board/ste/stemmy/stemmy.c
index 8cf6f18..f7834c0 100644
--- a/board/ste/stemmy/stemmy.c
+++ b/board/ste/stemmy/stemmy.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2019 Stephan Gerhold <stephan@gerhold.net>
  */
 #include <common.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 6afea6e..f32e8f5 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -14,7 +14,9 @@
 #include <dm.h>
 #include <env.h>
 #include <hang.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
 #include <mmc.h>
 #include <axp_pmic.h>
 #include <generic-phy.h>
@@ -26,6 +28,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/spl.h>
+#include <linux/delay.h>
 #include <u-boot/crc.h>
 #ifndef CONFIG_ARM64
 #include <asm/armv7.h>
diff --git a/board/sunxi/dram_sun4i_auto.c b/board/sunxi/dram_sun4i_auto.c
index 7d4409b..e8bbee4 100644
--- a/board/sunxi/dram_sun4i_auto.c
+++ b/board/sunxi/dram_sun4i_auto.c
@@ -1,4 +1,5 @@
 #include <common.h>
+#include <init.h>
 #include <asm/arch/dram.h>
 
 static struct dram_para dram_para = {
diff --git a/board/sunxi/dram_sun5i_auto.c b/board/sunxi/dram_sun5i_auto.c
index e3fa243..a5f4f8b 100644
--- a/board/sunxi/dram_sun5i_auto.c
+++ b/board/sunxi/dram_sun5i_auto.c
@@ -1,6 +1,7 @@
 /* DRAM parameters for auto dram configuration on sun5i and sun7i */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/dram.h>
 
 static struct dram_para dram_para = {
diff --git a/board/synopsys/axs10x/axs10x.c b/board/synopsys/axs10x/axs10x.c
index fa982bd..b4a1d4c 100644
--- a/board/synopsys/axs10x/axs10x.c
+++ b/board/synopsys/axs10x/axs10x.c
@@ -6,9 +6,11 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dwmmc.h>
+#include <init.h>
 #include <malloc.h>
 #include <asm/arcregs.h>
 #include "axs10x.h"
+#include <asm/cache.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/synopsys/emsdp/emsdp.c b/board/synopsys/emsdp/emsdp.c
index c09ed8c..91fa94a 100644
--- a/board/synopsys/emsdp/emsdp.c
+++ b/board/synopsys/emsdp/emsdp.c
@@ -4,9 +4,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <dwmmc.h>
+#include <init.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 
 #include <asm/arcregs.h>
 
@@ -101,7 +104,8 @@
 		; /* loop forever till reset */
 }
 
-static int do_emsdp_rom(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_emsdp_rom(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	u32 creg_boot = readl(CREG_BOOT);
 
@@ -117,13 +121,14 @@
 	return CMD_RET_SUCCESS;
 }
 
-cmd_tbl_t cmd_emsdp[] = {
+struct cmd_tbl cmd_emsdp[] = {
 	U_BOOT_CMD_MKENT(rom, 2, 0, do_emsdp_rom, "", ""),
 };
 
-static int do_emsdp(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_emsdp(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	c = find_cmd_tbl(argv[1], cmd_emsdp, ARRAY_SIZE(cmd_emsdp));
 
diff --git a/board/synopsys/hsdk/clk-lib.c b/board/synopsys/hsdk/clk-lib.c
index 6b6bb70..1c74bfb 100644
--- a/board/synopsys/hsdk/clk-lib.c
+++ b/board/synopsys/hsdk/clk-lib.c
@@ -5,6 +5,7 @@
  */
 
 #include <clk.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device.h>
 
diff --git a/board/synopsys/hsdk/clk-lib.h b/board/synopsys/hsdk/clk-lib.h
index c1c105a..970bcd4 100644
--- a/board/synopsys/hsdk/clk-lib.h
+++ b/board/synopsys/hsdk/clk-lib.h
@@ -8,6 +8,7 @@
 #define __BOARD_CLK_LIB_H
 
 #include <common.h>
+#include <linux/bitops.h>
 
 enum clk_ctl_ops {
 	CLK_SET		= BIT(0), /* set frequency */
diff --git a/board/synopsys/hsdk/env-lib.c b/board/synopsys/hsdk/env-lib.c
index f443c21..235f295 100644
--- a/board/synopsys/hsdk/env-lib.c
+++ b/board/synopsys/hsdk/env-lib.c
@@ -6,6 +6,7 @@
 
 #include "env-lib.h"
 #include <env.h>
+#include <log.h>
 
 #define MAX_CMD_LEN	25
 
diff --git a/board/synopsys/hsdk/hsdk.c b/board/synopsys/hsdk/hsdk.c
index 8ccd84c..cd11f9d 100644
--- a/board/synopsys/hsdk/hsdk.c
+++ b/board/synopsys/hsdk/hsdk.c
@@ -5,11 +5,17 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <config.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <image.h>
 #include <init.h>
 #include <irq_func.h>
+#include <log.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/printk.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
@@ -929,7 +935,8 @@
 	return hsdk_go_run(reg);
 }
 
-static int do_hsdk_go(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_hsdk_go(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int ret;
 
@@ -994,7 +1001,8 @@
 	writel(~INIT_MARKER_PENDING, INIT_MARKER_REGISTER);
 }
 
-static int do_hsdk_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_hsdk_init(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	int ret;
 
@@ -1022,7 +1030,7 @@
 	"- Init HSDK HW\n"
 );
 
-static int do_hsdk_clock_set(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_hsdk_clock_set(struct cmd_tbl *cmdtp, int flag, int argc,
 			     char *const argv[])
 {
 	int ret = 0;
@@ -1054,7 +1062,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_hsdk_clock_get(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_hsdk_clock_get(struct cmd_tbl *cmdtp, int flag, int argc,
 			     char *const argv[])
 {
 	ulong rate;
@@ -1082,7 +1090,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_hsdk_clock_print(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_hsdk_clock_print(struct cmd_tbl *cmdtp, int flag, int argc,
 			       char *const argv[])
 {
 	/* Main clocks */
@@ -1094,7 +1102,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_hsdk_clock_print_all(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_hsdk_clock_print_all(struct cmd_tbl *cmdtp, int flag, int argc,
 				   char *const argv[])
 {
 	/*
@@ -1155,16 +1163,17 @@
 	return CMD_RET_SUCCESS;
 }
 
-cmd_tbl_t cmd_hsdk_clock[] = {
+struct cmd_tbl cmd_hsdk_clock[] = {
 	U_BOOT_CMD_MKENT(set, 3, 0, do_hsdk_clock_set, "", ""),
 	U_BOOT_CMD_MKENT(get, 3, 0, do_hsdk_clock_get, "", ""),
 	U_BOOT_CMD_MKENT(print, 4, 0, do_hsdk_clock_print, "", ""),
 	U_BOOT_CMD_MKENT(print_all, 4, 0, do_hsdk_clock_print_all, "", ""),
 };
 
-static int do_hsdk_clock(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_hsdk_clock(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/board/synopsys/iot_devkit/iot_devkit.c b/board/synopsys/iot_devkit/iot_devkit.c
index 36aa8f6..497ea18 100644
--- a/board/synopsys/iot_devkit/iot_devkit.c
+++ b/board/synopsys/iot_devkit/iot_devkit.c
@@ -5,8 +5,10 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <malloc.h>
 #include <dwmmc.h>
+#include <linux/bitops.h>
 #include <linux/libfdt.h>
 #include <fdtdec.h>
 
diff --git a/board/synopsys/nsim/nsim.c b/board/synopsys/nsim/nsim.c
index f384f70..00e5cc3 100644
--- a/board/synopsys/nsim/nsim.c
+++ b/board/synopsys/nsim/nsim.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <dm/device.h>
 #include <virtio_types.h>
 #include <virtio.h>
diff --git a/board/syteco/zmx25/zmx25.c b/board/syteco/zmx25/zmx25.c
index 715e20d..d5393d7 100644
--- a/board/syteco/zmx25/zmx25.c
+++ b/board/syteco/zmx25/zmx25.c
@@ -15,11 +15,13 @@
  */
 #include <common.h>
 #include <cpu_func.h>
+#include <env.h>
 #include <init.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx25.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/tbs/tbs2910/tbs2910.c b/board/tbs/tbs2910/tbs2910.c
index b4fd183..d32517f 100644
--- a/board/tbs/tbs2910/tbs2910.c
+++ b/board/tbs/tbs2910/tbs2910.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2014 Soeren Moch <smoch@web.de>
  */
 
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
diff --git a/board/tcl/sl50/board.c b/board/tcl/sl50/board.c
index 7537fa2..afa6290 100644
--- a/board/tcl/sl50/board.c
+++ b/board/tcl/sl50/board.c
@@ -11,6 +11,7 @@
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <net.h>
 #include <serial.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
diff --git a/board/technexion/pico-imx6/pico-imx6.c b/board/technexion/pico-imx6/pico-imx6.c
index f8eeb40..b5a02eb 100644
--- a/board/technexion/pico-imx6/pico-imx6.c
+++ b/board/technexion/pico-imx6/pico-imx6.c
@@ -6,6 +6,9 @@
  * Author: Fabio Estevam <festevam@gmail.com>
  */
 
+#include <env.h>
+#include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
@@ -17,6 +20,7 @@
 #include <asm/mach-imx/video.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <miiphy.h>
diff --git a/board/technexion/pico-imx6/spl.c b/board/technexion/pico-imx6/spl.c
index 06ad0a8..f9ae096 100644
--- a/board/technexion/pico-imx6/spl.c
+++ b/board/technexion/pico-imx6/spl.c
@@ -6,10 +6,14 @@
  *	   Fabio Estevam <festevam@gmail.com>
  */
 
+#include <common.h>
+#include <image.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/technexion/pico-imx6ul/pico-imx6ul.c b/board/technexion/pico-imx6ul/pico-imx6ul.c
index e27a03c..1d24096 100644
--- a/board/technexion/pico-imx6ul/pico-imx6ul.c
+++ b/board/technexion/pico-imx6ul/pico-imx6ul.c
@@ -5,6 +5,8 @@
  * Author: Richard Hu <richard.hu@technexion.com>
  */
 
+#include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/imx-regs.h>
@@ -17,6 +19,7 @@
 #include <common.h>
 #include <miiphy.h>
 #include <netdev.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <usb.h>
 #include <power/pmic.h>
diff --git a/board/technexion/pico-imx7d/pico-imx7d.c b/board/technexion/pico-imx7d/pico-imx7d.c
index b7ca2e1..a6fd49d 100644
--- a/board/technexion/pico-imx7d/pico-imx7d.c
+++ b/board/technexion/pico-imx7d/pico-imx7d.c
@@ -4,6 +4,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/imx-regs.h>
diff --git a/board/technexion/pico-imx7d/spl.c b/board/technexion/pico-imx7d/spl.c
index 6c432ca..a651a00 100644
--- a/board/technexion/pico-imx7d/spl.c
+++ b/board/technexion/pico-imx7d/spl.c
@@ -5,7 +5,9 @@
  * Author: Richard Hu <richard.hu@technexion.com>
  */
 
+#include <common.h>
 #include <cpu_func.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/technexion/pico-imx8mq/pico-imx8mq.c b/board/technexion/pico-imx8mq/pico-imx8mq.c
index 822357b..2a3e6e7 100644
--- a/board/technexion/pico-imx8mq/pico-imx8mq.c
+++ b/board/technexion/pico-imx8mq/pico-imx8mq.c
@@ -20,6 +20,7 @@
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/arch/clock.h>
+#include <linux/delay.h>
 #include <spl.h>
 #include <power/pmic.h>
 
diff --git a/board/technexion/pico-imx8mq/spl.c b/board/technexion/pico-imx8mq/spl.c
index 1588f17..1677e03 100644
--- a/board/technexion/pico-imx8mq/spl.c
+++ b/board/technexion/pico-imx8mq/spl.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/ddr.h>
 #include <asm/arch/imx8mq_pins.h>
@@ -13,6 +15,7 @@
 #include <asm/mach-imx/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/mxc_i2c.h>
+#include <linux/delay.h>
 #include <errno.h>
 #include <fsl_esdhc_imx.h>
 #include <mmc.h>
diff --git a/board/technexion/tao3530/tao3530.c b/board/technexion/tao3530/tao3530.c
index 7d7c427..8ce3637 100644
--- a/board/technexion/tao3530/tao3530.c
+++ b/board/technexion/tao3530/tao3530.c
@@ -4,6 +4,8 @@
  *      Tapani Utriainen <linuxfae@technexion.com>
  */
 #include <common.h>
+#include <bootstage.h>
+#include <init.h>
 #include <malloc.h>
 #include <netdev.h>
 #include <twl4030.h>
diff --git a/board/technologic/ts4600/ts4600.c b/board/technologic/ts4600/ts4600.c
index f9cc2e8..54508cd 100644
--- a/board/technologic/ts4600/ts4600.c
+++ b/board/technologic/ts4600/ts4600.c
@@ -14,12 +14,14 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx28.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <miiphy.h>
 #include <netdev.h>
diff --git a/board/technologic/ts4800/ts4800.c b/board/technologic/ts4800/ts4800.c
index ff1a189..28918de 100644
--- a/board/technologic/ts4800/ts4800.c
+++ b/board/technologic/ts4800/ts4800.c
@@ -8,11 +8,14 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux-mx51.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/theadorable/fpga.c b/board/theadorable/fpga.c
index 4f8bf5e..bc8379c 100644
--- a/board/theadorable/fpga.c
+++ b/board/theadorable/fpga.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <altera.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/board/theadorable/theadorable.c b/board/theadorable/theadorable.c
index 621e269..53ef991 100644
--- a/board/theadorable/theadorable.c
+++ b/board/theadorable/theadorable.c
@@ -4,9 +4,11 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <console.h>
 #include <i2c.h>
 #include <init.h>
+#include <net.h>
 #include <pci.h>
 #if !defined(CONFIG_SPL_BUILD)
 #include <bootcount.h>
@@ -15,6 +17,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 #include <linux/mbus.h>
 #ifdef CONFIG_NET
 #include <netdev.h>
@@ -308,7 +311,7 @@
 #endif
 
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_PCI)
-int do_pcie_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_pcie_test(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pci_dev_t bdf;
 	u16 ven_id, dev_id;
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 7ff4766..561579d 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <log.h>
 #include <misc.h>
 #include <spl.h>
 #include <syscon.h>
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index 01b28e8..4199bee 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -11,8 +11,10 @@
 #include <dm.h>
 #include <env.h>
 #include <errno.h>
+#include <image.h>
 #include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <spl.h>
 #include <serial.h>
 #include <asm/arch/cpu.h>
@@ -34,6 +36,8 @@
 #include <i2c.h>
 #include <miiphy.h>
 #include <cpsw.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <power/tps65217.h>
 #include <power/tps65910.h>
 #include <env_internal.h>
diff --git a/board/ti/am3517crane/am3517crane.c b/board/ti/am3517crane/am3517crane.c
index 5d4e57f..888aa5b 100644
--- a/board/ti/am3517crane/am3517crane.c
+++ b/board/ti/am3517crane/am3517crane.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/mem.h>
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index 21fc5ed..923b224 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -9,11 +9,13 @@
 
 #include <common.h>
 #include <eeprom.h>
+#include <image.h>
 #include <dm/uclass.h>
 #include <env.h>
 #include <fdt_support.h>
 #include <i2c.h>
 #include <init.h>
+#include <net.h>
 #include <linux/errno.h>
 #include <spl.h>
 #include <usb.h>
diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c
index 34ca3ec..8720eb8 100644
--- a/board/ti/am57xx/board.c
+++ b/board/ti/am57xx/board.c
@@ -10,8 +10,10 @@
 #include <common.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
 #include <init.h>
 #include <malloc.h>
+#include <net.h>
 #include <palmas.h>
 #include <sata.h>
 #include <serial.h>
diff --git a/board/ti/am65x/evm.c b/board/ti/am65x/evm.c
index a610879..346f745 100644
--- a/board/ti/am65x/evm.c
+++ b/board/ti/am65x/evm.c
@@ -9,7 +9,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <fdt_support.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
diff --git a/board/ti/beagle/beagle.c b/board/ti/beagle/beagle.c
index 12e657c..9139ad8 100644
--- a/board/ti/beagle/beagle.c
+++ b/board/ti/beagle/beagle.c
@@ -13,8 +13,11 @@
  *
  */
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <ns16550.h>
 #include <serial.h>
 #ifdef CONFIG_LED_STATUS
diff --git a/board/ti/common/board_detect.c b/board/ti/common/board_detect.c
index cbd35f2..4296684 100644
--- a/board/ti/common/board_detect.c
+++ b/board/ti/common/board_detect.c
@@ -9,6 +9,8 @@
 
 #include <common.h>
 #include <eeprom.h>
+#include <log.h>
+#include <net.h>
 #include <asm/arch/hardware.h>
 #include <asm/omap_common.h>
 #include <dm/uclass.h>
diff --git a/board/ti/common/board_detect.h b/board/ti/common/board_detect.h
index 5835af5..9f75b5c 100644
--- a/board/ti/common/board_detect.h
+++ b/board/ti/common/board_detect.h
@@ -9,6 +9,7 @@
 #define __BOARD_DETECT_H
 
 /* TI EEPROM MAGIC Header identifier */
+#include <linux/bitops.h>
 #define TI_EEPROM_HEADER_MAGIC	0xEE3355AA
 #define TI_DEAD_EEPROM_MAGIC	0xADEAD12C
 
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 8132cdf..acf7ff1 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -12,8 +12,10 @@
 #include <common.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
 #include <init.h>
 #include <spl.h>
+#include <net.h>
 #include <palmas.h>
 #include <sata.h>
 #include <serial.h>
diff --git a/board/ti/evm/evm.c b/board/ti/evm/evm.c
index d26dd5b..aba74fc 100644
--- a/board/ti/evm/evm.c
+++ b/board/ti/evm/evm.c
@@ -13,6 +13,8 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <ns16550.h>
 #include <netdev.h>
 #include <serial.h>
@@ -26,6 +28,7 @@
 #include <twl4030.h>
 #include <asm/mach-types.h>
 #include <asm/omap_musb.h>
+#include <linux/delay.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index c068bb8..ff939c8 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -8,7 +8,12 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <fdt_support.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
diff --git a/board/ti/ks2_evm/board.c b/board/ti/ks2_evm/board.c
index 6554c0e..8595b20 100644
--- a/board/ti/ks2_evm/board.c
+++ b/board/ti/ks2_evm/board.c
@@ -10,6 +10,7 @@
 #include "board.h"
 #include <env.h>
 #include <hang.h>
+#include <image.h>
 #include <init.h>
 #include <spl.h>
 #include <exports.h>
diff --git a/board/ti/ks2_evm/board_k2e.c b/board/ti/ks2_evm/board_k2e.c
index ecd4a42..39abb24 100644
--- a/board/ti/ks2_evm/board_k2e.c
+++ b/board/ti/ks2_evm/board_k2e.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <init.h>
 #include <asm/arch/ddr3.h>
 #include <asm/arch/hardware.h>
 #include <asm/ti-common/keystone_net.h>
diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
index c6a14a0..ece7532 100644
--- a/board/ti/ks2_evm/board_k2g.c
+++ b/board/ti/ks2_evm/board_k2g.c
@@ -9,6 +9,7 @@
 #include <eeprom.h>
 #include <env.h>
 #include <hang.h>
+#include <image.h>
 #include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/ti-common/keystone_net.h>
@@ -17,6 +18,8 @@
 #include <fdtdec.h>
 #include <i2c.h>
 #include <remoteproc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "mux-k2g.h"
 #include "../common/board_detect.h"
 
diff --git a/board/ti/ks2_evm/board_k2hk.c b/board/ti/ks2_evm/board_k2hk.c
index 4c0acd6..12c4649 100644
--- a/board/ti/ks2_evm/board_k2hk.c
+++ b/board/ti/ks2_evm/board_k2hk.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
 #include <asm/ti-common/keystone_net.h>
diff --git a/board/ti/ks2_evm/board_k2l.c b/board/ti/ks2_evm/board_k2l.c
index e49d8b3..f759ee3 100644
--- a/board/ti/ks2_evm/board_k2l.c
+++ b/board/ti/ks2_evm/board_k2l.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <init.h>
 #include <asm/arch/ddr3.h>
 #include <asm/arch/hardware.h>
 #include <asm/ti-common/keystone_net.h>
diff --git a/board/ti/omap5_uevm/evm.c b/board/ti/omap5_uevm/evm.c
index ee7efcb..e35f319 100644
--- a/board/ti/omap5_uevm/evm.c
+++ b/board/ti/omap5_uevm/evm.c
@@ -6,12 +6,15 @@
  * Steve Sakoman  <steve@sakoman.com>
  */
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <palmas.h>
 #include <asm/arch/omap.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mmc_host_def.h>
 #include <tca642x.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include <linux/usb/gadget.h>
 #include <dwc3-uboot.h>
 #include <dwc3-omap-uboot.h>
diff --git a/board/ti/panda/panda.c b/board/ti/panda/panda.c
index 20199da..9ebecfd 100644
--- a/board/ti/panda/panda.c
+++ b/board/ti/panda/panda.c
@@ -5,6 +5,9 @@
  * Steve Sakoman  <steve@sakoman.com>
  */
 #include <common.h>
+#include <init.h>
+#include <log.h>
+#include <net.h>
 #include <asm/mach-types.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mmc_host_def.h>
diff --git a/board/ti/sdp4430/cmd_bat.c b/board/ti/sdp4430/cmd_bat.c
index c820435..6c1e6ca 100644
--- a/board/ti/sdp4430/cmd_bat.c
+++ b/board/ti/sdp4430/cmd_bat.c
@@ -9,7 +9,7 @@
 #ifdef CONFIG_CMD_BAT
 #include <twl6030.h>
 
-int do_vbat(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_vbat(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc == 2) {
 		if (strncmp(argv[1], "startcharge", 12) == 0)
diff --git a/board/ti/sdp4430/sdp.c b/board/ti/sdp4430/sdp.c
index e71c53e..a5b3504 100644
--- a/board/ti/sdp4430/sdp.c
+++ b/board/ti/sdp4430/sdp.c
@@ -6,6 +6,8 @@
  * Steve Sakoman  <steve@sakoman.com>
  */
 #include <common.h>
+#include <init.h>
+#include <net.h>
 #include <twl6030.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/mmc_host_def.h>
diff --git a/board/ti/ti814x/evm.c b/board/ti/ti814x/evm.c
index 2b9385d..8ed80d2 100644
--- a/board/ti/ti814x/evm.c
+++ b/board/ti/ti814x/evm.c
@@ -11,6 +11,8 @@
 #include <cpsw.h>
 #include <env.h>
 #include <errno.h>
+#include <init.h>
+#include <net.h>
 #include <spl.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/hardware.h>
diff --git a/board/ti/ti816x/evm.c b/board/ti/ti816x/evm.c
index 3896ebb..590c156 100644
--- a/board/ti/ti816x/evm.c
+++ b/board/ti/ti816x/evm.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <spl.h>
 #include <asm/cache.h>
 #include <asm/io.h>
diff --git a/board/timll/devkit3250/devkit3250.c b/board/timll/devkit3250/devkit3250.c
index b455844..f4eaf15 100644
--- a/board/timll/devkit3250/devkit3250.c
+++ b/board/timll/devkit3250/devkit3250.c
@@ -13,6 +13,7 @@
 #include <asm/arch/emc.h>
 #include <asm/arch/wdt.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c
index b037d72..cbb2199 100644
--- a/board/timll/devkit8000/devkit8000.c
+++ b/board/timll/devkit8000/devkit8000.c
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <dm.h>
 #include <env.h>
+#include <init.h>
 #include <malloc.h>
 #include <ns16550.h>
 #include <twl4030.h>
diff --git a/board/toradex/apalis-tk1/apalis-tk1.c b/board/toradex/apalis-tk1/apalis-tk1.c
index bc98858..d77b4c4 100644
--- a/board/toradex/apalis-tk1/apalis-tk1.c
+++ b/board/toradex/apalis-tk1/apalis-tk1.c
@@ -5,6 +5,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <env.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch-tegra/ap.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -12,6 +15,7 @@
 #include <asm/arch/pinmux.h>
 #include <env_internal.h>
 #include <pci_tegra.h>
+#include <linux/delay.h>
 #include <power/as3722.h>
 #include <power/pmic.h>
 
diff --git a/board/toradex/apalis-tk1/as3722_init.c b/board/toradex/apalis-tk1/as3722_init.c
index 15f8dce..68169f5 100644
--- a/board/toradex/apalis-tk1/as3722_init.c
+++ b/board/toradex/apalis-tk1/as3722_init.c
@@ -4,8 +4,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/tegra_i2c.h>
+#include <linux/delay.h>
 #include "as3722_init.h"
 
 /* AS3722-PMIC-specific early init code - get CPU rails up, etc */
diff --git a/board/toradex/apalis_imx6/apalis_imx6.c b/board/toradex/apalis_imx6/apalis_imx6.c
index 8c4a359..40c71ad 100644
--- a/board/toradex/apalis_imx6/apalis_imx6.c
+++ b/board/toradex/apalis_imx6/apalis_imx6.c
@@ -9,7 +9,11 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <image.h>
 #include <init.h>
+#include <net.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <ahci.h>
 #include <asm/arch/clock.h>
diff --git a/board/toradex/apalis_imx6/do_fuse.c b/board/toradex/apalis_imx6/do_fuse.c
index 22d191f..6991b1b 100644
--- a/board/toradex/apalis_imx6/do_fuse.c
+++ b/board/toradex/apalis_imx6/do_fuse.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #ifndef CONFIG_SPL_BUILD
+#include <command.h>
 #include <console.h>
 #include <fuse.h>
 
@@ -35,8 +36,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-int do_mfgr_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
-		char * const argv[])
+int do_mfgr_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
+		 char *const argv[])
 {
 	int ret;
 	puts("Fusing...\n");
@@ -48,8 +49,8 @@
 	return ret;
 }
 
-int do_updt_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
-		char * const argv[])
+int do_updt_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
+		 char *const argv[])
 {
 	unsigned val;
 	int ret;
diff --git a/board/toradex/apalis_imx6/pf0100.c b/board/toradex/apalis_imx6/pf0100.c
index ebd6418..c89052f 100644
--- a/board/toradex/apalis_imx6/pf0100.c
+++ b/board/toradex/apalis_imx6/pf0100.c
@@ -8,12 +8,14 @@
 */
 
 #include <common.h>
+#include <command.h>
 #include <i2c.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <linux/delay.h>
 
 #include "pf0100_otp.inc"
 #include "pf0100.h"
@@ -261,8 +263,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_pf0100_prog(cmd_tbl_t *cmdtp, int flag, int argc,
-		char * const argv[])
+static int do_pf0100_prog(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	int ret;
 	puts("Programming PMIC OTP...");
diff --git a/board/toradex/apalis_t30/apalis_t30.c b/board/toradex/apalis_t30/apalis_t30.c
index df9bc8e..3e8b8b1 100644
--- a/board/toradex/apalis_t30/apalis_t30.c
+++ b/board/toradex/apalis_t30/apalis_t30.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/gp_padctrl.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch-tegra/ap.h>
@@ -14,6 +16,7 @@
 #include <dm.h>
 #include <i2c.h>
 #include <pci_tegra.h>
+#include <linux/delay.h>
 #include "../common/tdx-common.h"
 
 #include "pinmux-config-apalis_t30.h"
diff --git a/board/toradex/colibri-imx6ull/colibri-imx6ull.c b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
index 7dfe8ae..c67d02f 100644
--- a/board/toradex/colibri-imx6ull/colibri-imx6ull.c
+++ b/board/toradex/colibri-imx6ull/colibri-imx6ull.c
@@ -4,6 +4,7 @@
  */
 #include <common.h>
 #include <init.h>
+#include <linux/delay.h>
 
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/toradex/colibri_imx6/colibri_imx6.c b/board/toradex/colibri_imx6/colibri_imx6.c
index d11401e..6522af4 100644
--- a/board/toradex/colibri_imx6/colibri_imx6.c
+++ b/board/toradex/colibri_imx6/colibri_imx6.c
@@ -11,6 +11,9 @@
 #include <dm.h>
 #include <env.h>
 #include <init.h>
+#include <net.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
diff --git a/board/toradex/colibri_imx6/do_fuse.c b/board/toradex/colibri_imx6/do_fuse.c
index 22d191f..6991b1b 100644
--- a/board/toradex/colibri_imx6/do_fuse.c
+++ b/board/toradex/colibri_imx6/do_fuse.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #ifndef CONFIG_SPL_BUILD
+#include <command.h>
 #include <console.h>
 #include <fuse.h>
 
@@ -35,8 +36,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-int do_mfgr_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
-		char * const argv[])
+int do_mfgr_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
+		 char *const argv[])
 {
 	int ret;
 	puts("Fusing...\n");
@@ -48,8 +49,8 @@
 	return ret;
 }
 
-int do_updt_fuse(cmd_tbl_t *cmdtp, int flag, int argc,
-		char * const argv[])
+int do_updt_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
+		 char *const argv[])
 {
 	unsigned val;
 	int ret;
diff --git a/board/toradex/colibri_imx6/pf0100.c b/board/toradex/colibri_imx6/pf0100.c
index e744243..8f08d8c 100644
--- a/board/toradex/colibri_imx6/pf0100.c
+++ b/board/toradex/colibri_imx6/pf0100.c
@@ -8,12 +8,14 @@
 */
 
 #include <common.h>
+#include <command.h>
 #include <i2c.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
+#include <linux/delay.h>
 
 #include "pf0100_otp.inc"
 #include "pf0100.h"
@@ -246,8 +248,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_pf0100_prog(cmd_tbl_t *cmdtp, int flag, int argc,
-		char * const argv[])
+static int do_pf0100_prog(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	int ret;
 	puts("Programming PMIC OTP...");
diff --git a/board/toradex/colibri_imx7/colibri_imx7.c b/board/toradex/colibri_imx7/colibri_imx7.c
index 8727101..8df925d 100644
--- a/board/toradex/colibri_imx7/colibri_imx7.c
+++ b/board/toradex/colibri_imx7/colibri_imx7.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/imx-regs.h>
@@ -20,6 +21,7 @@
 #include <fdt_support.h>
 #include <fsl_esdhc_imx.h>
 #include <jffs2/load_kernel.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <mmc.h>
 #include <miiphy.h>
diff --git a/board/toradex/colibri_pxa270/colibri_pxa270.c b/board/toradex/colibri_pxa270/colibri_pxa270.c
index c4db516..18b3d3f 100644
--- a/board/toradex/colibri_pxa270/colibri_pxa270.c
+++ b/board/toradex/colibri_pxa270/colibri_pxa270.c
@@ -9,6 +9,8 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <init.h>
+#include <net.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/pxa.h>
 #include <asm/arch/regs-mmc.h>
@@ -20,6 +22,7 @@
 #include <serial.h>
 #include <usb.h>
 #include <asm/mach-types.h>
+#include <linux/delay.h>
 #include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/toradex/colibri_t20/colibri_t20.c b/board/toradex/colibri_t20/colibri_t20.c
index e0b27e9..cb0aed8 100644
--- a/board/toradex/colibri_t20/colibri_t20.c
+++ b/board/toradex/colibri_t20/colibri_t20.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch/pinmux.h>
@@ -14,6 +16,7 @@
 #include <asm/io.h>
 #include <i2c.h>
 #include <nand.h>
+#include <linux/delay.h>
 #include "../common/tdx-common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/toradex/colibri_t30/colibri_t30.c b/board/toradex/colibri_t30/colibri_t30.c
index b6b00e3..0bbe81e 100644
--- a/board/toradex/colibri_t30/colibri_t30.c
+++ b/board/toradex/colibri_t30/colibri_t30.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/gp_padctrl.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch-tegra/ap.h>
@@ -12,6 +13,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <i2c.h>
+#include <linux/delay.h>
 #include "pinmux-config-colibri_t30.h"
 #include "../common/tdx-common.h"
 
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c
index 1b6c911..75216ec 100644
--- a/board/toradex/common/tdx-cfg-block.c
+++ b/board/toradex/common/tdx-cfg-block.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include "tdx-cfg-block.h"
+#include <command.h>
+#include <asm/cache.h>
 
 #if defined(CONFIG_TARGET_APALIS_IMX6) || \
 	defined(CONFIG_TARGET_APALIS_IMX8) || \
@@ -513,8 +515,8 @@
 	return 0;
 }
 
-static int do_cfgblock_create(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_cfgblock_create(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	u8 *config_block;
 	struct toradex_tag *tag;
@@ -642,8 +644,8 @@
 	return ret;
 }
 
-static int do_cfgblock(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_cfgblock(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	int ret;
 
diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
index e9441a7..e8de923 100644
--- a/board/toradex/common/tdx-common.c
+++ b/board/toradex/common/tdx-common.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <env.h>
 #include <g_dnl.h>
+#include <init.h>
 #include <linux/libfdt.h>
 
 #include "tdx-cfg-block.h"
diff --git a/board/toradex/verdin-imx8mm/spl.c b/board/toradex/verdin-imx8mm/spl.c
index dc5bd84..cc78c56 100644
--- a/board/toradex/verdin-imx8mm/spl.c
+++ b/board/toradex/verdin-imx8mm/spl.c
@@ -4,6 +4,10 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <image.h>
+#include <init.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/ddr.h>
 #include <asm/arch/imx8mm_pins.h>
diff --git a/board/toradex/verdin-imx8mm/verdin-imx8mm.c b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
index 35866e0..ff05c7d 100644
--- a/board/toradex/verdin-imx8mm/verdin-imx8mm.c
+++ b/board/toradex/verdin-imx8mm/verdin-imx8mm.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
diff --git a/board/tplink/wdr4300/wdr4300.c b/board/tplink/wdr4300/wdr4300.c
index 4dacaa4..9134d6b 100644
--- a/board/tplink/wdr4300/wdr4300.c
+++ b/board/tplink/wdr4300/wdr4300.c
@@ -4,9 +4,12 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/io.h>
 #include <asm/addrspace.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/ath79.h>
 #include <mach/ar71xx_regs.h>
 #include <mach/ddr.h>
diff --git a/board/tqc/tqm834x/pci.c b/board/tqc/tqm834x/pci.c
index 0834207..92bda607 100644
--- a/board/tqc/tqm834x/pci.c
+++ b/board/tqc/tqm834x/pci.c
@@ -13,6 +13,7 @@
 #include <pci.h>
 #include <i2c.h>
 #include <asm/fsl_i2c.h>
+#include <linux/delay.h>
 
 static struct pci_region pci1_regions[] = {
 	{
diff --git a/board/tqc/tqm834x/tqm834x.c b/board/tqc/tqm834x/tqm834x.c
index 02b3d2d..165a543 100644
--- a/board/tqc/tqm834x/tqm834x.c
+++ b/board/tqc/tqm834x/tqm834x.c
@@ -8,6 +8,7 @@
 #include <fdt_support.h>
 #include <init.h>
 #include <ioports.h>
+#include <log.h>
 #include <mpc83xx.h>
 #include <asm/mpc8349_pci.h>
 #include <i2c.h>
@@ -15,6 +16,7 @@
 #include <asm/mmu.h>
 #include <pci.h>
 #include <flash.h>
+#include <linux/delay.h>
 #include <mtd/cfi_flash.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/tqc/tqma6/tqma6.c b/board/tqc/tqma6/tqma6.c
index 675341a..d7df4f9 100644
--- a/board/tqc/tqma6/tqma6.c
+++ b/board/tqc/tqma6/tqma6.c
@@ -14,6 +14,7 @@
 #include <asm/arch/iomux.h>
 #include <asm/arch/sys_proto.h>
 #include <env.h>
+#include <fdt_support.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/board/tqc/tqma6/tqma6_mba6.c b/board/tqc/tqma6/tqma6_mba6.c
index a5b7587..84d0e38 100644
--- a/board/tqc/tqma6/tqma6_mba6.c
+++ b/board/tqc/tqma6/tqma6_mba6.c
@@ -8,12 +8,14 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/mxc_i2c.h>
diff --git a/board/tqc/tqma6/tqma6_wru4.c b/board/tqc/tqma6/tqma6_wru4.c
index 1320f8a..0488cba 100644
--- a/board/tqc/tqma6/tqma6_wru4.c
+++ b/board/tqc/tqma6/tqma6_wru4.c
@@ -10,12 +10,14 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/mx6-pins.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/boot_mode.h>
diff --git a/board/udoo/neo/neo.c b/board/udoo/neo/neo.c
index 2ba98c7..5e49180 100644
--- a/board/udoo/neo/neo.c
+++ b/board/udoo/neo/neo.c
@@ -9,6 +9,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/imx-regs.h>
@@ -24,6 +25,7 @@
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/arch/sys_proto.h>
 #include <spl.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <i2c.h>
diff --git a/board/udoo/udoo.c b/board/udoo/udoo.c
index 2a4e790..4c85d99 100644
--- a/board/udoo/udoo.c
+++ b/board/udoo/udoo.c
@@ -6,12 +6,14 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <env.h>
 #include <malloc.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/udoo/udoo_spl.c b/board/udoo/udoo_spl.c
index b287fbf..d9afbbb 100644
--- a/board/udoo/udoo_spl.c
+++ b/board/udoo/udoo_spl.c
@@ -6,10 +6,13 @@
  * Based on board/wandboard/spl.c
  */
 
+#include <common.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/variscite/dart_6ul/dart_6ul.c b/board/variscite/dart_6ul/dart_6ul.c
index 2d0b760..a4f449d 100644
--- a/board/variscite/dart_6ul/dart_6ul.c
+++ b/board/variscite/dart_6ul/dart_6ul.c
@@ -4,6 +4,8 @@
  * Copyright (C) 2019 Parthiban Nallathambi <parthitce@gmail.com>
  */
 
+#include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/mx6-pins.h>
diff --git a/board/variscite/dart_6ul/spl.c b/board/variscite/dart_6ul/spl.c
index 798523d..1b06a66 100644
--- a/board/variscite/dart_6ul/spl.c
+++ b/board/variscite/dart_6ul/spl.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <spl.h>
 #include <asm/arch/clock.h>
 #include <asm/io.h>
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index 4c02508..251d9fd 100644
--- a/board/varisys/common/sys_eeprom.c
+++ b/board/varisys/common/sys_eeprom.c
@@ -15,6 +15,7 @@
 #include <env.h>
 #include <i2c.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <u-boot/crc.h>
 
 #include "eeprom.h"
@@ -306,7 +307,7 @@
 	update_crc();
 }
 
-int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_mac(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char cmd;
 
diff --git a/board/varisys/cyrus/cyrus.c b/board/varisys/cyrus/cyrus.c
index 1342907..a42910f 100644
--- a/board/varisys/cyrus/cyrus.c
+++ b/board/varisys/cyrus/cyrus.c
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
 #include <init.h>
 #include <netdev.h>
 #include <linux/compiler.h>
diff --git a/board/varisys/cyrus/ddr.c b/board/varisys/cyrus/ddr.c
index cac00e0..7949eb8 100644
--- a/board/varisys/cyrus/ddr.c
+++ b/board/varisys/cyrus/ddr.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <init.h>
+#include <log.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/varisys/cyrus/eth.c b/board/varisys/cyrus/eth.c
index 9783abd..45b21fb 100644
--- a/board/varisys/cyrus/eth.c
+++ b/board/varisys/cyrus/eth.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 #include <netdev.h>
 #include <asm/fsl_serdes.h>
 #include <fm_eth.h>
diff --git a/board/ve8313/ve8313.c b/board/ve8313/ve8313.c
index d1c9535..ceb3d75 100644
--- a/board/ve8313/ve8313.c
+++ b/board/ve8313/ve8313.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <fdt_support.h>
 #include <init.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <pci.h>
 #include <mpc83xx.h>
diff --git a/board/vscom/baltos/board.c b/board/vscom/baltos/board.c
index c76502c..197405e 100644
--- a/board/vscom/baltos/board.c
+++ b/board/vscom/baltos/board.c
@@ -11,6 +11,7 @@
 #include <env.h>
 #include <errno.h>
 #include <init.h>
+#include <net.h>
 #include <serial.h>
 #include <linux/libfdt.h>
 #include <spl.h>
diff --git a/board/wandboard/spl.c b/board/wandboard/spl.c
index dbd9d02..04c351f 100644
--- a/board/wandboard/spl.c
+++ b/board/wandboard/spl.c
@@ -5,10 +5,13 @@
  *         Richard Hu <hakahu@gmail.com>
  */
 
+#include <common.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/iomux.h>
 #include <asm/arch/mx6-pins.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/mach-imx/iomux-v3.h>
diff --git a/board/wandboard/wandboard.c b/board/wandboard/wandboard.c
index fb2f3c1..e0e01b1 100644
--- a/board/wandboard/wandboard.c
+++ b/board/wandboard/wandboard.c
@@ -6,7 +6,10 @@
  * Author: Fabio Estevam <fabio.estevam@freescale.com>
  */
 
+#include <common.h>
+#include <image.h>
 #include <init.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/crm_regs.h>
 #include <asm/arch/iomux.h>
@@ -22,6 +25,7 @@
 #include <asm/mach-imx/sata.h>
 #include <asm/io.h>
 #include <env.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <common.h>
 #include <miiphy.h>
diff --git a/board/warp7/warp7.c b/board/warp7/warp7.c
index 1ebec93..5063057 100644
--- a/board/warp7/warp7.c
+++ b/board/warp7/warp7.c
@@ -5,6 +5,7 @@
  */
 
 #include <init.h>
+#include <net.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/mx7-pins.h>
diff --git a/board/work-microwave/work_92105/work_92105.c b/board/work-microwave/work_92105/work_92105.c
index 5cc2566..2e0def5 100644
--- a/board/work-microwave/work_92105/work_92105.c
+++ b/board/work-microwave/work_92105/work_92105.c
@@ -16,6 +16,7 @@
 #include <asm/arch/wdt.h>
 #include <asm/gpio.h>
 #include <spl.h>
+#include <linux/delay.h>
 #include "work_92105_display.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/board/work-microwave/work_92105/work_92105_display.c b/board/work-microwave/work_92105/work_92105_display.c
index db04dca..fecbbbd 100644
--- a/board/work-microwave/work_92105/work_92105_display.c
+++ b/board/work-microwave/work_92105/work_92105_display.c
@@ -11,6 +11,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/emc.h>
@@ -20,6 +22,7 @@
 #include <i2c.h>
 #include <version.h>
 #include <vsprintf.h>
+#include <linux/delay.h>
 
 /*
  * GPO 15 in port 3 is gpio 3*32+15 = 111
@@ -266,7 +269,7 @@
 
 #ifdef CONFIG_CMD_MAX6957
 
-static int do_max6957aax(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_max6957aax(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	int reg, val;
@@ -315,7 +318,8 @@
 #error CONFIG_CMD_HD44760 requires CONFIG_HUSH_PARSER
 #endif
 
-static int do_hd44780(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_hd44780(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	char *cmd;
 
diff --git a/board/xes/common/board.c b/board/xes/common/board.c
index 43575bc..053b07a 100644
--- a/board/xes/common/board.c
+++ b/board/xes/common/board.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <env.h>
 #include "fsl_8xxx_misc.h"
+#include <init.h>
 
 int checkboard(void)
 {
diff --git a/board/xes/xpedite517x/ddr.c b/board/xes/xpedite517x/ddr.c
index 604faf2..a3fd2fc 100644
--- a/board/xes/xpedite517x/ddr.c
+++ b/board/xes/xpedite517x/ddr.c
@@ -8,6 +8,7 @@
 #include <i2c.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
+#include <log.h>
 
 void get_spd(ddr2_spd_eeprom_t *spd, u8 i2c_address)
 {
diff --git a/board/xes/xpedite537x/ddr.c b/board/xes/xpedite537x/ddr.c
index 65e69c8..f55102a 100644
--- a/board/xes/xpedite537x/ddr.c
+++ b/board/xes/xpedite537x/ddr.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c
index 294a59d..0469e2e 100644
--- a/board/xilinx/common/board.c
+++ b/board/xilinx/common/board.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <log.h>
 #include <asm/sections.h>
 #include <dm/uclass.h>
 #include <i2c.h>
diff --git a/board/xilinx/microblaze-generic/microblaze-generic.c b/board/xilinx/microblaze-generic/microblaze-generic.c
index 0e33f6a..4e569e9 100644
--- a/board/xilinx/microblaze-generic/microblaze-generic.c
+++ b/board/xilinx/microblaze-generic/microblaze-generic.c
@@ -12,7 +12,9 @@
 
 #include <common.h>
 #include <config.h>
+#include <env.h>
 #include <init.h>
+#include <log.h>
 #include <dm/lists.h>
 #include <fdtdec.h>
 #include <linux/sizes.h>
diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c
index 483e3ce..45cf1d2 100644
--- a/board/xilinx/versal/board.c
+++ b/board/xilinx/versal/board.c
@@ -6,10 +6,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <env.h>
 #include <fdtdec.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <time.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/xilinx/zynq/bootimg.c b/board/xilinx/zynq/bootimg.c
index 56d69cd..481f012 100644
--- a/board/xilinx/zynq/bootimg.c
+++ b/board/xilinx/zynq/bootimg.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <part.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
diff --git a/board/xilinx/zynq/cmds.c b/board/xilinx/zynq/cmds.c
index 27d44b7..0c46de7 100644
--- a/board/xilinx/zynq/cmds.c
+++ b/board/xilinx/zynq/cmds.c
@@ -4,10 +4,13 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 #include <u-boot/md5.h>
 #include <u-boot/rsa.h>
 #include <u-boot/rsa-mod-exp.h>
@@ -408,8 +411,8 @@
 	return 0;
 }
 
-static int do_zynq_rsa(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_zynq_rsa(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	u32 src_ptr;
 	char *endp;
@@ -429,8 +432,8 @@
 #endif
 
 #ifdef CONFIG_CMD_ZYNQ_AES
-static int zynq_decrypt_image(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int zynq_decrypt_image(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	char *endp;
 	u32 srcaddr, srclen, dstaddr, dstlen;
@@ -469,7 +472,7 @@
 }
 #endif
 
-static cmd_tbl_t zynq_commands[] = {
+static struct cmd_tbl zynq_commands[] = {
 #ifdef CONFIG_CMD_ZYNQ_RSA
 	U_BOOT_CMD_MKENT(rsa, 3, 1, do_zynq_rsa, "", ""),
 #endif
@@ -478,9 +481,10 @@
 #endif
 };
 
-static int do_zynq(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_zynq(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
-	cmd_tbl_t *zynq_cmd;
+	struct cmd_tbl *zynq_cmd;
 	int ret;
 
 	if (!ARRAY_SIZE(zynq_commands)) {
diff --git a/board/xilinx/zynqmp/cmds.c b/board/xilinx/zynqmp/cmds.c
index 893616b..0f1f269 100644
--- a/board/xilinx/zynqmp/cmds.c
+++ b/board/xilinx/zynqmp/cmds.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <env.h>
 #include <malloc.h>
@@ -13,8 +14,8 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
 
-static int do_zynqmp_verify_secure(cmd_tbl_t *cmdtp, int flag, int argc,
-				   char * const argv[])
+static int do_zynqmp_verify_secure(struct cmd_tbl *cmdtp, int flag, int argc,
+				   char *const argv[])
 {
 	u64 src_addr, addr;
 	u32 len, src_lo, src_hi;
@@ -65,8 +66,8 @@
 	return ret;
 }
 
-static int do_zynqmp_mmio_read(cmd_tbl_t *cmdtp, int flag, int argc,
-			       char * const argv[])
+static int do_zynqmp_mmio_read(struct cmd_tbl *cmdtp, int flag, int argc,
+			       char *const argv[])
 {
 	u32 read_val, addr;
 	int ret;
@@ -86,8 +87,8 @@
 	return ret;
 }
 
-static int do_zynqmp_mmio_write(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_zynqmp_mmio_write(struct cmd_tbl *cmdtp, int flag, int argc,
+				char *const argv[])
 {
 	u32 addr, mask, val;
 	int ret;
@@ -107,8 +108,8 @@
 }
 
 #ifdef CONFIG_DEFINE_TCM_OCM_MMAP
-static int do_zynqmp_tcm_init(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_zynqmp_tcm_init(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	u8 mode;
 
@@ -129,7 +130,7 @@
 }
 #endif
 
-static cmd_tbl_t cmd_zynqmp_sub[] = {
+static struct cmd_tbl cmd_zynqmp_sub[] = {
 	U_BOOT_CMD_MKENT(secure, 5, 0, do_zynqmp_verify_secure, "", ""),
 	U_BOOT_CMD_MKENT(mmio_read, 3, 0, do_zynqmp_mmio_read, "", ""),
 	U_BOOT_CMD_MKENT(mmio_write, 5, 0, do_zynqmp_mmio_write, "", ""),
@@ -149,10 +150,10 @@
  *
  * Return: return 0 on success and CMD_RET_USAGE incase of misuse and error
  */
-static int do_zynqmp(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_zynqmp(struct cmd_tbl *cmdtp, int flag, int argc,
 		     char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/board/xilinx/zynqmp/tap_delays.c b/board/xilinx/zynqmp/tap_delays.c
index c3ae357..5fde0ae 100644
--- a/board/xilinx/zynqmp/tap_delays.c
+++ b/board/xilinx/zynqmp/tap_delays.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <asm/arch/sys_proto.h>
+#include <linux/delay.h>
 
 #define SD_DLL_CTRL			0xFF180358
 #define SD_ITAP_DLY			0xFF180314
diff --git a/board/xilinx/zynqmp/xil_io.h b/board/xilinx/zynqmp/xil_io.h
index 1c1bf32..e6caa7c 100644
--- a/board/xilinx/zynqmp/xil_io.h
+++ b/board/xilinx/zynqmp/xil_io.h
@@ -6,6 +6,7 @@
 /* FIXME remove this when vivado is fixed */
 #include <asm/io.h>
 #include <common.h>
+#include <linux/delay.h>
 
 #define xil_printf(...)
 
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index a2a0d56..cb72914 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -5,10 +5,13 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <debug_uart.h>
 #include <env.h>
 #include <init.h>
+#include <log.h>
+#include <net.h>
 #include <sata.h>
 #include <ahci.h>
 #include <scsi.h>
@@ -18,7 +21,9 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/psu_init_gpl.h>
+#include <asm/cache.h>
 #include <asm/io.h>
+#include <asm/ptrace.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <usb.h>
@@ -26,6 +31,9 @@
 #include <zynqmppl.h>
 #include <zynqmp_firmware.h>
 #include <g_dnl.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/sizes.h>
 #include "../common/board.h"
 
 #include "pm_cfg_obj.h"
@@ -413,7 +421,7 @@
 }
 
 unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
-			 char * const argv[])
+			 char *const argv[])
 {
 	int ret = 0;
 
diff --git a/board/xilinx/zynqmp_r5/board.c b/board/xilinx/zynqmp_r5/board.c
index 1c45ee7..5c5a2e9 100644
--- a/board/xilinx/zynqmp_r5/board.c
+++ b/board/xilinx/zynqmp_r5/board.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <init.h>
 
 int board_init(void)
 {
diff --git a/board/zyxel/nsa310s/nsa310s.c b/board/zyxel/nsa310s/nsa310s.c
index 82a3fee..3f71e3d 100644
--- a/board/zyxel/nsa310s/nsa310s.c
+++ b/board/zyxel/nsa310s/nsa310s.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <miiphy.h>
 #include <net.h>
 #include <asm/arch/cpu.h>
diff --git a/cmd/ab_select.c b/cmd/ab_select.c
index 7c8f2ee..6298fcf 100644
--- a/cmd/ab_select.c
+++ b/cmd/ab_select.c
@@ -3,15 +3,18 @@
  * Copyright (C) 2017 The Android Open Source Project
  */
 
+#include <common.h>
 #include <android_ab.h>
 #include <command.h>
+#include <env.h>
+#include <part.h>
 
-static int do_ab_select(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_ab_select(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	int ret;
 	struct blk_desc *dev_desc;
-	disk_partition_t part_info;
+	struct disk_partition part_info;
 	char slot[2];
 
 	if (argc != 4)
diff --git a/cmd/abootimg.c b/cmd/abootimg.c
index 670bcb3..40e8978 100644
--- a/cmd/abootimg.c
+++ b/cmd/abootimg.c
@@ -6,6 +6,8 @@
 
 #include <android_image.h>
 #include <common.h>
+#include <command.h>
+#include <image.h>
 #include <mapmem.h>
 
 #define abootimg_addr() \
@@ -14,7 +16,7 @@
 /* Please use abootimg_addr() macro to obtain the boot image address */
 static ulong _abootimg_addr = -1;
 
-static int abootimg_get_ver(int argc, char * const argv[])
+static int abootimg_get_ver(int argc, char *const argv[])
 {
 	const struct andr_img_hdr *hdr;
 	int res = CMD_RET_SUCCESS;
@@ -39,7 +41,7 @@
 	return res;
 }
 
-static int abootimg_get_recovery_dtbo(int argc, char * const argv[])
+static int abootimg_get_recovery_dtbo(int argc, char *const argv[])
 {
 	ulong addr;
 	u32 size;
@@ -61,7 +63,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int abootimg_get_dtb_load_addr(int argc, char * const argv[])
+static int abootimg_get_dtb_load_addr(int argc, char *const argv[])
 {
 	const struct andr_img_hdr *hdr;
 	int res = CMD_RET_SUCCESS;
@@ -92,7 +94,7 @@
 	return res;
 }
 
-static int abootimg_get_dtb_by_index(int argc, char * const argv[])
+static int abootimg_get_dtb_by_index(int argc, char *const argv[])
 {
 	const char *index_str;
 	u32 num;
@@ -139,7 +141,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int abootimg_get_dtb(int argc, char * const argv[])
+static int abootimg_get_dtb(int argc, char *const argv[])
 {
 	if (argc < 1)
 		return CMD_RET_USAGE;
@@ -150,8 +152,8 @@
 	return CMD_RET_USAGE;
 }
 
-static int do_abootimg_addr(cmd_tbl_t *cmdtp, int flag, int argc,
-			    char * const argv[])
+static int do_abootimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	char *endp;
 	ulong img_addr;
@@ -169,8 +171,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_abootimg_get(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_abootimg_get(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	const char *param;
 
@@ -192,8 +194,8 @@
 	return CMD_RET_USAGE;
 }
 
-static int do_abootimg_dump(cmd_tbl_t *cmdtp, int flag, int argc,
-			    char * const argv[])
+static int do_abootimg_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	if (argc != 2)
 		return CMD_RET_USAGE;
@@ -208,16 +210,16 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_abootimg_sub[] = {
+static struct cmd_tbl cmd_abootimg_sub[] = {
 	U_BOOT_CMD_MKENT(addr, 2, 1, do_abootimg_addr, "", ""),
 	U_BOOT_CMD_MKENT(dump, 2, 1, do_abootimg_dump, "", ""),
 	U_BOOT_CMD_MKENT(get, 5, 1, do_abootimg_get, "", ""),
 };
 
-static int do_abootimg(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_abootimg(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	cp = find_cmd_tbl(argv[1], cmd_abootimg_sub,
 			  ARRAY_SIZE(cmd_abootimg_sub));
diff --git a/cmd/acpi.c b/cmd/acpi.c
index 203bd93..e9a9161 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -137,7 +137,7 @@
 	return 0;
 }
 
-static int do_acpi_list(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_acpi_list(struct cmd_tbl *cmdtp, int flag, int argc,
 			char *const argv[])
 {
 	struct acpi_rsdp *rsdp;
@@ -153,7 +153,7 @@
 	return 0;
 }
 
-static int do_acpi_dump(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_acpi_dump(struct cmd_tbl *cmdtp, int flag, int argc,
 			char *const argv[])
 {
 	const char *name;
diff --git a/cmd/adc.c b/cmd/adc.c
index 381961c..16f914a 100644
--- a/cmd/adc.c
+++ b/cmd/adc.c
@@ -8,7 +8,7 @@
 #include <dm.h>
 #include <adc.h>
 
-static int do_adc_list(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_adc_list(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	struct udevice *dev;
@@ -31,7 +31,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_adc_info(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	struct udevice *dev;
@@ -68,7 +68,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_adc_single(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	struct udevice *dev;
@@ -95,7 +95,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_adc_scan(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_adc_scan(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	struct adc_channel ch[ADC_MAX_CHANNEL];
diff --git a/cmd/adtimg.c b/cmd/adtimg.c
index 60bb01c..aa94300 100644
--- a/cmd/adtimg.c
+++ b/cmd/adtimg.c
@@ -5,6 +5,7 @@
  * Eugeniu Rosca <rosca.eugeniu@gmail.com>
  */
 
+#include <command.h>
 #include <env.h>
 #include <image-android-dt.h>
 #include <common.h>
@@ -17,8 +18,8 @@
  */
 static ulong working_img;
 
-static int do_adtimg_addr(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_adtimg_addr(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	char *endp;
 	ulong hdr_addr;
@@ -56,8 +57,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_adtimg_dump(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_adtimg_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	if (argc != 1)
 		return CMD_RET_USAGE;
@@ -99,7 +100,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int adtimg_getopt_index(int argc, char * const argv[], u32 *index,
+static int adtimg_getopt_index(int argc, char *const argv[], u32 *index,
 			       char **avar, char **svar)
 {
 	int ret;
@@ -124,7 +125,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int adtimg_get_dt_by_index(int argc, char * const argv[])
+static int adtimg_get_dt_by_index(int argc, char *const argv[])
 {
 	ulong addr;
 	u32 index, size;
@@ -163,7 +164,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int adtimg_get_dt(int argc, char * const argv[])
+static int adtimg_get_dt(int argc, char *const argv[])
 {
 	if (argc < 2) {
 		printf("Error: No options passed to '%s'\n", argv[0]);
@@ -181,8 +182,8 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_adtimg_get(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_adtimg_get(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	if (argc < 2) {
 		printf("Error: No arguments passed to '%s'\n", argv[0]);
@@ -203,15 +204,16 @@
 	return CMD_RET_FAILURE;
 }
 
-static cmd_tbl_t cmd_adtimg_sub[] = {
+static struct cmd_tbl cmd_adtimg_sub[] = {
 	U_BOOT_CMD_MKENT(addr, CONFIG_SYS_MAXARGS, 1, do_adtimg_addr, "", ""),
 	U_BOOT_CMD_MKENT(dump, CONFIG_SYS_MAXARGS, 1, do_adtimg_dump, "", ""),
 	U_BOOT_CMD_MKENT(get, CONFIG_SYS_MAXARGS, 1, do_adtimg_get, "", ""),
 };
 
-static int do_adtimg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_adtimg(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	cp = find_cmd_tbl(argv[1], cmd_adtimg_sub, ARRAY_SIZE(cmd_adtimg_sub));
 
diff --git a/cmd/aes.c b/cmd/aes.c
index 8c5b42f..4c0dad9 100644
--- a/cmd/aes.c
+++ b/cmd/aes.c
@@ -35,7 +35,7 @@
  * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
  * on error.
  */
-static int do_aes(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_aes(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	uint32_t key_addr, iv_addr, src_addr, dst_addr, len;
 	uint8_t *key_ptr, *iv_ptr, *src_ptr, *dst_ptr;
diff --git a/cmd/arm/exception.c b/cmd/arm/exception.c
index 33bc759..522f6df 100644
--- a/cmd/arm/exception.c
+++ b/cmd/arm/exception.c
@@ -8,8 +8,8 @@
 #include <common.h>
 #include <command.h>
 
-static int do_unaligned(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_unaligned(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	/*
 	 * The LDRD instruction requires the data source to be four byte aligned
@@ -23,15 +23,15 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_breakpoint(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_breakpoint(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	asm volatile ("BKPT #123\n");
 	return CMD_RET_FAILURE;
 }
 
-static int do_undefined(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	/*
 	 * 0xe7f...f.	is undefined in ARM mode
@@ -41,7 +41,7 @@
 	return CMD_RET_FAILURE;
 }
 
-static cmd_tbl_t cmd_sub[] = {
+static struct cmd_tbl cmd_sub[] = {
 	U_BOOT_CMD_MKENT(breakpoint, CONFIG_SYS_MAXARGS, 1, do_breakpoint,
 			 "", ""),
 	U_BOOT_CMD_MKENT(unaligned, CONFIG_SYS_MAXARGS, 1, do_unaligned,
diff --git a/cmd/arm/exception64.c b/cmd/arm/exception64.c
index a363818..d5de50a 100644
--- a/cmd/arm/exception64.c
+++ b/cmd/arm/exception64.c
@@ -8,8 +8,8 @@
 #include <common.h>
 #include <command.h>
 
-static int do_undefined(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	/*
 	 * 0xe7f...f.	is undefined in ARM mode
@@ -19,7 +19,7 @@
 	return CMD_RET_FAILURE;
 }
 
-static cmd_tbl_t cmd_sub[] = {
+static struct cmd_tbl cmd_sub[] = {
 	U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
 			 "", ""),
 };
diff --git a/cmd/armflash.c b/cmd/armflash.c
index 6872b0d..5e7315e 100644
--- a/cmd/armflash.c
+++ b/cmd/armflash.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <console.h>
+#include <flash.h>
 #include <asm/io.h>
 
 #define MAX_REGIONS 4
@@ -266,7 +267,7 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_afs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_afs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret = CMD_RET_SUCCESS;
 
diff --git a/cmd/avb.c b/cmd/avb.c
index a4de5c4..398ad3b 100644
--- a/cmd/avb.c
+++ b/cmd/avb.c
@@ -15,7 +15,7 @@
 #define AVB_BOOTARGS	"avb_bootargs"
 static struct AvbOps *avb_ops;
 
-int do_avb_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_avb_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long mmc_dev;
 
@@ -36,7 +36,8 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_read_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_avb_read_part(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	const char *part;
 	s64 offset;
@@ -68,7 +69,7 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_read_part_hex(cmd_tbl_t *cmdtp, int flag, int argc,
+int do_avb_read_part_hex(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	const char *part;
@@ -114,7 +115,8 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_write_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_avb_write_part(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	const char *part;
 	s64 offset;
@@ -145,7 +147,8 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_read_rb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_avb_read_rb(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	size_t index;
 	u64 rb_idx;
@@ -171,7 +174,8 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_write_rb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_avb_write_rb(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	size_t index;
 	u64 rb_idx;
@@ -196,8 +200,8 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_get_uuid(cmd_tbl_t *cmdtp, int flag,
-		    int argc, char * const argv[])
+int do_avb_get_uuid(struct cmd_tbl *cmdtp, int flag,
+		    int argc, char *const argv[])
 {
 	const char *part;
 	char buffer[UUID_STR_LEN + 1];
@@ -224,7 +228,7 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_verify_part(cmd_tbl_t *cmdtp, int flag,
+int do_avb_verify_part(struct cmd_tbl *cmdtp, int flag,
 		       int argc, char *const argv[])
 {
 	const char * const requested_partitions[] = {"boot", NULL};
@@ -315,8 +319,8 @@
 	return res;
 }
 
-int do_avb_is_unlocked(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+int do_avb_is_unlocked(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
 	bool unlock;
 
@@ -341,8 +345,8 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_read_pvalue(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+int do_avb_read_pvalue(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	const char *name;
 	size_t bytes;
@@ -382,8 +386,8 @@
 	return CMD_RET_FAILURE;
 }
 
-int do_avb_write_pvalue(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+int do_avb_write_pvalue(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	const char *name;
 	const char *value;
@@ -411,7 +415,7 @@
 	return CMD_RET_FAILURE;
 }
 
-static cmd_tbl_t cmd_avb[] = {
+static struct cmd_tbl cmd_avb[] = {
 	U_BOOT_CMD_MKENT(init, 2, 0, do_avb_init, "", ""),
 	U_BOOT_CMD_MKENT(read_rb, 2, 0, do_avb_read_rb, "", ""),
 	U_BOOT_CMD_MKENT(write_rb, 3, 0, do_avb_write_rb, "", ""),
@@ -427,9 +431,9 @@
 #endif
 };
 
-static int do_avb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_avb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	cp = find_cmd_tbl(argv[1], cmd_avb, ARRAY_SIZE(cmd_avb));
 
diff --git a/cmd/axi.c b/cmd/axi.c
index 588098f..c9d53c0 100644
--- a/cmd/axi.c
+++ b/cmd/axi.c
@@ -14,6 +14,7 @@
 #include <command.h>
 #include <console.h>
 #include <dm.h>
+#include <log.h>
 
 /* Currently selected AXI bus device */
 static struct udevice *axi_cur_bus;
@@ -96,8 +97,8 @@
  * Command handlers
  */
 
-static int do_axi_show_bus(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_axi_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	struct udevice *dummy;
 
@@ -135,8 +136,8 @@
 	return 0;
 }
 
-static int do_axi_bus_num(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_axi_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	int ret = 0;
 	int bus_no;
@@ -163,7 +164,8 @@
 	return ret ? CMD_RET_FAILURE : 0;
 }
 
-static int do_axi_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_axi_md(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	/* Print that many bytes per line */
 	const uint DISP_LINE_LEN = 16;
@@ -261,7 +263,8 @@
 	return 0;
 }
 
-static int do_axi_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_axi_mw(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	u32 writeval;
 	ulong addr, count, size;
@@ -312,17 +315,17 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_axi_sub[] = {
+static struct cmd_tbl cmd_axi_sub[] = {
 	U_BOOT_CMD_MKENT(bus, 1, 1, do_axi_show_bus, "", ""),
 	U_BOOT_CMD_MKENT(dev, 1, 1, do_axi_bus_num, "", ""),
 	U_BOOT_CMD_MKENT(md, 4, 1, do_axi_md, "", ""),
 	U_BOOT_CMD_MKENT(mw, 5, 1, do_axi_mw, "", ""),
 };
 
-static int do_ihs_axi(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_ihs_axi(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/bcb.c b/cmd/bcb.c
index 9626f2c..e032180 100644
--- a/cmd/bcb.c
+++ b/cmd/bcb.c
@@ -8,6 +8,8 @@
 #include <android_bootloader_message.h>
 #include <command.h>
 #include <common.h>
+#include <log.h>
+#include <part.h>
 
 enum bcb_cmd {
 	BCB_CMD_LOAD,
@@ -108,11 +110,11 @@
 	return 0;
 }
 
-static int do_bcb_load(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_bcb_load(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct blk_desc *desc;
-	disk_partition_t info;
+	struct disk_partition info;
 	u64 cnt;
 	char *endp;
 	int part, ret;
@@ -161,8 +163,8 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_bcb_set(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_bcb_set(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int size, len;
 	char *field, *str, *found;
@@ -188,8 +190,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_bcb_clear(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_bcb_clear(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	int size;
 	char *field;
@@ -207,8 +209,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_bcb_test(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_bcb_test(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	int size;
 	char *field;
@@ -234,8 +236,8 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_bcb_dump(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_bcb_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	int size;
 	char *field;
@@ -248,11 +250,11 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_bcb_store(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_bcb_store(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	struct blk_desc *desc;
-	disk_partition_t info;
+	struct disk_partition info;
 	u64 cnt;
 	int ret;
 
@@ -280,7 +282,7 @@
 	return CMD_RET_FAILURE;
 }
 
-static cmd_tbl_t cmd_bcb_sub[] = {
+static struct cmd_tbl cmd_bcb_sub[] = {
 	U_BOOT_CMD_MKENT(load, CONFIG_SYS_MAXARGS, 1, do_bcb_load, "", ""),
 	U_BOOT_CMD_MKENT(set, CONFIG_SYS_MAXARGS, 1, do_bcb_set, "", ""),
 	U_BOOT_CMD_MKENT(clear, CONFIG_SYS_MAXARGS, 1, do_bcb_clear, "", ""),
@@ -289,9 +291,9 @@
 	U_BOOT_CMD_MKENT(store, CONFIG_SYS_MAXARGS, 1, do_bcb_store, "", ""),
 };
 
-static int do_bcb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_bcb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 9edcf8d..dba552b 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -10,7 +10,9 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <net.h>
 #include <vsprintf.h>
+#include <asm/cache.h>
 #include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -175,7 +177,7 @@
 	/* Please define board_detail() for your platform */
 }
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -220,7 +222,7 @@
 
 #elif defined(CONFIG_NIOS2)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -241,7 +243,7 @@
 
 #elif defined(CONFIG_MICROBLAZE)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -267,7 +269,7 @@
 
 #elif defined(CONFIG_M68K)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -299,7 +301,7 @@
 
 #elif defined(CONFIG_MIPS)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	print_std_bdinfo(gd->bd);
 	print_num("relocaddr", gd->relocaddr);
@@ -311,8 +313,8 @@
 
 #elif defined(CONFIG_ARM)
 
-static int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -372,7 +374,7 @@
 
 #elif defined(CONFIG_SH)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -387,7 +389,7 @@
 
 #elif defined(CONFIG_X86)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -409,7 +411,7 @@
 
 #elif defined(CONFIG_SANDBOX)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -427,7 +429,7 @@
 
 #elif defined(CONFIG_NDS32)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -443,7 +445,7 @@
 
 #elif defined(CONFIG_RISCV)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -460,7 +462,7 @@
 
 #elif defined(CONFIG_ARC)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	bd_t *bd = gd->bd;
 
@@ -474,7 +476,7 @@
 
 #elif defined(CONFIG_XTENSA)
 
-int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	print_std_bdinfo(gd->bd);
 	return 0;
diff --git a/cmd/bedbug.c b/cmd/bedbug.c
index d3e3121..81ce256 100644
--- a/cmd/bedbug.c
+++ b/cmd/bedbug.c
@@ -6,6 +6,7 @@
 #include <cli.h>
 #include <command.h>
 #include <console.h>
+#include <asm/ptrace.h>
 #include <linux/ctype.h>
 #include <net.h>
 #include <bedbug/type.h>
@@ -56,7 +57,8 @@
  * Entry point from the interpreter to the disassembler.  Repeated calls
  * will resume from the last disassembled address.
  * ====================================================================== */
-int do_bedbug_dis (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_dis(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
 {
 	ulong addr;		/* Address to start disassembly from    */
 	ulong len;		/* # of instructions to disassemble     */
@@ -96,7 +98,8 @@
  * instructions in consecutive memory locations until a '.' (period) is
  * entered on a line by itself.
  * ====================================================================== */
-int do_bedbug_asm (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_asm(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
 {
 	long mem_addr;		/* Address to assemble into     */
 	unsigned long instr;	/* Machine code for text        */
@@ -146,7 +149,8 @@
  * CPU-specific break point set routine.
  * ====================================================================== */
 
-int do_bedbug_break (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_break(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	/* -------------------------------------------------- */
 	if (bug_ctx.do_break)
@@ -242,7 +246,8 @@
  * stopped flag in the context so that the breakpoint routine will
  * return.
  * ====================================================================== */
-int do_bedbug_continue (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_continue(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	/* -------------------------------------------------- */
 
@@ -265,7 +270,8 @@
  * the address passes control to the CPU-specific set breakpoint routine
  * for the current breakpoint number.
  * ====================================================================== */
-int do_bedbug_step (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_step(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	unsigned long addr;	/* Address to stop at */
 
@@ -296,7 +302,8 @@
  * the address passes control to the CPU-specific set breakpoint routine
  * for the current breakpoint number.
  * ====================================================================== */
-int do_bedbug_next (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_next(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	unsigned long addr;	/* Address to stop at */
 
@@ -325,7 +332,8 @@
  * Interpreter command to print the current stack.  This assumes an EABI
  * architecture, so it starts with GPR R1 and works back up the stack.
  * ====================================================================== */
-int do_bedbug_stack (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_stack(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	unsigned long sp;	/* Stack pointer                */
 	unsigned long func;	/* LR from stack                */
@@ -370,7 +378,8 @@
  * Interpreter command to dump the registers.  Calls the CPU-specific
  * show registers routine.
  * ====================================================================== */
-int do_bedbug_rdump (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_bedbug_rdump(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	/* -------------------------------------------------- */
 
diff --git a/cmd/bind.c b/cmd/bind.c
index 44a5f17..068b139 100644
--- a/cmd/bind.c
+++ b/cmd/bind.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
@@ -194,8 +195,8 @@
 	return 0;
 }
 
-static int do_bind_unbind(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_bind_unbind(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	int ret = 0;
 	bool bind;
diff --git a/cmd/binop.c b/cmd/binop.c
index 6d2df5f..c85cb51 100644
--- a/cmd/binop.c
+++ b/cmd/binop.c
@@ -64,7 +64,8 @@
 	unmap_sysmem(buf);
 }
 
-static int do_binop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_binop(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	ulong len;
 	u8 *result, *src1, *src2;
diff --git a/cmd/blk_common.c b/cmd/blk_common.c
index cc6e161..87f94b5 100644
--- a/cmd/blk_common.c
+++ b/cmd/blk_common.c
@@ -10,8 +10,9 @@
 
 #include <common.h>
 #include <blk.h>
+#include <command.h>
 
-int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
+int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
 		   int *cur_devnump)
 {
 	const char *if_name = blk_get_if_type_name(if_type);
diff --git a/cmd/blkcache.c b/cmd/blkcache.c
index 2cc65a9..25f252e 100644
--- a/cmd/blkcache.c
+++ b/cmd/blkcache.c
@@ -4,13 +4,14 @@
  * Author: Eric Nelson<eric@nelint.com>
  *
  */
+#include <command.h>
 #include <config.h>
 #include <common.h>
 #include <malloc.h>
 #include <part.h>
 
-static int blkc_show(cmd_tbl_t *cmdtp, int flag,
-		     int argc, char * const argv[])
+static int blkc_show(struct cmd_tbl *cmdtp, int flag,
+		     int argc, char *const argv[])
 {
 	struct block_cache_stats stats;
 	blkcache_stats(&stats);
@@ -25,8 +26,8 @@
 	return 0;
 }
 
-static int blkc_configure(cmd_tbl_t *cmdtp, int flag,
-			  int argc, char * const argv[])
+static int blkc_configure(struct cmd_tbl *cmdtp, int flag,
+			  int argc, char *const argv[])
 {
 	unsigned blocks_per_entry, max_entries;
 	if (argc != 3)
@@ -40,7 +41,7 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_blkc_sub[] = {
+static struct cmd_tbl cmd_blkc_sub[] = {
 	U_BOOT_CMD_MKENT(show, 0, 0, blkc_show, "", ""),
 	U_BOOT_CMD_MKENT(configure, 3, 0, blkc_configure, "", ""),
 };
@@ -55,10 +56,10 @@
 	};
 }
 
-static int do_blkcache(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+static int do_blkcache(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	blkc_reloc();
diff --git a/cmd/blob.c b/cmd/blob.c
index 80478b8..c80e697 100644
--- a/cmd/blob.c
+++ b/cmd/blob.c
@@ -48,7 +48,8 @@
  * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
  * on error.
  */
-static int do_blob(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_blob(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	ulong key_addr, src_addr, dst_addr, len;
 	uint8_t *km_ptr, *src_ptr, *dst_ptr;
diff --git a/cmd/bmp.c b/cmd/bmp.c
index edf4f56..6040fa5 100644
--- a/cmd/bmp.c
+++ b/cmd/bmp.c
@@ -15,6 +15,7 @@
 #include <gzip.h>
 #include <image.h>
 #include <lcd.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <splash.h>
@@ -91,7 +92,8 @@
 }
 #endif
 
-static int do_bmp_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_bmp_info(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	ulong addr;
 
@@ -109,7 +111,8 @@
 	return (bmp_info(addr));
 }
 
-static int do_bmp_display(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_bmp_display(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	ulong addr;
 	int x = 0, y = 0;
@@ -141,7 +144,7 @@
 	 return (bmp_display(addr, x, y));
 }
 
-static cmd_tbl_t cmd_bmp_sub[] = {
+static struct cmd_tbl cmd_bmp_sub[] = {
 	U_BOOT_CMD_MKENT(info, 3, 0, do_bmp_info, "", ""),
 	U_BOOT_CMD_MKENT(display, 5, 0, do_bmp_display, "", ""),
 };
@@ -162,9 +165,9 @@
  * Return:      None
  *
  */
-static int do_bmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_bmp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	/* Strip off leading 'bmp' command argument */
 	argc--;
diff --git a/cmd/boot.c b/cmd/boot.c
index 9150fce..36aba22 100644
--- a/cmd/boot.c
+++ b/cmd/boot.c
@@ -16,12 +16,12 @@
 /* Allow ports to override the default behavior */
 __attribute__((weak))
 unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
-				 char * const argv[])
+				 char *const argv[])
 {
 	return entry (argc, argv);
 }
 
-static int do_go(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_go(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong	addr, rc;
 	int     rcode = 0;
diff --git a/cmd/bootcount.c b/cmd/bootcount.c
index c358418..654bbb8 100644
--- a/cmd/bootcount.c
+++ b/cmd/bootcount.c
@@ -4,15 +4,15 @@
 #include <command.h>
 #include <bootcount.h>
 
-static int do_bootcount_print(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_bootcount_print(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	printf("%lu\n", bootcount_load());
 	return CMD_RET_SUCCESS;
 }
 
-static int do_bootcount_reset(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_bootcount_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	/*
 	 * note that we're explicitly not resetting the environment
@@ -22,15 +22,15 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t bootcount_sub[] = {
+static struct cmd_tbl bootcount_sub[] = {
 	U_BOOT_CMD_MKENT(print, 1, 1, do_bootcount_print, "", ""),
 	U_BOOT_CMD_MKENT(reset, 1, 1, do_bootcount_reset, "", ""),
 };
 
-static int do_bootcount(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_bootcount(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 9849eb4..0f6d0f7 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -13,6 +13,7 @@
 #include <efi_selftest.h>
 #include <env.h>
 #include <errno.h>
+#include <image.h>
 #include <malloc.h>
 #include <linux/libfdt.h>
 #include <linux/libfdt_env.h>
@@ -594,7 +595,8 @@
  * @argv:	command line arguments
  * Return:	status code
  */
-static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_bootefi(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	efi_status_t ret;
 	void *fdt;
diff --git a/cmd/booti.c b/cmd/booti.c
index 4fff8cf..ae37975 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -10,6 +10,7 @@
 #include <image.h>
 #include <irq_func.h>
 #include <lmb.h>
+#include <log.h>
 #include <mapmem.h>
 #include <linux/kernel.h>
 #include <linux/sizes.h>
@@ -18,8 +19,8 @@
 /*
  * Image booting support
  */
-static int booti_start(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[], bootm_headers_t *images)
+static int booti_start(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[], bootm_headers_t *images)
 {
 	int ret;
 	ulong ld;
@@ -98,7 +99,7 @@
 	return 0;
 }
 
-int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_booti(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 
diff --git a/cmd/bootm.c b/cmd/bootm.c
index 931d53f..d5f877c 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -34,12 +34,13 @@
 #endif
 
 #if defined(CONFIG_CMD_IMLS) || defined(CONFIG_CMD_IMLS_NAND)
-static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+static int do_imls(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[]);
 #endif
 
 /* we overload the cmd field with our state machine info instead of a
  * function pointer */
-static cmd_tbl_t cmd_bootm_sub[] = {
+static struct cmd_tbl cmd_bootm_sub[] = {
 	U_BOOT_CMD_MKENT(start, 0, 1, (void *)BOOTM_STATE_START, "", ""),
 	U_BOOT_CMD_MKENT(loados, 0, 1, (void *)BOOTM_STATE_LOADOS, "", ""),
 #ifdef CONFIG_SYS_BOOT_RAMDISK_HIGH
@@ -55,12 +56,12 @@
 	U_BOOT_CMD_MKENT(go, 0, 1, (void *)BOOTM_STATE_OS_GO, "", ""),
 };
 
-static int do_bootm_subcommand(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_bootm_subcommand(struct cmd_tbl *cmdtp, int flag, int argc,
+			       char *const argv[])
 {
 	int ret = 0;
 	long state;
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	c = find_cmd_tbl(argv[0], &cmd_bootm_sub[0], ARRAY_SIZE(cmd_bootm_sub));
 	argc--; argv++;
@@ -89,7 +90,7 @@
 /* bootm - boot application image from image in memory */
 /*******************************************************************/
 
-int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	static int relocated = 0;
@@ -136,7 +137,7 @@
 		BOOTM_STATE_OS_GO, &images, 1);
 }
 
-int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
+int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
 {
 	const char *ep = env_get("autostart");
 
@@ -201,7 +202,7 @@
 /* bootd - boot default image */
 /*******************************************************************/
 #if defined(CONFIG_CMD_BOOTD)
-int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return run_command(env_get("bootcmd"), flag);
 }
@@ -226,7 +227,8 @@
 /* iminfo - print header info for a requested image */
 /*******************************************************************/
 #if defined(CONFIG_CMD_IMI)
-static int do_iminfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_iminfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	int	arg;
 	ulong	addr;
@@ -519,7 +521,8 @@
 #endif
 
 #if defined(CONFIG_CMD_IMLS) || defined(CONFIG_CMD_IMLS_NAND)
-static int do_imls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_imls(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	int ret_nor = 0, ret_nand = 0;
 
diff --git a/cmd/bootmenu.c b/cmd/bootmenu.c
index 6af0617..18efe25 100644
--- a/cmd/bootmenu.c
+++ b/cmd/bootmenu.c
@@ -7,9 +7,11 @@
 #include <command.h>
 #include <ansi.h>
 #include <env.h>
+#include <log.h>
 #include <menu.h>
 #include <watchdog.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include <linux/string.h>
 
 /* maximum bootmenu entries */
@@ -482,7 +484,7 @@
 }
 #endif
 
-int do_bootmenu(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_bootmenu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *delay_str = NULL;
 	int delay = 10;
diff --git a/cmd/bootstage.c b/cmd/bootstage.c
index ed0b0ff..0e623f2 100644
--- a/cmd/bootstage.c
+++ b/cmd/bootstage.c
@@ -4,16 +4,18 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
+#include <command.h>
 
-static int do_bootstage_report(cmd_tbl_t *cmdtp, int flag, int argc,
-			       char * const argv[])
+static int do_bootstage_report(struct cmd_tbl *cmdtp, int flag, int argc,
+			       char *const argv[])
 {
 	bootstage_report();
 
 	return 0;
 }
 
-static int get_base_size(int argc, char * const argv[], ulong *basep,
+static int get_base_size(int argc, char *const argv[], ulong *basep,
 			 ulong *sizep)
 {
 	char *endp;
@@ -34,8 +36,8 @@
 	return 0;
 }
 
-static int do_bootstage_stash(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_bootstage_stash(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	ulong base, size;
 	int ret;
@@ -57,7 +59,7 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_bootstage_sub[] = {
+static struct cmd_tbl cmd_bootstage_sub[] = {
 	U_BOOT_CMD_MKENT(report, 2, 1, do_bootstage_report, "", ""),
 	U_BOOT_CMD_MKENT(stash, 4, 0, do_bootstage_stash, "", ""),
 	U_BOOT_CMD_MKENT(unstash, 4, 0, do_bootstage_stash, "", ""),
@@ -66,10 +68,10 @@
 /*
  * Process a bootstage sub-command
  */
-static int do_boostage(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_boostage(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	/* Strip off leading 'bootstage' command argument */
 	argc--;
diff --git a/cmd/bootz.c b/cmd/bootz.c
index f14a5fe..bc15fd8e 100644
--- a/cmd/bootz.c
+++ b/cmd/bootz.c
@@ -10,6 +10,7 @@
 #include <image.h>
 #include <irq_func.h>
 #include <lmb.h>
+#include <log.h>
 #include <linux/compiler.h>
 
 int __weak bootz_setup(ulong image, ulong *start, ulong *end)
@@ -23,8 +24,8 @@
 /*
  * zImage booting support
  */
-static int bootz_start(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[], bootm_headers_t *images)
+static int bootz_start(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[], bootm_headers_t *images)
 {
 	int ret;
 	ulong zi_start, zi_end;
@@ -59,7 +60,7 @@
 	return 0;
 }
 
-int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 
diff --git a/cmd/btrfs.c b/cmd/btrfs.c
index faa1239..7e3cbe1 100644
--- a/cmd/btrfs.c
+++ b/cmd/btrfs.c
@@ -8,7 +8,7 @@
 #include <btrfs.h>
 #include <fs.h>
 
-int do_btrsubvol(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_btrsubvol(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc != 3)
 		return CMD_RET_USAGE;
diff --git a/cmd/cache.c b/cmd/cache.c
index 7678615..b68d45b 100644
--- a/cmd/cache.c
+++ b/cmd/cache.c
@@ -24,7 +24,8 @@
 {
 }
 
-static int do_icache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_icache(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	switch (argc) {
 	case 2:			/* on / off / flush */
@@ -58,7 +59,8 @@
 	/* please define arch specific flush_dcache_all */
 }
 
-static int do_dcache(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dcache(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	switch (argc) {
 	case 2:			/* on / off / flush */
diff --git a/cmd/cbfs.c b/cmd/cbfs.c
index 98e652a..8e91d4b 100644
--- a/cmd/cbfs.c
+++ b/cmd/cbfs.c
@@ -11,7 +11,7 @@
 #include <env.h>
 #include <cbfs.h>
 
-static int do_cbfs_init(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_cbfs_init(struct cmd_tbl *cmdtp, int flag, int argc,
 			char *const argv[])
 {
 	uintptr_t end_of_rom = 0xffffffff;
@@ -45,7 +45,7 @@
 	"      CBFS is in. It defaults to 0xFFFFFFFF\n"
 );
 
-static int do_cbfs_fsload(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_cbfs_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
 			  char *const argv[])
 {
 	const struct cbfs_cachenode *file;
@@ -92,7 +92,7 @@
 	"    - load binary file 'filename' from the cbfs to address 'addr'\n"
 );
 
-static int do_cbfs_ls(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_cbfs_ls(struct cmd_tbl *cmdtp, int flag, int argc,
 		      char *const argv[])
 {
 	const struct cbfs_cachenode *file = file_cbfs_get_first();
@@ -201,7 +201,7 @@
 	"    - list the files in the cbfs\n"
 );
 
-static int do_cbfs_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_cbfs_fsinfo(struct cmd_tbl *cmdtp, int flag, int argc,
 			  char *const argv[])
 {
 	const struct cbfs_header *header = file_cbfs_get_header();
diff --git a/cmd/clk.c b/cmd/clk.c
index 74ad868..439736d 100644
--- a/cmd/clk.c
+++ b/cmd/clk.c
@@ -72,7 +72,7 @@
 }
 #endif
 
-static int do_clk_dump(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_clk_dump(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	int ret;
@@ -86,14 +86,14 @@
 	return ret;
 }
 
-static cmd_tbl_t cmd_clk_sub[] = {
+static struct cmd_tbl cmd_clk_sub[] = {
 	U_BOOT_CMD_MKENT(dump, 1, 1, do_clk_dump, "", ""),
 };
 
-static int do_clk(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_clk(struct cmd_tbl *cmdtp, int flag, int argc,
 		  char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/cls.c b/cmd/cls.c
index f1ce6e8..eab4e69 100644
--- a/cmd/cls.c
+++ b/cmd/cls.c
@@ -11,7 +11,7 @@
 #include <lcd.h>
 #include <video.h>
 
-static int do_video_clear(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_video_clear(struct cmd_tbl *cmdtp, int flag, int argc,
 			  char *const argv[])
 {
 #if defined(CONFIG_DM_VIDEO)
diff --git a/cmd/config.c b/cmd/config.c
index d2810d5..cf30841 100644
--- a/cmd/config.c
+++ b/cmd/config.c
@@ -11,7 +11,8 @@
 #include "config_data_gz.h"
 #include "config_data_size.h"
 
-static int do_config(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_config(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	char *dst;
 	unsigned long len = data_size;
diff --git a/cmd/conitrace.c b/cmd/conitrace.c
index 85c5422..88850db 100644
--- a/cmd/conitrace.c
+++ b/cmd/conitrace.c
@@ -7,9 +7,10 @@
  */
 #include <common.h>
 #include <command.h>
+#include <linux/delay.h>
 
-static int do_conitrace(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_conitrace(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	bool first = true;
 
diff --git a/cmd/console.c b/cmd/console.c
index 3f1d98b..9a1db83 100644
--- a/cmd/console.c
+++ b/cmd/console.c
@@ -12,7 +12,8 @@
 #include <stdio_dev.h>
 
 extern void _do_coninfo (void);
-static int do_coninfo(cmd_tbl_t *cmd, int flag, int argc, char * const argv[])
+static int do_coninfo(struct cmd_tbl *cmd, int flag, int argc,
+		      char *const argv[])
 {
 	int l;
 	struct list_head *list = stdio_get_list();
diff --git a/cmd/cpu.c b/cmd/cpu.c
index 8c0abc1..ff553c1 100644
--- a/cmd/cpu.c
+++ b/cmd/cpu.c
@@ -64,7 +64,7 @@
 	return 0;
 }
 
-static int do_cpu_list(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_cpu_list(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	if (print_cpu_list(false))
@@ -73,7 +73,7 @@
 	return 0;
 }
 
-static int do_cpu_detail(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_cpu_detail(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	if (print_cpu_list(true))
@@ -82,7 +82,7 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_cpu_sub[] = {
+static struct cmd_tbl cmd_cpu_sub[] = {
 	U_BOOT_CMD_MKENT(list, 2, 1, do_cpu_list, "", ""),
 	U_BOOT_CMD_MKENT(detail, 4, 0, do_cpu_detail, "", ""),
 };
@@ -90,10 +90,10 @@
 /*
  * Process a cpu sub-command
  */
-static int do_cpu(cmd_tbl_t *cmdtp, int flag, int argc,
-		  char * const argv[])
+static int do_cpu(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
 {
-	cmd_tbl_t *c = NULL;
+	struct cmd_tbl *c = NULL;
 
 	/* Strip off leading 'cpu' command argument */
 	argc--;
diff --git a/cmd/cramfs.c b/cmd/cramfs.c
index ad232de..1aeb567 100644
--- a/cmd/cramfs.c
+++ b/cmd/cramfs.c
@@ -94,7 +94,8 @@
  * @param argv arguments list
  * @return 0 on success, 1 otherwise
  */
-int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cramfs_load(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	char *filename;
 	int size;
@@ -162,7 +163,7 @@
  * @param argv arguments list
  * @return 0 on success, 1 otherwise
  */
-int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cramfs_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename = "/";
 	int ret;
diff --git a/cmd/cros_ec.c b/cmd/cros_ec.c
index 9e2f1b0..ce1f59a 100644
--- a/cmd/cros_ec.c
+++ b/cmd/cros_ec.c
@@ -10,6 +10,8 @@
 #include <command.h>
 #include <cros_ec.h>
 #include <dm.h>
+#include <flash.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
 
@@ -23,7 +25,7 @@
  * @param argv List of remaining parameters
  * @return flash region (EC_FLASH_REGION_...) or -1 on error
  */
-static int cros_ec_decode_region(int argc, char * const argv[])
+static int cros_ec_decode_region(int argc, char *const argv[])
 {
 	if (argc > 0) {
 		if (0 == strcmp(*argv, "rw"))
@@ -50,7 +52,7 @@
  *	(negative EC_RES_...)
  */
 static int do_read_write(struct udevice *dev, int is_write, int argc,
-			 char * const argv[])
+			 char *const argv[])
 {
 	uint32_t offset, size = -1U, region_size;
 	unsigned long addr;
@@ -92,7 +94,8 @@
 	return 0;
 }
 
-static int do_cros_ec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_cros_ec(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct udevice *dev;
 	const char *cmd;
diff --git a/cmd/dataflash_mmc_mux.c b/cmd/dataflash_mmc_mux.c
index 9f271b6..73876e9 100644
--- a/cmd/dataflash_mmc_mux.c
+++ b/cmd/dataflash_mmc_mux.c
@@ -9,7 +9,8 @@
 
 static int mmc_nspi (const char *);
 
-int do_dataflash_mmc_mux (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_dataflash_mmc_mux(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	switch (argc) {
 	case 2:			/* on / off	*/
diff --git a/cmd/date.c b/cmd/date.c
index 7fa950a..75a032c 100644
--- a/cmd/date.c
+++ b/cmd/date.c
@@ -29,7 +29,8 @@
 
 static struct rtc_time default_tm = { 0, 0, 0, 1, 1, 2000, 6, 0, 0 };
 
-static int do_date(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_date(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct rtc_time tm;
 	int rcode = 0;
diff --git a/cmd/demo.c b/cmd/demo.c
index 52c6e7e..9da06f5 100644
--- a/cmd/demo.c
+++ b/cmd/demo.c
@@ -7,14 +7,15 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm-demo.h>
 #include <mapmem.h>
 #include <asm/io.h>
 
 struct udevice *demo_dev;
 
-static int do_demo_hello(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_demo_hello(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	int ch = 0;
 
@@ -24,8 +25,8 @@
 	return demo_hello(demo_dev, ch);
 }
 
-static int do_demo_status(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_demo_status(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	int status;
 	int ret;
@@ -39,8 +40,8 @@
 	return 0;
 }
 
-static int do_demo_light(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_demo_light(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	int light;
 	int ret;
@@ -59,7 +60,7 @@
 	return ret;
 }
 
-int do_demo_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_demo_list(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct udevice *dev;
 	int i, ret;
@@ -78,16 +79,17 @@
 	return cmd_process_error(cmdtp, ret);
 }
 
-static cmd_tbl_t demo_commands[] = {
+static struct cmd_tbl demo_commands[] = {
 	U_BOOT_CMD_MKENT(list, 0, 1, do_demo_list, "", ""),
 	U_BOOT_CMD_MKENT(hello, 2, 1, do_demo_hello, "", ""),
 	U_BOOT_CMD_MKENT(light, 2, 1, do_demo_light, "", ""),
 	U_BOOT_CMD_MKENT(status, 1, 1, do_demo_status, "", ""),
 };
 
-static int do_demo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_demo(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
-	cmd_tbl_t *demo_cmd;
+	struct cmd_tbl *demo_cmd;
 	int devnum = 0;
 	int ret;
 
diff --git a/cmd/dfu.c b/cmd/dfu.c
index b30f8a5..7310595 100644
--- a/cmd/dfu.c
+++ b/cmd/dfu.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <watchdog.h>
 #include <dfu.h>
 #include <console.h>
@@ -18,7 +19,7 @@
 #include <usb.h>
 #include <net.h>
 
-static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dfu(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 
 	if (argc < 2)
diff --git a/cmd/diag.c b/cmd/diag.c
index 8d21c7d..f51536d 100644
--- a/cmd/diag.c
+++ b/cmd/diag.c
@@ -11,7 +11,7 @@
 #include <command.h>
 #include <post.h>
 
-int do_diag (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_diag(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned int i;
 
diff --git a/cmd/disk.c b/cmd/disk.c
index 15973b7..8060e75 100644
--- a/cmd/disk.c
+++ b/cmd/disk.c
@@ -4,19 +4,21 @@
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  */
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <cpu_func.h>
 #include <image.h>
+#include <log.h>
 #include <part.h>
 
-int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
+int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
 		    char *const argv[])
 {
 	__maybe_unused int dev;
 	int part;
 	ulong addr = CONFIG_SYS_LOAD_ADDR;
 	ulong cnt;
-	disk_partition_t info;
+	struct disk_partition info;
 #if defined(CONFIG_LEGACY_IMAGE_FORMAT)
 	image_header_t *hdr;
 #endif
diff --git a/cmd/dm.c b/cmd/dm.c
index 7a90685..4e307ac 100644
--- a/cmd/dm.c
+++ b/cmd/dm.c
@@ -16,39 +16,39 @@
 #include <dm/root.h>
 #include <dm/util.h>
 
-static int do_dm_dump_all(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_dm_dump_all(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	dm_dump_all();
 
 	return 0;
 }
 
-static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int argc,
-			     char * const argv[])
+static int do_dm_dump_uclass(struct cmd_tbl *cmdtp, int flag, int argc,
+			     char *const argv[])
 {
 	dm_dump_uclass();
 
 	return 0;
 }
 
-static int do_dm_dump_devres(cmd_tbl_t *cmdtp, int flag, int argc,
-			     char * const argv[])
+static int do_dm_dump_devres(struct cmd_tbl *cmdtp, int flag, int argc,
+			     char *const argv[])
 {
 	dm_dump_devres();
 
 	return 0;
 }
 
-static int do_dm_dump_drivers(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_dm_dump_drivers(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	dm_dump_drivers();
 
 	return 0;
 }
 
-static cmd_tbl_t test_commands[] = {
+static struct cmd_tbl test_commands[] = {
 	U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""),
 	U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""),
 	U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""),
@@ -65,9 +65,9 @@
 	}
 }
 
-static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *test_cmd;
+	struct cmd_tbl *test_cmd;
 	int ret;
 
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
diff --git a/cmd/echo.c b/cmd/echo.c
index 5b018d9..d02a4cf 100644
--- a/cmd/echo.c
+++ b/cmd/echo.c
@@ -7,7 +7,8 @@
 #include <common.h>
 #include <command.h>
 
-static int do_echo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_echo(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	int i;
 	int putnl = 1;
diff --git a/cmd/eeprom.c b/cmd/eeprom.c
index 792415e..7fa62bb 100644
--- a/cmd/eeprom.c
+++ b/cmd/eeprom.c
@@ -25,6 +25,7 @@
 #include <eeprom.h>
 #include <i2c.h>
 #include <eeprom_layout.h>
+#include <linux/delay.h>
 
 #ifndef	CONFIG_SYS_I2C_SPEED
 #define	CONFIG_SYS_I2C_SPEED	50000
@@ -237,7 +238,7 @@
  * @returns:	number of arguments parsed or CMD_RET_USAGE if error
  */
 static int parse_i2c_bus_addr(int *i2c_bus, ulong *i2c_addr, int argc,
-			      char * const argv[], int argc_no_bus_addr)
+			      char *const argv[], int argc_no_bus_addr)
 {
 	int argc_no_bus = argc_no_bus_addr + 1;
 	int argc_bus_addr = argc_no_bus_addr + 2;
@@ -355,7 +356,7 @@
 }
 
 #define NEXT_PARAM(argc, index)	{ (argc)--; (index)++; }
-int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int layout_ver = LAYOUT_VERSION_AUTODETECT;
 	enum eeprom_action action = EEPROM_ACTION_INVALID;
diff --git a/cmd/efi.c b/cmd/efi.c
index ea239a0..9aeb913 100644
--- a/cmd/efi.c
+++ b/cmd/efi.c
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <efi.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <sort.h>
 
@@ -191,7 +192,8 @@
 		printf("*Some areas are merged (use 'all' to see)\n");
 }
 
-static int do_efi_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_efi_mem(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct efi_mem_desc *desc;
 	struct efi_entry_memmap *map;
@@ -231,13 +233,13 @@
 	return ret ? CMD_RET_FAILURE : 0;
 }
 
-static cmd_tbl_t efi_commands[] = {
+static struct cmd_tbl efi_commands[] = {
 	U_BOOT_CMD_MKENT(mem, 1, 1, do_efi_mem, "", ""),
 };
 
-static int do_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_efi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *efi_cmd;
+	struct cmd_tbl *efi_cmd;
 	int ret;
 
 	if (argc < 2)
diff --git a/cmd/efidebug.c b/cmd/efidebug.c
index f020d95..703dab0 100644
--- a/cmd/efidebug.c
+++ b/cmd/efidebug.c
@@ -11,6 +11,7 @@
 #include <efi_loader.h>
 #include <exports.h>
 #include <hexdump.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <search.h>
@@ -60,8 +61,8 @@
  * Implement efidebug "devices" sub-command.
  * Show all UEFI devices and their information.
  */
-static int do_efi_show_devices(cmd_tbl_t *cmdtp, int flag,
-			       int argc, char * const argv[])
+static int do_efi_show_devices(struct cmd_tbl *cmdtp, int flag,
+			       int argc, char *const argv[])
 {
 	efi_handle_t *handles;
 	efi_uintn_t num, i;
@@ -139,8 +140,8 @@
  * Implement efidebug "drivers" sub-command.
  * Show all UEFI drivers and their information.
  */
-static int do_efi_show_drivers(cmd_tbl_t *cmdtp, int flag,
-			       int argc, char * const argv[])
+static int do_efi_show_drivers(struct cmd_tbl *cmdtp, int flag,
+			       int argc, char *const argv[])
 {
 	efi_handle_t *handles;
 	efi_uintn_t num, i;
@@ -311,8 +312,8 @@
  * Show all UEFI handles and their information, currently all protocols
  * added to handle.
  */
-static int do_efi_show_handles(cmd_tbl_t *cmdtp, int flag,
-			       int argc, char * const argv[])
+static int do_efi_show_handles(struct cmd_tbl *cmdtp, int flag,
+			       int argc, char *const argv[])
 {
 	efi_handle_t *handles;
 	efi_guid_t **guid;
@@ -371,8 +372,8 @@
  * Implement efidebug "images" sub-command.
  * Show all UEFI loaded images and their information.
  */
-static int do_efi_show_images(cmd_tbl_t *cmdtp, int flag,
-			      int argc, char * const argv[])
+static int do_efi_show_images(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	efi_print_image_infos(NULL);
 
@@ -453,8 +454,8 @@
  * Implement efidebug "memmap" sub-command.
  * Show UEFI memory map.
  */
-static int do_efi_show_memmap(cmd_tbl_t *cmdtp, int flag,
-			      int argc, char * const argv[])
+static int do_efi_show_memmap(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	struct efi_mem_desc *memmap = NULL, *map;
 	efi_uintn_t map_size = 0;
@@ -521,8 +522,8 @@
  * Implement efidebug "tables" sub-command.
  * Show UEFI configuration tables.
  */
-static int do_efi_show_tables(cmd_tbl_t *cmdtp, int flag,
-			      int argc, char * const argv[])
+static int do_efi_show_tables(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	efi_uintn_t i;
 	const char *guid_str;
@@ -551,8 +552,8 @@
  *
  *     efidebug boot add <id> <label> <interface> <devnum>[:<part>] <file> <options>
  */
-static int do_efi_boot_add(cmd_tbl_t *cmdtp, int flag,
-			   int argc, char * const argv[])
+static int do_efi_boot_add(struct cmd_tbl *cmdtp, int flag,
+			   int argc, char *const argv[])
 {
 	int id;
 	char *endp;
@@ -650,8 +651,8 @@
  *
  *     efidebug boot rm <id> ...
  */
-static int do_efi_boot_rm(cmd_tbl_t *cmdtp, int flag,
-			  int argc, char * const argv[])
+static int do_efi_boot_rm(struct cmd_tbl *cmdtp, int flag,
+			  int argc, char *const argv[])
 {
 	efi_guid_t guid;
 	int id, i;
@@ -787,8 +788,8 @@
  *
  *     efidebug boot dump
  */
-static int do_efi_boot_dump(cmd_tbl_t *cmdtp, int flag,
-			    int argc, char * const argv[])
+static int do_efi_boot_dump(struct cmd_tbl *cmdtp, int flag,
+			    int argc, char *const argv[])
 {
 	u16 *var_name16, *p;
 	efi_uintn_t buf_size, size;
@@ -956,8 +957,8 @@
  *
  *     efidebug boot next <id>
  */
-static int do_efi_boot_next(cmd_tbl_t *cmdtp, int flag,
-			    int argc, char * const argv[])
+static int do_efi_boot_next(struct cmd_tbl *cmdtp, int flag,
+			    int argc, char *const argv[])
 {
 	u16 bootnext;
 	efi_uintn_t size;
@@ -1005,8 +1006,8 @@
  *
  *     efidebug boot order [<id> ...]
  */
-static int do_efi_boot_order(cmd_tbl_t *cmdtp, int flag,
-			     int argc, char * const argv[])
+static int do_efi_boot_order(struct cmd_tbl *cmdtp, int flag,
+			     int argc, char *const argv[])
 {
 	u16 *bootorder = NULL;
 	efi_uintn_t size;
@@ -1054,7 +1055,7 @@
 	return r;
 }
 
-static cmd_tbl_t cmd_efidebug_boot_sub[] = {
+static struct cmd_tbl cmd_efidebug_boot_sub[] = {
 	U_BOOT_CMD_MKENT(add, CONFIG_SYS_MAXARGS, 1, do_efi_boot_add, "", ""),
 	U_BOOT_CMD_MKENT(rm, CONFIG_SYS_MAXARGS, 1, do_efi_boot_rm, "", ""),
 	U_BOOT_CMD_MKENT(dump, CONFIG_SYS_MAXARGS, 1, do_efi_boot_dump, "", ""),
@@ -1075,10 +1076,10 @@
  *
  * Implement efidebug "boot" sub-command.
  */
-static int do_efi_boot_opt(cmd_tbl_t *cmdtp, int flag,
-			   int argc, char * const argv[])
+static int do_efi_boot_opt(struct cmd_tbl *cmdtp, int flag,
+			   int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
@@ -1108,7 +1109,7 @@
  *
  *     efidebug test bootmgr
  */
-static int do_efi_test_bootmgr(cmd_tbl_t *cmdtp, int flag,
+static int do_efi_test_bootmgr(struct cmd_tbl *cmdtp, int flag,
 			       int argc, char * const argv[])
 {
 	efi_handle_t image;
@@ -1130,7 +1131,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_efidebug_test_sub[] = {
+static struct cmd_tbl cmd_efidebug_test_sub[] = {
 	U_BOOT_CMD_MKENT(bootmgr, CONFIG_SYS_MAXARGS, 1, do_efi_test_bootmgr,
 			 "", ""),
 };
@@ -1147,10 +1148,10 @@
  *
  * Implement efidebug "test" sub-command.
  */
-static int do_efi_test(cmd_tbl_t *cmdtp, int flag,
+static int do_efi_test(struct cmd_tbl *cmdtp, int flag,
 		       int argc, char * const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
@@ -1178,7 +1179,7 @@
  * Implement efidebug "test" sub-command.
  */
 
-static int do_efi_query_info(cmd_tbl_t *cmdtp, int flag,
+static int do_efi_query_info(struct cmd_tbl *cmdtp, int flag,
 			     int argc, char * const argv[])
 {
 	efi_status_t ret;
@@ -1217,7 +1218,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_efidebug_sub[] = {
+static struct cmd_tbl cmd_efidebug_sub[] = {
 	U_BOOT_CMD_MKENT(boot, CONFIG_SYS_MAXARGS, 1, do_efi_boot_opt, "", ""),
 	U_BOOT_CMD_MKENT(devices, CONFIG_SYS_MAXARGS, 1, do_efi_show_devices,
 			 "", ""),
@@ -1250,10 +1251,10 @@
  * Implement efidebug command which allows us to display and
  * configure UEFI environment.
  */
-static int do_efidebug(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+static int do_efidebug(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 	efi_status_t r;
 
 	if (argc < 2)
diff --git a/cmd/elf.c b/cmd/elf.c
index 10e8264..d44b95d 100644
--- a/cmd/elf.c
+++ b/cmd/elf.c
@@ -10,17 +10,19 @@
 #include <elf.h>
 #include <env.h>
 #include <image.h>
+#include <log.h>
 #include <net.h>
 #include <vxworks.h>
 #ifdef CONFIG_X86
 #include <vbe.h>
+#include <asm/cache.h>
 #include <asm/e820.h>
 #include <linux/linkage.h>
 #endif
 
 /* Allow ports to override the default behavior */
 static unsigned long do_bootelf_exec(ulong (*entry)(int, char * const[]),
-				     int argc, char * const argv[])
+				     int argc, char *const argv[])
 {
 	unsigned long ret;
 
@@ -34,7 +36,7 @@
 }
 
 /* Interpreter command to boot an arbitrary ELF image from memory */
-int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long addr; /* Address of the ELF image */
 	unsigned long rc; /* Return value from user code */
@@ -90,7 +92,7 @@
  * be either an ELF image or a raw binary.  Will attempt to setup the
  * bootline and other parameters correctly.
  */
-int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long addr; /* Address of image */
 	unsigned long bootaddr = 0; /* Address to put the bootline */
diff --git a/cmd/ethsw.c b/cmd/ethsw.c
index 8d271ce..f8b8a79 100644
--- a/cmd/ethsw.c
+++ b/cmd/ethsw.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <env_flags.h>
 #include <ethsw.h>
+#include <net.h>
 
 static const char *ethsw_name;
 
@@ -999,7 +1000,7 @@
 }
 
 /* find all the keywords in the command */
-static int keywords_find(int argc, char * const argv[],
+static int keywords_find(int argc, char *const argv[],
 			 struct ethsw_command_def *parsed_cmd)
 {
 	int i;
@@ -1064,7 +1065,8 @@
 }
 
 /* function to interpret commands starting with "ethsw " */
-static int do_ethsw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ethsw(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	struct ethsw_command_def parsed_cmd;
 	int rc = CMD_RET_SUCCESS;
diff --git a/cmd/exit.c b/cmd/exit.c
index f40d068..7bf241e 100644
--- a/cmd/exit.c
+++ b/cmd/exit.c
@@ -7,7 +7,8 @@
 #include <common.h>
 #include <command.h>
 
-static int do_exit(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_exit(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	int r;
 
diff --git a/cmd/ext2.c b/cmd/ext2.c
index dc56ab2..57a9951 100644
--- a/cmd/ext2.c
+++ b/cmd/ext2.c
@@ -19,9 +19,12 @@
 /*
  * Ext2fs support
  */
+#include <common.h>
+#include <command.h>
 #include <fs.h>
 
-static int do_ext2ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ext2ls(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_EXT);
 }
@@ -29,7 +32,7 @@
 /******************************************************************************
  * Ext2fs boot command intepreter. Derived from diskboot
  */
-int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_EXT);
 }
diff --git a/cmd/ext4.c b/cmd/ext4.c
index d2fa7f1..4791b69 100644
--- a/cmd/ext4.c
+++ b/cmd/ext4.c
@@ -41,25 +41,23 @@
 #include <usb.h>
 #endif
 
-int do_ext4_size(cmd_tbl_t *cmdtp, int flag, int argc,
-						char *const argv[])
+int do_ext4_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return do_size(cmdtp, flag, argc, argv, FS_TYPE_EXT);
 }
 
-int do_ext4_load(cmd_tbl_t *cmdtp, int flag, int argc,
-						char *const argv[])
+int do_ext4_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_EXT);
 }
 
-int do_ext4_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ext4_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_EXT);
 }
 
 #if defined(CONFIG_CMD_EXT4_WRITE)
-int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
+int do_ext4_write(struct cmd_tbl *cmdtp, int flag, int argc,
 		  char *const argv[])
 {
 	return do_save(cmdtp, flag, argc, argv, FS_TYPE_EXT);
diff --git a/cmd/fastboot.c b/cmd/fastboot.c
index 1b42151..ad5c064 100644
--- a/cmd/fastboot.c
+++ b/cmd/fastboot.c
@@ -14,6 +14,7 @@
 #include <net.h>
 #include <usb.h>
 #include <watchdog.h>
+#include <linux/stringify.h>
 
 static int do_fastboot_udp(int argc, char *const argv[],
 			   uintptr_t buf_addr, size_t buf_size)
@@ -93,7 +94,8 @@
 #endif
 }
 
-static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_fastboot(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	uintptr_t buf_addr = (uintptr_t)NULL;
 	size_t buf_size = 0;
diff --git a/cmd/fat.c b/cmd/fat.c
index abce2f1..b438ce1 100644
--- a/cmd/fat.c
+++ b/cmd/fat.c
@@ -8,11 +8,14 @@
  * Boot support
  */
 #include <common.h>
+#include <command.h>
 #include <mapmem.h>
 #include <fat.h>
 #include <fs.h>
+#include <part.h>
+#include <asm/cache.h>
 
-int do_fat_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fat_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return do_size(cmdtp, flag, argc, argv, FS_TYPE_FAT);
 }
@@ -25,7 +28,7 @@
 	"      and determine its size."
 );
 
-int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fat_fsload(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_FAT);
 }
@@ -46,7 +49,8 @@
 	"      be printed and performance will suffer for the load."
 );
 
-static int do_fat_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_fat_ls(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_FAT);
 }
@@ -58,12 +62,12 @@
 	"    - list files from 'dev' on 'interface' in a 'directory'"
 );
 
-static int do_fat_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_fat_fsinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	int dev, part;
 	struct blk_desc *dev_desc;
-	disk_partition_t info;
+	struct disk_partition info;
 
 	if (argc < 2) {
 		printf("usage: fatinfo <interface> [<dev[:part]>]\n");
@@ -91,8 +95,8 @@
 );
 
 #ifdef CONFIG_FAT_WRITE
-static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
-		int argc, char * const argv[])
+static int do_fat_fswrite(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	loff_t size;
 	int ret;
@@ -100,7 +104,7 @@
 	unsigned long count;
 	long offset;
 	struct blk_desc *dev_desc = NULL;
-	disk_partition_t info;
+	struct disk_partition info;
 	int dev = 0;
 	int part = 1;
 	void *buf;
@@ -146,7 +150,8 @@
 	"      to 'dev' on 'interface'"
 );
 
-static int do_fat_rm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_fat_rm(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	return do_rm(cmdtp, flag, argc, argv, FS_TYPE_FAT);
 }
@@ -158,8 +163,8 @@
 	"    - delete a file from 'dev' on 'interface'"
 );
 
-static int do_fat_mkdir(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_fat_mkdir(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	return do_mkdir(cmdtp, flag, argc, argv, FS_TYPE_FAT);
 }
diff --git a/cmd/fdt.c b/cmd/fdt.c
index 36cc726..99b1b5b 100644
--- a/cmd/fdt.c
+++ b/cmd/fdt.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <image.h>
 #include <linux/ctype.h>
 #include <linux/types.h>
 #include <asm/global_data.h>
@@ -87,7 +88,7 @@
 	"size_dt_struct",
 };
 
-static int fdt_get_header_value(int argc, char * const argv[])
+static int fdt_get_header_value(int argc, char *const argv[])
 {
 	fdt32_t *fdtp = (fdt32_t *)working_fdt;
 	ulong val;
@@ -111,7 +112,7 @@
 /*
  * Flattened Device Tree command, see the help for parameter definitions.
  */
-static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/fitupd.c b/cmd/fitupd.c
index 1e5edd9..f6270d9 100644
--- a/cmd/fitupd.c
+++ b/cmd/fitupd.c
@@ -12,7 +12,8 @@
 #error "CONFIG_UPDATE_TFTP required"
 #endif
 
-static int do_fitupd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_fitupd(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	ulong addr = 0UL;
 
diff --git a/cmd/flash.c b/cmd/flash.c
index cd1758d..240871e 100644
--- a/cmd/flash.c
+++ b/cmd/flash.c
@@ -9,6 +9,8 @@
  */
 #include <common.h>
 #include <command.h>
+#include <log.h>
+#include <uuid.h>
 
 #if defined(CONFIG_CMD_MTDPARTS)
 #include <jffs2/jffs2.h>
@@ -88,7 +90,7 @@
 /*
  * Take *addr in Flash and adjust it to fall on the end of its sector
  */
-int flash_sect_roundb (ulong *addr)
+int flash_sect_roundb(ulong *addr)
 {
 	flash_info_t *info;
 	ulong bank, sector_end_addr;
@@ -268,7 +270,8 @@
 }
 #endif /* CONFIG_MTD_NOR_FLASH */
 
-static int do_flinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_flinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 #ifdef CONFIG_MTD_NOR_FLASH
 	ulong bank;
@@ -279,7 +282,7 @@
 		for (bank=0; bank <CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 			printf ("\nBank # %ld: ", bank+1);
 
-			flash_print_info (&flash_info[bank]);
+			flash_print_info(&flash_info[bank]);
 		}
 		return 0;
 	}
@@ -291,12 +294,13 @@
 		return 1;
 	}
 	printf ("\nBank # %ld: ", bank);
-	flash_print_info (&flash_info[bank-1]);
+	flash_print_info(&flash_info[bank - 1]);
 #endif /* CONFIG_MTD_NOR_FLASH */
 	return 0;
 }
 
-static int do_flerase(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_flerase(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 #ifdef CONFIG_MTD_NOR_FLASH
 	flash_info_t *info = NULL;
@@ -316,7 +320,7 @@
 		for (bank=1; bank<=CONFIG_SYS_MAX_FLASH_BANKS; ++bank) {
 			printf ("Erase Flash Bank # %ld ", bank);
 			info = &flash_info[bank-1];
-			rcode = flash_erase (info, 0, info->sector_count-1);
+			rcode = flash_erase(info, 0, info->sector_count - 1);
 		}
 		return rcode;
 	}
@@ -370,7 +374,7 @@
 		}
 		printf ("Erase Flash Bank # %ld ", bank);
 		info = &flash_info[bank-1];
-		rcode = flash_erase (info, 0, info->sector_count-1);
+		rcode = flash_erase(info, 0, info->sector_count - 1);
 		return rcode;
 	}
 
@@ -390,7 +394,7 @@
 }
 
 #ifdef CONFIG_MTD_NOR_FLASH
-int flash_sect_erase (ulong addr_first, ulong addr_last)
+int flash_sect_erase(ulong addr_first, ulong addr_last)
 {
 	flash_info_t *info;
 	ulong bank;
@@ -408,14 +412,14 @@
 		     ++bank, ++info) {
 			if (s_first[bank]>=0) {
 				erased += s_last[bank] - s_first[bank] + 1;
-				debug ("Erase Flash from 0x%08lx to 0x%08lx "
-					"in Bank # %ld ",
-					info->start[s_first[bank]],
-					(s_last[bank] == info->sector_count) ?
-						info->start[0] + info->size - 1:
-						info->start[s_last[bank]+1] - 1,
-					bank+1);
-				rcode = flash_erase (info, s_first[bank], s_last[bank]);
+				debug("Erase Flash from 0x%08lx to 0x%08lx in Bank # %ld ",
+				      info->start[s_first[bank]],
+				      (s_last[bank] == info->sector_count) ?
+				      info->start[0] + info->size - 1 :
+				      info->start[s_last[bank] + 1] - 1,
+				      bank + 1);
+				rcode = flash_erase(info, s_first[bank],
+						    s_last[bank]);
 			}
 		}
 		if (rcode == 0)
@@ -429,7 +433,8 @@
 }
 #endif /* CONFIG_MTD_NOR_FLASH */
 
-static int do_protect(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_protect(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int rcode = 0;
 #ifdef CONFIG_MTD_NOR_FLASH
@@ -526,7 +531,8 @@
 						p ? "" : "Un", argv[1],
 						bank, addr_first, addr_last);
 
-				rcode = flash_sect_protect (p, addr_first, addr_last);
+				rcode = flash_sect_protect(p, addr_first,
+							   addr_last);
 				return rcode;
 			}
 
@@ -580,13 +586,13 @@
 	if (addr_first >= addr_last)
 		return CMD_RET_USAGE;
 
-	rcode = flash_sect_protect (p, addr_first, addr_last);
+	rcode = flash_sect_protect(p, addr_first, addr_last);
 #endif /* CONFIG_MTD_NOR_FLASH */
 	return rcode;
 }
 
 #ifdef CONFIG_MTD_NOR_FLASH
-int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
+int flash_sect_protect(int p, ulong addr_first, ulong addr_last)
 {
 	flash_info_t *info;
 	ulong bank;
@@ -606,9 +612,9 @@
 			}
 
 			if (s_first[bank]>=0 && s_first[bank]<=s_last[bank]) {
-				debug ("%sProtecting sectors %d..%d in bank %ld\n",
-					p ? "" : "Un-",
-					s_first[bank], s_last[bank], bank+1);
+				debug("%sProtecting sectors %d..%d in bank %ld\n",
+				      p ? "" : "Un-", s_first[bank],
+				      s_last[bank], bank + 1);
 				protected += s_last[bank] - s_first[bank] + 1;
 				for (i=s_first[bank]; i<=s_last[bank]; ++i) {
 #if defined(CONFIG_SYS_FLASH_PROTECTION)
diff --git a/cmd/fpga.c b/cmd/fpga.c
index b1c7b54..8ae1c93 100644
--- a/cmd/fpga.c
+++ b/cmd/fpga.c
@@ -13,6 +13,8 @@
 #include <fpga.h>
 #include <fs.h>
 #include <gzip.h>
+#include <image.h>
+#include <log.h>
 #include <malloc.h>
 
 static long do_fpga_get_device(char *arg)
@@ -33,7 +35,8 @@
 }
 
 static int do_fpga_check_params(long *dev, long *fpga_data, size_t *data_size,
-				cmd_tbl_t *cmdtp, int argc, char *const argv[])
+				struct cmd_tbl *cmdtp, int argc,
+				char *const argv[])
 {
 	size_t local_data_size;
 	long local_fpga_data;
@@ -65,7 +68,7 @@
 }
 
 #if defined(CONFIG_CMD_FPGA_LOAD_SECURE)
-int do_fpga_loads(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_fpga_loads(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	size_t data_size = 0;
 	long fpga_data, dev;
@@ -117,7 +120,7 @@
 #endif
 
 #if defined(CONFIG_CMD_FPGA_LOADFS)
-static int do_fpga_loadfs(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_fpga_loadfs(struct cmd_tbl *cmdtp, int flag, int argc,
 			  char *const argv[])
 {
 	size_t data_size = 0;
@@ -140,16 +143,16 @@
 }
 #endif
 
-static int do_fpga_info(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_fpga_info(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	long dev = do_fpga_get_device(argv[0]);
 
 	return fpga_info(dev);
 }
 
-static int do_fpga_dump(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_fpga_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	size_t data_size = 0;
 	long fpga_data, dev;
@@ -163,8 +166,8 @@
 	return fpga_dump(dev, (void *)fpga_data, data_size);
 }
 
-static int do_fpga_load(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_fpga_load(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	size_t data_size = 0;
 	long fpga_data, dev;
@@ -178,8 +181,8 @@
 	return fpga_load(dev, (void *)fpga_data, data_size, BIT_FULL);
 }
 
-static int do_fpga_loadb(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_fpga_loadb(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	size_t data_size = 0;
 	long fpga_data, dev;
@@ -194,8 +197,8 @@
 }
 
 #if defined(CONFIG_CMD_FPGA_LOADP)
-static int do_fpga_loadp(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_fpga_loadp(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	size_t data_size = 0;
 	long fpga_data, dev;
@@ -211,8 +214,8 @@
 #endif
 
 #if defined(CONFIG_CMD_FPGA_LOADBP)
-static int do_fpga_loadbp(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_fpga_loadbp(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	size_t data_size = 0;
 	long fpga_data, dev;
@@ -229,8 +232,8 @@
 #endif
 
 #if defined(CONFIG_CMD_FPGA_LOADMK)
-static int do_fpga_loadmk(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_fpga_loadmk(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	size_t data_size = 0;
 	void *fpga_data = NULL;
@@ -362,7 +365,7 @@
 }
 #endif
 
-static cmd_tbl_t fpga_commands[] = {
+static struct cmd_tbl fpga_commands[] = {
 	U_BOOT_CMD_MKENT(info, 1, 1, do_fpga_info, "", ""),
 	U_BOOT_CMD_MKENT(dump, 3, 1, do_fpga_dump, "", ""),
 	U_BOOT_CMD_MKENT(load, 3, 1, do_fpga_load, "", ""),
@@ -384,10 +387,10 @@
 #endif
 };
 
-static int do_fpga_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_fpga_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 			   char *const argv[])
 {
-	cmd_tbl_t *fpga_cmd;
+	struct cmd_tbl *fpga_cmd;
 	int ret;
 
 	if (argc < 2)
diff --git a/cmd/fpgad.c b/cmd/fpgad.c
index 0d55453..fb2fe63 100644
--- a/cmd/fpgad.c
+++ b/cmd/fpgad.c
@@ -25,7 +25,7 @@
  *	fpgad {fpga} {addr} {len}
  */
 #define DISP_LINE_LEN	16
-int do_fpga_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fpga_md(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned int k;
 	unsigned int fpga;
diff --git a/cmd/fs.c b/cmd/fs.c
index db74767..3a0c465 100644
--- a/cmd/fs.c
+++ b/cmd/fs.c
@@ -9,7 +9,8 @@
 #include <command.h>
 #include <fs.h>
 
-static int do_size_wrapper(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_size_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	return do_size(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
@@ -22,8 +23,8 @@
 	"      and determine its size."
 );
 
-static int do_load_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_load_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
@@ -40,8 +41,8 @@
 	"      If 'pos' is 0 or omitted, the file is read from the start."
 )
 
-static int do_save_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_save_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	return do_save(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
@@ -57,8 +58,8 @@
 	"      If 'pos' is 0 or omitted, the file is written from the start."
 )
 
-static int do_ls_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_ls_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
@@ -71,8 +72,8 @@
 	"      device type 'interface' instance 'dev'."
 )
 
-static int do_ln_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_ln_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	return do_ln(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
@@ -85,8 +86,8 @@
 	"      device type 'interface' instance 'dev'."
 )
 
-static int do_fstype_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_fstype_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+			     char *const argv[])
 {
 	return do_fs_type(cmdtp, flag, argc, argv);
 }
diff --git a/cmd/fs_uuid.c b/cmd/fs_uuid.c
index 02ae9b7..5dc94aa 100644
--- a/cmd/fs_uuid.c
+++ b/cmd/fs_uuid.c
@@ -9,8 +9,8 @@
 #include <command.h>
 #include <fs.h>
 
-static int do_fs_uuid_wrapper(cmd_tbl_t *cmdtp, int flag,
-	int argc, char * const argv[])
+static int do_fs_uuid_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	return do_fs_uuid(cmdtp, flag, argc, argv, FS_TYPE_ANY);
 }
diff --git a/cmd/fuse.c b/cmd/fuse.c
index 42d74fa..e001619 100644
--- a/cmd/fuse.c
+++ b/cmd/fuse.c
@@ -40,7 +40,8 @@
 	return 0;
 }
 
-static int do_fuse(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_fuse(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	const char *op = argc >= 2 ? argv[1] : NULL;
 	int confirmed = argc >= 3 && !strcmp(argv[2], "-y");
diff --git a/cmd/gettime.c b/cmd/gettime.c
index 863bd87..2e74e02 100644
--- a/cmd/gettime.c
+++ b/cmd/gettime.c
@@ -14,8 +14,8 @@
 #include <common.h>
 #include <command.h>
 
-static int do_gettime(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_gettime(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	unsigned long int val = get_timer(0);
 
diff --git a/cmd/gpio.c b/cmd/gpio.c
index 408a942..4fdb313 100644
--- a/cmd/gpio.c
+++ b/cmd/gpio.c
@@ -10,6 +10,7 @@
 #include <command.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/gpio.h>
 #include <linux/err.h>
@@ -117,7 +118,8 @@
 }
 #endif
 
-static int do_gpio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_gpio(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	unsigned int gpio;
 	enum gpio_cmd sub_cmd;
diff --git a/cmd/gpt.c b/cmd/gpt.c
index b8d11c1..df75941 100644
--- a/cmd/gpt.c
+++ b/cmd/gpt.c
@@ -11,11 +11,15 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <command.h>
+#include <part.h>
 #include <part_efi.h>
 #include <exports.h>
+#include <uuid.h>
 #include <linux/ctype.h>
 #include <div64.h>
 #include <memalign.h>
@@ -188,7 +192,8 @@
 	}
 }
 
-static struct disk_part *allocate_disk_part(disk_partition_t *info, int partnum)
+static struct disk_part *allocate_disk_part(struct disk_partition *info,
+					    int partnum)
 {
 	struct disk_part *newpart;
 	newpart = calloc(1, sizeof(struct disk_part));
@@ -309,7 +314,7 @@
 {
 	/* start partition numbering at 1, as U-Boot does */
 	int valid_parts = 0, p, ret;
-	disk_partition_t info;
+	struct disk_partition info;
 	struct disk_part *new_disk_part;
 
 	/*
@@ -374,14 +379,14 @@
 static int set_gpt_info(struct blk_desc *dev_desc,
 			const char *str_part,
 			char **str_disk_guid,
-			disk_partition_t **partitions,
+			struct disk_partition **partitions,
 			u8 *parts_count)
 {
 	char *tok, *str, *s;
 	int i;
 	char *val, *p;
 	int p_count;
-	disk_partition_t *parts;
+	struct disk_partition *parts;
 	int errno = 0;
 	uint64_t size_ll, start_ll;
 	lbaint_t offset = 0;
@@ -439,7 +444,7 @@
 	}
 
 	/* allocate memory for partitions */
-	parts = calloc(sizeof(disk_partition_t), p_count);
+	parts = calloc(sizeof(struct disk_partition), p_count);
 	if (parts == NULL)
 		return -ENOMEM;
 
@@ -556,7 +561,7 @@
 	int ret;
 	char *str_disk_guid;
 	u8 part_count = 0;
-	disk_partition_t *partitions = NULL;
+	struct disk_partition *partitions = NULL;
 
 	/* fill partitions */
 	ret = set_gpt_info(blk_dev_desc, str_part,
@@ -583,7 +588,7 @@
 {
 	ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1,
 				     blk_dev_desc->blksz);
-	disk_partition_t *partitions = NULL;
+	struct disk_partition *partitions = NULL;
 	gpt_entry *gpt_pte = NULL;
 	char *str_disk_guid;
 	u8 part_count = 0;
@@ -639,7 +644,7 @@
 {
 	struct list_head *pos;
 	struct disk_part *curr;
-	disk_partition_t *new_partitions = NULL;
+	struct disk_partition *new_partitions = NULL;
 	char disk_guid[UUID_STR_LEN + 1];
 	char *partitions_list, *str_disk_guid = NULL;
 	u8 part_count = 0;
@@ -790,7 +795,7 @@
  *
  * @return zero on success; otherwise error
  */
-static int do_gpt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_gpt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret = CMD_RET_SUCCESS;
 	int dev = 0;
diff --git a/cmd/hash.c b/cmd/hash.c
index dff943a..e163cd6 100644
--- a/cmd/hash.c
+++ b/cmd/hash.c
@@ -14,7 +14,8 @@
 #include <hash.h>
 #include <linux/ctype.h>
 
-static int do_hash(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_hash(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	char *s;
 	int flags = HASH_FLAG_ENV;
diff --git a/cmd/help.c b/cmd/help.c
index a1a0b99..8d67d97 100644
--- a/cmd/help.c
+++ b/cmd/help.c
@@ -7,11 +7,12 @@
 #include <common.h>
 #include <command.h>
 
-static int do_help(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_help(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 #ifdef CONFIG_CMDLINE
-	cmd_tbl_t *start = ll_entry_start(cmd_tbl_t, cmd);
-	const int len = ll_entry_count(cmd_tbl_t, cmd);
+	struct cmd_tbl *start = ll_entry_start(struct cmd_tbl, cmd);
+	const int len = ll_entry_count(struct cmd_tbl, cmd);
 	return _do_help(start, len, cmdtp, flag, argc, argv);
 #else
 	return 0;
@@ -29,7 +30,7 @@
 
 #ifdef CONFIG_CMDLINE
 /* This does not use the U_BOOT_CMD macro as ? can't be used in symbol names */
-ll_entry_declare(cmd_tbl_t, question_mark, cmd) = {
+ll_entry_declare(struct cmd_tbl, question_mark, cmd) = {
 	"?",	CONFIG_SYS_MAXARGS, cmd_always_repeatable,	do_help,
 	"alias for 'help'",
 #ifdef  CONFIG_SYS_LONGHELP
diff --git a/cmd/host.c b/cmd/host.c
index eefc4f2..cd9c967 100644
--- a/cmd/host.c
+++ b/cmd/host.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <fs.h>
 #include <part.h>
@@ -13,32 +14,32 @@
 
 static int host_curr_device = -1;
 
-static int do_host_load(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_host_load(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	return do_load(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
-static int do_host_ls(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_host_ls(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
-static int do_host_size(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_host_size(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	return do_size(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
-static int do_host_save(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_host_save(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX);
 }
 
-static int do_host_bind(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_host_bind(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	if (argc < 2 || argc > 3)
 		return CMD_RET_USAGE;
@@ -53,8 +54,8 @@
 	return host_dev_bind(dev, file);
 }
 
-static int do_host_info(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_host_info(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	if (argc < 1 || argc > 2)
 		return CMD_RET_USAGE;
@@ -100,8 +101,8 @@
 	return 0;
 }
 
-static int do_host_dev(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_host_dev(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	int dev;
 	char *ep;
@@ -140,7 +141,7 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_host_sub[] = {
+static struct cmd_tbl cmd_host_sub[] = {
 	U_BOOT_CMD_MKENT(load, 7, 0, do_host_load, "", ""),
 	U_BOOT_CMD_MKENT(ls, 3, 0, do_host_ls, "", ""),
 	U_BOOT_CMD_MKENT(save, 6, 0, do_host_save, "", ""),
@@ -150,10 +151,10 @@
 	U_BOOT_CMD_MKENT(dev, 0, 1, do_host_dev, "", ""),
 };
 
-static int do_host(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_host(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	/* Skip past 'host' */
 	argc--;
diff --git a/cmd/i2c.c b/cmd/i2c.c
index 43a7629..cc01119 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -73,9 +73,11 @@
 #include <edid.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include <u-boot/crc.h>
 
 /* Display values from last command.
@@ -288,7 +290,8 @@
  * Syntax:
  *	i2c read {i2c_chip} {devaddr}{.0, .1, .2} {len} {memaddr}
  */
-static int do_i2c_read ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_read(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	uint	chip;
 	uint	devaddr, length;
@@ -341,7 +344,8 @@
 	return 0;
 }
 
-static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_write(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	uint	chip;
 	uint	devaddr, length;
@@ -432,7 +436,7 @@
 }
 
 #ifdef CONFIG_DM_I2C
-static int do_i2c_flags(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_i2c_flags(struct cmd_tbl *cmdtp, int flag, int argc,
 			char *const argv[])
 {
 	struct udevice *dev;
@@ -462,7 +466,8 @@
 	return 0;
 }
 
-static int do_i2c_olen(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_i2c_olen(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct udevice *dev;
 	uint olen;
@@ -507,7 +512,8 @@
  * Syntax:
  *	i2c md {i2c_chip} {addr}{.0, .1, .2} {len}
  */
-static int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_md(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	uint	chip;
 	uint	addr, length;
@@ -626,7 +632,8 @@
  * Syntax:
  *	i2c mw {i2c_chip} {addr}{.0, .1, .2} {data} [{count}]
  */
-static int do_i2c_mw ( cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	uint	chip;
 	ulong	addr;
@@ -712,7 +719,8 @@
  * Syntax:
  *	i2c crc32 {i2c_chip} {addr}{.0, .1, .2} {count}
  */
-static int do_i2c_crc (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_crc(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	uint	chip;
 	ulong	addr;
@@ -796,8 +804,8 @@
  *	i2c mm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2}
  *	i2c nm{.b, .w, .l} {i2c_chip} {addr}{.0, .1, .2}
  */
-static int
-mod_i2c_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
+static int mod_i2c_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
+		       char *const argv[])
 {
 	uint	chip;
 	ulong	addr;
@@ -945,7 +953,8 @@
  *
  * Returns zero (success) if one or more I2C devices was found
  */
-static int do_i2c_probe (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_probe(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	int j;
 	int addr = -1;
@@ -1020,7 +1029,8 @@
  *	{length} - Number of bytes to read
  *	{delay}  - A DECIMAL number and defaults to 1000 uSec
  */
-static int do_i2c_loop(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_loop(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	uint	chip;
 	int alen;
@@ -1146,7 +1156,8 @@
  * Syntax:
  *	i2c sdram {i2c_chip}
  */
-static int do_sdram (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_sdram(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	enum { unknown, EDO, SDRAM, DDR, DDR2, DDR3, DDR4 } type;
 
@@ -1648,7 +1659,7 @@
  *	i2c edid {i2c_chip}
  */
 #if defined(CONFIG_I2C_EDID)
-int do_edid(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_edid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	uint chip;
 	struct edid1_info edid;
@@ -1715,8 +1726,8 @@
  * Returns zero always.
  */
 #if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
-static int do_i2c_show_bus(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_i2c_show_bus(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	if (argc == 1) {
 		/* show all busses */
@@ -1802,8 +1813,8 @@
  */
 #if defined(CONFIG_SYS_I2C) || defined(CONFIG_I2C_MULTI_BUS) || \
 		defined(CONFIG_DM_I2C)
-static int do_i2c_bus_num(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_i2c_bus_num(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	int		ret = 0;
 	int	bus_no;
@@ -1853,7 +1864,8 @@
  * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
  * on error.
  */
-static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_bus_speed(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	int speed, ret=0;
 
@@ -1896,7 +1908,8 @@
  * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
  * on error.
  */
-static int do_i2c_mm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_mm(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	return mod_i2c_mem (cmdtp, 1, flag, argc, argv);
 }
@@ -1911,7 +1924,8 @@
  * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
  * on error.
  */
-static int do_i2c_nm(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_nm(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	return mod_i2c_mem (cmdtp, 0, flag, argc, argv);
 }
@@ -1925,7 +1939,8 @@
  *
  * Returns zero always.
  */
-static int do_i2c_reset(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 #if defined(CONFIG_DM_I2C)
 	struct udevice *bus;
@@ -1944,7 +1959,7 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_i2c_sub[] = {
+static struct cmd_tbl cmd_i2c_sub[] = {
 #if defined(CONFIG_SYS_I2C) || defined(CONFIG_DM_I2C)
 	U_BOOT_CMD_MKENT(bus, 1, 1, do_i2c_show_bus, "", ""),
 #endif
@@ -1995,9 +2010,9 @@
  * Returns zero on success, CMD_RET_USAGE in case of misuse and negative
  * on error.
  */
-static int do_i2c(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_i2c(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 	i2c_reloc();
diff --git a/cmd/ide.c b/cmd/ide.c
index 2f93ba7..b78c38e 100644
--- a/cmd/ide.c
+++ b/cmd/ide.c
@@ -27,7 +27,7 @@
 /* Current I/O Device	*/
 static int curr_device;
 
-int do_ide(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ide(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc == 2) {
 		if (strncmp(argv[1], "res", 3) == 0) {
@@ -40,7 +40,7 @@
 	return blk_common_cmd(argc, argv, IF_TYPE_IDE, &curr_device);
 }
 
-int do_diskboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_diskboot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return common_diskboot(cmdtp, "ide", argc, argv);
 }
diff --git a/cmd/ini.c b/cmd/ini.c
index 0c42526..c075be6 100644
--- a/cmd/ini.c
+++ b/cmd/ini.c
@@ -226,7 +226,7 @@
 	return 1;
 }
 
-static int do_ini(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ini(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	const char *section;
 	char *file_address;
diff --git a/cmd/io.c b/cmd/io.c
index 7fee967..c7e9641 100644
--- a/cmd/io.c
+++ b/cmd/io.c
@@ -24,7 +24,7 @@
  * Syntax:
  *	iod{.b, .w, .l} {addr}
  */
-int do_io_iod(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_io_iod(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong addr, length, bytes;
 	u8 buf[DISP_LINE_LEN];
@@ -90,7 +90,7 @@
 	return 0;
 }
 
-int do_io_iow(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_io_iow(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong addr, val;
 	int size;
diff --git a/cmd/iotrace.c b/cmd/iotrace.c
index fa6c68b..652ebef 100644
--- a/cmd/iotrace.c
+++ b/cmd/iotrace.c
@@ -55,7 +55,7 @@
 	}
 }
 
-static int do_set_buffer(int argc, char * const argv[])
+static int do_set_buffer(int argc, char *const argv[])
 {
 	ulong addr = 0, size = 0;
 
@@ -71,7 +71,7 @@
 	return 0;
 }
 
-static int do_set_region(int argc, char * const argv[])
+static int do_set_region(int argc, char *const argv[])
 {
 	ulong addr = 0, size = 0;
 
@@ -87,7 +87,7 @@
 	return 0;
 }
 
-int do_iotrace(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_iotrace(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	const char *cmd = argc < 2 ? NULL : argv[1];
 
diff --git a/cmd/irq.c b/cmd/irq.c
index 52d06b3..1d3e28c 100644
--- a/cmd/irq.c
+++ b/cmd/irq.c
@@ -8,8 +8,8 @@
 #include <command.h>
 #include <irq_func.h>
 
-static int do_interrupts(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_interrupts(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 
 	if (argc != 2)
@@ -31,7 +31,7 @@
 );
 
 /* Implemented in $(CPU)/interrupts.c */
-int do_irqinfo (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_irqinfo(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 
 U_BOOT_CMD(
 	irqinfo,    1,    1,     do_irqinfo,
diff --git a/cmd/itest.c b/cmd/itest.c
index e21e1f1..a0cf4be 100644
--- a/cmd/itest.c
+++ b/cmd/itest.c
@@ -175,7 +175,8 @@
 }
 
 /* command line interface to the shell test */
-static int do_itest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_itest(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	int	value, w;
 
diff --git a/cmd/jffs2.c b/cmd/jffs2.c
index da2580d..9540988 100644
--- a/cmd/jffs2.c
+++ b/cmd/jffs2.c
@@ -73,9 +73,11 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <flash.h>
 #include <image.h>
 #include <malloc.h>
 #include <jffs2/jffs2.h>
+#include <linux/bug.h>
 #include <linux/list.h>
 #include <linux/ctype.h>
 #include <cramfs/cramfs_fs.h>
@@ -471,7 +473,8 @@
  * @param argv arguments list
  * @return 0 on success, 1 otherwise
  */
-int do_jffs2_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_jffs2_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	char *fsname;
 	char *filename;
@@ -533,7 +536,7 @@
  * @param argv arguments list
  * @return 0 on success, 1 otherwise
  */
-int do_jffs2_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_jffs2_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename = "/";
 	int ret;
@@ -571,7 +574,8 @@
  * @param argv arguments list
  * @return 0 on success, 1 otherwise
  */
-int do_jffs2_fsinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_jffs2_fsinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	struct part_info *part;
 	char *fsname;
diff --git a/cmd/led.c b/cmd/led.c
index 50ffa50..9433fa8 100644
--- a/cmd/led.c
+++ b/cmd/led.c
@@ -71,7 +71,7 @@
 	return 0;
 }
 
-int do_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	enum led_state_t cmd;
 	const char *led_label;
diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c
index 7d40d8d..86cd969 100644
--- a/cmd/legacy_led.c
+++ b/cmd/legacy_led.c
@@ -85,7 +85,7 @@
 {
 }
 
-int do_legacy_led(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_legacy_led(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int i, match = 0;
 	enum led_cmd cmd;
diff --git a/cmd/license.c b/cmd/license.c
index c5b04c3..15411b5 100644
--- a/cmd/license.c
+++ b/cmd/license.c
@@ -12,7 +12,8 @@
 #include "license_data_gz.h"
 #include "license_data_size.h"
 
-static int do_license(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_license(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	char *dst;
 	unsigned long len = data_size;
diff --git a/cmd/load.c b/cmd/load.c
index fab30fe..63a9414 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -19,6 +19,8 @@
 #include <exports.h>
 #include <serial.h>
 #include <xyzModem.h>
+#include <asm/cache.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -40,8 +42,8 @@
 /* -------------------------------------------------------------------- */
 
 #if defined(CONFIG_CMD_LOADS)
-static int do_load_serial(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_load_serial(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	long offset = 0;
 	ulong addr;
@@ -241,7 +243,8 @@
 
 #if defined(CONFIG_CMD_SAVES)
 
-int do_save_serial (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_save_serial(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	ulong offset = 0;
 	ulong size   = 0;
@@ -418,8 +421,8 @@
 static char his_pad_char;   /* pad chars he needs */
 static char his_quote;      /* quote chars he'll use */
 
-static int do_load_serial_bin(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_load_serial_bin(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	ulong offset = 0;
 	ulong addr;
diff --git a/cmd/log.c b/cmd/log.c
index 1e3936a..664f7bd 100644
--- a/cmd/log.c
+++ b/cmd/log.c
@@ -11,8 +11,8 @@
 
 static char log_fmt_chars[LOGF_COUNT] = "clFLfm";
 
-static int do_log_level(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_log_level(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	if (argc > 1)
 		gd->default_log_level = simple_strtol(argv[1], NULL, 10);
@@ -22,8 +22,8 @@
 	return 0;
 }
 
-static int do_log_format(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_log_format(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	int i;
 
@@ -58,7 +58,8 @@
 	return 0;
 }
 
-static int do_log_rec(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_log_rec(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	enum log_category_t cat;
 	enum log_level_t level;
@@ -94,7 +95,7 @@
 	return 0;
 }
 
-static cmd_tbl_t log_sub[] = {
+static struct cmd_tbl log_sub[] = {
 	U_BOOT_CMD_MKENT(level, CONFIG_SYS_MAXARGS, 1, do_log_level, "", ""),
 #ifdef CONFIG_LOG_TEST
 	U_BOOT_CMD_MKENT(test, 2, 1, do_log_test, "", ""),
@@ -103,9 +104,9 @@
 	U_BOOT_CMD_MKENT(rec, CONFIG_SYS_MAXARGS, 1, do_log_rec, "", ""),
 };
 
-static int do_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_log(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/lzmadec.c b/cmd/lzmadec.c
index e3b9cc7..3b8db0a 100644
--- a/cmd/lzmadec.c
+++ b/cmd/lzmadec.c
@@ -17,7 +17,8 @@
 
 #include <lzma/LzmaTools.h>
 
-static int do_lzmadec(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_lzmadec(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	unsigned long src, dst;
 	SizeT src_len = ~0UL, dst_len = ~0UL;
diff --git a/cmd/mac.c b/cmd/mac.c
index 4227d10..a39e116 100644
--- a/cmd/mac.c
+++ b/cmd/mac.c
@@ -7,7 +7,8 @@
 #include <common.h>
 #include <command.h>
 
-extern int do_mac(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_mac(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[]);
 
 U_BOOT_CMD(
 	mac, 3, 1,  do_mac,
diff --git a/cmd/md5sum.c b/cmd/md5sum.c
index 63cbae0..5ae3ddf 100644
--- a/cmd/md5sum.c
+++ b/cmd/md5sum.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <image.h>
 #include <mapmem.h>
 #include <u-boot/md5.h>
 #include <asm/io.h>
@@ -72,7 +73,7 @@
 	return 0;
 }
 
-int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong addr, len;
 	unsigned int i;
@@ -135,7 +136,8 @@
 	return 0;
 }
 #else
-static int do_md5sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_md5sum(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	unsigned long addr, len;
 	unsigned int i;
diff --git a/cmd/mdio.c b/cmd/mdio.c
index 22c8fbe..c48bb51 100644
--- a/cmd/mdio.c
+++ b/cmd/mdio.c
@@ -190,7 +190,8 @@
 }
 
 /* ---------------------------------------------------------------- */
-static int do_mdio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mdio(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	char op[2];
 	int addrlo, addrhi, reglo, reghi, devadlo, devadhi;
diff --git a/cmd/mem.c b/cmd/mem.c
index 18f0510..9b97f7b 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -18,14 +18,22 @@
 #include <console.h>
 #include <flash.h>
 #include <hash.h>
+#include <log.h>
 #include <mapmem.h>
+#include <rand.h>
 #include <watchdog.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int mod_mem(cmd_tbl_t *, int, int, int, char * const []);
+#ifndef CONFIG_SYS_MEMTEST_SCRATCH
+#define CONFIG_SYS_MEMTEST_SCRATCH 0
+#endif
+
+static int mod_mem(struct cmd_tbl *, int, int, int, char * const []);
 
 /* Display values from last command.
  * Memory modify remembered values are different from display memory.
@@ -42,7 +50,8 @@
  *	md{.b, .w, .l, .q} {addr} {len}
  */
 #define DISP_LINE_LEN	16
-static int do_mem_md(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_md(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	ulong	addr, length, bytes;
 	const void *buf;
@@ -92,16 +101,20 @@
 	return (rc);
 }
 
-static int do_mem_mm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_mm(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	return mod_mem (cmdtp, 1, flag, argc, argv);
 }
-static int do_mem_nm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+
+static int do_mem_nm(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	return mod_mem (cmdtp, 0, flag, argc, argv);
 }
 
-static int do_mem_mw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_mw(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 #ifdef MEM_SUPPORT_64BIT_DATA
 	u64 writeval;
@@ -162,7 +175,8 @@
 }
 
 #ifdef CONFIG_CMD_MX_CYCLIC
-static int do_mem_mdc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_mdc(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int i;
 	ulong count;
@@ -177,7 +191,7 @@
 
 		/* delay for <count> ms... */
 		for (i=0; i<count; i++)
-			udelay (1000);
+			udelay(1000);
 
 		/* check for ctrl-c to abort... */
 		if (ctrlc()) {
@@ -189,7 +203,8 @@
 	return 0;
 }
 
-static int do_mem_mwc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_mwc(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int i;
 	ulong count;
@@ -204,7 +219,7 @@
 
 		/* delay for <count> ms... */
 		for (i=0; i<count; i++)
-			udelay (1000);
+			udelay(1000);
 
 		/* check for ctrl-c to abort... */
 		if (ctrlc()) {
@@ -217,7 +232,8 @@
 }
 #endif /* CONFIG_CMD_MX_CYCLIC */
 
-static int do_mem_cmp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_cmp(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	ulong	addr1, addr2, count, ngood, bytes;
 	int	size;
@@ -297,7 +313,8 @@
 	return rcode;
 }
 
-static int do_mem_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_cp(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	ulong	addr, dest, count;
 	void	*src, *dst;
@@ -355,8 +372,8 @@
 	return 0;
 }
 
-static int do_mem_base(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_mem_base(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	if (argc > 1) {
 		/* Set new base address.
@@ -369,8 +386,8 @@
 	return 0;
 }
 
-static int do_mem_loop(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_mem_loop(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	ulong	addr, length, i, bytes;
 	int	size;
@@ -467,8 +484,8 @@
 }
 
 #ifdef CONFIG_LOOPW
-static int do_mem_loopw(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_mem_loopw(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	ulong	addr, length, i, bytes;
 	int	size;
@@ -914,8 +931,8 @@
  * configured using CONFIG_SYS_ALT_MEMTEST. The complete test loops until
  * interrupted by ctrl-c or by a failure of one of the sub-tests.
  */
-static int do_mem_mtest(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_mem_mtest(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	ulong start, end;
 	vu_long scratch_space;
@@ -1002,7 +1019,8 @@
  *	nm{.b, .w, .l, .q} {addr}
  */
 static int
-mod_mem(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const argv[])
+mod_mem(struct cmd_tbl *cmdtp, int incrflag, int flag, int argc,
+	char *const argv[])
 {
 	ulong	addr;
 #ifdef MEM_SUPPORT_64BIT_DATA
@@ -1106,7 +1124,8 @@
 
 #ifdef CONFIG_CMD_CRC32
 
-static int do_mem_crc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mem_crc(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int flags = 0;
 	int ac;
@@ -1131,7 +1150,8 @@
 #endif
 
 #ifdef CONFIG_CMD_RANDOM
-static int do_random(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_random(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	unsigned long addr, len;
 	unsigned long seed; // NOT INITIALIZED ON PURPOSE
@@ -1259,8 +1279,8 @@
 #endif
 
 #ifdef CONFIG_CMD_MEMINFO
-static int do_mem_info(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_mem_info(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	puts("DRAM:  ");
 	print_size(gd->ram_size, "\n");
diff --git a/cmd/mfsl.c b/cmd/mfsl.c
index 583762a..31f5b36 100644
--- a/cmd/mfsl.c
+++ b/cmd/mfsl.c
@@ -14,7 +14,7 @@
 #include <command.h>
 #include <asm/asm.h>
 
-int do_frd (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_frd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned int fslnum;
 	unsigned int num;
@@ -169,7 +169,7 @@
 	return 0;
 }
 
-int do_fwr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_fwr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned int fslnum;
 	unsigned int num;
@@ -324,7 +324,7 @@
 
 }
 
-int do_rspr (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+int do_rspr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned int reg = 0;
 	unsigned int val = 0;
diff --git a/cmd/mii.c b/cmd/mii.c
index 23ee1e6..b52a55d 100644
--- a/cmd/mii.c
+++ b/cmd/mii.c
@@ -277,7 +277,7 @@
 }
 
 /* ---------------------------------------------------------------- */
-static int do_mii(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mii(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char		op[2];
 	unsigned char	addrlo, addrhi, reglo, reghi;
diff --git a/cmd/misc.c b/cmd/misc.c
index a1eef72..20ab943 100644
--- a/cmd/misc.c
+++ b/cmd/misc.c
@@ -10,8 +10,10 @@
 #include <common.h>
 #include <command.h>
 #include <console.h>
+#include <linux/delay.h>
 
-static int do_sleep(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sleep(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	ulong start = get_timer(0);
 	ulong mdelay = 0;
@@ -58,7 +60,8 @@
 );
 
 #ifdef CONFIG_CMD_TIMER
-static int do_timer(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_timer(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	static ulong start;
 
diff --git a/cmd/mmc.c b/cmd/mmc.c
index 6142ec8..97e5d91 100644
--- a/cmd/mmc.c
+++ b/cmd/mmc.c
@@ -5,9 +5,11 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <console.h>
 #include <mmc.h>
+#include <part.h>
 #include <sparse_format.h>
 #include <image-sparse.h>
 
@@ -140,7 +142,9 @@
 
 	return mmc;
 }
-static int do_mmcinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+
+static int do_mmcinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct mmc *mmc;
 
@@ -173,8 +177,9 @@
 	puts("Authentication key programming aborted\n");
 	return 0;
 }
-static int do_mmcrpmb_key(cmd_tbl_t *cmdtp, int flag,
-			  int argc, char * const argv[])
+
+static int do_mmcrpmb_key(struct cmd_tbl *cmdtp, int flag,
+			  int argc, char *const argv[])
 {
 	void *key_addr;
 	struct mmc *mmc = find_mmc_device(curr_device);
@@ -191,8 +196,9 @@
 	}
 	return CMD_RET_SUCCESS;
 }
-static int do_mmcrpmb_read(cmd_tbl_t *cmdtp, int flag,
-			   int argc, char * const argv[])
+
+static int do_mmcrpmb_read(struct cmd_tbl *cmdtp, int flag,
+			   int argc, char *const argv[])
 {
 	u16 blk, cnt;
 	void *addr;
@@ -219,8 +225,9 @@
 		return CMD_RET_FAILURE;
 	return CMD_RET_SUCCESS;
 }
-static int do_mmcrpmb_write(cmd_tbl_t *cmdtp, int flag,
-			    int argc, char * const argv[])
+
+static int do_mmcrpmb_write(struct cmd_tbl *cmdtp, int flag,
+			    int argc, char *const argv[])
 {
 	u16 blk, cnt;
 	void *addr;
@@ -245,8 +252,9 @@
 		return CMD_RET_FAILURE;
 	return CMD_RET_SUCCESS;
 }
-static int do_mmcrpmb_counter(cmd_tbl_t *cmdtp, int flag,
-			      int argc, char * const argv[])
+
+static int do_mmcrpmb_counter(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	unsigned long counter;
 	struct mmc *mmc = find_mmc_device(curr_device);
@@ -257,17 +265,17 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_rpmb[] = {
+static struct cmd_tbl cmd_rpmb[] = {
 	U_BOOT_CMD_MKENT(key, 2, 0, do_mmcrpmb_key, "", ""),
 	U_BOOT_CMD_MKENT(read, 5, 1, do_mmcrpmb_read, "", ""),
 	U_BOOT_CMD_MKENT(write, 5, 0, do_mmcrpmb_write, "", ""),
 	U_BOOT_CMD_MKENT(counter, 1, 1, do_mmcrpmb_counter, "", ""),
 };
 
-static int do_mmcrpmb(cmd_tbl_t *cmdtp, int flag,
-		      int argc, char * const argv[])
+static int do_mmcrpmb(struct cmd_tbl *cmdtp, int flag,
+		      int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 	struct mmc *mmc;
 	char original_part;
 	int ret;
@@ -314,8 +322,8 @@
 }
 #endif
 
-static int do_mmc_read(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+static int do_mmc_read(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
 	struct mmc *mmc;
 	u32 blk, cnt, n;
@@ -356,8 +364,8 @@
 	return blkcnt;
 }
 
-static int do_mmc_sparse_write(cmd_tbl_t *cmdtp, int flag,
-			       int argc, char * const argv[])
+static int do_mmc_sparse_write(struct cmd_tbl *cmdtp, int flag,
+			       int argc, char *const argv[])
 {
 	struct sparse_storage sparse;
 	struct blk_desc *dev_desc;
@@ -407,8 +415,8 @@
 #endif
 
 #if CONFIG_IS_ENABLED(MMC_WRITE)
-static int do_mmc_write(cmd_tbl_t *cmdtp, int flag,
-			int argc, char * const argv[])
+static int do_mmc_write(struct cmd_tbl *cmdtp, int flag,
+			int argc, char *const argv[])
 {
 	struct mmc *mmc;
 	u32 blk, cnt, n;
@@ -437,8 +445,9 @@
 
 	return (n == cnt) ? CMD_RET_SUCCESS : CMD_RET_FAILURE;
 }
-static int do_mmc_erase(cmd_tbl_t *cmdtp, int flag,
-			int argc, char * const argv[])
+
+static int do_mmc_erase(struct cmd_tbl *cmdtp, int flag,
+			int argc, char *const argv[])
 {
 	struct mmc *mmc;
 	u32 blk, cnt, n;
@@ -467,8 +476,8 @@
 }
 #endif
 
-static int do_mmc_rescan(cmd_tbl_t *cmdtp, int flag,
-			 int argc, char * const argv[])
+static int do_mmc_rescan(struct cmd_tbl *cmdtp, int flag,
+			 int argc, char *const argv[])
 {
 	struct mmc *mmc;
 
@@ -478,8 +487,9 @@
 
 	return CMD_RET_SUCCESS;
 }
-static int do_mmc_part(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+
+static int do_mmc_part(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
 	struct blk_desc *mmc_dev;
 	struct mmc *mmc;
@@ -497,8 +507,9 @@
 	puts("get mmc type error!\n");
 	return CMD_RET_FAILURE;
 }
-static int do_mmc_dev(cmd_tbl_t *cmdtp, int flag,
-		      int argc, char * const argv[])
+
+static int do_mmc_dev(struct cmd_tbl *cmdtp, int flag,
+		      int argc, char *const argv[])
 {
 	int dev, part = 0, ret;
 	struct mmc *mmc;
@@ -538,8 +549,9 @@
 
 	return CMD_RET_SUCCESS;
 }
-static int do_mmc_list(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+
+static int do_mmc_list(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
 	print_mmc_devices('\n');
 	return CMD_RET_SUCCESS;
@@ -547,7 +559,7 @@
 
 #if CONFIG_IS_ENABLED(MMC_HW_PARTITIONING)
 static int parse_hwpart_user(struct mmc_hwpart_conf *pconf,
-			     int argc, char * const argv[])
+			     int argc, char *const argv[])
 {
 	int i = 0;
 
@@ -581,7 +593,7 @@
 }
 
 static int parse_hwpart_gp(struct mmc_hwpart_conf *pconf, int pidx,
-			   int argc, char * const argv[])
+			   int argc, char *const argv[])
 {
 	int i;
 
@@ -614,8 +626,8 @@
 	return i;
 }
 
-static int do_mmc_hwpartition(cmd_tbl_t *cmdtp, int flag,
-			      int argc, char * const argv[])
+static int do_mmc_hwpartition(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	struct mmc *mmc;
 	struct mmc_hwpart_conf pconf = { };
@@ -698,8 +710,8 @@
 #endif
 
 #ifdef CONFIG_SUPPORT_EMMC_BOOT
-static int do_mmc_bootbus(cmd_tbl_t *cmdtp, int flag,
-			  int argc, char * const argv[])
+static int do_mmc_bootbus(struct cmd_tbl *cmdtp, int flag,
+			  int argc, char *const argv[])
 {
 	int dev;
 	struct mmc *mmc;
@@ -724,8 +736,9 @@
 	/* acknowledge to be sent during boot operation */
 	return mmc_set_boot_bus_width(mmc, width, reset, mode);
 }
-static int do_mmc_boot_resize(cmd_tbl_t *cmdtp, int flag,
-			      int argc, char * const argv[])
+
+static int do_mmc_boot_resize(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	int dev;
 	struct mmc *mmc;
@@ -777,8 +790,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_mmc_partconf(cmd_tbl_t *cmdtp, int flag,
-			   int argc, char * const argv[])
+static int do_mmc_partconf(struct cmd_tbl *cmdtp, int flag,
+			   int argc, char *const argv[])
 {
 	int dev;
 	struct mmc *mmc;
@@ -808,8 +821,9 @@
 	/* acknowledge to be sent during boot operation */
 	return mmc_set_part_conf(mmc, ack, part_num, access);
 }
-static int do_mmc_rst_func(cmd_tbl_t *cmdtp, int flag,
-			   int argc, char * const argv[])
+
+static int do_mmc_rst_func(struct cmd_tbl *cmdtp, int flag,
+			   int argc, char *const argv[])
 {
 	int dev;
 	struct mmc *mmc;
@@ -843,8 +857,8 @@
 	return mmc_set_rst_n_function(mmc, enable);
 }
 #endif
-static int do_mmc_setdsr(cmd_tbl_t *cmdtp, int flag,
-			 int argc, char * const argv[])
+static int do_mmc_setdsr(struct cmd_tbl *cmdtp, int flag,
+			 int argc, char *const argv[])
 {
 	struct mmc *mmc;
 	u32 val;
@@ -872,8 +886,8 @@
 }
 
 #ifdef CONFIG_CMD_BKOPS_ENABLE
-static int do_mmc_bkops_enable(cmd_tbl_t *cmdtp, int flag,
-				   int argc, char * const argv[])
+static int do_mmc_bkops_enable(struct cmd_tbl *cmdtp, int flag,
+			       int argc, char *const argv[])
 {
 	int dev;
 	struct mmc *mmc;
@@ -896,7 +910,7 @@
 }
 #endif
 
-static int do_mmc_boot_wp(cmd_tbl_t *cmdtp, int flag,
+static int do_mmc_boot_wp(struct cmd_tbl *cmdtp, int flag,
 			  int argc, char * const argv[])
 {
 	int err;
@@ -916,7 +930,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_mmc[] = {
+static struct cmd_tbl cmd_mmc[] = {
 	U_BOOT_CMD_MKENT(info, 1, 0, do_mmcinfo, "", ""),
 	U_BOOT_CMD_MKENT(read, 4, 1, do_mmc_read, "", ""),
 	U_BOOT_CMD_MKENT(wp, 1, 0, do_mmc_boot_wp, "", ""),
@@ -949,9 +963,10 @@
 #endif
 };
 
-static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mmcops(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	cp = find_cmd_tbl(argv[1], cmd_mmc, ARRAY_SIZE(cmd_mmc));
 
diff --git a/cmd/mp.c b/cmd/mp.c
index 4c8f5fc..c2b5235 100644
--- a/cmd/mp.c
+++ b/cmd/mp.c
@@ -26,7 +26,7 @@
 }
 
 static int
-cpu_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+cpu_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long cpuid;
 
diff --git a/cmd/mtd.c b/cmd/mtd.c
index f407c5e..485a963 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -195,8 +195,8 @@
 	return true;
 }
 
-static int do_mtd_list(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_mtd_list(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct mtd_info *mtd;
 	int dev_nb = 0;
@@ -240,7 +240,8 @@
 	return ret;
 }
 
-static int do_mtd_io(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	bool dump, read, raw, woob, write_empty_pages, has_pages = false;
 	u64 start_off, off, len, remaining, default_len;
@@ -382,8 +383,8 @@
 	return ret;
 }
 
-static int do_mtd_erase(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_mtd_erase(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	struct erase_info erase_op = {};
 	struct mtd_info *mtd;
@@ -454,8 +455,8 @@
 	return ret;
 }
 
-static int do_mtd_bad(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_mtd_bad(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct mtd_info *mtd;
 	loff_t off;
@@ -485,7 +486,7 @@
 }
 
 #ifdef CONFIG_AUTO_COMPLETE
-static int mtd_name_complete(int argc, char * const argv[], char last_char,
+static int mtd_name_complete(int argc, char *const argv[], char last_char,
 			     int maxv, char *cmdv[])
 {
 	int len = 0, n_found = 0;
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index b40c2af..5220142 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -73,6 +73,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <jffs2/load_kernel.h>
 #include <linux/list.h>
@@ -1915,7 +1916,8 @@
  * @param argv arguments list
  * @return 0 on success, 1 otherwise
  */
-static int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_chpart(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 /* command line only */
 	struct mtd_device *dev;
@@ -1953,8 +1955,8 @@
  * @param argv arguments list
  * @return 0 on success, 1 otherwise
  */
-static int do_mtdparts(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_mtdparts(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	if (argc == 2) {
 		if (strcmp(argv[1], "default") == 0) {
diff --git a/cmd/mvebu/bubt.c b/cmd/mvebu/bubt.c
index ef53153..a27b0df 100644
--- a/cmd/mvebu/bubt.c
+++ b/cmd/mvebu/bubt.c
@@ -8,7 +8,9 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <flash.h>
 #include <image.h>
+#include <net.h>
 #include <vsprintf.h>
 #include <errno.h>
 #include <dm.h>
@@ -827,7 +829,7 @@
 #endif
 #endif /* DEFAULT_BUBT_DST */
 
-int do_bubt_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_bubt_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct bubt_dev *src, *dst;
 	size_t image_size;
diff --git a/cmd/nand.c b/cmd/nand.c
index 4de6892..92d039a 100644
--- a/cmd/nand.c
+++ b/cmd/nand.c
@@ -20,7 +20,9 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <image.h>
+#include <asm/cache.h>
 #include <linux/mtd/mtd.h>
 #include <command.h>
 #include <console.h>
@@ -187,7 +189,7 @@
 #ifdef CONFIG_ENV_OFFSET_OOB
 unsigned long nand_env_oob_offset;
 
-int do_nand_env_oob(cmd_tbl_t *cmdtp, int argc, char *const argv[])
+int do_nand_env_oob(struct cmd_tbl *cmdtp, int argc, char *const argv[])
 {
 	int ret;
 	uint32_t oob_buf[ENV_OFFSET_SIZE/sizeof(uint32_t)];
@@ -374,7 +376,8 @@
 	}
 }
 
-static int do_nand(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_nand(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	int i, ret = 0;
 	ulong addr;
@@ -843,7 +846,7 @@
 	"NAND sub-system", nand_help_text
 );
 
-static int nand_load_image(cmd_tbl_t *cmdtp, struct mtd_info *mtd,
+static int nand_load_image(struct cmd_tbl *cmdtp, struct mtd_info *mtd,
 			   ulong offset, ulong addr, char *cmd)
 {
 	int r;
@@ -931,8 +934,8 @@
 	return bootm_maybe_autostart(cmdtp, cmd);
 }
 
-static int do_nandboot(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_nandboot(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	char *boot_device = NULL;
 	int idx;
diff --git a/cmd/net.c b/cmd/net.c
index 1b724cc..25390b0 100644
--- a/cmd/net.c
+++ b/cmd/net.c
@@ -8,15 +8,17 @@
  * Boot support
  */
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <env.h>
 #include <image.h>
 #include <net.h>
 
-static int netboot_common(enum proto_t, cmd_tbl_t *, int, char * const []);
+static int netboot_common(enum proto_t, struct cmd_tbl *, int, char * const []);
 
 #ifdef CONFIG_CMD_BOOTP
-static int do_bootp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_bootp(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	return netboot_common(BOOTP, cmdtp, argc, argv);
 }
@@ -29,7 +31,7 @@
 #endif
 
 #ifdef CONFIG_CMD_TFTPBOOT
-int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 
@@ -47,7 +49,8 @@
 #endif
 
 #ifdef CONFIG_CMD_TFTPPUT
-static int do_tftpput(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_tftpput(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	return netboot_common(TFTPPUT, cmdtp, argc, argv);
 }
@@ -60,7 +63,8 @@
 #endif
 
 #ifdef CONFIG_CMD_TFTPSRV
-static int do_tftpsrv(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_tftpsrv(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	return netboot_common(TFTPSRV, cmdtp, argc, argv);
 }
@@ -77,7 +81,7 @@
 
 
 #ifdef CONFIG_CMD_RARP
-int do_rarpb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_rarpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	return netboot_common(RARP, cmdtp, argc, argv);
 }
@@ -90,7 +94,8 @@
 #endif
 
 #if defined(CONFIG_CMD_DHCP)
-static int do_dhcp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dhcp(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	return netboot_common(DHCP, cmdtp, argc, argv);
 }
@@ -103,7 +108,8 @@
 #endif
 
 #if defined(CONFIG_CMD_NFS)
-static int do_nfs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_nfs(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
 {
 	return netboot_common(NFS, cmdtp, argc, argv);
 }
@@ -176,8 +182,8 @@
 #endif
 }
 
-static int netboot_common(enum proto_t proto, cmd_tbl_t *cmdtp, int argc,
-		char * const argv[])
+static int netboot_common(enum proto_t proto, struct cmd_tbl *cmdtp, int argc,
+			  char *const argv[])
 {
 	char *s;
 	char *end;
@@ -272,7 +278,8 @@
 }
 
 #if defined(CONFIG_CMD_PING)
-static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ping(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
@@ -320,7 +327,7 @@
 	}
 }
 
-int do_cdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_cdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int r;
 
@@ -343,7 +350,7 @@
 #endif
 
 #if defined(CONFIG_CMD_SNTP)
-int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_sntp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *toff;
 
@@ -384,7 +391,7 @@
 #endif
 
 #if defined(CONFIG_CMD_DNS)
-int do_dns(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_dns(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc == 1)
 		return CMD_RET_USAGE;
@@ -430,8 +437,8 @@
 #endif	/* CONFIG_CMD_DNS */
 
 #if defined(CONFIG_CMD_LINK_LOCAL)
-static int do_link_local(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_link_local(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	char tmp[22];
 
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 966c134..08d49df 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -29,10 +29,13 @@
 #include <console.h>
 #include <env.h>
 #include <env_internal.h>
+#include <log.h>
+#include <net.h>
 #include <search.h>
 #include <errno.h>
 #include <malloc.h>
 #include <mapmem.h>
+#include <linux/bitops.h>
 #include <u-boot/crc.h>
 #include <watchdog.h>
 #include <linux/stddef.h>
@@ -120,8 +123,8 @@
 	return 0;
 }
 
-static int do_env_print(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_env_print(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	int i;
 	int rcode = 0;
@@ -162,8 +165,8 @@
 }
 
 #ifdef CONFIG_CMD_GREPENV
-static int do_env_grep(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+static int do_env_grep(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
 	char *res = NULL;
 	int len, grep_how, grep_what;
@@ -222,7 +225,7 @@
  * Set a new environment variable,
  * or replace or delete an existing one.
  */
-static int _do_env_set(int flag, int argc, char * const argv[], int env_flag)
+static int _do_env_set(int flag, int argc, char *const argv[], int env_flag)
 {
 	int   i, len;
 	char  *name, *value, *s;
@@ -378,7 +381,8 @@
 }
 
 #ifndef CONFIG_SPL_BUILD
-static int do_env_set(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_env_set(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
@@ -390,7 +394,7 @@
  * Prompt for environment variable
  */
 #if defined(CONFIG_CMD_ASKENV)
-int do_env_ask(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_env_ask(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char message[CONFIG_SYS_CBSIZE];
 	int i, len, pos, size;
@@ -508,7 +512,8 @@
 /*
  * Print the callbacks available and what they are bound to
  */
-int do_env_callback(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_env_callback(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	struct env_clbk_tbl *clbkp;
 	int i;
@@ -576,7 +581,7 @@
 /*
  * Print the flags available and what variables have flags
  */
-int do_env_flags(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_env_flags(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	/* Print the available variable types */
 	printf("Available variable type flags (position %d):\n",
@@ -618,8 +623,8 @@
  * Interactively edit an environment variable
  */
 #if defined(CONFIG_CMD_EDITENV)
-static int do_env_edit(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_env_edit(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	char buffer[CONFIG_SYS_CBSIZE];
 	char *init_val;
@@ -763,8 +768,8 @@
 
 #ifndef CONFIG_SPL_BUILD
 #if defined(CONFIG_CMD_SAVEENV) && defined(ENV_IS_IN_DEVICE)
-static int do_env_save(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_env_save(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	return env_save() ? 1 : 0;
 }
@@ -776,8 +781,8 @@
 );
 
 #if defined(CONFIG_CMD_ERASEENV)
-static int do_env_erase(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_env_erase(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	return env_erase() ? 1 : 0;
 }
@@ -807,8 +812,8 @@
 }
 
 #ifndef CONFIG_SPL_BUILD
-static int do_env_default(cmd_tbl_t *cmdtp, int flag,
-			  int argc, char * const argv[])
+static int do_env_default(struct cmd_tbl *cmdtp, int flag,
+			  int argc, char *const argv[])
 {
 	int all = 0, env_flag = H_INTERACTIVE;
 
@@ -845,8 +850,8 @@
 	return cmd_usage(cmdtp);
 }
 
-static int do_env_delete(cmd_tbl_t *cmdtp, int flag,
-			 int argc, char * const argv[])
+static int do_env_delete(struct cmd_tbl *cmdtp, int flag,
+			 int argc, char *const argv[])
 {
 	int env_flag = H_INTERACTIVE;
 	int ret = 0;
@@ -926,8 +931,8 @@
  *
  *	=> env import -d -t ${backup_addr}
  */
-static int do_env_export(cmd_tbl_t *cmdtp, int flag,
-			 int argc, char * const argv[])
+static int do_env_export(struct cmd_tbl *cmdtp, int flag,
+			 int argc, char *const argv[])
 {
 	char	buf[32];
 	ulong	addr;
@@ -1059,8 +1064,8 @@
  *		the environment at address 'addr'. Without arguments, the whole
  *		environment gets imported.
  */
-static int do_env_import(cmd_tbl_t *cmdtp, int flag,
-			 int argc, char * const argv[])
+static int do_env_import(struct cmd_tbl *cmdtp, int flag,
+			 int argc, char *const argv[])
 {
 	ulong	addr;
 	char	*cmd, *ptr;
@@ -1220,8 +1225,8 @@
  * env info [-d] - evaluate whether default environment is used
  * env info [-p] - evaluate whether environment can be persisted
  */
-static int do_env_info(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+static int do_env_info(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
 	int eval_flags = 0;
 	int eval_results = 0;
@@ -1277,8 +1282,8 @@
 #endif
 
 #if defined(CONFIG_CMD_ENV_EXISTS)
-static int do_env_exists(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_env_exists(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	struct env_entry e, *ep;
 
@@ -1296,7 +1301,7 @@
 /*
  * New command line interface: "env" command with subcommands
  */
-static cmd_tbl_t cmd_env_sub[] = {
+static struct cmd_tbl cmd_env_sub[] = {
 #if defined(CONFIG_CMD_ASKENV)
 	U_BOOT_CMD_MKENT(ask, CONFIG_SYS_MAXARGS, 1, do_env_ask, "", ""),
 #endif
@@ -1346,9 +1351,9 @@
 }
 #endif
 
-static int do_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c
index 6f69a84..29cad38 100644
--- a/cmd/nvedit_efi.c
+++ b/cmd/nvedit_efi.c
@@ -14,6 +14,7 @@
 #include <hexdump.h>
 #include <malloc.h>
 #include <mapmem.h>
+#include <uuid.h>
 #include <linux/kernel.h>
 
 /*
@@ -137,7 +138,7 @@
  *
  * Show information encoded in named UEFI variables
  */
-static int efi_dump_vars(int argc,  char * const argv[],
+static int efi_dump_vars(int argc,  char *const argv[],
 			 const efi_guid_t *guid, bool verbose)
 {
 	u16 *var_name16, *p;
@@ -171,7 +172,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static bool match_name(int argc, char * const argv[], u16 *var_name16)
+static bool match_name(int argc, char *const argv[], u16 *var_name16)
 {
 	char *buf, *p;
 	size_t buflen;
@@ -209,7 +210,7 @@
  *
  * Show information encoded in all the UEFI variables
  */
-static int efi_dump_var_all(int argc,  char * const argv[],
+static int efi_dump_var_all(int argc,  char *const argv[],
 			    const efi_guid_t *guid_p, bool verbose)
 {
 	u16 *var_name16, *p;
@@ -274,7 +275,8 @@
  * If one or more variable names are specified, show information
  * named UEFI variables, otherwise show all the UEFI variables.
  */
-int do_env_print_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	efi_guid_t guid;
 	const efi_guid_t *guid_p;
@@ -464,7 +466,8 @@
  * Encode values specified and set given UEFI variable.
  * If no value is specified, delete the variable.
  */
-int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	char *var_name, *value, *ep;
 	ulong addr;
diff --git a/cmd/nvme.c b/cmd/nvme.c
index 5da903b..e715c57 100644
--- a/cmd/nvme.c
+++ b/cmd/nvme.c
@@ -5,13 +5,15 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <dm.h>
 #include <nvme.h>
 
 static int nvme_curr_dev;
 
-static int do_nvme(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_nvme(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	int ret;
 
diff --git a/cmd/onenand.c b/cmd/onenand.c
index d97844f..216458b 100644
--- a/cmd/onenand.c
+++ b/cmd/onenand.c
@@ -24,7 +24,7 @@
 static loff_t next_ofs;
 static loff_t skip_ofs;
 
-static int arg_off_size_onenand(int argc, char * const argv[], ulong *off,
+static int arg_off_size_onenand(int argc, char *const argv[], ulong *off,
 				size_t *size)
 {
 	if (argc >= 1) {
@@ -358,13 +358,15 @@
 	return 0;
 }
 
-static int do_onenand_info(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_info(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	printf("%s\n", mtd->name);
 	return 0;
 }
 
-static int do_onenand_bad(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_bad(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	ulong ofs;
 
@@ -379,7 +381,8 @@
 	return 0;
 }
 
-static int do_onenand_read(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_read(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	char *s;
 	int oob = 0;
@@ -408,7 +411,8 @@
 	return ret == 0 ? 0 : 1;
 }
 
-static int do_onenand_write(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_write(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	ulong addr, ofs;
 	size_t len;
@@ -434,7 +438,8 @@
 	return ret == 0 ? 0 : 1;
 }
 
-static int do_onenand_erase(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_erase(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	ulong ofs;
 	int ret = 0;
@@ -470,7 +475,8 @@
 	return ret == 0 ? 0 : 1;
 }
 
-static int do_onenand_test(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_test(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	ulong ofs;
 	int ret = 0;
@@ -495,7 +501,8 @@
 	return ret == 0 ? 0 : 1;
 }
 
-static int do_onenand_dump(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	ulong ofs;
 	int ret = 0;
@@ -515,7 +522,8 @@
 	return ret == 0 ? 1 : 0;
 }
 
-static int do_onenand_markbad(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand_markbad(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	int ret = 0;
 	ulong addr;
@@ -545,7 +553,7 @@
 	return ret;
 }
 
-static cmd_tbl_t cmd_onenand_sub[] = {
+static struct cmd_tbl cmd_onenand_sub[] = {
 	U_BOOT_CMD_MKENT(info, 1, 0, do_onenand_info, "", ""),
 	U_BOOT_CMD_MKENT(bad, 1, 0, do_onenand_bad, "", ""),
 	U_BOOT_CMD_MKENT(read, 4, 0, do_onenand_read, "", ""),
@@ -563,9 +571,10 @@
 }
 #endif
 
-static int do_onenand(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+static int do_onenand(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/osd.c b/cmd/osd.c
index 0b1fa49..bdad5d8 100644
--- a/cmd/osd.c
+++ b/cmd/osd.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <hexdump.h>
 #include <video_osd.h>
@@ -80,8 +81,8 @@
 	printf("\n");
 }
 
-static int do_osd_write(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_osd_write(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	uint x, y;
 	uint count;
@@ -131,8 +132,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_osd_print(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_osd_print(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	uint x, y;
 	u8 color;
@@ -161,8 +162,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_osd_size(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_osd_size(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	uint x, y;
 	int res;
@@ -187,8 +188,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_show_osd(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_show_osd(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct udevice *osd;
 
@@ -223,8 +224,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_osd_num(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_osd_num(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int osd_no;
 	int res = 0;
@@ -250,7 +251,7 @@
 	return res ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t cmd_osd_sub[] = {
+static struct cmd_tbl cmd_osd_sub[] = {
 	U_BOOT_CMD_MKENT(show, 1, 1, do_show_osd, "", ""),
 	U_BOOT_CMD_MKENT(dev, 1, 1, do_osd_num, "", ""),
 	U_BOOT_CMD_MKENT(write, 4, 1, do_osd_write, "", ""),
@@ -258,9 +259,9 @@
 	U_BOOT_CMD_MKENT(size, 2, 1, do_osd_size, "", ""),
 };
 
-static int do_osd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_osd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/part.c b/cmd/part.c
index 5e4e45c..216f14b 100644
--- a/cmd/part.c
+++ b/cmd/part.c
@@ -28,11 +28,11 @@
 	CMD_PART_INFO_NUMBER
 };
 
-static int do_part_uuid(int argc, char * const argv[])
+static int do_part_uuid(int argc, char *const argv[])
 {
 	int part;
 	struct blk_desc *dev_desc;
-	disk_partition_t info;
+	struct disk_partition info;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
@@ -51,7 +51,7 @@
 	return 0;
 }
 
-static int do_part_list(int argc, char * const argv[])
+static int do_part_list(int argc, char *const argv[])
 {
 	int ret;
 	struct blk_desc *desc;
@@ -90,7 +90,7 @@
 	if (var != NULL) {
 		int p;
 		char str[512] = { '\0', };
-		disk_partition_t info;
+		struct disk_partition info;
 
 		for (p = 1; p < MAX_SEARCH_PARTITIONS; p++) {
 			char t[5];
@@ -114,10 +114,10 @@
 	return 0;
 }
 
-static int do_part_info(int argc, char * const argv[], enum cmd_part_info param)
+static int do_part_info(int argc, char *const argv[], enum cmd_part_info param)
 {
 	struct blk_desc *desc;
-	disk_partition_t info;
+	struct disk_partition info;
 	char buf[512] = { 0 };
 	char *endp;
 	int part;
@@ -167,22 +167,23 @@
 	return 0;
 }
 
-static int do_part_start(int argc, char * const argv[])
+static int do_part_start(int argc, char *const argv[])
 {
 	return do_part_info(argc, argv, CMD_PART_INFO_START);
 }
 
-static int do_part_size(int argc, char * const argv[])
+static int do_part_size(int argc, char *const argv[])
 {
 	return do_part_info(argc, argv, CMD_PART_INFO_SIZE);
 }
 
-static int do_part_number(int argc, char * const argv[])
+static int do_part_number(int argc, char *const argv[])
 {
 	return do_part_info(argc, argv, CMD_PART_INFO_NUMBER);
 }
 
-static int do_part(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_part(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/pcap.c b/cmd/pcap.c
index 980603f..d0172f3 100644
--- a/cmd/pcap.c
+++ b/cmd/pcap.c
@@ -9,8 +9,8 @@
 #include <net.h>
 #include <net/pcap.h>
 
-static int do_pcap_init(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_pcap_init(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	phys_addr_t addr;
 	unsigned int size;
@@ -24,26 +24,26 @@
 	return pcap_init(addr, size) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
 
-static int do_pcap_start(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_pcap_start(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	return pcap_start_stop(true) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
 
-static int do_pcap_stop(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_pcap_stop(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	return pcap_start_stop(false) ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
 
-static int do_pcap_status(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_pcap_status(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	return pcap_print_status() ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
 
-static int do_pcap_clear(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_pcap_clear(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	return pcap_clear() ? CMD_RET_FAILURE : CMD_RET_SUCCESS;
 }
diff --git a/cmd/pci.c b/cmd/pci.c
index 0043471..f91a4eb 100644
--- a/cmd/pci.c
+++ b/cmd/pci.c
@@ -18,6 +18,7 @@
 #include <command.h>
 #include <console.h>
 #include <dm.h>
+#include <init.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <pci.h>
@@ -655,7 +656,7 @@
  *      pci modify[.b, .w, .l] bus.device.function [addr]
  *      pci write[.b, .w, .l] bus.device.function addr value
  */
-static int do_pci(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_pci(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong addr = 0, value = 0, cmd_size = 0;
 	enum pci_size_t size = PCI_SIZE_32;
diff --git a/cmd/pinmux.c b/cmd/pinmux.c
index de909a1..9942b15 100644
--- a/cmd/pinmux.c
+++ b/cmd/pinmux.c
@@ -14,7 +14,8 @@
 
 static struct udevice *currdev;
 
-static int do_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[])
 {
 	const char *name;
 	int ret;
@@ -75,7 +76,8 @@
 	return 0;
 }
 
-static int do_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_status(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	struct udevice *dev;
 	int ret = CMD_RET_USAGE;
@@ -99,7 +101,8 @@
 	return ret;
 }
 
-static int do_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_list(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct udevice *dev;
 
@@ -118,16 +121,16 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t pinmux_subcmd[] = {
+static struct cmd_tbl pinmux_subcmd[] = {
 	U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""),
 	U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""),
 	U_BOOT_CMD_MKENT(status, 2, 1, do_status, "", ""),
 };
 
-static int do_pinmux(cmd_tbl_t *cmdtp, int flag, int argc,
-		     char * const argv[])
+static int do_pinmux(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
-	cmd_tbl_t *cmd;
+	struct cmd_tbl *cmd;
 
 	argc--;
 	argv++;
diff --git a/cmd/pmc.c b/cmd/pmc.c
index cafeba9..9a3ba2b 100644
--- a/cmd/pmc.c
+++ b/cmd/pmc.c
@@ -30,7 +30,8 @@
 	return 0;
 }
 
-static int do_pmc_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_pmc_init(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct udevice *dev;
 	int ret;
@@ -42,7 +43,8 @@
 	return 0;
 }
 
-static int do_pmc_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_pmc_info(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct udevice *dev;
 	int ret;
@@ -55,14 +57,14 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_pmc_sub[] = {
+static struct cmd_tbl cmd_pmc_sub[] = {
 	U_BOOT_CMD_MKENT(init, 0, 1, do_pmc_init, "", ""),
 	U_BOOT_CMD_MKENT(info, 0, 1, do_pmc_info, "", ""),
 };
 
-static int do_pmc(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_pmc(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	const cmd_tbl_t *cp;
+	const struct cmd_tbl *cp;
 
 	if (argc < 2) /* no subcommand */
 		return cmd_usage(cmdtp);
diff --git a/cmd/pmic.c b/cmd/pmic.c
index 2400bfb..3bda053 100644
--- a/cmd/pmic.c
+++ b/cmd/pmic.c
@@ -4,6 +4,7 @@
  * Przemyslaw Marczak <p.marczak@samsung.com>
  */
 #include <common.h>
+#include <command.h>
 #include <errno.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
@@ -21,7 +22,7 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *name;
 	int ret = -ENODEV;
@@ -46,7 +47,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_list(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct udevice *dev;
 	int ret;
@@ -73,7 +75,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_dump(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dump(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct uc_pmic_priv *priv;
 	struct udevice *dev;
@@ -118,7 +121,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_read(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct uc_pmic_priv *priv;
 	struct udevice *dev;
@@ -157,7 +161,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_write(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_write(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	struct udevice *dev;
 	uint reg, value;
@@ -191,7 +196,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t subcmd[] = {
+static struct cmd_tbl subcmd[] = {
 	U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""),
 	U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""),
 	U_BOOT_CMD_MKENT(dump, 1, 1, do_dump, "", ""),
@@ -199,10 +204,10 @@
 	U_BOOT_CMD_MKENT(write, 3, 1, do_write, "", ""),
 };
 
-static int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_pmic(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
-	cmd_tbl_t *cmd;
+	struct cmd_tbl *cmd;
 
 	argc--;
 	argv++;
diff --git a/cmd/pxe.c b/cmd/pxe.c
index bce6728..6372fc9 100644
--- a/cmd/pxe.c
+++ b/cmd/pxe.c
@@ -24,7 +24,8 @@
 	NULL
 };
 
-static int do_get_tftp(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+static int do_get_tftp(struct cmd_tbl *cmdtp, const char *file_path,
+		       char *file_addr)
 {
 	char *tftp_argv[] = {"tftp", NULL, NULL, NULL};
 
@@ -42,7 +43,7 @@
  *
  * Returns 1 on success or < 0 on error.
  */
-static int pxe_uuid_path(cmd_tbl_t *cmdtp, unsigned long pxefile_addr_r)
+static int pxe_uuid_path(struct cmd_tbl *cmdtp, unsigned long pxefile_addr_r)
 {
 	char *uuid_str;
 
@@ -60,7 +61,7 @@
  *
  * Returns 1 on success or < 0 on error.
  */
-static int pxe_mac_path(cmd_tbl_t *cmdtp, unsigned long pxefile_addr_r)
+static int pxe_mac_path(struct cmd_tbl *cmdtp, unsigned long pxefile_addr_r)
 {
 	char mac_str[21];
 	int err;
@@ -80,7 +81,7 @@
  *
  * Returns 1 on success or < 0 on error.
  */
-static int pxe_ipaddr_paths(cmd_tbl_t *cmdtp, unsigned long pxefile_addr_r)
+static int pxe_ipaddr_paths(struct cmd_tbl *cmdtp, unsigned long pxefile_addr_r)
 {
 	char ip_addr[9];
 	int mask_pos, err;
@@ -113,7 +114,7 @@
  * Returns 0 on success or 1 on error.
  */
 static int
-do_pxe_get(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_pxe_get(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *pxefile_addr_str;
 	unsigned long pxefile_addr_r;
@@ -166,7 +167,7 @@
  * Returns 0 on success, 1 on error.
  */
 static int
-do_pxe_boot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_pxe_boot(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long pxefile_addr_r;
 	struct pxe_menu *cfg;
@@ -206,14 +207,14 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_pxe_sub[] = {
+static struct cmd_tbl cmd_pxe_sub[] = {
 	U_BOOT_CMD_MKENT(get, 1, 1, do_pxe_get, "", ""),
 	U_BOOT_CMD_MKENT(boot, 2, 1, do_pxe_boot, "", "")
 };
 
-static int do_pxe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_pxe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/pxe_utils.c b/cmd/pxe_utils.c
index c244bfb..8716e78 100644
--- a/cmd/pxe_utils.c
+++ b/cmd/pxe_utils.c
@@ -5,11 +5,14 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <image.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <lcd.h>
+#include <net.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <errno.h>
@@ -99,7 +102,8 @@
 	return 1;
 }
 
-int (*do_getfile)(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr);
+int (*do_getfile)(struct cmd_tbl *cmdtp, const char *file_path,
+		  char *file_addr);
 
 /*
  * As in pxelinux, paths to files referenced from files we retrieve are
@@ -109,7 +113,7 @@
  *
  * Returns 1 for success, or < 0 on error.
  */
-static int get_relfile(cmd_tbl_t *cmdtp, const char *file_path,
+static int get_relfile(struct cmd_tbl *cmdtp, const char *file_path,
 		       unsigned long file_addr)
 {
 	size_t path_len;
@@ -147,7 +151,7 @@
  *
  * Returns 1 on success, or < 0 for error.
  */
-int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path,
+int get_pxe_file(struct cmd_tbl *cmdtp, const char *file_path,
 		 unsigned long file_addr)
 {
 	unsigned long config_file_size;
@@ -188,7 +192,7 @@
  *
  * Returns 1 on success or < 0 on error.
  */
-int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file,
+int get_pxelinux_path(struct cmd_tbl *cmdtp, const char *file,
 		      unsigned long pxefile_addr_r)
 {
 	size_t base_len = strlen(PXELINUX_DIR);
@@ -212,7 +216,7 @@
  *
  * Returns 1 on success or < 0 on error.
  */
-static int get_relfile_envaddr(cmd_tbl_t *cmdtp, const char *file_path,
+static int get_relfile_envaddr(struct cmd_tbl *cmdtp, const char *file_path,
 			       const char *envaddr_name)
 {
 	unsigned long file_addr;
@@ -342,7 +346,7 @@
  * If the label specifies an 'append' line, its contents will overwrite that
  * of the 'bootargs' environment variable.
  */
-static int label_boot(cmd_tbl_t *cmdtp, struct pxe_label *label)
+static int label_boot(struct cmd_tbl *cmdtp, struct pxe_label *label)
 {
 	char *bootm_argv[] = { "bootm", NULL, NULL, NULL, NULL };
 	char initrd_str[28];
@@ -821,7 +825,7 @@
 	return 1;
 }
 
-static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
+static int parse_pxefile_top(struct cmd_tbl *cmdtp, char *p, unsigned long base,
 			     struct pxe_menu *cfg, int nest_level);
 
 /*
@@ -832,7 +836,7 @@
  * include, nest_level has already been incremented and doesn't need to be
  * incremented here.
  */
-static int handle_include(cmd_tbl_t *cmdtp, char **c, unsigned long base,
+static int handle_include(struct cmd_tbl *cmdtp, char **c, unsigned long base,
 			  struct pxe_menu *cfg, int nest_level)
 {
 	char *include_path;
@@ -872,7 +876,7 @@
  * nest_level should be 1 when parsing the top level pxe file, 2 when parsing
  * a file it includes, 3 when parsing a file included by that file, and so on.
  */
-static int parse_menu(cmd_tbl_t *cmdtp, char **c, struct pxe_menu *cfg,
+static int parse_menu(struct cmd_tbl *cmdtp, char **c, struct pxe_menu *cfg,
 		      unsigned long base, int nest_level)
 {
 	struct token t;
@@ -1085,7 +1089,7 @@
  *
  * Returns 1 on success, < 0 on error.
  */
-static int parse_pxefile_top(cmd_tbl_t *cmdtp, char *p, unsigned long base,
+static int parse_pxefile_top(struct cmd_tbl *cmdtp, char *p, unsigned long base,
 			     struct pxe_menu *cfg, int nest_level)
 {
 	struct token t;
@@ -1193,7 +1197,7 @@
  * files it includes). The resulting pxe_menu struct can be free()'d by using
  * the destroy_pxe_menu() function.
  */
-struct pxe_menu *parse_pxefile(cmd_tbl_t *cmdtp, unsigned long menucfg)
+struct pxe_menu *parse_pxefile(struct cmd_tbl *cmdtp, unsigned long menucfg)
 {
 	struct pxe_menu *cfg;
 	char *buf;
@@ -1277,7 +1281,7 @@
 /*
  * Try to boot any labels we have yet to attempt to boot.
  */
-static void boot_unattempted_labels(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
+static void boot_unattempted_labels(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
 {
 	struct list_head *pos;
 	struct pxe_label *label;
@@ -1302,7 +1306,7 @@
  * If this function returns, there weren't any labels that successfully
  * booted, or the user interrupted the menu selection via ctrl+c.
  */
-void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg)
+void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg)
 {
 	void *choice;
 	struct menu *m;
diff --git a/cmd/pxe_utils.h b/cmd/pxe_utils.h
index a38ac81..77d2588 100644
--- a/cmd/pxe_utils.h
+++ b/cmd/pxe_utils.h
@@ -74,15 +74,15 @@
 
 extern bool is_pxe;
 
-extern int (*do_getfile)(cmd_tbl_t *cmdtp, const char *file_path,
+extern int (*do_getfile)(struct cmd_tbl *cmdtp, const char *file_path,
 			 char *file_addr);
 void destroy_pxe_menu(struct pxe_menu *cfg);
-int get_pxe_file(cmd_tbl_t *cmdtp, const char *file_path,
+int get_pxe_file(struct cmd_tbl *cmdtp, const char *file_path,
 		 unsigned long file_addr);
-int get_pxelinux_path(cmd_tbl_t *cmdtp, const char *file,
+int get_pxelinux_path(struct cmd_tbl *cmdtp, const char *file,
 		      unsigned long pxefile_addr_r);
-void handle_pxe_menu(cmd_tbl_t *cmdtp, struct pxe_menu *cfg);
-struct pxe_menu *parse_pxefile(cmd_tbl_t *cmdtp, unsigned long menucfg);
+void handle_pxe_menu(struct cmd_tbl *cmdtp, struct pxe_menu *cfg);
+struct pxe_menu *parse_pxefile(struct cmd_tbl *cmdtp, unsigned long menucfg);
 int format_mac_pxe(char *outbuf, size_t outbuf_len);
 
 #endif /* __PXE_UTILS_H */
diff --git a/cmd/qfw.c b/cmd/qfw.c
index af82662..bb57148 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -93,8 +93,8 @@
 	return 0;
 }
 
-static int qemu_fwcfg_do_list(cmd_tbl_t *cmdtp, int flag,
-		int argc, char * const argv[])
+static int qemu_fwcfg_do_list(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	if (qemu_fwcfg_list_firmware() < 0)
 		return CMD_RET_FAILURE;
@@ -102,8 +102,8 @@
 	return 0;
 }
 
-static int qemu_fwcfg_do_cpus(cmd_tbl_t *cmdtp, int flag,
-		int argc, char * const argv[])
+static int qemu_fwcfg_do_cpus(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	int ret = qemu_fwcfg_online_cpus();
 	if (ret < 0) {
@@ -116,8 +116,8 @@
 	return 0;
 }
 
-static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
-		int argc, char * const argv[])
+static int qemu_fwcfg_do_load(struct cmd_tbl *cmdtp, int flag,
+			      int argc, char *const argv[])
 {
 	char *env;
 	void *load_addr;
@@ -156,16 +156,17 @@
 	return qemu_fwcfg_setup_kernel(load_addr, initrd_addr);
 }
 
-static cmd_tbl_t fwcfg_commands[] = {
+static struct cmd_tbl fwcfg_commands[] = {
 	U_BOOT_CMD_MKENT(list, 0, 1, qemu_fwcfg_do_list, "", ""),
 	U_BOOT_CMD_MKENT(cpus, 0, 1, qemu_fwcfg_do_cpus, "", ""),
 	U_BOOT_CMD_MKENT(load, 2, 1, qemu_fwcfg_do_load, "", ""),
 };
 
-static int do_qemu_fw(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_qemu_fw(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int ret;
-	cmd_tbl_t *fwcfg_cmd;
+	struct cmd_tbl *fwcfg_cmd;
 
 	if (!qemu_fwcfg_present()) {
 		printf("QEMU fw_cfg interface not found\n");
diff --git a/cmd/read.c b/cmd/read.c
index 82c2d9a..34f53f9 100644
--- a/cmd/read.c
+++ b/cmd/read.c
@@ -12,13 +12,13 @@
 #include <command.h>
 #include <part.h>
 
-int do_read(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_read(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *ep;
 	struct blk_desc *dev_desc = NULL;
 	int dev;
 	int part = 0;
-	disk_partition_t part_info;
+	struct disk_partition part_info;
 	ulong offset = 0u;
 	ulong limit = 0u;
 	void *addr;
diff --git a/cmd/reginfo.c b/cmd/reginfo.c
index de94dd8..c8a04b1 100644
--- a/cmd/reginfo.c
+++ b/cmd/reginfo.c
@@ -8,8 +8,8 @@
 #include <command.h>
 #include <asm/ppc.h>
 
-static int do_reginfo(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_reginfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	print_reginfo();
 
diff --git a/cmd/regulator.c b/cmd/regulator.c
index ed8d778..aa06c9a 100644
--- a/cmd/regulator.c
+++ b/cmd/regulator.c
@@ -4,6 +4,7 @@
  * Przemyslaw Marczak <p.marczak@samsung.com>
  */
 #include <common.h>
+#include <command.h>
 #include <errno.h>
 #include <dm.h>
 #include <dm/uclass-internal.h>
@@ -22,7 +23,7 @@
 	return CMD_RET_FAILURE;
 }
 
-static int do_dev(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dev(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct dm_regulator_uclass_platdata *uc_pdata;
 	const char *name;
@@ -82,7 +83,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_list(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_list(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct dm_regulator_uclass_platdata *uc_pdata;
 	struct udevice *dev;
@@ -137,7 +139,8 @@
 	return NULL;
 }
 
-static int do_info(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_info(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct udevice *dev;
 	struct dm_regulator_uclass_platdata *uc_pdata;
@@ -231,7 +234,8 @@
 	printf("\n");
 }
 
-static int do_status(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_status(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	struct dm_regulator_uclass_platdata *uc_pdata;
 	struct udevice *dev;
@@ -255,7 +259,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_value(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_value(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	struct udevice *dev;
 	struct dm_regulator_uclass_platdata *uc_pdata;
@@ -304,7 +309,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_current(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_current(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct udevice *dev;
 	struct dm_regulator_uclass_platdata *uc_pdata;
@@ -343,7 +349,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_mode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mode(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct udevice *dev;
 	struct dm_regulator_uclass_platdata *uc_pdata;
@@ -378,7 +385,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_enable(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_enable(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	struct udevice *dev;
 	struct dm_regulator_uclass_platdata *uc_pdata;
@@ -397,7 +405,8 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_disable(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_disable(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct udevice *dev;
 	struct dm_regulator_uclass_platdata *uc_pdata;
@@ -416,7 +425,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static cmd_tbl_t subcmd[] = {
+static struct cmd_tbl subcmd[] = {
 	U_BOOT_CMD_MKENT(dev, 2, 1, do_dev, "", ""),
 	U_BOOT_CMD_MKENT(list, 1, 1, do_list, "", ""),
 	U_BOOT_CMD_MKENT(info, 2, 1, do_info, "", ""),
@@ -428,10 +437,10 @@
 	U_BOOT_CMD_MKENT(disable, 1, 1, do_disable, "", ""),
 };
 
-static int do_regulator(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_regulator(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
-	cmd_tbl_t *cmd;
+	struct cmd_tbl *cmd;
 
 	argc--;
 	argv++;
diff --git a/cmd/reiser.c b/cmd/reiser.c
index 598fab4..3db926f 100644
--- a/cmd/reiser.c
+++ b/cmd/reiser.c
@@ -30,12 +30,12 @@
 #define PRINTF(fmt,args...)
 #endif
 
-int do_reiserls (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reiserls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename = "/";
 	int dev, part;
 	struct blk_desc *dev_desc = NULL;
-	disk_partition_t info;
+	struct disk_partition info;
 
 	if (argc < 3)
 		return CMD_RET_USAGE;
@@ -76,12 +76,12 @@
 /******************************************************************************
  * Reiserfs boot command intepreter. Derived from diskboot
  */
-int do_reiserload (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reiserload(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename = NULL;
 	int dev, part;
 	ulong addr = 0, filelen;
-	disk_partition_t info;
+	struct disk_partition info;
 	struct blk_desc *dev_desc = NULL;
 	unsigned long count;
 	char *addr_str;
diff --git a/cmd/remoteproc.c b/cmd/remoteproc.c
index da6f3fc..e8b9178 100644
--- a/cmd/remoteproc.c
+++ b/cmd/remoteproc.c
@@ -69,7 +69,7 @@
  *
  * Return: 0 if no error, else returns appropriate error value.
  */
-static int do_rproc_init(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_rproc_init(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	int id;
@@ -102,7 +102,7 @@
  *
  * Return: 0 if no error, else returns appropriate error value.
  */
-static int do_remoteproc_list(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_remoteproc_list(struct cmd_tbl *cmdtp, int flag, int argc,
 			      char *const argv[])
 {
 	if (print_remoteproc_list())
@@ -120,7 +120,7 @@
  *
  * Return: 0 if no error, else returns appropriate error value.
  */
-static int do_remoteproc_load(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_remoteproc_load(struct cmd_tbl *cmdtp, int flag, int argc,
 			      char *const argv[])
 {
 	ulong addr, size;
@@ -159,7 +159,7 @@
  *
  * Return: 0 if no error, else returns appropriate error value.
  */
-static int do_remoteproc_wrapper(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_remoteproc_wrapper(struct cmd_tbl *cmdtp, int flag, int argc,
 				 char *const argv[])
 {
 	int id, ret = CMD_RET_USAGE;
@@ -201,7 +201,7 @@
 	return ret ? CMD_RET_FAILURE : 0;
 }
 
-static cmd_tbl_t cmd_remoteproc_sub[] = {
+static struct cmd_tbl cmd_remoteproc_sub[] = {
 	U_BOOT_CMD_MKENT(init, 1, 1, do_rproc_init,
 			 "Enumerate and initialize the remote processor(s)",
 			 "id - ID of the remote processor\n"
@@ -242,10 +242,10 @@
  *
  * Return: 0 if no error, else returns appropriate error value.
  */
-static int do_remoteproc(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_remoteproc(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
-	cmd_tbl_t *c = NULL;
+	struct cmd_tbl *c = NULL;
 
 	/* Strip off leading 'rproc' command argument */
 	argc--;
diff --git a/cmd/riscv/exception.c b/cmd/riscv/exception.c
index 547fb7d..3c8dbbe 100644
--- a/cmd/riscv/exception.c
+++ b/cmd/riscv/exception.c
@@ -8,14 +8,14 @@
 #include <common.h>
 #include <command.h>
 
-static int do_undefined(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	asm volatile (".word 0xffffffff\n");
 	return CMD_RET_FAILURE;
 }
 
-static cmd_tbl_t cmd_sub[] = {
+static struct cmd_tbl cmd_sub[] = {
 	U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
 			 "", ""),
 };
diff --git a/cmd/rng.c b/cmd/rng.c
index 76367fe..9747c11 100644
--- a/cmd/rng.c
+++ b/cmd/rng.c
@@ -11,7 +11,7 @@
 #include <malloc.h>
 #include <rng.h>
 
-static int do_rng(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_rng(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	size_t n = 0x40;
 	struct udevice *dev;
diff --git a/cmd/rockusb.c b/cmd/rockusb.c
index 9b70c6a..f181ec6 100644
--- a/cmd/rockusb.c
+++ b/cmd/rockusb.c
@@ -10,7 +10,8 @@
 #include <usb.h>
 #include <asm/arch-rockchip/f_rockusb.h>
 
-static int do_rockusb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_rockusb(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int controller_index, dev_index;
 	char *usb_controller;
diff --git a/cmd/sata.c b/cmd/sata.c
index 6bdb516..aa396c1 100644
--- a/cmd/sata.c
+++ b/cmd/sata.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <blk.h>
 #include <dm.h>
 #include <command.h>
 #include <part.h>
@@ -78,7 +79,8 @@
 #endif
 }
 
-static int do_sata(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sata(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	int rc = 0;
 
diff --git a/cmd/sb.c b/cmd/sb.c
index 5701e03..f7eb921 100644
--- a/cmd/sb.c
+++ b/cmd/sb.c
@@ -5,11 +5,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <spl.h>
 #include <asm/state.h>
 
-static int do_sb_handoff(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 #if CONFIG_IS_ENABLED(HANDOFF)
@@ -26,8 +27,8 @@
 #endif
 }
 
-static int do_sb_state(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_sb_state(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	struct sandbox_state *state;
 
@@ -37,14 +38,14 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_sb_sub[] = {
+static struct cmd_tbl cmd_sb_sub[] = {
 	U_BOOT_CMD_MKENT(handoff, 1, 0, do_sb_handoff, "", ""),
 	U_BOOT_CMD_MKENT(state, 1, 0, do_sb_state, "", ""),
 };
 
-static int do_sb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	/* Skip past 'sb' */
 	argc--;
diff --git a/cmd/scsi.c b/cmd/scsi.c
index 67de1a3..5f710d2 100644
--- a/cmd/scsi.c
+++ b/cmd/scsi.c
@@ -8,6 +8,7 @@
  * SCSI support.
  */
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <scsi.h>
 
@@ -16,7 +17,8 @@
 /*
  * scsi boot command intepreter. Derived from diskboot
  */
-static int do_scsiboot(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_scsiboot(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	return common_diskboot(cmdtp, "scsi", argc, argv);
 }
@@ -24,7 +26,8 @@
 /*
  * scsi command intepreter
  */
-static int do_scsi(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_scsi(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	int ret;
 
diff --git a/cmd/setexpr.c b/cmd/setexpr.c
index 0182f19..770dc24 100644
--- a/cmd/setexpr.c
+++ b/cmd/setexpr.c
@@ -12,6 +12,7 @@
 #include <config.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <mapmem.h>
 
 static ulong get_arg(char *s, int w)
@@ -290,7 +291,8 @@
 }
 #endif
 
-static int do_setexpr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_setexpr(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	ulong a, b;
 	ulong value;
diff --git a/cmd/sf.c b/cmd/sf.c
index e993b3e..727837d 100644
--- a/cmd/sf.c
+++ b/cmd/sf.c
@@ -6,12 +6,16 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <div64.h>
 #include <dm.h>
+#include <flash.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <spi.h>
 #include <spi_flash.h>
+#include <asm/cache.h>
 #include <jffs2/jffs2.h>
 #include <linux/mtd/mtd.h>
 
@@ -79,7 +83,7 @@
 		return 1024 * len / max(get_timer(start_ms), 1UL);
 }
 
-static int do_spi_flash_probe(int argc, char * const argv[])
+static int do_spi_flash_probe(int argc, char *const argv[])
 {
 	unsigned int bus = CONFIG_SF_DEFAULT_BUS;
 	unsigned int cs = CONFIG_SF_DEFAULT_CS;
@@ -259,7 +263,7 @@
 	return 0;
 }
 
-static int do_spi_flash_read_write(int argc, char * const argv[])
+static int do_spi_flash_read_write(int argc, char *const argv[])
 {
 	unsigned long addr;
 	void *buf;
@@ -317,7 +321,7 @@
 	return ret == 0 ? 0 : 1;
 }
 
-static int do_spi_flash_erase(int argc, char * const argv[])
+static int do_spi_flash_erase(int argc, char *const argv[])
 {
 	int ret;
 	int dev = 0;
@@ -349,7 +353,7 @@
 	return ret == 0 ? 0 : 1;
 }
 
-static int do_spi_protect(int argc, char * const argv[])
+static int do_spi_protect(int argc, char *const argv[])
 {
 	int ret = 0;
 	loff_t start, len;
@@ -498,7 +502,7 @@
 	return 0;
 }
 
-static int do_spi_flash_test(int argc, char * const argv[])
+static int do_spi_flash_test(int argc, char *const argv[])
 {
 	unsigned long offset;
 	unsigned long len;
@@ -542,8 +546,8 @@
 }
 #endif /* CONFIG_CMD_SF_TEST */
 
-static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_spi_flash(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	const char *cmd;
 	int ret;
diff --git a/cmd/sha1sum.c b/cmd/sha1sum.c
index 3c50fc2..bcc665a 100644
--- a/cmd/sha1sum.c
+++ b/cmd/sha1sum.c
@@ -12,7 +12,7 @@
 #include <hash.h>
 #include <u-boot/sha1.h>
 
-int do_sha1sum(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_sha1sum(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int flags = HASH_FLAG_ENV;
 	int ac;
diff --git a/cmd/smccc.c b/cmd/smccc.c
index 8b1475c..0b19f6c 100644
--- a/cmd/smccc.c
+++ b/cmd/smccc.c
@@ -10,7 +10,8 @@
 #include <linux/compiler.h>
 #include <linux/psci.h>
 
-static int do_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_call(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct arm_smccc_res res;
 
diff --git a/cmd/sound.c b/cmd/sound.c
index 638f29d..7fc1967 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -13,7 +13,8 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 /* Initilaise sound subsystem */
-static int do_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_init(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct udevice *dev;
 	int ret;
@@ -30,7 +31,8 @@
 }
 
 /* play sound from buffer */
-static int do_play(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_play(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct udevice *dev;
 	int ret = 0;
@@ -53,15 +55,16 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_sound_sub[] = {
+static struct cmd_tbl cmd_sound_sub[] = {
 	U_BOOT_CMD_MKENT(init, 0, 1, do_init, "", ""),
 	U_BOOT_CMD_MKENT(play, 2, 1, do_play, "", ""),
 };
 
 /* process sound command */
-static int do_sound(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_sound(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	if (argc < 1)
 		return CMD_RET_USAGE;
diff --git a/cmd/source.c b/cmd/source.c
index 92f8f77..b6c709a 100644
--- a/cmd/source.c
+++ b/cmd/source.c
@@ -18,6 +18,7 @@
 #include <command.h>
 #include <env.h>
 #include <image.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <asm/byteorder.h>
@@ -154,13 +155,14 @@
 		return 1;
 	}
 
-	debug ("** Script length: %ld\n", len);
+	debug("** Script length: %ld\n", len);
 	return run_command_list((char *)data, len, 0);
 }
 
 /**************************************************/
 #if defined(CONFIG_CMD_SOURCE)
-static int do_source(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_source(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	ulong addr;
 	int rcode;
@@ -169,16 +171,16 @@
 	/* Find script image */
 	if (argc < 2) {
 		addr = CONFIG_SYS_LOAD_ADDR;
-		debug ("*  source: default load address = 0x%08lx\n", addr);
+		debug("*  source: default load address = 0x%08lx\n", addr);
 #if defined(CONFIG_FIT)
 	} else if (fit_parse_subimage(argv[1], image_load_addr, &addr,
 				      &fit_uname)) {
-		debug ("*  source: subimage '%s' from FIT image at 0x%08lx\n",
-				fit_uname, addr);
+		debug("*  source: subimage '%s' from FIT image at 0x%08lx\n",
+		      fit_uname, addr);
 #endif
 	} else {
 		addr = simple_strtoul(argv[1], NULL, 16);
-		debug ("*  source: cmdline image address = 0x%08lx\n", addr);
+		debug("*  source: cmdline image address = 0x%08lx\n", addr);
 	}
 
 	printf ("## Executing script at %08lx\n", addr);
diff --git a/cmd/spi.c b/cmd/spi.c
index bfa185b..aec9121 100644
--- a/cmd/spi.c
+++ b/cmd/spi.c
@@ -97,7 +97,7 @@
  * The command prints out the hexadecimal string received via SPI.
  */
 
-int do_spi (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_spi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char  *cp = 0;
 	uchar tmp;
diff --git a/cmd/spl.c b/cmd/spl.c
index 56051b8..28b40dd 100644
--- a/cmd/spl.c
+++ b/cmd/spl.c
@@ -8,6 +8,8 @@
 #include <command.h>
 #include <cmd_spl.h>
 #include <env.h>
+#include <image.h>
+#include <log.h>
 #include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -49,7 +51,7 @@
 };
 
 /* Calls bootm with the parameters given */
-static int call_bootm(int argc, char * const argv[], const char *subcommand[])
+static int call_bootm(int argc, char *const argv[], const char *subcommand[])
 {
 	char *bootm_argv[5];
 
@@ -95,14 +97,15 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_spl_export_sub[] = {
+static struct cmd_tbl cmd_spl_export_sub[] = {
 	U_BOOT_CMD_MKENT(fdt, 0, 1, (void *)SPL_EXPORT_FDT, "", ""),
 	U_BOOT_CMD_MKENT(atags, 0, 1, (void *)SPL_EXPORT_ATAGS, "", ""),
 };
 
-static int spl_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int spl_export(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
-	const cmd_tbl_t *c;
+	const struct cmd_tbl *c;
 
 	if (argc < 2) /* no subcommand */
 		return cmd_usage(cmdtp);
@@ -141,13 +144,13 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_spl_sub[] = {
+static struct cmd_tbl cmd_spl_sub[] = {
 	U_BOOT_CMD_MKENT(export, 0, 1, (void *)SPL_EXPORT, "", ""),
 };
 
-static int do_spl(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_spl(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	const cmd_tbl_t *c;
+	const struct cmd_tbl *c;
 	int cmd;
 
 	if (argc < 2) /* no subcommand */
diff --git a/cmd/strings.c b/cmd/strings.c
index 41b1665..85fdc34 100644
--- a/cmd/strings.c
+++ b/cmd/strings.c
@@ -12,7 +12,7 @@
 
 static char *start_addr, *last_addr;
 
-int do_strings(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_strings(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc == 1)
 		return CMD_RET_USAGE;
diff --git a/cmd/sysboot.c b/cmd/sysboot.c
index 793d67d..af6a2f1 100644
--- a/cmd/sysboot.c
+++ b/cmd/sysboot.c
@@ -8,7 +8,8 @@
 
 static char *fs_argv[5];
 
-static int do_get_ext2(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+static int do_get_ext2(struct cmd_tbl *cmdtp, const char *file_path,
+		       char *file_addr)
 {
 #ifdef CONFIG_CMD_EXT2
 	fs_argv[0] = "ext2load";
@@ -21,7 +22,8 @@
 	return -ENOENT;
 }
 
-static int do_get_fat(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+static int do_get_fat(struct cmd_tbl *cmdtp, const char *file_path,
+		      char *file_addr)
 {
 #ifdef CONFIG_CMD_FAT
 	fs_argv[0] = "fatload";
@@ -34,7 +36,8 @@
 	return -ENOENT;
 }
 
-static int do_get_any(cmd_tbl_t *cmdtp, const char *file_path, char *file_addr)
+static int do_get_any(struct cmd_tbl *cmdtp, const char *file_path,
+		      char *file_addr)
 {
 #ifdef CONFIG_CMD_FS_GENERIC
 	fs_argv[0] = "load";
@@ -52,7 +55,8 @@
  *
  * Returns 0 on success, 1 on error.
  */
-static int do_sysboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sysboot(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	unsigned long pxefile_addr_r;
 	struct pxe_menu *cfg;
diff --git a/cmd/terminal.c b/cmd/terminal.c
index e1ec66e..f6e4d25 100644
--- a/cmd/terminal.c
+++ b/cmd/terminal.c
@@ -12,7 +12,7 @@
 #include <stdio_dev.h>
 #include <serial.h>
 
-int do_terminal(cmd_tbl_t * cmd, int flag, int argc, char * const argv[])
+int do_terminal(struct cmd_tbl *cmd, int flag, int argc, char *const argv[])
 {
 	int last_tilde = 0;
 	struct stdio_dev *dev = NULL;
diff --git a/cmd/test.c b/cmd/test.c
index 258bfd8..fa7c48f 100644
--- a/cmd/test.c
+++ b/cmd/test.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <command.h>
 #include <fs.h>
+#include <log.h>
 
 #define OP_INVALID	0
 #define OP_NOT		1
@@ -50,7 +51,8 @@
 	{0, "-e", OP_FILE_EXISTS, 4},
 };
 
-static int do_test(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_test(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	char * const *ap;
 	int i, op, left, adv, expr, last_expr, last_unop, last_binop;
@@ -190,7 +192,8 @@
 	"[args..]"
 );
 
-static int do_false(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_false(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	return 1;
 }
@@ -201,7 +204,8 @@
 	NULL
 );
 
-static int do_true(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_true(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	return 0;
 }
diff --git a/cmd/thordown.c b/cmd/thordown.c
index 8dae024..ae20ddd 100644
--- a/cmd/thordown.c
+++ b/cmd/thordown.c
@@ -7,12 +7,13 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <thor.h>
 #include <dfu.h>
 #include <g_dnl.h>
 #include <usb.h>
 
-int do_thor_down(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_thor_down(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc < 4)
 		return CMD_RET_USAGE;
diff --git a/cmd/ti/ddr3.c b/cmd/ti/ddr3.c
index a452fe7..623b63b 100644
--- a/cmd/ti/ddr3.c
+++ b/cmd/ti/ddr3.c
@@ -6,7 +6,9 @@
  */
 
 #include <cpu_func.h>
+#include <env.h>
 #include <init.h>
+#include <log.h>
 #include <asm/arch/hardware.h>
 #include <asm/cache.h>
 #include <asm/emif.h>
@@ -276,8 +278,8 @@
 		(ecc_ctrl & EMIF_ECC_REG_RMW_EN_MASK);
 }
 
-static int do_ddr_test(cmd_tbl_t *cmdtp,
-		       int flag, int argc, char * const argv[])
+static int do_ddr_test(struct cmd_tbl *cmdtp,
+		       int flag, int argc, char *const argv[])
 {
 	u32 start_addr, end_addr, size, ecc_err;
 
diff --git a/cmd/time.c b/cmd/time.c
index 51cde97..db8c189 100644
--- a/cmd/time.c
+++ b/cmd/time.c
@@ -24,7 +24,8 @@
 	printf(" %lu.%03lu seconds\n", seconds, milliseconds);
 }
 
-static int do_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_time(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	ulong cycles = 0;
 	int retval = 0;
diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
index 211ab26..eab0531 100644
--- a/cmd/tlv_eeprom.c
+++ b/cmd/tlv_eeprom.c
@@ -15,6 +15,8 @@
 #include <i2c.h>
 #include <i2c_eeprom.h>
 #include <env.h>
+#include <init.h>
+#include <net.h>
 #include <linux/ctype.h>
 #include <u-boot/crc.h>
 
@@ -423,7 +425,7 @@
  *
  *  This function implements the tlv_eeprom command.
  */
-int do_tlv_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_tlv_eeprom(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char cmd;
 	struct tlvinfo_header *eeprom_hdr = to_header(eeprom);
diff --git a/cmd/tpm-common.c b/cmd/tpm-common.c
index 3014255..88c9e08 100644
--- a/cmd/tpm-common.c
+++ b/cmd/tpm-common.c
@@ -296,7 +296,7 @@
 	return 0;
 }
 
-int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_tpm_device(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long num;
 	int rc;
@@ -314,7 +314,7 @@
 	return rc;
 }
 
-int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_tpm_info(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct udevice *dev;
 	char buf[80];
@@ -333,7 +333,7 @@
 	return 0;
 }
 
-int do_tpm_init(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_tpm_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct udevice *dev;
 	int rc;
@@ -347,9 +347,9 @@
 	return report_return_code(tpm_init(dev));
 }
 
-int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_tpm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *tpm_commands, *cmd;
+	struct cmd_tbl *tpm_commands, *cmd;
 	struct tpm_chip_priv *priv;
 	struct udevice *dev;
 	unsigned int size;
diff --git a/cmd/tpm-user-utils.h b/cmd/tpm-user-utils.h
index a851d9c..358ddff 100644
--- a/cmd/tpm-user-utils.h
+++ b/cmd/tpm-user-utils.h
@@ -17,9 +17,10 @@
 int type_string_write_vars(const char *type_str, u8 *data, char * const vars[]);
 int get_tpm(struct udevice **devp);
 
-int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_tpm_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_tpm_device(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[]);
+int do_tpm_init(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_tpm_info(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_tpm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 
 #endif /* __TPM_USER_UTILS_H */
diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c
index bc34e06..0e2168a 100644
--- a/cmd/tpm-v1.c
+++ b/cmd/tpm-v1.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
 #include <malloc.h>
 #include <asm/unaligned.h>
@@ -11,8 +12,8 @@
 #include <tpm-v1.h>
 #include "tpm-user-utils.h"
 
-static int do_tpm_startup(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_tpm_startup(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	enum tpm_startup_type mode;
 	struct udevice *dev;
@@ -37,8 +38,8 @@
 	return report_return_code(tpm_startup(dev, mode));
 }
 
-static int do_tpm_nv_define_space(cmd_tbl_t *cmdtp, int flag, int argc,
-				  char * const argv[])
+static int do_tpm_nv_define_space(struct cmd_tbl *cmdtp, int flag, int argc,
+				  char *const argv[])
 {
 	u32 index, perm, size;
 	struct udevice *dev;
@@ -57,8 +58,8 @@
 	return report_return_code(tpm_nv_define_space(dev, index, perm, size));
 }
 
-static int do_tpm_nv_read_value(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_tpm_nv_read_value(struct cmd_tbl *cmdtp, int flag, int argc,
+				char *const argv[])
 {
 	u32 index, count, rc;
 	struct udevice *dev;
@@ -83,8 +84,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_nv_write_value(cmd_tbl_t *cmdtp, int flag, int argc,
-				 char * const argv[])
+static int do_tpm_nv_write_value(struct cmd_tbl *cmdtp, int flag, int argc,
+				 char *const argv[])
 {
 	struct udevice *dev;
 	u32 index, rc;
@@ -110,8 +111,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_extend(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_tpm_extend(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	u8 in_digest[20], out_digest[20];
 	struct udevice *dev;
@@ -138,8 +139,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_pcr_read(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_tpm_pcr_read(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	u32 index, count, rc;
 	struct udevice *dev;
@@ -164,8 +165,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_tsc_physical_presence(cmd_tbl_t *cmdtp, int flag, int argc,
-					char * const argv[])
+static int do_tpm_tsc_physical_presence(struct cmd_tbl *cmdtp, int flag,
+					int argc, char *const argv[])
 {
 	struct udevice *dev;
 	u16 presence;
@@ -182,8 +183,8 @@
 	return report_return_code(tpm_tsc_physical_presence(dev, presence));
 }
 
-static int do_tpm_read_pubek(cmd_tbl_t *cmdtp, int flag, int argc,
-			     char * const argv[])
+static int do_tpm_read_pubek(struct cmd_tbl *cmdtp, int flag, int argc,
+			     char *const argv[])
 {
 	struct udevice *dev;
 	u32 count, rc;
@@ -207,8 +208,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_physical_set_deactivated(cmd_tbl_t *cmdtp, int flag, int argc,
-					   char * const argv[])
+static int do_tpm_physical_set_deactivated(struct cmd_tbl *cmdtp, int flag,
+					   int argc, char *const argv[])
 {
 	struct udevice *dev;
 	u8 state;
@@ -225,8 +226,8 @@
 	return report_return_code(tpm_physical_set_deactivated(dev, state));
 }
 
-static int do_tpm_get_capability(cmd_tbl_t *cmdtp, int flag, int argc,
-				 char * const argv[])
+static int do_tpm_get_capability(struct cmd_tbl *cmdtp, int flag, int argc,
+				 char *const argv[])
 {
 	u32 cap_area, sub_cap, rc;
 	void *cap;
@@ -253,8 +254,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_raw_transfer(cmd_tbl_t *cmdtp, int flag, int argc,
-			       char * const argv[])
+static int do_tpm_raw_transfer(struct cmd_tbl *cmdtp, int flag, int argc,
+			       char *const argv[])
 {
 	struct udevice *dev;
 	void *command;
@@ -282,8 +283,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_nv_define(cmd_tbl_t *cmdtp, int flag, int argc,
-			    char * const argv[])
+static int do_tpm_nv_define(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	u32 index, perm, size;
 	struct udevice *dev;
@@ -306,8 +307,8 @@
 	return report_return_code(tpm_nv_define_space(dev, index, perm, size));
 }
 
-static int do_tpm_nv_read(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_tpm_nv_read(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	u32 index, count, err;
 	struct udevice *dev;
@@ -341,8 +342,8 @@
 	return report_return_code(err);
 }
 
-static int do_tpm_nv_write(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_tpm_nv_write(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	u32 index, count, err;
 	struct udevice *dev;
@@ -377,8 +378,8 @@
 
 #ifdef CONFIG_TPM_AUTH_SESSIONS
 
-static int do_tpm_oiap(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_tpm_oiap(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	u32 auth_handle, err;
 	struct udevice *dev;
@@ -394,8 +395,8 @@
 }
 
 #ifdef CONFIG_TPM_LOAD_KEY_BY_SHA1
-static int do_tpm_load_key_by_sha1(cmd_tbl_t *cmdtp, int flag, int argc, char *
-				   const argv[])
+static int do_tpm_load_key_by_sha1(struct cmd_tbl *cmdtp, int flag, int argc,
+				   char *const argv[])
 {
 	u32 parent_handle = 0;
 	u32 key_len, key_handle, err;
@@ -437,8 +438,8 @@
 }
 #endif /* CONFIG_TPM_LOAD_KEY_BY_SHA1 */
 
-static int do_tpm_load_key2_oiap(cmd_tbl_t *cmdtp, int flag, int argc,
-				 char * const argv[])
+static int do_tpm_load_key2_oiap(struct cmd_tbl *cmdtp, int flag, int argc,
+				 char *const argv[])
 {
 	u32 parent_handle, key_len, key_handle, err;
 	u8 usage_auth[DIGEST_LENGTH];
@@ -468,8 +469,8 @@
 	return report_return_code(err);
 }
 
-static int do_tpm_get_pub_key_oiap(cmd_tbl_t *cmdtp, int flag, int argc,
-				   char * const argv[])
+static int do_tpm_get_pub_key_oiap(struct cmd_tbl *cmdtp, int flag, int argc,
+				   char *const argv[])
 {
 	u32 key_handle, err;
 	u8 usage_auth[DIGEST_LENGTH];
@@ -504,8 +505,8 @@
 #endif /* CONFIG_TPM_AUTH_SESSIONS */
 
 #ifdef CONFIG_TPM_FLUSH_RESOURCES
-static int do_tpm_flush(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_tpm_flush(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	struct udevice *dev;
 	int type = 0;
@@ -577,8 +578,8 @@
 #endif /* CONFIG_TPM_FLUSH_RESOURCES */
 
 #ifdef CONFIG_TPM_LIST_RESOURCES
-static int do_tpm_list(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_tpm_list(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	int type = 0;
 	u16 res_count;
@@ -644,7 +645,7 @@
 TPM_COMMAND_NO_ARG(tpm_physical_enable)
 TPM_COMMAND_NO_ARG(tpm_physical_disable)
 
-static cmd_tbl_t tpm1_commands[] = {
+static struct cmd_tbl tpm1_commands[] = {
 	U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""),
 	U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
 	U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""),
@@ -710,7 +711,7 @@
 #endif /* CONFIG_TPM_LIST_RESOURCES */
 };
 
-cmd_tbl_t *get_tpm1_commands(unsigned int *size)
+struct cmd_tbl *get_tpm1_commands(unsigned int *size)
 {
 	*size = ARRAY_SIZE(tpm1_commands);
 
diff --git a/cmd/tpm-v2.c b/cmd/tpm-v2.c
index 0cd3982..e674265 100644
--- a/cmd/tpm-v2.c
+++ b/cmd/tpm-v2.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <log.h>
 #include <mapmem.h>
@@ -12,8 +13,8 @@
 #include <tpm-v2.h>
 #include "tpm-user-utils.h"
 
-static int do_tpm2_startup(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_tpm2_startup(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	enum tpm2_startup_types mode;
 	struct udevice *dev;
@@ -37,8 +38,8 @@
 	return report_return_code(tpm2_startup(dev, mode));
 }
 
-static int do_tpm2_self_test(cmd_tbl_t *cmdtp, int flag, int argc,
-			     char * const argv[])
+static int do_tpm2_self_test(struct cmd_tbl *cmdtp, int flag, int argc,
+			     char *const argv[])
 {
 	enum tpm2_yes_no full_test;
 	struct udevice *dev;
@@ -62,8 +63,8 @@
 	return report_return_code(tpm2_self_test(dev, full_test));
 }
 
-static int do_tpm2_clear(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int do_tpm2_clear(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	u32 handle = 0;
 	const char *pw = (argc < 3) ? NULL : argv[2];
@@ -91,8 +92,8 @@
 	return report_return_code(tpm2_clear(dev, handle, pw, pw_sz));
 }
 
-static int do_tpm2_pcr_extend(cmd_tbl_t *cmdtp, int flag, int argc,
-			      char * const argv[])
+static int do_tpm2_pcr_extend(struct cmd_tbl *cmdtp, int flag, int argc,
+			      char *const argv[])
 {
 	struct udevice *dev;
 	struct tpm_chip_priv *priv;
@@ -122,8 +123,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_pcr_read(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+static int do_tpm_pcr_read(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	struct udevice *dev;
 	struct tpm_chip_priv *priv;
@@ -160,8 +161,8 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_get_capability(cmd_tbl_t *cmdtp, int flag, int argc,
-				 char * const argv[])
+static int do_tpm_get_capability(struct cmd_tbl *cmdtp, int flag, int argc,
+				 char *const argv[])
 {
 	u32 capability, property, rc;
 	u8 *data;
@@ -203,7 +204,7 @@
 	return report_return_code(rc);
 }
 
-static int do_tpm_dam_reset(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_tpm_dam_reset(struct cmd_tbl *cmdtp, int flag, int argc,
 			    char *const argv[])
 {
 	const char *pw = (argc < 2) ? NULL : argv[1];
@@ -224,7 +225,7 @@
 	return report_return_code(tpm2_dam_reset(dev, pw, pw_sz));
 }
 
-static int do_tpm_dam_parameters(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_tpm_dam_parameters(struct cmd_tbl *cmdtp, int flag, int argc,
 				 char *const argv[])
 {
 	const char *pw = (argc < 5) ? NULL : argv[4];
@@ -268,7 +269,7 @@
 						      lockout_recovery));
 }
 
-static int do_tpm_change_auth(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_tpm_change_auth(struct cmd_tbl *cmdtp, int flag, int argc,
 			      char *const argv[])
 {
 	u32 handle;
@@ -304,8 +305,8 @@
 						   oldpw, oldpw_sz));
 }
 
-static int do_tpm_pcr_setauthpolicy(cmd_tbl_t *cmdtp, int flag, int argc,
-				    char * const argv[])
+static int do_tpm_pcr_setauthpolicy(struct cmd_tbl *cmdtp, int flag, int argc,
+				    char *const argv[])
 {
 	u32 index = simple_strtoul(argv[1], NULL, 0);
 	char *key = argv[2];
@@ -328,8 +329,8 @@
 							 key));
 }
 
-static int do_tpm_pcr_setauthvalue(cmd_tbl_t *cmdtp, int flag,
-				   int argc, char * const argv[])
+static int do_tpm_pcr_setauthvalue(struct cmd_tbl *cmdtp, int flag,
+				   int argc, char *const argv[])
 {
 	u32 index = simple_strtoul(argv[1], NULL, 0);
 	char *key = argv[2];
@@ -353,7 +354,7 @@
 							key, key_sz));
 }
 
-static cmd_tbl_t tpm2_commands[] = {
+static struct cmd_tbl tpm2_commands[] = {
 	U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""),
 	U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""),
 	U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""),
@@ -372,7 +373,7 @@
 			 do_tpm_pcr_setauthvalue, "", ""),
 };
 
-cmd_tbl_t *get_tpm2_commands(unsigned int *size)
+struct cmd_tbl *get_tpm2_commands(unsigned int *size)
 {
 	*size = ARRAY_SIZE(tpm2_commands);
 
diff --git a/cmd/tpm_test.c b/cmd/tpm_test.c
index 2cde517..ebfb25c 100644
--- a/cmd/tpm_test.c
+++ b/cmd/tpm_test.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <tpm-v1.h>
 #include "tpm-user-utils.h"
 
@@ -483,8 +484,8 @@
 }
 
 #define VOIDTEST(XFUNC) \
-	int do_test_##XFUNC(cmd_tbl_t *cmd_tbl, int flag, int argc, \
-	char * const argv[]) \
+	int do_test_##XFUNC(struct cmd_tbl *cmd_tbl, int flag, int argc, \
+	char *const argv[]) \
 	{ \
 		struct udevice *dev; \
 		int ret; \
@@ -513,7 +514,7 @@
 VOIDTEST(write_limit)
 VOIDTEST(timer)
 
-static cmd_tbl_t cmd_cros_tpm_sub[] = {
+static struct cmd_tbl cmd_cros_tpm_sub[] = {
 	VOIDENT(early_extend)
 	VOIDENT(early_nvram)
 	VOIDENT(early_nvram2)
@@ -530,9 +531,10 @@
 	VOIDENT(timer)
 };
 
-static int do_tpmtest(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_tpmtest(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 	int i;
 
 	printf("argc = %d, argv = ", argc);
diff --git a/cmd/trace.c b/cmd/trace.c
index 392b129..4ce47c7 100644
--- a/cmd/trace.c
+++ b/cmd/trace.c
@@ -10,7 +10,7 @@
 #include <trace.h>
 #include <asm/io.h>
 
-static int get_args(int argc, char * const argv[], char **buff,
+static int get_args(int argc, char *const argv[], char **buff,
 		    size_t *buff_ptr, size_t *buff_size)
 {
 	if (argc < 2)
@@ -29,7 +29,7 @@
 	return 0;
 }
 
-static int create_func_list(int argc, char * const argv[])
+static int create_func_list(int argc, char *const argv[])
 {
 	size_t buff_size, avail, buff_ptr, needed, used;
 	char *buff;
@@ -52,7 +52,7 @@
 	return 0;
 }
 
-static int create_call_list(int argc, char * const argv[])
+static int create_call_list(int argc, char *const argv[])
 {
 	size_t buff_size, avail, buff_ptr, needed, used;
 	char *buff;
@@ -76,7 +76,7 @@
 	return 0;
 }
 
-int do_trace(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_trace(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	const char *cmd = argc < 2 ? NULL : argv[1];
 
diff --git a/cmd/tsi148.c b/cmd/tsi148.c
index 369a2b5..2eae14f 100644
--- a/cmd/tsi148.c
+++ b/cmd/tsi148.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <pci.h>
@@ -382,7 +383,7 @@
 /*
  * Tundra Tsi148 configuration
  */
-int do_tsi148(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_tsi148(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong addr1 = 0, addr2 = 0, size = 0, vam = 0, vdw = 0;
 	char cmd = 'x';
diff --git a/cmd/ubi.c b/cmd/ubi.c
index 54d128d..171377c 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -528,7 +528,7 @@
 	return 0;
 }
 
-static int do_ubi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ubi(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int64_t size = 0;
 	ulong addr = 0;
diff --git a/cmd/ubifs.c b/cmd/ubifs.c
index e4000b7..a26b653 100644
--- a/cmd/ubifs.c
+++ b/cmd/ubifs.c
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <config.h>
 #include <command.h>
+#include <log.h>
 #include <ubifs_uboot.h>
 
 static int ubifs_initialized;
@@ -38,8 +39,9 @@
 
 	return ret;
 }
-static int do_ubifs_mount(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+
+static int do_ubifs_mount(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	char *vol_name;
 
@@ -70,8 +72,8 @@
 	return 0;
 }
 
-static int do_ubifs_umount(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_ubifs_umount(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	if (argc != 1)
 		return CMD_RET_USAGE;
@@ -79,8 +81,8 @@
 	return cmd_ubifs_umount();
 }
 
-static int do_ubifs_ls(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_ubifs_ls(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	char *filename = "/";
 	int ret;
@@ -103,8 +105,8 @@
 	return ret;
 }
 
-static int do_ubifs_load(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[])
+static int do_ubifs_load(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	char *filename;
 	char *endp;
diff --git a/cmd/ufs.c b/cmd/ufs.c
index 5b25788..858cd49 100644
--- a/cmd/ufs.c
+++ b/cmd/ufs.c
@@ -9,7 +9,7 @@
 #include <command.h>
 #include <ufs.h>
 
-static int do_ufs(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ufs(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int dev, ret;
 
diff --git a/cmd/universe.c b/cmd/universe.c
index dc9a8b5..5ff47dd 100644
--- a/cmd/universe.c
+++ b/cmd/universe.c
@@ -298,7 +298,7 @@
 /*
  * Tundra Universe configuration
  */
-int do_universe(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_universe(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong addr1 = 0, addr2 = 0, size = 0, vam = 0, pms = 0, vdw = 0;
 	char cmd = 'x';
diff --git a/cmd/unlz4.c b/cmd/unlz4.c
index 5320b37..4ae7f34 100644
--- a/cmd/unlz4.c
+++ b/cmd/unlz4.c
@@ -9,7 +9,8 @@
 #include <env.h>
 #include <lz4.h>
 
-static int do_unlz4(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_unlz4(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	unsigned long src, dst;
 	size_t src_len = ~0UL, dst_len = ~0UL;
diff --git a/cmd/unzip.c b/cmd/unzip.c
index afd58e7..9b28328 100644
--- a/cmd/unzip.c
+++ b/cmd/unzip.c
@@ -8,8 +8,10 @@
 #include <command.h>
 #include <env.h>
 #include <gzip.h>
+#include <part.h>
 
-static int do_unzip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_unzip(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	unsigned long src, dst;
 	unsigned long src_len = ~0UL, dst_len = ~0UL;
@@ -41,8 +43,8 @@
 	"srcaddr dstaddr [dstsize]"
 );
 
-static int do_gzwrite(cmd_tbl_t *cmdtp, int flag,
-		      int argc, char * const argv[])
+static int do_gzwrite(struct cmd_tbl *cmdtp, int flag,
+		      int argc, char *const argv[])
 {
 	struct blk_desc *bdev;
 	int ret;
diff --git a/cmd/usb.c b/cmd/usb.c
index dd9ac0b..b9ec29a 100644
--- a/cmd/usb.c
+++ b/cmd/usb.c
@@ -11,6 +11,8 @@
  */
 
 #include <common.h>
+#include <blk.h>
+#include <bootstage.h>
 #include <command.h>
 #include <console.h>
 #include <dm.h>
@@ -554,7 +556,8 @@
  * usb boot command intepreter. Derived from diskboot
  */
 #ifdef CONFIG_USB_STORAGE
-static int do_usbboot(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_usbboot(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	return common_diskboot(cmdtp, "usb", argc, argv);
 }
@@ -623,7 +626,7 @@
 /******************************************************************************
  * usb command intepreter
  */
-static int do_usb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_usb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct usb_device *udev = NULL;
 	int i;
diff --git a/cmd/usb_gadget_sdp.c b/cmd/usb_gadget_sdp.c
index 2ead06b..1af82e1 100644
--- a/cmd/usb_gadget_sdp.c
+++ b/cmd/usb_gadget_sdp.c
@@ -7,11 +7,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <g_dnl.h>
 #include <sdp.h>
 #include <usb.h>
 
-static int do_sdp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_sdp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 
diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
index c5c6899..d565635 100644
--- a/cmd/usb_mass_storage.c
+++ b/cmd/usb_mass_storage.c
@@ -6,16 +6,18 @@
  * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved.
  */
 
-#include <errno.h>
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <console.h>
+#include <errno.h>
 #include <g_dnl.h>
 #include <malloc.h>
 #include <part.h>
 #include <usb.h>
 #include <usb_mass_storage.h>
 #include <watchdog.h>
+#include <linux/delay.h>
 
 static int ums_read_sector(struct ums *ums_dev,
 			   ulong start, lbaint_t blkcnt, void *buf)
@@ -55,7 +57,7 @@
 {
 	char *s, *t, *devnum_part_str, *name;
 	struct blk_desc *block_dev;
-	disk_partition_t info;
+	struct disk_partition info;
 	int partnum;
 	int ret = -1;
 	struct ums *ums_new;
@@ -134,8 +136,8 @@
 	return ret;
 }
 
-static int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
-			       int argc, char * const argv[])
+static int do_usb_mass_storage(struct cmd_tbl *cmdtp, int flag,
+			       int argc, char *const argv[])
 {
 	const char *usb_controller;
 	const char *devtype;
diff --git a/cmd/version.c b/cmd/version.c
index b2fffe9..3686b87 100644
--- a/cmd/version.c
+++ b/cmd/version.c
@@ -14,7 +14,8 @@
 
 const char __weak version_string[] = U_BOOT_VERSION_STRING;
 
-static int do_version(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_version(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	char buf[DISPLAY_OPTIONS_BANNER_LENGTH];
 
diff --git a/cmd/virtio.c b/cmd/virtio.c
index b7082bc..3dace53 100644
--- a/cmd/virtio.c
+++ b/cmd/virtio.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <dm.h>
 #include <virtio_types.h>
@@ -12,7 +13,8 @@
 
 static int virtio_curr_dev;
 
-static int do_virtio(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_virtio(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	if (argc == 2 && !strcmp(argv[1], "scan")) {
 		/* make sure all virtio devices are enumerated */
diff --git a/cmd/w1.c b/cmd/w1.c
index 9c95fcf..92be1f2 100644
--- a/cmd/w1.c
+++ b/cmd/w1.c
@@ -103,7 +103,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-int do_w1(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_w1(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/cmd/wdt.c b/cmd/wdt.c
index 647d989..2741098 100644
--- a/cmd/wdt.c
+++ b/cmd/wdt.c
@@ -12,7 +12,7 @@
 
 static struct udevice *currdev;
 
-static int do_wdt_list(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_wdt_list(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	struct udevice *dev;
@@ -29,7 +29,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_wdt_dev(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_wdt_dev(struct cmd_tbl *cmdtp, int flag, int argc,
 		      char *const argv[])
 {
 	int ret;
@@ -60,7 +60,7 @@
 	return 0;
 }
 
-static int do_wdt_start(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_wdt_start(struct cmd_tbl *cmdtp, int flag, int argc,
 			char *const argv[])
 {
 	int ret;
@@ -90,7 +90,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_wdt_stop(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_wdt_stop(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	int ret;
@@ -111,7 +111,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_wdt_reset(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_wdt_reset(struct cmd_tbl *cmdtp, int flag, int argc,
 			char *const argv[])
 {
 	int ret;
@@ -132,7 +132,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-static int do_wdt_expire(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_wdt_expire(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	int ret;
diff --git a/cmd/wol.c b/cmd/wol.c
index 8a756f3..f0d6343 100644
--- a/cmd/wol.c
+++ b/cmd/wol.c
@@ -14,7 +14,7 @@
 #if defined(CONFIG_CMD_WOL)
 void wol_set_timeout(ulong);
 
-int do_wol(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_wol(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	/* Validate arguments */
 	if (argc < 2)
diff --git a/cmd/x86/exception.c b/cmd/x86/exception.c
index ade1e2e..82faaa9 100644
--- a/cmd/x86/exception.c
+++ b/cmd/x86/exception.c
@@ -8,14 +8,14 @@
 #include <common.h>
 #include <command.h>
 
-static int do_undefined(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+static int do_undefined(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
 	asm volatile (".word 0xffff\n");
 	return CMD_RET_FAILURE;
 }
 
-static cmd_tbl_t cmd_sub[] = {
+static struct cmd_tbl cmd_sub[] = {
 	U_BOOT_CMD_MKENT(undefined, CONFIG_SYS_MAXARGS, 1, do_undefined,
 			 "", ""),
 };
diff --git a/cmd/x86/fsp.c b/cmd/x86/fsp.c
index 6e485fb..8017eda 100644
--- a/cmd/x86/fsp.c
+++ b/cmd/x86/fsp.c
@@ -9,7 +9,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int do_hdr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_hdr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct fsp_header *hdr;
 	u32 img_addr;
@@ -80,13 +80,13 @@
 	return 0;
 }
 
-static cmd_tbl_t fsp_commands[] = {
+static struct cmd_tbl fsp_commands[] = {
 	U_BOOT_CMD_MKENT(hdr, 0, 1, do_hdr, "", ""),
 };
 
-static int do_fsp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_fsp(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *fsp_cmd;
+	struct cmd_tbl *fsp_cmd;
 	int ret;
 
 	if (argc < 2)
diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c
index 3967a7c..6b1f7bd 100644
--- a/cmd/x86/hob.c
+++ b/cmd/x86/hob.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <efi.h>
+#include <uuid.h>
 #include <asm/hob.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -25,7 +26,7 @@
 	"Capsule",
 };
 
-static int do_hob(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_hob(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	const struct hob_header *hdr;
 	uint type;
diff --git a/cmd/x86/mtrr.c b/cmd/x86/mtrr.c
index d3fd959..2c40e71 100644
--- a/cmd/x86/mtrr.c
+++ b/cmd/x86/mtrr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <asm/msr.h>
 #include <asm/mtrr.h>
 
@@ -43,7 +44,7 @@
 	return 0;
 }
 
-static int do_mtrr_set(uint reg, int argc, char * const argv[])
+static int do_mtrr_set(uint reg, int argc, char *const argv[])
 {
 	const char *typename = argv[0];
 	struct mtrr_state state;
@@ -98,7 +99,8 @@
 	return 0;
 }
 
-static int do_mtrr(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_mtrr(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	const char *cmd;
 	uint reg;
diff --git a/cmd/ximg.c b/cmd/ximg.c
index 770f6a3..159ba51 100644
--- a/cmd/ximg.c
+++ b/cmd/ximg.c
@@ -24,6 +24,7 @@
 #include <bzlib.h>
 #endif
 #include <asm/byteorder.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 
 #ifndef CONFIG_SYS_XIMG_LEN
@@ -32,7 +33,7 @@
 #endif
 
 static int
-do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[])
+do_imgextract(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong		addr = image_load_addr;
 	ulong		dest = 0;
diff --git a/cmd/yaffs2.c b/cmd/yaffs2.c
index 9244606..f29ebcc 100644
--- a/cmd/yaffs2.c
+++ b/cmd/yaffs2.c
@@ -43,7 +43,7 @@
 extern int yaffs_dump_dev(const char *path);
 
 /* ytrace - show/set yaffs trace mask */
-int do_ytrace(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ytrace(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	if (argc > 1)
 		cmd_yaffs_tracemask(1, simple_strtol(argv[1], NULL, 16));
@@ -54,7 +54,7 @@
 }
 
 /* ydevls - lists yaffs mount points. */
-int do_ydevls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ydevls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	cmd_yaffs_dev_ls();
 
@@ -62,7 +62,7 @@
 }
 
 /* ydevconfig mount_pt mtd_dev_num start_block end_block */
-int do_ydevconfig(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ydevconfig(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *mtpoint;
 	int mtd_dev;
@@ -85,7 +85,7 @@
 	return 0;
 }
 
-int do_ymount(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ymount(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *mtpoint;
 
@@ -102,7 +102,7 @@
 	return 0;
 }
 
-int do_yumount(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_yumount(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *mtpoint;
 
@@ -118,7 +118,7 @@
 	return 0;
 }
 
-int do_yls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_yls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *dirname;
 
@@ -134,7 +134,7 @@
 	return 0;
 }
 
-int do_yrd(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_yrd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename;
 
@@ -153,7 +153,7 @@
 	return 0;
 }
 
-int do_ywr(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ywr(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename;
 	ulong value;
@@ -177,7 +177,7 @@
 	return 0;
 }
 
-int do_yrdm(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_yrdm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename;
 	ulong addr;
@@ -195,7 +195,7 @@
 	return 0;
 }
 
-int do_ywrm(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ywrm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *filename;
 	ulong addr;
@@ -215,7 +215,7 @@
 	return 0;
 }
 
-int do_ymkdir(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ymkdir(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *dirname;
 
@@ -230,7 +230,7 @@
 	return 0;
 }
 
-int do_yrmdir(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_yrmdir(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *dirname;
 
@@ -245,7 +245,7 @@
 	return 0;
 }
 
-int do_yrm(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_yrm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *name;
 
@@ -261,7 +261,7 @@
 	return 0;
 }
 
-int do_ymv(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ymv(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char *oldPath;
 	char *newPath;
diff --git a/cmd/zfs.c b/cmd/zfs.c
index 9c237a5..e429ac8 100644
--- a/cmd/zfs.c
+++ b/cmd/zfs.c
@@ -32,13 +32,14 @@
 #define DOS_FS_TYPE_OFFSET	0x36
 #define DOS_FS32_TYPE_OFFSET	0x52
 
-static int do_zfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_zfs_load(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	char *filename = NULL;
 	int dev;
 	int part;
 	ulong addr = 0;
-	disk_partition_t info;
+	struct disk_partition info;
 	struct blk_desc *dev_desc;
 	unsigned long count;
 	const char *addr_str;
@@ -129,13 +130,13 @@
 }
 
 
-
-static int do_zfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_zfs_ls(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	const char *filename = "/";
 	int part;
 	struct blk_desc *dev_desc;
-	disk_partition_t info;
+	struct disk_partition info;
 	struct device_s vdev;
 
 	if (argc < 2)
diff --git a/cmd/zip.c b/cmd/zip.c
index 8ef46e9..b433f18 100644
--- a/cmd/zip.c
+++ b/cmd/zip.c
@@ -8,7 +8,7 @@
 #include <command.h>
 #include <env.h>
 
-static int do_zip(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_zip(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	unsigned long src, dst;
 	unsigned long src_len, dst_len = ~0UL;
diff --git a/common/android_ab.c b/common/android_ab.c
index e0fe32d..4943f26 100644
--- a/common/android_ab.c
+++ b/common/android_ab.c
@@ -5,9 +5,12 @@
 #include <common.h>
 #include <android_ab.h>
 #include <android_bootloader_message.h>
+#include <blk.h>
+#include <log.h>
 #include <malloc.h>
-#include <linux/err.h>
+#include <part.h>
 #include <memalign.h>
+#include <linux/err.h>
 #include <u-boot/crc.h>
 #include <u-boot/crc.h>
 
@@ -81,7 +84,7 @@
  * @return 0 on success and a negative on error
  */
 static int ab_control_create_from_disk(struct blk_desc *dev_desc,
-				       const disk_partition_t *part_info,
+				       const struct disk_partition *part_info,
 				       struct bootloader_control **abc)
 {
 	ulong abc_offset, abc_blocks, ret;
@@ -131,7 +134,7 @@
  * @return 0 on success and a negative on error
  */
 static int ab_control_store(struct blk_desc *dev_desc,
-			    const disk_partition_t *part_info,
+			    const struct disk_partition *part_info,
 			    struct bootloader_control *abc)
 {
 	ulong abc_offset, abc_blocks, ret;
@@ -178,7 +181,7 @@
 	return 0;
 }
 
-int ab_select_slot(struct blk_desc *dev_desc, disk_partition_t *part_info)
+int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info)
 {
 	struct bootloader_control *abc = NULL;
 	u32 crc32_le;
diff --git a/common/autoboot.c b/common/autoboot.c
index 4ea9be6..6d78716 100644
--- a/common/autoboot.c
+++ b/common/autoboot.c
@@ -13,11 +13,13 @@
 #include <env.h>
 #include <fdtdec.h>
 #include <hash.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <menu.h>
 #include <post.h>
 #include <time.h>
+#include <linux/delay.h>
 #include <u-boot/sha256.h>
 #include <bootcount.h>
 
diff --git a/common/bedbug.c b/common/bedbug.c
index 42ecf61..18a35ca 100644
--- a/common/bedbug.c
+++ b/common/bedbug.c
@@ -1,6 +1,7 @@
 /* $Id$ */
 
 #include <common.h>
+#include <asm/ptrace.h>
 
 #include <linux/ctype.h>
 #include <bedbug/bedbug.h>
diff --git a/common/board_f.c b/common/board_f.c
index a5ead31..01194ea 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <bloblist.h>
+#include <bootstage.h>
 #include <clock_legacy.h>
 #include <console.h>
 #include <cpu.h>
@@ -25,6 +26,7 @@
 #include <init.h>
 #include <initcall.h>
 #include <lcd.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <os.h>
@@ -40,6 +42,7 @@
 #include <trace.h>
 #include <video.h>
 #include <watchdog.h>
+#include <asm/cache.h>
 #ifdef CONFIG_MACH_TYPE
 #include <asm/mach-types.h>
 #endif
@@ -822,9 +825,9 @@
 #if defined(CONFIG_DM) && CONFIG_VAL(SYS_MALLOC_F_LEN)
 	int ret;
 
-	bootstage_start(BOOTSTATE_ID_ACCUM_DM_F, "dm_f");
+	bootstage_start(BOOTSTAGE_ID_ACCUM_DM_F, "dm_f");
 	ret = dm_init_and_scan(true);
-	bootstage_accum(BOOTSTATE_ID_ACCUM_DM_F);
+	bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_F);
 	if (ret)
 		return ret;
 #endif
diff --git a/common/board_info.c b/common/board_info.c
index a392bec..a6db087 100644
--- a/common/board_info.c
+++ b/common/board_info.c
@@ -1,6 +1,7 @@
 // SPDX-License-Identifier: GPL-2.0+
 
 #include <common.h>
+#include <init.h>
 #include <linux/libfdt.h>
 #include <linux/compiler.h>
 
diff --git a/common/board_r.c b/common/board_r.c
index 96034b8..bce87cb 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -11,12 +11,16 @@
 
 #include <common.h>
 #include <api.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <exports.h>
+#include <flash.h>
 #include <hang.h>
 #include <image.h>
 #include <irq_func.h>
+#include <log.h>
 #include <net.h>
+#include <asm/cache.h>
 #include <u-boot/crc.h>
 /* TODO: can we just include all these headers whether needed or not? */
 #if defined(CONFIG_CMD_BEDBUG)
@@ -310,9 +314,9 @@
 #ifdef CONFIG_TIMER
 	gd->timer = NULL;
 #endif
-	bootstage_start(BOOTSTATE_ID_ACCUM_DM_R, "dm_r");
+	bootstage_start(BOOTSTAGE_ID_ACCUM_DM_R, "dm_r");
 	ret = dm_init_and_scan(false);
-	bootstage_accum(BOOTSTATE_ID_ACCUM_DM_R);
+	bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_R);
 	if (ret)
 		return ret;
 
@@ -354,8 +358,8 @@
 #ifdef CONFIG_NEEDS_MANUAL_RELOC
 static int initr_manual_reloc_cmdtable(void)
 {
-	fixup_cmdtable(ll_entry_start(cmd_tbl_t, cmd),
-		       ll_entry_count(cmd_tbl_t, cmd));
+	fixup_cmdtable(ll_entry_start(struct cmd_tbl, cmd),
+		       ll_entry_count(struct cmd_tbl, cmd));
 	return 0;
 }
 #endif
diff --git a/common/boot_fit.c b/common/boot_fit.c
index ffa4d74..dfc2a31 100644
--- a/common/boot_fit.c
+++ b/common/boot_fit.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <errno.h>
 #include <image.h>
+#include <log.h>
 #include <linux/libfdt.h>
 
 static int fdt_offset(const void *fit)
diff --git a/common/bootm.c b/common/bootm.c
index db4362a..2ed7521 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -13,8 +13,11 @@
 #include <fdt_support.h>
 #include <irq_func.h>
 #include <lmb.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
+#include <net.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #if defined(CONFIG_CMD_USB)
 #include <usb.h>
@@ -40,8 +43,8 @@
 
 bootm_headers_t images;		/* pointers to os/initrd/fdt images */
 
-static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
-				   char * const argv[], bootm_headers_t *images,
+static const void *boot_get_kernel(struct cmd_tbl *cmdtp, int flag, int argc,
+				   char *const argv[], bootm_headers_t *images,
 				   ulong *os_data, ulong *os_len);
 
 __weak void board_quiesce_devices(void)
@@ -65,8 +68,8 @@
 static inline void boot_start_lmb(bootm_headers_t *images) { }
 #endif
 
-static int bootm_start(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int bootm_start(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	memset((void *)&images, 0, sizeof(images));
 	images.verify = env_get_yesno("verify");
@@ -79,8 +82,8 @@
 	return 0;
 }
 
-static int bootm_find_os(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[])
+static int bootm_find_os(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[])
 {
 	const void *os_hdr;
 	bool ep_found = false;
@@ -236,7 +239,7 @@
  *     0, if all existing images were loaded correctly
  *     1, if an image is found but corrupted, or invalid
  */
-int bootm_find_images(int flag, int argc, char * const argv[])
+int bootm_find_images(int flag, int argc, char *const argv[])
 {
 	int ret;
 
@@ -283,8 +286,8 @@
 	return 0;
 }
 
-static int bootm_find_other(cmd_tbl_t *cmdtp, int flag, int argc,
-			    char * const argv[])
+static int bootm_find_other(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[])
 {
 	if (((images.os.type == IH_TYPE_KERNEL) ||
 	     (images.os.type == IH_TYPE_KERNEL_NOLOAD) ||
@@ -518,8 +521,9 @@
  *	then the intent is to boot an OS, so this function will not return
  *	unless the image type is standalone.
  */
-int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		    int states, bootm_headers_t *images, int boot_progress)
+int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[], int states, bootm_headers_t *images,
+		    int boot_progress)
 {
 	boot_os_fn *boot_fn;
 	ulong iflag = 0;
@@ -702,8 +706,8 @@
  *     pointer to image header if valid image was found, plus kernel start
  *     address and length, otherwise NULL
  */
-static const void *boot_get_kernel(cmd_tbl_t *cmdtp, int flag, int argc,
-				   char * const argv[], bootm_headers_t *images,
+static const void *boot_get_kernel(struct cmd_tbl *cmdtp, int flag, int argc,
+				   char *const argv[], bootm_headers_t *images,
 				   ulong *os_data, ulong *os_len)
 {
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
diff --git a/common/bootm_os.c b/common/bootm_os.c
index 1d58462..5529648 100644
--- a/common/bootm_os.c
+++ b/common/bootm_os.c
@@ -6,10 +6,14 @@
 
 #include <common.h>
 #include <bootm.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <efi_loader.h>
 #include <env.h>
 #include <fdt_support.h>
+#include <image.h>
+#include <lmb.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -18,7 +22,7 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-static int do_bootm_standalone(int flag, int argc, char * const argv[],
+static int do_bootm_standalone(int flag, int argc, char *const argv[],
 			       bootm_headers_t *images)
 {
 	char *s;
@@ -40,7 +44,7 @@
 /*******************************************************************/
 
 #if defined(CONFIG_BOOTM_NETBSD) || defined(CONFIG_BOOTM_PLAN9)
-static void copy_args(char *dest, int argc, char * const argv[], char delim)
+static void copy_args(char *dest, int argc, char *const argv[], char delim)
 {
 	int i;
 
@@ -54,8 +58,8 @@
 #endif
 
 #ifdef CONFIG_BOOTM_NETBSD
-static int do_bootm_netbsd(int flag, int argc, char * const argv[],
-			    bootm_headers_t *images)
+static int do_bootm_netbsd(int flag, int argc, char *const argv[],
+			   bootm_headers_t *images)
 {
 	void (*loader)(bd_t *, image_header_t *, char *, char *);
 	image_header_t *os_hdr, *hdr;
@@ -126,8 +130,8 @@
 #endif /* CONFIG_BOOTM_NETBSD*/
 
 #ifdef CONFIG_LYNXKDI
-static int do_bootm_lynxkdi(int flag, int argc, char * const argv[],
-			     bootm_headers_t *images)
+static int do_bootm_lynxkdi(int flag, int argc, char *const argv[],
+			    bootm_headers_t *images)
 {
 	image_header_t *hdr = &images->legacy_hdr_os_copy;
 
@@ -148,8 +152,8 @@
 #endif /* CONFIG_LYNXKDI */
 
 #ifdef CONFIG_BOOTM_RTEMS
-static int do_bootm_rtems(int flag, int argc, char * const argv[],
-			   bootm_headers_t *images)
+static int do_bootm_rtems(int flag, int argc, char *const argv[],
+			  bootm_headers_t *images)
 {
 	void (*entry_point)(bd_t *);
 
@@ -181,8 +185,8 @@
 #endif /* CONFIG_BOOTM_RTEMS */
 
 #if defined(CONFIG_BOOTM_OSE)
-static int do_bootm_ose(int flag, int argc, char * const argv[],
-			   bootm_headers_t *images)
+static int do_bootm_ose(int flag, int argc, char *const argv[],
+			bootm_headers_t *images)
 {
 	void (*entry_point)(void);
 
@@ -214,8 +218,8 @@
 #endif /* CONFIG_BOOTM_OSE */
 
 #if defined(CONFIG_BOOTM_PLAN9)
-static int do_bootm_plan9(int flag, int argc, char * const argv[],
-			   bootm_headers_t *images)
+static int do_bootm_plan9(int flag, int argc, char *const argv[],
+			  bootm_headers_t *images)
 {
 	void (*entry_point)(void);
 	char *s;
@@ -321,7 +325,7 @@
 	puts("## vxWorks terminated\n");
 }
 
-static int do_bootm_vxworks_legacy(int flag, int argc, char * const argv[],
+static int do_bootm_vxworks_legacy(int flag, int argc, char *const argv[],
 				   bootm_headers_t *images)
 {
 	if (flag != BOOTM_STATE_OS_GO)
@@ -339,7 +343,7 @@
 	return 1;
 }
 
-int do_bootm_vxworks(int flag, int argc, char * const argv[],
+int do_bootm_vxworks(int flag, int argc, char *const argv[],
 		     bootm_headers_t *images)
 {
 	char *bootargs;
@@ -376,8 +380,8 @@
 #endif
 
 #if defined(CONFIG_CMD_ELF)
-static int do_bootm_qnxelf(int flag, int argc, char * const argv[],
-			    bootm_headers_t *images)
+static int do_bootm_qnxelf(int flag, int argc, char *const argv[],
+			   bootm_headers_t *images)
 {
 	char *local_args[2];
 	char str[16];
@@ -414,8 +418,8 @@
 #endif
 
 #ifdef CONFIG_INTEGRITY
-static int do_bootm_integrity(int flag, int argc, char * const argv[],
-			   bootm_headers_t *images)
+static int do_bootm_integrity(int flag, int argc, char *const argv[],
+			      bootm_headers_t *images)
 {
 	void (*entry_point)(void);
 
@@ -447,8 +451,8 @@
 #endif
 
 #ifdef CONFIG_BOOTM_OPENRTOS
-static int do_bootm_openrtos(int flag, int argc, char * const argv[],
-			   bootm_headers_t *images)
+static int do_bootm_openrtos(int flag, int argc, char *const argv[],
+			     bootm_headers_t *images)
 {
 	void (*entry_point)(void);
 
@@ -473,7 +477,7 @@
 #endif
 
 #ifdef CONFIG_BOOTM_OPTEE
-static int do_bootm_tee(int flag, int argc, char * const argv[],
+static int do_bootm_tee(int flag, int argc, char *const argv[],
 			bootm_headers_t *images)
 {
 	int ret;
@@ -501,7 +505,7 @@
 #endif
 
 #ifdef CONFIG_BOOTM_EFI
-static int do_bootm_efi(int flag, int argc, char * const argv[],
+static int do_bootm_efi(int flag, int argc, char *const argv[],
 			bootm_headers_t *images)
 {
 	int ret;
@@ -604,7 +608,7 @@
 	/* please define board specific board_preboot_os() */
 }
 
-int boot_selected_os(int argc, char * const argv[], int state,
+int boot_selected_os(int argc, char *const argv[], int state,
 		     bootm_headers_t *images, boot_os_fn *boot_fn)
 {
 	arch_preboot_os();
diff --git a/common/bootstage.c b/common/bootstage.c
index d2ed336..5f87358 100644
--- a/common/bootstage.c
+++ b/common/bootstage.c
@@ -10,7 +10,9 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <hang.h>
+#include <log.h>
 #include <malloc.h>
 #include <sort.h>
 #include <spl.h>
diff --git a/common/bouncebuf.c b/common/bouncebuf.c
index 0ace152..6d98920 100644
--- a/common/bouncebuf.c
+++ b/common/bouncebuf.c
@@ -7,9 +7,11 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <errno.h>
 #include <bouncebuf.h>
+#include <asm/cache.h>
 
 static int addr_aligned(struct bounce_buffer *state)
 {
diff --git a/common/cli.c b/common/cli.c
index 38bba17..6635ab2 100644
--- a/common/cli.c
+++ b/common/cli.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <cli.h>
 #include <cli_hush.h>
 #include <command.h>
@@ -128,7 +129,7 @@
 /****************************************************************************/
 
 #if defined(CONFIG_CMD_RUN)
-int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_run(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int i;
 
@@ -182,7 +183,7 @@
 void cli_secure_boot_cmd(const char *cmd)
 {
 #ifdef CONFIG_CMDLINE
-	cmd_tbl_t *cmdtp;
+	struct cmd_tbl *cmdtp;
 #endif
 	int rc;
 
diff --git a/common/cli_hush.c b/common/cli_hush.c
index a62af07..5b1f119 100644
--- a/common/cli_hush.c
+++ b/common/cli_hush.c
@@ -3664,8 +3664,8 @@
 }
 
 #ifdef __U_BOOT__
-static int do_showvar(cmd_tbl_t *cmdtp, int flag, int argc,
-		      char * const argv[])
+static int do_showvar(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	int i, k;
 	int rcode = 0;
diff --git a/common/cli_readline.c b/common/cli_readline.c
index 6ef7a3e..1f1e28c 100644
--- a/common/cli_readline.c
+++ b/common/cli_readline.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <bootretry.h>
 #include <cli.h>
+#include <command.h>
 #include <time.h>
 #include <watchdog.h>
 
diff --git a/common/cli_simple.c b/common/cli_simple.c
index 358e9b7..7d91316 100644
--- a/common/cli_simple.c
+++ b/common/cli_simple.c
@@ -14,6 +14,7 @@
 #include <command.h>
 #include <console.h>
 #include <env.h>
+#include <log.h>
 #include <linux/ctype.h>
 
 #define DEBUG_PARSER	0	/* set to 1 to debug */
diff --git a/common/command.c b/common/command.c
index 0d8bf24..4f49f15 100644
--- a/common/command.c
+++ b/common/command.c
@@ -12,6 +12,7 @@
 #include <command.h>
 #include <console.h>
 #include <env.h>
+#include <log.h>
 #include <linux/ctype.h>
 
 /*
@@ -19,14 +20,14 @@
  * for long help messages
  */
 
-int _do_help(cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t *cmdtp, int flag,
-	     int argc, char * const argv[])
+int _do_help(struct cmd_tbl *cmd_start, int cmd_items, struct cmd_tbl *cmdtp,
+	     int flag, int argc, char *const argv[])
 {
 	int i;
 	int rcode = 0;
 
 	if (argc == 1) {	/* show list of commands */
-		cmd_tbl_t *cmd_array[cmd_items];
+		struct cmd_tbl *cmd_array[cmd_items];
 		int i, j, swaps;
 
 		/* Make array of commands from .uboot_cmd section */
@@ -41,7 +42,7 @@
 			for (j = 0; j < i; ++j) {
 				if (strcmp(cmd_array[j]->name,
 					   cmd_array[j + 1]->name) > 0) {
-					cmd_tbl_t *tmp;
+					struct cmd_tbl *tmp;
 					tmp = cmd_array[j];
 					cmd_array[j] = cmd_array[j + 1];
 					cmd_array[j + 1] = tmp;
@@ -83,11 +84,12 @@
 }
 
 /* find command table entry for a command */
-cmd_tbl_t *find_cmd_tbl(const char *cmd, cmd_tbl_t *table, int table_len)
+struct cmd_tbl *find_cmd_tbl(const char *cmd, struct cmd_tbl *table,
+			     int table_len)
 {
 #ifdef CONFIG_CMDLINE
-	cmd_tbl_t *cmdtp;
-	cmd_tbl_t *cmdtp_temp = table;	/* Init value */
+	struct cmd_tbl *cmdtp;
+	struct cmd_tbl *cmdtp_temp = table;	/* Init value */
 	const char *p;
 	int len;
 	int n_found = 0;
@@ -117,14 +119,14 @@
 	return NULL;	/* not found or ambiguous command */
 }
 
-cmd_tbl_t *find_cmd(const char *cmd)
+struct cmd_tbl *find_cmd(const char *cmd)
 {
-	cmd_tbl_t *start = ll_entry_start(cmd_tbl_t, cmd);
-	const int len = ll_entry_count(cmd_tbl_t, cmd);
+	struct cmd_tbl *start = ll_entry_start(struct cmd_tbl, cmd);
+	const int len = ll_entry_count(struct cmd_tbl, cmd);
 	return find_cmd_tbl(cmd, start, len);
 }
 
-int cmd_usage(const cmd_tbl_t *cmdtp)
+int cmd_usage(const struct cmd_tbl *cmdtp)
 {
 	printf("%s - %s\n\n", cmdtp->name, cmdtp->usage);
 
@@ -145,7 +147,8 @@
 #ifdef CONFIG_AUTO_COMPLETE
 static char env_complete_buf[512];
 
-int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[])
+int var_complete(int argc, char *const argv[], char last_char, int maxv,
+		 char *cmdv[])
 {
 	int space;
 
@@ -163,7 +166,7 @@
 	return 0;
 }
 
-static int dollar_complete(int argc, char * const argv[], char last_char,
+static int dollar_complete(int argc, char *const argv[], char last_char,
 			   int maxv, char *cmdv[])
 {
 	/* Make sure the last argument starts with a $. */
@@ -177,12 +180,12 @@
 
 /*************************************************************************************/
 
-int complete_subcmdv(cmd_tbl_t *cmdtp, int count, int argc,
-		     char * const argv[], char last_char,
+int complete_subcmdv(struct cmd_tbl *cmdtp, int count, int argc,
+		     char *const argv[], char last_char,
 		     int maxv, char *cmdv[])
 {
 #ifdef CONFIG_CMDLINE
-	const cmd_tbl_t *cmdend = cmdtp + count;
+	const struct cmd_tbl *cmdend = cmdtp + count;
 	const char *p;
 	int len, clen;
 	int n_found = 0;
@@ -254,12 +257,12 @@
 #endif
 }
 
-static int complete_cmdv(int argc, char * const argv[], char last_char,
+static int complete_cmdv(int argc, char *const argv[], char last_char,
 			 int maxv, char *cmdv[])
 {
 #ifdef CONFIG_CMDLINE
-	return complete_subcmdv(ll_entry_start(cmd_tbl_t, cmd),
-				ll_entry_count(cmd_tbl_t, cmd), argc, argv,
+	return complete_subcmdv(ll_entry_start(struct cmd_tbl, cmd),
+				ll_entry_count(struct cmd_tbl, cmd), argc, argv,
 				last_char, maxv, cmdv);
 #else
 	return 0;
@@ -296,7 +299,8 @@
 	return argc;
 }
 
-static void print_argv(const char *banner, const char *leader, const char *sep, int linemax, char * const argv[])
+static void print_argv(const char *banner, const char *leader, const char *sep,
+		       int linemax, char *const argv[])
 {
 	int ll = leader != NULL ? strlen(leader) : 0;
 	int sl = sep != NULL ? strlen(sep) : 0;
@@ -323,7 +327,7 @@
 	printf("\n");
 }
 
-static int find_common_prefix(char * const argv[])
+static int find_common_prefix(char *const argv[])
 {
 	int i, len;
 	char *anchor, *s, *t;
@@ -486,7 +490,7 @@
 #if defined(CONFIG_NEEDS_MANUAL_RELOC)
 DECLARE_GLOBAL_DATA_PTR;
 
-void fixup_cmdtable(cmd_tbl_t *cmdtp, int size)
+void fixup_cmdtable(struct cmd_tbl *cmdtp, int size)
 {
 	int	i;
 
@@ -498,7 +502,7 @@
 
 		addr = (ulong)(cmdtp->cmd_rep) + gd->reloc_off;
 		cmdtp->cmd_rep =
-			(int (*)(struct cmd_tbl_s *, int, int,
+			(int (*)(struct cmd_tbl *, int, int,
 				 char * const [], int *))addr;
 
 		addr = (ulong)(cmdtp->cmd) + gd->reloc_off;
@@ -506,8 +510,8 @@
 		printf("Command \"%s\": 0x%08lx => 0x%08lx\n",
 		       cmdtp->name, (ulong)(cmdtp->cmd), addr);
 #endif
-		cmdtp->cmd =
-			(int (*)(struct cmd_tbl_s *, int, int, char * const []))addr;
+		cmdtp->cmd = (int (*)(struct cmd_tbl *, int, int,
+				      char *const []))addr;
 		addr = (ulong)(cmdtp->name) + gd->reloc_off;
 		cmdtp->name = (char *)addr;
 		if (cmdtp->usage) {
@@ -532,24 +536,24 @@
 }
 #endif
 
-int cmd_always_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[], int *repeatable)
+int cmd_always_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[], int *repeatable)
 {
 	*repeatable = 1;
 
 	return cmdtp->cmd(cmdtp, flag, argc, argv);
 }
 
-int cmd_never_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[], int *repeatable)
+int cmd_never_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[], int *repeatable)
 {
 	*repeatable = 0;
 
 	return cmdtp->cmd(cmdtp, flag, argc, argv);
 }
 
-int cmd_discard_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[])
+int cmd_discard_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[])
 {
 	int repeatable;
 
@@ -568,8 +572,8 @@
  * @param repeatable	Can the command be repeated
  * @return 0 if command succeeded, else non-zero (CMD_RET_...)
  */
-static int cmd_call(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		    int *repeatable)
+static int cmd_call(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[], int *repeatable)
 {
 	int result;
 
@@ -579,11 +583,11 @@
 	return result;
 }
 
-enum command_ret_t cmd_process(int flag, int argc, char * const argv[],
+enum command_ret_t cmd_process(int flag, int argc, char *const argv[],
 			       int *repeatable, ulong *ticks)
 {
 	enum command_ret_t rc = CMD_RET_SUCCESS;
-	cmd_tbl_t *cmdtp;
+	struct cmd_tbl *cmdtp;
 
 #if defined(CONFIG_SYS_XTRACE)
 	char *xtrace;
@@ -638,7 +642,7 @@
 	return rc;
 }
 
-int cmd_process_error(cmd_tbl_t *cmdtp, int err)
+int cmd_process_error(struct cmd_tbl *cmdtp, int err)
 {
 	if (err == CMD_RET_USAGE)
 		return CMD_RET_USAGE;
diff --git a/common/common_fit.c b/common/common_fit.c
index 41305d8..a993308 100644
--- a/common/common_fit.c
+++ b/common/common_fit.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <errno.h>
 #include <image.h>
+#include <log.h>
 #include <linux/libfdt.h>
 
 ulong fdt_getprop_u32(const void *fdt, int node, const char *prop)
diff --git a/common/console.c b/common/console.c
index e398530..1deca3c 100644
--- a/common/console.c
+++ b/common/console.c
@@ -19,6 +19,7 @@
 #include <exports.h>
 #include <env_internal.h>
 #include <watchdog.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/common/cros_ec.c b/common/cros_ec.c
index e66471e..249d1f1 100644
--- a/common/cros_ec.c
+++ b/common/cros_ec.c
@@ -12,6 +12,7 @@
 #include <cros_ec.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 
 struct udevice *board_get_cros_ec_dev(void)
 {
diff --git a/common/dfu.c b/common/dfu.c
index da6289b..d23cf67 100644
--- a/common/dfu.c
+++ b/common/dfu.c
@@ -11,6 +11,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <watchdog.h>
 #include <dfu.h>
 #include <console.h>
diff --git a/common/dlmalloc.c b/common/dlmalloc.c
index e8f07f1..b29a7cf 100644
--- a/common/dlmalloc.c
+++ b/common/dlmalloc.c
@@ -1,4 +1,5 @@
 #include <common.h>
+#include <log.h>
 
 #if CONFIG_IS_ENABLED(UNIT_TEST)
 #define DEBUG
diff --git a/common/edid.c b/common/edid.c
index f99f42d..553ab8f 100644
--- a/common/edid.c
+++ b/common/edid.c
@@ -13,6 +13,7 @@
 #include <edid.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <linux/ctype.h>
 #include <linux/string.h>
 
diff --git a/common/exports.c b/common/exports.c
index 18af38a..6253b55 100644
--- a/common/exports.c
+++ b/common/exports.c
@@ -1,4 +1,5 @@
 #include <common.h>
+#include <command.h>
 #include <exports.h>
 #include <malloc.h>
 #include <spi.h>
diff --git a/common/fdt_region.c b/common/fdt_region.c
index bf0a9be..6676590 100644
--- a/common/fdt_region.c
+++ b/common/fdt_region.c
@@ -5,6 +5,7 @@
  * Written by Simon Glass <sjg@chromium.org>
  */
 
+#include <fdt_support.h>
 #include <linux/libfdt_env.h>
 #include <fdt_region.h>
 
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 02cf5c6..3778de5 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -8,7 +8,9 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <mapmem.h>
+#include <net.h>
 #include <stdio_dev.h>
 #include <linux/ctype.h>
 #include <linux/types.h>
diff --git a/common/flash.c b/common/flash.c
index 5f155ae..bb82385 100644
--- a/common/flash.c
+++ b/common/flash.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <flash.h>
+#include <log.h>
+#include <uuid.h>
 
 #include <mtd/cfi_flash.h>
 
@@ -24,7 +26,7 @@
  * If necessary you have to map the second bank at lower addresses.
  */
 void
-flash_protect (int flag, ulong from, ulong to, flash_info_t *info)
+flash_protect(int flag, ulong from, ulong to, flash_info_t *info)
 {
 	ulong b_end;
 	short s_end;
@@ -38,10 +40,10 @@
 	s_end = info->sector_count - 1;	/* index of last sector */
 	b_end = info->start[0] + info->size - 1;	/* bank end address */
 
-	debug ("flash_protect %s: from 0x%08lX to 0x%08lX\n",
-		(flag & FLAG_PROTECT_SET) ? "ON" :
-			(flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
-		from, to);
+	debug("%s %s: from 0x%08lX to 0x%08lX\n", __func__,
+	      (flag & FLAG_PROTECT_SET) ? "ON" :
+	      (flag & FLAG_PROTECT_CLEAR) ? "OFF" : "???",
+	      from, to);
 
 	/* There is nothing to do if we have no data about the flash
 	 * or the protect range and flash range don't overlap.
@@ -66,7 +68,7 @@
 #else
 				info->protect[i] = 0;
 #endif	/* CONFIG_SYS_FLASH_PROTECTION */
-				debug ("protect off %d\n", i);
+				debug("protect off %d\n", i);
 			}
 			else if (flag & FLAG_PROTECT_SET) {
 #if defined(CONFIG_SYS_FLASH_PROTECTION)
@@ -74,7 +76,7 @@
 #else
 				info->protect[i] = 1;
 #endif	/* CONFIG_SYS_FLASH_PROTECTION */
-				debug ("protect on %d\n", i);
+				debug("protect on %d\n", i);
 			}
 		}
 	}
@@ -84,7 +86,7 @@
  */
 
 flash_info_t *
-addr2info (ulong addr)
+addr2info(ulong addr)
 {
 	flash_info_t *info;
 	int i;
@@ -119,12 +121,12 @@
  *			(only some targets require alignment)
  */
 int
-flash_write (char *src, ulong addr, ulong cnt)
+flash_write(char *src, ulong addr, ulong cnt)
 {
 	int i;
 	ulong         end        = addr + cnt - 1;
-	flash_info_t *info_first = addr2info (addr);
-	flash_info_t *info_last  = addr2info (end );
+	flash_info_t *info_first = addr2info(addr);
+	flash_info_t *info_last  = addr2info(end);
 	flash_info_t *info;
 	__maybe_unused char *src_orig = src;
 	__maybe_unused char *addr_orig = (char *)addr;
diff --git a/common/hash.c b/common/hash.c
index ff4986a..8c00659 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -13,19 +13,21 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <hw_sha.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <u-boot/crc.h>
 #else
 #include "mkimage.h"
 #include <time.h>
-#include <image.h>
 #endif /* !USE_HOSTCC*/
 
 #include <hash.h>
+#include <image.h>
 #include <u-boot/crc.h>
 #include <u-boot/sha1.h>
 #include <u-boot/sha256.h>
@@ -443,8 +445,8 @@
 		printf("%02x", output[i]);
 }
 
-int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
-		 int argc, char * const argv[])
+int hash_command(const char *algo_name, int flags, struct cmd_tbl *cmdtp,
+		 int flag, int argc, char *const argv[])
 {
 	ulong addr, len;
 
diff --git a/common/hwconfig.c b/common/hwconfig.c
index 72f3c4e..daf3eea 100644
--- a/common/hwconfig.c
+++ b/common/hwconfig.c
@@ -14,6 +14,7 @@
 #include <env.h>
 #include <exports.h>
 #include <hwconfig.h>
+#include <log.h>
 #include <linux/types.h>
 #include <linux/string.h>
 #else
diff --git a/common/image-cipher.c b/common/image-cipher.c
index f50c3d3..09869f7 100644
--- a/common/image-cipher.c
+++ b/common/image-cipher.c
@@ -10,7 +10,7 @@
 #include <common.h>
 #include <malloc.h>
 DECLARE_GLOBAL_DATA_PTR;
-#endif /* !USE_HOSTCC*/
+#endif /* !USE_HOSdTCC*/
 #include <image.h>
 #include <uboot_aes.h>
 #include <u-boot/aes.h>
diff --git a/common/image-fdt.c b/common/image-fdt.c
index 3002948..b63e772 100644
--- a/common/image-fdt.c
+++ b/common/image-fdt.c
@@ -14,6 +14,8 @@
 #include <env.h>
 #include <errno.h>
 #include <image.h>
+#include <lmb.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/libfdt.h>
 #include <mapmem.h>
@@ -263,8 +265,8 @@
  *     1, if fdt image is found but corrupted
  *     of_flat_tree and of_size are set to 0 if no fdt exists
  */
-int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
-		bootm_headers_t *images, char **of_flat_tree, ulong *of_size)
+int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
+		 bootm_headers_t *images, char **of_flat_tree, ulong *of_size)
 {
 #if CONFIG_IS_ENABLED(LEGACY_IMAGE_FORMAT)
 	const image_header_t *fdt_hdr;
diff --git a/common/image-fit-sig.c b/common/image-fit-sig.c
index a3a0c61..cc19671 100644
--- a/common/image-fit-sig.c
+++ b/common/image-fit-sig.c
@@ -8,6 +8,7 @@
 #include <time.h>
 #else
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
diff --git a/common/image-fit.c b/common/image-fit.c
index 368b730..1ece100 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -11,12 +11,14 @@
 #ifdef USE_HOSTCC
 #include "mkimage.h"
 #include <time.h>
+#include <linux/libfdt.h>
 #include <u-boot/crc.h>
 #else
 #include <linux/compiler.h>
 #include <linux/kconfig.h>
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <mapmem.h>
 #include <asm/io.h>
 #include <malloc.h>
diff --git a/common/image-sig.c b/common/image-sig.c
index 84b2c04..498969d 100644
--- a/common/image-sig.c
+++ b/common/image-sig.c
@@ -5,9 +5,12 @@
 
 #ifdef USE_HOSTCC
 #include "mkimage.h"
+#include <fdt_support.h>
 #include <time.h>
+#include <linux/libfdt.h>
 #else
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
diff --git a/common/image.c b/common/image.c
index d8d14e8..e1ca1a7 100644
--- a/common/image.c
+++ b/common/image.c
@@ -8,9 +8,13 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#include <bootstage.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <lmb.h>
+#include <log.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <u-boot/crc.h>
 #include <watchdog.h>
 
@@ -44,7 +48,8 @@
 #include <lzma/LzmaTools.h>
 
 #ifdef CONFIG_CMD_BDI
-extern int do_bdinfo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_bdinfo(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[]);
 #endif
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -1072,8 +1077,8 @@
  *     1, if ramdisk image is found but corrupted, or invalid
  *     rd_start and rd_end are set to 0 if no ramdisk exists
  */
-int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
-		uint8_t arch, ulong *rd_start, ulong *rd_end)
+int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
+		     uint8_t arch, ulong *rd_start, ulong *rd_end)
 {
 	ulong rd_addr, rd_load;
 	ulong rd_data, rd_len;
@@ -1368,7 +1373,7 @@
 
 #if IMAGE_ENABLE_FIT
 #if defined(CONFIG_FPGA)
-int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
+int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
 		  uint8_t arch, const ulong *ld_start, ulong * const ld_len)
 {
 	ulong tmp_img_addr, img_data, img_len;
@@ -1469,8 +1474,8 @@
 			fit_loadable_handler->handler(img_data, img_len);
 }
 
-int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
-		uint8_t arch, const ulong *ld_start, ulong * const ld_len)
+int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
+		      uint8_t arch, const ulong *ld_start, ulong * const ld_len)
 {
 	/*
 	 * These variables are used to hold the current image location
diff --git a/common/init/board_init.c b/common/init/board_init.c
index f7c8a17..8c8a5ea 100644
--- a/common/init/board_init.c
+++ b/common/init/board_init.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
+#include <init.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/common/iotrace.c b/common/iotrace.c
index 295ee07..7225ee4 100644
--- a/common/iotrace.c
+++ b/common/iotrace.c
@@ -9,6 +9,7 @@
 #include <mapmem.h>
 #include <time.h>
 #include <asm/io.h>
+#include <linux/bug.h>
 #include <u-boot/crc.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/common/kgdb.c b/common/kgdb.c
index daf53be..4493a15 100644
--- a/common/kgdb.c
+++ b/common/kgdb.c
@@ -88,6 +88,7 @@
  ****************************************************************************/
 
 #include <common.h>
+#include <asm/ptrace.h>
 
 #include <kgdb.h>
 #include <command.h>
@@ -574,7 +575,7 @@
 }
 
 int
-do_kgdb(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+do_kgdb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
     printf("Entering KGDB mode via exception handler...\n\n");
     kgdb_breakpoint(argc - 1, argv + 1);
diff --git a/common/kgdb_stubs.c b/common/kgdb_stubs.c
index c061126..66aed7c 100644
--- a/common/kgdb_stubs.c
+++ b/common/kgdb_stubs.c
@@ -11,6 +11,7 @@
 #include <cpu_func.h>
 #include <kgdb.h>
 #include <serial.h>
+#include <asm/ptrace.h>
 
 int (*debugger_exception_handler)(struct pt_regs *);
 
diff --git a/common/lcd.c b/common/lcd.c
index f8bc1ce..02f2db3 100644
--- a/common/lcd.c
+++ b/common/lcd.c
@@ -12,6 +12,9 @@
 #include <command.h>
 #include <cpu_func.h>
 #include <env_callback.h>
+#include <log.h>
+#include <asm/cache.h>
+#include <init.h>
 #include <linux/types.h>
 #include <stdio_dev.h>
 #include <lcd.h>
diff --git a/common/lcd_console.c b/common/lcd_console.c
index d34bc2f..1a246c4 100644
--- a/common/lcd_console.c
+++ b/common/lcd_console.c
@@ -7,7 +7,9 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <lcd.h>
+#include <log.h>
 #include <serial.h>
 #include <video_font.h>		/* Get font data, width and height */
 #if defined(CONFIG_LCD_LOGO)
@@ -219,7 +221,7 @@
 	lcd_puts(buf);
 }
 
-static int do_lcd_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_lcd_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
 			    char *const argv[])
 {
 	unsigned int col, row;
@@ -234,7 +236,7 @@
 	return 0;
 }
 
-static int do_lcd_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_lcd_puts(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	if (argc != 2)
diff --git a/common/log_syslog.c b/common/log_syslog.c
index 5e3e20e..698c585 100644
--- a/common/log_syslog.c
+++ b/common/log_syslog.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <log.h>
+#include <net.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/common/main.c b/common/main.c
index 06d7ff5..4b3cd30 100644
--- a/common/main.c
+++ b/common/main.c
@@ -8,11 +8,13 @@
 
 #include <common.h>
 #include <autoboot.h>
+#include <bootstage.h>
 #include <cli.h>
 #include <command.h>
 #include <console.h>
 #include <env.h>
 #include <init.h>
+#include <net.h>
 #include <version.h>
 
 static void run_preboot_environment_command(void)
diff --git a/common/malloc_simple.c b/common/malloc_simple.c
index eabbb70..34f0b49 100644
--- a/common/malloc_simple.c
+++ b/common/malloc_simple.c
@@ -8,6 +8,7 @@
 #define LOG_CATEGORY LOGC_ALLOC
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <asm/io.h>
diff --git a/common/miiphyutil.c b/common/miiphyutil.c
index 2db0678..7d4d15e 100644
--- a/common/miiphyutil.c
+++ b/common/miiphyutil.c
@@ -11,8 +11,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <miiphy.h>
 #include <phy.h>
+#include <linux/delay.h>
 
 #include <asm/types.h>
 #include <linux/list.h>
diff --git a/common/spl/spl.c b/common/spl/spl.c
index fc5cbbb..7ea0b06 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -9,10 +9,13 @@
 #include <common.h>
 #include <bloblist.h>
 #include <binman_sym.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <handoff.h>
 #include <hang.h>
+#include <init.h>
 #include <irq_func.h>
+#include <log.h>
 #include <serial.h>
 #include <spl.h>
 #include <asm/u-boot.h>
@@ -423,11 +426,11 @@
 		}
 	}
 	if (CONFIG_IS_ENABLED(DM)) {
-		bootstage_start(BOOTSTATE_ID_ACCUM_DM_SPL,
+		bootstage_start(BOOTSTAGE_ID_ACCUM_DM_SPL,
 				spl_phase() == PHASE_TPL ? "dm tpl" : "dm_spl");
 		/* With CONFIG_SPL_OF_PLATDATA, bring in all devices */
 		ret = dm_init_and_scan(!CONFIG_IS_ENABLED(OF_PLATDATA));
-		bootstage_accum(BOOTSTATE_ID_ACCUM_DM_SPL);
+		bootstage_accum(BOOTSTAGE_ID_ACCUM_DM_SPL);
 		if (ret) {
 			debug("dm_init_and_scan() returned error %d\n", ret);
 			return ret;
diff --git a/common/spl/spl_atf.c b/common/spl/spl_atf.c
index 702367b..b54b4f0 100644
--- a/common/spl/spl_atf.c
+++ b/common/spl/spl_atf.c
@@ -13,7 +13,10 @@
 #include <atf_common.h>
 #include <cpu_func.h>
 #include <errno.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
+#include <asm/cache.h>
 
 static struct bl2_to_bl31_params_mem bl31_params_mem;
 static struct bl31_params *bl2_to_bl31_params;
diff --git a/common/spl/spl_ext.c b/common/spl/spl_ext.c
index 2a62522..3898041 100644
--- a/common/spl/spl_ext.c
+++ b/common/spl/spl_ext.c
@@ -2,6 +2,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <part.h>
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <ext4fs.h>
@@ -15,7 +16,7 @@
 	s32 err;
 	struct image_header *header;
 	loff_t filelen, actlen;
-	disk_partition_t part_info = {};
+	struct disk_partition part_info = {};
 
 	header = spl_get_load_buffer(-sizeof(*header), sizeof(*header));
 
@@ -69,7 +70,7 @@
 {
 	int err;
 	__maybe_unused loff_t filelen, actlen;
-	disk_partition_t part_info = {};
+	struct disk_partition part_info = {};
 	__maybe_unused char *file;
 
 	if (part_get_info(block_dev, partition, &part_info)) {
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index aa371ab..c2eb097 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <fat.h>
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index c51e4be..f581a22 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -10,8 +10,10 @@
 #include <fpga.h>
 #include <gzip.h>
 #include <image.h>
+#include <log.h>
 #include <malloc.h>
 #include <spl.h>
+#include <asm/cache.h>
 #include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/common/spl/spl_legacy.c b/common/spl/spl_legacy.c
index 29d3ec7..82d0326 100644
--- a/common/spl/spl_legacy.c
+++ b/common/spl/spl_legacy.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <log.h>
 #include <malloc.h>
 #include <spl.h>
 
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index a68cdec..add2785 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -7,6 +7,8 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <part.h>
 #include <spl.h>
 #include <linux/compiler.h>
 #include <errno.h>
@@ -168,7 +170,7 @@
 					struct mmc *mmc, int partition,
 					unsigned long sector)
 {
-	disk_partition_t info;
+	struct disk_partition info;
 	int err;
 
 #ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION_TYPE
diff --git a/common/spl/spl_nand.c b/common/spl/spl_nand.c
index 5f8a111..48c9754 100644
--- a/common/spl/spl_nand.c
+++ b/common/spl/spl_nand.c
@@ -5,6 +5,9 @@
  */
 #include <common.h>
 #include <config.h>
+#include <fdt_support.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <nand.h>
diff --git a/common/spl/spl_net.c b/common/spl/spl_net.c
index 30c050c..e140a63 100644
--- a/common/spl/spl_net.c
+++ b/common/spl/spl_net.c
@@ -9,6 +9,8 @@
 #include <common.h>
 #include <env.h>
 #include <errno.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <net.h>
 #include <linux/libfdt.h>
diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 3f03ffe..5270401 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -4,6 +4,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 
 static ulong spl_nor_load_read(struct spl_load_info *load, ulong sector,
diff --git a/common/spl/spl_onenand.c b/common/spl/spl_onenand.c
index ee30f32..93cbf47 100644
--- a/common/spl/spl_onenand.c
+++ b/common/spl/spl_onenand.c
@@ -9,6 +9,8 @@
  */
 #include <common.h>
 #include <config.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <onenand_uboot.h>
diff --git a/common/spl/spl_opensbi.c b/common/spl/spl_opensbi.c
index 3519c34..e88136e 100644
--- a/common/spl/spl_opensbi.c
+++ b/common/spl/spl_opensbi.c
@@ -9,9 +9,11 @@
 #include <cpu_func.h>
 #include <errno.h>
 #include <hang.h>
+#include <image.h>
 #include <spl.h>
 #include <asm/smp.h>
 #include <opensbi.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/common/spl/spl_ram.c b/common/spl/spl_ram.c
index 954e91a..df1d5b4 100644
--- a/common/spl/spl_ram.c
+++ b/common/spl/spl_ram.c
@@ -11,6 +11,8 @@
  */
 #include <common.h>
 #include <binman_sym.h>
+#include <image.h>
+#include <log.h>
 #include <mapmem.h>
 #include <spl.h>
 #include <linux/libfdt.h>
diff --git a/common/spl/spl_sdp.c b/common/spl/spl_sdp.c
index 644dfa8..e7f7b68 100644
--- a/common/spl/spl_sdp.c
+++ b/common/spl/spl_sdp.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <spl.h>
 #include <usb.h>
 #include <g_dnl.h>
diff --git a/common/spl/spl_spi.c b/common/spl/spl_spi.c
index 288dbb5..2744fb5 100644
--- a/common/spl/spl_spi.c
+++ b/common/spl/spl_spi.c
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <log.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <errno.h>
diff --git a/common/spl/spl_ubi.c b/common/spl/spl_ubi.c
index 0cb5080..de6a63b 100644
--- a/common/spl/spl_ubi.c
+++ b/common/spl/spl_ubi.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <config.h>
+#include <image.h>
 #include <nand.h>
 #include <onenand_uboot.h>
 #include <ubispl.h>
diff --git a/common/spl/spl_usb.c b/common/spl/spl_usb.c
index e29d579..08837b3 100644
--- a/common/spl/spl_usb.c
+++ b/common/spl/spl_usb.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/u-boot.h>
 #include <errno.h>
diff --git a/common/spl/spl_xip.c b/common/spl/spl_xip.c
index 1af4da8..8ce0a09 100644
--- a/common/spl/spl_xip.c
+++ b/common/spl/spl_xip.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 
 static int spl_xip(struct spl_image_info *spl_image,
diff --git a/common/spl/spl_ymodem.c b/common/spl/spl_ymodem.c
index 8500ee8..2845124 100644
--- a/common/spl/spl_ymodem.c
+++ b/common/spl/spl_ymodem.c
@@ -10,6 +10,8 @@
  */
 #include <common.h>
 #include <gzip.h>
+#include <image.h>
+#include <log.h>
 #include <spl.h>
 #include <xyzModem.h>
 #include <asm/u-boot.h>
diff --git a/common/splash_source.c b/common/splash_source.c
index 2ff1520..f51ca5d 100644
--- a/common/splash_source.c
+++ b/common/splash_source.c
@@ -13,6 +13,7 @@
 #include <fs.h>
 #include <fdt_support.h>
 #include <image.h>
+#include <log.h>
 #include <nand.h>
 #include <sata.h>
 #include <spi.h>
diff --git a/common/stdio.c b/common/stdio.c
index 54ecc9b..2119204 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <stdarg.h>
 #include <malloc.h>
 #include <stdio_dev.h>
diff --git a/common/usb.c b/common/usb.c
index 686f09a..aad13fd 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -28,6 +28,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <asm/processor.h>
@@ -37,6 +38,7 @@
 #include <asm/unaligned.h>
 #include <errno.h>
 #include <usb.h>
+#include <linux/delay.h>
 
 #define USB_BUFSIZ	512
 
diff --git a/common/usb_hub.c b/common/usb_hub.c
index c642b68..e578f0b 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -26,11 +26,13 @@
 #include <dm.h>
 #include <env.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <asm/processor.h>
 #include <asm/unaligned.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <linux/list.h>
 #include <asm/byteorder.h>
 #ifdef CONFIG_SANDBOX
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index a6221ef..b316807 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <env.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <stdio_dev.h>
diff --git a/common/usb_storage.c b/common/usb_storage.c
index b291ac5..ff25441 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -33,15 +33,19 @@
 
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <mapmem.h>
 #include <memalign.h>
 #include <asm/byteorder.h>
+#include <asm/cache.h>
 #include <asm/processor.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
+#include <linux/delay.h>
 
 #include <part.h>
 #include <usb.h>
diff --git a/disk/part.c b/disk/part.c
index 4cc2fc1..f6a3102 100644
--- a/disk/part.c
+++ b/disk/part.c
@@ -5,10 +5,12 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <env.h>
 #include <errno.h>
 #include <ide.h>
+#include <log.h>
 #include <malloc.h>
 #include <part.h>
 #include <ubifs_uboot.h>
@@ -318,7 +320,7 @@
 #endif /* CONFIG_HAVE_BLOCK_DEVICE */
 
 int part_get_info(struct blk_desc *dev_desc, int part,
-		       disk_partition_t *info)
+		       struct disk_partition *info)
 {
 #ifdef CONFIG_HAVE_BLOCK_DEVICE
 	struct part_driver *drv;
@@ -351,7 +353,8 @@
 	return -1;
 }
 
-int part_get_info_whole_disk(struct blk_desc *dev_desc, disk_partition_t *info)
+int part_get_info_whole_disk(struct blk_desc *dev_desc,
+			     struct disk_partition *info)
 {
 	info->start = 0;
 	info->size = dev_desc->lba;
@@ -431,7 +434,7 @@
 #define PART_AUTO -1
 int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
 			     struct blk_desc **dev_desc,
-			     disk_partition_t *info, int allow_whole_dev)
+			     struct disk_partition *info, int allow_whole_dev)
 {
 	int ret = -1;
 	const char *part_str;
@@ -441,7 +444,7 @@
 	char *ep;
 	int p;
 	int part;
-	disk_partition_t tmpinfo;
+	struct disk_partition tmpinfo;
 
 #ifdef CONFIG_SANDBOX
 	/*
@@ -646,7 +649,7 @@
 }
 
 int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name,
-			       disk_partition_t *info, int part_type)
+			       struct disk_partition *info, int part_type)
 {
 	struct part_driver *part_drv;
 	int ret;
@@ -671,7 +674,7 @@
 }
 
 int part_get_info_by_name(struct blk_desc *dev_desc, const char *name,
-			  disk_partition_t *info)
+			  struct disk_partition *info)
 {
 	return part_get_info_by_name_type(dev_desc, name, info, PART_TYPE_ALL);
 }
@@ -693,7 +696,7 @@
 static int part_get_info_by_dev_and_name(const char *dev_iface,
 					 const char *dev_part_str,
 					 struct blk_desc **dev_desc,
-					 disk_partition_t *part_info)
+					 struct disk_partition *part_info)
 {
 	char *ep;
 	const char *part_str;
@@ -725,7 +728,7 @@
 int part_get_info_by_dev_and_name_or_num(const char *dev_iface,
 					 const char *dev_part_str,
 					 struct blk_desc **dev_desc,
-					 disk_partition_t *part_info)
+					 struct disk_partition *part_info)
 {
 	/* Split the part_name if passed as "$dev_num#part_name". */
 	if (!part_get_info_by_dev_and_name(dev_iface, dev_part_str,
diff --git a/disk/part_amiga.c b/disk/part_amiga.c
index 5a2bb71..7eea60b 100644
--- a/disk/part_amiga.c
+++ b/disk/part_amiga.c
@@ -9,6 +9,7 @@
 #include <env.h>
 #include <ide.h>
 #include "part_amiga.h"
+#include <part.h>
 
 #ifdef CONFIG_HAVE_BLOCK_DEVICE
 
@@ -291,7 +292,7 @@
  * Get info about a partition
  */
 static int part_get_info_amiga(struct blk_desc *dev_desc, int part,
-				    disk_partition_t *info)
+				    struct disk_partition *info)
 {
     struct partition_block *p = find_partition(dev_desc, part-1);
     struct amiga_part_geometry *g;
diff --git a/disk/part_dos.c b/disk/part_dos.c
index 813379f..04f5310 100644
--- a/disk/part_dos.c
+++ b/disk/part_dos.c
@@ -14,10 +14,12 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <ide.h>
 #include <memalign.h>
 #include "part_dos.h"
+#include <part.h>
 
 #ifdef CONFIG_HAVE_BLOCK_DEVICE
 
@@ -213,7 +215,7 @@
 static int part_get_info_extended(struct blk_desc *dev_desc,
 				  lbaint_t ext_part_sector, lbaint_t relative,
 				  int part_num, int which_part,
-				  disk_partition_t *info, unsigned int disksig)
+				  struct disk_partition *info, uint disksig)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
 	dos_partition_t *pt;
@@ -317,7 +319,7 @@
 }
 
 int part_get_info_dos(struct blk_desc *dev_desc, int part,
-		      disk_partition_t *info)
+		      struct disk_partition *info)
 {
 	return part_get_info_extended(dev_desc, 0, 0, 1, part, info, 0);
 }
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 83876a7..de34918 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -9,8 +9,13 @@
  *   when CONFIG_SYS_64BIT_LBA is not defined, lbaint_t is 32 bits; this
  *   limits the maximum size of addressable storage to < 2 Terra Bytes
  */
-#include <asm/unaligned.h>
 #include <common.h>
+#include <blk.h>
+#include <log.h>
+#include <part.h>
+#include <uuid.h>
+#include <asm/cache.h>
+#include <asm/unaligned.h>
 #include <command.h>
 #include <fdtdec.h>
 #include <ide.h>
@@ -257,7 +262,7 @@
 }
 
 int part_get_info_efi(struct blk_desc *dev_desc, int part,
-		      disk_partition_t *info)
+		      struct disk_partition *info)
 {
 	ALLOC_CACHE_ALIGN_BUFFER_PAD(gpt_header, gpt_head, 1, dev_desc->blksz);
 	gpt_entry *gpt_pte = NULL;
@@ -411,7 +416,7 @@
 
 int gpt_fill_pte(struct blk_desc *dev_desc,
 		 gpt_header *gpt_h, gpt_entry *gpt_e,
-		 disk_partition_t *partitions, int parts)
+		 struct disk_partition *partitions, int parts)
 {
 	lbaint_t offset = (lbaint_t)le64_to_cpu(gpt_h->first_usable_lba);
 	lbaint_t last_usable_lba = (lbaint_t)
@@ -601,7 +606,7 @@
 }
 
 int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid,
-		disk_partition_t *partitions, int parts_count)
+		struct disk_partition *partitions, int parts_count)
 {
 	gpt_header *gpt_h;
 	gpt_entry *gpt_e;
@@ -696,7 +701,7 @@
 }
 
 int gpt_verify_partitions(struct blk_desc *dev_desc,
-			  disk_partition_t *partitions, int parts,
+			  struct disk_partition *partitions, int parts,
 			  gpt_header *gpt_head, gpt_entry **gpt_pte)
 {
 	char efi_str[PARTNAME_SZ + 1];
diff --git a/disk/part_iso.c b/disk/part_iso.c
index e733227..822f2c4 100644
--- a/disk/part_iso.c
+++ b/disk/part_iso.c
@@ -5,7 +5,10 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
+#include <part.h>
+#include <asm/cache.h>
 #include <asm/unaligned.h>
 #include "part_iso.h"
 
@@ -46,7 +49,7 @@
 
 /* only boot records will be listed as valid partitions */
 int part_get_info_iso_verb(struct blk_desc *dev_desc, int part_num,
-			   disk_partition_t *info, int verb)
+			   struct disk_partition *info, int verb)
 {
 	int i,offset,entry_num;
 	unsigned short *chksumbuf;
@@ -199,14 +202,14 @@
 }
 
 static int part_get_info_iso(struct blk_desc *dev_desc, int part_num,
-				  disk_partition_t *info)
+			     struct disk_partition *info)
 {
 	return part_get_info_iso_verb(dev_desc, part_num, info, 0);
 }
 
 static void part_print_iso(struct blk_desc *dev_desc)
 {
-	disk_partition_t info;
+	struct disk_partition info;
 	int i;
 
 	if (part_get_info_iso_verb(dev_desc, 1, &info, 0) == -1) {
@@ -225,7 +228,7 @@
 
 static int part_test_iso(struct blk_desc *dev_desc)
 {
-	disk_partition_t info;
+	struct disk_partition info;
 
 	return part_get_info_iso_verb(dev_desc, 1, &info, 0);
 }
diff --git a/disk/part_mac.c b/disk/part_mac.c
index 8b2c004..e01ae74 100644
--- a/disk/part_mac.c
+++ b/disk/part_mac.c
@@ -14,9 +14,11 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <memalign.h>
 #include <ide.h>
 #include "part_mac.h"
+#include <part.h>
 
 #ifdef CONFIG_HAVE_BLOCK_DEVICE
 
@@ -214,7 +216,7 @@
 }
 
 static int part_get_info_mac(struct blk_desc *dev_desc, int part,
-				  disk_partition_t *info)
+				  struct disk_partition *info)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(mac_driver_desc_t, ddesc, 1);
 	ALLOC_CACHE_ALIGN_BUFFER(mac_partition_t, mpart, 1);
diff --git a/doc/README.commands b/doc/README.commands
index 4e9e809..716ad22 100644
--- a/doc/README.commands
+++ b/doc/README.commands
@@ -3,7 +3,7 @@
 
 Commands are added to U-Boot by creating a new command structure.
 This is done by first including command.h, then using the U_BOOT_CMD() or the
-U_BOOT_CMD_COMPLETE macro to fill in a cmd_tbl_t struct.
+U_BOOT_CMD_COMPLETE macro to fill in a struct cmd_tbl struct.
 
 U_BOOT_CMD(name, maxargs, repeatable, command, "usage", "help")
 U_BOOT_CMD_COMPLETE(name, maxargs, repeatable, command, "usage, "help", comp)
@@ -31,7 +31,7 @@
 Sub-command definition
 ----------------------
 
-Likewise an array of cmd_tbl_t holding sub-commands can be created using either
+Likewise an array of struct cmd_tbl holding sub-commands can be created using either
 of the following macros:
 
 * U_BOOT_CMD_MKENT(name, maxargs, repeatable, command, "usage", "help")
@@ -40,14 +40,14 @@
 
 This table has to be evaluated in the command function of the main command, e.g.
 
-    static cmd_tbl_t cmd_sub[] = {
+    static struct cmd_tbl cmd_sub[] = {
         U_BOOT_CMD_MKENT(foo, CONFIG_SYS_MAXARGS, 1, do_foo, "", ""),
         U_BOOT_CMD_MKENT(bar, CONFIG_SYS_MAXARGS, 1, do_bar, "", ""),
     };
 
-    static int do_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+    static int do_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
     {
-        cmd_tbl_t *cp;
+        struct cmd_tbl *cp;
 
         if (argc < 2)
                 return CMD_RET_USAGE;
@@ -68,7 +68,7 @@
 ----------------
 
 The command function pointer has to be of type
-int (*cmd)(struct cmd_tbl_s *cmdtp, int flag, int argc, const char *argv[]);
+int (*cmd)(struct cmd_tbl *cmdtp, int flag, int argc, const char *argv[]);
 
 cmdtp:		Table entry describing the command (see above).
 
diff --git a/doc/README.standalone b/doc/README.standalone
index 28ebde1..874ca2f 100644
--- a/doc/README.standalone
+++ b/doc/README.standalone
@@ -40,7 +40,7 @@
    that returns the ABI version of the running U-Boot. I.e., a
    typical application startup may look like this:
 
-	int my_app (int argc, char * const argv[])
+	int my_app (int argc, char *const argv[])
 	{
 		app_startup (argv);
 		if (get_version () != XF_VERSION)
diff --git a/drivers/adc/adc-uclass.c b/drivers/adc/adc-uclass.c
index 0a492eb..d435667 100644
--- a/drivers/adc/adc-uclass.c
+++ b/drivers/adc/adc-uclass.c
@@ -12,6 +12,7 @@
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
 #include <adc.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 #define ADC_UCLASS_PLATDATA_SIZE	sizeof(struct adc_uclass_platdata)
diff --git a/drivers/adc/meson-saradc.c b/drivers/adc/meson-saradc.c
index f7c919d..72b0cc4 100644
--- a/drivers/adc/meson-saradc.c
+++ b/drivers/adc/meson-saradc.c
@@ -14,6 +14,8 @@
 #include <regmap.h>
 #include <errno.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/math64.h>
 #include <linux/bitfield.h>
 
diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c
index 850142c..561740f6 100644
--- a/drivers/adc/rockchip-saradc.c
+++ b/drivers/adc/rockchip-saradc.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define SARADC_CTRL_CHN_MASK		GENMASK(2, 0)
diff --git a/drivers/adc/stm32-adc-core.c b/drivers/adc/stm32-adc-core.c
index 2ca0fb4..31bbb6f 100644
--- a/drivers/adc/stm32-adc-core.c
+++ b/drivers/adc/stm32-adc-core.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <power/regulator.h>
 #include "stm32-adc-core.h"
 
diff --git a/drivers/adc/stm32-adc.c b/drivers/adc/stm32-adc.c
index ca1ac3e..b12f894 100644
--- a/drivers/adc/stm32-adc.c
+++ b/drivers/adc/stm32-adc.c
@@ -10,6 +10,8 @@
 #include <adc.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/iopoll.h>
 #include "stm32-adc-core.h"
 
diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 4cd7420..47cdea1 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -9,7 +9,11 @@
  * This driver provides a SCSI interface to SATA.
  */
 #include <common.h>
+#include <blk.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <command.h>
 #include <dm.h>
diff --git a/drivers/ata/ahci_mvebu.c b/drivers/ata/ahci_mvebu.c
index 48a9d00..8be1826 100644
--- a/drivers/ata/ahci_mvebu.c
+++ b/drivers/ata/ahci_mvebu.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <ahci.h>
 #include <dm.h>
+#include <log.h>
 
 /*
  * Dummy implementation that can be overwritten by a board
diff --git a/drivers/ata/ahci_sunxi.c b/drivers/ata/ahci_sunxi.c
index 77b932a..58e345d 100644
--- a/drivers/ata/ahci_sunxi.c
+++ b/drivers/ata/ahci_sunxi.c
@@ -1,10 +1,12 @@
 #include <common.h>
 #include <ahci.h>
 #include <dm.h>
+#include <log.h>
 #include <scsi.h>
 #include <errno.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 
 #define AHCI_PHYCS0R 0x00c0
 #define AHCI_PHYCS1R 0x00c4
diff --git a/drivers/ata/dwc_ahsata.c b/drivers/ata/dwc_ahsata.c
index 2bc1de8..562e982 100644
--- a/drivers/ata/dwc_ahsata.c
+++ b/drivers/ata/dwc_ahsata.c
@@ -6,20 +6,25 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <blk.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <dwc_ahsata.h>
 #include <fis.h>
 #include <libata.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <part.h>
 #include <sata.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/mach-imx/sata.h>
 #include <linux/bitops.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include "dwc_ahsata_priv.h"
 
diff --git a/drivers/ata/fsl_sata.c b/drivers/ata/fsl_sata.c
index c6680dc..8c6726a 100644
--- a/drivers/ata/fsl_sata.c
+++ b/drivers/ata/fsl_sata.c
@@ -6,9 +6,11 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <console.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/fsl_serdes.h>
@@ -16,6 +18,7 @@
 #include <libata.h>
 #include <fis.h>
 #include <sata.h>
+#include <linux/delay.h>
 #include "fsl_sata.h"
 
 #if CONFIG_IS_ENABLED(BLK)
diff --git a/drivers/ata/mvsata_ide.c b/drivers/ata/mvsata_ide.c
index 6bbb345..41f9a91 100644
--- a/drivers/ata/mvsata_ide.c
+++ b/drivers/ata/mvsata_ide.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_ARCH_ORION5X)
 #include <asm/arch/orion5x.h>
diff --git a/drivers/ata/sata.c b/drivers/ata/sata.c
index e384b80..6a38d50 100644
--- a/drivers/ata/sata.c
+++ b/drivers/ata/sata.c
@@ -11,7 +11,9 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <blk.h>
 #include <dm.h>
+#include <part.h>
 #include <sata.h>
 
 #ifndef CONFIG_AHCI
diff --git a/drivers/ata/sata_ceva.c b/drivers/ata/sata_ceva.c
index 2d49630..77508aa 100644
--- a/drivers/ata/sata_ceva.c
+++ b/drivers/ata/sata_ceva.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <ahci.h>
+#include <log.h>
 #include <scsi.h>
 #include <asm/io.h>
 #include <linux/ioport.h>
diff --git a/drivers/ata/sata_mv.c b/drivers/ata/sata_mv.c
index 9ced9c0..b2b5c69 100644
--- a/drivers/ata/sata_mv.c
+++ b/drivers/ata/sata_mv.c
@@ -33,14 +33,19 @@
 
 #include <common.h>
 #include <ahci.h>
+#include <blk.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <fis.h>
 #include <libata.h>
 #include <malloc.h>
 #include <sata.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <linux/mbus.h>
diff --git a/drivers/ata/sata_sandbox.c b/drivers/ata/sata_sandbox.c
index a28ac56..e64cc4a 100644
--- a/drivers/ata/sata_sandbox.c
+++ b/drivers/ata/sata_sandbox.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <blk.h>
 
 int init_sata(int dev)
 {
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 71ee0c0..6896fa8 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <pci.h>
 #include <command.h>
 #include <asm/byteorder.h>
@@ -16,6 +17,7 @@
 #include <sata.h>
 #include <libata.h>
 #include <sata.h>
+#include <linux/delay.h>
 
 #if CONFIG_IS_ENABLED(BLK)
 #include <dm.h>
diff --git a/drivers/ata/sata_sil3114.c b/drivers/ata/sata_sil3114.c
index 4163574..4d3a680 100644
--- a/drivers/ata/sata_sil3114.c
+++ b/drivers/ata/sata_sil3114.c
@@ -8,6 +8,9 @@
  */
 
 #include <common.h>
+#include <blk.h>
+#include <log.h>
+#include <part.h>
 #include <pci.h>
 #include <command.h>
 #include <config.h>
@@ -16,6 +19,7 @@
 #include <ide.h>
 #include <sata.h>
 #include <libata.h>
+#include <linux/delay.h>
 #include "sata_sil3114.h"
 
 /* Convert sectorsize to wordsize */
@@ -61,9 +65,9 @@
 
 	port[num].ctl_reg = 0x08;	/*Default value of control reg */
 	writeb (port[num].ctl_reg, port[num].ioaddr.ctl_addr);
-	udelay (10);
+	udelay(10);
 	writeb (port[num].ctl_reg | ATA_SRST, port[num].ioaddr.ctl_addr);
-	udelay (10);
+	udelay(10);
 	writeb (port[num].ctl_reg, port[num].ioaddr.ctl_addr);
 
 	/* spec mandates ">= 2ms" before checking status.
@@ -118,7 +122,7 @@
 	cmd = ATA_CMD_ID_ATA;	/*Device Identify Command */
 	writeb (cmd, port[num].ioaddr.command_addr);
 	readb (port[num].ioaddr.altstatus_addr);
-	udelay (10);
+	udelay(10);
 
 	status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 1000, 0);
 	if (status & ATA_ERR) {
@@ -191,7 +195,7 @@
 	writeb (ATA_DEVICE_OBS, port[num].ioaddr.device_addr);
 	writeb (ATA_CMD_SET_FEATURES, port[num].ioaddr.command_addr);
 
-	udelay (50);
+	udelay(50);
 	msleep (150);
 
 	status = sata_busy_wait (&port[num].ioaddr, ATA_BUSY, 5000, 0);
@@ -389,7 +393,7 @@
 		if (readl (port) & VND_TF_CNST_INTST) {
 			break;
 		}
-		udelay (1000);
+		udelay(1000);
 		max--;
 	} while ((max > 0));
 
@@ -405,7 +409,7 @@
 		if (!((status = sata_chk_status (ioaddr, usealtstatus)) & bits)) {
 			break;
 		}
-		udelay (1000);
+		udelay(1000);
 		max--;
 	} while ((status & bits) && (max > 0));
 
@@ -426,7 +430,7 @@
 	int i;
 
 	for (i = 0; i < count; i++)
-		udelay (1000);
+		udelay(1000);
 }
 
 /* Read up to 255 sectors
@@ -613,7 +617,7 @@
 
 		output_data (&port[num].ioaddr, buffer, ATA_SECTOR_WORDS);
 		readb (port[num].ioaddr.altstatus_addr);
-		udelay (50);
+		udelay(50);
 
 		++n;
 		++blknr;
diff --git a/drivers/axi/axi-emul-uclass.c b/drivers/axi/axi-emul-uclass.c
index 06c4200..b28351f 100644
--- a/drivers/axi/axi-emul-uclass.c
+++ b/drivers/axi/axi-emul-uclass.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <axi.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <asm/axi.h>
 
diff --git a/drivers/axi/ihs_axi.c b/drivers/axi/ihs_axi.c
index 690aa77..3945511 100644
--- a/drivers/axi/ihs_axi.c
+++ b/drivers/axi/ihs_axi.c
@@ -10,7 +10,10 @@
 #include <common.h>
 #include <axi.h>
 #include <dm.h>
+#include <log.h>
 #include <regmap.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /**
  * struct ihs_axi_regs - Structure for the register map of a IHS AXI device
diff --git a/drivers/axi/sandbox_store.c b/drivers/axi/sandbox_store.c
index a6f483e..42bcae6 100644
--- a/drivers/axi/sandbox_store.c
+++ b/drivers/axi/sandbox_store.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <axi.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 
 /**
diff --git a/drivers/bios_emulator/atibios.c b/drivers/bios_emulator/atibios.c
index fb806b5..9c7f14e 100644
--- a/drivers/bios_emulator/atibios.c
+++ b/drivers/bios_emulator/atibios.c
@@ -48,8 +48,10 @@
 #include <common.h>
 #include <bios_emul.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <vbe.h>
+#include <linux/delay.h>
 #include "biosemui.h"
 
 /* Length of the BIOS image */
diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c
index 7c39aa5..b19375c 100644
--- a/drivers/block/blk-uclass.c
+++ b/drivers/block/blk-uclass.c
@@ -7,7 +7,9 @@
 #include <common.h>
 #include <blk.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
+#include <part.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/uclass-internal.h>
diff --git a/drivers/block/blk_legacy.c b/drivers/block/blk_legacy.c
index 0c343f7..e3ee778 100644
--- a/drivers/block/blk_legacy.c
+++ b/drivers/block/blk_legacy.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <blk.h>
+#include <part.h>
 #include <linux/err.h>
 
 struct blk_driver *blk_driver_lookup_type(int if_type)
diff --git a/drivers/block/blkcache.c b/drivers/block/blkcache.c
index ea40929..b6fc72f 100644
--- a/drivers/block/blkcache.c
+++ b/drivers/block/blkcache.c
@@ -4,8 +4,9 @@
  * Author: Eric Nelson<eric@nelint.com>
  *
  */
-#include <config.h>
 #include <common.h>
+#include <blk.h>
+#include <log.h>
 #include <malloc.h>
 #include <part.h>
 #include <linux/ctype.h>
diff --git a/drivers/block/ide.c b/drivers/block/ide.c
index 67cc4fb..a766b5c 100644
--- a/drivers/block/ide.c
+++ b/drivers/block/ide.c
@@ -6,10 +6,14 @@
 
 #include <common.h>
 #include <ata.h>
+#include <blk.h>
 #include <dm.h>
 #include <ide.h>
+#include <log.h>
+#include <part.h>
 #include <watchdog.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #ifdef __PPC__
 # define EIEIO		__asm__ volatile ("eieio")
diff --git a/drivers/board/gazerbeam.c b/drivers/board/gazerbeam.c
index 85de4e4..ed50fc5 100644
--- a/drivers/board/gazerbeam.c
+++ b/drivers/board/gazerbeam.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <board.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/gpio.h>
 
 #include "gazerbeam.h"
diff --git a/drivers/bootcount/bootcount-uclass.c b/drivers/bootcount/bootcount-uclass.c
index 0689db7..34ac08d 100644
--- a/drivers/bootcount/bootcount-uclass.c
+++ b/drivers/bootcount/bootcount-uclass.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <bootcount.h>
+#include <log.h>
 
 int dm_bootcount_get(struct udevice *dev, u32 *bootcount)
 {
diff --git a/drivers/bootcount/bootcount.c b/drivers/bootcount/bootcount.c
index 655dfaf..e8db854 100644
--- a/drivers/bootcount/bootcount.c
+++ b/drivers/bootcount/bootcount.c
@@ -6,6 +6,7 @@
 
 #include <bootcount.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <linux/compiler.h>
 
 #if !defined(CONFIG_DM_BOOTCOUNT)
diff --git a/drivers/bootcount/bootcount_ram.c b/drivers/bootcount/bootcount_ram.c
index 9c678e2..078c84d 100644
--- a/drivers/bootcount/bootcount_ram.c
+++ b/drivers/bootcount/bootcount_ram.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/bootcount/i2c-eeprom.c b/drivers/bootcount/i2c-eeprom.c
index ee760a2..a3aa0cf 100644
--- a/drivers/bootcount/i2c-eeprom.c
+++ b/drivers/bootcount/i2c-eeprom.c
@@ -8,6 +8,7 @@
 #include <bootcount.h>
 #include <dm.h>
 #include <i2c_eeprom.h>
+#include <log.h>
 
 static const u8 bootcount_magic = 0xbc;
 
diff --git a/drivers/bootcount/rtc.c b/drivers/bootcount/rtc.c
index db89fa3..076a8bb 100644
--- a/drivers/bootcount/rtc.c
+++ b/drivers/bootcount/rtc.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <bootcount.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 
 static const u8 bootcount_magic = 0xbc;
diff --git a/drivers/cache/cache-ncore.c b/drivers/cache/cache-ncore.c
index 0aab7ee..3beff78 100644
--- a/drivers/cache/cache-ncore.c
+++ b/drivers/cache/cache-ncore.c
@@ -8,6 +8,7 @@
 #include <wait_bit.h>
 
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /* Directory */
 #define DIRUSFER		0x80010
diff --git a/drivers/cache/cache-v5l2.c b/drivers/cache/cache-v5l2.c
index 1373e7c..51c074b 100644
--- a/drivers/cache/cache-v5l2.c
+++ b/drivers/cache/cache-v5l2.c
@@ -11,6 +11,7 @@
 #include <hang.h>
 #include <asm/io.h>
 #include <dm/ofnode.h>
+#include <linux/bitops.h>
 
 struct l2cache {
 	volatile u64	configure;
diff --git a/drivers/clk/altera/clk-agilex.c b/drivers/clk/altera/clk-agilex.c
index 5fedec5..0042958 100644
--- a/drivers/clk/altera/clk-agilex.c
+++ b/drivers/clk/altera/clk-agilex.c
@@ -4,12 +4,14 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <clk-uclass.h>
 #include <dm.h>
 #include <dm/lists.h>
 #include <dm/util.h>
 #include <dt-bindings/clock/agilex-clock.h>
+#include <linux/bitops.h>
 
 #include <asm/arch/clock_manager.h>
 
diff --git a/drivers/clk/altera/clk-agilex.h b/drivers/clk/altera/clk-agilex.h
index d93328e..cd68ebc 100644
--- a/drivers/clk/altera/clk-agilex.h
+++ b/drivers/clk/altera/clk-agilex.h
@@ -6,6 +6,10 @@
 #ifndef	_CLK_AGILEX_
 #define	_CLK_AGILEX_
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 #define CM_REG_READL(plat, reg)				\
 	readl((plat)->regs + (reg))
 
diff --git a/drivers/clk/altera/clk-arria10.c b/drivers/clk/altera/clk-arria10.c
index 694a942..ede0be2 100644
--- a/drivers/clk/altera/clk-arria10.c
+++ b/drivers/clk/altera/clk-arria10.c
@@ -12,6 +12,7 @@
 #include <dm/devres.h>
 #include <dm/lists.h>
 #include <dm/util.h>
+#include <linux/bitops.h>
 
 #include <asm/arch/clock_manager.h>
 
diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c
index f4a441a..ccfeded 100644
--- a/drivers/clk/aspeed/clk_ast2500.c
+++ b/drivers/clk/aspeed/clk_ast2500.c
@@ -6,10 +6,12 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/scu_ast2500.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/ast2500-scu.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 /*
diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c
index a80f259..c061094 100644
--- a/drivers/clk/at91/clk-generated.c
+++ b/drivers/clk/at91/clk-generated.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/err.h>
 #include <linux/io.h>
diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
index f9adef2..76b1958 100644
--- a/drivers/clk/at91/clk-system.c
+++ b/drivers/clk/at91/clk-system.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <mach/at91_pmc.h>
 #include "pmc.h"
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index c3cb2ba..af9d724 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <clk-uclass.h>
+#include <log.h>
 #include <dm/device.h>
 #include <linux/err.h>
 #include <linux/io.h>
diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c
index f580844..9d9d77d 100644
--- a/drivers/clk/at91/pmc.c
+++ b/drivers/clk/at91/pmc.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/lists.h>
 #include <dm/util.h>
 #include "pmc.h"
diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c
index f1f76b0..fd47872 100644
--- a/drivers/clk/clk-cdce9xx.c
+++ b/drivers/clk/clk-cdce9xx.c
@@ -14,6 +14,7 @@
 #include <clk-uclass.h>
 #include <i2c.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #define MAX_NUMBER_OF_PLLS		4
 #define MAX_NUMER_OF_OUTPUTS		9
diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index d79ae36..2a68719 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -18,6 +18,7 @@
 #include <dm/uclass.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
+#include <linux/bug.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 #include <linux/log2.h>
diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c
index 6415c2f..23c1f2c 100644
--- a/drivers/clk/clk-gate.c
+++ b/drivers/clk/clk-gate.c
@@ -13,6 +13,7 @@
 #include <clk-uclass.h>
 #include <dm/device.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/clk-provider.h>
 #include <clk.h>
 #include "clk.h"
diff --git a/drivers/clk/clk-hsdk-cgu.c b/drivers/clk/clk-hsdk-cgu.c
index 2de3a6a..3eb93a5 100644
--- a/drivers/clk/clk-hsdk-cgu.c
+++ b/drivers/clk/clk-hsdk-cgu.c
@@ -13,6 +13,10 @@
 #include <clk-uclass.h>
 #include <div64.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <asm/arcregs.h>
 
diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c
index b9d2ae6..c69cce0 100644
--- a/drivers/clk/clk-mux.c
+++ b/drivers/clk/clk-mux.c
@@ -27,6 +27,7 @@
 #include <clk-uclass.h>
 #include <dm/device.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/clk-provider.h>
 #include <clk.h>
 #include "clk.h"
diff --git a/drivers/clk/clk-ti-sci.c b/drivers/clk/clk-ti-sci.c
index 82241d9..7a9a645 100644
--- a/drivers/clk/clk-ti-sci.c
+++ b/drivers/clk/clk-ti-sci.c
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <clk-uclass.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device_compat.h>
 #include <linux/err.h>
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 7187847..9ffc224 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -12,9 +12,11 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/devres.h>
 #include <dm/read.h>
+#include <linux/bug.h>
 #include <linux/clk-provider.h>
 #include <linux/err.h>
 
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 4c477a4..0f55ba7 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <clk-uclass.h>
+#include <log.h>
 #include <dm/device.h>
 #include <dm/uclass.h>
 #include <dm/lists.h>
diff --git a/drivers/clk/clk_bcm6345.c b/drivers/clk/clk_bcm6345.c
index f01ec9a..b850b9f 100644
--- a/drivers/clk/clk_bcm6345.c
+++ b/drivers/clk/clk_bcm6345.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define MAX_CLKS	32
 
diff --git a/drivers/clk/clk_boston.c b/drivers/clk/clk_boston.c
index 0c49ee0..2318dcf 100644
--- a/drivers/clk/clk_boston.c
+++ b/drivers/clk/clk_boston.c
@@ -9,6 +9,7 @@
 #include <dt-bindings/clock/boston-clock.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 struct clk_boston {
 	struct regmap *regmap;
diff --git a/drivers/clk/clk_pic32.c b/drivers/clk/clk_pic32.c
index 79469c4..dc46de2 100644
--- a/drivers/clk/clk_pic32.c
+++ b/drivers/clk/clk_pic32.c
@@ -12,6 +12,8 @@
 #include <wait_bit.h>
 #include <dm/lists.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <mach/pic32.h>
 #include <dt-bindings/clock/microchip,clock.h>
 
diff --git a/drivers/clk/clk_sandbox_ccf.c b/drivers/clk/clk_sandbox_ccf.c
index 3543bea..0619d04 100644
--- a/drivers/clk/clk_sandbox_ccf.c
+++ b/drivers/clk/clk_sandbox_ccf.c
@@ -13,6 +13,7 @@
 #include <asm/clk.h>
 #include <clk-uclass.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/clk-provider.h>
 #include <sandbox-clk.h>
 #include <linux/err.h>
diff --git a/drivers/clk/clk_stm32f.c b/drivers/clk/clk_stm32f.c
index cbcfe3a..93722f7 100644
--- a/drivers/clk/clk_stm32f.c
+++ b/drivers/clk/clk_stm32f.c
@@ -7,7 +7,9 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <stm32_rcc.h>
+#include <linux/bitops.h>
 
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
diff --git a/drivers/clk/clk_stm32h7.c b/drivers/clk/clk_stm32h7.c
index 18d06b3..5e6abca 100644
--- a/drivers/clk/clk_stm32h7.c
+++ b/drivers/clk/clk_stm32h7.c
@@ -7,10 +7,12 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
 #include <dm/root.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/stm32h7-clks.h>
 
diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c
index 0d0ea43..6c5eddb 100644
--- a/drivers/clk/clk_stm32mp1.c
+++ b/drivers/clk/clk_stm32mp1.c
@@ -7,11 +7,14 @@
 #include <clk-uclass.h>
 #include <div64.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <regmap.h>
 #include <spl.h>
 #include <syscon.h>
 #include <time.h>
 #include <vsprintf.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <dt-bindings/clock/stm32mp1-clks.h>
diff --git a/drivers/clk/clk_versal.c b/drivers/clk/clk_versal.c
index 075a083..2fb3171 100644
--- a/drivers/clk/clk_versal.c
+++ b/drivers/clk/clk_versal.c
@@ -5,6 +5,9 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <asm/cache.h>
+#include <asm/ptrace.h>
 #include <dm/device_compat.h>
 #include <linux/bitops.h>
 #include <linux/bitfield.h>
diff --git a/drivers/clk/clk_vexpress_osc.c b/drivers/clk/clk_vexpress_osc.c
index 82e589e..b48319b 100644
--- a/drivers/clk/clk_vexpress_osc.c
+++ b/drivers/clk/clk_vexpress_osc.c
@@ -8,10 +8,12 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
 #include <errno.h>
 #include <misc.h>
+#include <linux/bitops.h>
 
 #define CLK_FUNCTION		BIT(20)
 
diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c
index 4ca1cc0..a699a36 100644
--- a/drivers/clk/clk_zynq.c
+++ b/drivers/clk/clk_zynq.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
 #include <errno.h>
diff --git a/drivers/clk/clk_zynqmp.c b/drivers/clk/clk_zynqmp.c
index e0eb897..2313ac0 100644
--- a/drivers/clk/clk_zynqmp.c
+++ b/drivers/clk/clk_zynqmp.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device_compat.h>
 #include <linux/bitops.h>
diff --git a/drivers/clk/ics8n3qv01.c b/drivers/clk/ics8n3qv01.c
index e85ab1f..4f80bf6 100644
--- a/drivers/clk/ics8n3qv01.c
+++ b/drivers/clk/ics8n3qv01.c
@@ -13,6 +13,7 @@
 #include <dm.h>
 #include <clk-uclass.h>
 #include <i2c.h>
+#include <log.h>
 
 const long long ICS8N3QV01_FREF = 114285000;
 const long long ICS8N3QV01_FREF_LL = 114285000LL;
diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c
index 3e99c52..4941567 100644
--- a/drivers/clk/imx/clk-composite-8m.c
+++ b/drivers/clk/imx/clk-composite-8m.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <malloc.h>
 #include <clk-uclass.h>
diff --git a/drivers/clk/imx/clk-imx6q.c b/drivers/clk/imx/clk-imx6q.c
index bd0d3e4..11d1943 100644
--- a/drivers/clk/imx/clk-imx6q.c
+++ b/drivers/clk/imx/clk-imx6q.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <dt-bindings/clock/imx6qdl-clock.h>
diff --git a/drivers/clk/imx/clk-imx8.c b/drivers/clk/imx/clk-imx8.c
index 671054d..27a652a 100644
--- a/drivers/clk/imx/clk-imx8.c
+++ b/drivers/clk/imx/clk-imx8.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c
index fc41a02..66c9601 100644
--- a/drivers/clk/imx/clk-imx8mm.c
+++ b/drivers/clk/imx/clk-imx8mm.c
@@ -8,6 +8,7 @@
 #include <clk.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <dt-bindings/clock/imx8mm-clock.h>
diff --git a/drivers/clk/imx/clk-imx8mn.c b/drivers/clk/imx/clk-imx8mn.c
index eb43971..2d8e373 100644
--- a/drivers/clk/imx/clk-imx8mn.c
+++ b/drivers/clk/imx/clk-imx8mn.c
@@ -8,6 +8,7 @@
 #include <clk.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <dt-bindings/clock/imx8mn-clock.h>
diff --git a/drivers/clk/imx/clk-imx8mp.c b/drivers/clk/imx/clk-imx8mp.c
index a2693d2..3d7aebb 100644
--- a/drivers/clk/imx/clk-imx8mp.c
+++ b/drivers/clk/imx/clk-imx8mp.c
@@ -8,6 +8,7 @@
 #include <clk.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <dt-bindings/clock/imx8mp-clock.h>
diff --git a/drivers/clk/imx/clk-imx8qm.c b/drivers/clk/imx/clk-imx8qm.c
index a6b09d2..54fb09f 100644
--- a/drivers/clk/imx/clk-imx8qm.c
+++ b/drivers/clk/imx/clk-imx8qm.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/arch/clock.h>
 #include <dt-bindings/clock/imx8qm-clock.h>
diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
index 0db4539..e6b2fb4 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/arch/clock.h>
 #include <dt-bindings/clock/imx8qxp-clock.h>
diff --git a/drivers/clk/imx/clk-imxrt1050.c b/drivers/clk/imx/clk-imxrt1050.c
index 8279e78..594093e 100644
--- a/drivers/clk/imx/clk-imxrt1050.c
+++ b/drivers/clk/imx/clk-imxrt1050.c
@@ -8,6 +8,7 @@
 #include <clk.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <dt-bindings/clock/imxrt1050-clock.h>
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c
index 1673eb2..b0ccb6c 100644
--- a/drivers/clk/imx/clk-pll14xx.c
+++ b/drivers/clk/imx/clk-pll14xx.c
@@ -11,7 +11,9 @@
 #include <clk-uclass.h>
 #include <dm/device.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/clk-provider.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/iopoll.h>
 #include <clk.h>
diff --git a/drivers/clk/mediatek/clk-mt7622.c b/drivers/clk/mediatek/clk-mt7622.c
index a5b61a1..dc0ba71 100644
--- a/drivers/clk/mediatek/clk-mt7622.c
+++ b/drivers/clk/mediatek/clk-mt7622.c
@@ -8,9 +8,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch-mediatek/reset.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt7622-clk.h>
+#include <linux/bitops.h>
 
 #include "clk-mtk.h"
 
diff --git a/drivers/clk/mediatek/clk-mt7623.c b/drivers/clk/mediatek/clk-mt7623.c
index dfce32e..a15fb45 100644
--- a/drivers/clk/mediatek/clk-mt7623.c
+++ b/drivers/clk/mediatek/clk-mt7623.c
@@ -8,9 +8,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch-mediatek/reset.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt7623-clk.h>
+#include <linux/bitops.h>
 
 #include "clk-mtk.h"
 
diff --git a/drivers/clk/mediatek/clk-mt7629.c b/drivers/clk/mediatek/clk-mt7629.c
index 858be85..5b2aa5f 100644
--- a/drivers/clk/mediatek/clk-mt7629.c
+++ b/drivers/clk/mediatek/clk-mt7629.c
@@ -8,9 +8,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch-mediatek/reset.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt7629-clk.h>
+#include <linux/bitops.h>
 
 #include "clk-mtk.h"
 
diff --git a/drivers/clk/mediatek/clk-mt8512.c b/drivers/clk/mediatek/clk-mt8512.c
index cb168f1..ad254d1 100644
--- a/drivers/clk/mediatek/clk-mt8512.c
+++ b/drivers/clk/mediatek/clk-mt8512.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt8512-clk.h>
+#include <linux/bitops.h>
 
 #include "clk-mtk.h"
 
diff --git a/drivers/clk/mediatek/clk-mt8516.c b/drivers/clk/mediatek/clk-mt8516.c
index 071bf69..cd1db25 100644
--- a/drivers/clk/mediatek/clk-mt8516.c
+++ b/drivers/clk/mediatek/clk-mt8516.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt8516-clk.h>
+#include <linux/bitops.h>
 
 #include "clk-mtk.h"
 
diff --git a/drivers/clk/mediatek/clk-mt8518.c b/drivers/clk/mediatek/clk-mt8518.c
index 76f7b3b..985a0c1 100644
--- a/drivers/clk/mediatek/clk-mt8518.c
+++ b/drivers/clk/mediatek/clk-mt8518.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <asm/io.h>
 #include <dt-bindings/clock/mt8518-clk.h>
+#include <linux/bitops.h>
 
 #include "clk-mtk.h"
 
diff --git a/drivers/clk/mediatek/clk-mtk.c b/drivers/clk/mediatek/clk-mtk.c
index c52537c..388471b 100644
--- a/drivers/clk/mediatek/clk-mtk.c
+++ b/drivers/clk/mediatek/clk-mtk.c
@@ -11,6 +11,8 @@
 #include <div64.h>
 #include <dm.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include "clk-mtk.h"
 
diff --git a/drivers/clk/mediatek/clk-mtk.h b/drivers/clk/mediatek/clk-mtk.h
index c7dc980..95a23d1 100644
--- a/drivers/clk/mediatek/clk-mtk.h
+++ b/drivers/clk/mediatek/clk-mtk.h
@@ -7,6 +7,7 @@
 #ifndef __DRV_CLK_MTK_H
 #define __DRV_CLK_MTK_H
 
+#include <linux/bitops.h>
 #define CLK_XTAL			0
 #define MHZ				(1000 * 1000)
 
diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c
index 4b0028d..6ef8b41 100644
--- a/drivers/clk/meson/axg.c
+++ b/drivers/clk/meson/axg.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock-axg.h>
 #include <asm/io.h>
 #include <clk-uclass.h>
@@ -14,6 +15,7 @@
 #include <syscon.h>
 #include <div64.h>
 #include <dt-bindings/clock/axg-clkc.h>
+#include <linux/bitops.h>
 #include "clk_meson.h"
 #include <linux/err.h>
 
diff --git a/drivers/clk/meson/clk_meson.h b/drivers/clk/meson/clk_meson.h
index 7adc55a..ef72a41 100644
--- a/drivers/clk/meson/clk_meson.h
+++ b/drivers/clk/meson/clk_meson.h
@@ -10,6 +10,7 @@
 
 /* Gate Structure */
 
+#include <linux/bitops.h>
 struct meson_gate {
 	unsigned int reg;
 	unsigned int bit;
diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c
index 6089f84..bf2f357 100644
--- a/drivers/clk/meson/g12a.c
+++ b/drivers/clk/meson/g12a.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock-g12a.h>
 #include <asm/io.h>
 #include <clk-uclass.h>
@@ -14,6 +15,8 @@
 #include <syscon.h>
 #include <div64.h>
 #include <dt-bindings/clock/g12a-clkc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include "clk_meson.h"
diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c
index 5ef4dd7..b9353c0 100644
--- a/drivers/clk/meson/gxbb.c
+++ b/drivers/clk/meson/gxbb.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock-gx.h>
 #include <asm/io.h>
 #include <clk-uclass.h>
@@ -14,6 +15,7 @@
 #include <regmap.h>
 #include <syscon.h>
 #include <dt-bindings/clock/gxbb-clkc.h>
+#include <linux/bitops.h>
 #include "clk_meson.h"
 #include <linux/err.h>
 
diff --git a/drivers/clk/mpc83xx_clk.c b/drivers/clk/mpc83xx_clk.c
index 4183db2..8d96ec7 100644
--- a/drivers/clk/mpc83xx_clk.c
+++ b/drivers/clk/mpc83xx_clk.c
@@ -7,11 +7,14 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <clock_legacy.h>
+#include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <vsprintf.h>
 #include <dm/lists.h>
 #include <dt-bindings/clk/mpc83xx-clk.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 
 #include "mpc83xx_clk.h"
 
@@ -390,7 +393,8 @@
 	.bind = mpc83xx_clk_bind,
 };
 
-static int do_clocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_clocks(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	int i;
 	char buf[32];
diff --git a/drivers/clk/mpc83xx_clk.h b/drivers/clk/mpc83xx_clk.h
index 7fb8802..8a31a4c 100644
--- a/drivers/clk/mpc83xx_clk.h
+++ b/drivers/clk/mpc83xx_clk.h
@@ -17,6 +17,7 @@
  * @RAT_2_5_TO_1: Ratio 2.5:1
  * @RAT_3_TO_1:   Ratio 3:1
  */
+#include <linux/bitops.h>
 enum ratio {
 	RAT_UNK,
 	RAT_BYP,
diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c
index 855f979..223da22 100644
--- a/drivers/clk/mvebu/armada-37xx-periph.c
+++ b/drivers/clk/mvebu/armada-37xx-periph.c
@@ -16,6 +16,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #define TBG_SEL		0x0
 #define DIV_SEL0	0x4
diff --git a/drivers/clk/owl/clk_owl.c b/drivers/clk/owl/clk_owl.c
index 5607b2b..9715fce 100644
--- a/drivers/clk/owl/clk_owl.c
+++ b/drivers/clk/owl/clk_owl.c
@@ -17,6 +17,8 @@
 #include <asm/arch-owl/regs_s700.h>
 #include <dt-bindings/clock/actions,s700-cmu.h>
 #endif
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 void owl_clk_init(struct owl_clk_priv *priv)
 {
diff --git a/drivers/clk/owl/clk_owl.h b/drivers/clk/owl/clk_owl.h
index b8d3362..cf896bd 100644
--- a/drivers/clk/owl/clk_owl.h
+++ b/drivers/clk/owl/clk_owl.h
@@ -11,6 +11,9 @@
 #define _OWL_CLK_H_
 
 #include <clk-uclass.h>
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
 
 enum owl_soc {
 	S700,
diff --git a/drivers/clk/renesas/clk-rcar-gen2.c b/drivers/clk/renesas/clk-rcar-gen2.c
index bfd7620..3ed0aa9 100644
--- a/drivers/clk/renesas/clk-rcar-gen2.c
+++ b/drivers/clk/renesas/clk-rcar-gen2.c
@@ -14,6 +14,7 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 
 #include <dt-bindings/clock/renesas-cpg-mssr.h>
diff --git a/drivers/clk/renesas/clk-rcar-gen3.c b/drivers/clk/renesas/clk-rcar-gen3.c
index a2011dd..15e3833 100644
--- a/drivers/clk/renesas/clk-rcar-gen3.c
+++ b/drivers/clk/renesas/clk-rcar-gen3.c
@@ -14,8 +14,10 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <wait_bit.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/renesas-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a7790-cpg-mssr.c b/drivers/clk/renesas/r8a7790-cpg-mssr.c
index b62b875..7451f53 100644
--- a/drivers/clk/renesas/r8a7790-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7790-cpg-mssr.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a7790-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a7791-cpg-mssr.c b/drivers/clk/renesas/r8a7791-cpg-mssr.c
index e11c02e..25fd489 100644
--- a/drivers/clk/renesas/r8a7791-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7791-cpg-mssr.c
@@ -17,6 +17,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a7791-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a7792-cpg-mssr.c b/drivers/clk/renesas/r8a7792-cpg-mssr.c
index fb18ee7..d47ab99 100644
--- a/drivers/clk/renesas/r8a7792-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7792-cpg-mssr.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a7792-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a7794-cpg-mssr.c b/drivers/clk/renesas/r8a7794-cpg-mssr.c
index b6be1bc..7093e0d 100644
--- a/drivers/clk/renesas/r8a7794-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7794-cpg-mssr.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a7794-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a7795-cpg-mssr.c b/drivers/clk/renesas/r8a7795-cpg-mssr.c
index ab4747e..dcd96ad 100644
--- a/drivers/clk/renesas/r8a7795-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7795-cpg-mssr.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a7795-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a7796-cpg-mssr.c b/drivers/clk/renesas/r8a7796-cpg-mssr.c
index 253a914..89dc141 100644
--- a/drivers/clk/renesas/r8a7796-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a7796-cpg-mssr.c
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a7796-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a77965-cpg-mssr.c b/drivers/clk/renesas/r8a77965-cpg-mssr.c
index bd36ea3..6ed8829 100644
--- a/drivers/clk/renesas/r8a77965-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77965-cpg-mssr.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a77965-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a77970-cpg-mssr.c b/drivers/clk/renesas/r8a77970-cpg-mssr.c
index 961eb7f..df07120 100644
--- a/drivers/clk/renesas/r8a77970-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77970-cpg-mssr.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a77970-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a77980-cpg-mssr.c b/drivers/clk/renesas/r8a77980-cpg-mssr.c
index c076ac7..c8d7a94 100644
--- a/drivers/clk/renesas/r8a77980-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77980-cpg-mssr.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a77980-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a77990-cpg-mssr.c b/drivers/clk/renesas/r8a77990-cpg-mssr.c
index 3168de2..357e7b5 100644
--- a/drivers/clk/renesas/r8a77990-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77990-cpg-mssr.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a77990-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/r8a77995-cpg-mssr.c b/drivers/clk/renesas/r8a77995-cpg-mssr.c
index 1c79370..d62aeba 100644
--- a/drivers/clk/renesas/r8a77995-cpg-mssr.c
+++ b/drivers/clk/renesas/r8a77995-cpg-mssr.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/r8a77995-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.c b/drivers/clk/renesas/renesas-cpg-mssr.c
index 7698613..7c1222f 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.c
+++ b/drivers/clk/renesas/renesas-cpg-mssr.c
@@ -13,8 +13,10 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <wait_bit.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #include <dt-bindings/clock/renesas-cpg-mssr.h>
 
diff --git a/drivers/clk/renesas/renesas-cpg-mssr.h b/drivers/clk/renesas/renesas-cpg-mssr.h
index 5b7012d..b669dec 100644
--- a/drivers/clk/renesas/renesas-cpg-mssr.h
+++ b/drivers/clk/renesas/renesas-cpg-mssr.h
@@ -13,6 +13,7 @@
 #ifndef __DRIVERS_CLK_RENESAS_CPG_MSSR__
 #define __DRIVERS_CLK_RENESAS_CPG_MSSR__
 
+#include <linux/bitops.h>
 struct cpg_mssr_info {
 	const struct cpg_core_clk	*core_clk;
 	unsigned int			core_clk_size;
diff --git a/drivers/clk/rockchip/clk_pll.c b/drivers/clk/rockchip/clk_pll.c
index c4b4531..83d45c7 100644
--- a/drivers/clk/rockchip/clk_pll.c
+++ b/drivers/clk/rockchip/clk_pll.c
@@ -7,10 +7,12 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/clock.h>
 #include <asm/arch-rockchip/hardware.h>
 #include <div64.h>
+#include <linux/delay.h>
 
 static struct rockchip_pll_rate_table rockchip_auto_table;
 
diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c
index b885341..71916db 100644
--- a/drivers/clk/rockchip/clk_px30.c
+++ b/drivers/clk/rockchip/clk_px30.c
@@ -8,6 +8,7 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
@@ -16,6 +17,8 @@
 #include <asm/io.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/px30-cru.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/clk/rockchip/clk_rk3036.c b/drivers/clk/rockchip/clk_rk3036.c
index 6e085c4..274572f 100644
--- a/drivers/clk/rockchip/clk_rk3036.c
+++ b/drivers/clk/rockchip/clk_rk3036.c
@@ -7,6 +7,7 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <asm/io.h>
@@ -15,7 +16,9 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3036-cru.h>
+#include <linux/delay.h>
 #include <linux/log2.h>
+#include <linux/stringify.h>
 
 enum {
 	VCO_MAX_HZ	= 2400U * 1000000,
diff --git a/drivers/clk/rockchip/clk_rk3128.c b/drivers/clk/rockchip/clk_rk3128.c
index a6f7902..61f823e 100644
--- a/drivers/clk/rockchip/clk_rk3128.c
+++ b/drivers/clk/rockchip/clk_rk3128.c
@@ -7,6 +7,7 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <asm/io.h>
@@ -16,6 +17,7 @@
 #include <bitfield.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3128-cru.h>
+#include <linux/delay.h>
 #include <linux/log2.h>
 
 enum {
diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c
index 2b82a40..11e3bd3 100644
--- a/drivers/clk/rockchip/clk_rk3188.c
+++ b/drivers/clk/rockchip/clk_rk3188.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <syscon.h>
@@ -21,8 +22,10 @@
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/uclass-internal.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/log2.h>
+#include <linux/stringify.h>
 
 enum rk3188_clk_type {
 	RK3188_CRU,
diff --git a/drivers/clk/rockchip/clk_rk322x.c b/drivers/clk/rockchip/clk_rk322x.c
index ef33adb..054b2fd 100644
--- a/drivers/clk/rockchip/clk_rk322x.c
+++ b/drivers/clk/rockchip/clk_rk322x.c
@@ -7,6 +7,7 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <asm/io.h>
@@ -15,7 +16,10 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3228-cru.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/log2.h>
+#include <linux/stringify.h>
 
 enum {
 	VCO_MAX_HZ	= 3200U * 1000000,
diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
index 81cdb8e..a1dd642 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <syscon.h>
@@ -22,8 +23,11 @@
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/uclass-internal.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/log2.h>
+#include <linux/stringify.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/clk/rockchip/clk_rk3308.c b/drivers/clk/rockchip/clk_rk3308.c
index c0f1285..d3633b6 100644
--- a/drivers/clk/rockchip/clk_rk3308.c
+++ b/drivers/clk/rockchip/clk_rk3308.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <div64.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <asm/io.h>
@@ -16,6 +17,7 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3308-cru.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c
index 8e867c5..02d3b08 100644
--- a/drivers/clk/rockchip/clk_rk3328.c
+++ b/drivers/clk/rockchip/clk_rk3328.c
@@ -8,6 +8,7 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
@@ -17,6 +18,8 @@
 #include <asm/io.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3328-cru.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 struct pll_div {
 	u32 refdiv;
diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
index 2cce1b9..d1804c6 100644
--- a/drivers/clk/rockchip/clk_rk3368.c
+++ b/drivers/clk/rockchip/clk_rk3368.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <syscon.h>
@@ -20,6 +21,8 @@
 #include <asm/io.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3368-cru.h>
+#include <linux/delay.h>
+#include <linux/stringify.h>
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 struct rk3368_clk_plat {
diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index d822aca..e009f1c 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <syscon.h>
@@ -19,6 +20,8 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3399-cru.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 struct rk3399_clk_plat {
diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c
index da9c48b..aa1d98c 100644
--- a/drivers/clk/rockchip/clk_rv1108.c
+++ b/drivers/clk/rockchip/clk_rv1108.c
@@ -9,6 +9,7 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <syscon.h>
 #include <asm/io.h>
@@ -17,6 +18,8 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rv1108-cru.h>
+#include <linux/delay.h>
+#include <linux/stringify.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c
index 8847178..67e21b6 100644
--- a/drivers/clk/sifive/fu540-prci.c
+++ b/drivers/clk/sifive/fu540-prci.c
@@ -35,6 +35,7 @@
 #include <div64.h>
 #include <dm.h>
 #include <errno.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 #include <linux/math64.h>
diff --git a/drivers/clk/sunxi/clk_a10.c b/drivers/clk/sunxi/clk_a10.c
index 7a96d17..67507c5 100644
--- a/drivers/clk/sunxi/clk_a10.c
+++ b/drivers/clk/sunxi/clk_a10.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun4i-a10-ccu.h>
 #include <dt-bindings/reset/sun4i-a10-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate a10_gates[] = {
 	[CLK_AHB_OTG]		= GATE(0x060, BIT(0)),
diff --git a/drivers/clk/sunxi/clk_a10s.c b/drivers/clk/sunxi/clk_a10s.c
index 33d41d4..d11a4b5 100644
--- a/drivers/clk/sunxi/clk_a10s.c
+++ b/drivers/clk/sunxi/clk_a10s.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun5i-ccu.h>
 #include <dt-bindings/reset/sun5i-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate a10s_gates[] = {
 	[CLK_AHB_OTG]		= GATE(0x060, BIT(0)),
diff --git a/drivers/clk/sunxi/clk_a23.c b/drivers/clk/sunxi/clk_a23.c
index c160192..4d562bf 100644
--- a/drivers/clk/sunxi/clk_a23.c
+++ b/drivers/clk/sunxi/clk_a23.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun8i-a23-a33-ccu.h>
 #include <dt-bindings/reset/sun8i-a23-a33-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate a23_gates[] = {
 	[CLK_BUS_MMC0]		= GATE(0x060, BIT(8)),
diff --git a/drivers/clk/sunxi/clk_a31.c b/drivers/clk/sunxi/clk_a31.c
index 4ec3c2a..4a9454e 100644
--- a/drivers/clk/sunxi/clk_a31.c
+++ b/drivers/clk/sunxi/clk_a31.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun6i-a31-ccu.h>
 #include <dt-bindings/reset/sun6i-a31-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate a31_gates[] = {
 	[CLK_AHB1_MMC0]		= GATE(0x060, BIT(8)),
diff --git a/drivers/clk/sunxi/clk_a64.c b/drivers/clk/sunxi/clk_a64.c
index f94e8aa..d96cb1a 100644
--- a/drivers/clk/sunxi/clk_a64.c
+++ b/drivers/clk/sunxi/clk_a64.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun50i-a64-ccu.h>
 #include <dt-bindings/reset/sun50i-a64-ccu.h>
+#include <linux/bitops.h>
 
 static const struct ccu_clk_gate a64_gates[] = {
 	[CLK_BUS_MMC0]		= GATE(0x060, BIT(8)),
diff --git a/drivers/clk/sunxi/clk_a80.c b/drivers/clk/sunxi/clk_a80.c
index fb76aad..80d7407 100644
--- a/drivers/clk/sunxi/clk_a80.c
+++ b/drivers/clk/sunxi/clk_a80.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun9i-a80-ccu.h>
 #include <dt-bindings/reset/sun9i-a80-ccu.h>
+#include <linux/bitops.h>
 
 static const struct ccu_clk_gate a80_gates[] = {
 	[CLK_SPI0]		= GATE(0x430, BIT(31)),
diff --git a/drivers/clk/sunxi/clk_a83t.c b/drivers/clk/sunxi/clk_a83t.c
index 2be87a3..d6f23dd 100644
--- a/drivers/clk/sunxi/clk_a83t.c
+++ b/drivers/clk/sunxi/clk_a83t.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun8i-a83t-ccu.h>
 #include <dt-bindings/reset/sun8i-a83t-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate a83t_gates[] = {
 	[CLK_BUS_MMC0]		= GATE(0x060, BIT(8)),
diff --git a/drivers/clk/sunxi/clk_h3.c b/drivers/clk/sunxi/clk_h3.c
index 6111a13..7e844f4 100644
--- a/drivers/clk/sunxi/clk_h3.c
+++ b/drivers/clk/sunxi/clk_h3.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun8i-h3-ccu.h>
 #include <dt-bindings/reset/sun8i-h3-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate h3_gates[] = {
 	[CLK_BUS_MMC0]		= GATE(0x060, BIT(8)),
diff --git a/drivers/clk/sunxi/clk_h6.c b/drivers/clk/sunxi/clk_h6.c
index 105c15d..a1cb895 100644
--- a/drivers/clk/sunxi/clk_h6.c
+++ b/drivers/clk/sunxi/clk_h6.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun50i-h6-ccu.h>
 #include <dt-bindings/reset/sun50i-h6-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate h6_gates[] = {
 	[CLK_BUS_MMC0]		= GATE(0x84c, BIT(0)),
diff --git a/drivers/clk/sunxi/clk_r40.c b/drivers/clk/sunxi/clk_r40.c
index 44abc4f..ac360b2 100644
--- a/drivers/clk/sunxi/clk_r40.c
+++ b/drivers/clk/sunxi/clk_r40.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun8i-r40-ccu.h>
 #include <dt-bindings/reset/sun8i-r40-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate r40_gates[] = {
 	[CLK_BUS_MMC0]		= GATE(0x060, BIT(8)),
diff --git a/drivers/clk/sunxi/clk_sunxi.c b/drivers/clk/sunxi/clk_sunxi.c
index 6d4aeb5..41934cd 100644
--- a/drivers/clk/sunxi/clk_sunxi.c
+++ b/drivers/clk/sunxi/clk_sunxi.c
@@ -8,9 +8,11 @@
 #include <clk-uclass.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <asm/arch/ccu.h>
+#include <linux/bitops.h>
 #include <linux/log2.h>
 
 static const struct ccu_clk_gate *priv_to_gate(struct ccu_priv *priv,
diff --git a/drivers/clk/sunxi/clk_v3s.c b/drivers/clk/sunxi/clk_v3s.c
index 789ac72..b79446c 100644
--- a/drivers/clk/sunxi/clk_v3s.c
+++ b/drivers/clk/sunxi/clk_v3s.c
@@ -11,6 +11,7 @@
 #include <asm/arch/ccu.h>
 #include <dt-bindings/clock/sun8i-v3s-ccu.h>
 #include <dt-bindings/reset/sun8i-v3s-ccu.h>
+#include <linux/bitops.h>
 
 static struct ccu_clk_gate v3s_gates[] = {
 	[CLK_BUS_MMC0]		= GATE(0x060, BIT(8)),
diff --git a/drivers/clk/tegra/tegra-car-clk.c b/drivers/clk/tegra/tegra-car-clk.c
index 6083f14..09a7cf4 100644
--- a/drivers/clk/tegra/tegra-car-clk.c
+++ b/drivers/clk/tegra/tegra-car-clk.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/arch/clock.h>
 #include <asm/arch-tegra/clk_rst.h>
diff --git a/drivers/clk/tegra/tegra186-clk.c b/drivers/clk/tegra/tegra186-clk.c
index 612fb1b..5a98a3f 100644
--- a/drivers/clk/tegra/tegra186-clk.c
+++ b/drivers/clk/tegra/tegra186-clk.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <misc.h>
 #include <asm/arch-tegra/bpmp_abi.h>
 
diff --git a/drivers/clk/uniphier/clk-uniphier-core.c b/drivers/clk/uniphier/clk-uniphier-core.c
index 9f24050..c9ec523 100644
--- a/drivers/clk/uniphier/clk-uniphier-core.c
+++ b/drivers/clk/uniphier/clk-uniphier-core.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <dm/device_compat.h>
 #include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
 
diff --git a/drivers/core/acpi.c b/drivers/core/acpi.c
index e09905c..8ae6157 100644
--- a/drivers/core/acpi.c
+++ b/drivers/core/acpi.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/acpi.h>
 #include <dm/device-internal.h>
 #include <dm/root.h>
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 0157bb1..a7408d9 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -10,11 +10,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/io.h>
 #include <clk.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <dm/device.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
diff --git a/drivers/core/devres.c b/drivers/core/devres.c
index 457e130..8824469 100644
--- a/drivers/core/devres.c
+++ b/drivers/core/devres.c
@@ -10,6 +10,7 @@
 #define LOG_CATEGORY LOGC_DEVRES
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/compat.h>
 #include <linux/kernel.h>
diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c
index 33811e6..dfcb868 100644
--- a/drivers/core/fdtaddr.c
+++ b/drivers/core/fdtaddr.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm/device-internal.h>
 
diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index c7db14e..5beba91 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <dm/device.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c
index ea3ee8b..922e78f 100644
--- a/drivers/core/of_access.c
+++ b/drivers/core/of_access.c
@@ -20,7 +20,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
+#include <linux/bug.h>
 #include <linux/libfdt.h>
 #include <dm/of_access.h>
 #include <linux/ctype.h>
diff --git a/drivers/core/of_addr.c b/drivers/core/of_addr.c
index 4e256d9..ca34d84 100644
--- a/drivers/core/of_addr.c
+++ b/drivers/core/of_addr.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/bug.h>
 #include <linux/libfdt.h>
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
diff --git a/drivers/core/of_extra.c b/drivers/core/of_extra.c
index f1f393c..6420e6e 100644
--- a/drivers/core/of_extra.c
+++ b/drivers/core/of_extra.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <dm/of_access.h>
 #include <dm/of_extra.h>
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index e3c42da..c37afa1 100644
--- a/drivers/core/ofnode.c
+++ b/drivers/core/ofnode.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/libfdt.h>
 #include <dm/of_access.h>
diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c
index a974744..4a214ef 100644
--- a/drivers/core/regmap.c
+++ b/drivers/core/regmap.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <malloc.h>
 #include <mapmem.h>
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 14df16c..7d257ea 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/libfdt.h>
 #include <dm/device.h>
diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c
index 15f0e42..b5cd763 100644
--- a/drivers/core/syscon-uclass.c
+++ b/drivers/core/syscon-uclass.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <syscon.h>
 #include <dm.h>
 #include <errno.h>
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 6849302..2ab419c 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device.h>
 #include <dm/device-internal.h>
diff --git a/drivers/cpu/bmips_cpu.c b/drivers/cpu/bmips_cpu.c
index fc04747..2649c5c 100644
--- a/drivers/cpu/bmips_cpu.c
+++ b/drivers/cpu/bmips_cpu.c
@@ -11,7 +11,9 @@
 #include <cpu.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define REV_CHIPID_SHIFT		16
 #define REV_CHIPID_MASK			(0xffff << REV_CHIPID_SHIFT)
diff --git a/drivers/cpu/cpu-uclass.c b/drivers/cpu/cpu-uclass.c
index 8352e2e..7418c26 100644
--- a/drivers/cpu/cpu-uclass.c
+++ b/drivers/cpu/cpu-uclass.c
@@ -8,6 +8,7 @@
 #include <cpu.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <dm/lists.h>
 #include <dm/root.h>
 #include <linux/err.h>
diff --git a/drivers/cpu/imx8_cpu.c b/drivers/cpu/imx8_cpu.c
index 95c14c9..dddd12d 100644
--- a/drivers/cpu/imx8_cpu.c
+++ b/drivers/cpu/imx8_cpu.c
@@ -7,10 +7,12 @@
 #include <cpu.h>
 #include <dm.h>
 #include <thermal.h>
+#include <asm/system.h>
 #include <asm/arch/sci/sci.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch-imx/cpu.h>
 #include <asm/armv8/cpu.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/cpu/mpc83xx_cpu.c b/drivers/cpu/mpc83xx_cpu.c
index 1e58457..f8a84ba 100644
--- a/drivers/cpu/mpc83xx_cpu.c
+++ b/drivers/cpu/mpc83xx_cpu.c
@@ -9,7 +9,9 @@
 #include <clk.h>
 #include <cpu.h>
 #include <dm.h>
+#include <log.h>
 #include <vsprintf.h>
+#include <linux/bitops.h>
 
 #include "mpc83xx_cpu.h"
 
diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c
index 28ad0aa..cb04f56 100644
--- a/drivers/cpu/riscv_cpu.c
+++ b/drivers/cpu/riscv_cpu.c
@@ -7,8 +7,10 @@
 #include <cpu.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/crypto/ace_sha.c b/drivers/crypto/ace_sha.c
index 3461105..261d3ef 100644
--- a/drivers/crypto/ace_sha.c
+++ b/drivers/crypto/ace_sha.c
@@ -5,6 +5,8 @@
  */
 #include <common.h>
 #include "ace_sha.h"
+#include <log.h>
+#include <rand.h>
 
 #ifdef CONFIG_SHA_HW_ACCEL
 #include <u-boot/sha256.h>
diff --git a/drivers/crypto/fsl/error.c b/drivers/crypto/fsl/error.c
index 731c748..c765749 100644
--- a/drivers/crypto/fsl/error.c
+++ b/drivers/crypto/fsl/error.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include "desc.h"
 #include "jr.h"
diff --git a/drivers/crypto/fsl/fsl_blob.c b/drivers/crypto/fsl/fsl_blob.c
index 0531b1b..d6bd861 100644
--- a/drivers/crypto/fsl/fsl_blob.c
+++ b/drivers/crypto/fsl/fsl_blob.c
@@ -6,9 +6,11 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <fsl_sec.h>
+#include <asm/cache.h>
 #include <linux/errno.h>
 #include "jobdesc.h"
 #include "desc.h"
diff --git a/drivers/crypto/fsl/fsl_hash.c b/drivers/crypto/fsl/fsl_hash.c
index 74e38ca..953deec 100644
--- a/drivers/crypto/fsl/fsl_hash.c
+++ b/drivers/crypto/fsl/fsl_hash.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include "jobdesc.h"
@@ -13,6 +14,7 @@
 #include "jr.h"
 #include "fsl_hash.h"
 #include <hw_sha.h>
+#include <asm/cache.h>
 #include <linux/errno.h>
 
 #define CRYPTO_MAX_ALG_NAME	80
diff --git a/drivers/crypto/fsl/fsl_rsa.c b/drivers/crypto/fsl/fsl_rsa.c
index 0cb3c6b..ed2a54f 100644
--- a/drivers/crypto/fsl/fsl_rsa.c
+++ b/drivers/crypto/fsl/fsl_rsa.c
@@ -7,6 +7,7 @@
 #include <config.h>
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/types.h>
 #include <malloc.h>
 #include "jobdesc.h"
diff --git a/drivers/crypto/fsl/jobdesc.c b/drivers/crypto/fsl/jobdesc.c
index 637ef29..2f35e0c 100644
--- a/drivers/crypto/fsl/jobdesc.c
+++ b/drivers/crypto/fsl/jobdesc.c
@@ -13,6 +13,7 @@
 #include "desc_constr.h"
 #include "jobdesc.h"
 #include "rsa_caam.h"
+#include <asm/cache.h>
 
 #if defined(CONFIG_MX6) || defined(CONFIG_MX7)
 /*!
diff --git a/drivers/crypto/fsl/jr.c b/drivers/crypto/fsl/jr.c
index aa84f2c..e2d9216 100644
--- a/drivers/crypto/fsl/jr.c
+++ b/drivers/crypto/fsl/jr.c
@@ -7,13 +7,16 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include "fsl_sec.h"
 #include "jr.h"
 #include "jobdesc.h"
 #include "desc_constr.h"
 #include <time.h>
+#include <asm/cache.h>
 #ifdef CONFIG_FSL_CORENET
+#include <asm/cache.h>
 #include <asm/fsl_pamu.h>
 #endif
 
diff --git a/drivers/crypto/rsa_mod_exp/mod_exp_sw.c b/drivers/crypto/rsa_mod_exp/mod_exp_sw.c
index c9b571a..03b3d61 100644
--- a/drivers/crypto/rsa_mod_exp/mod_exp_sw.c
+++ b/drivers/crypto/rsa_mod_exp/mod_exp_sw.c
@@ -7,6 +7,7 @@
 #include <config.h>
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <u-boot/rsa-mod-exp.h>
 
 static int mod_exp_sw(struct udevice *dev, const uint8_t *sig, uint32_t sig_len,
diff --git a/drivers/ddr/altera/sdram_agilex.c b/drivers/ddr/altera/sdram_agilex.c
index 626fb72..a0f25d1 100644
--- a/drivers/ddr/altera/sdram_agilex.c
+++ b/drivers/ddr/altera/sdram_agilex.c
@@ -10,6 +10,7 @@
 #include <div64.h>
 #include <fdtdec.h>
 #include <hang.h>
+#include <log.h>
 #include <ram.h>
 #include <reset.h>
 #include "sdram_soc64.h"
diff --git a/drivers/ddr/altera/sdram_arria10.c b/drivers/ddr/altera/sdram_arria10.c
index 2fd50b7..3c58f59 100644
--- a/drivers/ddr/altera/sdram_arria10.c
+++ b/drivers/ddr/altera/sdram_arria10.c
@@ -7,14 +7,19 @@
 #include <cpu_func.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <wait_bit.h>
 #include <watchdog.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/misc.h>
 #include <asm/arch/reset_manager.h>
 #include <asm/arch/sdram.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/kernel.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/ddr/altera/sdram_gen5.c b/drivers/ddr/altera/sdram_gen5.c
index 314c7ae..1360bd0 100644
--- a/drivers/ddr/altera/sdram_gen5.c
+++ b/drivers/ddr/altera/sdram_gen5.c
@@ -7,6 +7,7 @@
 #include <errno.h>
 #include <div64.h>
 #include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <reset.h>
 #include <watchdog.h>
@@ -14,6 +15,7 @@
 #include <asm/arch/reset_manager.h>
 #include <asm/arch/sdram.h>
 #include <asm/arch/system_manager.h>
+#include <asm/bitops.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
 
diff --git a/drivers/ddr/altera/sdram_s10.c b/drivers/ddr/altera/sdram_s10.c
index 0b36d6c..91f76e0 100644
--- a/drivers/ddr/altera/sdram_s10.c
+++ b/drivers/ddr/altera/sdram_s10.c
@@ -12,6 +12,7 @@
 #include <fdtdec.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <reset.h>
 #include "sdram_s10.h"
diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c
index 1f7ead0..491f689 100644
--- a/drivers/ddr/altera/sdram_soc64.c
+++ b/drivers/ddr/altera/sdram_soc64.c
@@ -11,6 +11,8 @@
 #include <div64.h>
 #include <fdtdec.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <reset.h>
 #include "sdram_soc64.h"
@@ -18,6 +20,7 @@
 #include <asm/arch/firewall.h>
 #include <asm/arch/system_manager.h>
 #include <asm/arch/reset_manager.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <linux/sizes.h>
diff --git a/drivers/ddr/altera/sequencer.c b/drivers/ddr/altera/sequencer.c
index 35bda9b..2dbde49 100644
--- a/drivers/ddr/altera/sequencer.c
+++ b/drivers/ddr/altera/sequencer.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/sdram.h>
 #include <errno.h>
diff --git a/drivers/ddr/fsl/arm_ddr_gen3.c b/drivers/ddr/fsl/arm_ddr_gen3.c
index e9eaa1e..629ba67 100644
--- a/drivers/ddr/fsl/arm_ddr_gen3.c
+++ b/drivers/ddr/fsl/arm_ddr_gen3.c
@@ -6,12 +6,14 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <fsl_ddr_sdram.h>
 #include <asm/processor.h>
 #include <fsl_immap.h>
 #include <fsl_ddr.h>
 #include <asm/arch/clock.h>
+#include <linux/delay.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
diff --git a/drivers/ddr/fsl/ctrl_regs.c b/drivers/ddr/fsl/ctrl_regs.c
index 98ccbb7..2d3fb19 100644
--- a/drivers/ddr/fsl/ctrl_regs.c
+++ b/drivers/ddr/fsl/ctrl_regs.c
@@ -15,6 +15,8 @@
 #include <fsl_errata.h>
 #include <fsl_ddr.h>
 #include <fsl_immap.h>
+#include <log.h>
+#include <asm/bitops.h>
 #include <asm/io.h>
 #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
 	defined(CONFIG_ARM)
diff --git a/drivers/ddr/fsl/ddr1_dimm_params.c b/drivers/ddr/fsl/ddr1_dimm_params.c
index 50fd998..e5481ea 100644
--- a/drivers/ddr/fsl/ddr1_dimm_params.c
+++ b/drivers/ddr/fsl/ddr1_dimm_params.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <fsl_ddr_sdram.h>
+#include <log.h>
+#include <asm/bitops.h>
 
 #include <fsl_ddr.h>
 
diff --git a/drivers/ddr/fsl/ddr2_dimm_params.c b/drivers/ddr/fsl/ddr2_dimm_params.c
index ad91ba6..3b78118 100644
--- a/drivers/ddr/fsl/ddr2_dimm_params.c
+++ b/drivers/ddr/fsl/ddr2_dimm_params.c
@@ -5,6 +5,8 @@
 
 #include <common.h>
 #include <fsl_ddr_sdram.h>
+#include <log.h>
+#include <asm/bitops.h>
 
 #include <fsl_ddr.h>
 /*
diff --git a/drivers/ddr/fsl/ddr3_dimm_params.c b/drivers/ddr/fsl/ddr3_dimm_params.c
index 47b4d76..8464438 100644
--- a/drivers/ddr/fsl/ddr3_dimm_params.c
+++ b/drivers/ddr/fsl/ddr3_dimm_params.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <fsl_ddr_sdram.h>
+#include <log.h>
 
 #include <fsl_ddr.h>
 
diff --git a/drivers/ddr/fsl/ddr4_dimm_params.c b/drivers/ddr/fsl/ddr4_dimm_params.c
index 2aa53d1..e2bdc12 100644
--- a/drivers/ddr/fsl/ddr4_dimm_params.c
+++ b/drivers/ddr/fsl/ddr4_dimm_params.c
@@ -12,6 +12,8 @@
 
 #include <common.h>
 #include <fsl_ddr_sdram.h>
+#include <log.h>
+#include <linux/bug.h>
 
 #include <fsl_ddr.h>
 
diff --git a/drivers/ddr/fsl/fsl_ddr_gen4.c b/drivers/ddr/fsl/fsl_ddr_gen4.c
index 17a4a82..eab5b82 100644
--- a/drivers/ddr/fsl/fsl_ddr_gen4.c
+++ b/drivers/ddr/fsl/fsl_ddr_gen4.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <asm/io.h>
 #include <fsl_ddr_sdram.h>
 #include <asm/processor.h>
@@ -15,6 +16,7 @@
 	defined(CONFIG_ARM)
 #include <asm/arch/clock.h>
 #endif
+#include <linux/delay.h>
 
 #define CTLR_INTLV_MASK	0x20000000
 
diff --git a/drivers/ddr/fsl/fsl_mmdc.c b/drivers/ddr/fsl/fsl_mmdc.c
index 0828512..cbd625b 100644
--- a/drivers/ddr/fsl/fsl_mmdc.c
+++ b/drivers/ddr/fsl/fsl_mmdc.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <fsl_mmdc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 static void set_wait_for_bits_clear(void *ptr, u32 value, u32 bits)
 {
diff --git a/drivers/ddr/fsl/interactive.c b/drivers/ddr/fsl/interactive.c
index 8e171e6..2f76beb 100644
--- a/drivers/ddr/fsl/interactive.c
+++ b/drivers/ddr/fsl/interactive.c
@@ -13,7 +13,10 @@
 
 #include <common.h>
 #include <cli.h>
+#include <command.h>
 #include <env.h>
+#include <log.h>
+#include <asm/bitops.h>
 #include <linux/ctype.h>
 #include <asm/types.h>
 #include <asm/io.h>
diff --git a/drivers/ddr/fsl/lc_common_dimm_params.c b/drivers/ddr/fsl/lc_common_dimm_params.c
index df5bdb6..d299d76 100644
--- a/drivers/ddr/fsl/lc_common_dimm_params.c
+++ b/drivers/ddr/fsl/lc_common_dimm_params.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <fsl_ddr_sdram.h>
+#include <log.h>
+#include <asm/bitops.h>
 
 #include <fsl_ddr.h>
 
diff --git a/drivers/ddr/fsl/main.c b/drivers/ddr/fsl/main.c
index 0aa6aed..84139b8 100644
--- a/drivers/ddr/fsl/main.c
+++ b/drivers/ddr/fsl/main.c
@@ -14,6 +14,9 @@
 #include <i2c.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr.h>
+#include <init.h>
+#include <log.h>
+#include <asm/bitops.h>
 
 /*
  * CONFIG_SYS_FSL_DDR_SDRAM_BASE_PHY is the physical address from the view
diff --git a/drivers/ddr/fsl/mpc85xx_ddr_gen1.c b/drivers/ddr/fsl/mpc85xx_ddr_gen1.c
index 1ab15c9..572f370 100644
--- a/drivers/ddr/fsl/mpc85xx_ddr_gen1.c
+++ b/drivers/ddr/fsl/mpc85xx_ddr_gen1.c
@@ -4,8 +4,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <fsl_ddr_sdram.h>
+#include <linux/delay.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
diff --git a/drivers/ddr/fsl/mpc85xx_ddr_gen2.c b/drivers/ddr/fsl/mpc85xx_ddr_gen2.c
index 54c10a8..d7b8064 100644
--- a/drivers/ddr/fsl/mpc85xx_ddr_gen2.c
+++ b/drivers/ddr/fsl/mpc85xx_ddr_gen2.c
@@ -7,6 +7,7 @@
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <fsl_ddr_sdram.h>
+#include <linux/delay.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
diff --git a/drivers/ddr/fsl/mpc85xx_ddr_gen3.c b/drivers/ddr/fsl/mpc85xx_ddr_gen3.c
index a9b085d..ab8d2de 100644
--- a/drivers/ddr/fsl/mpc85xx_ddr_gen3.c
+++ b/drivers/ddr/fsl/mpc85xx_ddr_gen3.c
@@ -4,9 +4,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <fsl_ddr_sdram.h>
 #include <asm/processor.h>
+#include <linux/delay.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
diff --git a/drivers/ddr/fsl/mpc86xx_ddr.c b/drivers/ddr/fsl/mpc86xx_ddr.c
index 934b72b..43ed1ba 100644
--- a/drivers/ddr/fsl/mpc86xx_ddr.c
+++ b/drivers/ddr/fsl/mpc86xx_ddr.c
@@ -4,8 +4,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <fsl_ddr_sdram.h>
+#include <linux/delay.h>
 
 #if (CONFIG_CHIP_SELECTS_PER_CTRL > 4)
 #error Invalid setting for CONFIG_CHIP_SELECTS_PER_CTRL
diff --git a/drivers/ddr/fsl/options.c b/drivers/ddr/fsl/options.c
index b917931..c000a45 100644
--- a/drivers/ddr/fsl/options.c
+++ b/drivers/ddr/fsl/options.c
@@ -8,6 +8,7 @@
 #include <env.h>
 #include <hwconfig.h>
 #include <fsl_ddr_sdram.h>
+#include <log.h>
 
 #include <fsl_ddr.h>
 #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
diff --git a/drivers/ddr/fsl/util.c b/drivers/ddr/fsl/util.c
index b270796..ac4f8d2 100644
--- a/drivers/ddr/fsl/util.c
+++ b/drivers/ddr/fsl/util.c
@@ -8,9 +8,11 @@
 #include <asm/fsl_law.h>
 #endif
 #include <div64.h>
+#include <linux/delay.h>
 
 #include <fsl_ddr.h>
 #include <fsl_immap.h>
+#include <log.h>
 #include <asm/io.h>
 #if defined(CONFIG_FSL_LSCH2) || defined(CONFIG_FSL_LSCH3) || \
 	defined(CONFIG_ARM)
diff --git a/drivers/ddr/imx/imx8m/ddr_init.c b/drivers/ddr/imx/imx8m/ddr_init.c
index af8c142..bbddee6 100644
--- a/drivers/ddr/imx/imx8m/ddr_init.c
+++ b/drivers/ddr/imx/imx8m/ddr_init.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/ddr.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/ddr/imx/imx8m/ddrphy_train.c b/drivers/ddr/imx/imx8m/ddrphy_train.c
index 306af82..f2a997b 100644
--- a/drivers/ddr/imx/imx8m/ddrphy_train.c
+++ b/drivers/ddr/imx/imx8m/ddrphy_train.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/kernel.h>
 #include <asm/arch/ddr.h>
 #include <asm/arch/lpddr4_define.h>
diff --git a/drivers/ddr/imx/imx8m/ddrphy_utils.c b/drivers/ddr/imx/imx8m/ddrphy_utils.c
index 9ac7ca9..d5eef53 100644
--- a/drivers/ddr/imx/imx8m/ddrphy_utils.c
+++ b/drivers/ddr/imx/imx8m/ddrphy_utils.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/ddr.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/ddr/imx/imx8m/helper.c b/drivers/ddr/imx/imx8m/helper.c
index b3e6383..5ebf54f 100644
--- a/drivers/ddr/imx/imx8m/helper.c
+++ b/drivers/ddr/imx/imx8m/helper.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <errno.h>
diff --git a/drivers/ddr/marvell/a38x/ddr3_debug.c b/drivers/ddr/marvell/a38x/ddr3_debug.c
index f5fc964..22e0cc4 100644
--- a/drivers/ddr/marvell/a38x/ddr3_debug.c
+++ b/drivers/ddr/marvell/a38x/ddr3_debug.c
@@ -6,6 +6,7 @@
 #include "ddr3_init.h"
 #include "mv_ddr_training_db.h"
 #include "mv_ddr_regs.h"
+#include <log.h>
 
 u8 is_reg_dump = 0;
 u8 debug_pbs = DEBUG_LEVEL_ERROR;
diff --git a/drivers/ddr/marvell/a38x/ddr3_training.c b/drivers/ddr/marvell/a38x/ddr3_training.c
index 9718f18..34cc170 100644
--- a/drivers/ddr/marvell/a38x/ddr3_training.c
+++ b/drivers/ddr/marvell/a38x/ddr3_training.c
@@ -7,6 +7,8 @@
 #include "mv_ddr_common.h"
 #include "mv_ddr_training_db.h"
 #include "mv_ddr_regs.h"
+#include <log.h>
+#include <linux/delay.h>
 
 #define GET_CS_FROM_MASK(mask)	(cs_mask2_num[mask])
 #define CS_CBE_VALUE(cs_num)	(cs_cbe_reg[cs_num])
diff --git a/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c b/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
index 1eababe..979f353 100644
--- a/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
+++ b/drivers/ddr/marvell/a38x/ddr3_training_ip_engine.c
@@ -7,6 +7,7 @@
 #include "mv_ddr_regs.h"
 #include "ddr_training_ip_db.h"
 #include <image.h>
+#include <linux/delay.h>
 
 #define PATTERN_1	0x55555555
 #define PATTERN_2	0xaaaaaaaa
diff --git a/drivers/ddr/marvell/a38x/ddr3_training_leveling.c b/drivers/ddr/marvell/a38x/ddr3_training_leveling.c
index 7f7df67..dadb06b 100644
--- a/drivers/ddr/marvell/a38x/ddr3_training_leveling.c
+++ b/drivers/ddr/marvell/a38x/ddr3_training_leveling.c
@@ -7,6 +7,7 @@
 #include "mv_ddr_training_db.h"
 #include "ddr_training_ip_db.h"
 #include "mv_ddr_regs.h"
+#include <linux/delay.h>
 
 #define WL_ITERATION_NUM	10
 
diff --git a/drivers/ddr/marvell/a38x/mv_ddr_plat.c b/drivers/ddr/marvell/a38x/mv_ddr_plat.c
index cc7942d..72f0dfb 100644
--- a/drivers/ddr/marvell/a38x/mv_ddr_plat.c
+++ b/drivers/ddr/marvell/a38x/mv_ddr_plat.c
@@ -7,6 +7,7 @@
 #include "mv_ddr_training_db.h"
 #include "mv_ddr_regs.h"
 #include "mv_ddr_sys_env_lib.h"
+#include <linux/delay.h>
 
 #define DDR_INTERFACES_NUM		1
 #define DDR_INTERFACE_OCTETS_NUM	5
diff --git a/drivers/ddr/marvell/axp/ddr3_dfs.c b/drivers/ddr/marvell/axp/ddr3_dfs.c
index ba89959..b58c0fe 100644
--- a/drivers/ddr/marvell/axp/ddr3_dfs.c
+++ b/drivers/ddr/marvell/axp/ddr3_dfs.c
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_hw_training.h"
 
diff --git a/drivers/ddr/marvell/axp/ddr3_dqs.c b/drivers/ddr/marvell/axp/ddr3_dqs.c
index 0a64dde..0db9421 100644
--- a/drivers/ddr/marvell/axp/ddr3_dqs.c
+++ b/drivers/ddr/marvell/axp/ddr3_dqs.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/ddr/marvell/axp/ddr3_hw_training.c b/drivers/ddr/marvell/axp/ddr3_hw_training.c
index cc3a77c..35d98fa 100644
--- a/drivers/ddr/marvell/axp/ddr3_hw_training.c
+++ b/drivers/ddr/marvell/axp/ddr3_hw_training.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_init.h"
 #include "ddr3_hw_training.h"
diff --git a/drivers/ddr/marvell/axp/ddr3_init.c b/drivers/ddr/marvell/axp/ddr3_init.c
index 30ad5d4..607f3e1 100644
--- a/drivers/ddr/marvell/axp/ddr3_init.c
+++ b/drivers/ddr/marvell/axp/ddr3_init.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_init.h"
 
diff --git a/drivers/ddr/marvell/axp/ddr3_pbs.c b/drivers/ddr/marvell/axp/ddr3_pbs.c
index e44f08d..069a42fb 100644
--- a/drivers/ddr/marvell/axp/ddr3_pbs.c
+++ b/drivers/ddr/marvell/axp/ddr3_pbs.c
@@ -9,6 +9,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_hw_training.h"
 
diff --git a/drivers/ddr/marvell/axp/ddr3_read_leveling.c b/drivers/ddr/marvell/axp/ddr3_read_leveling.c
index bf8d676..30a5c35 100644
--- a/drivers/ddr/marvell/axp/ddr3_read_leveling.c
+++ b/drivers/ddr/marvell/axp/ddr3_read_leveling.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/ddr/marvell/axp/ddr3_write_leveling.c b/drivers/ddr/marvell/axp/ddr3_write_leveling.c
index cd364ed..d4add44 100644
--- a/drivers/ddr/marvell/axp/ddr3_write_leveling.c
+++ b/drivers/ddr/marvell/axp/ddr3_write_leveling.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "ddr3_hw_training.h"
 
diff --git a/drivers/ddr/marvell/axp/xor.c b/drivers/ddr/marvell/axp/xor.c
index 31e6582..17bfe6a 100644
--- a/drivers/ddr/marvell/axp/xor.c
+++ b/drivers/ddr/marvell/axp/xor.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/demo/demo-shape.c b/drivers/demo/demo-shape.c
index 98b6446..8686c99 100644
--- a/drivers/demo/demo-shape.c
+++ b/drivers/demo/demo-shape.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm-demo.h>
 #include <asm/io.h>
diff --git a/drivers/demo/demo-uclass.c b/drivers/demo/demo-uclass.c
index 3b8439b..6c36f03 100644
--- a/drivers/demo/demo-uclass.c
+++ b/drivers/demo/demo-uclass.c
@@ -11,6 +11,7 @@
 #include <dm-demo.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <linux/list.h>
diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index df50196..a298c2c 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <env.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <fat.h>
diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 0d495a7..691d01c 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <errno.h>
 #include <div64.h>
@@ -14,6 +15,7 @@
 #include <ext4fs.h>
 #include <fat.h>
 #include <mmc.h>
+#include <part.h>
 
 static unsigned char *dfu_file_buf;
 static u64 dfu_file_buf_len;
@@ -369,7 +371,7 @@
 					simple_strtoul(s, NULL, 0);
 
 	} else if (!strcmp(entity_type, "part")) {
-		disk_partition_t partinfo;
+		struct disk_partition partinfo;
 		struct blk_desc *blk_dev = mmc_get_blk_desc(mmc);
 		int mmcdev = second_arg;
 		int mmcpart = third_arg;
diff --git a/drivers/dfu/dfu_nand.c b/drivers/dfu/dfu_nand.c
index 58b9434..b8d24d2 100644
--- a/drivers/dfu/dfu_nand.c
+++ b/drivers/dfu/dfu_nand.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <errno.h>
 #include <div64.h>
diff --git a/drivers/dfu/dfu_sf.c b/drivers/dfu/dfu_sf.c
index 0fdbfae..318e43c 100644
--- a/drivers/dfu/dfu_sf.c
+++ b/drivers/dfu/dfu_sf.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <malloc.h>
 #include <errno.h>
 #include <div64.h>
diff --git a/drivers/dfu/dfu_tftp.c b/drivers/dfu/dfu_tftp.c
index e5b35bf..ffae4bb 100644
--- a/drivers/dfu/dfu_tftp.c
+++ b/drivers/dfu/dfu_tftp.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <errno.h>
 #include <dfu.h>
diff --git a/drivers/dfu/dfu_virt.c b/drivers/dfu/dfu_virt.c
index ea8c71f..62605bc 100644
--- a/drivers/dfu/dfu_virt.c
+++ b/drivers/dfu/dfu_virt.c
@@ -5,6 +5,7 @@
 #include <common.h>
 #include <dfu.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 
 int __weak dfu_write_medium_virt(struct dfu_entity *dfu, u64 offset,
diff --git a/drivers/dma/apbh_dma.c b/drivers/dma/apbh_dma.c
index 69eb040..da988f6 100644
--- a/drivers/dma/apbh_dma.c
+++ b/drivers/dma/apbh_dma.c
@@ -12,6 +12,7 @@
  */
 
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <linux/list.h>
 
 #include <common.h>
diff --git a/drivers/dma/bcm6348-iudma.c b/drivers/dma/bcm6348-iudma.c
index d99460f..91172d4 100644
--- a/drivers/dma/bcm6348-iudma.c
+++ b/drivers/dma/bcm6348-iudma.c
@@ -20,10 +20,14 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <dma-uclass.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <net.h>
 #include <reset.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define DMA_RX_DESC	6
 #define DMA_TX_DESC	1
diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c
index 9d5a7fc..8cbb364 100644
--- a/drivers/dma/dma-uclass.c
+++ b/drivers/dma/dma-uclass.c
@@ -12,7 +12,9 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <dm/read.h>
 #include <dma-uclass.h>
 #include <dt-structs.h>
diff --git a/drivers/dma/keystone_nav.c b/drivers/dma/keystone_nav.c
index 3a15121..443e4b2 100644
--- a/drivers/dma/keystone_nav.c
+++ b/drivers/dma/keystone_nav.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/ti-common/keystone_nav.h>
+#include <linux/delay.h>
 
 struct qm_config qm_memmap = {
 	.stat_cfg	= CONFIG_KSNAV_QM_QUEUE_STATUS_BASE,
diff --git a/drivers/dma/lpc32xx_dma.c b/drivers/dma/lpc32xx_dma.c
index d3ce141..ab58e97 100644
--- a/drivers/dma/lpc32xx_dma.c
+++ b/drivers/dma/lpc32xx_dma.c
@@ -9,11 +9,14 @@
 
 #include <common.h>
 #include <errno.h>
+#include <init.h>
 #include <asm/arch/dma.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* DMA controller channel register structure */
 struct dmac_chan_reg {
diff --git a/drivers/dma/sandbox-dma-test.c b/drivers/dma/sandbox-dma-test.c
index 234a7d2..838596b 100644
--- a/drivers/dma/sandbox-dma-test.c
+++ b/drivers/dma/sandbox-dma-test.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/read.h>
 #include <dma-uclass.h>
diff --git a/drivers/dma/ti-edma3.c b/drivers/dma/ti-edma3.c
index 7e11b13..77c4ba9 100644
--- a/drivers/dma/ti-edma3.c
+++ b/drivers/dma/ti-edma3.c
@@ -8,6 +8,7 @@
  * Author: Ivan Khoronzhuk <ivan.khoronzhuk@ti.com>
  */
 
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
diff --git a/drivers/dma/ti/k3-udma-hwdef.h b/drivers/dma/ti/k3-udma-hwdef.h
index c88399a..5d50bbc 100644
--- a/drivers/dma/ti/k3-udma-hwdef.h
+++ b/drivers/dma/ti/k3-udma-hwdef.h
@@ -12,6 +12,7 @@
 #ifndef K3_NAVSS_UDMA_HWDEF_H_
 #define K3_NAVSS_UDMA_HWDEF_H_
 
+#include <linux/bitops.h>
 #define UDMA_PSIL_DST_THREAD_ID_OFFSET 0x8000
 
 /* Global registers */
diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c
index a0e536a..2ce16c8 100644
--- a/drivers/dma/ti/k3-udma.c
+++ b/drivers/dma/ti/k3-udma.c
@@ -7,9 +7,12 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/bitops.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 #include <linux/dma-mapping.h>
 #include <dm.h>
 #include <dm/device_compat.h>
diff --git a/drivers/fastboot/fb_command.c b/drivers/fastboot/fb_command.c
index 3c4acfe..49f6a61 100644
--- a/drivers/fastboot/fb_command.c
+++ b/drivers/fastboot/fb_command.c
@@ -10,6 +10,7 @@
 #include <fastboot-internal.h>
 #include <fb_mmc.h>
 #include <fb_nand.h>
+#include <flash.h>
 #include <part.h>
 #include <stdlib.h>
 
diff --git a/drivers/fastboot/fb_getvar.c b/drivers/fastboot/fb_getvar.c
index 95cb434..52da34b 100644
--- a/drivers/fastboot/fb_getvar.c
+++ b/drivers/fastboot/fb_getvar.c
@@ -10,6 +10,7 @@
 #include <fb_mmc.h>
 #include <fb_nand.h>
 #include <fs.h>
+#include <part.h>
 #include <version.h>
 
 static void getvar_version(char *var_parameter, char *response);
@@ -103,7 +104,7 @@
 	int r;
 # if CONFIG_IS_ENABLED(FASTBOOT_FLASH_MMC)
 	struct blk_desc *dev_desc;
-	disk_partition_t part_info;
+	struct disk_partition part_info;
 
 	r = fastboot_mmc_get_part_info(part_name, &dev_desc, &part_info,
 				       response);
@@ -219,7 +220,7 @@
 {
 	int r;
 	struct blk_desc *dev_desc;
-	disk_partition_t part_info;
+	struct disk_partition part_info;
 
 	r = fastboot_mmc_get_part_info(part_name, &dev_desc, &part_info,
 				       response);
diff --git a/drivers/fastboot/fb_mmc.c b/drivers/fastboot/fb_mmc.c
index d7cf9f4..b2f8932 100644
--- a/drivers/fastboot/fb_mmc.c
+++ b/drivers/fastboot/fb_mmc.c
@@ -10,7 +10,10 @@
 #include <fastboot.h>
 #include <fastboot-internal.h>
 #include <fb_mmc.h>
+#include <flash.h>
 #include <image-sparse.h>
+#include <image.h>
+#include <log.h>
 #include <part.h>
 #include <mmc.h>
 #include <div64.h>
@@ -26,7 +29,7 @@
 };
 
 static int part_get_info_by_name_or_alias(struct blk_desc *dev_desc,
-		const char *name, disk_partition_t *info)
+		const char *name, struct disk_partition *info)
 {
 	int ret;
 
@@ -97,9 +100,9 @@
 	return blkcnt;
 }
 
-static void write_raw_image(struct blk_desc *dev_desc, disk_partition_t *info,
-		const char *part_name, void *buffer,
-		u32 download_bytes, char *response)
+static void write_raw_image(struct blk_desc *dev_desc,
+			    struct disk_partition *info, const char *part_name,
+			    void *buffer, u32 download_bytes, char *response)
 {
 	lbaint_t blkcnt;
 	lbaint_t blks;
@@ -210,7 +213,7 @@
  * @return Boot image header sectors count or 0 on error
  */
 static lbaint_t fb_mmc_get_boot_header(struct blk_desc *dev_desc,
-				       disk_partition_t *info,
+				       struct disk_partition *info,
 				       struct andr_img_hdr *hdr,
 				       char *response)
 {
@@ -270,7 +273,7 @@
 	u32 kernel_sector_start;
 	u32 kernel_sectors;
 	u32 sectors_per_page;
-	disk_partition_t info;
+	struct disk_partition info;
 	int res;
 
 	puts("Flashing zImage\n");
@@ -366,12 +369,12 @@
  *
  * @part_name: Named partition to lookup
  * @dev_desc: Pointer to returned blk_desc pointer
- * @part_info: Pointer to returned disk_partition_t
+ * @part_info: Pointer to returned struct disk_partition
  * @response: Pointer to fastboot response buffer
  */
 int fastboot_mmc_get_part_info(const char *part_name,
 			       struct blk_desc **dev_desc,
-			       disk_partition_t *part_info, char *response)
+			       struct disk_partition *part_info, char *response)
 {
 	int r;
 
@@ -406,7 +409,7 @@
 			      u32 download_bytes, char *response)
 {
 	struct blk_desc *dev_desc;
-	disk_partition_t info;
+	struct disk_partition info;
 
 	dev_desc = blk_get_dev("mmc", CONFIG_FASTBOOT_FLASH_MMC_DEV);
 	if (!dev_desc || dev_desc->type == DEV_TYPE_UNKNOWN) {
@@ -523,7 +526,7 @@
 {
 	int ret;
 	struct blk_desc *dev_desc;
-	disk_partition_t info;
+	struct disk_partition info;
 	lbaint_t blks, blks_start, blks_size, grp_size;
 	struct mmc *mmc = find_mmc_device(CONFIG_FASTBOOT_FLASH_MMC_DEV);
 
diff --git a/drivers/fastboot/fb_nand.c b/drivers/fastboot/fb_nand.c
index 6756ea7..eb8a36f 100644
--- a/drivers/fastboot/fb_nand.c
+++ b/drivers/fastboot/fb_nand.c
@@ -6,6 +6,8 @@
 
 #include <config.h>
 #include <common.h>
+#include <blk.h>
+#include <flash.h>
 
 #include <fastboot.h>
 #include <image-sparse.h>
diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index c376425..2bdf777 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -7,7 +7,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <zynqmp_firmware.h>
+#include <asm/cache.h>
+#include <asm/ptrace.h>
 
 #if defined(CONFIG_ZYNQMP_IPI)
 #include <mailbox.h>
diff --git a/drivers/firmware/psci.c b/drivers/firmware/psci.c
index 394f30f..e0d66d7 100644
--- a/drivers/firmware/psci.c
+++ b/drivers/firmware/psci.c
@@ -7,10 +7,13 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
 #include <irq_func.h>
+#include <log.h>
 #include <dm/lists.h>
 #include <efi_loader.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <linux/arm-smccc.h>
 #include <linux/errno.h>
@@ -131,7 +134,7 @@
 #endif /* CONFIG_PSCI_RESET */
 
 #ifdef CONFIG_CMD_POWEROFF
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	do_psci_probe();
 
diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index c3f95b2..15f5b0b 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -10,11 +10,13 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <mailbox.h>
 #include <malloc.h>
 #include <dm/device.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/err.h>
 #include <linux/soc/ti/k3-sec-proxy.h>
diff --git a/drivers/firmware/ti_sci.h b/drivers/firmware/ti_sci.h
index 24b4d1c..327bb82 100644
--- a/drivers/firmware/ti_sci.h
+++ b/drivers/firmware/ti_sci.h
@@ -15,6 +15,7 @@
 #define __TI_SCI_H
 
 /* Generic Messages */
+#include <linux/bitops.h>
 #define TI_SCI_MSG_ENABLE_WDT		0x0000
 #define TI_SCI_MSG_WAKE_RESET		0x0001
 #define TI_SCI_MSG_VERSION		0x0002
diff --git a/drivers/fpga/ACEX1K.c b/drivers/fpga/ACEX1K.c
index 5afd42a..aca8049 100644
--- a/drivers/fpga/ACEX1K.c
+++ b/drivers/fpga/ACEX1K.c
@@ -10,6 +10,7 @@
 #include <common.h>		/* core U-Boot definitions */
 #include <console.h>
 #include <ACEX1K.h>		/* ACEX device family */
+#include <linux/delay.h>
 
 /* Define FPGA_DEBUG to get debug printf's */
 #ifdef	FPGA_DEBUG
diff --git a/drivers/fpga/altera.c b/drivers/fpga/altera.c
index 7c8f518..bb27b37 100644
--- a/drivers/fpga/altera.c
+++ b/drivers/fpga/altera.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <errno.h>
 #include <ACEX1K.h>
+#include <log.h>
 #include <stratixII.h>
 
 /* Define FPGA_DEBUG to 1 to get debug printf's */
diff --git a/drivers/fpga/cyclon2.c b/drivers/fpga/cyclon2.c
index c929cd2..3b008fa 100644
--- a/drivers/fpga/cyclon2.c
+++ b/drivers/fpga/cyclon2.c
@@ -8,6 +8,7 @@
 #include <common.h>		/* core U-Boot definitions */
 #include <altera.h>
 #include <ACEX1K.h>		/* ACEX device family */
+#include <linux/delay.h>
 
 /* Define FPGA_DEBUG to get debug printf's */
 #ifdef	FPGA_DEBUG
diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c
index 0917871..fe3dfa1 100644
--- a/drivers/fpga/fpga.c
+++ b/drivers/fpga/fpga.c
@@ -6,6 +6,8 @@
 
 /* Generic FPGA support */
 #include <common.h>             /* core U-Boot definitions */
+#include <init.h>
+#include <log.h>
 #include <xilinx.h>             /* xilinx specific definitions */
 #include <altera.h>             /* altera specific definitions */
 #include <lattice.h>
diff --git a/drivers/fpga/ivm_core.c b/drivers/fpga/ivm_core.c
index 6c6e5c3..adc6091 100644
--- a/drivers/fpga/ivm_core.c
+++ b/drivers/fpga/ivm_core.c
@@ -30,6 +30,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/string.h>
 #include <malloc.h>
 #include <lattice.h>
diff --git a/drivers/fpga/lattice.c b/drivers/fpga/lattice.c
index 30bec7f..e292d99 100644
--- a/drivers/fpga/lattice.c
+++ b/drivers/fpga/lattice.c
@@ -11,9 +11,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <fpga.h>
 #include <lattice.h>
+#include <linux/delay.h>
 
 static lattice_board_specific_func *pfns;
 static const char *fpga_image;
diff --git a/drivers/fpga/socfpga_arria10.c b/drivers/fpga/socfpga_arria10.c
index 2853581..dfd3cbb 100644
--- a/drivers/fpga/socfpga_arria10.c
+++ b/drivers/fpga/socfpga_arria10.c
@@ -2,6 +2,8 @@
 /*
  * Copyright (C) 2017-2019 Intel Corporation <www.intel.com>
  */
+#include <image.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/fpga_manager.h>
 #include <asm/arch/reset_manager.h>
@@ -16,6 +18,8 @@
 #include <fs_loader.h>
 #include <wait_bit.h>
 #include <watchdog.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define CFGWDTH_32	1
 #define MIN_BITSTREAM_SIZECHECK	230
diff --git a/drivers/fpga/stratix10.c b/drivers/fpga/stratix10.c
index d8e3250..da8fa31 100644
--- a/drivers/fpga/stratix10.c
+++ b/drivers/fpga/stratix10.c
@@ -5,7 +5,9 @@
 
 #include <common.h>
 #include <altera.h>
+#include <log.h>
 #include <asm/arch/mailbox_s10.h>
+#include <linux/delay.h>
 
 #define RECONFIG_STATUS_POLL_RESP_TIMEOUT_MS		60000
 #define RECONFIG_STATUS_INTERVAL_DELAY_US		1000000
diff --git a/drivers/fpga/stratixII.c b/drivers/fpga/stratixII.c
index 12d8dd1..b450a81 100644
--- a/drivers/fpga/stratixII.c
+++ b/drivers/fpga/stratixII.c
@@ -6,6 +6,7 @@
 
 #include <common.h>		/* core U-Boot definitions */
 #include <altera.h>
+#include <linux/delay.h>
 
 int StratixII_ps_fpp_load (Altera_desc * desc, void *buf, size_t bsize,
 			   int isSerial, int isSecure);
@@ -116,9 +117,9 @@
 
 	/* 2. Strat burn cycle by deasserting config for t_CFG and waiting t_CF2CK after reaserted */
 	fns->config (0, 1, cookie);
-	udelay (5);		/* nCONFIG low pulse width 2usec */
+	udelay(5);		/* nCONFIG low pulse width 2usec */
 	fns->config (1, 1, cookie);
-	udelay (100);		/* nCONFIG high to first rising edge on DCLK */
+	udelay(100);		/* nCONFIG high to first rising edge on DCLK */
 
 	/* 3. Start the Data cycle with clk deasserted */
 	bytecount = 0;
@@ -168,7 +169,7 @@
 
 	/* 4. Set one last clock and check conf done signal */
 	fns->clk (1, 1, cookie);
-	udelay (100);
+	udelay(100);
 	if (!fns->done (cookie)) {
 		printf (" error!.\n");
 		fns->abort (cookie);
diff --git a/drivers/fpga/stratixv.c b/drivers/fpga/stratixv.c
index 236a730..abae3b5 100644
--- a/drivers/fpga/stratixv.c
+++ b/drivers/fpga/stratixv.c
@@ -5,8 +5,10 @@
 
 #include <common.h>
 #include <altera.h>
+#include <log.h>
 #include <spi.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 
 /* Write the RBF data to FPGA via SPI */
diff --git a/drivers/fpga/versalpl.c b/drivers/fpga/versalpl.c
index 6c69ab7..b96519e 100644
--- a/drivers/fpga/versalpl.c
+++ b/drivers/fpga/versalpl.c
@@ -6,10 +6,12 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/arch/sys_proto.h>
 #include <memalign.h>
 #include <versalpl.h>
 #include <zynqmp_firmware.h>
+#include <asm/cache.h>
 
 static ulong versal_align_dma_buffer(ulong *buf, u32 len)
 {
diff --git a/drivers/fpga/virtex2.c b/drivers/fpga/virtex2.c
index 3957368..b3e0537 100644
--- a/drivers/fpga/virtex2.c
+++ b/drivers/fpga/virtex2.c
@@ -15,6 +15,7 @@
 #include <common.h>
 #include <console.h>
 #include <virtex2.h>
+#include <linux/delay.h>
 
 #if 0
 #define FPGA_DEBUG
diff --git a/drivers/fpga/xilinx.c b/drivers/fpga/xilinx.c
index 4b0334b..cbebefb 100644
--- a/drivers/fpga/xilinx.c
+++ b/drivers/fpga/xilinx.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <fpga.h>
+#include <log.h>
 #include <virtex2.h>
 #include <spartan2.h>
 #include <spartan3.h>
diff --git a/drivers/fpga/zynqmppl.c b/drivers/fpga/zynqmppl.c
index 4a826e4..2ac4e38 100644
--- a/drivers/fpga/zynqmppl.c
+++ b/drivers/fpga/zynqmppl.c
@@ -8,8 +8,11 @@
 #include <console.h>
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <zynqmppl.h>
 #include <zynqmp_firmware.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
 #include <linux/sizes.h>
 #include <asm/arch/sys_proto.h>
 #include <memalign.h>
diff --git a/drivers/fpga/zynqpl.c b/drivers/fpga/zynqpl.c
index 21624f7..dcfe513 100644
--- a/drivers/fpga/zynqpl.c
+++ b/drivers/fpga/zynqpl.c
@@ -9,9 +9,12 @@
 #include <common.h>
 #include <console.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <fs.h>
 #include <zynqpl.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
diff --git a/drivers/gpio/adi_gpio2.c b/drivers/gpio/adi_gpio2.c
index 9d293b6..d0849c8 100644
--- a/drivers/gpio/adi_gpio2.c
+++ b/drivers/gpio/adi_gpio2.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 
diff --git a/drivers/gpio/atmel_pio4.c b/drivers/gpio/atmel_pio4.c
index a3f5e7a..455944d 100644
--- a/drivers/gpio/atmel_pio4.c
+++ b/drivers/gpio/atmel_pio4.c
@@ -12,6 +12,7 @@
 #include <malloc.h>
 #include <asm/arch/hardware.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <mach/gpio.h>
 #include <mach/atmel_pio4.h>
 
diff --git a/drivers/gpio/bcm6345_gpio.c b/drivers/gpio/bcm6345_gpio.c
index 71a978c..5da11d9 100644
--- a/drivers/gpio/bcm6345_gpio.c
+++ b/drivers/gpio/bcm6345_gpio.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 struct bcm6345_gpio_priv {
 	void __iomem *reg_dirout;
diff --git a/drivers/gpio/cortina_gpio.c b/drivers/gpio/cortina_gpio.c
index e2374ce..055907c 100644
--- a/drivers/gpio/cortina_gpio.c
+++ b/drivers/gpio/cortina_gpio.c
@@ -7,8 +7,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/compiler.h>
 
diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c
index e3439ee..e5e3518 100644
--- a/drivers/gpio/dwapb_gpio.c
+++ b/drivers/gpio/dwapb_gpio.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
@@ -18,6 +19,7 @@
 #include <dm/root.h>
 #include <errno.h>
 #include <reset.h>
+#include <linux/bitops.h>
 
 #define GPIO_SWPORT_DR(p)	(0x00 + (p) * 0xc)
 #define GPIO_SWPORT_DDR(p)	(0x04 + (p) * 0xc)
diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c
index 9dc4cd6..c49a041 100644
--- a/drivers/gpio/gpio-rcar.c
+++ b/drivers/gpio/gpio-rcar.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include "../pinctrl/renesas/sh_pfc.h"
 
 #define GPIO_IOINTSEL	0x00	/* General IO/Interrupt Switching Register */
diff --git a/drivers/gpio/gpio-rza1.c b/drivers/gpio/gpio-rza1.c
index ce2453e..21a87d6 100644
--- a/drivers/gpio/gpio-rza1.c
+++ b/drivers/gpio/gpio-rza1.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define P(bank)			(0x0000 + (bank) * 4)
 #define PSR(bank)		(0x0100 + (bank) * 4)
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c
index d3cea11..9eeab22 100644
--- a/drivers/gpio/gpio-uclass.c
+++ b/drivers/gpio/gpio-uclass.c
@@ -5,7 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
-#include <dm/device_compat.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/uclass-internal.h>
@@ -14,6 +14,7 @@
 #include <fdtdec.h>
 #include <malloc.h>
 #include <asm/gpio.h>
+#include <dm/device_compat.h>
 #include <linux/bug.h>
 #include <linux/ctype.h>
 
diff --git a/drivers/gpio/hi6220_gpio.c b/drivers/gpio/hi6220_gpio.c
index 97a0417..95de2ae 100644
--- a/drivers/gpio/hi6220_gpio.c
+++ b/drivers/gpio/hi6220_gpio.c
@@ -9,6 +9,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <errno.h>
+#include <linux/bitops.h>
 
 static int hi6220_gpio_direction_input(struct udevice *dev, unsigned int gpio)
 {
diff --git a/drivers/gpio/hsdk-creg-gpio.c b/drivers/gpio/hsdk-creg-gpio.c
index 800027f..d9df804 100644
--- a/drivers/gpio/hsdk-creg-gpio.c
+++ b/drivers/gpio/hsdk-creg-gpio.c
@@ -9,11 +9,13 @@
  * warranty of any kind, whether express or implied.
  */
 
+#include <log.h>
 #include <asm-generic/gpio.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <linux/bitops.h>
 #include <linux/printk.h>
 
 #define DRV_NAME	"gpio_creg"
diff --git a/drivers/gpio/intel_broadwell_gpio.c b/drivers/gpio/intel_broadwell_gpio.c
index 37299ec..95f8b2b 100644
--- a/drivers/gpio/intel_broadwell_gpio.c
+++ b/drivers/gpio/intel_broadwell_gpio.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <pch.h>
 #include <pci.h>
 #include <syscon.h>
diff --git a/drivers/gpio/intel_gpio.c b/drivers/gpio/intel_gpio.c
index 67b8b80..711fea1 100644
--- a/drivers/gpio/intel_gpio.c
+++ b/drivers/gpio/intel_gpio.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <p2sb.h>
 #include <pch.h>
 #include <pci.h>
diff --git a/drivers/gpio/intel_ich6_gpio.c b/drivers/gpio/intel_ich6_gpio.c
index ad08b3a..73d98fd 100644
--- a/drivers/gpio/intel_ich6_gpio.c
+++ b/drivers/gpio/intel_ich6_gpio.c
@@ -30,6 +30,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <pch.h>
 #include <pci.h>
 #include <asm/cpu.h>
diff --git a/drivers/gpio/mscc_sgpio.c b/drivers/gpio/mscc_sgpio.c
index c65ca81..780d77b 100644
--- a/drivers/gpio/mscc_sgpio.c
+++ b/drivers/gpio/mscc_sgpio.c
@@ -9,11 +9,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <errno.h>
 #include <clk.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define MSCC_SGPIOS_PER_BANK	32
diff --git a/drivers/gpio/mt7621_gpio.c b/drivers/gpio/mt7621_gpio.c
index 54d313d..612413e 100644
--- a/drivers/gpio/mt7621_gpio.c
+++ b/drivers/gpio/mt7621_gpio.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/drivers/gpio/mvebu_gpio.c b/drivers/gpio/mvebu_gpio.c
index e8b1c59..770cbf6 100644
--- a/drivers/gpio/mvebu_gpio.c
+++ b/drivers/gpio/mvebu_gpio.c
@@ -8,6 +8,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <errno.h>
+#include <linux/bitops.h>
 
 #define MVEBU_GPIOS_PER_BANK	32
 
diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c
index 405e9ac..815339a 100644
--- a/drivers/gpio/mxs_gpio.c
+++ b/drivers/gpio/mxs_gpio.c
@@ -7,7 +7,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/iomux.h>
diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index fda8054..4ab8cee 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <i2c.h>
 #include <pca953x.h>
 
@@ -192,7 +193,7 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_pca953x[] = {
+static struct cmd_tbl cmd_pca953x[] = {
 	U_BOOT_CMD_MKENT(device, 3, 0, (void *)PCA953X_CMD_DEVICE, "", ""),
 	U_BOOT_CMD_MKENT(output, 4, 0, (void *)PCA953X_CMD_OUTPUT, "", ""),
 	U_BOOT_CMD_MKENT(input, 3, 0, (void *)PCA953X_CMD_INPUT, "", ""),
@@ -200,13 +201,14 @@
 	U_BOOT_CMD_MKENT(info, 2, 0, (void *)PCA953X_CMD_INFO, "", ""),
 };
 
-static int do_pca953x(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_pca953x(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	static uint8_t chip = CONFIG_SYS_I2C_PCA953X_ADDR;
 	int ret = CMD_RET_USAGE, val;
 	ulong ul_arg2 = 0;
 	ulong ul_arg3 = 0;
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	c = find_cmd_tbl(argv[1], cmd_pca953x, ARRAY_SIZE(cmd_pca953x));
 
diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c
index d06b834..fd17d1a 100644
--- a/drivers/gpio/pca953x_gpio.c
+++ b/drivers/gpio/pca953x_gpio.c
@@ -28,6 +28,7 @@
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <dt-bindings/gpio/gpio.h>
+#include <linux/bitops.h>
 
 #define PCA953X_INPUT           0
 #define PCA953X_OUTPUT          1
diff --git a/drivers/gpio/pcf8575_gpio.c b/drivers/gpio/pcf8575_gpio.c
index e93f640..1b9a18f 100644
--- a/drivers/gpio/pcf8575_gpio.c
+++ b/drivers/gpio/pcf8575_gpio.c
@@ -26,7 +26,9 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm-generic/gpio.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/gpio/pic32_gpio.c b/drivers/gpio/pic32_gpio.c
index d8789e7..bb1ad25 100644
--- a/drivers/gpio/pic32_gpio.c
+++ b/drivers/gpio/pic32_gpio.c
@@ -10,6 +10,7 @@
 #include <malloc.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <mach/pic32.h>
 
diff --git a/drivers/gpio/pm8916_gpio.c b/drivers/gpio/pm8916_gpio.c
index 74a773c..51df536 100644
--- a/drivers/gpio/pm8916_gpio.c
+++ b/drivers/gpio/pm8916_gpio.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <spmi/spmi.h>
 #include <asm/io.h>
diff --git a/drivers/gpio/s5p_gpio.c b/drivers/gpio/s5p_gpio.c
index e4b5383..258f133 100644
--- a/drivers/gpio/s5p_gpio.c
+++ b/drivers/gpio/s5p_gpio.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index 9549c74..98b7fa4 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/gpio.h>
 #include <dm/device_compat.h>
diff --git a/drivers/gpio/sh_pfc.c b/drivers/gpio/sh_pfc.c
index 6320a62..0653171 100644
--- a/drivers/gpio/sh_pfc.c
+++ b/drivers/gpio/sh_pfc.c
@@ -10,10 +10,13 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/bitops.h>
 #include <asm/io.h>
 #include <sh_pfc.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 
 static struct pinmux_info *gpioc;
 
diff --git a/drivers/gpio/sifive-gpio.c b/drivers/gpio/sifive-gpio.c
index 76d5a1d3..24da3b3 100644
--- a/drivers/gpio/sifive-gpio.c
+++ b/drivers/gpio/sifive-gpio.c
@@ -11,6 +11,7 @@
 #include <asm/io.h>
 #include <errno.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 
 static int sifive_gpio_probe(struct udevice *dev)
 {
diff --git a/drivers/gpio/stm32_gpio.c b/drivers/gpio/stm32_gpio.c
index 37a8cfa..4f710b6 100644
--- a/drivers/gpio/stm32_gpio.c
+++ b/drivers/gpio/stm32_gpio.c
@@ -8,11 +8,13 @@
 #include <clk.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/stm32.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 
diff --git a/drivers/gpio/tca642x.c b/drivers/gpio/tca642x.c
index 730460a..463cfe8 100644
--- a/drivers/gpio/tca642x.c
+++ b/drivers/gpio/tca642x.c
@@ -21,6 +21,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <i2c.h>
 #include <tca642x.h>
 
@@ -212,7 +213,7 @@
 	return 0;
 }
 
-static cmd_tbl_t cmd_tca642x[] = {
+static struct cmd_tbl cmd_tca642x[] = {
 	U_BOOT_CMD_MKENT(device, 3, 0, (void *)TCA642X_CMD_DEVICE, "", ""),
 	U_BOOT_CMD_MKENT(output, 4, 0, (void *)TCA642X_CMD_OUTPUT, "", ""),
 	U_BOOT_CMD_MKENT(input, 3, 0, (void *)TCA642X_CMD_INPUT, "", ""),
@@ -220,7 +221,8 @@
 	U_BOOT_CMD_MKENT(info, 2, 0, (void *)TCA642X_CMD_INFO, "", ""),
 };
 
-static int do_tca642x(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_tca642x(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	static uchar chip = CONFIG_SYS_I2C_TCA642X_ADDR;
 	int ret = CMD_RET_USAGE, val;
@@ -228,7 +230,7 @@
 	uint8_t bank_shift;
 	ulong ul_arg2 = 0;
 	ulong ul_arg3 = 0;
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 
 	c = find_cmd_tbl(argv[1], cmd_tca642x, ARRAY_SIZE(cmd_tca642x));
 
diff --git a/drivers/gpio/tegra186_gpio_priv.h b/drivers/gpio/tegra186_gpio_priv.h
index ac8df27..3e686be 100644
--- a/drivers/gpio/tegra186_gpio_priv.h
+++ b/drivers/gpio/tegra186_gpio_priv.h
@@ -10,6 +10,7 @@
  * For each GPIO, there are a set of registers than affect it, all packed
  * back-to-back.
  */
+#include <linux/bitops.h>
 #define TEGRA186_GPIO_ENABLE_CONFIG				0x00
 #define TEGRA186_GPIO_ENABLE_CONFIG_ENABLE			BIT(0)
 #define TEGRA186_GPIO_ENABLE_CONFIG_OUT				BIT(1)
diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c
index a730f5c..912577a 100644
--- a/drivers/gpio/tegra_gpio.c
+++ b/drivers/gpio/tegra_gpio.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <errno.h>
 #include <fdtdec.h>
diff --git a/drivers/gpio/xilinx_gpio.c b/drivers/gpio/xilinx_gpio.c
index 2389abe..014f120 100644
--- a/drivers/gpio/xilinx_gpio.c
+++ b/drivers/gpio/xilinx_gpio.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/list.h>
 #include <asm/io.h>
diff --git a/drivers/gpio/zynq_gpio.c b/drivers/gpio/zynq_gpio.c
index fe3b2c3..d0e90b8 100644
--- a/drivers/gpio/zynq_gpio.c
+++ b/drivers/gpio/zynq_gpio.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <dm.h>
 #include <fdtdec.h>
diff --git a/drivers/hwspinlock/hwspinlock-uclass.c b/drivers/hwspinlock/hwspinlock-uclass.c
index 61d226b..9da7945 100644
--- a/drivers/hwspinlock/hwspinlock-uclass.c
+++ b/drivers/hwspinlock/hwspinlock-uclass.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <hwspinlock.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <linux/compat.h>
diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c
index 74afb4a..8be585a 100644
--- a/drivers/hwspinlock/stm32_hwspinlock.c
+++ b/drivers/hwspinlock/stm32_hwspinlock.c
@@ -9,6 +9,7 @@
 #include <hwspinlock.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define STM32_MUTEX_COREID	BIT(8)
 #define STM32_MUTEX_LOCK_BIT	BIT(31)
diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c
index c84d75a..214362d 100644
--- a/drivers/i2c/ast_i2c.c
+++ b/drivers/i2c/ast_i2c.c
@@ -11,8 +11,10 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/scu_ast2500.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 #include "ast_i2c.h"
diff --git a/drivers/i2c/at91_i2c.h b/drivers/i2c/at91_i2c.h
index 87f02bf..3915af8 100644
--- a/drivers/i2c/at91_i2c.h
+++ b/drivers/i2c/at91_i2c.h
@@ -1,6 +1,7 @@
 #ifndef _AT91_I2C_H
 #define _AT91_I2C_H
 
+#include <linux/bitops.h>
 #define	TWI_CR_START		BIT(0)	/* Send a Start Condition */
 #define	TWI_CR_MSEN		BIT(2)	/* Master Transfer Enable */
 #define	TWI_CR_STOP		BIT(1)	/* Send a Stop Condition */
diff --git a/drivers/i2c/cros_ec_ldo.c b/drivers/i2c/cros_ec_ldo.c
index 501e602..c593540 100644
--- a/drivers/i2c/cros_ec_ldo.c
+++ b/drivers/i2c/cros_ec_ldo.c
@@ -9,6 +9,7 @@
 #include <cros_ec.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/tps65090.h>
 
 static int cros_ec_ldo_set_bus_speed(struct udevice *dev, unsigned int speed)
diff --git a/drivers/i2c/davinci_i2c.c b/drivers/i2c/davinci_i2c.c
index edc40f7..f8e9d00 100644
--- a/drivers/i2c/davinci_i2c.c
+++ b/drivers/i2c/davinci_i2c.c
@@ -14,9 +14,11 @@
 #include <common.h>
 #include <i2c.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/i2c_defs.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "davinci_i2c.h"
 
 #ifdef CONFIG_DM_I2C
diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c
index 088a6f3..42ee7d5 100644
--- a/drivers/i2c/designware_i2c.c
+++ b/drivers/i2c/designware_i2c.c
@@ -8,10 +8,12 @@
 #include <clk.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <reset.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "designware_i2c.h"
 #include <dm/device_compat.h>
 #include <linux/err.h>
diff --git a/drivers/i2c/designware_i2c.h b/drivers/i2c/designware_i2c.h
index 7ee2361..dc9a6cc 100644
--- a/drivers/i2c/designware_i2c.h
+++ b/drivers/i2c/designware_i2c.h
@@ -10,6 +10,7 @@
 #include <clk.h>
 #include <i2c.h>
 #include <reset.h>
+#include <linux/bitops.h>
 
 struct i2c_regs {
 	u32 ic_con;		/* 0x00 */
diff --git a/drivers/i2c/designware_i2c_pci.c b/drivers/i2c/designware_i2c_pci.c
index 50f03e3..bd34ec0 100644
--- a/drivers/i2c/designware_i2c_pci.c
+++ b/drivers/i2c/designware_i2c_pci.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <spl.h>
 #include <asm/lpss.h>
 #include "designware_i2c.h"
diff --git a/drivers/i2c/exynos_hs_i2c.c b/drivers/i2c/exynos_hs_i2c.c
index 9f201c6..4fc9d90 100644
--- a/drivers/i2c/exynos_hs_i2c.c
+++ b/drivers/i2c/exynos_hs_i2c.c
@@ -9,9 +9,11 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/pinmux.h>
+#include <linux/delay.h>
 #include "s3c24x0_i2c.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/i2c/fsl_i2c.c b/drivers/i2c/fsl_i2c.c
index 097c543..da93345 100644
--- a/drivers/i2c/fsl_i2c.c
+++ b/drivers/i2c/fsl_i2c.c
@@ -9,12 +9,14 @@
 #include <common.h>
 #include <command.h>
 #include <i2c.h>		/* Functional interface */
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/fsl_i2c.h>	/* HW definitions */
 #include <clk.h>
 #include <dm.h>
 #include <mapmem.h>
+#include <linux/delay.h>
 
 /* The maximum number of microseconds we will wait until another master has
  * released the bus.  If not defined in the board header file, then use a
diff --git a/drivers/i2c/i2c-cdns.c b/drivers/i2c/i2c-cdns.c
index ac15da2..024c63c 100644
--- a/drivers/i2c/i2c-cdns.c
+++ b/drivers/i2c/i2c-cdns.c
@@ -9,6 +9,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/io.h>
 #include <linux/errno.h>
diff --git a/drivers/i2c/i2c-emul-uclass.c b/drivers/i2c/i2c-emul-uclass.c
index ae5aae0..1b70e14 100644
--- a/drivers/i2c/i2c-emul-uclass.c
+++ b/drivers/i2c/i2c-emul-uclass.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
 
diff --git a/drivers/i2c/i2c-gpio.c b/drivers/i2c/i2c-gpio.c
index 07fdd34..cfdeadc 100644
--- a/drivers/i2c/i2c-gpio.c
+++ b/drivers/i2c/i2c-gpio.c
@@ -9,7 +9,9 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 
 #define DEFAULT_UDELAY	5
 #define RETRIES		0
diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index e9ec388..8166df7 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
@@ -14,6 +15,7 @@
 #if CONFIG_IS_ENABLED(DM_GPIO)
 #include <asm/gpio.h>
 #endif
+#include <linux/delay.h>
 
 #define I2C_MAX_OFFSET_LEN	4
 
diff --git a/drivers/i2c/i2c-versatile.c b/drivers/i2c/i2c-versatile.c
index f523844..6283152 100644
--- a/drivers/i2c/i2c-versatile.c
+++ b/drivers/i2c/i2c-versatile.c
@@ -11,6 +11,8 @@
 #include <i2c.h>
 #include <asm/io.h>
 #include <clk.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 
 #define I2C_CONTROL_REG		0x00
diff --git a/drivers/i2c/i2c_core.c b/drivers/i2c/i2c_core.c
index 234277a..da50d86 100644
--- a/drivers/i2c/i2c_core.c
+++ b/drivers/i2c/i2c_core.c
@@ -9,6 +9,7 @@
  */
 #include <common.h>
 #include <i2c.h>
+#include <linker_lists.h>
 
 struct i2c_adapter *i2c_get_adapter(int index)
 {
diff --git a/drivers/i2c/ihs_i2c.c b/drivers/i2c/ihs_i2c.c
index f7b59d3..cec3853 100644
--- a/drivers/i2c/ihs_i2c.c
+++ b/drivers/i2c/ihs_i2c.c
@@ -12,7 +12,10 @@
 #else
 #include <gdsys_fpga.h>
 #endif
+#include <log.h>
 #include <asm/unaligned.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_DM_I2C
 struct ihs_i2c_priv {
diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c
index 62e6804..c8e42e0 100644
--- a/drivers/i2c/imx_lpi2c.c
+++ b/drivers/i2c/imx_lpi2c.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
diff --git a/drivers/i2c/intel_i2c.c b/drivers/i2c/intel_i2c.c
index f5509fe..3b79cb4 100644
--- a/drivers/i2c/intel_i2c.c
+++ b/drivers/i2c/intel_i2c.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/io.h>
 
diff --git a/drivers/i2c/kona_i2c.c b/drivers/i2c/kona_i2c.c
index 8e31481..4edcba2 100644
--- a/drivers/i2c/kona_i2c.c
+++ b/drivers/i2c/kona_i2c.c
@@ -7,7 +7,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/arch/sysmap.h>
 #include <asm/kona-common/clk.h>
diff --git a/drivers/i2c/lpc32xx_i2c.c b/drivers/i2c/lpc32xx_i2c.c
index a95b5cc..6af2e97 100644
--- a/drivers/i2c/lpc32xx_i2c.c
+++ b/drivers/i2c/lpc32xx_i2c.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <i2c.h>
 #include <linux/errno.h>
diff --git a/drivers/i2c/meson_i2c.c b/drivers/i2c/meson_i2c.c
index bcf4516..e070caf 100644
--- a/drivers/i2c/meson_i2c.c
+++ b/drivers/i2c/meson_i2c.c
@@ -3,10 +3,13 @@
  * (C) Copyright 2017 - Beniamino Galvani <b.galvani@gmail.com>
  */
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <clk.h>
 #include <dm.h>
 #include <i2c.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 #define I2C_TIMEOUT_MS		100
diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
index 5029c71..584d0a4 100644
--- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
+++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c
@@ -8,8 +8,10 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c
index 0575bd8..83dcb40 100644
--- a/drivers/i2c/muxes/i2c-mux-gpio.c
+++ b/drivers/i2c/muxes/i2c-mux-gpio.c
@@ -17,6 +17,7 @@
 #include <fdtdec.h>
 #include <i2c.h>
 #include <linux/errno.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/i2c/muxes/i2c-mux-uclass.c b/drivers/i2c/muxes/i2c-mux-uclass.c
index 9a3dd7e..2689755 100644
--- a/drivers/i2c/muxes/i2c-mux-uclass.c
+++ b/drivers/i2c/muxes/i2c-mux-uclass.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/lists.h>
 #include <dm/root.h>
diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c
index cc8afc9..7360e16 100644
--- a/drivers/i2c/muxes/pca954x.c
+++ b/drivers/i2c/muxes/pca954x.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 
 #include <asm-generic/gpio.h>
diff --git a/drivers/i2c/mv_i2c.c b/drivers/i2c/mv_i2c.c
index 63665f0..59675d8 100644
--- a/drivers/i2c/mv_i2c.c
+++ b/drivers/i2c/mv_i2c.c
@@ -19,7 +19,9 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "mv_i2c.h"
 
 /* All transfers are described by this data structure */
diff --git a/drivers/i2c/mvtwsi.c b/drivers/i2c/mvtwsi.c
index d4b2031..d3cc9b9 100644
--- a/drivers/i2c/mvtwsi.c
+++ b/drivers/i2c/mvtwsi.c
@@ -9,6 +9,8 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c
index 4d6e0e3..3b0d27e 100644
--- a/drivers/i2c/mxc_i2c.c
+++ b/drivers/i2c/mxc_i2c.c
@@ -14,9 +14,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/imx-regs.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/mach-imx/mxc_i2c.h>
 #include <asm/mach-imx/sys_proto.h>
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index 6e7d24d..8592a81 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -41,6 +41,8 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/omap_i2c.h>
diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c
index b877602..4267bbf 100644
--- a/drivers/i2c/rcar_i2c.c
+++ b/drivers/i2c/rcar_i2c.c
@@ -18,6 +18,8 @@
 #include <asm/io.h>
 #include <wait_bit.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define RCAR_I2C_ICSCR			0x00 /* slave ctrl */
 #define RCAR_I2C_ICMCR			0x04 /* master ctrl */
diff --git a/drivers/i2c/rcar_iic.c b/drivers/i2c/rcar_iic.c
index 2a82eb0..cad0a62 100644
--- a/drivers/i2c/rcar_iic.c
+++ b/drivers/i2c/rcar_iic.c
@@ -14,6 +14,8 @@
 #include <dm.h>
 #include <i2c.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 struct rcar_iic_priv {
 	void __iomem		*base;
diff --git a/drivers/i2c/rk_i2c.c b/drivers/i2c/rk_i2c.c
index 32b2ee8..fa6f69f 100644
--- a/drivers/i2c/rk_i2c.c
+++ b/drivers/i2c/rk_i2c.c
@@ -11,11 +11,13 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/clock.h>
 #include <asm/arch-rockchip/i2c.h>
 #include <asm/arch-rockchip/periph.h>
 #include <dm/pinctrl.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 
 /* i2c timerout */
diff --git a/drivers/i2c/s3c24x0_i2c.c b/drivers/i2c/s3c24x0_i2c.c
index 68bf93b..5907217 100644
--- a/drivers/i2c/s3c24x0_i2c.c
+++ b/drivers/i2c/s3c24x0_i2c.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #if (defined CONFIG_EXYNOS4 || defined CONFIG_EXYNOS5)
+#include <log.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/pinmux.h>
diff --git a/drivers/i2c/sandbox_i2c.c b/drivers/i2c/sandbox_i2c.c
index 1a4521d..f4ae239 100644
--- a/drivers/i2c/sandbox_i2c.c
+++ b/drivers/i2c/sandbox_i2c.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/test.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
diff --git a/drivers/i2c/sh_i2c.c b/drivers/i2c/sh_i2c.c
index 834f1f2..f857307 100644
--- a/drivers/i2c/sh_i2c.c
+++ b/drivers/i2c/sh_i2c.c
@@ -9,7 +9,9 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c
index 9ad1c28..1031066 100644
--- a/drivers/i2c/soft_i2c.c
+++ b/drivers/i2c/soft_i2c.c
@@ -25,6 +25,7 @@
 #endif
 #endif
 #include <i2c.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_SOFT_I2C_GPIO_SCL)
 # include <asm/gpio.h>
diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c
index fc5c122..ada8f40 100644
--- a/drivers/i2c/stm32f7_i2c.c
+++ b/drivers/i2c/stm32f7_i2c.c
@@ -7,7 +7,10 @@
 #include <clk.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <reset.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <dm/device.h>
 #include <linux/err.h>
diff --git a/drivers/i2c/tegra186_bpmp_i2c.c b/drivers/i2c/tegra186_bpmp_i2c.c
index 793f3f5..3720471 100644
--- a/drivers/i2c/tegra186_bpmp_i2c.c
+++ b/drivers/i2c/tegra186_bpmp_i2c.c
@@ -6,8 +6,10 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <misc.h>
 #include <asm/arch-tegra/bpmp_abi.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c
index 66a0148..65b3734 100644
--- a/drivers/i2c/tegra_i2c.c
+++ b/drivers/i2c/tegra_i2c.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/io.h>
 #include <clk.h>
 #include <reset.h>
@@ -18,6 +19,7 @@
 #endif
 #include <asm/arch/gpio.h>
 #include <asm/arch-tegra/tegra_i2c.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 enum i2c_type {
diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c
index 8c1a25c..6f12ec8 100644
--- a/drivers/input/cros_ec_keyb.c
+++ b/drivers/input/cros_ec_keyb.c
@@ -12,6 +12,7 @@
 #include <input.h>
 #include <keyboard.h>
 #include <key_matrix.h>
+#include <log.h>
 #include <stdio_dev.h>
 
 enum {
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 9801589..7beaccc 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -13,7 +13,9 @@
 #include <i8042.h>
 #include <input.h>
 #include <keyboard.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/input/input.c b/drivers/input/input.c
index 6ab378b..da264f4 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <env.h>
 #include <errno.h>
+#include <log.h>
 #include <stdio_dev.h>
 #include <input.h>
 #ifdef CONFIG_DM_KEYBOARD
diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c
index 8951e12..4631728 100644
--- a/drivers/input/key_matrix.c
+++ b/drivers/input/key_matrix.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <key_matrix.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/input.h>
 
diff --git a/drivers/input/keyboard-uclass.c b/drivers/input/keyboard-uclass.c
index db1a515..f19934e 100644
--- a/drivers/input/keyboard-uclass.c
+++ b/drivers/input/keyboard-uclass.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <keyboard.h>
+#include <log.h>
 
 static int keyboard_start(struct stdio_dev *sdev)
 {
diff --git a/drivers/input/tegra-kbc.c b/drivers/input/tegra-kbc.c
index 70429b9..3409bb6 100644
--- a/drivers/input/tegra-kbc.c
+++ b/drivers/input/tegra-kbc.c
@@ -10,12 +10,14 @@
 #include <input.h>
 #include <keyboard.h>
 #include <key_matrix.h>
+#include <log.h>
 #include <stdio_dev.h>
 #include <tegra-kbc.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/funcmux.h>
 #include <asm/arch-tegra/timer.h>
+#include <linux/delay.h>
 #include <linux/input.h>
 
 enum {
diff --git a/drivers/led/led_bcm6328.c b/drivers/led/led_bcm6328.c
index 7be4bad..5294683 100644
--- a/drivers/led/led_bcm6328.c
+++ b/drivers/led/led_bcm6328.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <led.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm/lists.h>
 
diff --git a/drivers/led/led_bcm6358.c b/drivers/led/led_bcm6358.c
index 01b86b7..307d418 100644
--- a/drivers/led/led_bcm6358.c
+++ b/drivers/led/led_bcm6358.c
@@ -7,8 +7,10 @@
 #include <dm.h>
 #include <errno.h>
 #include <led.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm/lists.h>
+#include <linux/delay.h>
 
 #define LEDS_MAX		32
 #define LEDS_WAIT		100
diff --git a/drivers/led/led_bcm6858.c b/drivers/led/led_bcm6858.c
index 27a76fc..b415d8b 100644
--- a/drivers/led/led_bcm6858.c
+++ b/drivers/led/led_bcm6858.c
@@ -11,8 +11,10 @@
 #include <dm.h>
 #include <errno.h>
 #include <led.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm/lists.h>
+#include <linux/bitops.h>
 
 #define LEDS_MAX		32
 #define LEDS_WAIT		100
diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c
index af6b824..ef9b61e 100644
--- a/drivers/led/led_gpio.c
+++ b/drivers/led/led_gpio.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <led.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/gpio.h>
 #include <dm/lists.h>
diff --git a/drivers/mailbox/k3-sec-proxy.c b/drivers/mailbox/k3-sec-proxy.c
index a560209..3f9afae 100644
--- a/drivers/mailbox/k3-sec-proxy.c
+++ b/drivers/mailbox/k3-sec-proxy.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c
index 291f5c2..c972d84 100644
--- a/drivers/mailbox/mailbox-uclass.c
+++ b/drivers/mailbox/mailbox-uclass.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <mailbox.h>
 #include <mailbox-uclass.h>
 #include <malloc.h>
diff --git a/drivers/mailbox/sandbox-mbox.c b/drivers/mailbox/sandbox-mbox.c
index 25e23eb..19704dd 100644
--- a/drivers/mailbox/sandbox-mbox.c
+++ b/drivers/mailbox/sandbox-mbox.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <mailbox-uclass.h>
 #include <malloc.h>
 #include <asm/io.h>
diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c
index 13e642a..b8bf356 100644
--- a/drivers/mailbox/stm32-ipcc.c
+++ b/drivers/mailbox/stm32-ipcc.c
@@ -6,10 +6,12 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <mailbox-uclass.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 /*
  * IPCC has one set of registers per CPU
diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index 60f6a38..f82e6d3 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -4,11 +4,13 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <dm.h>
 #include <mailbox-uclass.h>
 #include <dt-bindings/mailbox/tegra186-hsp.h>
+#include <linux/bitops.h>
 
 #define TEGRA_HSP_INT_DIMENSIONING		0x380
 #define TEGRA_HSP_INT_DIMENSIONING_NSI_SHIFT	16
diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c
index 17b4654..f206a27 100644
--- a/drivers/mailbox/zynqmp-ipi.c
+++ b/drivers/mailbox/zynqmp-ipi.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm.h>
 #include <mailbox-uclass.h>
diff --git a/drivers/misc/altera_sysid.c b/drivers/misc/altera_sysid.c
index eff33f7..387c70b 100644
--- a/drivers/misc/altera_sysid.c
+++ b/drivers/misc/altera_sysid.c
@@ -44,7 +44,7 @@
 	printf("SYSID: %08x, %s", sysid[0], asc);
 }
 
-int do_sysid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_sysid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	display_sysid();
 	return 0;
diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
index 116c066..422ea6f 100644
--- a/drivers/misc/atsha204a-i2c.c
+++ b/drivers/misc/atsha204a-i2c.c
@@ -15,6 +15,8 @@
 #include <i2c.h>
 #include <errno.h>
 #include <atsha204a-i2c.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <u-boot/crc.h>
 
 #define ATSHA204A_TWLO			60
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index fa9984f..a5534b1 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -18,11 +18,14 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <flash.h>
 #include <i2c.h>
 #include <cros_ec.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
diff --git a/drivers/misc/cros_ec_i2c.c b/drivers/misc/cros_ec_i2c.c
index cdd55f5..c00f5f7 100644
--- a/drivers/misc/cros_ec_i2c.c
+++ b/drivers/misc/cros_ec_i2c.c
@@ -16,6 +16,7 @@
 #include <dm.h>
 #include <i2c.h>
 #include <cros_ec.h>
+#include <log.h>
 
 #ifdef DEBUG_TRACE
 #define debug_trace(fmt, b...)	debug(fmt, #b)
diff --git a/drivers/misc/cros_ec_lpc.c b/drivers/misc/cros_ec_lpc.c
index 71d03bf..4ad6c8c 100644
--- a/drivers/misc/cros_ec_lpc.c
+++ b/drivers/misc/cros_ec_lpc.c
@@ -16,6 +16,7 @@
 #include <dm.h>
 #include <command.h>
 #include <cros_ec.h>
+#include <log.h>
 #include <asm/io.h>
 
 #ifdef DEBUG_TRACE
diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c
index 9dd6a18..c9fa7ab 100644
--- a/drivers/misc/cros_ec_sandbox.c
+++ b/drivers/misc/cros_ec_sandbox.c
@@ -11,6 +11,7 @@
 #include <ec_commands.h>
 #include <errno.h>
 #include <hash.h>
+#include <log.h>
 #include <os.h>
 #include <u-boot/sha256.h>
 #include <spi.h>
diff --git a/drivers/misc/cros_ec_spi.c b/drivers/misc/cros_ec_spi.c
index be51070..153f971 100644
--- a/drivers/misc/cros_ec_spi.c
+++ b/drivers/misc/cros_ec_spi.c
@@ -16,6 +16,7 @@
 #include <cros_ec.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <spi.h>
 
 int cros_ec_spi_packet(struct udevice *udev, int out_bytes, int in_bytes)
diff --git a/drivers/misc/ds4510.c b/drivers/misc/ds4510.c
index bf20a83..a2a5291 100644
--- a/drivers/misc/ds4510.c
+++ b/drivers/misc/ds4510.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <i2c.h>
 #include <command.h>
+#include <linux/delay.h>
 #include "ds4510.h"
 
 enum {
@@ -233,7 +234,7 @@
 	return 0;
 }
 
-cmd_tbl_t cmd_ds4510[] = {
+struct cmd_tbl cmd_ds4510[] = {
 	U_BOOT_CMD_MKENT(device, 3, 0, (void *)DS4510_CMD_DEVICE, "", ""),
 	U_BOOT_CMD_MKENT(nv, 3, 0, (void *)DS4510_CMD_NV, "", ""),
 	U_BOOT_CMD_MKENT(output, 4, 0, (void *)DS4510_CMD_OUTPUT, "", ""),
@@ -246,10 +247,10 @@
 	U_BOOT_CMD_MKENT(sram, 6, 0, (void *)DS4510_CMD_SRAM, "", ""),
 };
 
-int do_ds4510(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ds4510(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	static uint8_t chip = 0x51;
-	cmd_tbl_t *c;
+	struct cmd_tbl *c;
 	ulong ul_arg2 = 0;
 	ulong ul_arg3 = 0;
 	int tmp;
diff --git a/drivers/misc/esm_pmic.c b/drivers/misc/esm_pmic.c
index 92c8d68..a195dc5 100644
--- a/drivers/misc/esm_pmic.c
+++ b/drivers/misc/esm_pmic.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <power/pmic.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #define INT_ESM_REG		0x6c
 #define INT_ESM_MASK		0x3f
diff --git a/drivers/misc/fs_loader.c b/drivers/misc/fs_loader.c
index 88e486e..56406aa 100644
--- a/drivers/misc/fs_loader.c
+++ b/drivers/misc/fs_loader.c
@@ -10,6 +10,7 @@
 #include <blk.h>
 #include <fs.h>
 #include <fs_loader.h>
+#include <log.h>
 #include <linux/string.h>
 #include <mapmem.h>
 #include <malloc.h>
diff --git a/drivers/misc/fsl_ifc.c b/drivers/misc/fsl_ifc.c
index 0dbf304..8fdaacd 100644
--- a/drivers/misc/fsl_ifc.c
+++ b/drivers/misc/fsl_ifc.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <fsl_ifc.h>
+#include <part.h>
 
 #ifdef CONFIG_TFABOOT
 struct ifc_regs ifc_cfg_default_boot[CONFIG_SYS_FSL_IFC_BANK_COUNT] = {
diff --git a/drivers/misc/fsl_iim.c b/drivers/misc/fsl_iim.c
index f8075db..85cc3c2 100644
--- a/drivers/misc/fsl_iim.c
+++ b/drivers/misc/fsl_iim.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <fuse.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
diff --git a/drivers/misc/fsl_portals.c b/drivers/misc/fsl_portals.c
index 45eed22..632430e 100644
--- a/drivers/misc/fsl_portals.c
+++ b/drivers/misc/fsl_portals.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <fdt_support.h>
 
diff --git a/drivers/misc/fsl_sec_mon.c b/drivers/misc/fsl_sec_mon.c
index e9f351d..321bd27 100644
--- a/drivers/misc/fsl_sec_mon.c
+++ b/drivers/misc/fsl_sec_mon.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fsl_sec_mon.h>
+#include <linux/delay.h>
 
 static u32 get_sec_mon_state(void)
 {
diff --git a/drivers/misc/gdsys_ioep.c b/drivers/misc/gdsys_ioep.c
index 7f17095..69e16a0 100644
--- a/drivers/misc/gdsys_ioep.c
+++ b/drivers/misc/gdsys_ioep.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <misc.h>
 #include <regmap.h>
 
diff --git a/drivers/misc/gdsys_ioep.h b/drivers/misc/gdsys_ioep.h
index 4d9524b..f195388 100644
--- a/drivers/misc/gdsys_ioep.h
+++ b/drivers/misc/gdsys_ioep.h
@@ -15,6 +15,7 @@
  * @bc:                 Block counter (filled in by FPGA).
  * @packet_length:      Length of the packet's payload bytes.
  */
+#include <linux/bitops.h>
 struct io_generic_packet {
 	u16 target_address;
 	u16 source_address;
diff --git a/drivers/misc/gdsys_soc.c b/drivers/misc/gdsys_soc.c
index 94a21e0..b4c721c 100644
--- a/drivers/misc/gdsys_soc.c
+++ b/drivers/misc/gdsys_soc.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/lists.h>
 
 #include "gdsys_soc.h"
diff --git a/drivers/misc/i2c_eeprom.c b/drivers/misc/i2c_eeprom.c
index ef5f103..ed23a62 100644
--- a/drivers/misc/i2c_eeprom.c
+++ b/drivers/misc/i2c_eeprom.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <eeprom.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <dm.h>
diff --git a/drivers/misc/i2c_eeprom_emul.c b/drivers/misc/i2c_eeprom_emul.c
index 16758a0..6be76ad 100644
--- a/drivers/misc/i2c_eeprom_emul.c
+++ b/drivers/misc/i2c_eeprom_emul.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/test.h>
 
diff --git a/drivers/misc/ihs_fpga.c b/drivers/misc/ihs_fpga.c
index f9e4b27..00d34a3 100644
--- a/drivers/misc/ihs_fpga.c
+++ b/drivers/misc/ihs_fpga.c
@@ -11,8 +11,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <regmap.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include "ihs_fpga.h"
 
diff --git a/drivers/misc/imx8/scu.c b/drivers/misc/imx8/scu.c
index 6916b75..ee635eb 100644
--- a/drivers/misc/imx8/scu.c
+++ b/drivers/misc/imx8/scu.c
@@ -6,12 +6,14 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm.h>
 #include <dm/lists.h>
 #include <dm/root.h>
 #include <dm/device-internal.h>
 #include <asm/arch/sci/sci.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 #include <misc.h>
 
diff --git a/drivers/misc/irq-uclass.c b/drivers/misc/irq-uclass.c
index 61aa10e..16dc0be 100644
--- a/drivers/misc/irq-uclass.c
+++ b/drivers/misc/irq-uclass.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <irq.h>
+#include <log.h>
 #include <dm/device-internal.h>
 
 int irq_route_pmc_gpio_gpe(struct udevice *dev, uint pmc_gpe_num)
diff --git a/drivers/misc/jz4780_efuse.c b/drivers/misc/jz4780_efuse.c
index bc3dc93..1fba327 100644
--- a/drivers/misc/jz4780_efuse.c
+++ b/drivers/misc/jz4780_efuse.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/unaligned.h>
 #include <errno.h>
+#include <linux/bitops.h>
 #include <mach/jz4780.h>
 #include <wait_bit.h>
 
diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c
index d8048e1..408c893 100644
--- a/drivers/misc/k3_avs.c
+++ b/drivers/misc/k3_avs.c
@@ -14,6 +14,7 @@
 #include <i2c.h>
 #include <k3-avs.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <power/regulator.h>
 
 #define AM6_VTM_DEVINFO(i)	(priv->base + 0x100 + 0x20 * (i))
diff --git a/drivers/misc/k3_esm.c b/drivers/misc/k3_esm.c
index 8f270f3..cc2a23d 100644
--- a/drivers/misc/k3_esm.c
+++ b/drivers/misc/k3_esm.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #define ESM_SFT_RST			0x0c
 #define ESM_SFT_RST_KEY			0x0f
diff --git a/drivers/misc/microchip_flexcom.c b/drivers/misc/microchip_flexcom.c
index 4cff160..44a8b18 100644
--- a/drivers/misc/microchip_flexcom.c
+++ b/drivers/misc/microchip_flexcom.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <misc.h>
 #include <asm/io.h>
 #include <linux/err.h>
diff --git a/drivers/misc/mpc83xx_serdes.c b/drivers/misc/mpc83xx_serdes.c
index d572dda..ab1e34e 100644
--- a/drivers/misc/mpc83xx_serdes.c
+++ b/drivers/misc/mpc83xx_serdes.c
@@ -11,8 +11,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <mapmem.h>
 #include <misc.h>
+#include <linux/delay.h>
 
 #include "mpc83xx_serdes.h"
 
diff --git a/drivers/misc/mpc83xx_serdes.h b/drivers/misc/mpc83xx_serdes.h
index 89ea1db..2a13c58 100644
--- a/drivers/misc/mpc83xx_serdes.h
+++ b/drivers/misc/mpc83xx_serdes.h
@@ -18,6 +18,7 @@
  *			lane E) field of the SRCSCR0
  * @SRDSCR0_TXEQE_SATA: Bitmask to set the TXEQE to the value used for SATA
  */
+#include <linux/bitops.h>
 enum srdscr0_mask {
 	SRDSCR0_DPPA        = BIT(31 - 16),
 	SRDSCR0_DPPE        = BIT(31 - 20),
diff --git a/drivers/misc/mxc_ocotp.c b/drivers/misc/mxc_ocotp.c
index 80cd8dc..926c62c 100644
--- a/drivers/misc/mxc_ocotp.c
+++ b/drivers/misc/mxc_ocotp.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <fuse.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/misc/mxs_ocotp.c b/drivers/misc/mxs_ocotp.c
index 21cae02..facc720 100644
--- a/drivers/misc/mxs_ocotp.c
+++ b/drivers/misc/mxs_ocotp.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <fuse.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/misc/p2sb-uclass.c b/drivers/misc/p2sb-uclass.c
index 9fe0aca..06b1e8d 100644
--- a/drivers/misc/p2sb-uclass.c
+++ b/drivers/misc/p2sb-uclass.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <p2sb.h>
diff --git a/drivers/misc/p2sb_emul.c b/drivers/misc/p2sb_emul.c
index 02f7a7e..a4b6dba 100644
--- a/drivers/misc/p2sb_emul.c
+++ b/drivers/misc/p2sb_emul.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <axi.h>
 #include <dm.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/test.h>
 #include <p2sb.h>
diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
index 81e2661..f6eb658 100644
--- a/drivers/misc/qfw.c
+++ b/drivers/misc/qfw.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <qfw.h>
 #include <asm/io.h>
diff --git a/drivers/misc/rockchip-efuse.c b/drivers/misc/rockchip-efuse.c
index 2520c6a..46ce630 100644
--- a/drivers/misc/rockchip-efuse.c
+++ b/drivers/misc/rockchip-efuse.c
@@ -43,8 +43,8 @@
 };
 
 #if defined(DEBUG)
-static int dump_efuses(cmd_tbl_t *cmdtp, int flag,
-		       int argc, char * const argv[])
+static int dump_efuses(struct cmd_tbl *cmdtp, int flag,
+		       int argc, char *const argv[])
 {
 	/*
 	 * N.B.: This function is tailored towards the RK3399 and assumes that
diff --git a/drivers/misc/stm32_rcc.c b/drivers/misc/stm32_rcc.c
index 980b844..b82fe54 100644
--- a/drivers/misc/stm32_rcc.c
+++ b/drivers/misc/stm32_rcc.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <misc.h>
 #include <stm32_rcc.h>
 #include <dm/device-internal.h>
diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c
index 97e2afa..07c6757 100644
--- a/drivers/misc/swap_case.c
+++ b/drivers/misc/swap_case.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/test.h>
 #include <linux/ctype.h>
diff --git a/drivers/misc/tegra186_bpmp.c b/drivers/misc/tegra186_bpmp.c
index ce2b925..18da138 100644
--- a/drivers/misc/tegra186_bpmp.c
+++ b/drivers/misc/tegra186_bpmp.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <time.h>
 #include <dm/lists.h>
@@ -13,6 +14,7 @@
 #include <misc.h>
 #include <asm/arch-tegra/bpmp_abi.h>
 #include <asm/arch-tegra/ivc.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define BPMP_IVC_FRAME_COUNT 1
diff --git a/drivers/misc/tegra_car.c b/drivers/misc/tegra_car.c
index db05c891..0ddbb3c 100644
--- a/drivers/misc/tegra_car.c
+++ b/drivers/misc/tegra_car.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/lists.h>
 #include <dm/root.h>
 
diff --git a/drivers/misc/vexpress_config.c b/drivers/misc/vexpress_config.c
index 53d7e1d..02e5b58 100644
--- a/drivers/misc/vexpress_config.c
+++ b/drivers/misc/vexpress_config.c
@@ -9,6 +9,7 @@
 #include <malloc.h>
 #include <dm/read.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/delay.h>
 #include <misc.h>
 
diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c
index ca76e1f..cbc531d 100644
--- a/drivers/mmc/am654_sdhci.c
+++ b/drivers/mmc/am654_sdhci.c
@@ -13,6 +13,7 @@
 #include <regmap.h>
 #include <sdhci.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 /* CTL_CFG Registers */
diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c
index d396afc..8466228 100644
--- a/drivers/mmc/arm_pl180_mmci.c
+++ b/drivers/mmc/arm_pl180_mmci.c
@@ -14,6 +14,7 @@
 #include "common.h"
 #include <clk.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <dm/device_compat.h>
@@ -22,6 +23,7 @@
 #include <asm-generic/gpio.h>
 
 #include "arm_pl180_mmci.h"
+#include <linux/delay.h>
 
 #ifdef CONFIG_DM_MMC
 #include <dm.h>
diff --git a/drivers/mmc/bcm2835_sdhci.c b/drivers/mmc/bcm2835_sdhci.c
index 39c93db..dc3dffb 100644
--- a/drivers/mmc/bcm2835_sdhci.c
+++ b/drivers/mmc/bcm2835_sdhci.c
@@ -38,6 +38,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <sdhci.h>
diff --git a/drivers/mmc/bcm2835_sdhost.c b/drivers/mmc/bcm2835_sdhost.c
index 8cebf99..c4876e8 100644
--- a/drivers/mmc/bcm2835_sdhost.c
+++ b/drivers/mmc/bcm2835_sdhost.c
@@ -37,7 +37,10 @@
 #include <asm/arch/mbox.h>
 #include <asm/unaligned.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/sizes.h>
diff --git a/drivers/mmc/davinci_mmc.c b/drivers/mmc/davinci_mmc.c
index ef5cd4e..2408a68 100644
--- a/drivers/mmc/davinci_mmc.c
+++ b/drivers/mmc/davinci_mmc.c
@@ -16,6 +16,7 @@
 #include <asm/io.h>
 #include <asm/arch/sdmmc_defs.h>
 #include <asm-generic/gpio.h>
+#include <linux/delay.h>
 
 #define DAVINCI_MAX_BLOCKS	(32)
 #define WATCHDOG_COUNT		(100000)
diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 1224540..7702f4b 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -9,11 +9,14 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <mmc.h>
 #include <dwmmc.h>
 #include <wait_bit.h>
+#include <asm/cache.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 #define PAGE_SIZE 4096
diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c
index 386781d..d5d9558 100644
--- a/drivers/mmc/fsl_esdhc.c
+++ b/drivers/mmc/fsl_esdhc.c
@@ -20,9 +20,12 @@
 #include <malloc.h>
 #include <fsl_esdhc.h>
 #include <fdt_support.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c
index 6bca2a9..588d6a9 100644
--- a/drivers/mmc/fsl_esdhc_imx.c
+++ b/drivers/mmc/fsl_esdhc_imx.c
@@ -17,9 +17,13 @@
 #include <cpu_func.h>
 #include <errno.h>
 #include <hwconfig.h>
+#include <log.h>
 #include <mmc.h>
 #include <part.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <power/regulator.h>
 #include <malloc.h>
diff --git a/drivers/mmc/ftsdc010_mci.c b/drivers/mmc/ftsdc010_mci.c
index 9c15eb3..b37523e 100644
--- a/drivers/mmc/ftsdc010_mci.c
+++ b/drivers/mmc/ftsdc010_mci.c
@@ -11,9 +11,11 @@
 
 #include <common.h>
 #include <clk.h>
+#include <log.h>
 #include <malloc.h>
 #include <part.h>
 #include <mmc.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/errno.h>
 #include <asm/byteorder.h>
diff --git a/drivers/mmc/gen_atmel_mci.c b/drivers/mmc/gen_atmel_mci.c
index 93b88d1..9d20e28 100644
--- a/drivers/mmc/gen_atmel_mci.c
+++ b/drivers/mmc/gen_atmel_mci.c
@@ -11,10 +11,12 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <mmc.h>
 #include <part.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/byteorder.h>
 #include <asm/arch/clk.h>
diff --git a/drivers/mmc/iproc_sdhci.c b/drivers/mmc/iproc_sdhci.c
index c2319b4..91e2e3f 100644
--- a/drivers/mmc/iproc_sdhci.c
+++ b/drivers/mmc/iproc_sdhci.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <malloc.h>
 #include <sdhci.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/mmc/jz_mmc.c b/drivers/mmc/jz_mmc.c
index 8d4f886..d3f1edd 100644
--- a/drivers/mmc/jz_mmc.c
+++ b/drivers/mmc/jz_mmc.c
@@ -13,6 +13,8 @@
 #include <asm/unaligned.h>
 #include <errno.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <mach/jz4780.h>
 #include <wait_bit.h>
 
diff --git a/drivers/mmc/kona_sdhci.c b/drivers/mmc/kona_sdhci.c
index f5e1f2c..2bbe673 100644
--- a/drivers/mmc/kona_sdhci.c
+++ b/drivers/mmc/kona_sdhci.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <sdhci.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/kona-common/clk.h>
 
diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c
index 86c1a71..b7f793c 100644
--- a/drivers/mmc/meson_gx_mmc.c
+++ b/drivers/mmc/meson_gx_mmc.c
@@ -14,6 +14,7 @@
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/arch/sd_emmc.h>
+#include <linux/delay.h>
 #include <linux/log2.h>
 
 static inline void *get_regbase(const struct mmc *mmc)
diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c
index f313bc1..c5b7872 100644
--- a/drivers/mmc/mmc-uclass.c
+++ b/drivers/mmc/mmc-uclass.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <mmc.h>
 #include <dm.h>
 #include <dm/device-internal.h>
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 523c055..620bb93 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -8,12 +8,16 @@
 
 #include <config.h>
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <errno.h>
 #include <mmc.h>
 #include <part.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 #include <malloc.h>
 #include <memalign.h>
diff --git a/drivers/mmc/mmc_boot.c b/drivers/mmc/mmc_boot.c
index 64dc147..0a74b1f 100644
--- a/drivers/mmc/mmc_boot.c
+++ b/drivers/mmc/mmc_boot.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <mmc.h>
 #include "mmc_private.h"
 
diff --git a/drivers/mmc/mmc_legacy.c b/drivers/mmc/mmc_legacy.c
index b0f5cf5..2bb12ce 100644
--- a/drivers/mmc/mmc_legacy.c
+++ b/drivers/mmc/mmc_legacy.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include "mmc_private.h"
diff --git a/drivers/mmc/mmc_spi.c b/drivers/mmc/mmc_spi.c
index c693fb2..e76ab54 100644
--- a/drivers/mmc/mmc_spi.c
+++ b/drivers/mmc/mmc_spi.c
@@ -8,10 +8,12 @@
  */
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <part.h>
 #include <mmc.h>
 #include <stdlib.h>
+#include <linux/bitops.h>
 #include <u-boot/crc.h>
 #include <linux/crc7.h>
 #include <asm/byteorder.h>
diff --git a/drivers/mmc/mmc_write.c b/drivers/mmc/mmc_write.c
index b52ff9f..6a4453c 100644
--- a/drivers/mmc/mmc_write.c
+++ b/drivers/mmc/mmc_write.c
@@ -8,6 +8,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <blk.h>
 #include <dm.h>
 #include <part.h>
 #include <div64.h>
diff --git a/drivers/mmc/mvebu_mmc.c b/drivers/mmc/mvebu_mmc.c
index 958ac17..8e7745e 100644
--- a/drivers/mmc/mvebu_mmc.c
+++ b/drivers/mmc/mvebu_mmc.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <part.h>
 #include <mmc.h>
diff --git a/drivers/mmc/mxsmmc.c b/drivers/mmc/mxsmmc.c
index 9414eff..e3c352b 100644
--- a/drivers/mmc/mxsmmc.c
+++ b/drivers/mmc/mxsmmc.c
@@ -21,8 +21,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c
index 4d0dc33..8636cd7 100644
--- a/drivers/mmc/omap_hsmmc.c
+++ b/drivers/mmc/omap_hsmmc.c
@@ -25,6 +25,7 @@
 #include <config.h>
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <mmc.h>
@@ -33,6 +34,7 @@
 #if defined(CONFIG_OMAP54XX) || defined(CONFIG_OMAP44XX)
 #include <palmas.h>
 #endif
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/mmc_host_def.h>
 #ifdef CONFIG_OMAP54XX
@@ -48,6 +50,8 @@
 #endif
 #include <dm.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <power/regulator.h>
 #include <thermal.h>
diff --git a/drivers/mmc/pxa_mmc_gen.c b/drivers/mmc/pxa_mmc_gen.c
index a4dcdb5..cc60147 100644
--- a/drivers/mmc/pxa_mmc_gen.c
+++ b/drivers/mmc/pxa_mmc_gen.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/regs-mmc.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <malloc.h>
diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c
index 88a7160..d6ea99d 100644
--- a/drivers/mmc/renesas-sdhi.c
+++ b/drivers/mmc/renesas-sdhi.c
@@ -7,11 +7,14 @@
 #include <bouncebuf.h>
 #include <clk.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
+#include <linux/delay.h>
 #include <linux/dma-direction.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
diff --git a/drivers/mmc/rockchip_dw_mmc.c b/drivers/mmc/rockchip_dw_mmc.c
index a0e1be8..638107a 100644
--- a/drivers/mmc/rockchip_dw_mmc.c
+++ b/drivers/mmc/rockchip_dw_mmc.c
@@ -9,12 +9,14 @@
 #include <dt-structs.h>
 #include <dwmmc.h>
 #include <errno.h>
+#include <log.h>
 #include <mapmem.h>
 #include <pwrseq.h>
 #include <syscon.h>
 #include <asm/gpio.h>
 #include <asm/arch-rockchip/clock.h>
 #include <asm/arch-rockchip/periph.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 struct rockchip_mmc_plat {
diff --git a/drivers/mmc/rpmb.c b/drivers/mmc/rpmb.c
index ee6dbe3..ea7e506 100644
--- a/drivers/mmc/rpmb.c
+++ b/drivers/mmc/rpmb.c
@@ -9,6 +9,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <memalign.h>
 #include <mmc.h>
 #include <sdhci.h>
diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c
index b5fe828..24f599e 100644
--- a/drivers/mmc/s5p_sdhci.c
+++ b/drivers/mmc/s5p_sdhci.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <sdhci.h>
 #include <fdtdec.h>
diff --git a/drivers/mmc/sandbox_mmc.c b/drivers/mmc/sandbox_mmc.c
index 899952d..e86ea8f 100644
--- a/drivers/mmc/sandbox_mmc.c
+++ b/drivers/mmc/sandbox_mmc.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <mmc.h>
 #include <asm/test.h>
 
diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c
index 2d38c22..7b5010b 100644
--- a/drivers/mmc/sdhci-cadence.c
+++ b/drivers/mmc/sdhci-cadence.c
@@ -8,6 +8,8 @@
 #include <dm.h>
 #include <dm/device_compat.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <linux/sizes.h>
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c
index 8bb4393..92cc843 100644
--- a/drivers/mmc/sdhci.c
+++ b/drivers/mmc/sdhci.c
@@ -11,10 +11,14 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <sdhci.h>
 #include <dm.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <phys2bus.h>
 
diff --git a/drivers/mmc/sh_mmcif.c b/drivers/mmc/sh_mmcif.c
index 29bbb4b..2e994d0 100644
--- a/drivers/mmc/sh_mmcif.c
+++ b/drivers/mmc/sh_mmcif.c
@@ -7,6 +7,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <watchdog.h>
 #include <command.h>
 #include <mmc.h>
@@ -14,6 +15,8 @@
 #include <dm.h>
 #include <malloc.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/compat.h>
 #include <linux/io.h>
diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c
index 2202158..772fe94 100644
--- a/drivers/mmc/sh_sdhi.c
+++ b/drivers/mmc/sh_sdhi.c
@@ -10,10 +10,14 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <dm.h>
+#include <part.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/compat.h>
 #include <linux/io.h>
diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c
index 786cdc7..892222d 100644
--- a/drivers/mmc/socfpga_dw_mmc.c
+++ b/drivers/mmc/socfpga_dw_mmc.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/clock_manager.h>
 #include <asm/arch/system_manager.h>
 #include <clk.h>
diff --git a/drivers/mmc/sti_sdhci.c b/drivers/mmc/sti_sdhci.c
index d6c75ea..9bcd8ce 100644
--- a/drivers/mmc/sti_sdhci.c
+++ b/drivers/mmc/sti_sdhci.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <mmc.h>
 #include <reset-uclass.h>
 #include <sdhci.h>
diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c
index fa6fc94..6d50356 100644
--- a/drivers/mmc/stm32_sdmmc2.c
+++ b/drivers/mmc/stm32_sdmmc2.c
@@ -9,7 +9,12 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
+#include <asm/bitops.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <mmc.h>
 #include <reset.h>
diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c
index 9f42666..0e03b07 100644
--- a/drivers/mmc/sunxi_mmc.c
+++ b/drivers/mmc/sunxi_mmc.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <mmc.h>
 #include <clk.h>
@@ -20,6 +21,7 @@
 #include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm-generic/gpio.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_DM_MMC
 struct sunxi_mmc_variant {
diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c
index 2b04156..cc78a2f 100644
--- a/drivers/mmc/tegra_mmc.c
+++ b/drivers/mmc/tegra_mmc.c
@@ -10,10 +10,13 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <mmc.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/tegra_mmc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #if defined(CONFIG_TEGRA30) || defined(CONFIG_TEGRA210)
 #include <asm/arch/clock.h>
diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c
index 1dc13db..20cd237 100644
--- a/drivers/mmc/tmio-common.c
+++ b/drivers/mmc/tmio-common.c
@@ -13,6 +13,7 @@
 #include <dm/device_compat.h>
 #include <dm/pinctrl.h>
 #include <linux/compat.h>
+#include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
diff --git a/drivers/mmc/tmio-common.h b/drivers/mmc/tmio-common.h
index 2f671df..9062300 100644
--- a/drivers/mmc/tmio-common.h
+++ b/drivers/mmc/tmio-common.h
@@ -7,6 +7,7 @@
 #ifndef __TMIO_COMMON_H__
 #define __TMIO_COMMON_H__
 
+#include <linux/bitops.h>
 #define TMIO_SD_CMD			0x000	/* command */
 #define   TMIO_SD_CMD_NOSTOP		BIT(14)	/* No automatic CMD12 issue */
 #define   TMIO_SD_CMD_MULTI		BIT(13)	/* multiple block transfer */
diff --git a/drivers/mmc/xenon_sdhci.c b/drivers/mmc/xenon_sdhci.c
index 829b756..e765dd3 100644
--- a/drivers/mmc/xenon_sdhci.c
+++ b/drivers/mmc/xenon_sdhci.c
@@ -17,6 +17,8 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <malloc.h>
 #include <sdhci.h>
diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c
index 18925d0..de404aa 100644
--- a/drivers/mmc/zynq_sdhci.c
+++ b/drivers/mmc/zynq_sdhci.c
@@ -9,7 +9,9 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <linux/delay.h>
 #include "mmc_private.h"
+#include <log.h>
 #include <dm/device_compat.h>
 #include <linux/err.h>
 #include <linux/libfdt.h>
diff --git a/drivers/mtd/altera_qspi.c b/drivers/mtd/altera_qspi.c
index 1d32feb..cd4d329 100644
--- a/drivers/mtd/altera_qspi.c
+++ b/drivers/mtd/altera_qspi.c
@@ -9,8 +9,10 @@
 #include <errno.h>
 #include <fdt_support.h>
 #include <flash.h>
+#include <log.h>
 #include <mtd.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 4ce183b..b7289ba 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -22,12 +22,16 @@
 #include <env.h>
 #include <errno.h>
 #include <fdt_support.h>
+#include <flash.h>
+#include <init.h>
 #include <irq_func.h>
+#include <log.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
 #include <asm/unaligned.h>
 #include <env_internal.h>
+#include <linux/delay.h>
 #include <mtd/cfi_flash.h>
 #include <watchdog.h>
 
diff --git a/drivers/mtd/jedec_flash.c b/drivers/mtd/jedec_flash.c
index f59b2bc..859c7fd 100644
--- a/drivers/mtd/jedec_flash.c
+++ b/drivers/mtd/jedec_flash.c
@@ -12,6 +12,8 @@
 /*#define DEBUG*/
 
 #include <common.h>
+#include <flash.h>
+#include <log.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/byteorder.h>
diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c
index db20a6b..9360d4e 100644
--- a/drivers/mtd/mtd_uboot.c
+++ b/drivers/mtd/mtd_uboot.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device.h>
 #include <dm/uclass-internal.h>
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c
index 5621c3f..684bc94 100644
--- a/drivers/mtd/mtdconcat.c
+++ b/drivers/mtd/mtdconcat.c
@@ -10,6 +10,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -20,6 +21,7 @@
 #include <asm/div64.h>
 #else
 #include <div64.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #endif
 
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index f8d3f4d..1a4dec3 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -9,6 +9,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -27,6 +28,8 @@
 #include <linux/gfp.h>
 #include <linux/slab.h>
 #else
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/err.h>
 #include <ubi_uboot.h>
 #endif
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 56acdbf..d1f6029 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -9,6 +9,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -20,6 +21,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 #include <linux/compat.h>
 #include <ubi_uboot.h>
diff --git a/drivers/mtd/mw_eeprom.c b/drivers/mtd/mw_eeprom.c
index 6a3a6f6..9837733 100644
--- a/drivers/mtd/mw_eeprom.c
+++ b/drivers/mtd/mw_eeprom.c
@@ -3,6 +3,7 @@
 #include <common.h>
 #include <eeprom.h>
 #include <asm/ic/ssi.h>
+#include <linux/delay.h>
 
 /*
  * Serial EEPROM opcodes, including start bit
diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c
index 133670c..84d60b8 100644
--- a/drivers/mtd/nand/bbt.c
+++ b/drivers/mtd/nand/bbt.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/mtd/nand.h>
 #ifndef __UBOOT__
 #include <linux/slab.h>
diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
index bc0accf..6fbd24b 100644
--- a/drivers/mtd/nand/core.c
+++ b/drivers/mtd/nand/core.c
@@ -14,6 +14,7 @@
 #include <linux/compat.h>
 #include <linux/module.h>
 #endif
+#include <linux/bitops.h>
 #include <linux/mtd/nand.h>
 
 /**
diff --git a/drivers/mtd/nand/raw/am335x_spl_bch.c b/drivers/mtd/nand/raw/am335x_spl_bch.c
index ba2f33a..b6fc5f2 100644
--- a/drivers/mtd/nand/raw/am335x_spl_bch.c
+++ b/drivers/mtd/nand/raw/am335x_spl_bch.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <nand.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/mtd/nand_ecc.h>
 
 static int nand_ecc_pos[] = CONFIG_SYS_NAND_ECCPOS;
diff --git a/drivers/mtd/nand/raw/arasan_nfc.c b/drivers/mtd/nand/raw/arasan_nfc.c
index 110c32b..6c1d640 100644
--- a/drivers/mtd/nand/raw/arasan_nfc.c
+++ b/drivers/mtd/nand/raw/arasan_nfc.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/rawnand.h>
diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c
index 996d3db..5e95901 100644
--- a/drivers/mtd/nand/raw/atmel_nand.c
+++ b/drivers/mtd/nand/raw/atmel_nand.c
@@ -11,10 +11,14 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <asm/arch/gpio.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 
 #include <malloc.h>
 #include <nand.h>
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c
index ea7c65a..6313403 100644
--- a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c
+++ b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c
@@ -4,6 +4,7 @@
 #include <asm/io.h>
 #include <memalign.h>
 #include <nand.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/io.h>
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c
index e2f5452..cd4b24a 100644
--- a/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c
+++ b/drivers/mtd/nand/raw/brcmnand/bcm6368_nand.c
@@ -4,6 +4,7 @@
 #include <asm/io.h>
 #include <memalign.h>
 #include <nand.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c
index 0f1a28e..aa042be 100644
--- a/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c
+++ b/drivers/mtd/nand/raw/brcmnand/bcm68360_nand.c
@@ -4,6 +4,7 @@
 #include <asm/io.h>
 #include <memalign.h>
 #include <nand.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c
index 3a13615..0788455 100644
--- a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c
+++ b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c
@@ -4,6 +4,7 @@
 #include <asm/io.h>
 #include <memalign.h>
 #include <nand.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/io.h>
diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c
index 6aca011..818eae8 100644
--- a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c
+++ b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c
@@ -4,6 +4,7 @@
 #include <asm/io.h>
 #include <memalign.h>
 #include <nand.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/io.h>
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
index 7bdebf5..48c0ca6 100644
--- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
+++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
@@ -19,6 +19,8 @@
 #include <clk.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/err.h>
 #include <linux/ioport.h>
 #include <linux/completion.h>
diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c
index 724bbee..4416b8f 100644
--- a/drivers/mtd/nand/raw/davinci_nand.c
+++ b/drivers/mtd/nand/raw/davinci_nand.c
@@ -29,6 +29,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <nand.h>
 #include <dm/uclass.h>
diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c
index b525b1b..5bae7f1 100644
--- a/drivers/mtd/nand/raw/denali.c
+++ b/drivers/mtd/nand/raw/denali.c
@@ -5,12 +5,18 @@
  * Copyright (C) 2009-2010, Intel Corporation and its suppliers.
  */
 
+#include <common.h>
 #include <dm.h>
 #include <malloc.h>
 #include <nand.h>
+#include <asm/cache.h>
+#include <asm/dma-mapping.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/dma-direction.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/errno.h>
diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
index 41b93e6..2728e80 100644
--- a/drivers/mtd/nand/raw/denali_dt.c
+++ b/drivers/mtd/nand/raw/denali_dt.c
@@ -7,6 +7,8 @@
 #include <clk.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <linux/printk.h>
diff --git a/drivers/mtd/nand/raw/denali_spl.c b/drivers/mtd/nand/raw/denali_spl.c
index b8b2981..f721428 100644
--- a/drivers/mtd/nand/raw/denali_spl.c
+++ b/drivers/mtd/nand/raw/denali_spl.c
@@ -5,8 +5,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/unaligned.h>
+#include <linux/delay.h>
 #include <linux/mtd/rawnand.h>
 #include "denali.h"
 
diff --git a/drivers/mtd/nand/raw/fsl_ifc_spl.c b/drivers/mtd/nand/raw/fsl_ifc_spl.c
index 0983fbc..b7e3741 100644
--- a/drivers/mtd/nand/raw/fsl_ifc_spl.c
+++ b/drivers/mtd/nand/raw/fsl_ifc_spl.c
@@ -10,6 +10,7 @@
 #include <cpu_func.h>
 #include <asm/io.h>
 #include <fsl_ifc.h>
+#include <part.h>
 #include <linux/mtd/rawnand.h>
 #ifdef CONFIG_CHAIN_OF_TRUST
 #include <fsl_validate.h>
diff --git a/drivers/mtd/nand/raw/fsl_upm.c b/drivers/mtd/nand/raw/fsl_upm.c
index dfbdbca..6c86a7e 100644
--- a/drivers/mtd/nand/raw/fsl_upm.c
+++ b/drivers/mtd/nand/raw/fsl_upm.c
@@ -8,7 +8,9 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/fsl_upm.h>
diff --git a/drivers/mtd/nand/raw/kmeter1_nand.c b/drivers/mtd/nand/raw/kmeter1_nand.c
index 7103300..cf33f28 100644
--- a/drivers/mtd/nand/raw/kmeter1_nand.c
+++ b/drivers/mtd/nand/raw/kmeter1_nand.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <nand.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #define CONFIG_NAND_MODE_REG	(void *)(CONFIG_SYS_NAND_BASE + 0x20000)
 #define CONFIG_NAND_DATA_REG	(void *)(CONFIG_SYS_NAND_BASE + 0x30000)
diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c
index 79d1489..b3232ed 100644
--- a/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_nand_mlc.c
@@ -21,6 +21,7 @@
 
 #include <common.h>
 #include <nand.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <nand.h>
diff --git a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c
index 8615b11..9cca3c5 100644
--- a/drivers/mtd/nand/raw/lpc32xx_nand_slc.c
+++ b/drivers/mtd/nand/raw/lpc32xx_nand_slc.c
@@ -11,7 +11,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <nand.h>
+#include <linux/bug.h>
 #include <linux/mtd/nand_ecc.h>
 #include <linux/errno.h>
 #include <asm/io.h>
diff --git a/drivers/mtd/nand/raw/mxc_nand.c b/drivers/mtd/nand/raw/mxc_nand.c
index cf97e0f..59cef20 100644
--- a/drivers/mtd/nand/raw/mxc_nand.c
+++ b/drivers/mtd/nand/raw/mxc_nand.c
@@ -6,7 +6,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <nand.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <asm/io.h>
 #if defined(CONFIG_MX25) || defined(CONFIG_MX27) || defined(CONFIG_MX35) || \
diff --git a/drivers/mtd/nand/raw/mxs_nand.c b/drivers/mtd/nand/raw/mxs_nand.c
index e3516cd..a7852a8 100644
--- a/drivers/mtd/nand/raw/mxs_nand.c
+++ b/drivers/mtd/nand/raw/mxs_nand.c
@@ -16,6 +16,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <asm/cache.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/sizes.h>
 #include <linux/types.h>
diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c
index ae50cc3..46dc29d 100644
--- a/drivers/mtd/nand/raw/mxs_nand_spl.c
+++ b/drivers/mtd/nand/raw/mxs_nand_spl.c
@@ -5,9 +5,13 @@
  * Author: Tim Harvey <tharvey@gateworks.com>
  */
 #include <common.h>
+#include <log.h>
 #include <nand.h>
 #include <malloc.h>
 #include <mxs_nand.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 static struct mtd_info *mtd;
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 49d5e26..698968b 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -32,9 +32,13 @@
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 #include <fdtdec.h>
 #endif
+#include <log.h>
 #include <malloc.h>
 #include <watchdog.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c
index a6e6e0e..911472e 100644
--- a/drivers/mtd/nand/raw/nand_bbt.c
+++ b/drivers/mtd/nand/raw/nand_bbt.c
@@ -58,8 +58,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/devres.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/bbm.h>
diff --git a/drivers/mtd/nand/raw/nand_bch.c b/drivers/mtd/nand/raw/nand_bch.c
index 11a22e0..734d1c6 100644
--- a/drivers/mtd/nand/raw/nand_bch.c
+++ b/drivers/mtd/nand/raw/nand_bch.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <dm/devres.h>
 /*#include <asm/io.h>*/
 #include <linux/types.h>
diff --git a/drivers/mtd/nand/raw/nand_util.c b/drivers/mtd/nand/raw/nand_util.c
index f3c8f7f..5b74ef0 100644
--- a/drivers/mtd/nand/raw/nand_util.c
+++ b/drivers/mtd/nand/raw/nand_util.c
@@ -20,10 +20,12 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <watchdog.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <div64.h>
+#include <asm/cache.h>
 #include <dm/devres.h>
 
 #include <linux/errno.h>
diff --git a/drivers/mtd/nand/raw/omap_gpmc.c b/drivers/mtd/nand/raw/omap_gpmc.c
index 6a05050..97fd569 100644
--- a/drivers/mtd/nand/raw/omap_gpmc.c
+++ b/drivers/mtd/nand/raw/omap_gpmc.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <asm/arch/mem.h>
diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c
index 7e3346d..a30e821 100644
--- a/drivers/mtd/nand/raw/pxa3xx_nand.c
+++ b/drivers/mtd/nand/raw/pxa3xx_nand.c
@@ -12,6 +12,9 @@
 #include <nand.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <asm/io.h>
diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
index 1c212da..3306bd8 100644
--- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c
+++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c
@@ -7,8 +7,11 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <nand.h>
 #include <reset.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/iopoll.h>
 #include <linux/ioport.h>
diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c
index 9b99be1..004b6f1 100644
--- a/drivers/mtd/nand/raw/sunxi_nand.c
+++ b/drivers/mtd/nand/raw/sunxi_nand.c
@@ -31,6 +31,8 @@
 #include <nand.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 #include <linux/kernel.h>
diff --git a/drivers/mtd/nand/raw/sunxi_nand_spl.c b/drivers/mtd/nand/raw/sunxi_nand_spl.c
index 6cde981..85d8013 100644
--- a/drivers/mtd/nand/raw/sunxi_nand_spl.c
+++ b/drivers/mtd/nand/raw/sunxi_nand_spl.c
@@ -9,7 +9,9 @@
 #include <common.h>
 #include <config.h>
 #include <nand.h>
+#include <linux/bitops.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 
 /* registers */
 #define NFC_CTL                    0x00000000
diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c
index ae699d1..b9f5bdd 100644
--- a/drivers/mtd/nand/raw/tegra_nand.c
+++ b/drivers/mtd/nand/raw/tegra_nand.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <memalign.h>
 #include <nand.h>
@@ -14,6 +15,8 @@
 #include <asm/arch/funcmux.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <dm/device_compat.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <fdtdec.h>
diff --git a/drivers/mtd/nand/raw/zynq_nand.c b/drivers/mtd/nand/raw/zynq_nand.c
index 3941297..fa59455 100644
--- a/drivers/mtd/nand/raw/zynq_nand.c
+++ b/drivers/mtd/nand/raw/zynq_nand.c
@@ -7,8 +7,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <nand.h>
 #include <linux/ioport.h>
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 397dfa4..93371fd 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -26,6 +26,8 @@
 #include <spi-mem.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/mtd/spinand.h>
 #endif
 
diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
index 67d092b..215f09a 100644
--- a/drivers/mtd/nand/spi/macronix.c
+++ b/drivers/mtd/nand/spi/macronix.c
@@ -10,6 +10,7 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #endif
+#include <linux/bug.h>
 #include <linux/mtd/spinand.h>
 
 #define SPINAND_MFR_MACRONIX		0xC2
diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c
index 687306e..04de51c 100644
--- a/drivers/mtd/nand/spi/micron.c
+++ b/drivers/mtd/nand/spi/micron.c
@@ -11,6 +11,7 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #endif
+#include <linux/bitops.h>
 #include <linux/mtd/spinand.h>
 
 #define SPINAND_MFR_MICRON		0x2c
diff --git a/drivers/mtd/nand/spi/toshiba.c b/drivers/mtd/nand/spi/toshiba.c
index 77c2539..c4beefa 100644
--- a/drivers/mtd/nand/spi/toshiba.c
+++ b/drivers/mtd/nand/spi/toshiba.c
@@ -11,6 +11,7 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #endif
+#include <linux/bug.h>
 #include <linux/mtd/spinand.h>
 
 #define SPINAND_MFR_TOSHIBA		0x98
diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c
index 6ede98c..c119486 100644
--- a/drivers/mtd/nand/spi/winbond.c
+++ b/drivers/mtd/nand/spi/winbond.c
@@ -12,6 +12,7 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #endif
+#include <linux/bitops.h>
 #include <linux/mtd/spinand.h>
 
 #define SPINAND_MFR_WINBOND		0xEF
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 693bb78..36daef0 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -20,8 +20,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <watchdog.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>
 #include "linux/mtd/flashchip.h"
diff --git a/drivers/mtd/onenand/onenand_bbt.c b/drivers/mtd/onenand/onenand_bbt.c
index cde342a..eca9edf 100644
--- a/drivers/mtd/onenand/onenand_bbt.c
+++ b/drivers/mtd/onenand/onenand_bbt.c
@@ -15,6 +15,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/onenand.h>
diff --git a/drivers/mtd/onenand/onenand_spl.c b/drivers/mtd/onenand/onenand_spl.c
index c4983d1..ab6f1a8 100644
--- a/drivers/mtd/onenand/onenand_spl.c
+++ b/drivers/mtd/onenand/onenand_spl.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/mtd/onenand_regs.h>
 #include <onenand_uboot.h>
 
diff --git a/drivers/mtd/pic32_flash.c b/drivers/mtd/pic32_flash.c
index 8fff818..a58a2c4 100644
--- a/drivers/mtd/pic32_flash.c
+++ b/drivers/mtd/pic32_flash.c
@@ -10,7 +10,9 @@
 #include <dm.h>
 #include <fdt_support.h>
 #include <flash.h>
+#include <init.h>
 #include <irq_func.h>
+#include <linux/bitops.h>
 #include <mach/pic32.h>
 #include <wait_bit.h>
 
diff --git a/drivers/mtd/renesas_rpc_hf.c b/drivers/mtd/renesas_rpc_hf.c
index fc2aa22..65320c7 100644
--- a/drivers/mtd/renesas_rpc_hf.c
+++ b/drivers/mtd/renesas_rpc_hf.c
@@ -19,6 +19,7 @@
 #include <flash.h>
 #include <mtd.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
 #include <mtd/cfi_flash.h>
 
 #define RPC_CMNCR		0x0000	/* R/W */
diff --git a/drivers/mtd/spi/sandbox.c b/drivers/mtd/spi/sandbox.c
index 084c66e..8cbe97e 100644
--- a/drivers/mtd/spi/sandbox.c
+++ b/drivers/mtd/spi/sandbox.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <os.h>
diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c
index 5ebcca5..de369aa 100644
--- a/drivers/mtd/spi/sf-uclass.c
+++ b/drivers/mtd/spi/sf-uclass.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi_flash.h>
diff --git a/drivers/mtd/spi/sf_dataflash.c b/drivers/mtd/spi/sf_dataflash.c
index 55fb4bd..27d847d 100644
--- a/drivers/mtd/spi/sf_dataflash.c
+++ b/drivers/mtd/spi/sf_dataflash.c
@@ -10,9 +10,12 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <flash.h>
+#include <log.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <div64.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/math64.h>
 
diff --git a/drivers/mtd/spi/sf_internal.h b/drivers/mtd/spi/sf_internal.h
index 940b2e4..ce0cf4c 100644
--- a/drivers/mtd/spi/sf_internal.h
+++ b/drivers/mtd/spi/sf_internal.h
@@ -9,6 +9,7 @@
 #ifndef _SF_INTERNAL_H_
 #define _SF_INTERNAL_H_
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/compiler.h>
 
diff --git a/drivers/mtd/spi/sf_mtd.c b/drivers/mtd/spi/sf_mtd.c
index 68c3600..987fac2 100644
--- a/drivers/mtd/spi/sf_mtd.c
+++ b/drivers/mtd/spi/sf_mtd.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <malloc.h>
 #include <linux/errno.h>
 #include <linux/mtd/mtd.h>
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c
index 72b6ee7..c2e51f9 100644
--- a/drivers/mtd/spi/sf_probe.c
+++ b/drivers/mtd/spi/sf_probe.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi_flash.h>
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index 3d43614..56b44eb 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -10,8 +10,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/log2.h>
diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c
index ccc0ab0..55f86d5 100644
--- a/drivers/mtd/spi/spi-nor-tiny.c
+++ b/drivers/mtd/spi/spi-nor-tiny.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <linux/err.h>
 #include <linux/errno.h>
diff --git a/drivers/mtd/st_smi.c b/drivers/mtd/st_smi.c
index d29a715..7c652e6 100644
--- a/drivers/mtd/st_smi.c
+++ b/drivers/mtd/st_smi.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <flash.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mtd/st_smi.h>
 
diff --git a/drivers/mtd/stm32_flash.c b/drivers/mtd/stm32_flash.c
index fd0d550..95afa2d 100644
--- a/drivers/mtd/stm32_flash.c
+++ b/drivers/mtd/stm32_flash.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
 #include "stm32_flash.h"
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index f02a06f..e488caa 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -70,6 +70,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/err.h>
 #include <linux/slab.h>
@@ -78,6 +79,7 @@
 #include <u-boot/crc.h>
 #else
 #include <div64.h>
+#include <linux/bug.h>
 #include <linux/err.h>
 #endif
 
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 7de65bc..61e38ba 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -17,6 +17,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 8428278..9d4337b 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -29,6 +29,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/slab.h>
 #include <linux/crc32.h>
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index a3f5e3e..b54b563 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -7,6 +7,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc32.h>
 #include <linux/err.h>
@@ -15,6 +16,7 @@
 #include <div64.h>
 #include <malloc.h>
 #include <ubi_uboot.h>
+#include <linux/bug.h>
 #endif
 
 #include <linux/compat.h>
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 8ba22d8..b8b878b 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -74,6 +74,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc32.h>
 #include <linux/err.h>
diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c
index 3f7ee59..81275de 100644
--- a/drivers/mtd/ubi/misc.c
+++ b/drivers/mtd/ubi/misc.c
@@ -7,6 +7,7 @@
 
 /* Here we keep miscellaneous functions which are used all over the UBI code */
 
+#include <log.h>
 #include <malloc.h>
 #include <ubi_uboot.h>
 #include "ubi.h"
diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c
index 0f7951c..28a362a 100644
--- a/drivers/mtd/ubi/upd.c
+++ b/drivers/mtd/ubi/upd.c
@@ -26,6 +26,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <malloc.h>
 #include <linux/uaccess.h>
 #else
diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c
index 2114abb..0bfedd0 100644
--- a/drivers/mtd/ubi/vmt.c
+++ b/drivers/mtd/ubi/vmt.c
@@ -11,6 +11,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/err.h>
 #include <linux/slab.h>
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index 123c2f3..a2b5352 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -46,6 +46,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc32.h>
 #include <linux/err.h>
@@ -54,6 +55,7 @@
 #include <u-boot/crc.h>
 #else
 #include <ubi_uboot.h>
+#include <linux/bug.h>
 #endif
 
 #include <linux/err.h>
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c
index 4038b7f..bae4024 100644
--- a/drivers/mtd/ubi/wl.c
+++ b/drivers/mtd/ubi/wl.c
@@ -86,6 +86,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/slab.h>
 #include <linux/crc32.h>
diff --git a/drivers/mtd/ubispl/ubispl.c b/drivers/mtd/ubispl/ubispl.c
index 00102fc..03b31f0 100644
--- a/drivers/mtd/ubispl/ubispl.c
+++ b/drivers/mtd/ubispl/ubispl.c
@@ -9,9 +9,11 @@
 
 #include <common.h>
 #include <errno.h>
+#include <linux/bug.h>
 #include <u-boot/crc.h>
 #include <ubispl.h>
 
+#include <linux/bitops.h>
 #include <linux/crc32.h>
 
 #include "ubispl.h"
diff --git a/drivers/net/ag7xxx.c b/drivers/net/ag7xxx.c
index e3a7222..3b5d11f 100644
--- a/drivers/net/ag7xxx.c
+++ b/drivers/net/ag7xxx.c
@@ -11,9 +11,14 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <miiphy.h>
 #include <malloc.h>
+#include <net.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mii.h>
 #include <wait_bit.h>
diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index a511068..93b26da 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -13,6 +13,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <memalign.h>
 #include <miiphy.h>
 #include <net.h>
diff --git a/drivers/net/altera_tse.h b/drivers/net/altera_tse.h
index 2b1af81..79509b8 100644
--- a/drivers/net/altera_tse.h
+++ b/drivers/net/altera_tse.h
@@ -11,6 +11,7 @@
 #ifndef _ALTERA_TSE_H_
 #define _ALTERA_TSE_H_
 
+#include <linux/bitops.h>
 #define __packed_1_    __packed __aligned(1)
 
 /* dma type */
diff --git a/drivers/net/armada100_fec.c b/drivers/net/armada100_fec.c
index da6662c..3ee119b 100644
--- a/drivers/net/armada100_fec.c
+++ b/drivers/net/armada100_fec.c
@@ -10,12 +10,14 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <netdev.h>
 #include <asm/types.h>
 #include <asm/byteorder.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/mii.h>
 #include <asm/io.h>
diff --git a/drivers/net/at91_emac.c b/drivers/net/at91_emac.c
index 3233478..4e4ad61 100644
--- a/drivers/net/at91_emac.c
+++ b/drivers/net/at91_emac.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_emac.h>
@@ -17,6 +18,7 @@
 #include <netdev.h>
 #include <malloc.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 
 #undef MII_DEBUG
diff --git a/drivers/net/ax88180.c b/drivers/net/ax88180.c
index 261fde0..28cb412 100644
--- a/drivers/net/ax88180.c
+++ b/drivers/net/ax88180.c
@@ -39,8 +39,10 @@
  */
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include "ax88180.h"
 
@@ -117,7 +119,7 @@
 
 	/* Wait for the reset to complete, or time out (500 ms) */
 	while (ax88180_mdio_read (dev, MII_BMCR) & BMCR_RESET) {
-		udelay (1000);
+		udelay(1000);
 		if (--delay_cnt == 0) {
 			printf ("Failed to reset PHY!\n");
 			return -1;
@@ -176,7 +178,7 @@
 		if ((tmpval & txbs_txdp) == 0)
 			break;
 
-		udelay (100);
+		udelay(100);
 	}
 
 	if (TimeOutCnt)
@@ -341,7 +343,7 @@
 		if (bmsr_val & BMSR_LSTATUS) {
 			break;
 		}
-		udelay (100);
+		udelay(100);
 	}
 
 	bmsr_val = ax88180_mdio_read (dev, MII_BMSR);
@@ -363,7 +365,7 @@
 				if (bmsr_val & BMSR_ANEGCOMPLETE) {
 					break;
 				}
-				udelay (100);
+				udelay(100);
 			}
 		} else
 			debug ("ax88180: Auto-negotiation is disabled.\n");
@@ -679,7 +681,7 @@
 		tmp_regval = INW (dev, PROMCTRL);
 		if ((tmp_regval & RELOAD_EEPROM) == 0)
 			break;
-		udelay (1000);
+		udelay(1000);
 	}
 
 	/* Get MAC addresses */
diff --git a/drivers/net/ax88796.c b/drivers/net/ax88796.c
index 01c1ae2..d161f0e 100644
--- a/drivers/net/ax88796.c
+++ b/drivers/net/ax88796.c
@@ -3,6 +3,7 @@
  * (c) 2007 Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
  */
 #include <common.h>
+#include <linux/delay.h>
 #include "ax88796.h"
 
 /*
diff --git a/drivers/net/bcm-sf2-eth-gmac.c b/drivers/net/bcm-sf2-eth-gmac.c
index 6a25f67..3caf0f3 100644
--- a/drivers/net/bcm-sf2-eth-gmac.c
+++ b/drivers/net/bcm-sf2-eth-gmac.c
@@ -12,10 +12,14 @@
 #include <config.h>
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <phy.h>
+#include <linux/delay.h>
+#include <linux/bitops.h>
 
 #include "bcm-sf2-eth.h"
 #include "bcm-sf2-eth-gmac.h"
diff --git a/drivers/net/bcm-sf2-eth.c b/drivers/net/bcm-sf2-eth.c
index 11f9370..2998d57 100644
--- a/drivers/net/bcm-sf2-eth.c
+++ b/drivers/net/bcm-sf2-eth.c
@@ -4,9 +4,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <config.h>
+#include <linux/delay.h>
 
 #include <phy.h>
 #include <miiphy.h>
diff --git a/drivers/net/bcm6348-eth.c b/drivers/net/bcm6348-eth.c
index fe35329..9ddc0f9 100644
--- a/drivers/net/bcm6348-eth.c
+++ b/drivers/net/bcm6348-eth.c
@@ -10,6 +10,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <dma.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <net.h>
diff --git a/drivers/net/bcm6368-eth.c b/drivers/net/bcm6368-eth.c
index 1200049..648fafd 100644
--- a/drivers/net/bcm6368-eth.c
+++ b/drivers/net/bcm6368-eth.c
@@ -10,6 +10,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <dma.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <net.h>
@@ -17,6 +18,7 @@
 #include <wait_bit.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 
 #define ETH_PORT_STR			"brcm,enetsw-port"
 
diff --git a/drivers/net/bcmgenet.c b/drivers/net/bcmgenet.c
index e971b55..11b6148 100644
--- a/drivers/net/bcmgenet.c
+++ b/drivers/net/bcmgenet.c
@@ -16,11 +16,15 @@
  * we only support v5, as used in the Raspberry Pi 4.
  */
 
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <clk.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <malloc.h>
 #include <miiphy.h>
diff --git a/drivers/net/calxedaxgmac.c b/drivers/net/calxedaxgmac.c
index 1b7c94f..5dad69c 100644
--- a/drivers/net/calxedaxgmac.c
+++ b/drivers/net/calxedaxgmac.c
@@ -5,7 +5,9 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <net.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <asm/io.h>
 
diff --git a/drivers/net/cs8900.c b/drivers/net/cs8900.c
index 9331cdf..7ec95be 100644
--- a/drivers/net/cs8900.c
+++ b/drivers/net/cs8900.c
@@ -25,9 +25,11 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <asm/io.h>
 #include <net.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include "cs8900.h"
 
 #undef DEBUG
diff --git a/drivers/net/dc2114x.c b/drivers/net/dc2114x.c
index d008696..c55358e 100644
--- a/drivers/net/dc2114x.c
+++ b/drivers/net/dc2114x.c
@@ -6,6 +6,8 @@
 #include <net.h>
 #include <netdev.h>
 #include <pci.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define SROM_DLEVEL	0
 
diff --git a/drivers/net/designware.c b/drivers/net/designware.c
index baac277..b89a68a 100644
--- a/drivers/net/designware.c
+++ b/drivers/net/designware.c
@@ -13,13 +13,17 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <miiphy.h>
 #include <malloc.h>
+#include <net.h>
 #include <pci.h>
 #include <reset.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <asm/io.h>
diff --git a/drivers/net/designware.h b/drivers/net/designware.h
index 3519a41..ffaf5a1 100644
--- a/drivers/net/designware.h
+++ b/drivers/net/designware.h
@@ -7,6 +7,9 @@
 #ifndef _DW_ETH_H
 #define _DW_ETH_H
 
+#include <asm/cache.h>
+#include <net.h>
+
 #if CONFIG_IS_ENABLED(DM_GPIO)
 #include <asm-generic/gpio.h>
 #endif
diff --git a/drivers/net/dm9000x.c b/drivers/net/dm9000x.c
index a6c0a24..d575a62 100644
--- a/drivers/net/dm9000x.c
+++ b/drivers/net/dm9000x.c
@@ -54,6 +54,7 @@
 #include <net.h>
 #include <asm/io.h>
 #include <dm9000.h>
+#include <linux/delay.h>
 
 #include "dm9000x.h"
 
diff --git a/drivers/net/dnet.c b/drivers/net/dnet.c
index 933d1fc..98e9b2c 100644
--- a/drivers/net/dnet.c
+++ b/drivers/net/dnet.c
@@ -9,6 +9,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 
 #ifndef CONFIG_DNET_AUTONEG_TIMEOUT
 #define CONFIG_DNET_AUTONEG_TIMEOUT	5000000	/* default value */
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c
index f67c5f4..3f44370 100644
--- a/drivers/net/dwc_eth_qos.c
+++ b/drivers/net/dwc_eth_qos.c
@@ -31,6 +31,7 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <miiphy.h>
@@ -39,6 +40,7 @@
 #include <phy.h>
 #include <reset.h>
 #include <wait_bit.h>
+#include <asm/cache.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <eth_phy.h>
@@ -46,6 +48,8 @@
 #include <asm/arch/clock.h>
 #include <asm/mach-imx/sys_proto.h>
 #endif
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* Core registers */
 
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 9212920..008da4a 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -30,13 +30,18 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <net.h>
 #include <pci.h>
+#include <linux/delay.h>
 #include "e1000.h"
+#include <asm/cache.h>
 
 #define TOUT_LOOP   100000
 
@@ -5759,8 +5764,8 @@
 #endif /* !CONFIG_DM_ETH */
 
 #ifdef CONFIG_CMD_E1000
-static int do_e1000(cmd_tbl_t *cmdtp, int flag,
-		int argc, char * const argv[])
+static int do_e1000(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	unsigned char *mac = NULL;
 #ifdef CONFIG_DM_ETH
diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
index 2ae3085..19ed477 100644
--- a/drivers/net/e1000.h
+++ b/drivers/net/e1000.h
@@ -74,8 +74,8 @@
 #endif
 
 #ifdef CONFIG_E1000_SPI
-int do_e1000_spi(cmd_tbl_t *cmdtp, struct e1000_hw *hw,
-		int argc, char * const argv[]);
+int do_e1000_spi(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
+		 int argc, char *const argv[]);
 #endif
 
 /* Enumerated types specific to the e1000 hardware */
diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c
index 52b3c79..4fcc65d 100644
--- a/drivers/net/e1000_spi.c
+++ b/drivers/net/e1000_spi.c
@@ -1,5 +1,7 @@
 #include <common.h>
+#include <command.h>
 #include <console.h>
+#include <linux/delay.h>
 #include "e1000.h"
 #include <malloc.h>
 #include <linux/compiler.h>
@@ -315,8 +317,8 @@
 	return 0;
 }
 
-static int do_e1000_spi_show(cmd_tbl_t *cmdtp, struct e1000_hw *hw,
-		int argc, char * const argv[])
+static int do_e1000_spi_show(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
+			     int argc, char *const argv[])
 {
 	unsigned int length = 0;
 	u16 i, offset = 0;
@@ -384,8 +386,8 @@
 	return 0;
 }
 
-static int do_e1000_spi_dump(cmd_tbl_t *cmdtp, struct e1000_hw *hw,
-		int argc, char * const argv[])
+static int do_e1000_spi_dump(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
+			     int argc, char *const argv[])
 {
 	unsigned int length;
 	u16 offset;
@@ -429,8 +431,8 @@
 	return 0;
 }
 
-static int do_e1000_spi_program(cmd_tbl_t *cmdtp, struct e1000_hw *hw,
-		int argc, char * const argv[])
+static int do_e1000_spi_program(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
+				int argc, char *const argv[])
 {
 	unsigned int length;
 	const void *source;
@@ -464,8 +466,8 @@
 	return 0;
 }
 
-static int do_e1000_spi_checksum(cmd_tbl_t *cmdtp, struct e1000_hw *hw,
-		int argc, char * const argv[])
+static int do_e1000_spi_checksum(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
+				 int argc, char *const argv[])
 {
 	uint16_t i, length, checksum = 0, checksum_reg;
 	uint16_t *buffer;
@@ -540,8 +542,8 @@
 	return 0;
 }
 
-int do_e1000_spi(cmd_tbl_t *cmdtp, struct e1000_hw *hw,
-		int argc, char * const argv[])
+int do_e1000_spi(struct cmd_tbl *cmdtp, struct e1000_hw *hw,
+		 int argc, char *const argv[])
 {
 	if (argc < 1) {
 		cmd_usage(cmdtp);
diff --git a/drivers/net/eepro100.c b/drivers/net/eepro100.c
index 2fe0ba6..e186ab4 100644
--- a/drivers/net/eepro100.c
+++ b/drivers/net/eepro100.c
@@ -11,6 +11,7 @@
 #include <asm/io.h>
 #include <pci.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 
 #undef DEBUG
 
@@ -462,7 +463,7 @@
 		 */
 		pci_write_config_byte (devno, PCI_LATENCY_TIMER, 0x20);
 
-		udelay (10 * 1000);
+		udelay(10 * 1000);
 
 		read_hw_addr (dev, bis);
 	}
@@ -480,10 +481,10 @@
 	/* Reset the ethernet controller
 	 */
 	OUTL (dev, I82559_SELECTIVE_RESET, SCBPort);
-	udelay (20);
+	udelay(20);
 
 	OUTL (dev, I82559_RESET, SCBPort);
-	udelay (20);
+	udelay(20);
 
 	if (!wait_for_eepro100 (dev)) {
 		printf ("Error: Can not reset ethernet controller.\n");
@@ -721,10 +722,10 @@
 	/* Reset the ethernet controller
 	 */
 	OUTL (dev, I82559_SELECTIVE_RESET, SCBPort);
-	udelay (20);
+	udelay(20);
 
 	OUTL (dev, I82559_RESET, SCBPort);
-	udelay (20);
+	udelay(20);
 
 	if (!wait_for_eepro100 (dev)) {
 		printf ("Error: Can not reset ethernet controller.\n");
@@ -760,19 +761,19 @@
 		short dataval = (read_cmd & (1 << i)) ? EE_DATA_WRITE : 0;
 
 		OUTW (dev, EE_ENB | dataval, SCBeeprom);
-		udelay (1);
+		udelay(1);
 		OUTW (dev, EE_ENB | dataval | EE_SHIFT_CLK, SCBeeprom);
-		udelay (1);
+		udelay(1);
 	}
 	OUTW (dev, EE_ENB, SCBeeprom);
 
 	for (i = 15; i >= 0; i--) {
 		OUTW (dev, EE_ENB | EE_SHIFT_CLK, SCBeeprom);
-		udelay (1);
+		udelay(1);
 		retval = (retval << 1) |
 				((INW (dev, SCBeeprom) & EE_DATA_READ) ? 1 : 0);
 		OUTW (dev, EE_ENB, SCBeeprom);
-		udelay (1);
+		udelay(1);
 	}
 
 	/* Terminate the EEPROM access. */
diff --git a/drivers/net/ep93xx_eth.c b/drivers/net/ep93xx_eth.c
index ecb34b2..894ffc9 100644
--- a/drivers/net/ep93xx_eth.c
+++ b/drivers/net/ep93xx_eth.c
@@ -18,10 +18,13 @@
 
 #include <command.h>
 #include <common.h>
+#include <log.h>
+#include <net.h>
 #include <asm/arch/ep93xx.h>
 #include <asm/io.h>
 #include <malloc.h>
 #include <miiphy.h>
+#include <linux/bug.h>
 #include <linux/types.h>
 #include "ep93xx_eth.h"
 
diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index be5d9ad..81d0f3d 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/platform_data/net_ethoc.h>
 #include <linux/io.h>
 #include <malloc.h>
diff --git a/drivers/net/fec_mxc.c b/drivers/net/fec_mxc.c
index 910c961..9ae2db0 100644
--- a/drivers/net/fec_mxc.c
+++ b/drivers/net/fec_mxc.c
@@ -11,11 +11,14 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <miiphy.h>
 #include <net.h>
 #include <netdev.h>
+#include <asm/cache.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 #include <asm/io.h>
diff --git a/drivers/net/fm/dtsec.c b/drivers/net/fm/dtsec.c
index 4c78a4d..c51a65c 100644
--- a/drivers/net/fm/dtsec.c
+++ b/drivers/net/fm/dtsec.c
@@ -9,6 +9,7 @@
 #include <fsl_dtsec.h>
 #include <fsl_mdio.h>
 #include <phy.h>
+#include <linux/delay.h>
 
 #include "fm.h"
 
diff --git a/drivers/net/fm/eth.c b/drivers/net/fm/eth.c
index 5f1a023..81a4cf2 100644
--- a/drivers/net/fm/eth.c
+++ b/drivers/net/fm/eth.c
@@ -5,6 +5,8 @@
  *	Dave Liu <daveliu@freescale.com>
  */
 #include <common.h>
+#include <log.h>
+#include <part.h>
 #include <asm/io.h>
 #ifdef CONFIG_DM_ETH
 #include <dm.h>
@@ -22,6 +24,7 @@
 #include <fsl_dtsec.h>
 #include <fsl_tgec.h>
 #include <fsl_memac.h>
+#include <linux/delay.h>
 
 #include "fm.h"
 
diff --git a/drivers/net/fm/fdt.c b/drivers/net/fm/fdt.c
index a6b0d87..242d27a 100644
--- a/drivers/net/fm/fdt.c
+++ b/drivers/net/fm/fdt.c
@@ -4,6 +4,7 @@
  */
 #include <asm/io.h>
 #include <env.h>
+#include <fdt_support.h>
 #include <fsl_qe.h>	/* For struct qe_firmware */
 #include <u-boot/crc.h>
 
diff --git a/drivers/net/fm/init.c b/drivers/net/fm/init.c
index 8669d21..2cc8bbf 100644
--- a/drivers/net/fm/init.c
+++ b/drivers/net/fm/init.c
@@ -4,11 +4,13 @@
  */
 #include <errno.h>
 #include <common.h>
+#include <net.h>
 #include <asm/io.h>
 #include <fdt_support.h>
 #include <fsl_mdio.h>
 #ifdef CONFIG_FSL_LAYERSCAPE
 #include <asm/arch/fsl_serdes.h>
+#include <linux/libfdt.h>
 #else
 #include <asm/fsl_serdes.h>
 #endif
diff --git a/drivers/net/fm/memac.c b/drivers/net/fm/memac.c
index 77ea083..0f0f7b0 100644
--- a/drivers/net/fm/memac.c
+++ b/drivers/net/fm/memac.c
@@ -8,6 +8,7 @@
 #define MAXFRM_MASK	0x0000ffff
 
 #include <common.h>
+#include <log.h>
 #include <phy.h>
 #include <asm/types.h>
 #include <asm/io.h>
diff --git a/drivers/net/fm/tgec.c b/drivers/net/fm/tgec.c
index 9f2f6f6..9cc9f3f 100644
--- a/drivers/net/fm/tgec.c
+++ b/drivers/net/fm/tgec.c
@@ -12,6 +12,7 @@
 #include <asm/types.h>
 #include <asm/io.h>
 #include <fsl_tgec.h>
+#include <linux/delay.h>
 
 #include "fm.h"
 
diff --git a/drivers/net/fsl-mc/dpio/qbman_portal.c b/drivers/net/fsl-mc/dpio/qbman_portal.c
index e161b4e..44ce000 100644
--- a/drivers/net/fsl-mc/dpio/qbman_portal.c
+++ b/drivers/net/fsl-mc/dpio/qbman_portal.c
@@ -3,8 +3,10 @@
  * Copyright (C) 2014 Freescale Semiconductor
  */
 
+#include <log.h>
 #include <malloc.h>
 #include <asm/arch/clock.h>
+#include <linux/bug.h>
 #include "qbman_portal.h"
 
 /* QBMan portal management command codes */
diff --git a/drivers/net/fsl-mc/dpio/qbman_private.h b/drivers/net/fsl-mc/dpio/qbman_private.h
index ded11a6..53f1300 100644
--- a/drivers/net/fsl-mc/dpio/qbman_private.h
+++ b/drivers/net/fsl-mc/dpio/qbman_private.h
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <errno.h>
 #include <asm/io.h>
+#include <linux/bug.h>
 #include <linux/types.h>
 #include <asm/atomic.h>
 #include <malloc.h>
diff --git a/drivers/net/fsl-mc/dpio/qbman_sys.h b/drivers/net/fsl-mc/dpio/qbman_sys.h
index cdced68..8be38e1 100644
--- a/drivers/net/fsl-mc/dpio/qbman_sys.h
+++ b/drivers/net/fsl-mc/dpio/qbman_sys.h
@@ -20,6 +20,7 @@
 
 /* Trace the 3 different classes of read/write access to QBMan. #undef as
  * required. */
+#include <linux/bug.h>
 #undef QBMAN_CCSR_TRACE
 #undef QBMAN_CINH_TRACE
 #undef QBMAN_CENA_TRACE
diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c
index fee3729..1c03427 100644
--- a/drivers/net/fsl-mc/mc.c
+++ b/drivers/net/fsl-mc/mc.c
@@ -8,9 +8,12 @@
 #include <cpu_func.h>
 #include <env.h>
 #include <errno.h>
+#include <image.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/bug.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <net.h>
 #include <fdt_support.h>
@@ -1744,7 +1747,8 @@
 	return err;
 }
 
-static int do_fsl_mc(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_fsl_mc(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	int err = 0;
 	if (argc < 3)
diff --git a/drivers/net/fsl-mc/mc_sys.c b/drivers/net/fsl-mc/mc_sys.c
index fddf5cb..b5ae2ea 100644
--- a/drivers/net/fsl-mc/mc_sys.c
+++ b/drivers/net/fsl-mc/mc_sys.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <errno.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #define MC_CMD_HDR_READ_CMDID(_hdr) \
 	((uint16_t)mc_dec((_hdr), MC_CMD_HDR_CMDID_O, MC_CMD_HDR_CMDID_S))
diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c
index bee7315..2929ae7 100644
--- a/drivers/net/fsl_enetc.c
+++ b/drivers/net/fsl_enetc.c
@@ -7,11 +7,16 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <fdt_support.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <net.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <pci.h>
 #include <miiphy.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 
 #include "fsl_enetc.h"
 
diff --git a/drivers/net/fsl_enetc.h b/drivers/net/fsl_enetc.h
index 48c3005..37e7e85 100644
--- a/drivers/net/fsl_enetc.h
+++ b/drivers/net/fsl_enetc.h
@@ -7,6 +7,7 @@
 #ifndef _ENETC_H
 #define _ENETC_H
 
+#include <linux/bitops.h>
 #define enetc_dbg(dev, fmt, args...)	debug("%s:" fmt, dev->name, ##args)
 
 /* PCI function IDs */
diff --git a/drivers/net/fsl_mcdmafec.c b/drivers/net/fsl_mcdmafec.c
index 45954ce..73e92b7 100644
--- a/drivers/net/fsl_mcdmafec.c
+++ b/drivers/net/fsl_mcdmafec.c
@@ -18,6 +18,7 @@
 #include <config.h>
 #include <net.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <asm/immap.h>
 #include <asm/fsl_mcdmafec.h>
diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c
index 40e6b3b..e4d08f2 100644
--- a/drivers/net/ftgmac100.c
+++ b/drivers/net/ftgmac100.c
@@ -11,14 +11,18 @@
  * Copyright (C) 2018, IBM Corporation.
  */
 
+#include <common.h>
 #include <clk.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <net.h>
 #include <wait_bit.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 
diff --git a/drivers/net/ftgmac100.h b/drivers/net/ftgmac100.h
index 9a789e4..f7874ae 100644
--- a/drivers/net/ftgmac100.h
+++ b/drivers/net/ftgmac100.h
@@ -13,6 +13,7 @@
 #define __FTGMAC100_H
 
 /* The registers offset table of ftgmac100 */
+#include <linux/bitops.h>
 struct ftgmac100 {
 	unsigned int	isr;		/* 0x00 */
 	unsigned int	ier;		/* 0x04 */
diff --git a/drivers/net/ftmac100.c b/drivers/net/ftmac100.c
index 24bb45f..4aae7c4 100644
--- a/drivers/net/ftmac100.c
+++ b/drivers/net/ftmac100.c
@@ -12,6 +12,7 @@
 #include <env.h>
 #include <malloc.h>
 #include <net.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 
 #include "ftmac100.h"
diff --git a/drivers/net/ftmac110.c b/drivers/net/ftmac110.c
index 8408240..835346c 100644
--- a/drivers/net/ftmac110.c
+++ b/drivers/net/ftmac110.c
@@ -8,8 +8,10 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
+#include <asm/cache.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <linux/dma-mapping.h>
diff --git a/drivers/net/gmac_rockchip.c b/drivers/net/gmac_rockchip.c
index e152faf..8d95ee1 100644
--- a/drivers/net/gmac_rockchip.c
+++ b/drivers/net/gmac_rockchip.c
@@ -8,6 +8,8 @@
 #include <common.h>
 #include <dm.h>
 #include <clk.h>
+#include <log.h>
+#include <net.h>
 #include <phy.h>
 #include <syscon.h>
 #include <asm/io.h>
@@ -24,6 +26,7 @@
 #include <asm/arch-rockchip/grf_rv1108.h>
 #include <dm/pinctrl.h>
 #include <dt-bindings/clock/rk3288-cru.h>
+#include <linux/bitops.h>
 #include "designware.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/net/higmacv300.c b/drivers/net/higmacv300.c
index 0c1dd68..2aae7f4 100644
--- a/drivers/net/higmacv300.c
+++ b/drivers/net/higmacv300.c
@@ -4,11 +4,15 @@
  */
 
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <common.h>
 #include <console.h>
+#include <linux/bitops.h>
 #include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <miiphy.h>
 #include <net.h>
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 718a7dd..6643d1e 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -4,12 +4,14 @@
  * Copyright (c) 2011 Roberto Cerati <roberto.cerati@bticino.it>
  */
 
+#include <log.h>
 #include <asm/io.h>
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
 #include <net.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 
 #include "ks8851_mll.h"
 
diff --git a/drivers/net/lan91c96.c b/drivers/net/lan91c96.c
index c08bd21..13900f1 100644
--- a/drivers/net/lan91c96.c
+++ b/drivers/net/lan91c96.c
@@ -48,6 +48,7 @@
 #include <command.h>
 #include <env.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include "lan91c96.h"
 #include <net.h>
 #include <linux/compiler.h>
@@ -211,7 +212,7 @@
 	SMC_SELECT_BANK(dev, 0);
 	SMC_outw(dev, LAN91C96_RCR_SOFT_RST, LAN91C96_RCR);
 
-	udelay (10);
+	udelay(10);
 
 	/* Disable transmit and receive functionality */
 	SMC_outw(dev, 0, LAN91C96_RCR);
@@ -438,7 +439,7 @@
 
 		/* wait for MMU getting ready (low) */
 		while (SMC_inw(dev, LAN91C96_MMU) & LAN91C96_MMUCR_NO_BUSY)
-			udelay (10);
+			udelay(10);
 
 		PRINTK2("MMU ready\n");
 
@@ -455,7 +456,7 @@
 
 		/* wait for MMU getting ready (low) */
 		while (SMC_inw(dev, LAN91C96_MMU) & LAN91C96_MMUCR_NO_BUSY)
-			udelay (10);
+			udelay(10);
 
 		PRINTK2 ("MMU ready\n");
 	}
@@ -600,13 +601,13 @@
 	}
 
 	while (SMC_inw(dev, LAN91C96_MMU) & LAN91C96_MMUCR_NO_BUSY)
-		udelay (1);		/* Wait until not busy */
+		udelay(1);		/* Wait until not busy */
 
 	/*  error or good, tell the card to get rid of this packet */
 	SMC_outw(dev, LAN91C96_MMUCR_RELEASE_RX, LAN91C96_MMU);
 
 	while (SMC_inw(dev, LAN91C96_MMU) & LAN91C96_MMUCR_NO_BUSY)
-		udelay (1);		/* Wait until not busy */
+		udelay(1);		/* Wait until not busy */
 
 	if (!is_error) {
 		/* Pass the packet up to the protocol layers. */
diff --git a/drivers/net/ldpaa_eth/ldpaa_eth.c b/drivers/net/ldpaa_eth/ldpaa_eth.c
index 48343dc..116b307 100644
--- a/drivers/net/ldpaa_eth/ldpaa_eth.c
+++ b/drivers/net/ldpaa_eth/ldpaa_eth.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/types.h>
 #include <malloc.h>
@@ -13,8 +14,10 @@
 #include <hwconfig.h>
 #include <phy.h>
 #include <miiphy.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <fsl-mc/fsl_dpmac.h>
+#include <linux/delay.h>
 
 #include <fsl-mc/ldpaa_wriop.h>
 #include "ldpaa_eth.h"
diff --git a/drivers/net/lpc32xx_eth.c b/drivers/net/lpc32xx_eth.c
index ec5184e..f68daaa 100644
--- a/drivers/net/lpc32xx_eth.c
+++ b/drivers/net/lpc32xx_eth.c
@@ -7,10 +7,12 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/types.h>
 #include <asm/system.h>
diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index bd588ca..424ca59 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -6,6 +6,8 @@
 #include <clk.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/delay.h>
 
 /*
  * The u-boot networking stack is a little weird.  It seems like the
diff --git a/drivers/net/mcffec.c b/drivers/net/mcffec.c
index 8caf0ba..6975493 100644
--- a/drivers/net/mcffec.c
+++ b/drivers/net/mcffec.c
@@ -19,6 +19,7 @@
 #include <miiphy.h>
 #include <asm/fec.h>
 #include <asm/immap.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 
 #undef	ET_DEBUG
diff --git a/drivers/net/mcfmii.c b/drivers/net/mcfmii.c
index 3b8ee07..3936055 100644
--- a/drivers/net/mcfmii.c
+++ b/drivers/net/mcfmii.c
@@ -8,6 +8,7 @@
 #include <config.h>
 #include <net.h>
 #include <netdev.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_MCF547x_8x
 #include <asm/fsl_mcdmafec.h>
diff --git a/drivers/net/mdio_mux_i2creg.c b/drivers/net/mdio_mux_i2creg.c
index 3e82898..cc02b5f 100644
--- a/drivers/net/mdio_mux_i2creg.c
+++ b/drivers/net/mdio_mux_i2creg.c
@@ -6,6 +6,7 @@
 
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <miiphy.h>
 #include <i2c.h>
 
diff --git a/drivers/net/mpc8xx_fec.c b/drivers/net/mpc8xx_fec.c
index 69b2174..f9f7dd7 100644
--- a/drivers/net/mpc8xx_fec.c
+++ b/drivers/net/mpc8xx_fec.c
@@ -12,6 +12,7 @@
 #include <netdev.h>
 #include <asm/cpm_8xx.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #include <phy.h>
 #include <linux/mii.h>
diff --git a/drivers/net/mscc_eswitch/jr2_switch.c b/drivers/net/mscc_eswitch/jr2_switch.c
index 33dd002..1c9a401 100644
--- a/drivers/net/mscc_eswitch/jr2_switch.c
+++ b/drivers/net/mscc_eswitch/jr2_switch.c
@@ -10,6 +10,8 @@
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <miiphy.h>
diff --git a/drivers/net/mscc_eswitch/luton_switch.c b/drivers/net/mscc_eswitch/luton_switch.c
index 9d24c00..1d46d0e 100644
--- a/drivers/net/mscc_eswitch/luton_switch.c
+++ b/drivers/net/mscc_eswitch/luton_switch.c
@@ -10,6 +10,7 @@
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <miiphy.h>
diff --git a/drivers/net/mscc_eswitch/mscc_mac_table.c b/drivers/net/mscc_eswitch/mscc_mac_table.c
index 833e233..25b9cad 100644
--- a/drivers/net/mscc_eswitch/mscc_mac_table.c
+++ b/drivers/net/mscc_eswitch/mscc_mac_table.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2018 Microsemi Corporation
  */
 
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include "mscc_mac_table.h"
 
diff --git a/drivers/net/mscc_eswitch/mscc_miim.c b/drivers/net/mscc_eswitch/mscc_miim.c
index d8ee8df..6687787 100644
--- a/drivers/net/mscc_eswitch/mscc_miim.c
+++ b/drivers/net/mscc_eswitch/mscc_miim.c
@@ -5,6 +5,7 @@
 
 #include <miiphy.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
 #include "mscc_miim.h"
 
 #define MIIM_STATUS			0x0
diff --git a/drivers/net/mscc_eswitch/mscc_xfer.c b/drivers/net/mscc_eswitch/mscc_xfer.c
index f412901..6f74746 100644
--- a/drivers/net/mscc_eswitch/mscc_xfer.c
+++ b/drivers/net/mscc_eswitch/mscc_xfer.c
@@ -3,6 +3,9 @@
  * Copyright (c) 2018 Microsemi Corporation
  */
 
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include "mscc_xfer.h"
 
diff --git a/drivers/net/mscc_eswitch/ocelot_switch.c b/drivers/net/mscc_eswitch/ocelot_switch.c
index fe48f37..2a48dc6 100644
--- a/drivers/net/mscc_eswitch/ocelot_switch.c
+++ b/drivers/net/mscc_eswitch/ocelot_switch.c
@@ -6,10 +6,12 @@
 #include <common.h>
 #include <config.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <miiphy.h>
diff --git a/drivers/net/mscc_eswitch/serval_switch.c b/drivers/net/mscc_eswitch/serval_switch.c
index f05fa42..d8ee1a7 100644
--- a/drivers/net/mscc_eswitch/serval_switch.c
+++ b/drivers/net/mscc_eswitch/serval_switch.c
@@ -6,10 +6,12 @@
 #include <common.h>
 #include <config.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <miiphy.h>
diff --git a/drivers/net/mscc_eswitch/servalt_switch.c b/drivers/net/mscc_eswitch/servalt_switch.c
index bf95a38..1cf2273 100644
--- a/drivers/net/mscc_eswitch/servalt_switch.c
+++ b/drivers/net/mscc_eswitch/servalt_switch.c
@@ -10,6 +10,7 @@
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/ioport.h>
 #include <miiphy.h>
diff --git a/drivers/net/mt7628-eth.c b/drivers/net/mt7628-eth.c
index 404a046..64f1c8c 100644
--- a/drivers/net/mt7628-eth.c
+++ b/drivers/net/mt7628-eth.c
@@ -16,13 +16,17 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <net.h>
 #include <reset.h>
 #include <wait_bit.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 /* Ethernet frame engine register */
diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c
index 5ffcc53..86f1360 100644
--- a/drivers/net/mtk_eth.c
+++ b/drivers/net/mtk_eth.c
@@ -9,15 +9,19 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
+#include <net.h>
 #include <regmap.h>
 #include <reset.h>
 #include <syscon.h>
 #include <wait_bit.h>
+#include <asm/cache.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/ioport.h>
 #include <linux/mdio.h>
diff --git a/drivers/net/mtk_eth.h b/drivers/net/mtk_eth.h
index f2940c9..be74ac2 100644
--- a/drivers/net/mtk_eth.h
+++ b/drivers/net/mtk_eth.h
@@ -10,6 +10,7 @@
 #define _MTK_ETH_H_
 
 /* Frame Engine Register Bases */
+#include <linux/bitops.h>
 #define PDMA_BASE			0x0800
 #define GDMA1_BASE			0x0500
 #define GDMA2_BASE			0x1500
diff --git a/drivers/net/mvgbe.c b/drivers/net/mvgbe.c
index 6d56360..7974dfc 100644
--- a/drivers/net/mvgbe.c
+++ b/drivers/net/mvgbe.c
@@ -13,11 +13,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <wait_bit.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/types.h>
 #include <asm/system.h>
diff --git a/drivers/net/mvmdio.c b/drivers/net/mvmdio.c
index ec6805e..a8e93e8 100644
--- a/drivers/net/mvmdio.c
+++ b/drivers/net/mvmdio.c
@@ -12,6 +12,7 @@
 #include <phy.h>
 #include <asm/io.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
 
 #define MVMDIO_SMI_DATA_SHIFT		0
 #define MVMDIO_SMI_PHY_ADDR_SHIFT	16
diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c
index d737400..092f619 100644
--- a/drivers/net/mvneta.c
+++ b/drivers/net/mvneta.c
@@ -15,13 +15,18 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <net.h>
 #include <netdev.h>
 #include <config.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <phy.h>
 #include <miiphy.h>
diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c
index fcd2486..19b9375 100644
--- a/drivers/net/mvpp2.c
+++ b/drivers/net/mvpp2.c
@@ -16,6 +16,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <asm/cache.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
@@ -25,6 +26,9 @@
 #include <config.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <phy.h>
@@ -33,6 +37,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
 #include <linux/compat.h>
+#include <linux/libfdt.h>
 #include <linux/mbus.h>
 #include <asm-generic/gpio.h>
 #include <fdt_support.h>
diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 86f6898..bf6fa8f 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -56,6 +56,7 @@
 #include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
+#include <linux/delay.h>
 
 /* defines */
 #define EEPROM_SIZE 0xb /*12 16-bit chunks, or 24 bytes*/
diff --git a/drivers/net/ne2000.c b/drivers/net/ne2000.c
index e6cd3e9..28a99bb 100644
--- a/drivers/net/ne2000.c
+++ b/drivers/net/ne2000.c
@@ -74,6 +74,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <linux/delay.h>
 
 /* NE2000 base header file */
 #include "ne2000_base.h"
diff --git a/drivers/net/ne2000_base.c b/drivers/net/ne2000_base.c
index a240d06..55145da 100644
--- a/drivers/net/ne2000_base.c
+++ b/drivers/net/ne2000_base.c
@@ -75,6 +75,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <linux/compiler.h>
diff --git a/drivers/net/ne2000_base.h b/drivers/net/ne2000_base.h
index eee0956..2493608 100644
--- a/drivers/net/ne2000_base.h
+++ b/drivers/net/ne2000_base.h
@@ -106,6 +106,7 @@
 #endif
 
 /* timeout for tx/rx in s */
+#include <linux/delay.h>
 #define TOUT 5
 /* Ether MAC address size */
 #define ETHER_ADDR_LEN 6
diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 73005ff..f1d0630 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <stdio_dev.h>
 #include <net.h>
 
diff --git a/drivers/net/ns8382x.c b/drivers/net/ns8382x.c
index ea7ece5..c292aba 100644
--- a/drivers/net/ns8382x.c
+++ b/drivers/net/ns8382x.c
@@ -51,11 +51,13 @@
 
 /* Includes */
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
+#include <linux/delay.h>
 
 /* defines */
 #define DSIZE     0x00000FFF
diff --git a/drivers/net/pch_gbe.c b/drivers/net/pch_gbe.c
index b282370..1daafbe 100644
--- a/drivers/net/pch_gbe.c
+++ b/drivers/net/pch_gbe.c
@@ -9,10 +9,12 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <pci.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include "pch_gbe.h"
 
 #if !defined(CONFIG_PHYLIB)
diff --git a/drivers/net/pcnet.c b/drivers/net/pcnet.c
index f97e7f8..260a5a3 100644
--- a/drivers/net/pcnet.c
+++ b/drivers/net/pcnet.c
@@ -8,11 +8,14 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <pci.h>
+#include <linux/delay.h>
 
 #define	PCNET_DEBUG_LEVEL	0	/* 0=off, 1=init, 2=rx/tx */
 
diff --git a/drivers/net/pfe_eth/pfe_cmd.c b/drivers/net/pfe_eth/pfe_cmd.c
index dd8c68d..1e69525 100644
--- a/drivers/net/pfe_eth/pfe_cmd.c
+++ b/drivers/net/pfe_eth/pfe_cmd.c
@@ -9,6 +9,10 @@
  * @brief PFE utility commands
  */
 
+#include <common.h>
+#include <command.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <net/pfe_eth/pfe_eth.h>
 
 static inline void pfe_command_help(void)
@@ -16,7 +20,7 @@
 	printf("Usage: pfe [pe | status | expt ] <options>\n");
 }
 
-static void pfe_command_pe(int argc, char * const argv[])
+static void pfe_command_pe(int argc, char *const argv[])
 {
 	if (argc >= 3 && strcmp(argv[2], "pmem") == 0) {
 		if (argc >= 4 && strcmp(argv[3], "read") == 0) {
@@ -271,7 +275,7 @@
 #define PEMBOX_ADDR_TMU		0x290
 #define	PESTATUS_ADDR_UTIL	0x0
 
-static void pfe_pe_status(int argc, char * const argv[])
+static void pfe_pe_status(int argc, char *const argv[])
 {
 	int do_clear = 0;
 	u32 id;
@@ -336,7 +340,7 @@
 	}
 }
 
-static void pfe_command_status(int argc, char * const argv[])
+static void pfe_command_status(int argc, char *const argv[])
 {
 	if (argc >= 3 && strcmp(argv[2], "pe") == 0) {
 		pfe_pe_status(argc, argv);
@@ -370,7 +374,7 @@
 		" r12", " r13", " r14", " r15"
 };
 
-static void pfe_command_expt(int argc, char * const argv[])
+static void pfe_command_expt(int argc, char *const argv[])
 {
 	unsigned int id, i, val, addr;
 
@@ -414,7 +418,7 @@
 	writel(buf, TMU_PHY_INQ_PKTINFO);
 }
 
-static void pfe_command_stop(int argc, char * const argv[])
+static void pfe_command_stop(int argc, char *const argv[])
 {
 	int pfe_pe_id, hif_stop_loop = 10;
 	u32 rx_status;
@@ -462,8 +466,8 @@
 }
 #endif
 
-static int pfe_command(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int pfe_command(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[])
 {
 	if (argc == 1 || strcmp(argv[1], "help") == 0) {
 		pfe_command_help();
diff --git a/drivers/net/pfe_eth/pfe_driver.c b/drivers/net/pfe_eth/pfe_driver.c
index f70a235..6f443b4 100644
--- a/drivers/net/pfe_eth/pfe_driver.c
+++ b/drivers/net/pfe_eth/pfe_driver.c
@@ -4,7 +4,9 @@
  * Copyright 2017 NXP
  */
 
+#include <log.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include <net/pfe_eth/pfe_eth.h>
 #include <net/pfe_eth/pfe_firmware.h>
 
diff --git a/drivers/net/pfe_eth/pfe_eth.c b/drivers/net/pfe_eth/pfe_eth.c
index 1b5d11e..718e24f 100644
--- a/drivers/net/pfe_eth/pfe_eth.c
+++ b/drivers/net/pfe_eth/pfe_eth.c
@@ -6,9 +6,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/platform_data/pfe_dm_eth.h>
 #include <net.h>
+#include <linux/delay.h>
 #include <net/pfe_eth/pfe_eth.h>
 #include <net/pfe_eth/pfe_mdio.h>
 
diff --git a/drivers/net/pfe_eth/pfe_firmware.c b/drivers/net/pfe_eth/pfe_firmware.c
index 13112d9..0493cfe 100644
--- a/drivers/net/pfe_eth/pfe_firmware.c
+++ b/drivers/net/pfe_eth/pfe_firmware.c
@@ -10,7 +10,10 @@
  * files.
  */
 
+#include <image.h>
+#include <log.h>
 #include <malloc.h>
+#include <linux/bitops.h>
 #include <net/pfe_eth/pfe_eth.h>
 #include <net/pfe_eth/pfe_firmware.h>
 #ifdef CONFIG_CHAIN_OF_TRUST
diff --git a/drivers/net/pfe_eth/pfe_hw.c b/drivers/net/pfe_eth/pfe_hw.c
index 7137ac1..722f5c2 100644
--- a/drivers/net/pfe_eth/pfe_hw.c
+++ b/drivers/net/pfe_eth/pfe_hw.c
@@ -3,6 +3,8 @@
  * Copyright 2015-2016 Freescale Semiconductor, Inc.
  * Copyright 2017 NXP
  */
+#include <log.h>
+#include <linux/bitops.h>
 #include <net/pfe_eth/pfe_eth.h>
 #include <net/pfe_eth/pfe/pfe_hw.h>
 
diff --git a/drivers/net/pfe_eth/pfe_mdio.c b/drivers/net/pfe_eth/pfe_mdio.c
index b990e7f..3228b8d 100644
--- a/drivers/net/pfe_eth/pfe_mdio.c
+++ b/drivers/net/pfe_eth/pfe_mdio.c
@@ -5,9 +5,11 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/platform_data/pfe_dm_eth.h>
 #include <net.h>
+#include <linux/delay.h>
 #include <net/pfe_eth/pfe_eth.h>
 
 extern struct gemac_s gem_info[];
diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
index 8ece926..68cd3d0 100644
--- a/drivers/net/phy/aquantia.c
+++ b/drivers/net/phy/aquantia.c
@@ -8,7 +8,11 @@
 #include <config.h>
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <net.h>
 #include <phy.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <u-boot/crc.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
diff --git a/drivers/net/phy/atheros.c b/drivers/net/phy/atheros.c
index 47ff9f8..13f7275 100644
--- a/drivers/net/phy/atheros.c
+++ b/drivers/net/phy/atheros.c
@@ -10,6 +10,7 @@
 #include <phy.h>
 #include <dm/device_compat.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
 #include <dt-bindings/net/qca-ar803x.h>
 
 #define AR803x_PHY_DEBUG_ADDR_REG	0x1d
diff --git a/drivers/net/phy/b53.c b/drivers/net/phy/b53.c
index 30c4812..21da53c 100644
--- a/drivers/net/phy/b53.c
+++ b/drivers/net/phy/b53.c
@@ -23,6 +23,9 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <errno.h>
 #include <malloc.h>
@@ -627,7 +630,7 @@
 	return 0;
 }
 
-int do_b53_reg_read(const char *name, int argc, char * const argv[])
+int do_b53_reg_read(const char *name, int argc, char *const argv[])
 {
 	u8 page, offset, width;
 	struct mii_dev *bus;
@@ -681,7 +684,7 @@
 	return ret;
 }
 
-int do_b53_reg_write(const char *name, int argc, char * const argv[])
+int do_b53_reg_write(const char *name, int argc, char *const argv[])
 {
 	u8 page, offset, width;
 	struct mii_dev *bus;
@@ -727,7 +730,7 @@
 	return ret;
 }
 
-int do_b53_reg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_b53_reg(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	const char *cmd, *mdioname;
 	int ret = 0;
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 3399fd2..566fcb8 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -7,6 +7,7 @@
  */
 #include <common.h>
 #include <phy.h>
+#include <linux/delay.h>
 
 /* Broadcom BCM54xx -- taken from linux sungem_phy */
 #define MIIM_BCM54xx_AUXCNTL			0x18
diff --git a/drivers/net/phy/cortina.c b/drivers/net/phy/cortina.c
index ec81dab..dbc20b1 100644
--- a/drivers/net/phy/cortina.c
+++ b/drivers/net/phy/cortina.c
@@ -9,8 +9,10 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/ctype.h>
+#include <linux/delay.h>
 #include <linux/string.h>
 #include <linux/err.h>
 #include <phy.h>
diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c
index 50804c1..d435cc1 100644
--- a/drivers/net/phy/dp83867.c
+++ b/drivers/net/phy/dp83867.c
@@ -4,8 +4,10 @@
  *
  */
 #include <common.h>
+#include <log.h>
 #include <phy.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <malloc.h>
 
diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 93cf44a..a62c695 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -8,6 +8,8 @@
 #include <common.h>
 #include <errno.h>
 #include <phy.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define PHY_AUTONEGOTIATE_TIMEOUT 5000
 
diff --git a/drivers/net/phy/micrel_ksz8xxx.c b/drivers/net/phy/micrel_ksz8xxx.c
index e27fc45..98a0c83 100644
--- a/drivers/net/phy/micrel_ksz8xxx.c
+++ b/drivers/net/phy/micrel_ksz8xxx.c
@@ -12,6 +12,7 @@
 #include <fdtdec.h>
 #include <micrel.h>
 #include <phy.h>
+#include <linux/bitops.h>
 
 static struct phy_driver KSZ804_driver = {
 	.name = "Micrel KSZ804",
diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c
index 72bbda5..709979f 100644
--- a/drivers/net/phy/mscc.c
+++ b/drivers/net/phy/mscc.c
@@ -9,9 +9,11 @@
  *
  */
 
+#include <log.h>
 #include <miiphy.h>
 #include <bitfield.h>
 #include <time.h>
+#include <linux/bitops.h>
 #include <linux/delay.h>
 
 /* Microsemi PHY ID's */
diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c
index 5aff7ed..7eff37b 100644
--- a/drivers/net/phy/mv88e61xx.c
+++ b/drivers/net/phy/mv88e61xx.c
@@ -30,6 +30,9 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <bitfield.h>
 #include <errno.h>
diff --git a/drivers/net/phy/mv88e6352.c b/drivers/net/phy/mv88e6352.c
index 6fe08b8..62a7f19 100644
--- a/drivers/net/phy/mv88e6352.c
+++ b/drivers/net/phy/mv88e6352.c
@@ -5,7 +5,10 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <mv88e6352.h>
 
@@ -230,7 +233,7 @@
 	return -ETIMEDOUT;
 }
 
-int do_mvsw_reg_read(const char *name, int argc, char * const argv[])
+int do_mvsw_reg_read(const char *name, int argc, char *const argv[])
 {
 	u16 value = 0, phyaddr, reg, port;
 	int ret;
@@ -245,7 +248,7 @@
 	return ret;
 }
 
-int do_mvsw_reg_write(const char *name, int argc, char * const argv[])
+int do_mvsw_reg_write(const char *name, int argc, char *const argv[])
 {
 	u16 value = 0, phyaddr, reg, port;
 	int ret;
@@ -261,7 +264,7 @@
 }
 
 
-int do_mvsw_reg(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_mvsw_reg(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 	const char *cmd, *ethname;
diff --git a/drivers/net/phy/ncsi.c b/drivers/net/phy/ncsi.c
index adc3ac0..bf1e832 100644
--- a/drivers/net/phy/ncsi.c
+++ b/drivers/net/phy/ncsi.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <phy.h>
 #include <net/ncsi.h>
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 505d3ab..cce09c4 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -10,12 +10,15 @@
 #include <common.h>
 #include <console.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <command.h>
 #include <miiphy.h>
 #include <phy.h>
 #include <errno.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/compiler.h>
 
diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 8f0a897..b4612c1 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <linux/bitops.h>
 #include <phy.h>
+#include <linux/delay.h>
 
 #define PHY_RTL8211x_FORCE_MASTER BIT(1)
 #define PHY_RTL8211E_PINE64_GIGABIT_FIX BIT(2)
diff --git a/drivers/net/phy/teranetics.c b/drivers/net/phy/teranetics.c
index 49d6a1a..60049c2 100644
--- a/drivers/net/phy/teranetics.c
+++ b/drivers/net/phy/teranetics.c
@@ -7,6 +7,7 @@
  */
 #include <common.h>
 #include <phy.h>
+#include <linux/delay.h>
 
 #ifndef CONFIG_PHYLIB_10G
 #error The Teranetics PHY needs 10G support
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index 8c20da2..e2feb17 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -6,6 +6,7 @@
  */
 
 #include <dm.h>
+#include <log.h>
 #include <phy.h>
 #include <config.h>
 #include <common.h>
diff --git a/drivers/net/phy/xilinx_phy.c b/drivers/net/phy/xilinx_phy.c
index 3aa8891..39dbfdb 100644
--- a/drivers/net/phy/xilinx_phy.c
+++ b/drivers/net/phy/xilinx_phy.c
@@ -7,6 +7,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <phy.h>
 #include <dm.h>
 
diff --git a/drivers/net/pic32_eth.c b/drivers/net/pic32_eth.c
index e966be0..6a20849 100644
--- a/drivers/net/pic32_eth.c
+++ b/drivers/net/pic32_eth.c
@@ -7,6 +7,7 @@
 #include <cpu_func.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <miiphy.h>
@@ -14,6 +15,7 @@
 #include <time.h>
 #include <wait_bit.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 
 #include "pic32_eth.h"
diff --git a/drivers/net/pic32_eth.h b/drivers/net/pic32_eth.h
index 823c565..7b873bc 100644
--- a/drivers/net/pic32_eth.h
+++ b/drivers/net/pic32_eth.h
@@ -7,6 +7,7 @@
 #ifndef __MICROCHIP_PIC32_ETH_H_
 #define __MICROCHIP_PIC32_ETH_H_
 
+#include <linux/bitops.h>
 #include <mach/pic32.h>
 
 /* Ethernet */
diff --git a/drivers/net/pic32_mdio.c b/drivers/net/pic32_mdio.c
index 1aa5b1d..d4049cf 100644
--- a/drivers/net/pic32_mdio.c
+++ b/drivers/net/pic32_mdio.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <wait_bit.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "pic32_eth.h"
 
 static int pic32_mdio_write(struct mii_dev *bus,
diff --git a/drivers/net/ravb.c b/drivers/net/ravb.c
index fb4a628..393ee9b 100644
--- a/drivers/net/ravb.c
+++ b/drivers/net/ravb.c
@@ -13,8 +13,12 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <miiphy.h>
 #include <malloc.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <wait_bit.h>
 #include <asm/io.h>
diff --git a/drivers/net/rtl8139.c b/drivers/net/rtl8139.c
index 1f08397..0daeefa 100644
--- a/drivers/net/rtl8139.c
+++ b/drivers/net/rtl8139.c
@@ -70,12 +70,15 @@
 
 #include <common.h>
 #include <cpu_func.h>
-#include <linux/types.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>
 #include <asm/io.h>
 #include <pci.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/types.h>
 
 #define RTL_TIMEOUT	100000
 
diff --git a/drivers/net/rtl8169.c b/drivers/net/rtl8169.c
index 5ccdfdd..75058fd 100644
--- a/drivers/net/rtl8169.c
+++ b/drivers/net/rtl8169.c
@@ -43,14 +43,17 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <net.h>
 #ifndef CONFIG_DM_ETH
 #include <netdev.h>
 #endif
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <pci.h>
+#include <linux/delay.h>
 
 #undef DEBUG_RTL8169
 #undef DEBUG_RTL8169_TX
diff --git a/drivers/net/sandbox-raw.c b/drivers/net/sandbox-raw.c
index 3707ee3..4bd94c3 100644
--- a/drivers/net/sandbox-raw.c
+++ b/drivers/net/sandbox-raw.c
@@ -6,6 +6,7 @@
  * Joe Hershberger <joe.hershberger@ni.com>
  */
 
+#include <log.h>
 #include <asm/eth-raw-os.h>
 #include <common.h>
 #include <dm.h>
diff --git a/drivers/net/sandbox.c b/drivers/net/sandbox.c
index c136392..4f7e3d4 100644
--- a/drivers/net/sandbox.c
+++ b/drivers/net/sandbox.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <asm/eth.h>
diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index f8e5d05..b26fc7b 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -12,10 +12,13 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <netdev.h>
 #include <miiphy.h>
+#include <asm/cache.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 
diff --git a/drivers/net/smc91111.c b/drivers/net/smc91111.c
index 5754c31..23265ef 100644
--- a/drivers/net/smc91111.c
+++ b/drivers/net/smc91111.c
@@ -51,6 +51,7 @@
 #include <command.h>
 #include <config.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include "smc91111.h"
 #include <net.h>
 
@@ -266,7 +267,7 @@
 
 	/* assume bank 2 selected */
 	while (SMC_inw (dev, MMU_CMD_REG) & MC_BUSY) {
-		udelay (1);	/* Wait until not busy */
+		udelay(1);	/* Wait until not busy */
 		if (++count > 200)
 			break;
 	}
@@ -318,7 +319,7 @@
 	SMC_SELECT_BANK (dev, 0);
 
 	/* this should pause enough for the chip to be happy */
-	udelay (10);
+	udelay(10);
 
 	/* Disable transmit and receive functionality */
 	SMC_outw (dev, RCR_CLEAR, RCR_REG);
@@ -333,7 +334,7 @@
 	smc_wait_mmu_release_complete (dev);
 	SMC_outw (dev, MC_RESET, MMU_CMD_REG);
 	while (SMC_inw (dev, MMU_CMD_REG) & MC_BUSY)
-		udelay (1);	/* Wait until not busy */
+		udelay(1);	/* Wait until not busy */
 
 	/* Note:  It doesn't seem that waiting for the MMU busy is needed here,
 	   but this is a place where future chipsets _COULD_ break.  Be wary
@@ -564,7 +565,7 @@
 
 		/* wait for MMU getting ready (low) */
 		while (SMC_inw (dev, MMU_CMD_REG) & MC_BUSY) {
-			udelay (10);
+			udelay(10);
 		}
 
 		PRINTK2 ("MMU ready\n");
@@ -583,7 +584,7 @@
 
 		/* wait for MMU getting ready (low) */
 		while (SMC_inw (dev, MMU_CMD_REG) & MC_BUSY) {
-			udelay (10);
+			udelay(10);
 		}
 
 		PRINTK2 ("MMU ready\n");
@@ -957,19 +958,19 @@
 	for (i = 0; i < sizeof bits; ++i) {
 		/* Clock Low - output data */
 		SMC_outw (dev, mii_reg | bits[i], MII_REG);
-		udelay (SMC_PHY_CLOCK_DELAY);
+		udelay(SMC_PHY_CLOCK_DELAY);
 
 
 		/* Clock Hi - input data */
 		SMC_outw (dev, mii_reg | bits[i] | MII_MCLK, MII_REG);
-		udelay (SMC_PHY_CLOCK_DELAY);
+		udelay(SMC_PHY_CLOCK_DELAY);
 		bits[i] |= SMC_inw (dev, MII_REG) & MII_MDI;
 	}
 
 	/* Return to idle state */
 	/* Set clock to low, data to low, and output tristated */
 	SMC_outw (dev, mii_reg, MII_REG);
-	udelay (SMC_PHY_CLOCK_DELAY);
+	udelay(SMC_PHY_CLOCK_DELAY);
 
 	/* Restore original bank select */
 	SMC_SELECT_BANK (dev, oldBank);
@@ -1078,19 +1079,19 @@
 	for (i = 0; i < sizeof bits; ++i) {
 		/* Clock Low - output data */
 		SMC_outw (dev, mii_reg | bits[i], MII_REG);
-		udelay (SMC_PHY_CLOCK_DELAY);
+		udelay(SMC_PHY_CLOCK_DELAY);
 
 
 		/* Clock Hi - input data */
 		SMC_outw (dev, mii_reg | bits[i] | MII_MCLK, MII_REG);
-		udelay (SMC_PHY_CLOCK_DELAY);
+		udelay(SMC_PHY_CLOCK_DELAY);
 		bits[i] |= SMC_inw (dev, MII_REG) & MII_MDI;
 	}
 
 	/* Return to idle state */
 	/* Set clock to low, data to low, and output tristated */
 	SMC_outw (dev, mii_reg, MII_REG);
-	udelay (SMC_PHY_CLOCK_DELAY);
+	udelay(SMC_PHY_CLOCK_DELAY);
 
 	/* Restore original bank select */
 	SMC_SELECT_BANK (dev, oldBank);
diff --git a/drivers/net/smc91111.h b/drivers/net/smc91111.h
index 0135427..4c3acba 100644
--- a/drivers/net/smc91111.h
+++ b/drivers/net/smc91111.h
@@ -30,6 +30,7 @@
 
 #include <asm/types.h>
 #include <config.h>
+#include <net.h>
 
 /*
  * This function may be called by the board specific initialisation code
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 45ecd6a..9d2790e 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -11,6 +11,7 @@
 #include <net.h>
 #include <miiphy.h>
 #include <linux/io.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 
 #include "smc911x.h"
diff --git a/drivers/net/smc911x.h b/drivers/net/smc911x.h
index ce66900..0a27f3c 100644
--- a/drivers/net/smc911x.h
+++ b/drivers/net/smc911x.h
@@ -8,6 +8,8 @@
 #ifndef _SMC911X_H_
 #define _SMC911X_H_
 
+#include <net.h>
+
 /* Below are the register offsets and bit definitions
  * of the Lan911x memory space
  */
diff --git a/drivers/net/sni_ave.c b/drivers/net/sni_ave.c
index 5d66a63..0784635 100644
--- a/drivers/net/sni_ave.c
+++ b/drivers/net/sni_ave.c
@@ -8,13 +8,17 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <net.h>
 #include <regmap.h>
 #include <reset.h>
 #include <syscon.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index 1ae776b..99e24c6 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -11,6 +11,8 @@
 */
 
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/gpio.h>
@@ -19,6 +21,8 @@
 #include <dm.h>
 #include <fdt_support.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <malloc.h>
 #include <miiphy.h>
diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c
index a9874e4..6364beb 100644
--- a/drivers/net/sunxi_emac.c
+++ b/drivers/net/sunxi_emac.c
@@ -8,7 +8,9 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <malloc.h>
 #include <miiphy.h>
diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c
index 7531a07..85f3e49 100644
--- a/drivers/net/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ti/am65-cpsw-nuss.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <clk.h>
@@ -20,6 +21,7 @@
 #include <net.h>
 #include <phy.h>
 #include <power-domain.h>
+#include <linux/bitops.h>
 #include <linux/soc/ti/ti-udma.h>
 
 #include "cpsw_mdio.h"
diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c
index 04b01a8..95761ff 100644
--- a/drivers/net/ti/cpsw.c
+++ b/drivers/net/ti/cpsw.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <net.h>
 #include <miiphy.h>
 #include <malloc.h>
@@ -15,6 +16,7 @@
 #include <netdev.h>
 #include <cpsw.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/drivers/net/ti/cpsw_mdio.c b/drivers/net/ti/cpsw_mdio.c
index 1fa520b..f4cb86d 100644
--- a/drivers/net/ti/cpsw_mdio.c
+++ b/drivers/net/ti/cpsw_mdio.c
@@ -6,10 +6,13 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <miiphy.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 struct cpsw_mdio_regs {
 	u32	version;
diff --git a/drivers/net/ti/davinci_emac.c b/drivers/net/ti/davinci_emac.c
index 9c6bfca..56ea1fe 100644
--- a/drivers/net/ti/davinci_emac.c
+++ b/drivers/net/ti/davinci_emac.c
@@ -24,12 +24,15 @@
 #include <common.h>
 #include <command.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <net.h>
 #include <miiphy.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <linux/compiler.h>
 #include <asm/arch/emac_defs.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "davinci_emac.h"
 
 unsigned int	emac_dbg = 0;
diff --git a/drivers/net/ti/keystone_net.c b/drivers/net/ti/keystone_net.c
index 4baeeb8..e3ac40c 100644
--- a/drivers/net/ti/keystone_net.c
+++ b/drivers/net/ti/keystone_net.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <console.h>
+#include <linux/delay.h>
 
 #include <dm.h>
 #include <dm/lists.h>
@@ -21,6 +22,7 @@
 #include <asm/ti-common/keystone_net.h>
 #include <asm/ti-common/keystone_serdes.h>
 #include <asm/arch/psc_defs.h>
+#include <linux/libfdt.h>
 
 #include "cpsw_mdio.h"
 
diff --git a/drivers/net/tsec.c b/drivers/net/tsec.c
index f85cdcb..c2e755f 100644
--- a/drivers/net/tsec.c
+++ b/drivers/net/tsec.c
@@ -15,6 +15,8 @@
 #include <command.h>
 #include <tsec.h>
 #include <fsl_mdio.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/processor.h>
 #include <asm/io.h>
diff --git a/drivers/net/uli526x.c b/drivers/net/uli526x.c
index c568366..cfdd113 100644
--- a/drivers/net/uli526x.c
+++ b/drivers/net/uli526x.c
@@ -16,6 +16,7 @@
 #include <asm/io.h>
 #include <pci.h>
 #include <miiphy.h>
+#include <linux/delay.h>
 
 /* some kernel function compatible define */
 
diff --git a/drivers/net/vsc7385.c b/drivers/net/vsc7385.c
index 0724210..af8d99c 100644
--- a/drivers/net/vsc7385.c
+++ b/drivers/net/vsc7385.c
@@ -15,7 +15,9 @@
 #include <config.h>
 #include <common.h>
 #include <console.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include "vsc7385.h"
 
diff --git a/drivers/net/vsc9953.c b/drivers/net/vsc9953.c
index f17839c..c438dab 100644
--- a/drivers/net/vsc9953.c
+++ b/drivers/net/vsc9953.c
@@ -5,6 +5,9 @@
  *  Driver for the Vitesse VSC9953 L2 Switch
  */
 
+#include <common.h>
+#include <command.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/fsl_serdes.h>
 #include <fm_eth.h>
@@ -14,6 +17,7 @@
 #include <malloc.h>
 #include <vsc9953.h>
 #include <ethsw.h>
+#include <linux/delay.h>
 
 static struct vsc9953_info vsc9953_l2sw = {
 		.port[0] = VSC9953_PORT_INFO_INITIALIZER(0),
diff --git a/drivers/net/xilinx_axi_emac.c b/drivers/net/xilinx_axi_emac.c
index b0450ff..d0683db 100644
--- a/drivers/net/xilinx_axi_emac.c
+++ b/drivers/net/xilinx_axi_emac.c
@@ -9,12 +9,14 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <phy.h>
 #include <miiphy.h>
 #include <wait_bit.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/net/xilinx_emaclite.c b/drivers/net/xilinx_emaclite.c
index 4b49290..9bdb679 100644
--- a/drivers/net/xilinx_emaclite.c
+++ b/drivers/net/xilinx_emaclite.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <net.h>
 #include <config.h>
 #include <dm.h>
@@ -16,6 +17,7 @@
 #include <phy.h>
 #include <miiphy.h>
 #include <fdtdec.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <asm/io.h>
diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c
index a158824..412daf7 100644
--- a/drivers/net/zynq_gem.c
+++ b/drivers/net/zynq_gem.c
@@ -12,11 +12,13 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <net.h>
 #include <netdev.h>
 #include <config.h>
 #include <console.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <phy.h>
 #include <miiphy.h>
@@ -26,6 +28,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 
diff --git a/drivers/nvme/nvme-uclass.c b/drivers/nvme/nvme-uclass.c
index 2d88efd..277e31e 100644
--- a/drivers/nvme/nvme-uclass.c
+++ b/drivers/nvme/nvme-uclass.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <errno.h>
 #include <dm.h>
 #include <dm/device.h>
diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c
index ef4382d..0357aba 100644
--- a/drivers/nvme/nvme.c
+++ b/drivers/nvme/nvme.c
@@ -5,9 +5,11 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <pci.h>
diff --git a/drivers/pch/pch7.c b/drivers/pch/pch7.c
index 268edb3..5fb35a1 100644
--- a/drivers/pch/pch7.c
+++ b/drivers/pch/pch7.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pch.h>
 
 #define GPIO_BASE	0x44
diff --git a/drivers/pch/pch9.c b/drivers/pch/pch9.c
index fd61f16..3bd0115 100644
--- a/drivers/pch/pch9.c
+++ b/drivers/pch/pch9.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pch.h>
 
 #define GPIO_BASE	0x48
diff --git a/drivers/pci/fsl_pci_init.c b/drivers/pci/fsl_pci_init.c
index ab5e499..1d09c5a 100644
--- a/drivers/pci/fsl_pci_init.c
+++ b/drivers/pci/fsl_pci_init.c
@@ -5,8 +5,11 @@
 
 #include <common.h>
 #include <env.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/fsl_serdes.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c
index d678e0b..711b930 100644
--- a/drivers/pci/pci-aardvark.c
+++ b/drivers/pci/pci-aardvark.c
@@ -30,6 +30,8 @@
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/ioport.h>
 
 /* PCIe core registers */
diff --git a/drivers/pci/pci-emul-uclass.c b/drivers/pci/pci-emul-uclass.c
index 9486e1c..a520643 100644
--- a/drivers/pci/pci-emul-uclass.c
+++ b/drivers/pci/pci-emul-uclass.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <pci.h>
 #include <dm/lists.h>
diff --git a/drivers/pci/pci-rcar-gen2.c b/drivers/pci/pci-rcar-gen2.c
index 014d870..e76abc1 100644
--- a/drivers/pci/pci-rcar-gen2.c
+++ b/drivers/pci/pci-rcar-gen2.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <pci.h>
+#include <linux/bitops.h>
 
 /* AHB-PCI Bridge PCI communication registers */
 #define RCAR_AHBPCI_PCICOM_OFFSET	0x800
diff --git a/drivers/pci/pci-rcar-gen3.c b/drivers/pci/pci-rcar-gen3.c
index 30eff67..df7b37a 100644
--- a/drivers/pci/pci-rcar-gen3.c
+++ b/drivers/pci/pci-rcar-gen3.c
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <pci.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
 
 #define PCIECAR			0x000010
 #define PCIECCTLR		0x000018
diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c
index 7f46e90..9ab3539 100644
--- a/drivers/pci/pci-uclass.c
+++ b/drivers/pci/pci-uclass.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <asm/io.h>
@@ -15,6 +17,7 @@
 #if defined(CONFIG_X86) && defined(CONFIG_HAVE_FSP)
 #include <asm/fsp/fsp_support.h>
 #endif
+#include <linux/delay.h>
 #include "pci_internal.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e8285bf..664e837 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -16,6 +16,8 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
+#include <linux/delay.h>
 
 #include <command.h>
 #include <env.h>
diff --git a/drivers/pci/pci_auto.c b/drivers/pci/pci_auto.c
index 28667bd..3f46b76 100644
--- a/drivers/pci/pci_auto.c
+++ b/drivers/pci/pci_auto.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <pci.h>
 
 /* the user can define CONFIG_SYS_PCI_CACHE_LINE_SIZE to avoid problems */
diff --git a/drivers/pci/pci_auto_common.c b/drivers/pci/pci_auto_common.c
index 8690316..c0a53dc 100644
--- a/drivers/pci/pci_auto_common.c
+++ b/drivers/pci/pci_auto_common.c
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <pci.h>
 
 void pciauto_region_init(struct pci_region *res)
diff --git a/drivers/pci/pci_auto_old.c b/drivers/pci/pci_auto_old.c
index b566705..8b67cfa 100644
--- a/drivers/pci/pci_auto_old.c
+++ b/drivers/pci/pci_auto_old.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <pci.h>
 
 /*
diff --git a/drivers/pci/pci_compat.c b/drivers/pci/pci_compat.c
index 6c15bdf..9dddca8 100644
--- a/drivers/pci/pci_compat.c
+++ b/drivers/pci/pci_compat.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <dm/device-internal.h>
diff --git a/drivers/pci/pci_ftpci100.c b/drivers/pci/pci_ftpci100.c
index 736befd..32fac87 100644
--- a/drivers/pci/pci_ftpci100.c
+++ b/drivers/pci/pci_ftpci100.c
@@ -7,6 +7,8 @@
  * Macpaul Lin, Andes Technology Corporation <macpaul@andestech.com>
  */
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 
diff --git a/drivers/pci/pci_gt64120.c b/drivers/pci/pci_gt64120.c
index 55f4800..80f11fe 100644
--- a/drivers/pci/pci_gt64120.c
+++ b/drivers/pci/pci_gt64120.c
@@ -10,6 +10,8 @@
 
 #include <common.h>
 #include <gt64120.h>
+#include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <pci_gt64120.h>
 
diff --git a/drivers/pci/pci_mpc85xx.c b/drivers/pci/pci_mpc85xx.c
index 8dff68d..6576f53 100644
--- a/drivers/pci/pci_mpc85xx.c
+++ b/drivers/pci/pci_mpc85xx.c
@@ -5,6 +5,7 @@
  *
  */
 #include <common.h>
+#include <asm/bitops.h>
 #include <asm/cpm_85xx.h>
 #include <pci.h>
 #include <dm.h>
diff --git a/drivers/pci/pci_msc01.c b/drivers/pci/pci_msc01.c
index 504eb65..0483820 100644
--- a/drivers/pci/pci_msc01.c
+++ b/drivers/pci/pci_msc01.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <msc01.h>
 #include <pci.h>
 #include <pci_msc01.h>
diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c
index 483a87d..c9afe75 100644
--- a/drivers/pci/pci_mvebu.c
+++ b/drivers/pci/pci_mvebu.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
@@ -19,6 +20,7 @@
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
 #include <linux/mbus.h>
diff --git a/drivers/pci/pci_rom.c b/drivers/pci/pci_rom.c
index 6b17f18..6a9bc49 100644
--- a/drivers/pci/pci_rom.c
+++ b/drivers/pci/pci_rom.c
@@ -24,9 +24,11 @@
 
 #include <common.h>
 #include <bios_emul.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <errno.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <pci_rom.h>
diff --git a/drivers/pci/pci_sandbox.c b/drivers/pci/pci_sandbox.c
index fa4c476..8745f28 100644
--- a/drivers/pci/pci_sandbox.c
+++ b/drivers/pci/pci_sandbox.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <pci.h>
 
 #define FDT_DEV_INFO_CELLS	4
diff --git a/drivers/pci/pci_sh4.c b/drivers/pci/pci_sh4.c
index 4500e8b..aac9be0 100644
--- a/drivers/pci/pci_sh4.c
+++ b/drivers/pci/pci_sh4.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 
 #include <asm/processor.h>
 #include <asm/io.h>
diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c
index 2f48b96..e110550 100644
--- a/drivers/pci/pci_sh7751.c
+++ b/drivers/pci/pci_sh7751.c
@@ -11,6 +11,8 @@
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <asm/pci.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* Register addresses and such */
 #define SH7751_BCR1	(vu_long *)0xFF800000
diff --git a/drivers/pci/pci_sh7780.c b/drivers/pci/pci_sh7780.c
index 722b5e7..06d711a 100644
--- a/drivers/pci/pci_sh7780.c
+++ b/drivers/pci/pci_sh7780.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 
 #include <pci.h>
 #include <asm/processor.h>
diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c
index 96d308f..82f5c59 100644
--- a/drivers/pci/pci_tegra.c
+++ b/drivers/pci/pci_tegra.c
@@ -15,11 +15,13 @@
 #include <clk.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <pci_tegra.h>
 #include <power-domain.h>
 #include <reset.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c
index 1f216e1..c773f8d 100644
--- a/drivers/pci/pcie_dw_mvebu.c
+++ b/drivers/pci/pcie_dw_mvebu.c
@@ -12,9 +12,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/pci/pcie_dw_ti.c b/drivers/pci/pcie_dw_ti.c
index f62264c..742dd93 100644
--- a/drivers/pci/pcie_dw_ti.c
+++ b/drivers/pci/pcie_dw_ti.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pci.h>
 #include <generic-phy.h>
 #include <power-domain.h>
@@ -13,6 +14,8 @@
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c
index dc994b7..ab33459 100644
--- a/drivers/pci/pcie_fsl.c
+++ b/drivers/pci/pcie_fsl.c
@@ -14,6 +14,7 @@
 #include <asm/fsl_pci.h>
 #include <asm/fsl_serdes.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "pcie_fsl.h"
 #include <dm/device_compat.h>
 
diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c
index f34a157..cbf1237 100644
--- a/drivers/pci/pcie_imx.c
+++ b/drivers/pci/pcie_imx.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <asm/arch/clock.h>
@@ -19,6 +20,7 @@
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <dm.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 #include <errno.h>
 #include <asm/arch/sys_proto.h>
diff --git a/drivers/pci/pcie_intel_fpga.c b/drivers/pci/pcie_intel_fpga.c
index 6a9f29c..aa1903e 100644
--- a/drivers/pci/pcie_intel_fpga.c
+++ b/drivers/pci/pcie_intel_fpga.c
@@ -11,6 +11,8 @@
 #include <pci.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define RP_TX_REG0			0x2000
 #define RP_TX_CNTRL			0x2004
diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c
index 8b313e9..39b6d40 100644
--- a/drivers/pci/pcie_layerscape.c
+++ b/drivers/pci/pcie_layerscape.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/fsl_serdes.h>
 #include <pci.h>
 #include <asm/io.h>
diff --git a/drivers/pci/pcie_layerscape_fixup.c b/drivers/pci/pcie_layerscape_fixup.c
index ec6acbb..25a3c38 100644
--- a/drivers/pci/pcie_layerscape_fixup.c
+++ b/drivers/pci/pcie_layerscape_fixup.c
@@ -6,6 +6,8 @@
  */
 
 #include <common.h>
+#include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/io.h>
diff --git a/drivers/pci/pcie_layerscape_fixup_common.c b/drivers/pci/pcie_layerscape_fixup_common.c
index b010a63..c11c691 100644
--- a/drivers/pci/pcie_layerscape_fixup_common.c
+++ b/drivers/pci/pcie_layerscape_fixup_common.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <init.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/soc.h>
 #include "pcie_layerscape_fixup_common.h"
diff --git a/drivers/pci/pcie_layerscape_gen4.c b/drivers/pci/pcie_layerscape_gen4.c
index cec61fa..428bfca 100644
--- a/drivers/pci/pcie_layerscape_gen4.c
+++ b/drivers/pci/pcie_layerscape_gen4.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/fsl_serdes.h>
 #include <pci.h>
 #include <asm/io.h>
diff --git a/drivers/pci/pcie_layerscape_gen4.h b/drivers/pci/pcie_layerscape_gen4.h
index 27c2d09..d298a2b 100644
--- a/drivers/pci/pcie_layerscape_gen4.h
+++ b/drivers/pci/pcie_layerscape_gen4.h
@@ -10,6 +10,7 @@
 #define _PCIE_LAYERSCAPE_GEN4_H_
 #include <pci.h>
 #include <dm.h>
+#include <linux/bitops.h>
 
 #ifndef CONFIG_SYS_PCI_MEMORY_SIZE
 #define CONFIG_SYS_PCI_MEMORY_SIZE		(4 * 1024 * 1024 * 1024ULL)
diff --git a/drivers/pci/pcie_layerscape_gen4_fixup.c b/drivers/pci/pcie_layerscape_gen4_fixup.c
index bfe197e..1975004 100644
--- a/drivers/pci/pcie_layerscape_gen4_fixup.c
+++ b/drivers/pci/pcie_layerscape_gen4_fixup.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/arch/fsl_serdes.h>
 #include <asm/io.h>
diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c
index d8a32d5..6e6375c 100644
--- a/drivers/pci/pcie_mediatek.c
+++ b/drivers/pci/pcie_mediatek.c
@@ -11,11 +11,13 @@
 #include <clk.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <pci.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 #include <linux/list.h>
 
diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c
index 05787ae..713ad49 100644
--- a/drivers/pci/pcie_xilinx.c
+++ b/drivers/pci/pcie_xilinx.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <pci.h>
+#include <linux/bitops.h>
 
 #include <asm/io.h>
 
diff --git a/drivers/pci_endpoint/pcie-cadence.h b/drivers/pci_endpoint/pcie-cadence.h
index 91630d3..8a659c3 100644
--- a/drivers/pci_endpoint/pcie-cadence.h
+++ b/drivers/pci_endpoint/pcie-cadence.h
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <pci_ep.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /*
  * Local Management Registers
diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c
index 612c428..b4bae22 100644
--- a/drivers/phy/allwinner/phy-sun4i-usb.c
+++ b/drivers/phy/allwinner/phy-sun4i-usb.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device.h>
 #include <generic-phy.h>
 #include <phy-sun4i-usb.h>
@@ -22,6 +23,8 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/cpu.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 #define REG_ISCR			0x00
diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c
index 2de343d..d29344d 100644
--- a/drivers/phy/bcm6318-usbh-phy.c
+++ b/drivers/phy/bcm6318-usbh-phy.c
@@ -11,11 +11,14 @@
 #include <clk.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <dm/device.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* USBH Setup register */
 #define USBH_SETUP_REG		0x00
diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c
index ed9f02b..8d28292 100644
--- a/drivers/phy/bcm6348-usbh-phy.c
+++ b/drivers/phy/bcm6348-usbh-phy.c
@@ -11,10 +11,12 @@
 #include <clk.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <dm/device.h>
+#include <linux/bitops.h>
 
 #define USBH_SETUP_PORT1_EN	BIT(0)
 
diff --git a/drivers/phy/bcm6358-usbh-phy.c b/drivers/phy/bcm6358-usbh-phy.c
index f0fda02..501b97f 100644
--- a/drivers/phy/bcm6358-usbh-phy.c
+++ b/drivers/phy/bcm6358-usbh-phy.c
@@ -10,10 +10,12 @@
 #include <common.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <dm/device.h>
+#include <linux/bitops.h>
 
 /* USBH Swap Control register */
 #define USBH_SWAP_REG		0x00
diff --git a/drivers/phy/bcm6368-usbh-phy.c b/drivers/phy/bcm6368-usbh-phy.c
index 53d1f45..99fdd33 100644
--- a/drivers/phy/bcm6368-usbh-phy.c
+++ b/drivers/phy/bcm6368-usbh-phy.c
@@ -11,11 +11,14 @@
 #include <clk.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <dm/device.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* USBH PLL Control register */
 #define USBH_PLL_REG		0x18
diff --git a/drivers/phy/keystone-usb-phy.c b/drivers/phy/keystone-usb-phy.c
index 14ac6bb..9faf501 100644
--- a/drivers/phy/keystone-usb-phy.c
+++ b/drivers/phy/keystone-usb-phy.c
@@ -6,10 +6,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device.h>
 #include <generic-phy.h>
 #include <asm/io.h>
 #include <asm/arch/psc_defs.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* USB PHY control register offsets */
 #define USB_PHY_CTL_UTMI		0x0000
diff --git a/drivers/phy/marvell/comphy_a3700.c b/drivers/phy/marvell/comphy_a3700.c
index 3b2902f..dc188c4 100644
--- a/drivers/phy/marvell/comphy_a3700.c
+++ b/drivers/phy/marvell/comphy_a3700.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "comphy_a3700.h"
 
diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c
index 244beef..27bff27 100644
--- a/drivers/phy/marvell/comphy_core.c
+++ b/drivers/phy/marvell/comphy_core.c
@@ -8,10 +8,11 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <asm/io.h>
 #include <dm/device_compat.h>
 #include <linux/err.h>
 #include <linux/errno.h>
-#include <asm/io.h>
+#include <linux/libfdt.h>
 
 #include "comphy_core.h"
 
diff --git a/drivers/phy/marvell/comphy_cp110.c b/drivers/phy/marvell/comphy_cp110.c
index 9998c07..15e8004 100644
--- a/drivers/phy/marvell/comphy_cp110.c
+++ b/drivers/phy/marvell/comphy_cp110.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/soc.h>
+#include <linux/delay.h>
 
 #include "comphy_core.h"
 #include "comphy_hpipe.h"
diff --git a/drivers/phy/marvell/comphy_mux.c b/drivers/phy/marvell/comphy_mux.c
index c67ba99..9832755 100644
--- a/drivers/phy/marvell/comphy_mux.c
+++ b/drivers/phy/marvell/comphy_mux.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 
 #include "comphy_core.h"
diff --git a/drivers/phy/meson-g12a-usb2.c b/drivers/phy/meson-g12a-usb2.c
index c23bc87..a1e6219 100644
--- a/drivers/phy/meson-g12a-usb2.c
+++ b/drivers/phy/meson-g12a-usb2.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <bitfield.h>
@@ -15,6 +16,7 @@
 #include <errno.h>
 #include <generic-phy.h>
 #include <regmap.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 #include <reset.h>
 #include <clk.h>
diff --git a/drivers/phy/meson-g12a-usb3-pcie.c b/drivers/phy/meson-g12a-usb3-pcie.c
index 82655f2..4e9696f 100644
--- a/drivers/phy/meson-g12a-usb3-pcie.c
+++ b/drivers/phy/meson-g12a-usb3-pcie.c
@@ -17,6 +17,7 @@
 #include <reset.h>
 #include <bitfield.h>
 #include <generic-phy.h>
+#include <linux/delay.h>
 
 #include <linux/bitops.h>
 #include <linux/compat.h>
diff --git a/drivers/phy/meson-gxbb-usb2.c b/drivers/phy/meson-gxbb-usb2.c
index 88c2ec6..d1beebe 100644
--- a/drivers/phy/meson-gxbb-usb2.c
+++ b/drivers/phy/meson-gxbb-usb2.c
@@ -15,6 +15,7 @@
 #include <power/regulator.h>
 #include <regmap.h>
 #include <reset.h>
+#include <linux/bitops.h>
 
 #define REG_CONFIG					0x00
 	#define REG_CONFIG_CLK_EN			BIT(0)
diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c
index b4f4c3c..2267bd0 100644
--- a/drivers/phy/meson-gxl-usb2.c
+++ b/drivers/phy/meson-gxl-usb2.c
@@ -15,6 +15,7 @@
 #include <errno.h>
 #include <generic-phy.h>
 #include <regmap.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 #include <clk.h>
 #include <linux/usb/otg.h>
diff --git a/drivers/phy/msm8916-usbh-phy.c b/drivers/phy/msm8916-usbh-phy.c
index 2c90738..4efaddd 100644
--- a/drivers/phy/msm8916-usbh-phy.c
+++ b/drivers/phy/msm8916-usbh-phy.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <linux/bitops.h>
 #include <usb/ehci-ci.h>
 #include <usb/ulpi.h>
 #include <asm/io.h>
diff --git a/drivers/phy/mt76x8-usb-phy.c b/drivers/phy/mt76x8-usb-phy.c
index 1e7c5f3..4c0818f 100644
--- a/drivers/phy/mt76x8-usb-phy.c
+++ b/drivers/phy/mt76x8-usb-phy.c
@@ -10,9 +10,11 @@
 #include <common.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define OFS_U2_PHY_AC0			0x800
 #define USBPLL_FBDIV_S			16
diff --git a/drivers/phy/omap-usb2-phy.c b/drivers/phy/omap-usb2-phy.c
index 160a386..0793b97 100644
--- a/drivers/phy/omap-usb2-phy.c
+++ b/drivers/phy/omap-usb2-phy.c
@@ -13,6 +13,7 @@
 #include <generic-phy.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT	BIT(0)
diff --git a/drivers/phy/phy-da8xx-usb.c b/drivers/phy/phy-da8xx-usb.c
index 034b479..d025188 100644
--- a/drivers/phy/phy-da8xx-usb.c
+++ b/drivers/phy/phy-da8xx-usb.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <asm/arch/hardware.h>
diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c
index 81525a4..1e65c24 100644
--- a/drivers/phy/phy-mtk-tphy.c
+++ b/drivers/phy/phy-mtk-tphy.c
@@ -14,6 +14,8 @@
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <dt-bindings/phy/phy.h>
 
diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c
index e93130a..18da86e 100644
--- a/drivers/phy/phy-rcar-gen2.c
+++ b/drivers/phy/phy-rcar-gen2.c
@@ -18,6 +18,7 @@
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 #define USBHS_LPSTS			0x02
diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index 6ba3721..464b073 100644
--- a/drivers/phy/phy-stm32-usbphyc.c
+++ b/drivers/phy/phy-stm32-usbphyc.c
@@ -9,12 +9,14 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <reset.h>
 #include <syscon.h>
 #include <usb.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 /* USBPHYC registers */
diff --git a/drivers/phy/phy-ti-am654.c b/drivers/phy/phy-ti-am654.c
index 0b2b241..6907c1a 100644
--- a/drivers/phy/phy-ti-am654.c
+++ b/drivers/phy/phy-ti-am654.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
@@ -19,6 +20,8 @@
 #include <power-domain.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 #define CMU_R07C		0x7c
diff --git a/drivers/phy/phy-uclass.c b/drivers/phy/phy-uclass.c
index 1fded5e..65b5316 100644
--- a/drivers/phy/phy-uclass.c
+++ b/drivers/phy/phy-uclass.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <dm/devres.h>
 #include <generic-phy.h>
+#include <log.h>
 
 static inline struct phy_ops *phy_dev_ops(struct udevice *dev)
 {
diff --git a/drivers/phy/sti_usb_phy.c b/drivers/phy/sti_usb_phy.c
index ec597da..2a20f76 100644
--- a/drivers/phy/sti_usb_phy.c
+++ b/drivers/phy/sti_usb_phy.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <bitfield.h>
 #include <dm.h>
diff --git a/drivers/phy/ti-pipe3-phy.c b/drivers/phy/ti-pipe3-phy.c
index 7fc3631..3f49851 100644
--- a/drivers/phy/ti-pipe3-phy.c
+++ b/drivers/phy/ti-pipe3-phy.c
@@ -12,6 +12,8 @@
 #include <asm/arch/sys_proto.h>
 #include <syscon.h>
 #include <regmap.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 /* PLLCTRL Registers */
diff --git a/drivers/pinctrl/aspeed/pinctrl_ast2500.c b/drivers/pinctrl/aspeed/pinctrl_ast2500.c
index a6e9c0d..05ef248 100644
--- a/drivers/pinctrl/aspeed/pinctrl_ast2500.c
+++ b/drivers/pinctrl/aspeed/pinctrl_ast2500.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/pinctrl.h>
 #include <asm/arch/scu_ast2500.h>
diff --git a/drivers/pinctrl/ath79/pinctrl_ar933x.c b/drivers/pinctrl/ath79/pinctrl_ar933x.c
index 5e154a9..a0625d7 100644
--- a/drivers/pinctrl/ath79/pinctrl_ar933x.c
+++ b/drivers/pinctrl/ath79/pinctrl_ar933x.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm/pinctrl.h>
 #include <mach/ar71xx_regs.h>
diff --git a/drivers/pinctrl/ath79/pinctrl_qca953x.c b/drivers/pinctrl/ath79/pinctrl_qca953x.c
index 3166167..c9f9608 100644
--- a/drivers/pinctrl/ath79/pinctrl_qca953x.c
+++ b/drivers/pinctrl/ath79/pinctrl_qca953x.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm/pinctrl.h>
 #include <mach/ar71xx_regs.h>
diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c
index eb720f0..f44af6c 100644
--- a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c
+++ b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c
@@ -14,6 +14,7 @@
 #include <config.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <dm/root.h>
 #include <dm/device-internal.h>
diff --git a/drivers/pinctrl/intel/pinctrl.c b/drivers/pinctrl/intel/pinctrl.c
index e280054..ba82063 100644
--- a/drivers/pinctrl/intel/pinctrl.c
+++ b/drivers/pinctrl/intel/pinctrl.c
@@ -19,6 +19,7 @@
 #include <common.h>
 #include <dm.h>
 #include <irq.h>
+#include <log.h>
 #include <malloc.h>
 #include <p2sb.h>
 #include <spl.h>
diff --git a/drivers/pinctrl/intel/pinctrl_apl.c b/drivers/pinctrl/intel/pinctrl_apl.c
index bd80435..c14176d4 100644
--- a/drivers/pinctrl/intel/pinctrl_apl.c
+++ b/drivers/pinctrl/intel/pinctrl_apl.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <dt-structs.h>
+#include <log.h>
 #include <p2sb.h>
 #include <asm/intel_pinctrl.h>
 #include <asm-generic/gpio.h>
diff --git a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
index c7351f3..5fdc150 100644
--- a/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
+++ b/drivers/pinctrl/mediatek/pinctrl-mtk-common.c
@@ -11,6 +11,7 @@
 #include <dm/pinctrl.h>
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-mtk-common.h"
 
diff --git a/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c b/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
index b5d7406..c6cb941 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-axg-pmx.c
@@ -4,6 +4,7 @@
  * Copyright (C) 2017 Xingyu Chen <xingyu.chen@amlogic.com>
  */
 
+#include <log.h>
 #include <asm/gpio.h>
 #include <common.h>
 #include <dm.h>
diff --git a/drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c b/drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c
index b37b517..159f340 100644
--- a/drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c
+++ b/drivers/pinctrl/meson/pinctrl-meson-gx-pmx.c
@@ -3,10 +3,12 @@
  * (C) Copyright 2016 - Beniamino Galvani <b.galvani@gmail.com>
  */
 
+#include <log.h>
 #include <asm/gpio.h>
 #include <common.h>
 #include <dm.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include "pinctrl-meson-gx.h"
 
diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c
index 7fbe281..d4539b0 100644
--- a/drivers/pinctrl/meson/pinctrl-meson.c
+++ b/drivers/pinctrl/meson/pinctrl-meson.c
@@ -5,14 +5,17 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
 #include <dm/pinctrl.h>
 #include <fdt_support.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/io.h>
+#include <linux/libfdt.h>
 #include <linux/sizes.h>
 #include <asm/gpio.h>
 
diff --git a/drivers/pinctrl/mscc/mscc-common.c b/drivers/pinctrl/mscc/mscc-common.c
index 90c54b4..307ed1d 100644
--- a/drivers/pinctrl/mscc/mscc-common.c
+++ b/drivers/pinctrl/mscc/mscc-common.c
@@ -21,6 +21,7 @@
 #include <dm/root.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include "mscc-common.h"
 
diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
index 6e0bcae..2dee79a 100644
--- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
+++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c
@@ -32,6 +32,8 @@
 #include <asm/gpio.h>
 #include <asm/system.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/pinctrl/mvebu/pinctrl-mvebu.c b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
index 0b9c9e1..2206e95 100644
--- a/drivers/pinctrl/mvebu/pinctrl-mvebu.c
+++ b/drivers/pinctrl/mvebu/pinctrl-mvebu.c
@@ -9,11 +9,13 @@
 #include <fdtdec.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <dm/root.h>
 #include <asm/system.h>
 #include <asm/io.h>
 #include <asm/arch-armada8k/soc-info.h>
+#include <linux/bitops.h>
 #include "pinctrl-mvebu.h"
 
 #define AP_EMMC_PHY_CTRL_REG		0x100
diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c b/drivers/pinctrl/nxp/pinctrl-imx.c
index 474c38a..48c7bde 100644
--- a/drivers/pinctrl/nxp/pinctrl-imx.c
+++ b/drivers/pinctrl/nxp/pinctrl-imx.c
@@ -8,6 +8,7 @@
 #include <mapmem.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/err.h>
 #include <dm.h>
diff --git a/drivers/pinctrl/nxp/pinctrl-mxs.c b/drivers/pinctrl/nxp/pinctrl-mxs.c
index 8d61dfe..a403114 100644
--- a/drivers/pinctrl/nxp/pinctrl-mxs.c
+++ b/drivers/pinctrl/nxp/pinctrl-mxs.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <linux/io.h>
diff --git a/drivers/pinctrl/pinctrl-at91-pio4.c b/drivers/pinctrl/pinctrl-at91-pio4.c
index 0c43686..801d142 100644
--- a/drivers/pinctrl/pinctrl-at91-pio4.c
+++ b/drivers/pinctrl/pinctrl-at91-pio4.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/err.h>
 #include <mach/atmel_pio4.h>
diff --git a/drivers/pinctrl/pinctrl-at91.c b/drivers/pinctrl/pinctrl-at91.c
index 27f274f..b3fa124 100644
--- a/drivers/pinctrl/pinctrl-at91.c
+++ b/drivers/pinctrl/pinctrl-at91.c
@@ -8,8 +8,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <asm/hardware.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/err.h>
 #include <mach/at91_pio.h>
diff --git a/drivers/pinctrl/pinctrl-sandbox.c b/drivers/pinctrl/pinctrl-sandbox.c
index 3ee75fb..ac0119d 100644
--- a/drivers/pinctrl/pinctrl-sandbox.c
+++ b/drivers/pinctrl/pinctrl-sandbox.c
@@ -7,7 +7,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 
 static const char * const sandbox_pins[] = {
 	"SCL",
diff --git a/drivers/pinctrl/pinctrl-sti.c b/drivers/pinctrl/pinctrl-sti.c
index f0cd845..8e942a8 100644
--- a/drivers/pinctrl/pinctrl-sti.c
+++ b/drivers/pinctrl/pinctrl-sti.c
@@ -14,6 +14,8 @@
 #include <syscon.h>
 #include <asm/io.h>
 #include <dm/pinctrl.h>
+#include <linux/bug.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c
index b0e43ae..a3240cc 100644
--- a/drivers/pinctrl/pinctrl-stmfx.c
+++ b/drivers/pinctrl/pinctrl-stmfx.c
@@ -15,6 +15,8 @@
 #include <dm/lists.h>
 #include <dm/pinctrl.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 /* STMFX pins = GPIO[15:0] + aGPIO[7:0] */
diff --git a/drivers/pinctrl/pinctrl_pic32.c b/drivers/pinctrl/pinctrl_pic32.c
index 06f1518..911af12 100644
--- a/drivers/pinctrl/pinctrl_pic32.c
+++ b/drivers/pinctrl/pinctrl_pic32.c
@@ -7,8 +7,10 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <mach/pic32.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c
index 9926235..fc241fd 100644
--- a/drivers/pinctrl/pinctrl_stm32.c
+++ b/drivers/pinctrl/pinctrl_stm32.c
@@ -1,6 +1,7 @@
 #include <common.h>
 #include <dm.h>
 #include <hwspinlock.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
@@ -8,7 +9,9 @@
 #include <dm/device_compat.h>
 #include <dm/lists.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/pinctrl/renesas/pfc-r7s72100.c b/drivers/pinctrl/renesas/pfc-r7s72100.c
index 7e4530d..5055780 100644
--- a/drivers/pinctrl/renesas/pfc-r7s72100.c
+++ b/drivers/pinctrl/renesas/pfc-r7s72100.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <dm/lists.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/err.h>
 
diff --git a/drivers/pinctrl/renesas/pfc-r8a77990.c b/drivers/pinctrl/renesas/pfc-r8a77990.c
index 5313f2f..de22e49 100644
--- a/drivers/pinctrl/renesas/pfc-r8a77990.c
+++ b/drivers/pinctrl/renesas/pfc-r8a77990.c
@@ -15,6 +15,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <linux/kernel.h>
 
 #include "sh_pfc.h"
diff --git a/drivers/pinctrl/renesas/pfc.c b/drivers/pinctrl/renesas/pfc.c
index ab64f4f..1179afd 100644
--- a/drivers/pinctrl/renesas/pfc.c
+++ b/drivers/pinctrl/renesas/pfc.c
@@ -17,6 +17,8 @@
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/io.h>
 #include <linux/sizes.h>
 
diff --git a/drivers/pinctrl/renesas/sh_pfc.h b/drivers/pinctrl/renesas/sh_pfc.h
index 1cfb881..db3d513 100644
--- a/drivers/pinctrl/renesas/sh_pfc.h
+++ b/drivers/pinctrl/renesas/sh_pfc.h
@@ -672,4 +672,5 @@
  */
 #define RCAR_GP_PIN(bank, pin)		(((bank) * 32) + (pin))
 
+#include <linux/bug.h>
 #endif /* __SH_PFC_H */
diff --git a/drivers/pinctrl/rockchip/pinctrl-px30.c b/drivers/pinctrl/rockchip/pinctrl-px30.c
index bb56ae9..617721a 100644
--- a/drivers/pinctrl/rockchip/pinctrl-px30.c
+++ b/drivers/pinctrl/rockchip/pinctrl-px30.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3036.c b/drivers/pinctrl/rockchip/pinctrl-rk3036.c
index 28c9051..d49e300 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3036.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3036.c
@@ -8,6 +8,7 @@
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3128.c b/drivers/pinctrl/rockchip/pinctrl-rk3128.c
index 3eb4d95..a175d6c 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3128.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3128.c
@@ -8,6 +8,7 @@
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3188.c b/drivers/pinctrl/rockchip/pinctrl-rk3188.c
index 043764f..afde809 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3188.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3188.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk322x.c b/drivers/pinctrl/rockchip/pinctrl-rk322x.c
index c5e4fe3..85bc0ef 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk322x.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk322x.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3288.c b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
index 7ae147f..faaa2ce 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3288.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3288.c
@@ -5,8 +5,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3308.c b/drivers/pinctrl/rockchip/pinctrl-rk3308.c
index abd57e5..db2b10a 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3308.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3308.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3328.c b/drivers/pinctrl/rockchip/pinctrl-rk3328.c
index 8d37a6f..f9160f2 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3328.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3328.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3368.c b/drivers/pinctrl/rockchip/pinctrl-rk3368.c
index 6cb7bb4..7a60599 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3368.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3368.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/drivers/pinctrl/rockchip/pinctrl-rk3399.c b/drivers/pinctrl/rockchip/pinctrl-rk3399.c
index 75634e9..d04c1af 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rk3399.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rk3399.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
index 0fd0416..ec1cb9b 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
@@ -5,10 +5,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
+#include <linux/libfdt.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/rockchip/pinctrl-rockchip.h b/drivers/pinctrl/rockchip/pinctrl-rockchip.h
index 5edc7cb..d969c20 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rockchip.h
+++ b/drivers/pinctrl/rockchip/pinctrl-rockchip.h
@@ -6,6 +6,7 @@
 #ifndef __DRIVERS_PINCTRL_ROCKCHIP_H
 #define __DRIVERS_PINCTRL_ROCKCHIP_H
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 
 /**
diff --git a/drivers/pinctrl/rockchip/pinctrl-rv1108.c b/drivers/pinctrl/rockchip/pinctrl-rv1108.c
index 54610a3..2233432 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rv1108.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rv1108.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/pinctrl.h>
 #include <regmap.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 
 #include "pinctrl-rockchip.h"
 
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
index abeba96..8545b9d 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/io.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier.h b/drivers/pinctrl/uniphier/pinctrl-uniphier.h
index 8f83eca..5951835 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier.h
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier.h
@@ -8,6 +8,7 @@
 #define __PINCTRL_UNIPHIER_H__
 
 #include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/build_bug.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
diff --git a/drivers/power/acpi_pmc/pmc_emul.c b/drivers/power/acpi_pmc/pmc_emul.c
index dfff335..5ed6fcc 100644
--- a/drivers/power/acpi_pmc/pmc_emul.c
+++ b/drivers/power/acpi_pmc/pmc_emul.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pci.h>
 #include <asm/test.h>
 #include <power/acpi_pmc.h>
diff --git a/drivers/power/acpi_pmc/sandbox.c b/drivers/power/acpi_pmc/sandbox.c
index 7fbbf97..48a6c66 100644
--- a/drivers/power/acpi_pmc/sandbox.c
+++ b/drivers/power/acpi_pmc/sandbox.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/io.h>
 #include <power/acpi_pmc.h>
 
diff --git a/drivers/power/axp152.c b/drivers/power/axp152.c
index 361be6c..d6e3612 100644
--- a/drivers/power/axp152.c
+++ b/drivers/power/axp152.c
@@ -79,7 +79,7 @@
 	return 0;
 }
 
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP152_SHUTDOWN, AXP152_POWEROFF);
 
diff --git a/drivers/power/axp209.c b/drivers/power/axp209.c
index 67b4209..ade5319 100644
--- a/drivers/power/axp209.c
+++ b/drivers/power/axp209.c
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <asm/arch/pmic_bus.h>
 #include <axp_pmic.h>
+#include <linux/delay.h>
 
 #ifdef CONFIG_AXP_ALDO3_VOLT_SLOPE_08
 #  define AXP209_VRC_SLOPE AXP209_VRC_LDO3_800uV_uS
@@ -229,7 +230,7 @@
 	return 0;
 }
 
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP209_SHUTDOWN, AXP209_POWEROFF);
 
diff --git a/drivers/power/axp221.c b/drivers/power/axp221.c
index c440047..3446fe7 100644
--- a/drivers/power/axp221.c
+++ b/drivers/power/axp221.c
@@ -264,7 +264,7 @@
 	return 0;
 }
 
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP221_SHUTDOWN, AXP221_SHUTDOWN_POWEROFF);
 
diff --git a/drivers/power/axp809.c b/drivers/power/axp809.c
index 7de92f4..6323492 100644
--- a/drivers/power/axp809.c
+++ b/drivers/power/axp809.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <errno.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pmic_bus.h>
@@ -219,7 +220,7 @@
 	return pmic_bus_init();
 }
 
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP809_SHUTDOWN, AXP809_SHUTDOWN_POWEROFF);
 
diff --git a/drivers/power/axp818.c b/drivers/power/axp818.c
index 834919d..0531707 100644
--- a/drivers/power/axp818.c
+++ b/drivers/power/axp818.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <errno.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/pmic_bus.h>
@@ -255,7 +256,7 @@
 	return 0;
 }
 
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	pmic_bus_write(AXP818_SHUTDOWN, AXP818_SHUTDOWN_POWEROFF);
 
diff --git a/drivers/power/battery/bat_trats.c b/drivers/power/battery/bat_trats.c
index 450b1df..54b2bf9 100644
--- a/drivers/power/battery/bat_trats.c
+++ b/drivers/power/battery/bat_trats.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <console.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/battery.h>
 #include <power/max8997_pmic.h>
diff --git a/drivers/power/battery/bat_trats2.c b/drivers/power/battery/bat_trats2.c
index bb21cd7..1172970 100644
--- a/drivers/power/battery/bat_trats2.c
+++ b/drivers/power/battery/bat_trats2.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/battery.h>
 #include <power/max77693_pmic.h>
diff --git a/drivers/power/domain/bcm6328-power-domain.c b/drivers/power/domain/bcm6328-power-domain.c
index a6426be..a494bfa 100644
--- a/drivers/power/domain/bcm6328-power-domain.c
+++ b/drivers/power/domain/bcm6328-power-domain.c
@@ -8,6 +8,7 @@
 #include <malloc.h>
 #include <power-domain-uclass.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define MAX_DOMAINS	32
 
diff --git a/drivers/power/domain/imx8-power-domain-legacy.c b/drivers/power/domain/imx8-power-domain-legacy.c
index 7ba4056..889b65a 100644
--- a/drivers/power/domain/imx8-power-domain-legacy.c
+++ b/drivers/power/domain/imx8-power-domain-legacy.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain-uclass.h>
 #include <asm/io.h>
diff --git a/drivers/power/domain/imx8-power-domain.c b/drivers/power/domain/imx8-power-domain.c
index 571146e..6461ab2 100644
--- a/drivers/power/domain/imx8-power-domain.c
+++ b/drivers/power/domain/imx8-power-domain.c
@@ -6,6 +6,7 @@
 #define DEBUG
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain-uclass.h>
 #include <asm/arch/power-domain.h>
diff --git a/drivers/power/domain/meson-ee-pwrc.c b/drivers/power/domain/meson-ee-pwrc.c
index 7082c80..8349a9c 100644
--- a/drivers/power/domain/meson-ee-pwrc.c
+++ b/drivers/power/domain/meson-ee-pwrc.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain-uclass.h>
 #include <regmap.h>
@@ -14,6 +15,8 @@
 #include <clk.h>
 #include <dt-bindings/power/meson-g12a-power.h>
 #include <dt-bindings/power/meson-sm1-power.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 /* AO Offsets */
diff --git a/drivers/power/domain/meson-gx-pwrc-vpu.c b/drivers/power/domain/meson-gx-pwrc-vpu.c
index 12cdfcd..a41b230 100644
--- a/drivers/power/domain/meson-gx-pwrc-vpu.c
+++ b/drivers/power/domain/meson-gx-pwrc-vpu.c
@@ -8,12 +8,15 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain-uclass.h>
 #include <regmap.h>
 #include <syscon.h>
 #include <reset.h>
 #include <clk.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 enum {
diff --git a/drivers/power/domain/mtk-power-domain.c b/drivers/power/domain/mtk-power-domain.c
index 3ff7ca1..fae4749 100644
--- a/drivers/power/domain/mtk-power-domain.c
+++ b/drivers/power/domain/mtk-power-domain.c
@@ -13,6 +13,7 @@
 #include <syscon.h>
 #include <asm/io.h>
 #include <asm/processor.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/iopoll.h>
 
diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c
index 2b7a1cb..c2c7c3b 100644
--- a/drivers/power/domain/power-domain-uclass.c
+++ b/drivers/power/domain/power-domain-uclass.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain.h>
 #include <power-domain-uclass.h>
diff --git a/drivers/power/domain/sandbox-power-domain.c b/drivers/power/domain/sandbox-power-domain.c
index 3a834a9..4d9a200 100644
--- a/drivers/power/domain/sandbox-power-domain.c
+++ b/drivers/power/domain/sandbox-power-domain.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain-uclass.h>
 #include <asm/io.h>
diff --git a/drivers/power/domain/tegra186-power-domain.c b/drivers/power/domain/tegra186-power-domain.c
index e872441..707735c 100644
--- a/drivers/power/domain/tegra186-power-domain.c
+++ b/drivers/power/domain/tegra186-power-domain.c
@@ -5,10 +5,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <misc.h>
 #include <power-domain-uclass.h>
 #include <asm/arch-tegra/bpmp_abi.h>
+#include <linux/bitops.h>
 
 #define UPDATE	BIT(0)
 #define ON	BIT(1)
diff --git a/drivers/power/domain/ti-sci-power-domain.c b/drivers/power/domain/ti-sci-power-domain.c
index a586670..7ee121d 100644
--- a/drivers/power/domain/ti-sci-power-domain.c
+++ b/drivers/power/domain/ti-sci-power-domain.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <power-domain-uclass.h>
 #include <dm/device_compat.h>
diff --git a/drivers/power/exynos-tmu.c b/drivers/power/exynos-tmu.c
index 6a66267..4fba7b5 100644
--- a/drivers/power/exynos-tmu.c
+++ b/drivers/power/exynos-tmu.c
@@ -20,6 +20,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <tmu.h>
 #include <asm/arch/tmu.h>
 #include <asm/arch/power.h>
diff --git a/drivers/power/fuel_gauge/fg_max17042.c b/drivers/power/fuel_gauge/fg_max17042.c
index 8cfdf65..a395d58 100644
--- a/drivers/power/fuel_gauge/fg_max17042.c
+++ b/drivers/power/fuel_gauge/fg_max17042.c
@@ -5,6 +5,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/max17042_fg.h>
 #include <i2c.h>
diff --git a/drivers/power/mfd/fg_max77693.c b/drivers/power/mfd/fg_max77693.c
index 0de9ee7..983a6d4 100644
--- a/drivers/power/mfd/fg_max77693.c
+++ b/drivers/power/mfd/fg_max77693.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/max77693_fg.h>
 #include <i2c.h>
diff --git a/drivers/power/mfd/muic_max77693.c b/drivers/power/mfd/muic_max77693.c
index 0eb26d2..36ee44b 100644
--- a/drivers/power/mfd/muic_max77693.c
+++ b/drivers/power/mfd/muic_max77693.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/power_chrg.h>
 #include <power/max77693_muic.h>
diff --git a/drivers/power/mfd/pmic_max77693.c b/drivers/power/mfd/pmic_max77693.c
index c3bd6c4..e32a972 100644
--- a/drivers/power/mfd/pmic_max77693.c
+++ b/drivers/power/mfd/pmic_max77693.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/max77693_pmic.h>
 #include <i2c.h>
diff --git a/drivers/power/mt6323.c b/drivers/power/mt6323.c
index 566be5f..354817a 100644
--- a/drivers/power/mt6323.c
+++ b/drivers/power/mt6323.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #define PWRAP_BASE		0x1000d000
 #define PWRAP_WACS2_CMD		0x9c
@@ -17,7 +18,7 @@
 #define RTC_BBPU_KEY		(0x43 << 8)
 #define RTC_WRTGR		0x003c
 
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	u32 addr, val;
 
diff --git a/drivers/power/pmic/act8846.c b/drivers/power/pmic/act8846.c
index 186fa90..8f0f5a6 100644
--- a/drivers/power/pmic/act8846.c
+++ b/drivers/power/pmic/act8846.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <power/act8846_pmic.h>
 #include <power/pmic.h>
diff --git a/drivers/power/pmic/as3722.c b/drivers/power/pmic/as3722.c
index 54adcbf..3aa3cce 100644
--- a/drivers/power/pmic/as3722.c
+++ b/drivers/power/pmic/as3722.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
 #include <dm/lists.h>
 #include <power/as3722.h>
 #include <power/pmic.h>
diff --git a/drivers/power/pmic/bd71837.c b/drivers/power/pmic/bd71837.c
index 2e04298..31c9139 100644
--- a/drivers/power/pmic/bd71837.c
+++ b/drivers/power/pmic/bd71837.c
@@ -7,6 +7,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/bd71837.h>
diff --git a/drivers/power/pmic/da9063.c b/drivers/power/pmic/da9063.c
index abda7a5..25101d1 100644
--- a/drivers/power/pmic/da9063.c
+++ b/drivers/power/pmic/da9063.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/da9063_pmic.h>
diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c
index a5f855c..4d1e686 100644
--- a/drivers/power/pmic/fan53555.c
+++ b/drivers/power/pmic/fan53555.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
diff --git a/drivers/power/pmic/i2c_pmic_emul.c b/drivers/power/pmic/i2c_pmic_emul.c
index 86d7b89..404fe00 100644
--- a/drivers/power/pmic/i2c_pmic_emul.c
+++ b/drivers/power/pmic/i2c_pmic_emul.c
@@ -8,6 +8,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <malloc.h>
 #include <power/pmic.h>
 #include <power/sandbox_pmic.h>
diff --git a/drivers/power/pmic/lp873x.c b/drivers/power/pmic/lp873x.c
index 4ae4043..2b1260e 100644
--- a/drivers/power/pmic/lp873x.c
+++ b/drivers/power/pmic/lp873x.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/lp873x.h>
diff --git a/drivers/power/pmic/lp87565.c b/drivers/power/pmic/lp87565.c
index 3e5fc60..f4a4bd0 100644
--- a/drivers/power/pmic/lp87565.c
+++ b/drivers/power/pmic/lp87565.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/lp87565.h>
diff --git a/drivers/power/pmic/max77686.c b/drivers/power/pmic/max77686.c
index 8e3a8cf..9f02c0b 100644
--- a/drivers/power/pmic/max77686.c
+++ b/drivers/power/pmic/max77686.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/max77686_pmic.h>
diff --git a/drivers/power/pmic/muic_max8997.c b/drivers/power/pmic/muic_max8997.c
index 241ab35..969ce90 100644
--- a/drivers/power/pmic/muic_max8997.c
+++ b/drivers/power/pmic/muic_max8997.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/power_chrg.h>
 #include <power/max8997_muic.h>
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c
index 36be119..6080cbf 100644
--- a/drivers/power/pmic/palmas.c
+++ b/drivers/power/pmic/palmas.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/palmas.h>
diff --git a/drivers/power/pmic/pca9450.c b/drivers/power/pmic/pca9450.c
index 77986c4..0c9d9a3 100644
--- a/drivers/power/pmic/pca9450.c
+++ b/drivers/power/pmic/pca9450.c
@@ -8,6 +8,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/pca9450.h>
diff --git a/drivers/power/pmic/pfuze100.c b/drivers/power/pmic/pfuze100.c
index db630f3..65c4456 100644
--- a/drivers/power/pmic/pfuze100.c
+++ b/drivers/power/pmic/pfuze100.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/pfuze100_pmic.h>
diff --git a/drivers/power/pmic/pmic-uclass.c b/drivers/power/pmic/pmic-uclass.c
index db68c76..7770171 100644
--- a/drivers/power/pmic/pmic-uclass.c
+++ b/drivers/power/pmic/pmic-uclass.c
@@ -8,6 +8,7 @@
 #include <fdtdec.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <vsprintf.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
diff --git a/drivers/power/pmic/pmic_hi6553.c b/drivers/power/pmic/pmic_hi6553.c
index 6443c9f..80b9078 100644
--- a/drivers/power/pmic/pmic_hi6553.c
+++ b/drivers/power/pmic/pmic_hi6553.c
@@ -5,6 +5,7 @@
  */
 #include <asm/io.h>
 #include <common.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/max8997_muic.h>
 #include <power/hi6553_pmic.h>
diff --git a/drivers/power/pmic/pmic_max8997.c b/drivers/power/pmic/pmic_max8997.c
index 87c438e..1d834ff7 100644
--- a/drivers/power/pmic/pmic_max8997.c
+++ b/drivers/power/pmic/pmic_max8997.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/max8997_pmic.h>
 #include <i2c.h>
diff --git a/drivers/power/pmic/pmic_tps65910_dm.c b/drivers/power/pmic/pmic_tps65910_dm.c
index 489af59..e03ddc9 100644
--- a/drivers/power/pmic/pmic_tps65910_dm.c
+++ b/drivers/power/pmic/pmic_tps65910_dm.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/tps65910_pmic.h>
diff --git a/drivers/power/pmic/rk8xx.c b/drivers/power/pmic/rk8xx.c
index 52e6d9d..195884b 100644
--- a/drivers/power/pmic/rk8xx.c
+++ b/drivers/power/pmic/rk8xx.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <power/rk8xx_pmic.h>
 #include <power/pmic.h>
 
diff --git a/drivers/power/pmic/rn5t567.c b/drivers/power/pmic/rn5t567.c
index f238396..d9a8298 100644
--- a/drivers/power/pmic/rn5t567.c
+++ b/drivers/power/pmic/rn5t567.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <power/rn5t567_pmic.h>
 #include <power/pmic.h>
diff --git a/drivers/power/pmic/s2mps11.c b/drivers/power/pmic/s2mps11.c
index f2aab6c..1ba1640 100644
--- a/drivers/power/pmic/s2mps11.c
+++ b/drivers/power/pmic/s2mps11.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/s2mps11.h>
 
diff --git a/drivers/power/pmic/s5m8767.c b/drivers/power/pmic/s5m8767.c
index b5ddd49..db6d035 100644
--- a/drivers/power/pmic/s5m8767.c
+++ b/drivers/power/pmic/s5m8767.c
@@ -8,6 +8,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/s5m8767.h>
diff --git a/drivers/power/pmic/tps65090.c b/drivers/power/pmic/tps65090.c
index 5b1d19f..b81df0d 100644
--- a/drivers/power/pmic/tps65090.c
+++ b/drivers/power/pmic/tps65090.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/tps65090.h>
 
diff --git a/drivers/power/pmic/tps65941.c b/drivers/power/pmic/tps65941.c
index 7b3416a..3dfc191 100644
--- a/drivers/power/pmic/tps65941.c
+++ b/drivers/power/pmic/tps65941.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/tps65941.h>
diff --git a/drivers/power/power_core.c b/drivers/power/power_core.c
index 095d8a5..eeed8e2 100644
--- a/drivers/power/power_core.c
+++ b/drivers/power/power_core.c
@@ -10,6 +10,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/types.h>
 #include <linux/list.h>
@@ -120,7 +122,8 @@
 	}
 }
 
-static int do_pmic(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_pmic(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	u32 ret, reg, val;
 	char *cmd, *name;
diff --git a/drivers/power/power_dialog.c b/drivers/power/power_dialog.c
index 9ecd358..e286dd1 100644
--- a/drivers/power/power_dialog.c
+++ b/drivers/power/power_dialog.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <dialog_pmic.h>
 #include <errno.h>
diff --git a/drivers/power/power_i2c.c b/drivers/power/power_i2c.c
index b30f223..5a0455e 100644
--- a/drivers/power/power_i2c.c
+++ b/drivers/power/power_i2c.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/types.h>
 #include <power/pmic.h>
 #include <i2c.h>
diff --git a/drivers/power/regulator/as3722_regulator.c b/drivers/power/regulator/as3722_regulator.c
index a0703c9..0fee9bf 100644
--- a/drivers/power/regulator/as3722_regulator.c
+++ b/drivers/power/regulator/as3722_regulator.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <power/as3722.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/bd71837.c b/drivers/power/regulator/bd71837.c
index 575429a..931d753 100644
--- a/drivers/power/regulator/bd71837.c
+++ b/drivers/power/regulator/bd71837.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/bitops.h>
 #include <power/bd71837.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/da9063.c b/drivers/power/regulator/da9063.c
index 8990be1..5055e39 100644
--- a/drivers/power/regulator/da9063.c
+++ b/drivers/power/regulator/da9063.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <linux/bitops.h>
 #include <power/da9063_pmic.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/fan53555.c b/drivers/power/regulator/fan53555.c
index 24a9b67..b407f55 100644
--- a/drivers/power/regulator/fan53555.c
+++ b/drivers/power/regulator/fan53555.c
@@ -9,7 +9,9 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
 #include <power/fan53555.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c
index 763e671..f9f9659 100644
--- a/drivers/power/regulator/fixed.c
+++ b/drivers/power/regulator/fixed.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 
diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c
index ec1dcb6..cf3fbae 100644
--- a/drivers/power/regulator/gpio-regulator.c
+++ b/drivers/power/regulator/gpio-regulator.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <asm/gpio.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/lp87565_regulator.c b/drivers/power/regulator/lp87565_regulator.c
index f438dea..4ea6c34 100644
--- a/drivers/power/regulator/lp87565_regulator.c
+++ b/drivers/power/regulator/lp87565_regulator.c
@@ -11,6 +11,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/lp87565.h>
diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c
index 60255ee..28a9a14 100644
--- a/drivers/power/regulator/pbias_regulator.c
+++ b/drivers/power/regulator/pbias_regulator.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/pfuze100.c b/drivers/power/regulator/pfuze100.c
index d6d35f3..b568430 100644
--- a/drivers/power/regulator/pfuze100.c
+++ b/drivers/power/regulator/pfuze100.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/pfuze100_pmic.h>
diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c
index 4030144..f870622 100644
--- a/drivers/power/regulator/pwm_regulator.c
+++ b/drivers/power/regulator/pwm_regulator.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <pwm.h>
 #include <dm/device_compat.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index c9d2634..7dcb317 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -7,7 +7,9 @@
 #include <common.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/uclass-internal.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 
diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c
index 33b73b7..16d9412 100644
--- a/drivers/power/regulator/regulator_common.c
+++ b/drivers/power/regulator/regulator_common.c
@@ -6,6 +6,8 @@
 
 #include "regulator_common.h"
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 int regulator_common_ofdata_to_platdata(struct udevice *dev,
diff --git a/drivers/power/regulator/rk8xx.c b/drivers/power/regulator/rk8xx.c
index e99331f..a08e215 100644
--- a/drivers/power/regulator/rk8xx.c
+++ b/drivers/power/regulator/rk8xx.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <power/rk8xx_pmic.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/s2mps11_regulator.c b/drivers/power/regulator/s2mps11_regulator.c
index 67d1f96..a6b4f15 100644
--- a/drivers/power/regulator/s2mps11_regulator.c
+++ b/drivers/power/regulator/s2mps11_regulator.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/s2mps11.h>
diff --git a/drivers/power/regulator/stm32-vrefbuf.c b/drivers/power/regulator/stm32-vrefbuf.c
index 08a10f0..2507735 100644
--- a/drivers/power/regulator/stm32-vrefbuf.c
+++ b/drivers/power/regulator/stm32-vrefbuf.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 #include <linux/kernel.h>
 #include <power/regulator.h>
diff --git a/drivers/power/regulator/stpmic1.c b/drivers/power/regulator/stpmic1.c
index 1e3f96f..3e342f4 100644
--- a/drivers/power/regulator/stpmic1.c
+++ b/drivers/power/regulator/stpmic1.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/stpmic1.h>
diff --git a/drivers/power/regulator/tps65090_regulator.c b/drivers/power/regulator/tps65090_regulator.c
index 0bcf1a6..9e45627 100644
--- a/drivers/power/regulator/tps65090_regulator.c
+++ b/drivers/power/regulator/tps65090_regulator.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/tps65090.h>
diff --git a/drivers/power/regulator/tps65910_regulator.c b/drivers/power/regulator/tps65910_regulator.c
index 12e66eb..171afd3 100644
--- a/drivers/power/regulator/tps65910_regulator.c
+++ b/drivers/power/regulator/tps65910_regulator.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/tps65910_pmic.h>
diff --git a/drivers/power/regulator/tps65941_regulator.c b/drivers/power/regulator/tps65941_regulator.c
index a00ef58..150c72d 100644
--- a/drivers/power/regulator/tps65941_regulator.c
+++ b/drivers/power/regulator/tps65941_regulator.c
@@ -11,6 +11,8 @@
 #include <errno.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <power/pmic.h>
 #include <power/regulator.h>
 #include <power/tps65941.h>
diff --git a/drivers/power/tps6586x.c b/drivers/power/tps6586x.c
index 19680e2..49b28a5 100644
--- a/drivers/power/tps6586x.c
+++ b/drivers/power/tps6586x.c
@@ -5,9 +5,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <tps6586x.h>
 #include <asm/io.h>
 #include <i2c.h>
+#include <linux/delay.h>
 
 static struct udevice *tps6586x_dev;
 
diff --git a/drivers/power/twl4030.c b/drivers/power/twl4030.c
index 42c9001..b0d5cba 100644
--- a/drivers/power/twl4030.c
+++ b/drivers/power/twl4030.c
@@ -22,7 +22,9 @@
  *	Syed Mohammed Khasim <khasim at ti.com>
  */
 
+#include <command.h>
 #include <twl4030.h>
+#include <linux/delay.h>
 
 /*
  * Power Reset
@@ -172,7 +174,7 @@
 }
 
 #ifdef CONFIG_CMD_POWEROFF
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	twl4030_power_off();
 
diff --git a/drivers/power/twl6030.c b/drivers/power/twl6030.c
index 103960d..60a5aaa 100644
--- a/drivers/power/twl6030.c
+++ b/drivers/power/twl6030.c
@@ -4,6 +4,7 @@
  * Texas Instruments, <www.ti.com>
  */
 #include <config.h>
+#include <linux/delay.h>
 
 #include <twl6030.h>
 
diff --git a/drivers/pwm/exynos_pwm.c b/drivers/pwm/exynos_pwm.c
index 1c829d2..fed1583 100644
--- a/drivers/pwm/exynos_pwm.c
+++ b/drivers/pwm/exynos_pwm.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pwm.h>
 #include <asm/io.h>
 #include <asm/arch/clk.h>
diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index 8d8f3e6..f5b9544 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <div64.h>
 #include <dm.h>
+#include <log.h>
 #include <pwm.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/io.h>
diff --git a/drivers/pwm/rk_pwm.c b/drivers/pwm/rk_pwm.c
index 46888e9..911da1d 100644
--- a/drivers/pwm/rk_pwm.c
+++ b/drivers/pwm/rk_pwm.c
@@ -8,11 +8,13 @@
 #include <clk.h>
 #include <div64.h>
 #include <dm.h>
+#include <log.h>
 #include <pwm.h>
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/pwm.h>
+#include <linux/bitops.h>
 #include <power/regulator.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/pwm/sunxi_pwm.c b/drivers/pwm/sunxi_pwm.c
index 8a55e4f..56215db 100644
--- a/drivers/pwm/sunxi_pwm.c
+++ b/drivers/pwm/sunxi_pwm.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <div64.h>
 #include <dm.h>
+#include <log.h>
 #include <pwm.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/drivers/pwm/tegra_pwm.c b/drivers/pwm/tegra_pwm.c
index 02c3650..5e98d0f 100644
--- a/drivers/pwm/tegra_pwm.c
+++ b/drivers/pwm/tegra_pwm.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <pwm.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index fbad124..61ca476 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -781,7 +781,7 @@
 	return qe_firmware_uploaded ? &qe_firmware_info : NULL;
 }
 
-static int qe_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int qe_cmd(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ulong addr;
 
diff --git a/drivers/qe/uec.c b/drivers/qe/uec.c
index 69cdf94..849f191 100644
--- a/drivers/qe/uec.c
+++ b/drivers/qe/uec.c
@@ -6,8 +6,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <linux/immap_qe.h>
diff --git a/drivers/qe/uec_phy.c b/drivers/qe/uec_phy.c
index 9425379..69c22dd 100644
--- a/drivers/qe/uec_phy.c
+++ b/drivers/qe/uec_phy.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <net.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/immap_qe.h>
 #include <asm/io.h>
@@ -875,7 +876,7 @@
 			uec_phy_write(mii_info, 0x04, 0x01e1);
 			uec_phy_write(mii_info, 0x00, 0x9140);
 			uec_phy_write(mii_info, 0x00, 0x1000);
-			udelay (100000);
+			mdelay(100);
 			uec_phy_write(mii_info, 0x00, 0x2900);
 			uec_phy_write(mii_info, 0x14, 0x0cd2);
 			uec_phy_write(mii_info, 0x00, 0xa100);
@@ -884,13 +885,13 @@
 			uec_phy_write(mii_info, 0x04, 0x05e1);
 			uec_phy_write(mii_info, 0x00, 0xa100);
 			uec_phy_write(mii_info, 0x00, 0x2100);
-			udelay (1000000);
+			mdelay(1000);
 		} else if (speed == SPEED_10) {
 			uec_phy_write(mii_info, 0x14, 0x8e40);
 			uec_phy_write(mii_info, 0x1b, 0x800b);
 			uec_phy_write(mii_info, 0x14, 0x0c82);
 			uec_phy_write(mii_info, 0x00, 0x8100);
-			udelay (1000000);
+			mdelay(1000);
 		}
 	}
 
diff --git a/drivers/ram/imxrt_sdram.c b/drivers/ram/imxrt_sdram.c
index ac15e94..765a214 100644
--- a/drivers/ram/imxrt_sdram.c
+++ b/drivers/ram/imxrt_sdram.c
@@ -7,8 +7,12 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 /* SDRAM Command Code */
diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c
index 8cf7486..8bbd8cf 100644
--- a/drivers/ram/k3-am654-ddrss.c
+++ b/drivers/ram/k3-am654-ddrss.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <ram.h>
 #include <asm/io.h>
 #include <power-domain.h>
diff --git a/drivers/ram/k3-am654-ddrss.h b/drivers/ram/k3-am654-ddrss.h
index 94a7c91..c87f186 100644
--- a/drivers/ram/k3-am654-ddrss.h
+++ b/drivers/ram/k3-am654-ddrss.h
@@ -11,6 +11,7 @@
 #define __K3_AM654_DDRSS_H
 
 /* DDRSS subsystem wrapper logic registers */
+#include <linux/bitops.h>
 #define DDRSS_SS_ID_REV_REG		0x00000000
 #define DDRSS_SS_CTL_REG		0x00000004
 #define DDRSS_V2H_CTL_REG		0x00000020
diff --git a/drivers/ram/k3-j721e/k3-j721e-ddrss.c b/drivers/ram/k3-j721e/k3-j721e-ddrss.c
index 352483c..d647a8a 100644
--- a/drivers/ram/k3-j721e/k3-j721e-ddrss.c
+++ b/drivers/ram/k3-j721e/k3-j721e-ddrss.c
@@ -9,6 +9,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <hang.h>
+#include <log.h>
 #include <ram.h>
 #include <asm/io.h>
 #include <power-domain.h>
diff --git a/drivers/ram/mediatek/ddr3-mt7629.c b/drivers/ram/mediatek/ddr3-mt7629.c
index b413f49..b3a68cb 100644
--- a/drivers/ram/mediatek/ddr3-mt7629.c
+++ b/drivers/ram/mediatek/ddr3-mt7629.c
@@ -12,6 +12,8 @@
 #include <dm.h>
 #include <ram.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* EMI */
 #define EMI_CONA			0x000
diff --git a/drivers/ram/mpc83xx_sdram.c b/drivers/ram/mpc83xx_sdram.c
index 46449d3..a226bac 100644
--- a/drivers/ram/mpc83xx_sdram.c
+++ b/drivers/ram/mpc83xx_sdram.c
@@ -7,7 +7,9 @@
 #include <common.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <ram.h>
+#include <asm/bitops.h>
 #include <dt-bindings/memory/mpc83xx-sdram.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c
index 2d82a17..92457a1 100644
--- a/drivers/ram/rockchip/dmc-rk3368.c
+++ b/drivers/ram/rockchip/dmc-rk3368.c
@@ -7,6 +7,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <hang.h>
+#include <log.h>
 #include <dt-bindings/memory/rk3368-dmc.h>
 #include <dt-structs.h>
 #include <ram.h>
@@ -19,6 +20,8 @@
 #include <asm/arch-rockchip/ddr_rk3368.h>
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_rk3288.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 struct dram_info {
diff --git a/drivers/ram/rockchip/sdram_pctl_px30.c b/drivers/ram/rockchip/sdram_pctl_px30.c
index 1839ceb..331d85f 100644
--- a/drivers/ram/rockchip/sdram_pctl_px30.c
+++ b/drivers/ram/rockchip/sdram_pctl_px30.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_pctl_px30.h>
+#include <linux/delay.h>
 
 /*
  * rank = 1: cs0
diff --git a/drivers/ram/rockchip/sdram_phy_px30.c b/drivers/ram/rockchip/sdram_phy_px30.c
index 5de7377..f7f6de1 100644
--- a/drivers/ram/rockchip/sdram_phy_px30.c
+++ b/drivers/ram/rockchip/sdram_phy_px30.c
@@ -9,6 +9,7 @@
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_common.h>
 #include <asm/arch-rockchip/sdram_phy_px30.h>
+#include <linux/delay.h>
 
 static void sdram_phy_dll_bypass_set(void __iomem *phy_base, u32 freq)
 {
diff --git a/drivers/ram/rockchip/sdram_px30.c b/drivers/ram/rockchip/sdram_px30.c
index 7292554..fd5763d 100644
--- a/drivers/ram/rockchip/sdram_px30.c
+++ b/drivers/ram/rockchip/sdram_px30.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <debug_uart.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <syscon.h>
 #include <asm/io.h>
@@ -15,6 +17,7 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_px30.h>
+#include <linux/delay.h>
 
 struct dram_info {
 #ifdef CONFIG_TPL_BUILD
diff --git a/drivers/ram/rockchip/sdram_rk3128.c b/drivers/ram/rockchip/sdram_rk3128.c
index 8486653..0162955 100644
--- a/drivers/ram/rockchip/sdram_rk3128.c
+++ b/drivers/ram/rockchip/sdram_rk3128.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <ram.h>
 #include <syscon.h>
 #include <asm/arch-rockchip/clock.h>
diff --git a/drivers/ram/rockchip/sdram_rk3188.c b/drivers/ram/rockchip/sdram_rk3188.c
index 9b5eb38..7aedb4f 100644
--- a/drivers/ram/rockchip/sdram_rk3188.c
+++ b/drivers/ram/rockchip/sdram_rk3188.c
@@ -12,6 +12,8 @@
 #include <dt-structs.h>
 #include <errno.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <regmap.h>
 #include <syscon.h>
@@ -23,6 +25,7 @@
 #include <asm/arch-rockchip/pmu_rk3188.h>
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_rk3288.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 struct chan_info {
diff --git a/drivers/ram/rockchip/sdram_rk322x.c b/drivers/ram/rockchip/sdram_rk322x.c
index 223f048..094693c 100644
--- a/drivers/ram/rockchip/sdram_rk322x.c
+++ b/drivers/ram/rockchip/sdram_rk322x.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <init.h>
 #include <ram.h>
 #include <regmap.h>
 #include <syscon.h>
@@ -19,6 +20,7 @@
 #include <asm/arch-rockchip/uart.h>
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/types.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c
index 9f6f555..64d704e 100644
--- a/drivers/ram/rockchip/sdram_rk3288.c
+++ b/drivers/ram/rockchip/sdram_rk3288.c
@@ -12,6 +12,8 @@
 #include <dt-structs.h>
 #include <errno.h>
 #include <hang.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <regmap.h>
 #include <syscon.h>
@@ -23,6 +25,7 @@
 #include <asm/arch-rockchip/pmu_rk3288.h>
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_rk3288.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <power/regulator.h>
 #include <power/rk8xx_pmic.h>
diff --git a/drivers/ram/rockchip/sdram_rk3328.c b/drivers/ram/rockchip/sdram_rk3328.c
index 8329f4a..3f3926f 100644
--- a/drivers/ram/rockchip/sdram_rk3328.c
+++ b/drivers/ram/rockchip/sdram_rk3328.c
@@ -7,6 +7,8 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <dt-structs.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <regmap.h>
 #include <syscon.h>
@@ -17,6 +19,7 @@
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_rk3328.h>
 #include <asm/arch-rockchip/uart.h>
+#include <linux/delay.h>
 
 struct dram_info {
 #ifdef CONFIG_TPL_BUILD
diff --git a/drivers/ram/rockchip/sdram_rk3399.c b/drivers/ram/rockchip/sdram_rk3399.c
index d69ef01..60a1ab8 100644
--- a/drivers/ram/rockchip/sdram_rk3399.c
+++ b/drivers/ram/rockchip/sdram_rk3399.c
@@ -9,6 +9,8 @@
 #include <clk.h>
 #include <dm.h>
 #include <dt-structs.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <regmap.h>
 #include <syscon.h>
@@ -20,6 +22,7 @@
 #include <asm/arch-rockchip/hardware.h>
 #include <asm/arch-rockchip/sdram.h>
 #include <asm/arch-rockchip/sdram_rk3399.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <time.h>
 
diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c
index 2d03333..3fddf4d 100644
--- a/drivers/ram/stm32_sdram.c
+++ b/drivers/ram/stm32_sdram.c
@@ -7,9 +7,13 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define MEM_MODE_MASK	GENMASK(2, 0)
 #define SWP_FMC_OFFSET 10
diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr.c b/drivers/ram/stm32mp1/stm32mp1_ddr.c
index 11b14ae..bf3a4c9 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ddr.c
+++ b/drivers/ram/stm32mp1/stm32mp1_ddr.c
@@ -5,11 +5,14 @@
 
 #include <common.h>
 #include <clk.h>
+#include <log.h>
 #include <ram.h>
 #include <reset.h>
 #include <timer.h>
 #include <asm/io.h>
 #include <asm/arch/ddr.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/iopoll.h>
 #include "stm32mp1_ddr.h"
 #include "stm32mp1_ddr_regs.h"
diff --git a/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h b/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h
index afd93c5..3c8885a 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h
+++ b/drivers/ram/stm32mp1/stm32mp1_ddr_regs.h
@@ -7,6 +7,7 @@
 #define _RAM_STM32MP1_DDR_REGS_H
 
 /* DDR3/LPDDR2/LPDDR3 Controller (DDRCTRL) registers */
+#include <linux/bitops.h>
 struct stm32mp1_ddrctl {
 	u32 mstr ;		/* 0x0 Master*/
 	u32 stat;		/* 0x4 Operating Mode Status*/
diff --git a/drivers/ram/stm32mp1/stm32mp1_interactive.c b/drivers/ram/stm32mp1/stm32mp1_interactive.c
index 805c9dd..38390c0 100644
--- a/drivers/ram/stm32mp1/stm32mp1_interactive.c
+++ b/drivers/ram/stm32mp1/stm32mp1_interactive.c
@@ -4,9 +4,11 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <console.h>
 #include <cli.h>
 #include <clk.h>
+#include <log.h>
 #include <malloc.h>
 #include <ram.h>
 #include <reset.h>
@@ -150,7 +152,7 @@
 static void stm32mp1_do_info(struct ddr_info *priv,
 			     struct stm32mp1_ddr_config *config,
 			     enum stm32mp1_ddr_interact_step step,
-			     int argc, char * const argv[])
+			     int argc, char *const argv[])
 {
 	unsigned long value;
 	static char *ddr_name;
@@ -223,7 +225,7 @@
 }
 
 static bool stm32mp1_do_freq(struct ddr_info *priv,
-			     int argc, char * const argv[])
+			     int argc, char *const argv[])
 {
 	unsigned long ddrphy_clk;
 
@@ -246,7 +248,7 @@
 
 static void stm32mp1_do_param(enum stm32mp1_ddr_interact_step step,
 			      const struct stm32mp1_ddr_config *config,
-			      int argc, char * const argv[])
+			      int argc, char *const argv[])
 {
 	switch (argc) {
 	case 1:
@@ -266,7 +268,7 @@
 }
 
 static void stm32mp1_do_print(struct ddr_info *priv,
-			      int argc, char * const argv[])
+			      int argc, char *const argv[])
 {
 	switch (argc) {
 	case 1:
@@ -281,7 +283,7 @@
 }
 
 static int stm32mp1_do_step(enum stm32mp1_ddr_interact_step step,
-			    int argc, char * const argv[])
+			    int argc, char *const argv[])
 {
 	int i;
 	unsigned long value;
diff --git a/drivers/ram/stm32mp1/stm32mp1_ram.c b/drivers/ram/stm32mp1/stm32mp1_ram.c
index 8bcd861..9022679 100644
--- a/drivers/ram/stm32mp1/stm32mp1_ram.c
+++ b/drivers/ram/stm32mp1/stm32mp1_ram.c
@@ -7,6 +7,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <ram.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/drivers/ram/stm32mp1/stm32mp1_tests.c b/drivers/ram/stm32mp1/stm32mp1_tests.c
index 12298cf..bacdd74 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tests.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tests.c
@@ -5,6 +5,8 @@
 #include <common.h>
 #include <console.h>
 #include <init.h>
+#include <log.h>
+#include <rand.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <linux/log2.h>
diff --git a/drivers/ram/stm32mp1/stm32mp1_tuning.c b/drivers/ram/stm32mp1/stm32mp1_tuning.c
index 3013b7b..a8d6892 100644
--- a/drivers/ram/stm32mp1/stm32mp1_tuning.c
+++ b/drivers/ram/stm32mp1/stm32mp1_tuning.c
@@ -5,10 +5,13 @@
 #include <common.h>
 #include <console.h>
 #include <clk.h>
+#include <log.h>
 #include <ram.h>
+#include <rand.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/iopoll.h>
 
 #include "stm32mp1_ddr_regs.h"
diff --git a/drivers/remoteproc/k3_system_controller.c b/drivers/remoteproc/k3_system_controller.c
index 8843029..54209fc 100644
--- a/drivers/remoteproc/k3_system_controller.c
+++ b/drivers/remoteproc/k3_system_controller.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <remoteproc.h>
 #include <errno.h>
 #include <mailbox.h>
diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c
index f2e033a..c464ece 100644
--- a/drivers/remoteproc/rproc-elf-loader.c
+++ b/drivers/remoteproc/rproc-elf-loader.c
@@ -6,7 +6,9 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <elf.h>
+#include <log.h>
 #include <remoteproc.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
 #include <linux/compat.h>
 
diff --git a/drivers/remoteproc/rproc-uclass.c b/drivers/remoteproc/rproc-uclass.c
index c8a41a6..9640a81 100644
--- a/drivers/remoteproc/rproc-uclass.c
+++ b/drivers/remoteproc/rproc-uclass.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <remoteproc.h>
 #include <asm/io.h>
diff --git a/drivers/remoteproc/sandbox_testproc.c b/drivers/remoteproc/sandbox_testproc.c
index eeee49c..2b58b27 100644
--- a/drivers/remoteproc/sandbox_testproc.c
+++ b/drivers/remoteproc/sandbox_testproc.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <remoteproc.h>
 #include <asm/io.h>
 
diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c
index e9dce0d..33b574b 100644
--- a/drivers/remoteproc/stm32_copro.c
+++ b/drivers/remoteproc/stm32_copro.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <regmap.h>
 #include <remoteproc.h>
 #include <reset.h>
diff --git a/drivers/remoteproc/ti_k3_dsp_rproc.c b/drivers/remoteproc/ti_k3_dsp_rproc.c
index 1fc8193..3361555 100644
--- a/drivers/remoteproc/ti_k3_dsp_rproc.c
+++ b/drivers/remoteproc/ti_k3_dsp_rproc.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <remoteproc.h>
 #include <errno.h>
diff --git a/drivers/remoteproc/ti_k3_r5f_rproc.c b/drivers/remoteproc/ti_k3_r5f_rproc.c
index c01b29d..1a7f1f8 100644
--- a/drivers/remoteproc/ti_k3_r5f_rproc.c
+++ b/drivers/remoteproc/ti_k3_r5f_rproc.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <remoteproc.h>
 #include <errno.h>
diff --git a/drivers/remoteproc/ti_power_proc.c b/drivers/remoteproc/ti_power_proc.c
index f9660d4..350450d 100644
--- a/drivers/remoteproc/ti_power_proc.c
+++ b/drivers/remoteproc/ti_power_proc.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <remoteproc.h>
 #include <mach/psc_defs.h>
 
diff --git a/drivers/reset/ast2500-reset.c b/drivers/reset/ast2500-reset.c
index d1d44f3..beb5cd8 100644
--- a/drivers/reset/ast2500-reset.c
+++ b/drivers/reset/ast2500-reset.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <misc.h>
 #include <reset.h>
 #include <reset-uclass.h>
diff --git a/drivers/reset/reset-bcm6345.c b/drivers/reset/reset-bcm6345.c
index c1f1e7f..156703e 100644
--- a/drivers/reset/reset-bcm6345.c
+++ b/drivers/reset/reset-bcm6345.c
@@ -9,9 +9,12 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define MAX_RESETS	32
 
diff --git a/drivers/reset/reset-hisilicon.c b/drivers/reset/reset-hisilicon.c
index a678b8f..139bc5d 100644
--- a/drivers/reset/reset-hisilicon.c
+++ b/drivers/reset/reset-hisilicon.c
@@ -3,12 +3,14 @@
  * Copyright (c) 2019, Linaro Limited
  */
 
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
 #include <dt-bindings/reset/ti-syscon.h>
 #include <reset-uclass.h>
+#include <linux/bitops.h>
 
 struct hisi_reset_priv {
 	void __iomem *base;
diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c
index f9a432a..0c8f276 100644
--- a/drivers/reset/reset-hsdk.c
+++ b/drivers/reset/reset-hsdk.c
@@ -6,9 +6,11 @@
  * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
  */
 
+#include <log.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 #include <reset-uclass.h>
 
diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c
index a61855e..96916b6 100644
--- a/drivers/reset/reset-imx7.c
+++ b/drivers/reset/reset-imx7.c
@@ -3,6 +3,7 @@
  * Copyright (c) 2017, Impinj, Inc.
  */
 
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <common.h>
@@ -10,6 +11,8 @@
 #include <dt-bindings/reset/imx7-reset.h>
 #include <dt-bindings/reset/imx8mq-reset.h>
 #include <reset-uclass.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 struct imx7_reset_priv {
 	void __iomem *base;
diff --git a/drivers/reset/reset-mediatek.c b/drivers/reset/reset-mediatek.c
index 6d17f52..97d3d57 100644
--- a/drivers/reset/reset-mediatek.c
+++ b/drivers/reset/reset-mediatek.c
@@ -8,11 +8,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/lists.h>
 #include <regmap.h>
 #include <reset-uclass.h>
 #include <syscon.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 struct mediatek_reset_priv {
diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c
index 70f9635..4e33278 100644
--- a/drivers/reset/reset-meson.c
+++ b/drivers/reset/reset-meson.c
@@ -8,9 +8,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <regmap.h>
+#include <linux/bitops.h>
 
 #define REG_COUNT	8
 #define BITS_PER_REG	32
diff --git a/drivers/reset/reset-mtmips.c b/drivers/reset/reset-mtmips.c
index 677de0a..bc20e33 100644
--- a/drivers/reset/reset-mtmips.c
+++ b/drivers/reset/reset-mtmips.c
@@ -8,8 +8,10 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 
 struct mtmips_reset_priv {
diff --git a/drivers/reset/reset-rockchip.c b/drivers/reset/reset-rockchip.c
index 100afc8..8092555 100644
--- a/drivers/reset/reset-rockchip.c
+++ b/drivers/reset/reset-rockchip.c
@@ -5,8 +5,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <asm/arch-rockchip/hardware.h>
 #include <dm/lists.h>
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c
index c0930a6..830eda9 100644
--- a/drivers/reset/reset-socfpga.c
+++ b/drivers/reset/reset-socfpga.c
@@ -14,6 +14,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/lists.h>
 #include <dm/of_access.h>
diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c
index f21bf3b..05f7f59 100644
--- a/drivers/reset/reset-sunxi.c
+++ b/drivers/reset/reset-sunxi.c
@@ -7,10 +7,12 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <asm/io.h>
 #include <dm/lists.h>
+#include <linux/bitops.h>
 #include <linux/log2.h>
 #include <asm/arch/ccu.h>
 
diff --git a/drivers/reset/reset-ti-sci.c b/drivers/reset/reset-ti-sci.c
index f5d82b5..95cd388 100644
--- a/drivers/reset/reset-ti-sci.c
+++ b/drivers/reset/reset-ti-sci.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <dm/device_compat.h>
diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c
index 8ec8e46..5e38ce5 100644
--- a/drivers/reset/reset-uclass.c
+++ b/drivers/reset/reset-uclass.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset.h>
 #include <reset-uclass.h>
diff --git a/drivers/reset/reset-uniphier.c b/drivers/reset/reset-uniphier.c
index 348f388..06079d2 100644
--- a/drivers/reset/reset-uniphier.c
+++ b/drivers/reset/reset-uniphier.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <dm/device_compat.h>
diff --git a/drivers/reset/sandbox-reset-test.c b/drivers/reset/sandbox-reset-test.c
index ae79be0..9bc4a7e 100644
--- a/drivers/reset/sandbox-reset-test.c
+++ b/drivers/reset/sandbox-reset-test.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset.h>
 #include <asm/io.h>
diff --git a/drivers/reset/sandbox-reset.c b/drivers/reset/sandbox-reset.c
index bdf53a3..7a6f7f6 100644
--- a/drivers/reset/sandbox-reset.c
+++ b/drivers/reset/sandbox-reset.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <asm/io.h>
diff --git a/drivers/reset/sti-reset.c b/drivers/reset/sti-reset.c
index 31b3e48..ac3a99f 100644
--- a/drivers/reset/sti-reset.c
+++ b/drivers/reset/sti-reset.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <wait_bit.h>
 #include <dm.h>
@@ -13,6 +14,7 @@
 #include <regmap.h>
 #include <syscon.h>
 #include <dt-bindings/reset/stih407-resets.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/reset/stm32-reset.c b/drivers/reset/stm32-reset.c
index 5dda522..64a11cf 100644
--- a/drivers/reset/stm32-reset.c
+++ b/drivers/reset/stm32-reset.c
@@ -7,10 +7,12 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <stm32_rcc.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /* reset clear offset for STM32MP RCC */
 #define RCC_CL 0x4
diff --git a/drivers/reset/tegra-car-reset.c b/drivers/reset/tegra-car-reset.c
index 23c6fac..a33d453 100644
--- a/drivers/reset/tegra-car-reset.c
+++ b/drivers/reset/tegra-car-reset.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset-uclass.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/reset/tegra186-reset.c b/drivers/reset/tegra186-reset.c
index e85f42b..c60a03f 100644
--- a/drivers/reset/tegra186-reset.c
+++ b/drivers/reset/tegra186-reset.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <misc.h>
 #include <reset-uclass.h>
diff --git a/drivers/rng/rockchip_rng.c b/drivers/rng/rockchip_rng.c
index 47fb140..c6a834b 100644
--- a/drivers/rng/rockchip_rng.c
+++ b/drivers/rng/rockchip_rng.c
@@ -6,6 +6,7 @@
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 #include <linux/string.h>
 #include <rng.h>
diff --git a/drivers/rng/sandbox_rng.c b/drivers/rng/sandbox_rng.c
index cd0b0ac..cc5e1f6 100644
--- a/drivers/rng/sandbox_rng.c
+++ b/drivers/rng/sandbox_rng.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <rand.h>
 #include <rng.h>
 
 #include <linux/string.h>
diff --git a/drivers/rng/stm32mp1_rng.c b/drivers/rng/stm32mp1_rng.c
index e0f0a66..7ef7ff9 100644
--- a/drivers/rng/stm32mp1_rng.c
+++ b/drivers/rng/stm32mp1_rng.c
@@ -6,8 +6,11 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <reset.h>
 #include <rng.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <linux/iopoll.h>
diff --git a/drivers/rtc/davinci.c b/drivers/rtc/davinci.c
index b6930bd..c446e7a 100644
--- a/drivers/rtc/davinci.c
+++ b/drivers/rtc/davinci.c
@@ -5,9 +5,11 @@
  */
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <rtc.h>
 #include <asm/io.h>
 #include <asm/davinci_rtc.h>
+#include <linux/delay.h>
 
 int rtc_get(struct rtc_time *tmp)
 {
diff --git a/drivers/rtc/ds1302.c b/drivers/rtc/ds1302.c
index b94163f..189607c 100644
--- a/drivers/rtc/ds1302.c
+++ b/drivers/rtc/ds1302.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <rtc.h>
+#include <linux/delay.h>
 
 /* GPP Pins */
 #define DATA		0x200
diff --git a/drivers/rtc/ds1306.c b/drivers/rtc/ds1306.c
index 02d617e..36d6158 100644
--- a/drivers/rtc/ds1306.c
+++ b/drivers/rtc/ds1306.c
@@ -18,6 +18,7 @@
 #include <command.h>
 #include <rtc.h>
 #include <spi.h>
+#include <linux/delay.h>
 
 #define	RTC_SECONDS		0x00
 #define	RTC_MINUTES		0x01
@@ -71,7 +72,7 @@
 
 	/* Now we can enable the DS1306 RTC */
 	immap->im_cpm.cp_pbdat |= PB_SPI_CE;
-	udelay (10);
+	udelay(10);
 
 	/* Shift out the address (0) of the time in the Clock Chip */
 	soft_spi_send (0);
@@ -105,7 +106,7 @@
 
 	/* Now we can disable the DS1306 RTC */
 	immap->im_cpm.cp_pbdat &= ~PB_SPI_CE;	/* Disable DS1306 Chip */
-	udelay (10);
+	udelay(10);
 
 	rtc_calc_weekday(tmp);	/* Determine the day of week */
 
@@ -127,7 +128,7 @@
 
 	/* Now we can enable the DS1306 RTC */
 	immap->im_cpm.cp_pbdat |= PB_SPI_CE;	/* Enable DS1306 Chip */
-	udelay (10);
+	udelay(10);
 
 	/* First disable write protect in the clock chip control register */
 	soft_spi_send (0x8F);	/* send address of the control register */
@@ -135,11 +136,11 @@
 
 	/* Now disable the DS1306 to terminate the write */
 	immap->im_cpm.cp_pbdat &= ~PB_SPI_CE;
-	udelay (10);
+	udelay(10);
 
 	/* Now enable the DS1306 to initiate a new write */
 	immap->im_cpm.cp_pbdat |= PB_SPI_CE;
-	udelay (10);
+	udelay(10);
 
 	/* Next, send the address of the clock time write registers */
 	soft_spi_send (0x80);	/* send address of the first time register */
@@ -156,11 +157,11 @@
 
 	/* Now we can disable the Clock chip to terminate the burst write */
 	immap->im_cpm.cp_pbdat &= ~PB_SPI_CE;	/* Disable DS1306 Chip */
-	udelay (10);
+	udelay(10);
 
 	/* Now we can enable the Clock chip to initiate a new write */
 	immap->im_cpm.cp_pbdat |= PB_SPI_CE;	/* Enable DS1306 Chip */
-	udelay (10);
+	udelay(10);
 
 	/* First we Enable write protect in the clock chip control register */
 	soft_spi_send (0x8F);	/* send address of the control register */
@@ -168,7 +169,7 @@
 
 	/* Now disable the DS1306 */
 	immap->im_cpm.cp_pbdat &= ~PB_SPI_CE;	/*  Disable DS1306 Chip */
-	udelay (10);
+	udelay(10);
 
 	/* Set standard MPC8xx clock to the same time so Linux will
 	 * see the time even if it doesn't have a DS1306 clock driver.
@@ -204,7 +205,7 @@
 	immap->im_cpm.cp_pbdir |= (PB_SPIMOSI | PB_SPI_CE | PB_SPISCK);
 
 	immap->im_cpm.cp_pbdir &= ~PB_SPIMISO;	/* Make MISO pin an input */
-	udelay (10);
+	udelay(10);
 }
 
 /* ------------------------------------------------------------------------- */
@@ -227,10 +228,10 @@
 			immap->im_cpm.cp_pbdat |= PB_SPIMOSI;	/* Set MOSI to 1 */
 		else
 			immap->im_cpm.cp_pbdat &= ~PB_SPIMOSI;	/* Set MOSI to 0 */
-		udelay (10);
+		udelay(10);
 
 		immap->im_cpm.cp_pbdat &= ~PB_SPISCK;	/* Lower SCK */
-		udelay (10);
+		udelay(10);
 
 		bitpos >>= 1;	/* Shift for next bit position */
 	}
@@ -253,11 +254,11 @@
 	/* Read 8 bits here */
 	for (i = 0; i < 8; i++) {	/* Do 8 bits in loop */
 		immap->im_cpm.cp_pbdat |= PB_SPISCK;	/* Raise SCK */
-		udelay (10);
+		udelay(10);
 		if (immap->im_cpm.cp_pbdat & PB_SPIMISO)	/* Get a bit of data */
 			spi_byte |= bitpos;	/* Set data accordingly */
 		immap->im_cpm.cp_pbdat &= ~PB_SPISCK;	/* Lower SCK */
-		udelay (10);
+		udelay(10);
 		bitpos >>= 1;	/* Shift for next bit position */
 	}
 
diff --git a/drivers/rtc/ds1307.c b/drivers/rtc/ds1307.c
index a33f475..17344d4 100644
--- a/drivers/rtc/ds1307.c
+++ b/drivers/rtc/ds1307.c
@@ -16,6 +16,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/rtc/ds1337.c b/drivers/rtc/ds1337.c
index af94bcf..4986c96 100644
--- a/drivers/rtc/ds1337.c
+++ b/drivers/rtc/ds1337.c
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c
index eb5ce73..5b72e86 100644
--- a/drivers/rtc/ds3231.c
+++ b/drivers/rtc/ds3231.c
@@ -17,6 +17,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/rtc/ds3232.c b/drivers/rtc/ds3232.c
index e3b3579..0a30e0e 100644
--- a/drivers/rtc/ds3232.c
+++ b/drivers/rtc/ds3232.c
@@ -9,6 +9,7 @@
 #include <i2c.h>
 #include <rtc.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 /*
  * RTC register addresses
diff --git a/drivers/rtc/ftrtc010.c b/drivers/rtc/ftrtc010.c
index b68ea22..67c2b6e 100644
--- a/drivers/rtc/ftrtc010.c
+++ b/drivers/rtc/ftrtc010.c
@@ -8,6 +8,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <rtc.h>
 #include <asm/io.h>
 
diff --git a/drivers/rtc/i2c_rtc_emul.c b/drivers/rtc/i2c_rtc_emul.c
index d4b33e5..a010af4 100644
--- a/drivers/rtc/i2c_rtc_emul.c
+++ b/drivers/rtc/i2c_rtc_emul.c
@@ -16,6 +16,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <os.h>
 #include <rtc.h>
 #include <asm/rtc.h>
diff --git a/drivers/rtc/imxdi.c b/drivers/rtc/imxdi.c
index 39920f1..e3a1393 100644
--- a/drivers/rtc/imxdi.c
+++ b/drivers/rtc/imxdi.c
@@ -16,6 +16,7 @@
 #include <command.h>
 #include <linux/compat.h>
 #include <rtc.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
diff --git a/drivers/rtc/m41t11.c b/drivers/rtc/m41t11.c
index 960348b..706b718 100644
--- a/drivers/rtc/m41t11.c
+++ b/drivers/rtc/m41t11.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
@@ -109,9 +110,9 @@
 	tmp->tm_yday = 0;
 	tmp->tm_isdst= 0;
 
-	debug ( "Get DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
-		tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
-		tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+	debug("Get DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+	      tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+	      tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
 
 	return rel;
 }
@@ -120,9 +121,9 @@
 {
 	uchar data[RTC_REG_CNT];
 
-	debug ( "Set DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
-		tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
-		tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
+	debug("Set DATE: %4d-%02d-%02d (wday=%d)  TIME: %2d:%02d:%02d\n",
+	      tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday,
+	      tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
 
 	data[RTC_SEC_ADDR]    = bin2bcd(tmp->tm_sec) &  0x7F;/*just in case*/
 	data[RTC_MIN_ADDR]    = bin2bcd(tmp->tm_min);
diff --git a/drivers/rtc/m41t60.c b/drivers/rtc/m41t60.c
index 532d210..692042b 100644
--- a/drivers/rtc/m41t60.c
+++ b/drivers/rtc/m41t60.c
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/rtc/m41t62.c b/drivers/rtc/m41t62.c
index f52e129..94a6b52 100644
--- a/drivers/rtc/m41t62.c
+++ b/drivers/rtc/m41t62.c
@@ -19,6 +19,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/rtc/max6900.c b/drivers/rtc/max6900.c
index b351865..1192883 100644
--- a/drivers/rtc/max6900.c
+++ b/drivers/rtc/max6900.c
@@ -14,6 +14,7 @@
 #include <command.h>
 #include <rtc.h>
 #include <i2c.h>
+#include <linux/delay.h>
 
 #ifndef	CONFIG_SYS_I2C_RTC_ADDR
 #define	CONFIG_SYS_I2C_RTC_ADDR	0x50
diff --git a/drivers/rtc/mvrtc.c b/drivers/rtc/mvrtc.c
index 94a0653..6f49505 100644
--- a/drivers/rtc/mvrtc.c
+++ b/drivers/rtc/mvrtc.c
@@ -13,6 +13,7 @@
 #include <dm.h>
 #include <rtc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "mvrtc.h"
 
 /* This RTC does not support century, so we assume 20 */
diff --git a/drivers/rtc/pcf2127.c b/drivers/rtc/pcf2127.c
index b34ed63..c423960 100644
--- a/drivers/rtc/pcf2127.c
+++ b/drivers/rtc/pcf2127.c
@@ -9,6 +9,7 @@
 #include <command.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <rtc.h>
 
 #define PCF2127_REG_CTRL1	0x00
diff --git a/drivers/rtc/pcf8563.c b/drivers/rtc/pcf8563.c
index 84f2b23..19faefb 100644
--- a/drivers/rtc/pcf8563.c
+++ b/drivers/rtc/pcf8563.c
@@ -13,6 +13,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/rtc/pl031.c b/drivers/rtc/pl031.c
index 8bf04f2..1b67172 100644
--- a/drivers/rtc/pl031.c
+++ b/drivers/rtc/pl031.c
@@ -10,6 +10,7 @@
 #include <command.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <rtc.h>
 #include <asm/io.h>
 #include <asm/types.h>
diff --git a/drivers/rtc/pt7c4338.c b/drivers/rtc/pt7c4338.c
index 5211d07..c987494 100644
--- a/drivers/rtc/pt7c4338.c
+++ b/drivers/rtc/pt7c4338.c
@@ -21,6 +21,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/rtc/rtc-uclass.c b/drivers/rtc/rtc-uclass.c
index a0a238a..926cca2 100644
--- a/drivers/rtc/rtc-uclass.c
+++ b/drivers/rtc/rtc-uclass.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <rtc.h>
 
 int dm_rtc_get(struct udevice *dev, struct rtc_time *time)
diff --git a/drivers/rtc/rv3029.c b/drivers/rtc/rv3029.c
index 87c4320..3afe5b2 100644
--- a/drivers/rtc/rv3029.c
+++ b/drivers/rtc/rv3029.c
@@ -12,8 +12,11 @@
 #include <dm.h>
 #include <eeprom.h>
 #include <i2c.h>
+#include <log.h>
 #include <rtc.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define RTC_RV3029_PAGE_LEN             7
 
diff --git a/drivers/rtc/rv8803.c b/drivers/rtc/rv8803.c
index 2ab40f0..acd50c6 100644
--- a/drivers/rtc/rv8803.c
+++ b/drivers/rtc/rv8803.c
@@ -13,8 +13,10 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
+#include <linux/bitops.h>
 
 /*
  * RTC register addresses
diff --git a/drivers/rtc/rx8010sj.c b/drivers/rtc/rx8010sj.c
index 82c5185..d513561 100644
--- a/drivers/rtc/rx8010sj.c
+++ b/drivers/rtc/rx8010sj.c
@@ -21,6 +21,7 @@
 #include <dm.h>
 #include <i2c.h>
 #include <rtc.h>
+#include <linux/bitops.h>
 
 /*---------------------------------------------------------------------*/
 /* #undef DEBUG_RTC */
diff --git a/drivers/rtc/s35392a.c b/drivers/rtc/s35392a.c
index 3bfe481..80f55c8 100644
--- a/drivers/rtc/s35392a.c
+++ b/drivers/rtc/s35392a.c
@@ -23,6 +23,7 @@
 #include <i2c.h>
 #include <linux/bitrev.h>
 #include <rtc.h>
+#include <linux/delay.h>
 
 #define S35390A_CHIP_ADDR	0x30
 
diff --git a/drivers/rtc/stm32_rtc.c b/drivers/rtc/stm32_rtc.c
index 3e12f57..f9db318 100644
--- a/drivers/rtc/stm32_rtc.c
+++ b/drivers/rtc/stm32_rtc.c
@@ -9,6 +9,7 @@
 #include <rtc.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 
 #define STM32_RTC_TR		0x00
diff --git a/drivers/rtc/x1205.c b/drivers/rtc/x1205.c
index ed6aaa5..ce23427 100644
--- a/drivers/rtc/x1205.c
+++ b/drivers/rtc/x1205.c
@@ -19,6 +19,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <rtc.h>
 #include <i2c.h>
 
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 69de6a53..0ab1d44 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -5,8 +5,12 @@
  */
 
 #include <common.h>
+#include <blk.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <env.h>
+#include <log.h>
+#include <part.h>
 #include <pci.h>
 #include <scsi.h>
 #include <dm/device-internal.h>
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c
index 86c3de4..7a86161 100644
--- a/drivers/serial/altera_jtag_uart.c
+++ b/drivers/serial/altera_jtag_uart.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <serial.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /* data register */
 #define ALTERA_JTAG_RVALID	BIT(15)	/* Read valid */
diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c
index 436cf23..f88a293 100644
--- a/drivers/serial/altera_uart.c
+++ b/drivers/serial/altera_uart.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <serial.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /* status register */
 #define ALTERA_UART_TMT		BIT(5)	/* tx empty */
diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c
index 98d2090..71cb31f 100644
--- a/drivers/serial/atmel_usart.c
+++ b/drivers/serial/atmel_usart.c
@@ -14,6 +14,7 @@
 #include <serial.h>
 #include <debug_uart.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #ifdef CONFIG_DM_SERIAL
diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c
index 6415d2e..cca798d 100644
--- a/drivers/serial/ns16550.c
+++ b/drivers/serial/ns16550.c
@@ -9,6 +9,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <ns16550.h>
 #include <reset.h>
 #include <serial.h>
diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c
index 7703c67..a0af0e6 100644
--- a/drivers/serial/serial-uclass.c
+++ b/drivers/serial/serial-uclass.c
@@ -15,6 +15,7 @@
 #include <dm/lists.h>
 #include <dm/device-internal.h>
 #include <dm/of_access.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index baeaeaa..da017dc 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -12,6 +12,7 @@
 #include <post.h>
 #include <linux/compiler.h>
 #include <errno.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c
index 897ea5d..382c3b3 100644
--- a/drivers/serial/serial_ar933x.c
+++ b/drivers/serial/serial_ar933x.c
@@ -13,6 +13,7 @@
 #include <asm/addrspace.h>
 #include <asm/types.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <mach/ar71xx_regs.h>
 
 #define AR933X_UART_DATA_REG            0x00
diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c
index febb5ce..0102b10 100644
--- a/drivers/serial/serial_bcm283x_mu.c
+++ b/drivers/serial/serial_bcm283x_mu.c
@@ -23,6 +23,7 @@
 #include <serial.h>
 #include <dm/platform_data/serial_bcm283x_mu.h>
 #include <dm/pinctrl.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 
 struct bcm283x_mu_regs {
diff --git a/drivers/serial/serial_cortina.c b/drivers/serial/serial_cortina.c
index 4f227bf..cc20673 100644
--- a/drivers/serial/serial_cortina.c
+++ b/drivers/serial/serial_cortina.c
@@ -11,6 +11,7 @@
 #include <watchdog.h>
 #include <asm/io.h>
 #include <serial.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 
 /* Register definitions */
diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c
index dd3e511..b152e10 100644
--- a/drivers/serial/serial_efi.c
+++ b/drivers/serial/serial_efi.c
@@ -11,6 +11,7 @@
 #include <efi_api.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <linux/compiler.h>
 #include <asm/io.h>
 #include <serial.h>
diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c
index 3b53f5a..0c63c41 100644
--- a/drivers/serial/serial_lpuart.c
+++ b/drivers/serial/serial_lpuart.c
@@ -8,10 +8,12 @@
 #include <clk.h>
 #include <dm.h>
 #include <fsl_lpuart.h>
+#include <log.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <serial.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c
index b3dad77..439057b 100644
--- a/drivers/serial/serial_meson.c
+++ b/drivers/serial/serial_meson.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <serial.h>
 
diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c
index e63f230..778a04d 100644
--- a/drivers/serial/serial_mtk.c
+++ b/drivers/serial/serial_mtk.c
@@ -11,6 +11,7 @@
 #include <div64.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <serial.h>
 #include <watchdog.h>
 #include <asm/io.h>
diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c
index 4d4d919..f7997fc 100644
--- a/drivers/serial/serial_omap.c
+++ b/drivers/serial/serial_omap.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <dt-structs.h>
+#include <log.h>
 #include <ns16550.h>
 #include <serial.h>
 #include <clk.h>
diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c
index bb60ca2..2651a45 100644
--- a/drivers/serial/serial_owl.c
+++ b/drivers/serial/serial_owl.c
@@ -14,6 +14,7 @@
 #include <serial.h>
 #include <asm/io.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 /* UART Registers */
 #define	OWL_UART_CTL			(0x0000)
diff --git a/drivers/serial/serial_pic32.c b/drivers/serial/serial_pic32.c
index bac506e..a492063 100644
--- a/drivers/serial/serial_pic32.c
+++ b/drivers/serial/serial_pic32.c
@@ -9,6 +9,7 @@
 #include <malloc.h>
 #include <serial.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
 #include <mach/pic32.h>
 #include <dt-bindings/clock/microchip,clock.h>
 
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index acfcc29..5f45d58 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -15,6 +15,7 @@
 #include <serial.h>
 #include <linux/compiler.h>
 #include <dm/platform_data/serial_sh.h>
+#include <linux/delay.h>
 #include "serial_sh.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c
index 5a02f0c..fcc47fb 100644
--- a/drivers/serial/serial_sifive.c
+++ b/drivers/serial/serial_sifive.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <linux/compiler.h>
diff --git a/drivers/serial/serial_sti_asc.c b/drivers/serial/serial_sti_asc.c
index c972f1e..5fbbfac 100644
--- a/drivers/serial/serial_sti_asc.c
+++ b/drivers/serial/serial_sti_asc.c
@@ -8,8 +8,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <serial.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c
index 0160828..e77b906 100644
--- a/drivers/serial/serial_stm32.c
+++ b/drivers/serial/serial_stm32.c
@@ -7,11 +7,14 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <reset.h>
 #include <serial.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <asm/arch/stm32.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "serial_stm32.h"
 #include <dm/device_compat.h>
 
diff --git a/drivers/serial/serial_stm32.h b/drivers/serial/serial_stm32.h
index 7b0c531..5737651 100644
--- a/drivers/serial/serial_stm32.h
+++ b/drivers/serial/serial_stm32.h
@@ -7,6 +7,7 @@
 #ifndef _SERIAL_STM32_
 #define _SERIAL_STM32_
 
+#include <linux/bitops.h>
 #define CR1_OFFSET(x)	(x ? 0x0c : 0x00)
 #define CR3_OFFSET(x)	(x ? 0x14 : 0x08)
 #define BRR_OFFSET(x)	(x ? 0x08 : 0x0c)
diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c
index 1be777b..f29a9a0 100644
--- a/drivers/serial/serial_xuartlite.c
+++ b/drivers/serial/serial_xuartlite.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <serial.h>
 
diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c
index 0dd6cec..0e71cad 100644
--- a/drivers/serial/serial_zynq.c
+++ b/drivers/serial/serial_zynq.c
@@ -10,9 +10,11 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/compiler.h>
 #include <serial.h>
 #include <linux/err.h>
diff --git a/drivers/smem/msm_smem.c b/drivers/smem/msm_smem.c
index 5557fd2..2557269 100644
--- a/drivers/smem/msm_smem.c
+++ b/drivers/smem/msm_smem.c
@@ -13,6 +13,7 @@
 #include <dm/of_access.h>
 #include <dm/of_addr.h>
 #include <asm/io.h>
+#include <linux/bug.h>
 #include <linux/err.h>
 #include <linux/ioport.h>
 #include <linux/io.h>
diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c
index c5661c5..ecc4b8b 100644
--- a/drivers/soc/ti/k3-navss-ringacc.c
+++ b/drivers/soc/ti/k3-navss-ringacc.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <malloc.h>
 #include <asm/bitops.h>
@@ -15,6 +17,7 @@
 #include <dm/devres.h>
 #include <dm/read.h>
 #include <dm/uclass.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
diff --git a/drivers/soc/ti/keystone_serdes.c b/drivers/soc/ti/keystone_serdes.c
index 7907e6f..2ece1a8 100644
--- a/drivers/soc/ti/keystone_serdes.c
+++ b/drivers/soc/ti/keystone_serdes.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <common.h>
 #include <asm/ti-common/keystone_serdes.h>
+#include <linux/bitops.h>
 
 #define SERDES_CMU_REGS(x)		(0x0000 + (0x0c00 * (x)))
 #define SERDES_LANE_REGS(x)		(0x0200 + (0x200 * (x)))
diff --git a/drivers/sound/broadwell_i2s.c b/drivers/sound/broadwell_i2s.c
index 3d57740..adb0b2b 100644
--- a/drivers/sound/broadwell_i2s.c
+++ b/drivers/sound/broadwell_i2s.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include "broadwell_i2s.h"
diff --git a/drivers/sound/hda_codec.c b/drivers/sound/hda_codec.c
index 572ef69..4154d29 100644
--- a/drivers/sound/hda_codec.c
+++ b/drivers/sound/hda_codec.c
@@ -10,10 +10,13 @@
 #include <common.h>
 #include <dm.h>
 #include <hda_codec.h>
+#include <log.h>
 #include <pci.h>
 #include <sound.h>
 #include <asm/io.h>
 #include <dt-bindings/sound/azalia.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /**
  * struct hda_regs - HDA registers
diff --git a/drivers/sound/ivybridge_sound.c b/drivers/sound/ivybridge_sound.c
index 101046f..bc3c1e8 100644
--- a/drivers/sound/ivybridge_sound.c
+++ b/drivers/sound/ivybridge_sound.c
@@ -15,8 +15,10 @@
 #include <common.h>
 #include <dm.h>
 #include <hda_codec.h>
+#include <log.h>
 #include <pch.h>
 #include <sound.h>
+#include <linux/bitops.h>
 
 static int bd82x6x_azalia_probe(struct udevice *dev)
 {
diff --git a/drivers/sound/max98088.c b/drivers/sound/max98088.c
index 332254d..5b4c489 100644
--- a/drivers/sound/max98088.c
+++ b/drivers/sound/max98088.c
@@ -14,6 +14,7 @@
 #include <dm.h>
 #include <i2c.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/gpio.h>
 #include "maxim_codec.h"
diff --git a/drivers/sound/max98088.h b/drivers/sound/max98088.h
index 127d2bd..b1307a7 100644
--- a/drivers/sound/max98088.h
+++ b/drivers/sound/max98088.h
@@ -9,6 +9,7 @@
 #define _MAX98088_H
 
 /* MAX98088 Registers Definition */
+#include <linux/bitops.h>
 #define M98088_REG_IRQ_STATUS		0x00
 #define M98088_REG_MIC_STATUS		0x01
 #define M98088_REG_JACK_STAUS		0x02
diff --git a/drivers/sound/max98090.c b/drivers/sound/max98090.c
index 5505c35..d23955d 100644
--- a/drivers/sound/max98090.c
+++ b/drivers/sound/max98090.c
@@ -11,8 +11,10 @@
 #include <dm.h>
 #include <i2c.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 #include "maxim_codec.h"
 #include "max98090.h"
 
diff --git a/drivers/sound/max98095.c b/drivers/sound/max98095.c
index 9e08e96..5037f95 100644
--- a/drivers/sound/max98095.c
+++ b/drivers/sound/max98095.c
@@ -13,6 +13,7 @@
 #include <div64.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/gpio.h>
 #include "i2s.h"
diff --git a/drivers/sound/maxim_codec.c b/drivers/sound/maxim_codec.c
index 5480dce..31e67ee 100644
--- a/drivers/sound/maxim_codec.c
+++ b/drivers/sound/maxim_codec.c
@@ -9,6 +9,7 @@
 #include <div64.h>
 #include <i2c.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/drivers/sound/rockchip_i2s.c b/drivers/sound/rockchip_i2s.c
index e5df8ca..4e9e68a 100644
--- a/drivers/sound/rockchip_i2s.c
+++ b/drivers/sound/rockchip_i2s.c
@@ -10,8 +10,10 @@
 #include <common.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 struct rk_i2s_regs {
 	u32 txcr;		/* I2S_TXCR, 0x00 */
diff --git a/drivers/sound/rockchip_sound.c b/drivers/sound/rockchip_sound.c
index a092dbc..94058e6 100644
--- a/drivers/sound/rockchip_sound.c
+++ b/drivers/sound/rockchip_sound.c
@@ -11,6 +11,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <misc.h>
 #include <sound.h>
 #include <asm/arch-rockchip/periph.h>
diff --git a/drivers/sound/rt5677.c b/drivers/sound/rt5677.c
index 6477605..16aa9df 100644
--- a/drivers/sound/rt5677.c
+++ b/drivers/sound/rt5677.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <i2c.h>
 #include "rt5677.h"
+#include <log.h>
 
 struct rt5677_priv {
 	struct udevice *dev;
diff --git a/drivers/sound/samsung-i2s.c b/drivers/sound/samsung-i2s.c
index 1045840..aa1d6bb 100644
--- a/drivers/sound/samsung-i2s.c
+++ b/drivers/sound/samsung-i2s.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/pinmux.h>
diff --git a/drivers/sound/samsung_sound.c b/drivers/sound/samsung_sound.c
index b695267..473cedf 100644
--- a/drivers/sound/samsung_sound.c
+++ b/drivers/sound/samsung_sound.c
@@ -8,6 +8,7 @@
 #include <audio_codec.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/gpio.h>
 #include <asm/arch/power.h>
diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c
index 9034a83..0686add 100644
--- a/drivers/sound/sandbox.c
+++ b/drivers/sound/sandbox.c
@@ -9,6 +9,7 @@
 #include <audio_codec.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/sdl.h>
 
diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c
index d9b3a38..92f4b0b 100644
--- a/drivers/sound/sound-uclass.c
+++ b/drivers/sound/sound-uclass.c
@@ -7,8 +7,10 @@
 #include <common.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <malloc.h>
 #include <sound.h>
+#include <linux/delay.h>
 
 #define SOUND_BITS_IN_BYTE 8
 
diff --git a/drivers/sound/sound.c b/drivers/sound/sound.c
index dd3f9db..b0eab23 100644
--- a/drivers/sound/sound.c
+++ b/drivers/sound/sound.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <sound.h>
 
 void sound_create_square_wave(uint sample_rate, unsigned short *data, int size,
diff --git a/drivers/sound/tegra_ahub.c b/drivers/sound/tegra_ahub.c
index c71fce9..26d4572 100644
--- a/drivers/sound/tegra_ahub.c
+++ b/drivers/sound/tegra_ahub.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <misc.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/tegra_ahub.h>
diff --git a/drivers/sound/tegra_i2s.c b/drivers/sound/tegra_i2s.c
index 8022dbb..5cf8225 100644
--- a/drivers/sound/tegra_i2s.c
+++ b/drivers/sound/tegra_i2s.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <misc.h>
 #include <sound.h>
 #include <asm/io.h>
diff --git a/drivers/sound/tegra_sound.c b/drivers/sound/tegra_sound.c
index 7c2ed53..aef6a2e 100644
--- a/drivers/sound/tegra_sound.c
+++ b/drivers/sound/tegra_sound.c
@@ -10,6 +10,7 @@
 #include <audio_codec.h>
 #include <dm.h>
 #include <i2s.h>
+#include <log.h>
 #include <misc.h>
 #include <sound.h>
 #include <asm/gpio.h>
diff --git a/drivers/sound/wm8994.c b/drivers/sound/wm8994.c
index b290c4e..367e144 100644
--- a/drivers/sound/wm8994.c
+++ b/drivers/sound/wm8994.c
@@ -10,6 +10,7 @@
 #include <fdtdec.h>
 #include <i2c.h>
 #include <i2s.h>
+#include <log.h>
 #include <sound.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/drivers/spi/altera_spi.c b/drivers/spi/altera_spi.c
index e24deb4..3aa7a40 100644
--- a/drivers/spi/altera_spi.c
+++ b/drivers/spi/altera_spi.c
@@ -9,10 +9,12 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <fdtdec.h>
 #include <spi.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define ALTERA_SPI_STATUS_RRDY_MSK	BIT(7)
 #define ALTERA_SPI_CONTROL_SSO_MSK	BIT(10)
diff --git a/drivers/spi/atcspi200_spi.c b/drivers/spi/atcspi200_spi.c
index e0cc323..328b16c 100644
--- a/drivers/spi/atcspi200_spi.c
+++ b/drivers/spi/atcspi200_spi.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <clk.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <asm/io.h>
diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c
index a6c3939..9320a8b 100644
--- a/drivers/spi/atmel-quadspi.c
+++ b/drivers/spi/atmel-quadspi.c
@@ -17,6 +17,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
diff --git a/drivers/spi/atmel_spi.h b/drivers/spi/atmel_spi.h
index 76b8556..6167bd1 100644
--- a/drivers/spi/atmel_spi.h
+++ b/drivers/spi/atmel_spi.h
@@ -3,6 +3,7 @@
  */
 
 /* Register offsets */
+#include <linux/bitops.h>
 #define ATMEL_SPI_CR			0x0000
 #define ATMEL_SPI_MR			0x0004
 #define ATMEL_SPI_RDR			0x0008
diff --git a/drivers/spi/bcm63xx_hsspi.c b/drivers/spi/bcm63xx_hsspi.c
index f88702d..f30a8a4 100644
--- a/drivers/spi/bcm63xx_hsspi.c
+++ b/drivers/spi/bcm63xx_hsspi.c
@@ -10,11 +10,13 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <reset.h>
 #include <wait_bit.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define HSSPI_PP			0
 
diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c
index 719f53d..acc1a49 100644
--- a/drivers/spi/bcm63xx_spi.c
+++ b/drivers/spi/bcm63xx_spi.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <reset.h>
diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c
index 994a594..1e85749 100644
--- a/drivers/spi/cadence_qspi.c
+++ b/drivers/spi/cadence_qspi.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <clk.h>
+#include <log.h>
 #include <asm-generic/io.h>
 #include <dm.h>
 #include <fdtdec.h>
diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index 0a5af05..f9675f7 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -26,8 +26,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dma.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <wait_bit.h>
 #include <spi.h>
diff --git a/drivers/spi/cf_spi.c b/drivers/spi/cf_spi.c
index 923ff6f..dd9c772 100644
--- a/drivers/spi/cf_spi.c
+++ b/drivers/spi/cf_spi.c
@@ -15,6 +15,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/platform_data/spi_coldfire.h>
 #include <spi.h>
 #include <malloc.h>
diff --git a/drivers/spi/davinci_spi.c b/drivers/spi/davinci_spi.c
index 4d2c106..97ac97b 100644
--- a/drivers/spi/davinci_spi.c
+++ b/drivers/spi/davinci_spi.c
@@ -9,12 +9,15 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <spi.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <dm.h>
 #include <dm/platform_data/spi_davinci.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /* SPIGCR0 */
 #define SPIGCR0_SPIENA_MASK	0x1
diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c
index 2dc1673..c9b14f9 100644
--- a/drivers/spi/designware_spi.c
+++ b/drivers/spi/designware_spi.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm-generic/gpio.h>
 #include <clk.h>
 #include <dm.h>
@@ -19,6 +20,7 @@
 #include <fdtdec.h>
 #include <reset.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/iopoll.h>
 #include <asm/io.h>
diff --git a/drivers/spi/exynos_spi.c b/drivers/spi/exynos_spi.c
index d682a11..746686a 100644
--- a/drivers/spi/exynos_spi.c
+++ b/drivers/spi/exynos_spi.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <fdtdec.h>
@@ -18,6 +19,7 @@
 #include <asm/arch/pinmux.h>
 #include <asm/arch/spi.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/spi/fsl_dspi.c b/drivers/spi/fsl_dspi.c
index a68a519..1cdb233 100644
--- a/drivers/spi/fsl_dspi.c
+++ b/drivers/spi/fsl_dspi.c
@@ -13,6 +13,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <common.h>
+#include <log.h>
 #include <spi.h>
 #include <malloc.h>
 #include <asm/io.h>
@@ -21,6 +22,8 @@
 #include <asm/arch/clock.h>
 #endif
 #include <fsl_dspi.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c
index 7444ae1..50d194f 100644
--- a/drivers/spi/fsl_espi.c
+++ b/drivers/spi/fsl_espi.c
@@ -7,6 +7,9 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <malloc.h>
 #include <spi.h>
diff --git a/drivers/spi/fsl_qspi.c b/drivers/spi/fsl_qspi.c
index ee2c8b6..e715f98 100644
--- a/drivers/spi/fsl_qspi.c
+++ b/drivers/spi/fsl_qspi.c
@@ -24,7 +24,13 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/libfdt.h>
+#include <linux/sizes.h>
+#include <linux/iopoll.h>
 #include <dm.h>
 #include <linux/iopoll.h>
 #include <linux/sizes.h>
diff --git a/drivers/spi/ich.c b/drivers/spi/ich.c
index a9d7715..7405062 100644
--- a/drivers/spi/ich.c
+++ b/drivers/spi/ich.c
@@ -8,10 +8,12 @@
 #define LOG_CATEGORY	UCLASS_SPI
 
 #include <common.h>
+#include <bootstage.h>
 #include <div64.h>
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <pch.h>
 #include <pci.h>
@@ -23,6 +25,8 @@
 #include <asm/fast_spi.h>
 #include <asm/io.h>
 #include <asm/mtrr.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 
 #include "ich.h"
diff --git a/drivers/spi/ich.h b/drivers/spi/ich.h
index d7f1ffd..23c7827 100644
--- a/drivers/spi/ich.h
+++ b/drivers/spi/ich.h
@@ -8,6 +8,7 @@
 #ifndef _ICH_H_
 #define _ICH_H_
 
+#include <linux/bitops.h>
 struct ich7_spi_regs {
 	uint16_t spis;
 	uint16_t spic;
diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index 38fe414..01fcf6b 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <asm/io.h>
diff --git a/drivers/spi/meson_spifc.c b/drivers/spi/meson_spifc.c
index 3d55169..2cdc018 100644
--- a/drivers/spi/meson_spifc.c
+++ b/drivers/spi/meson_spifc.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <spi.h>
 #include <clk.h>
 #include <dm.h>
@@ -15,6 +16,7 @@
 #include <errno.h>
 #include <asm/io.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
 
 /* register map */
 #define REG_CMD			0x00
diff --git a/drivers/spi/mpc8xx_spi.c b/drivers/spi/mpc8xx_spi.c
index b020ce2..0026ad2 100644
--- a/drivers/spi/mpc8xx_spi.c
+++ b/drivers/spi/mpc8xx_spi.c
@@ -20,6 +20,7 @@
 #include <dm.h>
 #include <mpc8xx.h>
 #include <spi.h>
+#include <linux/delay.h>
 
 #include <asm/cpm_8xx.h>
 #include <asm/io.h>
diff --git a/drivers/spi/mpc8xxx_spi.c b/drivers/spi/mpc8xxx_spi.c
index e48debb..811b5d4 100644
--- a/drivers/spi/mpc8xxx_spi.c
+++ b/drivers/spi/mpc8xxx_spi.c
@@ -8,11 +8,14 @@
 #include <clk.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <asm/mpc8xxx_spi.h>
 #include <asm-generic/gpio.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 enum {
 	SPI_EV_NE = BIT(31 - 22),	/* Receiver Not Empty */
diff --git a/drivers/spi/mscc_bb_spi.c b/drivers/spi/mscc_bb_spi.c
index c3c7b80..0454410 100644
--- a/drivers/spi/mscc_bb_spi.c
+++ b/drivers/spi/mscc_bb_spi.c
@@ -8,11 +8,13 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <dm.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/delay.h>
 
 struct mscc_bb_priv {
diff --git a/drivers/spi/mt7621_spi.c b/drivers/spi/mt7621_spi.c
index 90e85c6..3a0738e 100644
--- a/drivers/spi/mt7621_spi.c
+++ b/drivers/spi/mt7621_spi.c
@@ -11,8 +11,10 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <spi.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 
 #define MT7621_RX_FIFO_LEN	32
diff --git a/drivers/spi/mvebu_a3700_spi.c b/drivers/spi/mvebu_a3700_spi.c
index 1469771..2302e62 100644
--- a/drivers/spi/mvebu_a3700_spi.c
+++ b/drivers/spi/mvebu_a3700_spi.c
@@ -7,12 +7,14 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <clk.h>
 #include <wait_bit.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 4d1317c..f52ebf4 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -5,9 +5,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/drivers/spi/mxs_spi.c b/drivers/spi/mxs_spi.c
index 3ca3088..0da4a80 100644
--- a/drivers/spi/mxs_spi.c
+++ b/drivers/spi/mxs_spi.c
@@ -14,9 +14,12 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <spi.h>
+#include <asm/cache.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c
index 22a5c0e..c507437 100644
--- a/drivers/spi/nxp_fspi.c
+++ b/drivers/spi/nxp_fspi.c
@@ -40,6 +40,7 @@
 #include <spi-mem.h>
 #include <dm.h>
 #include <clk.h>
+#include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <linux/sizes.h>
 #include <linux/iopoll.h>
diff --git a/drivers/spi/omap3_spi.c b/drivers/spi/omap3_spi.c
index ff4c700..6a615d1 100644
--- a/drivers/spi/omap3_spi.c
+++ b/drivers/spi/omap3_spi.c
@@ -21,6 +21,7 @@
 #include <spi.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/spi/pic32_spi.c b/drivers/spi/pic32_spi.c
index 4ec6683..52e9eff 100644
--- a/drivers/spi/pic32_spi.c
+++ b/drivers/spi/pic32_spi.c
@@ -9,6 +9,8 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <malloc.h>
 #include <spi.h>
diff --git a/drivers/spi/renesas_rpc_spi.c b/drivers/spi/renesas_rpc_spi.c
index bb2e774..3ea59b8 100644
--- a/drivers/spi/renesas_rpc_spi.c
+++ b/drivers/spi/renesas_rpc_spi.c
@@ -12,6 +12,8 @@
 #include <dm/of_access.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 #include <spi.h>
 #include <wait_bit.h>
diff --git a/drivers/spi/rk_spi.c b/drivers/spi/rk_spi.c
index 95eeb83..833cb04 100644
--- a/drivers/spi/rk_spi.c
+++ b/drivers/spi/rk_spi.c
@@ -15,8 +15,10 @@
 #include <dm.h>
 #include <dt-structs.h>
 #include <errno.h>
+#include <log.h>
 #include <spi.h>
 #include <time.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/arch-rockchip/clock.h>
diff --git a/drivers/spi/sandbox_spi.c b/drivers/spi/sandbox_spi.c
index 6b610ff..b0a46c8 100644
--- a/drivers/spi/sandbox_spi.c
+++ b/drivers/spi/sandbox_spi.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi_flash.h>
diff --git a/drivers/spi/sh_qspi.c b/drivers/spi/sh_qspi.c
index 5ae203d..2839dd1 100644
--- a/drivers/spi/sh_qspi.c
+++ b/drivers/spi/sh_qspi.c
@@ -13,6 +13,7 @@
 #include <wait_bit.h>
 #include <asm/arch/rmobile.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /* SH QSPI register bit masks <REG>_<BIT> */
 #define SPCR_MSTR	0x08
diff --git a/drivers/spi/sh_spi.c b/drivers/spi/sh_spi.c
index c58fd0e..4ecfe60 100644
--- a/drivers/spi/sh_spi.c
+++ b/drivers/spi/sh_spi.c
@@ -10,6 +10,7 @@
 #include <malloc.h>
 #include <spi.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include "sh_spi.h"
 
 static void sh_spi_write(unsigned long data, unsigned long *reg)
diff --git a/drivers/spi/soft_spi.c b/drivers/spi/soft_spi.c
index b80f810..e8d7758 100644
--- a/drivers/spi/soft_spi.c
+++ b/drivers/spi/soft_spi.c
@@ -13,9 +13,12 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <asm/gpio.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/spi/spi-mem-nodm.c b/drivers/spi/spi-mem-nodm.c
index 83dde48..765f05f 100644
--- a/drivers/spi/spi-mem-nodm.c
+++ b/drivers/spi/spi-mem-nodm.c
@@ -3,6 +3,7 @@
  * Copyright (C) 2018 Texas Instruments Incorporated - http://www.ti.com/
  */
 
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi-mem.h>
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
index ffbe20c..d344701 100644
--- a/drivers/spi/spi-mem.c
+++ b/drivers/spi/spi-mem.c
@@ -7,6 +7,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/dmaengine.h>
 #include <linux/pm_runtime.h>
diff --git a/drivers/spi/spi-sifive.c b/drivers/spi/spi-sifive.c
index 4cab039..0e0ce25 100644
--- a/drivers/spi/spi-sifive.c
+++ b/drivers/spi/spi-sifive.c
@@ -13,6 +13,7 @@
 #include <spi-mem.h>
 #include <wait_bit.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/log2.h>
 #include <clk.h>
 
diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c
index c59fee1..d2dccd6 100644
--- a/drivers/spi/spi-sunxi.c
+++ b/drivers/spi/spi-sunxi.c
@@ -21,12 +21,14 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <spi.h>
 #include <errno.h>
 #include <fdt_support.h>
 #include <reset.h>
 #include <wait_bit.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #include <asm/bitops.h>
 #include <asm/gpio.h>
diff --git a/drivers/spi/spi-uclass.c b/drivers/spi/spi-uclass.c
index 4a02d95..cffd9cf 100644
--- a/drivers/spi/spi-uclass.c
+++ b/drivers/spi/spi-uclass.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <dm/device-internal.h>
diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
index 6857a87..001f070 100644
--- a/drivers/spi/stm32_qspi.c
+++ b/drivers/spi/stm32_qspi.c
@@ -9,9 +9,12 @@
 
 #include <common.h>
 #include <clk.h>
+#include <log.h>
 #include <reset.h>
 #include <spi-mem.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/iopoll.h>
 #include <linux/ioport.h>
 #include <linux/sizes.h>
diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c
index ebf2b98..4a0833b 100644
--- a/drivers/spi/stm32_spi.c
+++ b/drivers/spi/stm32_spi.c
@@ -8,10 +8,13 @@
 #include <clk.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset.h>
 #include <spi.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/drivers/spi/tegra114_spi.c b/drivers/spi/tegra114_spi.c
index bb34b20..0e8198c 100644
--- a/drivers/spi/tegra114_spi.c
+++ b/drivers/spi/tegra114_spi.c
@@ -7,11 +7,14 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <spi.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "tegra_spi.h"
 
 /* COMMAND1 */
diff --git a/drivers/spi/tegra20_sflash.c b/drivers/spi/tegra20_sflash.c
index 0e68d33..22a0304 100644
--- a/drivers/spi/tegra20_sflash.c
+++ b/drivers/spi/tegra20_sflash.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
@@ -16,6 +17,8 @@
 #include <asm/arch-tegra/clk_rst.h>
 #include <spi.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "tegra_spi.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/spi/tegra20_slink.c b/drivers/spi/tegra20_slink.c
index ae2fc3e..3679cf0 100644
--- a/drivers/spi/tegra20_slink.c
+++ b/drivers/spi/tegra20_slink.c
@@ -7,12 +7,15 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <spi.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "tegra_spi.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/spi/tegra210_qspi.c b/drivers/spi/tegra210_qspi.c
index 6e540e9..ae16b45 100644
--- a/drivers/spi/tegra210_qspi.c
+++ b/drivers/spi/tegra210_qspi.c
@@ -8,12 +8,15 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch-tegra/clk_rst.h>
 #include <spi.h>
 #include <fdtdec.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "tegra_spi.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c
index e3750b0..0db0de8 100644
--- a/drivers/spi/ti_qspi.c
+++ b/drivers/spi/ti_qspi.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <asm/arch/omap.h>
 #include <malloc.h>
@@ -17,6 +19,7 @@
 #include <asm/omap_gpio.h>
 #include <asm/omap_common.h>
 #include <asm/ti-common/ti-edma3.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <regmap.h>
diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c
index 153fbb2..114bd8a 100644
--- a/drivers/spi/uniphier_spi.c
+++ b/drivers/spi/uniphier_spi.c
@@ -7,9 +7,12 @@
 #include <clk.h>
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <time.h>
 #include <dm/device_compat.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <spi.h>
 #include <wait_bit.h>
diff --git a/drivers/spi/xilinx_spi.c b/drivers/spi/xilinx_spi.c
index 2b5f2cf..05768ee 100644
--- a/drivers/spi/xilinx_spi.c
+++ b/drivers/spi/xilinx_spi.c
@@ -16,10 +16,12 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <asm/io.h>
 #include <wait_bit.h>
+#include <linux/bitops.h>
 
 /*
  * [0]: http://www.xilinx.com/support/documentation
diff --git a/drivers/spi/zynq_qspi.c b/drivers/spi/zynq_qspi.c
index 9ad1927..db473da 100644
--- a/drivers/spi/zynq_qspi.c
+++ b/drivers/spi/zynq_qspi.c
@@ -8,9 +8,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/spi/zynq_spi.c b/drivers/spi/zynq_spi.c
index 0b2b2f4..3e66b34 100644
--- a/drivers/spi/zynq_spi.c
+++ b/drivers/spi/zynq_spi.c
@@ -8,10 +8,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <spi.h>
 #include <time.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c
index 02b78df..c3a5b3e 100644
--- a/drivers/spi/zynqmp_gqspi.c
+++ b/drivers/spi/zynqmp_gqspi.c
@@ -7,7 +7,9 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/arch/sys_proto.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <clk.h>
 #include <dm.h>
@@ -17,6 +19,7 @@
 #include <ubi_uboot.h>
 #include <wait_bit.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define GQSPI_GFIFO_STRT_MODE_MASK	BIT(29)
diff --git a/drivers/sysreset/sysreset-ti-sci.c b/drivers/sysreset/sysreset-ti-sci.c
index e7fcfcd..3877b9b 100644
--- a/drivers/sysreset/sysreset-ti-sci.c
+++ b/drivers/sysreset/sysreset-ti-sci.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <sysreset.h>
 #include <dm/device_compat.h>
 #include <linux/err.h>
diff --git a/drivers/sysreset/sysreset-uclass.c b/drivers/sysreset/sysreset-uclass.c
index 51fdb10..995240f 100644
--- a/drivers/sysreset/sysreset-uclass.c
+++ b/drivers/sysreset/sysreset-uclass.c
@@ -7,8 +7,10 @@
 #define LOG_CATEGORY UCLASS_SYSRESET
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <hang.h>
+#include <log.h>
 #include <sysreset.h>
 #include <dm.h>
 #include <errno.h>
@@ -16,6 +18,7 @@
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dm/root.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 
 int sysreset_request(struct udevice *dev, enum sysreset_t type)
@@ -111,7 +114,7 @@
 }
 
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	printf("resetting ...\n");
 
@@ -121,7 +124,7 @@
 }
 
 #if IS_ENABLED(CONFIG_SYSRESET_CMD_POWEROFF)
-int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret;
 
diff --git a/drivers/sysreset/sysreset_ast.c b/drivers/sysreset/sysreset_ast.c
index d0336a1..ee941c7 100644
--- a/drivers/sysreset/sysreset_ast.c
+++ b/drivers/sysreset/sysreset_ast.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <sysreset.h>
 #include <wdt.h>
 #include <asm/io.h>
diff --git a/drivers/sysreset/sysreset_gpio.c b/drivers/sysreset/sysreset_gpio.c
index ed9a49a..d7280ee 100644
--- a/drivers/sysreset/sysreset_gpio.c
+++ b/drivers/sysreset/sysreset_gpio.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <sysreset.h>
 #include <asm/gpio.h>
 
diff --git a/drivers/sysreset/sysreset_mpc83xx.c b/drivers/sysreset/sysreset_mpc83xx.c
index 9092764..456f006 100644
--- a/drivers/sysreset/sysreset_mpc83xx.c
+++ b/drivers/sysreset/sysreset_mpc83xx.c
@@ -5,9 +5,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <sysreset.h>
 #include <wait_bit.h>
+#include <linux/delay.h>
 
 #include "sysreset_mpc83xx.h"
 
diff --git a/drivers/sysreset/sysreset_socfpga.c b/drivers/sysreset/sysreset_socfpga.c
index 3390b7b..178bcb2 100644
--- a/drivers/sysreset/sysreset_socfpga.c
+++ b/drivers/sysreset/sysreset_socfpga.c
@@ -10,6 +10,7 @@
 #include <sysreset.h>
 #include <asm/io.h>
 #include <asm/arch/reset_manager.h>
+#include <linux/bitops.h>
 
 struct socfpga_sysreset_data {
 	void __iomem *rstmgr_base;
diff --git a/drivers/sysreset/sysreset_sti.c b/drivers/sysreset/sysreset_sti.c
index 9996716..3482d2a 100644
--- a/drivers/sysreset/sysreset_sti.c
+++ b/drivers/sysreset/sysreset_sti.c
@@ -10,6 +10,7 @@
 #include <syscon.h>
 #include <sysreset.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/tee/tee-uclass.c b/drivers/tee/tee-uclass.c
index 1fb3c16..112e216 100644
--- a/drivers/tee/tee-uclass.c
+++ b/drivers/tee/tee-uclass.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <tee.h>
 #include <dm/device-internal.h>
diff --git a/drivers/thermal/imx_scu_thermal.c b/drivers/thermal/imx_scu_thermal.c
index da13121..321f905 100644
--- a/drivers/thermal/imx_scu_thermal.c
+++ b/drivers/thermal/imx_scu_thermal.c
@@ -7,10 +7,13 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <thermal.h>
 #include <dm/device-internal.h>
 #include <dm/device.h>
 #include <asm/arch/sci/sci.h>
+#include <linux/delay.h>
+#include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index e50b85b..101bd5e 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -9,12 +9,14 @@
 #include <common.h>
 #include <div64.h>
 #include <fuse.h>
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <dm.h>
 #include <errno.h>
 #include <malloc.h>
+#include <linux/delay.h>
 #include <linux/math64.h>
 #include <thermal.h>
 #include <imx_thermal.h>
diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c
index 6f504f7..6ca9501 100644
--- a/drivers/timer/altera_timer.c
+++ b/drivers/timer/altera_timer.c
@@ -12,6 +12,7 @@
 #include <errno.h>
 #include <timer.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 /* control register */
 #define ALTERA_TIMER_CONT	BIT(1)	/* Continuous mode */
diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c
index 009af2f..7051169 100644
--- a/drivers/timer/atmel_pit_timer.c
+++ b/drivers/timer/atmel_pit_timer.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <timer.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define AT91_PIT_VALUE		0xfffff
 #define AT91_PIT_PITEN		BIT(24)		/* Timer Enabled */
diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c
index ed48a14..e6b6dfe 100644
--- a/drivers/timer/cadence-ttc.c
+++ b/drivers/timer/cadence-ttc.c
@@ -4,10 +4,13 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
 #include <timer.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define CNT_CNTRL_RESET		BIT(4)
diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c
index 72cb58b..ad8bb28 100644
--- a/drivers/timer/mpc83xx_timer.c
+++ b/drivers/timer/mpc83xx_timer.c
@@ -9,10 +9,13 @@
 #include <clk.h>
 #include <dm.h>
 #include <irq_func.h>
+#include <log.h>
 #include <status_led.h>
 #include <time.h>
 #include <timer.h>
 #include <watchdog.h>
+#include <asm/ptrace.h>
+#include <linux/bitops.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/timer/mtk_timer.c b/drivers/timer/mtk_timer.c
index e99135e..69ed521 100644
--- a/drivers/timer/mtk_timer.c
+++ b/drivers/timer/mtk_timer.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <timer.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define MTK_GPT4_CTRL	0x40
 #define MTK_GPT4_CLK	0x44
diff --git a/drivers/timer/nomadik-mtu-timer.c b/drivers/timer/nomadik-mtu-timer.c
index 8648f1f..7ff9213 100644
--- a/drivers/timer/nomadik-mtu-timer.c
+++ b/drivers/timer/nomadik-mtu-timer.c
@@ -16,6 +16,7 @@
 #include <dm.h>
 #include <timer.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define MTU_NUM_TIMERS		4
 
diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c
index a13fb71..700c349 100644
--- a/drivers/timer/omap-timer.c
+++ b/drivers/timer/omap-timer.c
@@ -11,6 +11,7 @@
 #include <timer.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <linux/bitops.h>
 
 /* Timer register bits */
 #define TCLR_START			BIT(0)	/* Start=1 */
diff --git a/drivers/timer/ostm_timer.c b/drivers/timer/ostm_timer.c
index 48a5055..bea9715 100644
--- a/drivers/timer/ostm_timer.c
+++ b/drivers/timer/ostm_timer.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <clk.h>
 #include <timer.h>
+#include <linux/bitops.h>
 
 #define OSTM_CMP	0x00
 #define OSTM_CNT	0x04
diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c
index 54956e5..7a5a484 100644
--- a/drivers/timer/rockchip_timer.c
+++ b/drivers/timer/rockchip_timer.c
@@ -4,7 +4,10 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <dm/ofnode.h>
 #include <mapmem.h>
 #include <asm/arch-rockchip/timer.h>
diff --git a/drivers/timer/stm32_timer.c b/drivers/timer/stm32_timer.c
index 76d99a2..c57fa3f 100644
--- a/drivers/timer/stm32_timer.c
+++ b/drivers/timer/stm32_timer.c
@@ -10,6 +10,7 @@
 #include <fdtdec.h>
 #include <timer.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #include <asm/io.h>
 
diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c
index b619200..14dde95 100644
--- a/drivers/timer/timer-uclass.c
+++ b/drivers/timer/timer-uclass.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
 #include <dm/root.h>
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c
index 43cb2d8..93c959f 100644
--- a/drivers/timer/tsc_timer.c
+++ b/drivers/timer/tsc_timer.c
@@ -7,7 +7,9 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <time.h>
 #include <timer.h>
@@ -17,6 +19,7 @@
 #include <asm/ibmpc.h>
 #include <asm/msr.h>
 #include <asm/u-boot-x86.h>
+#include <linux/delay.h>
 
 #define MAX_NUM_FREQS	9
 
diff --git a/drivers/tpm/cr50_i2c.c b/drivers/tpm/cr50_i2c.c
index b67051a..1942c07 100644
--- a/drivers/tpm/cr50_i2c.c
+++ b/drivers/tpm/cr50_i2c.c
@@ -11,12 +11,14 @@
 #include <dm.h>
 #include <i2c.h>
 #include <irq.h>
+#include <log.h>
 #include <spl.h>
 #include <tpm-v2.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/arch/iomap.h>
 #include <asm/arch/pm.h>
+#include <linux/delay.h>
 
 enum {
 	TIMEOUT_INIT_MS		= 30000, /* Very long timeout for TPM init */
diff --git a/drivers/tpm/tpm-uclass.c b/drivers/tpm/tpm-uclass.c
index 71d5807..6ea795b 100644
--- a/drivers/tpm/tpm-uclass.c
+++ b/drivers/tpm/tpm-uclass.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/unaligned/be_byteshift.h>
 #include <tpm-v1.h>
 #include <tpm-v2.h>
diff --git a/drivers/tpm/tpm2_ftpm_tee.c b/drivers/tpm/tpm2_ftpm_tee.c
index 4b79d4a..3197e0e 100644
--- a/drivers/tpm/tpm2_ftpm_tee.c
+++ b/drivers/tpm/tpm2_ftpm_tee.c
@@ -15,6 +15,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <tpm-v2.h>
 #include <tee.h>
 
diff --git a/drivers/tpm/tpm2_tis_sandbox.c b/drivers/tpm/tpm2_tis_sandbox.c
index 5229887..41a15bd 100644
--- a/drivers/tpm/tpm2_tis_sandbox.c
+++ b/drivers/tpm/tpm2_tis_sandbox.c
@@ -9,6 +9,7 @@
 #include <tpm-v2.h>
 #include <asm/state.h>
 #include <asm/unaligned.h>
+#include <linux/bitops.h>
 #include <u-boot/crc.h>
 
 /* Hierarchies */
diff --git a/drivers/tpm/tpm2_tis_spi.c b/drivers/tpm/tpm2_tis_spi.c
index 713111f..36016de 100644
--- a/drivers/tpm/tpm2_tis_spi.c
+++ b/drivers/tpm/tpm2_tis_spi.c
@@ -19,6 +19,8 @@
 #include <log.h>
 #include <spi.h>
 #include <tpm-v2.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
diff --git a/drivers/tpm/tpm_atmel_twi.c b/drivers/tpm/tpm_atmel_twi.c
index 2079ea9..d9e4877 100644
--- a/drivers/tpm/tpm_atmel_twi.c
+++ b/drivers/tpm/tpm_atmel_twi.c
@@ -10,6 +10,7 @@
 #include <tpm-v1.h>
 #include <i2c.h>
 #include <asm/unaligned.h>
+#include <linux/delay.h>
 
 #include "tpm_internal.h"
 
diff --git a/drivers/tpm/tpm_tis_infineon.c b/drivers/tpm/tpm_tis_infineon.c
index b5fe43e..f47813e 100644
--- a/drivers/tpm/tpm_tis_infineon.c
+++ b/drivers/tpm/tpm_tis_infineon.c
@@ -23,7 +23,9 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
 #include <tpm-v1.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/compiler.h>
 #include <linux/types.h>
diff --git a/drivers/tpm/tpm_tis_lpc.c b/drivers/tpm/tpm_tis_lpc.c
index 30194bc..2dd374c 100644
--- a/drivers/tpm/tpm_tis_lpc.c
+++ b/drivers/tpm/tpm_tis_lpc.c
@@ -14,9 +14,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <mapmem.h>
 #include <tpm-v1.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #define PREFIX "lpc_tpm: "
 
diff --git a/drivers/tpm/tpm_tis_st33zp24_i2c.c b/drivers/tpm/tpm_tis_st33zp24_i2c.c
index 0d38037..a253ee1 100644
--- a/drivers/tpm/tpm_tis_st33zp24_i2c.c
+++ b/drivers/tpm/tpm_tis_st33zp24_i2c.c
@@ -16,8 +16,10 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <i2c.h>
+#include <log.h>
 #include <tpm-v1.h>
 #include <errno.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <asm/unaligned.h>
 
diff --git a/drivers/tpm/tpm_tis_st33zp24_spi.c b/drivers/tpm/tpm_tis_st33zp24_spi.c
index f6087e7..ef54e3b 100644
--- a/drivers/tpm/tpm_tis_st33zp24_spi.c
+++ b/drivers/tpm/tpm_tis_st33zp24_spi.c
@@ -15,9 +15,11 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <spi.h>
 #include <tpm-v1.h>
 #include <errno.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <asm/unaligned.h>
 #include <linux/compat.h>
diff --git a/drivers/ufs/cdns-platform.c b/drivers/ufs/cdns-platform.c
index 41ee6a6..1a7bb7b 100644
--- a/drivers/ufs/cdns-platform.c
+++ b/drivers/ufs/cdns-platform.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <ufs.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #include "ufs.h"
diff --git a/drivers/ufs/ti-j721e-ufs.c b/drivers/ufs/ti-j721e-ufs.c
index 4990fba..d875269 100644
--- a/drivers/ufs/ti-j721e-ufs.c
+++ b/drivers/ufs/ti-j721e-ufs.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 
 #define UFS_SS_CTRL             0x4
diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c
index 24e1bc2..87b4e5f 100644
--- a/drivers/ufs/ufs.c
+++ b/drivers/ufs/ufs.c
@@ -11,6 +11,7 @@
 #include <charset.h>
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <dm/lists.h>
@@ -18,6 +19,8 @@
 #include <malloc.h>
 #include <hexdump.h>
 #include <scsi.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include <linux/dma-mapping.h>
 
diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c
index 652cd5c..cd7b211 100644
--- a/drivers/usb/cdns3/cdns3-ti.c
+++ b/drivers/usb/cdns3/cdns3-ti.c
@@ -10,6 +10,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 #include <linux/usb/otg.h>
 #include <malloc.h>
diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
index ce84648..ea86a25 100644
--- a/drivers/usb/cdns3/core.c
+++ b/drivers/usb/cdns3/core.c
@@ -13,10 +13,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <dm/lists.h>
+#include <linux/bug.h>
 #include <linux/kernel.h>
 #include <linux/io.h>
 #include <usb.h>
diff --git a/drivers/usb/cdns3/drd.h b/drivers/usb/cdns3/drd.h
index 815b93f..fffda7b 100644
--- a/drivers/usb/cdns3/drd.h
+++ b/drivers/usb/cdns3/drd.h
@@ -9,6 +9,7 @@
 #ifndef __LINUX_CDNS3_DRD
 #define __LINUX_CDNS3_DRD
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 #include <linux/usb/otg.h>
 #include "core.h"
diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c
index 1957a3b..a08c6945 100644
--- a/drivers/usb/cdns3/ep0.c
+++ b/drivers/usb/cdns3/ep0.c
@@ -11,7 +11,10 @@
  */
 
 #include <cpu_func.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/usb/composite.h>
 #include <linux/iopoll.h>
 
diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c
index caed27c..8f81d17 100644
--- a/drivers/usb/cdns3/gadget.c
+++ b/drivers/usb/cdns3/gadget.c
@@ -59,6 +59,8 @@
 #include <dm.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/usb/gadget.h>
 #include <linux/compat.h>
diff --git a/drivers/usb/cdns3/gadget.h b/drivers/usb/cdns3/gadget.h
index 3d5242b..8803fa4 100644
--- a/drivers/usb/cdns3/gadget.h
+++ b/drivers/usb/cdns3/gadget.h
@@ -11,6 +11,7 @@
  */
 #ifndef __LINUX_CDNS3_GADGET
 #define __LINUX_CDNS3_GADGET
+#include <linux/bitops.h>
 #include <linux/usb/gadget.h>
 
 /*
diff --git a/drivers/usb/common/fsl-dt-fixup.c b/drivers/usb/common/fsl-dt-fixup.c
index 6debfff..0759ec7 100644
--- a/drivers/usb/common/fsl-dt-fixup.c
+++ b/drivers/usb/common/fsl-dt-fixup.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <usb.h>
 #include <asm/io.h>
 #include <hwconfig.h>
diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 0972e45..8d418c9 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -19,6 +19,8 @@
 #include <dwc3-uboot.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/err.h>
 #include <linux/ioport.h>
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 7f45a9c..2b4c51a 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -17,6 +17,7 @@
 #ifndef __DRIVERS_USB_DWC3_CORE_H
 #define __DRIVERS_USB_DWC3_CORE_H
 
+#include <linux/bitops.h>
 #include <linux/ioport.h>
 
 #include <linux/usb/ch9.h>
diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 175866c..484e7a7 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -9,11 +9,13 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm-generic/io.h>
 #include <dm.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dwc3-uboot.h>
+#include <linux/bitops.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <malloc.h>
diff --git a/drivers/usb/dwc3/dwc3-meson-g12a.c b/drivers/usb/dwc3/dwc3-meson-g12a.c
index de964d6..6567502 100644
--- a/drivers/usb/dwc3/dwc3-meson-g12a.c
+++ b/drivers/usb/dwc3/dwc3-meson-g12a.c
@@ -7,12 +7,14 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm-generic/io.h>
 #include <dm.h>
 #include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dwc3-uboot.h>
 #include <generic-phy.h>
+#include <linux/delay.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <malloc.h>
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 4af5894..385bed3 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -15,6 +15,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm/device_compat.h>
+#include <linux/bug.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
 
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index e445c70..2aec874 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -15,10 +15,12 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/dma-mapping.h>
 #include <linux/list.h>
 
diff --git a/drivers/usb/dwc3/samsung_usb_phy.c b/drivers/usb/dwc3/samsung_usb_phy.c
index 6770614..abbd413 100644
--- a/drivers/usb/dwc3/samsung_usb_phy.c
+++ b/drivers/usb/dwc3/samsung_usb_phy.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <asm/arch/power.h>
 #include <asm/arch/xhci-exynos.h>
+#include <linux/delay.h>
 
 void exynos5_usb3_phy_init(struct exynos_usb3_phy *phy)
 {
diff --git a/drivers/usb/dwc3/ti_usb_phy.c b/drivers/usb/dwc3/ti_usb_phy.c
index 6b0166a..f8ab064 100644
--- a/drivers/usb/dwc3/ti_usb_phy.c
+++ b/drivers/usb/dwc3/ti_usb_phy.c
@@ -21,6 +21,8 @@
 #include <ti-usb-phy-uboot.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/ioport.h>
 #include <asm/io.h>
 #include <asm/arch/sys_proto.h>
diff --git a/drivers/usb/emul/sandbox_flash.c b/drivers/usb/emul/sandbox_flash.c
index 399d1d3..9c305f4 100644
--- a/drivers/usb/emul/sandbox_flash.c
+++ b/drivers/usb/emul/sandbox_flash.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <os.h>
 #include <scsi.h>
 #include <usb.h>
diff --git a/drivers/usb/emul/sandbox_hub.c b/drivers/usb/emul/sandbox_hub.c
index 7f15034..21bf3bd 100644
--- a/drivers/usb/emul/sandbox_hub.c
+++ b/drivers/usb/emul/sandbox_hub.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <usb.h>
 #include <dm/device-internal.h>
 
diff --git a/drivers/usb/emul/sandbox_keyb.c b/drivers/usb/emul/sandbox_keyb.c
index 32bc9a1..f562fb7 100644
--- a/drivers/usb/emul/sandbox_keyb.c
+++ b/drivers/usb/emul/sandbox_keyb.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <os.h>
 #include <scsi.h>
 #include <usb.h>
diff --git a/drivers/usb/emul/usb-emul-uclass.c b/drivers/usb/emul/usb-emul-uclass.c
index 50da6bd..e3419e2 100644
--- a/drivers/usb/emul/usb-emul-uclass.c
+++ b/drivers/usb/emul/usb-emul-uclass.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <usb.h>
 #include <dm/device-internal.h>
 
diff --git a/drivers/usb/eth/asix.c b/drivers/usb/eth/asix.c
index 3a8ec0b..db75ae2 100644
--- a/drivers/usb/eth/asix.c
+++ b/drivers/usb/eth/asix.c
@@ -7,9 +7,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <net.h>
 #include <usb.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include "usb_ether.h"
 
diff --git a/drivers/usb/eth/asix88179.c b/drivers/usb/eth/asix88179.c
index 00706be..381bef2 100644
--- a/drivers/usb/eth/asix88179.c
+++ b/drivers/usb/eth/asix88179.c
@@ -7,8 +7,10 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <usb.h>
 #include <net.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include "usb_ether.h"
 #include <malloc.h>
diff --git a/drivers/usb/eth/lan75xx.c b/drivers/usb/eth/lan75xx.c
index 418139d..46b92e8 100644
--- a/drivers/usb/eth/lan75xx.c
+++ b/drivers/usb/eth/lan75xx.c
@@ -4,7 +4,9 @@
  */
 
 #include <dm.h>
+#include <log.h>
 #include <usb.h>
+#include <linux/bitops.h>
 #include <linux/mii.h>
 #include "usb_ether.h"
 #include "lan7x.h"
diff --git a/drivers/usb/eth/lan78xx.c b/drivers/usb/eth/lan78xx.c
index e8ee665..e34ad26 100644
--- a/drivers/usb/eth/lan78xx.c
+++ b/drivers/usb/eth/lan78xx.c
@@ -4,7 +4,10 @@
  */
 
 #include <dm.h>
+#include <log.h>
+#include <net.h>
 #include <usb.h>
+#include <linux/bitops.h>
 #include "usb_ether.h"
 #include "lan7x.h"
 
diff --git a/drivers/usb/eth/lan7x.c b/drivers/usb/eth/lan7x.c
index 21786e1..0a28361 100644
--- a/drivers/usb/eth/lan7x.c
+++ b/drivers/usb/eth/lan7x.c
@@ -4,9 +4,11 @@
  */
 
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <memalign.h>
+#include <net.h>
 #include <usb.h>
 #include <linux/ethtool.h>
 #include <linux/mii.h>
diff --git a/drivers/usb/eth/lan7x.h b/drivers/usb/eth/lan7x.h
index 7af610b..f71e8c7 100644
--- a/drivers/usb/eth/lan7x.h
+++ b/drivers/usb/eth/lan7x.h
@@ -4,7 +4,11 @@
  */
 
 #include <console.h>
+#include <time.h>
 #include <watchdog.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/errno.h>
 
 /* USB Vendor Requests */
 #define USB_VENDOR_REQUEST_WRITE_REGISTER	0xA0
@@ -122,6 +126,10 @@
 
 int lan7x_read_reg(struct usb_device *udev, u32 index, u32 *data);
 
+/*
+ * FIXME: Code should not be in header files. Nive this to a file common to
+ * the two drivers.
+ */
 static inline int lan7x_wait_for_bit(struct usb_device *udev,
 				     const char *prefix, const u32 reg,
 				     const u32 mask, const bool set,
diff --git a/drivers/usb/eth/mcs7830.c b/drivers/usb/eth/mcs7830.c
index 75c45ee..0cb7dbc 100644
--- a/drivers/usb/eth/mcs7830.c
+++ b/drivers/usb/eth/mcs7830.c
@@ -12,6 +12,9 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
+#include <net.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <malloc.h>
 #include <memalign.h>
diff --git a/drivers/usb/eth/r8152.c b/drivers/usb/eth/r8152.c
index e5f73e3..61b8683 100644
--- a/drivers/usb/eth/r8152.c
+++ b/drivers/usb/eth/r8152.c
@@ -7,9 +7,12 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <net.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include <linux/bitops.h>
 #include "usb_ether.h"
diff --git a/drivers/usb/eth/r8152.h b/drivers/usb/eth/r8152.h
index b6df535..09f1c61 100644
--- a/drivers/usb/eth/r8152.h
+++ b/drivers/usb/eth/r8152.h
@@ -7,6 +7,7 @@
 #ifndef _RTL8152_ETH_H
 #define _RTL8152_ETH_H
 
+#include <linux/bitops.h>
 #define R8152_BASE_NAME		"r8152"
 
 #define PLA_IDR			0xc000
diff --git a/drivers/usb/eth/r8152_fw.c b/drivers/usb/eth/r8152_fw.c
index 4bf4066..3ebbd53 100644
--- a/drivers/usb/eth/r8152_fw.c
+++ b/drivers/usb/eth/r8152_fw.c
@@ -6,6 +6,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include "usb_ether.h"
 #include "r8152.h"
 
diff --git a/drivers/usb/eth/smsc95xx.c b/drivers/usb/eth/smsc95xx.c
index 25f69a06..d3532df 100644
--- a/drivers/usb/eth/smsc95xx.c
+++ b/drivers/usb/eth/smsc95xx.c
@@ -9,10 +9,13 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <net.h>
 #include <usb.h>
 #include <asm/unaligned.h>
+#include <linux/delay.h>
 #include <linux/mii.h>
 #include "usb_ether.h"
 
diff --git a/drivers/usb/eth/usb_ether.c b/drivers/usb/eth/usb_ether.c
index 3aca9ac..e368ecd 100644
--- a/drivers/usb/eth/usb_ether.c
+++ b/drivers/usb/eth/usb_ether.c
@@ -6,8 +6,11 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
+#include <net.h>
 #include <usb.h>
+#include <asm/cache.h>
 #include <dm/device-internal.h>
 
 #include "usb_ether.h"
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c
index 13dec51..1feed41 100644
--- a/drivers/usb/gadget/at91_udc.c
+++ b/drivers/usb/gadget/at91_udc.c
@@ -15,6 +15,7 @@
 
 #include <common.h>
 #include <dm/devres.h>
+#include <linux/bug.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <asm/io.h>
diff --git a/drivers/usb/gadget/atmel_usba_udc.c b/drivers/usb/gadget/atmel_usba_udc.c
index dffa511..7d51821 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <asm/gpio.h>
 #include <asm/hardware.h>
diff --git a/drivers/usb/gadget/bcm_udc_otg_phy.c b/drivers/usb/gadget/bcm_udc_otg_phy.c
index 3ecb669..c89cd57 100644
--- a/drivers/usb/gadget/bcm_udc_otg_phy.c
+++ b/drivers/usb/gadget/bcm_udc_otg_phy.c
@@ -8,6 +8,7 @@
 #include <asm/io.h>
 #include <asm/arch/sysmap.h>
 #include <asm/kona-common/clk.h>
+#include <linux/delay.h>
 
 #include "dwc2_udc_otg_priv.h"
 #include "bcm_udc_otg.h"
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index d9cfff3..cdbdbcc 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -14,6 +14,8 @@
 #include <net.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
+#include <asm/cache.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm/unaligned.h>
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index b2b2793..91ed7fc 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -7,8 +7,10 @@
  */
 #undef DEBUG
 
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/usb/composite.h>
 
 #define USB_BUFSIZ	4096
diff --git a/drivers/usb/gadget/core.c b/drivers/usb/gadget/core.c
index 7e1e51db..3781d25 100644
--- a/drivers/usb/gadget/core.c
+++ b/drivers/usb/gadget/core.c
@@ -15,6 +15,7 @@
  *	Bruce Balden <balden@lineo.com>
  */
 
+#include <log.h>
 #include <malloc.h>
 #include <serial.h>
 #include <usbdevice.h>
diff --git a/drivers/usb/gadget/designware_udc.c b/drivers/usb/gadget/designware_udc.c
index 70c5c67..7fc5d27 100644
--- a/drivers/usb/gadget/designware_udc.c
+++ b/drivers/usb/gadget/designware_udc.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <serial.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #include <env.h>
 #include <usbdevice.h>
diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c
index 9f21af2..eaa5dcb 100644
--- a/drivers/usb/gadget/dwc2_udc_otg.c
+++ b/drivers/usb/gadget/dwc2_udc_otg.c
@@ -21,10 +21,13 @@
 #include <clk.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 
 #include <linux/errno.h>
 #include <linux/list.h>
diff --git a/drivers/usb/gadget/dwc2_udc_otg_phy.c b/drivers/usb/gadget/dwc2_udc_otg_phy.c
index c4338af..7f8e956 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_phy.c
+++ b/drivers/usb/gadget/dwc2_udc_otg_phy.c
@@ -18,6 +18,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/list.h>
 #include <malloc.h>
diff --git a/drivers/usb/gadget/dwc2_udc_otg_regs.h b/drivers/usb/gadget/dwc2_udc_otg_regs.h
index 434db5b..2eda5c3 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_regs.h
+++ b/drivers/usb/gadget/dwc2_udc_otg_regs.h
@@ -11,6 +11,7 @@
 #define __ASM_ARCH_REGS_USB_OTG_HS_H
 
 /* USB2.0 OTG Controller register */
+#include <linux/bitops.h>
 struct dwc2_usbotg_phy {
 	u32 phypwr;
 	u32 phyclk;
diff --git a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
index d4fbb75..1c0505e 100644
--- a/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
+++ b/drivers/usb/gadget/dwc2_udc_otg_xfer_dma.c
@@ -19,6 +19,8 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
+#include <linux/bug.h>
 
 static u8 clear_feature_num;
 int clear_feature_flag;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 8533abf..6f04523 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -10,6 +10,8 @@
 #include <common.h>
 #include <console.h>
 #include <env.h>
+#include <log.h>
+#include <part.h>
 #include <linux/errno.h>
 #include <linux/netdevice.h>
 #include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/f_dfu.c b/drivers/usb/gadget/f_dfu.c
index a4a57ba..4bedc7d 100644
--- a/drivers/usb/gadget/f_dfu.c
+++ b/drivers/usb/gadget/f_dfu.c
@@ -17,6 +17,7 @@
 #include <env.h>
 #include <errno.h>
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 
 #include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
index fc27dbe..384c0f6 100644
--- a/drivers/usb/gadget/f_fastboot.c
+++ b/drivers/usb/gadget/f_fastboot.c
@@ -9,11 +9,13 @@
  * Copyright 2014 Linaro, Ltd.
  * Rob Herring <robh@kernel.org>
  */
+#include <command.h>
 #include <config.h>
 #include <common.h>
 #include <env.h>
 #include <errno.h>
 #include <fastboot.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index 5250fc8..439a31c 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -241,11 +241,13 @@
 
 #include <config.h>
 #include <hexdump.h>
+#include <log.h>
 #include <malloc.h>
 #include <common.h>
 #include <console.h>
 #include <g_dnl.h>
 #include <dm/devres.h>
+#include <linux/bug.h>
 
 #include <linux/err.h>
 #include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/f_rockusb.c b/drivers/usb/gadget/f_rockusb.c
index 1cfeabc..9ae02ae 100644
--- a/drivers/usb/gadget/f_rockusb.c
+++ b/drivers/usb/gadget/f_rockusb.c
@@ -4,12 +4,15 @@
  *
  * Eddie Cai <eddie.cai.linux@gmail.com>
  */
+#include <command.h>
 #include <config.h>
 #include <common.h>
 #include <env.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <part.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
diff --git a/drivers/usb/gadget/f_sdp.c b/drivers/usb/gadget/f_sdp.c
index 1732a3a..f2fe89d 100644
--- a/drivers/usb/gadget/f_sdp.c
+++ b/drivers/usb/gadget/f_sdp.c
@@ -20,6 +20,7 @@
 #include <common.h>
 #include <console.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 
 #include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/f_thor.c b/drivers/usb/gadget/f_thor.c
index ee646fd..88fc87f 100644
--- a/drivers/usb/gadget/f_thor.c
+++ b/drivers/usb/gadget/f_thor.c
@@ -18,9 +18,12 @@
 #include <errno.h>
 #include <common.h>
 #include <console.h>
+#include <init.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <version.h>
+#include <linux/delay.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
 #include <linux/usb/composite.h>
diff --git a/drivers/usb/gadget/fotg210.c b/drivers/usb/gadget/fotg210.c
index 0866ef6..af43433 100644
--- a/drivers/usb/gadget/fotg210.c
+++ b/drivers/usb/gadget/fotg210.c
@@ -10,9 +10,11 @@
 #include <command.h>
 #include <config.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 #include <linux/usb/ch9.h>
diff --git a/drivers/usb/gadget/g_dnl.c b/drivers/usb/gadget/g_dnl.c
index 7a51b53..86fdd16 100644
--- a/drivers/usb/gadget/g_dnl.c
+++ b/drivers/usb/gadget/g_dnl.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 
 #include <mmc.h>
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 6e1e57f..d19ac1d 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -18,15 +18,18 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/byteorder.h>
 #include <asm/system.h>
 #include <asm/mach-types.h>
 #include <asm/unaligned.h>
 #include <dm/devres.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <asm/arch/pxa.h>
+#include <linux/delay.h>
 
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
diff --git a/drivers/usb/gadget/pxa27x_udc.c b/drivers/usb/gadget/pxa27x_udc.c
index 15c4378..ba362b8 100644
--- a/drivers/usb/gadget/pxa27x_udc.c
+++ b/drivers/usb/gadget/pxa27x_udc.c
@@ -13,6 +13,7 @@
 #include <asm/byteorder.h>
 #include <asm/io.h>
 #include <usbdevice.h>
+#include <linux/delay.h>
 #include <usb/pxa27x_udc.h>
 #include <usb/udc.h>
 
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c
index eec639f..13c327e 100644
--- a/drivers/usb/gadget/rndis.c
+++ b/drivers/usb/gadget/rndis.c
@@ -19,6 +19,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <linux/types.h>
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index f40779b..5674e8f 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -268,6 +268,7 @@
 struct device_attribute { int i; };
 #define ETOOSMALL	525
 
+#include <log.h>
 #include <usb_mass_storage.h>
 #include <dm/device_compat.h>
 
diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c
index f25ed2d..cefe9d8 100644
--- a/drivers/usb/host/dwc2.c
+++ b/drivers/usb/host/dwc2.c
@@ -10,14 +10,17 @@
 #include <dm.h>
 #include <errno.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <phys2bus.h>
 #include <usb.h>
 #include <usbroothubdes.h>
 #include <wait_bit.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 #include <reset.h>
 
diff --git a/drivers/usb/host/dwc3-sti-glue.c b/drivers/usb/host/dwc3-sti-glue.c
index 99d4e29..a72ab20 100644
--- a/drivers/usb/host/dwc3-sti-glue.c
+++ b/drivers/usb/host/dwc3-sti-glue.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dm.h>
 #include <errno.h>
diff --git a/drivers/usb/host/ehci-armada100.c b/drivers/usb/host/ehci-armada100.c
index 85a8adf..2ce9f27 100644
--- a/drivers/usb/host/ehci-armada100.c
+++ b/drivers/usb/host/ehci-armada100.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <usb.h>
 #include "ehci.h"
diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c
index 67eec0e..f9083d9 100644
--- a/drivers/usb/host/ehci-atmel.c
+++ b/drivers/usb/host/ehci-atmel.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <usb.h>
 #include <asm/io.h>
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index fabc662..0b0b213 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -9,6 +9,8 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <malloc.h>
 #include <usb.h>
diff --git a/drivers/usb/host/ehci-faraday.c b/drivers/usb/host/ehci-faraday.c
index a01da4d..b61b538 100644
--- a/drivers/usb/host/ehci-faraday.c
+++ b/drivers/usb/host/ehci-faraday.c
@@ -7,8 +7,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include <usb/fusbh200.h>
 #include <usb/fotg210.h>
 
diff --git a/drivers/usb/host/ehci-fsl.c b/drivers/usb/host/ehci-fsl.c
index ced295e..ac6c5b5 100644
--- a/drivers/usb/host/ehci-fsl.c
+++ b/drivers/usb/host/ehci-fsl.c
@@ -9,9 +9,11 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <pci.h>
 #include <usb.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <usb/ehci-ci.h>
 #include <hwconfig.h>
 #include <fsl_usb.h>
diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
index 0643681..304a343 100644
--- a/drivers/usb/host/ehci-generic.c
+++ b/drivers/usb/host/ehci-generic.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <clk.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <dm/ofnode.h>
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index a2a85db..f79f063 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -10,7 +10,9 @@
 #include <cpu_func.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <asm/byteorder.h>
+#include <asm/cache.h>
 #include <asm/unaligned.h>
 #include <usb.h>
 #include <asm/io.h>
@@ -19,6 +21,7 @@
 #include <watchdog.h>
 #include <dm/device_compat.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 
 #include "ehci.h"
 
diff --git a/drivers/usb/host/ehci-marvell.c b/drivers/usb/host/ehci-marvell.c
index 5a9bd54..8fe685a 100644
--- a/drivers/usb/host/ehci-marvell.c
+++ b/drivers/usb/host/ehci-marvell.c
@@ -6,8 +6,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include "ehci.h"
 #include <linux/mbus.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c
index 0b32728..212b362 100644
--- a/drivers/usb/host/ehci-mx5.c
+++ b/drivers/usb/host/ehci-mx5.c
@@ -5,9 +5,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <usb.h>
 #include <errno.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include <usb/ehci-ci.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 04eb3c0..24f8ad7 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -5,10 +5,12 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <usb.h>
 #include <errno.h>
 #include <wait_bit.h>
 #include <linux/compiler.h>
+#include <linux/delay.h>
 #include <usb/ehci-ci.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
diff --git a/drivers/usb/host/ehci-mxc.c b/drivers/usb/host/ehci-mxc.c
index 4941cb9..d0b7ac5 100644
--- a/drivers/usb/host/ehci-mxc.c
+++ b/drivers/usb/host/ehci-mxc.c
@@ -8,6 +8,7 @@
 #include <usb.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
+#include <linux/delay.h>
 #include <usb/ehci-ci.h>
 #include <errno.h>
 
diff --git a/drivers/usb/host/ehci-mxs.c b/drivers/usb/host/ehci-mxs.c
index 8e8f6d4..824c620 100644
--- a/drivers/usb/host/ehci-mxs.c
+++ b/drivers/usb/host/ehci-mxs.c
@@ -10,6 +10,7 @@
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <errno.h>
+#include <linux/delay.h>
 
 #include "ehci.h"
 
diff --git a/drivers/usb/host/ehci-omap.c b/drivers/usb/host/ehci-omap.c
index ab459c8..5fee537 100644
--- a/drivers/usb/host/ehci-omap.c
+++ b/drivers/usb/host/ehci-omap.c
@@ -11,7 +11,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include <usb/ulpi.h>
 #include <errno.h>
 #include <asm/io.h>
diff --git a/drivers/usb/host/ehci-pci.c b/drivers/usb/host/ehci-pci.c
index 04e7c5e..7dd5c33 100644
--- a/drivers/usb/host/ehci-pci.c
+++ b/drivers/usb/host/ehci-pci.c
@@ -7,6 +7,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <usb.h>
 #include <asm/io.h>
diff --git a/drivers/usb/host/ehci-rmobile.c b/drivers/usb/host/ehci-rmobile.c
index 4868581..130b73d 100644
--- a/drivers/usb/host/ehci-rmobile.c
+++ b/drivers/usb/host/ehci-rmobile.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <asm/io.h>
 #include <asm/arch/ehci-rmobile.h>
+#include <linux/delay.h>
 #include "ehci.h"
 
 #if defined(CONFIG_R8A7740)
diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
index f93ffa8..3e87e0c 100644
--- a/drivers/usb/host/ehci-spear.c
+++ b/drivers/usb/host/ehci-spear.c
@@ -9,8 +9,10 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include "ehci.h"
 #include <asm/arch/hardware.h>
 #include <asm/arch/spr_misc.h>
diff --git a/drivers/usb/host/ehci-tegra.c b/drivers/usb/host/ehci-tegra.c
index 702f3b5..d81f4a0 100644
--- a/drivers/usb/host/ehci-tegra.c
+++ b/drivers/usb/host/ehci-tegra.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 #include <asm-generic/gpio.h>
diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c
index a16cf13..562207d 100644
--- a/drivers/usb/host/ehci-vf.c
+++ b/drivers/usb/host/ehci-vf.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <usb.h>
 #include <errno.h>
 #include <linux/compiler.h>
@@ -18,6 +19,7 @@
 #include <asm/arch/crm_regs.h>
 #include <asm/mach-imx/iomux-v3.h>
 #include <asm/mach-imx/regs-usbphy.h>
+#include <linux/delay.h>
 #include <usb/ehci-ci.h>
 #include <linux/libfdt.h>
 #include <fdtdec.h>
diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index 66c1d61..8e07554 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -298,4 +298,5 @@
 int ehci_setup_phy(struct udevice *dev, struct phy *phy, int index);
 int ehci_shutdown_phy(struct udevice *dev, struct phy *phy);
 
+#include <linux/bitops.h>
 #endif /* USB_EHCI_H */
diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
index 04d5fdb..631711a 100644
--- a/drivers/usb/host/ohci-generic.c
+++ b/drivers/usb/host/ohci-generic.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <dm/ofnode.h>
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index c94960f..c62d8fe 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -32,6 +32,8 @@
 #include <asm/byteorder.h>
 #include <dm.h>
 #include <errno.h>
+#include <asm/cache.h>
+#include <linux/delay.h>
 
 #if defined(CONFIG_PCI_OHCI)
 # include <pci.h>
diff --git a/drivers/usb/host/ohci-lpc32xx.c b/drivers/usb/host/ohci-lpc32xx.c
index 34a4b00..afb9e29 100644
--- a/drivers/usb/host/ohci-lpc32xx.c
+++ b/drivers/usb/host/ohci-lpc32xx.c
@@ -10,6 +10,8 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
+#include <log.h>
 #include <wait_bit.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c
index 8fc9d21..37aa2c5 100644
--- a/drivers/usb/host/r8a66597-hcd.c
+++ b/drivers/usb/host/r8a66597-hcd.c
@@ -8,9 +8,11 @@
 #include <common.h>
 #include <console.h>
 #include <dm.h>
+#include <log.h>
 #include <usb.h>
 #include <asm/io.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/iopoll.h>
 #include <power/regulator.h>
 
diff --git a/drivers/usb/host/r8a66597.h b/drivers/usb/host/r8a66597.h
index b6110d6..625d493 100644
--- a/drivers/usb/host/r8a66597.h
+++ b/drivers/usb/host/r8a66597.h
@@ -8,6 +8,7 @@
 #ifndef __R8A66597_H__
 #define __R8A66597_H__
 
+#include <linux/bitops.h>
 #define SYSCFG0		0x00
 #define SYSCFG1		0x02
 #define SYSSTS0		0x04
diff --git a/drivers/usb/host/sl811-hcd.c b/drivers/usb/host/sl811-hcd.c
index e08da61..7c823f2 100644
--- a/drivers/usb/host/sl811-hcd.c
+++ b/drivers/usb/host/sl811-hcd.c
@@ -21,6 +21,7 @@
 #include <common.h>
 #include <mpc8xx.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include "sl811.h"
 
 #include "../../../board/kup/common/kup.h"
diff --git a/drivers/usb/host/usb-sandbox.c b/drivers/usb/host/usb-sandbox.c
index 28ee4b0..beb62eb 100644
--- a/drivers/usb/host/usb-sandbox.c
+++ b/drivers/usb/host/usb-sandbox.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <usb.h>
 #include <dm/root.h>
 
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index 5e42301..cb79dfb 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <memalign.h>
 #include <usb.h>
 #include <dm/device-internal.h>
diff --git a/drivers/usb/host/utmi-armada100.c b/drivers/usb/host/utmi-armada100.c
index 8a40f66..5d66e58 100644
--- a/drivers/usb/host/utmi-armada100.c
+++ b/drivers/usb/host/utmi-armada100.c
@@ -14,6 +14,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/armada100.h>
 #include <asm/arch/utmi-armada100.h>
+#include <linux/delay.h>
 
 static int utmi_phy_init(void)
 {
diff --git a/drivers/usb/host/xhci-dwc3.c b/drivers/usb/host/xhci-dwc3.c
index 563db1a..cf72f02 100644
--- a/drivers/usb/host/xhci-dwc3.c
+++ b/drivers/usb/host/xhci-dwc3.c
@@ -10,8 +10,10 @@
 #include <common.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <usb.h>
 #include <dwc3-uboot.h>
+#include <linux/delay.h>
 
 #include <usb/xhci.h>
 #include <asm/io.h>
diff --git a/drivers/usb/host/xhci-exynos5.c b/drivers/usb/host/xhci-exynos5.c
index 25c30c2..1705acc 100644
--- a/drivers/usb/host/xhci-exynos5.c
+++ b/drivers/usb/host/xhci-exynos5.c
@@ -15,6 +15,8 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <malloc.h>
 #include <usb.h>
diff --git a/drivers/usb/host/xhci-fsl.c b/drivers/usb/host/xhci-fsl.c
index 9e0c1b7..d8fb2c5 100644
--- a/drivers/usb/host/xhci-fsl.c
+++ b/drivers/usb/host/xhci-fsl.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <usb.h>
 #include <linux/errno.h>
 #include <linux/compat.h>
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 93450ee..2d968aa 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -16,10 +16,12 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/byteorder.h>
 #include <usb.h>
 #include <malloc.h>
 #include <asm/cache.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 
 #include <usb/xhci.h>
diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
index 2b87104..5fb7484 100644
--- a/drivers/usb/host/xhci-mvebu.c
+++ b/drivers/usb/host/xhci-mvebu.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <usb.h>
 #include <power/regulator.h>
 #include <asm/gpio.h>
diff --git a/drivers/usb/host/xhci-omap.c b/drivers/usb/host/xhci-omap.c
index 25b195f..501129d 100644
--- a/drivers/usb/host/xhci-omap.c
+++ b/drivers/usb/host/xhci-omap.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <usb.h>
 #include <linux/errno.h>
 #include <asm/omap_common.h>
diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index c1f60da..9fb6d2f 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -7,6 +7,8 @@
 
 #include <common.h>
 #include <dm.h>
+#include <init.h>
+#include <log.h>
 #include <pci.h>
 #include <usb.h>
 #include <usb/xhci.h>
diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index d86584b..4964697 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -9,10 +9,12 @@
 #include <clk.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <usb.h>
 #include <wait_bit.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 #include <usb/xhci.h>
 #include "xhci-rcar-r8a779x_usb3_v3.h"
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 3cd6c8a..86aeaab 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -15,9 +15,11 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <asm/byteorder.h>
 #include <usb.h>
 #include <asm/unaligned.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 
 #include <usb/xhci.h>
diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c
index b67722f..1c2bf04 100644
--- a/drivers/usb/host/xhci-rockchip.c
+++ b/drivers/usb/host/xhci-rockchip.c
@@ -5,6 +5,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <usb.h>
 #include <watchdog.h>
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index c370eb6..ebd2954 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -22,12 +22,16 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/byteorder.h>
 #include <usb.h>
 #include <malloc.h>
 #include <watchdog.h>
 #include <asm/cache.h>
 #include <asm/unaligned.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <usb/xhci.h>
 
diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c
index 6e5be90..0a52e09 100644
--- a/drivers/usb/musb-new/am35x.c
+++ b/drivers/usb/musb-new/am35x.c
@@ -26,6 +26,8 @@
 #else
 #include <common.h>
 #include <asm/omap_musb.h>
+#include <linux/bug.h>
+#include <linux/delay.h>
 #include "linux-compat.h"
 #endif
 
diff --git a/drivers/usb/musb-new/da8xx.c b/drivers/usb/musb-new/da8xx.c
index 2ddcf33..67488dd 100644
--- a/drivers/usb/musb-new/da8xx.c
+++ b/drivers/usb/musb-new/da8xx.c
@@ -15,11 +15,13 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/da8xx-usb.h>
+#include <linux/delay.h>
 #include <linux/usb/otg.h>
 #include <asm/omap_musb.h>
 #include <generic-phy.h>
diff --git a/drivers/usb/musb-new/linux-compat.h b/drivers/usb/musb-new/linux-compat.h
index f366ae5..733b197 100644
--- a/drivers/usb/musb-new/linux-compat.h
+++ b/drivers/usb/musb-new/linux-compat.h
@@ -2,6 +2,7 @@
 #define __LINUX_COMPAT_H__
 
 #include <malloc.h>
+#include <linux/delay.h>
 #include <linux/list.h>
 #include <linux/compat.h>
 
diff --git a/drivers/usb/musb-new/mt85xx.c b/drivers/usb/musb-new/mt85xx.c
index 131fd7d..c281c38 100644
--- a/drivers/usb/musb-new/mt85xx.c
+++ b/drivers/usb/musb-new/mt85xx.c
@@ -14,6 +14,7 @@
 #include <dm.h>
 #include <dm/lists.h>
 #include <dm/root.h>
+#include <linux/delay.h>
 #include <linux/usb/musb.h>
 #include <usb.h>
 #include "linux-compat.h"
diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c
index f678aa4..961de99 100644
--- a/drivers/usb/musb-new/musb_core.c
+++ b/drivers/usb/musb-new/musb_core.c
@@ -65,6 +65,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <linux/module.h>
@@ -80,6 +81,8 @@
 #else
 #include <common.h>
 #include <usb.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 #include <linux/usb/ch9.h>
 #include <linux/usb/gadget.h>
diff --git a/drivers/usb/musb-new/musb_gadget.c b/drivers/usb/musb-new/musb_gadget.c
index 35d2123..8ba98d8 100644
--- a/drivers/usb/musb-new/musb_gadget.c
+++ b/drivers/usb/musb-new/musb_gadget.c
@@ -9,6 +9,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <linux/kernel.h>
@@ -22,6 +23,7 @@
 #include <linux/slab.h>
 #else
 #include <common.h>
+#include <linux/bug.h>
 #include <linux/usb/ch9.h>
 #include "linux-compat.h"
 #endif
diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c
index 79e8222..93f43ba 100644
--- a/drivers/usb/musb-new/musb_gadget_ep0.c
+++ b/drivers/usb/musb-new/musb_gadget_ep0.c
@@ -9,6 +9,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/device_compat.h>
 #include <linux/kernel.h>
 #include <linux/list.h>
diff --git a/drivers/usb/musb-new/musb_host.c b/drivers/usb/musb-new/musb_host.c
index b98f0ed..5fa0136 100644
--- a/drivers/usb/musb-new/musb_host.c
+++ b/drivers/usb/musb-new/musb_host.c
@@ -23,6 +23,7 @@
 #else
 #include <common.h>
 #include <usb.h>
+#include <linux/bug.h>
 #include "linux-compat.h"
 #include "usb-compat.h"
 #endif
diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c
index 72f14b9..988071a 100644
--- a/drivers/usb/musb-new/musb_uboot.c
+++ b/drivers/usb/musb-new/musb_uboot.c
@@ -2,6 +2,7 @@
 #include <console.h>
 #include <malloc.h>
 #include <watchdog.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/usb/ch9.h>
diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c
index 0d34dcf..da63cc2 100644
--- a/drivers/usb/musb-new/omap2430.c
+++ b/drivers/usb/musb-new/omap2430.c
@@ -10,6 +10,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <serial.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
diff --git a/drivers/usb/musb-new/pic32.c b/drivers/usb/musb-new/pic32.c
index c7867fe..74a841a 100644
--- a/drivers/usb/musb-new/pic32.c
+++ b/drivers/usb/musb-new/pic32.c
@@ -11,6 +11,8 @@
 
 #include <common.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/usb/musb.h>
 #include "linux-compat.h"
 #include "musb_core.h"
diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c
index 98bf736..53c336f 100644
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -19,6 +19,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <malloc.h>
 #include <phy-sun4i-usb.h>
 #include <reset.h>
@@ -29,6 +30,8 @@
 #include <dm/device_compat.h>
 #include <dm/lists.h>
 #include <dm/root.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/usb/musb.h>
 #include "linux-compat.h"
 #include "musb_core.h"
diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c
index 608face..f4f26d8 100644
--- a/drivers/usb/musb-new/ti-musb.c
+++ b/drivers/usb/musb-new/ti-musb.c
@@ -9,6 +9,7 @@
 #include <command.h>
 #include <console.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/usb/otg.h>
 #include <dm/device-internal.h>
diff --git a/drivers/usb/musb/am35x.c b/drivers/usb/musb/am35x.c
index 0617364..f945f1f 100644
--- a/drivers/usb/musb/am35x.c
+++ b/drivers/usb/musb/am35x.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 
 #include "am35x.h"
 
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c
index c6d47be..147b2eb 100644
--- a/drivers/usb/musb/musb_core.c
+++ b/drivers/usb/musb/musb_core.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <linux/bitops.h>
 
 #include "musb_core.h"
 struct musb_regs *musbr;
diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
index adcd319..afbc648 100644
--- a/drivers/usb/musb/musb_hcd.c
+++ b/drivers/usb/musb/musb_hcd.c
@@ -8,7 +8,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <usb.h>
+#include <linux/delay.h>
 #include "musb_hcd.h"
 
 /* MSC control transfers */
diff --git a/drivers/usb/musb/musb_udc.c b/drivers/usb/musb/musb_udc.c
index 4d77236..d901f87 100644
--- a/drivers/usb/musb/musb_udc.c
+++ b/drivers/usb/musb/musb_udc.c
@@ -41,6 +41,7 @@
 #include <hang.h>
 #include <serial.h>
 #include <usbdevice.h>
+#include <linux/delay.h>
 #include <usb/udc.h>
 #include "../gadget/ep0.h"
 #include "musb_core.h"
diff --git a/drivers/usb/phy/omap_usb_phy.c b/drivers/usb/phy/omap_usb_phy.c
index 9209942..be733f3 100644
--- a/drivers/usb/phy/omap_usb_phy.c
+++ b/drivers/usb/phy/omap_usb_phy.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <usb.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/omap_common.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/usb/phy/rockchip_usb2_phy.c b/drivers/usb/phy/rockchip_usb2_phy.c
index ec99890..f1cf916 100644
--- a/drivers/usb/phy/rockchip_usb2_phy.c
+++ b/drivers/usb/phy/rockchip_usb2_phy.c
@@ -5,7 +5,10 @@
 
 #include <common.h>
 #include <hang.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #include "../gadget/dwc2_udc_otg_priv.h"
 
diff --git a/drivers/usb/phy/twl4030.c b/drivers/usb/phy/twl4030.c
index d2945d1..676868b 100644
--- a/drivers/usb/phy/twl4030.c
+++ b/drivers/usb/phy/twl4030.c
@@ -24,6 +24,7 @@
  */
 
 #include <twl4030.h>
+#include <linux/delay.h>
 
 /* Defines for bits in registers */
 #define OPMODE_MASK		(3 << 3)
diff --git a/drivers/usb/ulpi/omap-ulpi-viewport.c b/drivers/usb/ulpi/omap-ulpi-viewport.c
index 67cdebc..8b930e3 100644
--- a/drivers/usb/ulpi/omap-ulpi-viewport.c
+++ b/drivers/usb/ulpi/omap-ulpi-viewport.c
@@ -8,7 +8,9 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <usb/ulpi.h>
 
 #define OMAP_ULPI_WR_OPSEL	(2 << 22)
diff --git a/drivers/usb/ulpi/ulpi-viewport.c b/drivers/usb/ulpi/ulpi-viewport.c
index a2158c9..3bb152b 100644
--- a/drivers/usb/ulpi/ulpi-viewport.c
+++ b/drivers/usb/ulpi/ulpi-viewport.c
@@ -15,6 +15,7 @@
 
 #include <common.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 #include <usb/ulpi.h>
 
 /* ULPI viewport control bits */
diff --git a/drivers/usb/ulpi/ulpi.c b/drivers/usb/ulpi/ulpi.c
index e0fb43f..dd0da0e 100644
--- a/drivers/usb/ulpi/ulpi.c
+++ b/drivers/usb/ulpi/ulpi.c
@@ -21,6 +21,8 @@
 
 #include <common.h>
 #include <exports.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <usb/ulpi.h>
 
 #define ULPI_ID_REGS_COUNT	4
diff --git a/drivers/video/am335x-fb.c b/drivers/video/am335x-fb.c
index 0f066df..2707ff5 100644
--- a/drivers/video/am335x-fb.c
+++ b/drivers/video/am335x-fb.c
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <dm.h>
 #include <lcd.h>
+#include <log.h>
 #include <video.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/hardware.h>
@@ -21,6 +22,7 @@
 #include <asm/arch/sys_proto.h>
 #include <asm/io.h>
 #include <asm/utils.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include "am335x-fb.h"
 
diff --git a/drivers/video/anx9804.c b/drivers/video/anx9804.c
index fc2f431..b050c42 100644
--- a/drivers/video/anx9804.c
+++ b/drivers/video/anx9804.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <i2c.h>
+#include <linux/delay.h>
 #include "anx98xx-edp.h"
 #include "anx9804.h"
 
diff --git a/drivers/video/anx98xx-edp.h b/drivers/video/anx98xx-edp.h
index 64269c3..ece36d4 100644
--- a/drivers/video/anx98xx-edp.h
+++ b/drivers/video/anx98xx-edp.h
@@ -6,6 +6,7 @@
 
 /* Registers at i2c address 0x38 */
 
+#include <linux/bitops.h>
 #define ANX9804_HDCP_CONTROL_0_REG				0x01
 
 #define ANX9804_SYS_CTRL1_REG					0x80
diff --git a/drivers/video/ati_radeon_fb.c b/drivers/video/ati_radeon_fb.c
index 6fce033..c4da2e3 100644
--- a/drivers/video/ati_radeon_fb.c
+++ b/drivers/video/ati_radeon_fb.c
@@ -16,6 +16,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 
 #include <command.h>
 #include <bios_emul.h>
diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c
index 62accce..35a56a8 100644
--- a/drivers/video/atmel_hlcdfb.c
+++ b/drivers/video/atmel_hlcdfb.c
@@ -7,7 +7,9 @@
 
 #include <common.h>
 #include <cpu_func.h>
+#include <log.h>
 #include <malloc.h>
+#include <part.h>
 #include <asm/io.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/clk.h>
@@ -18,6 +20,7 @@
 #include <video.h>
 #include <wait_bit.h>
 #include <atmel_hlcdc.h>
+#include <linux/bug.h>
 
 #if defined(CONFIG_LCD_LOGO)
 #include <bmp_logo.h>
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c
index bd2e9c0..ae8ec26 100644
--- a/drivers/video/atmel_lcdfb.c
+++ b/drivers/video/atmel_lcdfb.c
@@ -9,6 +9,8 @@
 #include <atmel_lcd.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
+#include <part.h>
 #include <video.h>
 #include <asm/io.h>
 #include <asm/arch/gpio.h>
@@ -16,6 +18,7 @@
 #include <lcd.h>
 #include <bmp_layout.h>
 #include <atmel_lcdc.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/video/backlight_gpio.c b/drivers/video/backlight_gpio.c
index fb1525b..67fed7f 100644
--- a/drivers/video/backlight_gpio.c
+++ b/drivers/video/backlight_gpio.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <backlight.h>
+#include <log.h>
 #include <asm/gpio.h>
 
 struct gpio_backlight_priv {
diff --git a/drivers/video/bcm2835.c b/drivers/video/bcm2835.c
index 1d2eda0..0888cb0 100644
--- a/drivers/video/bcm2835.c
+++ b/drivers/video/bcm2835.c
@@ -5,9 +5,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <video.h>
 #include <asm/arch/mbox.h>
 #include <asm/arch/msg.h>
+#include <asm/cache.h>
 
 static int bcm2835_video_probe(struct udevice *dev)
 {
diff --git a/drivers/video/bridge/anx6345.c b/drivers/video/bridge/anx6345.c
index 3e3f0e2..1c5270f 100644
--- a/drivers/video/bridge/anx6345.c
+++ b/drivers/video/bridge/anx6345.c
@@ -8,7 +8,9 @@
 #include <errno.h>
 #include <i2c.h>
 #include <edid.h>
+#include <log.h>
 #include <video_bridge.h>
+#include <linux/delay.h>
 #include "../anx98xx-edp.h"
 
 #define DP_MAX_LINK_RATE		0x001
diff --git a/drivers/video/bridge/ps862x.c b/drivers/video/bridge/ps862x.c
index 3c5bf7b..8399c6f 100644
--- a/drivers/video/bridge/ps862x.c
+++ b/drivers/video/bridge/ps862x.c
@@ -8,7 +8,9 @@
 #include <dm.h>
 #include <errno.h>
 #include <i2c.h>
+#include <log.h>
 #include <video_bridge.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/video/bridge/ptn3460.c b/drivers/video/bridge/ptn3460.c
index 59f0649..4760f04 100644
--- a/drivers/video/bridge/ptn3460.c
+++ b/drivers/video/bridge/ptn3460.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <video_bridge.h>
 
 static int ptn3460_attach(struct udevice *dev)
diff --git a/drivers/video/bridge/video-bridge-uclass.c b/drivers/video/bridge/video-bridge-uclass.c
index 5fecb4c..389b02c 100644
--- a/drivers/video/bridge/video-bridge-uclass.c
+++ b/drivers/video/bridge/video-bridge-uclass.c
@@ -8,7 +8,9 @@
 #include <dm.h>
 #include <errno.h>
 #include <edid.h>
+#include <log.h>
 #include <video_bridge.h>
+#include <linux/delay.h>
 
 int video_bridge_set_backlight(struct udevice *dev, int percent)
 {
diff --git a/drivers/video/broadwell_igd.c b/drivers/video/broadwell_igd.c
index c23421d..8e8fe9d 100644
--- a/drivers/video/broadwell_igd.c
+++ b/drivers/video/broadwell_igd.c
@@ -7,8 +7,10 @@
 
 #include <common.h>
 #include <bios_emul.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <init.h>
+#include <log.h>
 #include <vbe.h>
 #include <video.h>
 #include <asm/cpu.h>
@@ -18,6 +20,7 @@
 #include <asm/arch/cpu.h>
 #include <asm/arch/iomap.h>
 #include <asm/arch/pch.h>
+#include <linux/delay.h>
 #include "i915_reg.h"
 
 struct broadwell_igd_priv {
diff --git a/drivers/video/bus_vcxk.c b/drivers/video/bus_vcxk.c
index e87c66d..2a72d23 100644
--- a/drivers/video/bus_vcxk.c
+++ b/drivers/video/bus_vcxk.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <bmp_layout.h>
+#include <log.h>
 #include <asm/io.h>
 
 vu_char  *vcxk_bws      = ((vu_char *) (CONFIG_SYS_VCXK_BASE));
diff --git a/drivers/video/cfb_console.c b/drivers/video/cfb_console.c
index 5442bac..6495e22 100644
--- a/drivers/video/cfb_console.c
+++ b/drivers/video/cfb_console.c
@@ -65,10 +65,12 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <cpu_func.h>
 #include <env.h>
 #include <fdtdec.h>
 #include <gzip.h>
+#include <log.h>
 #include <version.h>
 #include <malloc.h>
 #include <video.h>
@@ -1710,7 +1712,8 @@
 			1);
 }
 
-static int do_clrlogo(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_clrlogo(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	if (argc != 1)
 		return cmd_usage(cmdtp);
diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c
index 6d7661d..5f7f039 100644
--- a/drivers/video/console_truetype.c
+++ b/drivers/video/console_truetype.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <video.h>
 #include <video_console.h>
diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c
index 5fb6886..4984dda 100644
--- a/drivers/video/da8xx-fb.c
+++ b/drivers/video/da8xx-fb.c
@@ -13,9 +13,11 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <video_fb.h>
+#include <linux/delay.h>
 #include <linux/list.h>
 #include <linux/fb.h>
 
diff --git a/drivers/video/dw_hdmi.c b/drivers/video/dw_hdmi.c
index bf74d6a..c4fbb18 100644
--- a/drivers/video/dw_hdmi.c
+++ b/drivers/video/dw_hdmi.c
@@ -7,9 +7,11 @@
 
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/io.h>
 #include <i2c.h>
 #include <media_bus_format.h>
+#include <linux/delay.h>
 #include "dw_hdmi.h"
 
 struct tmds_n_cts {
diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c
index 5dd75e7..b7bfbb5 100644
--- a/drivers/video/dw_mipi_dsi.c
+++ b/drivers/video/dw_mipi_dsi.c
@@ -20,6 +20,8 @@
 #include <asm/arch/gpio.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/iopoll.h>
 #include <video_bridge.h>
 
diff --git a/drivers/video/efi.c b/drivers/video/efi.c
index 653cb47..47441a3 100644
--- a/drivers/video/efi.c
+++ b/drivers/video/efi.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <efi_api.h>
+#include <log.h>
 #include <vbe.h>
 #include <video.h>
 
diff --git a/drivers/video/exynos/exynos_dp.c b/drivers/video/exynos/exynos_dp.c
index 2781f6f..749bde8 100644
--- a/drivers/video/exynos/exynos_dp.c
+++ b/drivers/video/exynos/exynos_dp.c
@@ -10,6 +10,8 @@
 #include <common.h>
 #include <display.h>
 #include <fdtdec.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/libfdt.h>
 #include <malloc.h>
 #include <video_bridge.h>
diff --git a/drivers/video/exynos/exynos_dp_lowlevel.c b/drivers/video/exynos/exynos_dp_lowlevel.c
index 8027037..ae500a7 100644
--- a/drivers/video/exynos/exynos_dp_lowlevel.c
+++ b/drivers/video/exynos/exynos_dp_lowlevel.c
@@ -7,6 +7,8 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/dp_info.h>
diff --git a/drivers/video/exynos/exynos_fb.c b/drivers/video/exynos/exynos_fb.c
index 8a8c846..d5b13a6 100644
--- a/drivers/video/exynos/exynos_fb.c
+++ b/drivers/video/exynos/exynos_fb.c
@@ -12,6 +12,7 @@
 #include <div64.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <panel.h>
 #include <video.h>
diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c
index ad5ef93..042aa9a 100644
--- a/drivers/video/exynos/exynos_mipi_dsi.c
+++ b/drivers/video/exynos/exynos_mipi_dsi.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <fdtdec.h>
 #include <dm/devres.h>
diff --git a/drivers/video/exynos/exynos_mipi_dsi_common.c b/drivers/video/exynos/exynos_mipi_dsi_common.c
index adf3d96..ab7d61a 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_common.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_common.c
@@ -8,6 +8,8 @@
 
 #include <common.h>
 #include <lcd.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <asm/arch/dsim.h>
 #include <asm/arch/mipi_dsim.h>
diff --git a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
index 1b6e71d..8111acd 100644
--- a/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
+++ b/drivers/video/exynos/exynos_mipi_dsi_lowlevel.c
@@ -11,6 +11,7 @@
 #include <asm/arch/mipi_dsim.h>
 #include <asm/arch/power.h>
 #include <asm/arch/cpu.h>
+#include <linux/delay.h>
 
 #include "exynos_mipi_dsi_lowlevel.h"
 #include "exynos_mipi_dsi_common.h"
diff --git a/drivers/video/formike.c b/drivers/video/formike.c
index 7bc4bc6..5cbe50d 100644
--- a/drivers/video/formike.c
+++ b/drivers/video/formike.c
@@ -7,7 +7,9 @@
  */
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <spi.h>
+#include <linux/delay.h>
 
 #define TAG_READ	0x80
 #define TAG_WRITE	0x00
diff --git a/drivers/video/fsl_dcu_fb.c b/drivers/video/fsl_dcu_fb.c
index 076e9ea..e9d05c9 100644
--- a/drivers/video/fsl_dcu_fb.c
+++ b/drivers/video/fsl_dcu_fb.c
@@ -7,6 +7,7 @@
  */
 
 #include <init.h>
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <common.h>
 #include <dm.h>
diff --git a/drivers/video/hitachi_tx18d42vm_lcd.c b/drivers/video/hitachi_tx18d42vm_lcd.c
index a57abd2..c6c8df6 100644
--- a/drivers/video/hitachi_tx18d42vm_lcd.c
+++ b/drivers/video/hitachi_tx18d42vm_lcd.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <linux/delay.h>
 
 #include <asm/gpio.h>
 #include <errno.h>
diff --git a/drivers/video/ihs_video_out.c b/drivers/video/ihs_video_out.c
index 0af7c2b..f02fd13 100644
--- a/drivers/video/ihs_video_out.c
+++ b/drivers/video/ihs_video_out.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <display.h>
 #include <dm.h>
+#include <log.h>
 #include <regmap.h>
 #include <video_osd.h>
 #include <asm/gpio.h>
diff --git a/drivers/video/imx/ipu_common.c b/drivers/video/imx/ipu_common.c
index cbe1984..5908b23 100644
--- a/drivers/video/imx/ipu_common.c
+++ b/drivers/video/imx/ipu_common.c
@@ -12,6 +12,8 @@
 
 /* #define DEBUG */
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/err.h>
 #include <asm/io.h>
diff --git a/drivers/video/imx/ipu_disp.c b/drivers/video/imx/ipu_disp.c
index 5c77229..c2f00bf 100644
--- a/drivers/video/imx/ipu_disp.c
+++ b/drivers/video/imx/ipu_disp.c
@@ -13,6 +13,8 @@
 /* #define DEBUG */
 
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <asm/io.h>
diff --git a/drivers/video/imx/mxc_ipuv3_fb.c b/drivers/video/imx/mxc_ipuv3_fb.c
index c64be38..4044473 100644
--- a/drivers/video/imx/mxc_ipuv3_fb.c
+++ b/drivers/video/imx/mxc_ipuv3_fb.c
@@ -11,6 +11,9 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <part.h>
+#include <asm/cache.h>
 #include <linux/errno.h>
 #include <asm/global_data.h>
 #include <linux/string.h>
diff --git a/drivers/video/ivybridge_igd.c b/drivers/video/ivybridge_igd.c
index 6b986e9..4c57e31 100644
--- a/drivers/video/ivybridge_igd.c
+++ b/drivers/video/ivybridge_igd.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <pci_rom.h>
 #include <vbe.h>
 #include <asm/intel_regs.h>
@@ -16,6 +17,7 @@
 #include <asm/pci.h>
 #include <asm/arch/pch.h>
 #include <asm/arch/sandybridge.h>
+#include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/drivers/video/ld9040.c b/drivers/video/ld9040.c
index 93aea05..a36bc2f 100644
--- a/drivers/video/ld9040.c
+++ b/drivers/video/ld9040.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <spi.h>
+#include <linux/delay.h>
 
 static const unsigned char SEQ_USER_SETTING[] = {
 	0xF0, 0x5A, 0x5A
diff --git a/drivers/video/lg4573.c b/drivers/video/lg4573.c
index 997e854..45df9c1 100644
--- a/drivers/video/lg4573.c
+++ b/drivers/video/lg4573.c
@@ -6,13 +6,16 @@
  */
 #include <common.h>
 #include <backlight.h>
+#include <command.h>
 #include <display.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/read.h>
 #include <dm/uclass-internal.h>
 #include <errno.h>
 #include <spi.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 
 #define PWR_ON_DELAY_MSECS  120
 
@@ -208,8 +211,8 @@
 	return 0;
 }
 
-static int do_lgset(cmd_tbl_t *cmdtp, int flag, int argc,
-		       char * const argv[])
+static int do_lgset(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[])
 {
 	struct spi_slave *slave;
 	struct udevice *dev;
diff --git a/drivers/video/logicore_dp_tx.c b/drivers/video/logicore_dp_tx.c
index 84fafe4..9bc4bbb 100644
--- a/drivers/video/logicore_dp_tx.c
+++ b/drivers/video/logicore_dp_tx.c
@@ -14,6 +14,7 @@
 #include <display.h>
 #include <dm.h>
 #include <errno.h>
+#include <linux/delay.h>
 
 #include "axi.h"
 #include "logicore_dp_dpcd.h"
diff --git a/drivers/video/mali_dp.c b/drivers/video/mali_dp.c
index 87a75a9..1e6da0e 100644
--- a/drivers/video/mali_dp.c
+++ b/drivers/video/mali_dp.c
@@ -18,6 +18,7 @@
 #include <fdt_support.h>
 #include <clk.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/sizes.h>
 
 #define MALIDP_CORE_ID		0x0018
diff --git a/drivers/video/mb862xx.c b/drivers/video/mb862xx.c
index 301c1f0..04e435f 100644
--- a/drivers/video/mb862xx.c
+++ b/drivers/video/mb862xx.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <linux/delay.h>
 
 #include <asm/io.h>
 #include <env.h>
@@ -79,7 +80,7 @@
 	GraphicDevice *dev = &mb862xx;
 
 	HOST_WR_REG (GC_SRST, 0x1);
-	udelay (500);
+	udelay(500);
 	video_hw_init ();
 }
 
@@ -222,9 +223,9 @@
 
 	/* Setup clocks and memory mode for Coral-P(A) */
 	HOST_WR_REG(GC_CCF, CONFIG_SYS_MB862xx_CCF);
-	udelay (200);
+	udelay(200);
 	HOST_WR_REG(GC_MMR, CONFIG_SYS_MB862xx_MMR);
-	udelay (100);
+	udelay(100);
 	return dev->frameAdrs;
 }
 
diff --git a/drivers/video/meson/meson_dw_hdmi.c b/drivers/video/meson/meson_dw_hdmi.c
index ae2e628..7b2ff94 100644
--- a/drivers/video/meson/meson_dw_hdmi.c
+++ b/drivers/video/meson/meson_dw_hdmi.c
@@ -8,10 +8,12 @@
 #include <display.h>
 #include <dm.h>
 #include <edid.h>
+#include <log.h>
 #include <asm/io.h>
 #include <dw_hdmi.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
+#include <linux/bitops.h>
 #include <power/regulator.h>
 #include <clk.h>
 #include <linux/delay.h>
diff --git a/drivers/video/meson/meson_dw_hdmi.h b/drivers/video/meson/meson_dw_hdmi.h
index b13beb1..d507e59 100644
--- a/drivers/video/meson/meson_dw_hdmi.h
+++ b/drivers/video/meson/meson_dw_hdmi.h
@@ -24,6 +24,7 @@
  * Bit 0 RW sw_reset_core: connects to IP's ~irstz. 1=Apply reset;
  *     0=Release from reset. Default 1.
  */
+#include <linux/bitops.h>
 #define HDMITX_TOP_SW_RESET                     (0x000)
 
 /*
diff --git a/drivers/video/meson/meson_plane.c b/drivers/video/meson/meson_plane.c
index 8edf451..b367276 100644
--- a/drivers/video/meson/meson_plane.c
+++ b/drivers/video/meson/meson_plane.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <asm/io.h>
 #include <linux/bitfield.h>
+#include <linux/bitops.h>
 
 #include "meson_vpu.h"
 
diff --git a/drivers/video/meson/meson_registers.h b/drivers/video/meson/meson_registers.h
index 39e8ec8..f6a5d1a 100644
--- a/drivers/video/meson/meson_registers.h
+++ b/drivers/video/meson/meson_registers.h
@@ -7,6 +7,7 @@
 #define __MESON_REGISTERS_H
 
 /* Shift all registers by 2 */
+#include <linux/bitops.h>
 #define _REG(reg)	((reg) << 2)
 
 #define writel_bits(mask, val, addr) \
diff --git a/drivers/video/meson/meson_vclk.c b/drivers/video/meson/meson_vclk.c
index 01bfa4b..cd1e690 100644
--- a/drivers/video/meson/meson_vclk.c
+++ b/drivers/video/meson/meson_vclk.c
@@ -9,7 +9,9 @@
 #include <common.h>
 #include <dm.h>
 #include <edid.h>
+#include <linux/bitops.h>
 #include "meson_vpu.h"
+#include <log.h>
 #include <linux/iopoll.h>
 #include <linux/math64.h>
 
diff --git a/drivers/video/meson/meson_venc.c b/drivers/video/meson/meson_venc.c
index 89e859b..e7366dd 100644
--- a/drivers/video/meson/meson_venc.c
+++ b/drivers/video/meson/meson_venc.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <edid.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/io.h>
 #include "meson_vpu.h"
 
diff --git a/drivers/video/meson/meson_vpu.c b/drivers/video/meson/meson_vpu.c
index ed47192..4868839 100644
--- a/drivers/video/meson/meson_vpu.c
+++ b/drivers/video/meson/meson_vpu.c
@@ -11,6 +11,8 @@
 #include <dm.h>
 #include <efi_loader.h>
 #include <fdt_support.h>
+#include <log.h>
+#include <part.h>
 #include <linux/sizes.h>
 #include <asm/arch/mem.h>
 #include <dm/device-internal.h>
diff --git a/drivers/video/meson/meson_vpu_init.c b/drivers/video/meson/meson_vpu_init.c
index 8408c59..c9808e1 100644
--- a/drivers/video/meson/meson_vpu_init.c
+++ b/drivers/video/meson/meson_vpu_init.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <dm.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #include "meson_vpu.h"
 
diff --git a/drivers/video/mvebu_lcd.c b/drivers/video/mvebu_lcd.c
index 3ff5b28..f3cb2bf 100644
--- a/drivers/video/mvebu_lcd.c
+++ b/drivers/video/mvebu_lcd.c
@@ -7,8 +7,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <part.h>
 #include <video.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/mbus.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/video/mx3fb.c b/drivers/video/mx3fb.c
index a984443..9b42ca8 100644
--- a/drivers/video/mx3fb.c
+++ b/drivers/video/mx3fb.c
@@ -7,8 +7,10 @@
  */
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <video_fb.h>
+#include <linux/delay.h>
 
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index 12d00b4..6589a2a 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -8,7 +8,10 @@
 #include <clk.h>
 #include <dm.h>
 #include <env.h>
+#include <log.h>
+#include <asm/cache.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <malloc.h>
 #include <video.h>
diff --git a/drivers/video/orisetech_otm8009a.c b/drivers/video/orisetech_otm8009a.c
index 650ed07..b1f2dd4 100644
--- a/drivers/video/orisetech_otm8009a.c
+++ b/drivers/video/orisetech_otm8009a.c
@@ -14,6 +14,7 @@
 #include <panel.h>
 #include <asm/gpio.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 #define OTM8009A_BACKLIGHT_DEFAULT	240
diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c
index 742579a..468a570 100644
--- a/drivers/video/pwm_backlight.c
+++ b/drivers/video/pwm_backlight.c
@@ -9,9 +9,11 @@
 #include <common.h>
 #include <dm.h>
 #include <backlight.h>
+#include <log.h>
 #include <malloc.h>
 #include <pwm.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 /**
diff --git a/drivers/video/pxa_lcd.c b/drivers/video/pxa_lcd.c
index 92d6e3d..67f5266 100644
--- a/drivers/video/pxa_lcd.c
+++ b/drivers/video/pxa_lcd.c
@@ -11,6 +11,7 @@
 /************************************************************************/
 
 #include <common.h>
+#include <log.h>
 #include <asm/arch/pxa-regs.h>
 #include <asm/io.h>
 #include <lcd.h>
diff --git a/drivers/video/raydium-rm68200.c b/drivers/video/raydium-rm68200.c
index 853dbc5..9169280 100644
--- a/drivers/video/raydium-rm68200.c
+++ b/drivers/video/raydium-rm68200.c
@@ -14,6 +14,7 @@
 #include <panel.h>
 #include <asm/gpio.h>
 #include <dm/device_compat.h>
+#include <linux/delay.h>
 #include <power/regulator.h>
 
 /*** Manufacturer Command Set ***/
diff --git a/drivers/video/rockchip/rk3288_hdmi.c b/drivers/video/rockchip/rk3288_hdmi.c
index 51eb415..f835f4d 100644
--- a/drivers/video/rockchip/rk3288_hdmi.c
+++ b/drivers/video/rockchip/rk3288_hdmi.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <dw_hdmi.h>
 #include <edid.h>
+#include <log.h>
 #include <malloc.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/drivers/video/rockchip/rk3288_mipi.c b/drivers/video/rockchip/rk3288_mipi.c
index 71d3faf..b232ff0 100644
--- a/drivers/video/rockchip/rk3288_mipi.c
+++ b/drivers/video/rockchip/rk3288_mipi.c
@@ -8,6 +8,7 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
+#include <log.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
diff --git a/drivers/video/rockchip/rk3288_vop.c b/drivers/video/rockchip/rk3288_vop.c
index 0f91dab..25ef25b 100644
--- a/drivers/video/rockchip/rk3288_vop.c
+++ b/drivers/video/rockchip/rk3288_vop.c
@@ -15,6 +15,7 @@
 #include <asm/arch-rockchip/clock.h>
 #include <asm/arch-rockchip/grf_rk3288.h>
 #include <asm/arch-rockchip/hardware.h>
+#include <linux/delay.h>
 #include "rk_vop.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/video/rockchip/rk3399_mipi.c b/drivers/video/rockchip/rk3399_mipi.c
index cfaa377..113708d 100644
--- a/drivers/video/rockchip/rk3399_mipi.c
+++ b/drivers/video/rockchip/rk3399_mipi.c
@@ -8,6 +8,7 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
+#include <log.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
diff --git a/drivers/video/rockchip/rk3399_vop.c b/drivers/video/rockchip/rk3399_vop.c
index 1d5b393..d5a7aa8 100644
--- a/drivers/video/rockchip/rk3399_vop.c
+++ b/drivers/video/rockchip/rk3399_vop.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <display.h>
 #include <dm.h>
+#include <log.h>
 #include <regmap.h>
 #include <video.h>
 #include <asm/arch-rockchip/hardware.h>
diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c
index 99b16cd..92188be 100644
--- a/drivers/video/rockchip/rk_edp.c
+++ b/drivers/video/rockchip/rk_edp.c
@@ -9,6 +9,7 @@
 #include <display.h>
 #include <dm.h>
 #include <edid.h>
+#include <log.h>
 #include <malloc.h>
 #include <panel.h>
 #include <regmap.h>
@@ -20,6 +21,7 @@
 #include <asm/arch-rockchip/grf_rk3288.h>
 #include <asm/arch-rockchip/hardware.h>
 #include <dt-bindings/clock/rk3288-cru.h>
+#include <linux/delay.h>
 
 #define MAX_CR_LOOP 5
 #define MAX_EQ_LOOP 5
diff --git a/drivers/video/rockchip/rk_hdmi.c b/drivers/video/rockchip/rk_hdmi.c
index 5b44a7e..f27cdf8 100644
--- a/drivers/video/rockchip/rk_hdmi.c
+++ b/drivers/video/rockchip/rk_hdmi.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <dw_hdmi.h>
 #include <edid.h>
+#include <log.h>
 #include <regmap.h>
 #include <syscon.h>
 #include <asm/gpio.h>
diff --git a/drivers/video/rockchip/rk_lvds.c b/drivers/video/rockchip/rk_lvds.c
index c92c2e3..04f795a 100644
--- a/drivers/video/rockchip/rk_lvds.c
+++ b/drivers/video/rockchip/rk_lvds.c
@@ -7,6 +7,7 @@
 #include <display.h>
 #include <dm.h>
 #include <edid.h>
+#include <log.h>
 #include <panel.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/drivers/video/rockchip/rk_mipi.c b/drivers/video/rockchip/rk_mipi.c
index f1c21bb..f811913 100644
--- a/drivers/video/rockchip/rk_mipi.c
+++ b/drivers/video/rockchip/rk_mipi.c
@@ -8,6 +8,7 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
+#include <log.h>
 #include <panel.h>
 #include <regmap.h>
 #include "rk_mipi.h"
diff --git a/drivers/video/rockchip/rk_vop.c b/drivers/video/rockchip/rk_vop.c
index e1bd656..9032eb4 100644
--- a/drivers/video/rockchip/rk_vop.c
+++ b/drivers/video/rockchip/rk_vop.c
@@ -9,6 +9,7 @@
 #include <display.h>
 #include <dm.h>
 #include <edid.h>
+#include <log.h>
 #include <regmap.h>
 #include <syscon.h>
 #include <video.h>
@@ -19,6 +20,7 @@
 #include <asm/arch-rockchip/vop_rk3288.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <power/regulator.h>
 #include "rk_vop.h"
diff --git a/drivers/video/s6e8ax0.c b/drivers/video/s6e8ax0.c
index 9c7b5f6..497258f 100644
--- a/drivers/video/s6e8ax0.c
+++ b/drivers/video/s6e8ax0.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <asm/arch/mipi_dsim.h>
+#include <linux/delay.h>
 
 #include "exynos/exynos_mipi_dsi_lowlevel.h"
 #include "exynos/exynos_mipi_dsi_common.h"
diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c
index 1196e6c..20248e6 100644
--- a/drivers/video/sandbox_sdl.c
+++ b/drivers/video/sandbox_sdl.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <video.h>
 #include <asm/sdl.h>
 #include <asm/state.h>
diff --git a/drivers/video/scf0403_lcd.c b/drivers/video/scf0403_lcd.c
index 60075a6..54f0f88 100644
--- a/drivers/video/scf0403_lcd.c
+++ b/drivers/video/scf0403_lcd.c
@@ -17,6 +17,7 @@
 #include <malloc.h>
 #include <asm/gpio.h>
 #include <spi.h>
+#include <linux/delay.h>
 
 struct scf0403_cmd {
 	u16 cmd;
diff --git a/drivers/video/simple_panel.c b/drivers/video/simple_panel.c
index 5722811..6c624c3 100644
--- a/drivers/video/simple_panel.c
+++ b/drivers/video/simple_panel.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <backlight.h>
 #include <dm.h>
+#include <log.h>
 #include <panel.h>
 #include <asm/gpio.h>
 #include <power/regulator.h>
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
index 1679d20..0c5b40c 100644
--- a/drivers/video/simplefb.c
+++ b/drivers/video/simplefb.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <video.h>
 
 static int simple_video_probe(struct udevice *dev)
diff --git a/drivers/video/ssd2828.c b/drivers/video/ssd2828.c
index 83566bc..4cdcbe7 100644
--- a/drivers/video/ssd2828.c
+++ b/drivers/video/ssd2828.c
@@ -14,6 +14,7 @@
 #include <mipi_display.h>
 #include <asm/arch/gpio.h>
 #include <asm/gpio.h>
+#include <linux/delay.h>
 
 #include "videomodes.h"
 #include "ssd2828.h"
diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c
index ded03b1..0479643 100644
--- a/drivers/video/stm32/stm32_dsi.c
+++ b/drivers/video/stm32/stm32_dsi.c
@@ -12,6 +12,7 @@
 #include <clk.h>
 #include <dm.h>
 #include <dsi_host.h>
+#include <log.h>
 #include <mipi_dsi.h>
 #include <panel.h>
 #include <reset.h>
@@ -22,6 +23,7 @@
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
 #include <dm/lists.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 #include <power/regulator.h>
 
diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c
index be7e9bf..2f3427a 100644
--- a/drivers/video/stm32/stm32_ltdc.c
+++ b/drivers/video/stm32/stm32_ltdc.c
@@ -9,6 +9,7 @@
 #include <clk.h>
 #include <display.h>
 #include <dm.h>
+#include <log.h>
 #include <panel.h>
 #include <reset.h>
 #include <video.h>
@@ -17,6 +18,7 @@
 #include <asm/arch/gpio.h>
 #include <dm/device-internal.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
 
 struct stm32_ltdc_priv {
 	void __iomem *regs;
diff --git a/drivers/video/sunxi/lcdc.c b/drivers/video/sunxi/lcdc.c
index 4cf3a0e..73033c3 100644
--- a/drivers/video/sunxi/lcdc.c
+++ b/drivers/video/sunxi/lcdc.c
@@ -8,6 +8,8 @@
  */
 
 #include <common.h>
+#include <log.h>
+#include <linux/delay.h>
 
 #include <asm/arch/clock.h>
 #include <asm/arch/lcdc.h>
diff --git a/drivers/video/sunxi/sunxi_de2.c b/drivers/video/sunxi/sunxi_de2.c
index c6e7a35..b657e16 100644
--- a/drivers/video/sunxi/sunxi_de2.c
+++ b/drivers/video/sunxi/sunxi_de2.c
@@ -12,6 +12,8 @@
 #include <efi_loader.h>
 #include <fdtdec.h>
 #include <fdt_support.h>
+#include <log.h>
+#include <part.h>
 #include <video.h>
 #include <asm/global_data.h>
 #include <asm/io.h>
@@ -19,6 +21,7 @@
 #include <asm/arch/display2.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
+#include <linux/bitops.h>
 #include "simplefb_common.h"
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/video/sunxi/sunxi_display.c b/drivers/video/sunxi/sunxi_display.c
index c4c1d1b..f52aba4 100644
--- a/drivers/video/sunxi/sunxi_display.c
+++ b/drivers/video/sunxi/sunxi_display.c
@@ -11,6 +11,7 @@
 #include <efi_loader.h>
 #include <init.h>
 #include <time.h>
+#include <linux/delay.h>
 
 #include <asm/arch/clock.h>
 #include <asm/arch/display.h>
diff --git a/drivers/video/sunxi/sunxi_dw_hdmi.c b/drivers/video/sunxi/sunxi_dw_hdmi.c
index c87c919..01d4b7a 100644
--- a/drivers/video/sunxi/sunxi_dw_hdmi.c
+++ b/drivers/video/sunxi/sunxi_dw_hdmi.c
@@ -10,10 +10,13 @@
 #include <dm.h>
 #include <dw_hdmi.h>
 #include <edid.h>
+#include <log.h>
 #include <time.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/lcdc.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 struct sunxi_dw_hdmi_priv {
 	struct dw_hdmi hdmi;
diff --git a/drivers/video/sunxi/sunxi_lcd.c b/drivers/video/sunxi/sunxi_lcd.c
index 619f589..49bf083 100644
--- a/drivers/video/sunxi/sunxi_lcd.c
+++ b/drivers/video/sunxi/sunxi_lcd.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <display.h>
+#include <log.h>
 #include <video_bridge.h>
 #include <backlight.h>
 #include <dm.h>
diff --git a/drivers/video/tda19988.c b/drivers/video/tda19988.c
index 01ed619..191cda3 100644
--- a/drivers/video/tda19988.c
+++ b/drivers/video/tda19988.c
@@ -9,6 +9,8 @@
 #include <dm.h>
 #include <display.h>
 #include <i2c.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 /*
  * TDA19988 uses paged registers. We encode the page# in the upper
diff --git a/drivers/video/tegra.c b/drivers/video/tegra.c
index f4bae9f..1208d91 100644
--- a/drivers/video/tegra.c
+++ b/drivers/video/tegra.c
@@ -6,9 +6,12 @@
 #include <common.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <panel.h>
+#include <part.h>
 #include <pwm.h>
 #include <video.h>
+#include <asm/cache.h>
 #include <asm/system.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
diff --git a/drivers/video/tegra124/display.c b/drivers/video/tegra124/display.c
index f08f117..6c27932 100644
--- a/drivers/video/tegra124/display.c
+++ b/drivers/video/tegra124/display.c
@@ -6,12 +6,15 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <edid.h>
 #include <errno.h>
 #include <display.h>
 #include <edid.h>
 #include <lcd.h>
+#include <log.h>
+#include <part.h>
 #include <video.h>
 #include <asm/gpio.h>
 #include <asm/io.h>
@@ -19,6 +22,7 @@
 #include <asm/arch/pwm.h>
 #include <asm/arch-tegra/dc.h>
 #include <dm/uclass-internal.h>
+#include <linux/delay.h>
 #include "displayport.h"
 
 /* return in 1000ths of a Hertz */
diff --git a/drivers/video/tegra124/dp.c b/drivers/video/tegra124/dp.c
index 73e0651..59758eb 100644
--- a/drivers/video/tegra124/dp.c
+++ b/drivers/video/tegra124/dp.c
@@ -9,9 +9,11 @@
 #include <dm.h>
 #include <div64.h>
 #include <errno.h>
+#include <log.h>
 #include <video_bridge.h>
 #include <asm/io.h>
 #include <asm/arch-tegra/dc.h>
+#include <linux/delay.h>
 #include "display.h"
 #include "edid.h"
 #include "sor.h"
diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c
index 8dc3df6..49f33c1 100644
--- a/drivers/video/tegra124/sor.c
+++ b/drivers/video/tegra124/sor.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <panel.h>
 #include <syscon.h>
@@ -13,6 +14,7 @@
 #include <asm/io.h>
 #include <asm/arch/clock.h>
 #include <asm/arch-tegra/dc.h>
+#include <linux/delay.h>
 #include "displayport.h"
 #include "sor.h"
 #include <linux/err.h>
diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c
index 8e0fc7f..d30e6db 100644
--- a/drivers/video/vidconsole-uclass.c
+++ b/drivers/video/vidconsole-uclass.c
@@ -8,6 +8,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <linux/ctype.h>
 #include <dm.h>
 #include <video.h>
@@ -623,7 +625,7 @@
 	priv->ycur = min_t(short, row, vid_priv->ysize - 1);
 }
 
-static int do_video_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_video_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
 			      char *const argv[])
 {
 	unsigned int col, row;
@@ -641,7 +643,7 @@
 	return 0;
 }
 
-static int do_video_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc,
 			 char *const argv[])
 {
 	struct udevice *dev;
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 3d658e6..bf396d1 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -6,11 +6,13 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <stdio_dev.h>
 #include <video.h>
 #include <video_console.h>
+#include <asm/cache.h>
 #include <dm/lists.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
diff --git a/drivers/video/video_bmp.c b/drivers/video/video_bmp.c
index 8768228..eb96365 100644
--- a/drivers/video/video_bmp.c
+++ b/drivers/video/video_bmp.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <bmp_layout.h>
 #include <dm.h>
+#include <log.h>
 #include <mapmem.h>
 #include <splash.h>
 #include <video.h>
diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c
index 23f281c..2636cbe 100644
--- a/drivers/virtio/virtio-uclass.c
+++ b/drivers/virtio/virtio-uclass.c
@@ -17,10 +17,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <virtio_types.h>
 #include <virtio.h>
 #include <dm/lists.h>
+#include <linux/bug.h>
 
 static const char *const virtio_drv_name[VIRTIO_ID_MAX_NUM] = {
 	[VIRTIO_ID_NET]		= VIRTIO_NET_DRV_NAME,
diff --git a/drivers/virtio/virtio_blk.c b/drivers/virtio/virtio_blk.c
index e793e34..992118c 100644
--- a/drivers/virtio/virtio_blk.c
+++ b/drivers/virtio/virtio_blk.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <blk.h>
 #include <dm.h>
+#include <part.h>
 #include <virtio_types.h>
 #include <virtio.h>
 #include <virtio_ring.h>
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c
index 60ece13..b951ea3 100644
--- a/drivers/virtio/virtio_mmio.c
+++ b/drivers/virtio/virtio_mmio.c
@@ -9,9 +9,11 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <virtio_types.h>
 #include <virtio.h>
 #include <virtio_ring.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <linux/err.h>
 #include <linux/io.h>
diff --git a/drivers/virtio/virtio_mmio.h b/drivers/virtio/virtio_mmio.h
index b340882..b446674 100644
--- a/drivers/virtio/virtio_mmio.h
+++ b/drivers/virtio/virtio_mmio.h
@@ -12,6 +12,7 @@
 /* Control registers */
 
 /* Magic value ("virt" string) - Read Only */
+#include <linux/bitops.h>
 #define VIRTIO_MMIO_MAGIC_VALUE		0x000
 
 /* Virtio device version - Read Only */
diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c
index d9be260..fa7f242 100644
--- a/drivers/virtio/virtio_pci_legacy.c
+++ b/drivers/virtio/virtio_pci_legacy.c
@@ -8,10 +8,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <virtio_types.h>
 #include <virtio.h>
 #include <virtio_ring.h>
 #include <dm/device.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <linux/err.h>
 #include <linux/io.h>
diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c
index 4673f4a..2e5bbad 100644
--- a/drivers/virtio/virtio_pci_modern.c
+++ b/drivers/virtio/virtio_pci_modern.c
@@ -8,11 +8,14 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <virtio_types.h>
 #include <virtio.h>
 #include <virtio_ring.h>
 #include <dm/device.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
+#include <linux/delay.h>
 #include <linux/err.h>
 #include <linux/io.h>
 #include "virtio_pci.h"
diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c
index 45c48a9..7f1cbc5 100644
--- a/drivers/virtio/virtio_ring.c
+++ b/drivers/virtio/virtio_ring.c
@@ -8,10 +8,12 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <virtio_types.h>
 #include <virtio.h>
 #include <virtio_ring.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 
 int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[],
diff --git a/drivers/virtio/virtio_rng.c b/drivers/virtio/virtio_rng.c
index 4edffa6..fc3e19c 100644
--- a/drivers/virtio/virtio_rng.c
+++ b/drivers/virtio/virtio_rng.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <rng.h>
 #include <virtio_types.h>
 #include <virtio.h>
diff --git a/drivers/virtio/virtio_sandbox.c b/drivers/virtio/virtio_sandbox.c
index 61f6a96..2a2abb9 100644
--- a/drivers/virtio/virtio_sandbox.c
+++ b/drivers/virtio/virtio_sandbox.c
@@ -10,6 +10,7 @@
 #include <virtio_types.h>
 #include <virtio.h>
 #include <virtio_ring.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <linux/err.h>
 #include <linux/io.h>
diff --git a/drivers/w1-eeprom/w1-eeprom-uclass.c b/drivers/w1-eeprom/w1-eeprom-uclass.c
index 7b05793..d515b4c 100644
--- a/drivers/w1-eeprom/w1-eeprom-uclass.c
+++ b/drivers/w1-eeprom/w1-eeprom-uclass.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <w1.h>
 #include <w1-eeprom.h>
 
diff --git a/drivers/w1/mxc_w1.c b/drivers/w1/mxc_w1.c
index 08715c6..5bf0865 100644
--- a/drivers/w1/mxc_w1.c
+++ b/drivers/w1/mxc_w1.c
@@ -21,6 +21,8 @@
 #include <common.h>
 #include <dm.h>
 #include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 #include <linux/io.h>
 #include <w1.h>
 
diff --git a/drivers/w1/w1-gpio.c b/drivers/w1/w1-gpio.c
index 5e5d6b3..45ad47a 100644
--- a/drivers/w1/w1-gpio.c
+++ b/drivers/w1/w1-gpio.c
@@ -9,7 +9,9 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <w1.h>
+#include <linux/delay.h>
 
 #include <asm/gpio.h>
 
diff --git a/drivers/w1/w1-uclass.c b/drivers/w1/w1-uclass.c
index 042b3b5..9478c93 100644
--- a/drivers/w1/w1-uclass.c
+++ b/drivers/w1/w1-uclass.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <w1.h>
 #include <w1-eeprom.h>
 
diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c
index fe2f6be..7e11465 100644
--- a/drivers/watchdog/ast_wdt.c
+++ b/drivers/watchdog/ast_wdt.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <wdt.h>
 #include <asm/io.h>
 #include <asm/arch/wdt.h>
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
index 48433cc..18756e3 100644
--- a/drivers/watchdog/at91sam9_wdt.c
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -14,6 +14,7 @@
  * write to this register. Inform Linux to it too
  */
 
+#include <log.h>
 #include <asm/io.h>
 #include <asm/arch/at91_wdt.h>
 #include <common.h>
diff --git a/drivers/watchdog/bcm6345_wdt.c b/drivers/watchdog/bcm6345_wdt.c
index 9f14e7d..ee77f49 100644
--- a/drivers/watchdog/bcm6345_wdt.c
+++ b/drivers/watchdog/bcm6345_wdt.c
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <wdt.h>
 #include <clk.h>
 #include <asm/io.h>
diff --git a/drivers/watchdog/cdns_wdt.c b/drivers/watchdog/cdns_wdt.c
index 5bf0260..2abd552 100644
--- a/drivers/watchdog/cdns_wdt.c
+++ b/drivers/watchdog/cdns_wdt.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <wdt.h>
 #include <clk.h>
 #include <div64.h>
diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
index 1024a04..12f09a7 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -10,6 +10,7 @@
 #include <wdt.h>
 #include <asm/io.h>
 #include <asm/utils.h>
+#include <linux/bitops.h>
 
 #define DW_WDT_CR	0x00
 #define DW_WDT_TORR	0x04
diff --git a/drivers/watchdog/ftwdt010_wdt.c b/drivers/watchdog/ftwdt010_wdt.c
index 076d801..6aed416 100644
--- a/drivers/watchdog/ftwdt010_wdt.c
+++ b/drivers/watchdog/ftwdt010_wdt.c
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <faraday/ftwdt010_wdt.h>
diff --git a/drivers/watchdog/mt7621_wdt.c b/drivers/watchdog/mt7621_wdt.c
index 3886614..1cd8866 100644
--- a/drivers/watchdog/mt7621_wdt.c
+++ b/drivers/watchdog/mt7621_wdt.c
@@ -12,6 +12,7 @@
 #include <common.h>
 #include <dm.h>
 #include <wdt.h>
+#include <linux/bitops.h>
 #include <linux/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/watchdog/mtk_wdt.c b/drivers/watchdog/mtk_wdt.c
index b3c597e..a636cff 100644
--- a/drivers/watchdog/mtk_wdt.c
+++ b/drivers/watchdog/mtk_wdt.c
@@ -11,6 +11,7 @@
 #include <hang.h>
 #include <wdt.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 
 #define MTK_WDT_MODE			0x00
 #define MTK_WDT_LENGTH			0x04
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c
index 5199d91..ed8b219 100644
--- a/drivers/watchdog/omap_wdt.c
+++ b/drivers/watchdog/omap_wdt.c
@@ -37,6 +37,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <watchdog.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
diff --git a/drivers/watchdog/orion_wdt.c b/drivers/watchdog/orion_wdt.c
index 885821d..d33e2ac 100644
--- a/drivers/watchdog/orion_wdt.c
+++ b/drivers/watchdog/orion_wdt.c
@@ -15,7 +15,9 @@
 #include <common.h>
 #include <dm.h>
 #include <clk.h>
+#include <log.h>
 #include <wdt.h>
+#include <linux/bitops.h>
 #include <linux/kernel.h>
 #include <asm/io.h>
 #include <asm/arch/cpu.h>
diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 65fd238..23fef21 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -5,6 +5,7 @@
  * Copyright 2019 NXP
  */
 
+#include <log.h>
 #include <asm/io.h>
 #include <common.h>
 #include <clk.h>
diff --git a/drivers/watchdog/stm32mp_wdt.c b/drivers/watchdog/stm32mp_wdt.c
index 8093d0a..2d8bfc0 100644
--- a/drivers/watchdog/stm32mp_wdt.c
+++ b/drivers/watchdog/stm32mp_wdt.c
@@ -6,9 +6,11 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <syscon.h>
 #include <wdt.h>
 #include <asm/io.h>
+#include <linux/bitops.h>
 #include <linux/iopoll.h>
 
 /* IWDG registers */
diff --git a/drivers/watchdog/tangier_wdt.c b/drivers/watchdog/tangier_wdt.c
index ba265cf..358a9b9 100644
--- a/drivers/watchdog/tangier_wdt.c
+++ b/drivers/watchdog/tangier_wdt.c
@@ -4,6 +4,7 @@
  */
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <wdt.h>
 #include <div64.h>
 #include <asm/scu.h>
diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 4cdb7bd..e632f07 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <hang.h>
+#include <log.h>
 #include <time.h>
 #include <wdt.h>
 #include <dm/device-internal.h>
diff --git a/drivers/watchdog/xilinx_tb_wdt.c b/drivers/watchdog/xilinx_tb_wdt.c
index 5580764..ea4311c 100644
--- a/drivers/watchdog/xilinx_tb_wdt.c
+++ b/drivers/watchdog/xilinx_tb_wdt.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <wdt.h>
 #include <linux/err.h>
 #include <linux/io.h>
diff --git a/env/common.c b/env/common.c
index 1fd1bd0..088b2ae 100644
--- a/env/common.c
+++ b/env/common.c
@@ -8,9 +8,11 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <env.h>
 #include <env_internal.h>
+#include <log.h>
 #include <sort.h>
 #include <linux/stddef.h>
 #include <search.h>
diff --git a/env/env.c b/env/env.c
index 9237bb9..dcc25c0 100644
--- a/env/env.c
+++ b/env/env.c
@@ -7,6 +7,9 @@
 #include <common.h>
 #include <env.h>
 #include <env_internal.h>
+#include <log.h>
+#include <linux/bitops.h>
+#include <linux/bug.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/env/ext4.c b/env/ext4.c
index 911e19c..8e90bb7 100644
--- a/env/ext4.c
+++ b/env/ext4.c
@@ -19,6 +19,7 @@
  */
 
 #include <common.h>
+#include <part.h>
 
 #include <command.h>
 #include <env.h>
@@ -45,7 +46,7 @@
 {
 	env_t	env_new;
 	struct blk_desc *dev_desc = NULL;
-	disk_partition_t info;
+	struct disk_partition info;
 	int dev, part;
 	int err;
 	const char *ifname = env_ext4_get_intf();
@@ -87,7 +88,7 @@
 {
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 	struct blk_desc *dev_desc = NULL;
-	disk_partition_t info;
+	struct disk_partition info;
 	int dev, part;
 	int err;
 	loff_t off;
diff --git a/env/fat.c b/env/fat.c
index cf2e5e2..35a1955 100644
--- a/env/fat.c
+++ b/env/fat.c
@@ -7,17 +7,18 @@
  */
 
 #include <common.h>
-
 #include <command.h>
 #include <env.h>
 #include <env_internal.h>
-#include <linux/stddef.h>
+#include <part.h>
 #include <malloc.h>
 #include <memalign.h>
 #include <search.h>
 #include <errno.h>
 #include <fat.h>
 #include <mmc.h>
+#include <asm/cache.h>
+#include <linux/stddef.h>
 
 #ifdef CONFIG_SPL_BUILD
 /* TODO(sjg@chromium.org): Figure out why this is needed */
@@ -32,7 +33,7 @@
 {
 	env_t __aligned(ARCH_DMA_MINALIGN) env_new;
 	struct blk_desc *dev_desc = NULL;
-	disk_partition_t info;
+	struct disk_partition info;
 	int dev, part;
 	int err;
 	loff_t size;
@@ -78,7 +79,7 @@
 {
 	ALLOC_CACHE_ALIGN_BUFFER(char, buf, CONFIG_ENV_SIZE);
 	struct blk_desc *dev_desc = NULL;
-	disk_partition_t info;
+	struct disk_partition info;
 	int dev, part;
 	int err;
 
diff --git a/env/flash.c b/env/flash.c
index e05f7ef..3198147 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -14,6 +14,7 @@
 #include <env.h>
 #include <env_internal.h>
 #include <flash.h>
+#include <log.h>
 #include <linux/stddef.h>
 #include <malloc.h>
 #include <search.h>
diff --git a/env/mmc.c b/env/mmc.c
index 251ad07..a8b661d 100644
--- a/env/mmc.c
+++ b/env/mmc.c
@@ -27,7 +27,7 @@
 #if CONFIG_IS_ENABLED(OF_CONTROL)
 static inline int mmc_offset_try_partition(const char *str, s64 *val)
 {
-	disk_partition_t info;
+	struct disk_partition info;
 	struct blk_desc *desc;
 	int len, i, ret;
 
diff --git a/env/sf.c b/env/sf.c
index 64c57f2..23de5a3 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -12,11 +12,14 @@
 #include <dm.h>
 #include <env.h>
 #include <env_internal.h>
+#include <flash.h>
 #include <malloc.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <search.h>
 #include <errno.h>
+#include <uuid.h>
+#include <asm/cache.h>
 #include <dm/device-internal.h>
 #include <u-boot/crc.h>
 
diff --git a/examples/api/demo.c b/examples/api/demo.c
index e752378..d586174 100644
--- a/examples/api/demo.c
+++ b/examples/api/demo.c
@@ -24,7 +24,7 @@
 
 static char buf[BUF_SZ];
 
-int main(int argc, char * const argv[])
+int main(int argc, char *const argv[])
 {
 	int rv = 0, h, i, j, devs_no;
 	struct api_signature *sig = NULL;
diff --git a/examples/api/libgenwrap.c b/examples/api/libgenwrap.c
index 769dcc7..3aa2228 100644
--- a/examples/api/libgenwrap.c
+++ b/examples/api/libgenwrap.c
@@ -10,7 +10,9 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <hang.h>
+#include <linux/delay.h>
 #include <linux/types.h>
 #include <api_public.h>
 
@@ -31,7 +33,7 @@
 	ub_udelay(usec);
 }
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	ub_reset();
 	return 0;
diff --git a/examples/standalone/atmel_df_pow2.c b/examples/standalone/atmel_df_pow2.c
index b7bd243..9c74f49 100644
--- a/examples/standalone/atmel_df_pow2.c
+++ b/examples/standalone/atmel_df_pow2.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <exports.h>
 #include <spi.h>
+#include <linux/delay.h>
 
 #define CMD_ID    0x9f
 #define CMD_STAT  0xd7
@@ -115,7 +116,7 @@
 	}
 }
 
-int atmel_df_pow2(int argc, char * const argv[])
+int atmel_df_pow2(int argc, char *const argv[])
 {
 	/* Print the ABI version */
 	app_startup(argv);
diff --git a/examples/standalone/hello_world.c b/examples/standalone/hello_world.c
index 1f61bb4..263cd9c 100644
--- a/examples/standalone/hello_world.c
+++ b/examples/standalone/hello_world.c
@@ -7,7 +7,7 @@
 #include <common.h>
 #include <exports.h>
 
-int hello_world (int argc, char * const argv[])
+int hello_world(int argc, char *const argv[])
 {
 	int i;
 
diff --git a/examples/standalone/smc91111_eeprom.c b/examples/standalone/smc91111_eeprom.c
index 5ffefc8..bf7e930 100644
--- a/examples/standalone/smc91111_eeprom.c
+++ b/examples/standalone/smc91111_eeprom.c
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <exports.h>
+#include <linux/delay.h>
 #include "../drivers/net/smc91111.h"
 
 #ifndef SMC91111_EEPROM_INIT
@@ -31,7 +32,7 @@
 int read_eeprom_reg (struct eth_device *dev, int reg);
 void print_macaddr (struct eth_device *dev);
 
-int smc91111_eeprom (int argc, char * const argv[])
+int smc91111_eeprom(int argc, char *const argv[])
 {
 	int c, i, j, done, line, reg, value, start, what;
 	char input[50];
@@ -237,7 +238,7 @@
 		CTL_RELOAD, CTL_REG);
 	i = 100;
 	while ((SMC_inw (dev, CTL_REG) & CTL_RELOAD) && --i)
-		udelay (100);
+		udelay(100);
 	if (i == 0) {
 		printf ("Timeout Refreshing EEPROM registers\n");
 	} else {
@@ -318,7 +319,7 @@
 		CTL_RELOAD, CTL_REG);
 	timeout = 100;
 	while ((SMC_inw (dev, CTL_REG) & CTL_RELOAD) && --timeout)
-		udelay (100);
+		udelay(100);
 	if (timeout == 0) {
 		printf ("Timeout Reading EEPROM register %02x\n", reg);
 		return 0;
@@ -341,7 +342,7 @@
 		CTL_STORE, CTL_REG);
 	timeout = 100;
 	while ((SMC_inw (dev, CTL_REG) & CTL_STORE) && --timeout)
-		udelay (100);
+		udelay(100);
 	if (timeout == 0) {
 		printf ("Timeout Writing EEPROM register %02x\n", reg);
 		return 0;
diff --git a/examples/standalone/smc911x_eeprom.c b/examples/standalone/smc911x_eeprom.c
index 270588b..9bd9a6e 100644
--- a/examples/standalone/smc911x_eeprom.c
+++ b/examples/standalone/smc911x_eeprom.c
@@ -17,6 +17,7 @@
 #include <common.h>
 #include <console.h>
 #include <exports.h>
+#include <net.h>
 #include <linux/ctype.h>
 #include <linux/types.h>
 #include "../drivers/net/smc911x.h"
@@ -465,7 +466,7 @@
 /**
  *	smc911x_eeprom - our application's main() function
  */
-int smc911x_eeprom(int argc, char * const argv[])
+int smc911x_eeprom(int argc, char *const argv[])
 {
 	/* Avoid initializing on stack as gcc likes to call memset() */
 	struct eth_device dev;
diff --git a/examples/standalone/stubs.c b/examples/standalone/stubs.c
index 0827bde..5fb4604 100644
--- a/examples/standalone/stubs.c
+++ b/examples/standalone/stubs.c
@@ -2,6 +2,8 @@
 #include <exports.h>
 #include <linux/compiler.h>
 
+struct cmd_tbl;
+
 #define FO(x) offsetof(struct jt_funcs, x)
 
 #if defined(CONFIG_X86)
diff --git a/fs/btrfs/btrfs.c b/fs/btrfs/btrfs.c
index cb7e182..de16217 100644
--- a/fs/btrfs/btrfs.c
+++ b/fs/btrfs/btrfs.c
@@ -8,6 +8,7 @@
 #include "btrfs.h"
 #include <config.h>
 #include <malloc.h>
+#include <uuid.h>
 #include <linux/time.h>
 
 struct btrfs_info btrfs_info;
@@ -74,7 +75,8 @@
 	return 0;
 }
 
-int btrfs_probe(struct blk_desc *fs_dev_desc, disk_partition_t *fs_partition)
+int btrfs_probe(struct blk_desc *fs_dev_desc,
+		struct disk_partition *fs_partition)
 {
 	btrfs_blk_desc = fs_dev_desc;
 	btrfs_part_info = fs_partition;
diff --git a/fs/btrfs/btrfs.h b/fs/btrfs/btrfs.h
index 986d078..25a8cf6 100644
--- a/fs/btrfs/btrfs.h
+++ b/fs/btrfs/btrfs.h
@@ -36,7 +36,7 @@
 
 /* dev.c */
 extern struct blk_desc *btrfs_blk_desc;
-extern disk_partition_t *btrfs_part_info;
+extern struct disk_partition *btrfs_part_info;
 
 int btrfs_devread(u64, int, void *);
 
diff --git a/fs/btrfs/chunk-map.c b/fs/btrfs/chunk-map.c
index 0c9a659..2e5be65 100644
--- a/fs/btrfs/chunk-map.c
+++ b/fs/btrfs/chunk-map.c
@@ -6,6 +6,7 @@
  */
 
 #include "btrfs.h"
+#include <log.h>
 #include <malloc.h>
 
 struct chunk_map_item {
diff --git a/fs/btrfs/compression.c b/fs/btrfs/compression.c
index b1884fc..59e4a94 100644
--- a/fs/btrfs/compression.c
+++ b/fs/btrfs/compression.c
@@ -6,6 +6,7 @@
  */
 
 #include "btrfs.h"
+#include <log.h>
 #include <malloc.h>
 #include <linux/lzo.h>
 #include <linux/zstd.h>
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 7fae383..28f98d4 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -6,6 +6,7 @@
  */
 
 #include "btrfs.h"
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 
diff --git a/fs/btrfs/dev.c b/fs/btrfs/dev.c
index ada3800..1e5b832 100644
--- a/fs/btrfs/dev.c
+++ b/fs/btrfs/dev.c
@@ -6,11 +6,12 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <compiler.h>
 #include <fs_internal.h>
 
 struct blk_desc *btrfs_blk_desc;
-disk_partition_t *btrfs_part_info;
+struct disk_partition *btrfs_part_info;
 
 int btrfs_devread(u64 address, int byte_len, void *buf)
 {
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index b693a07..913a4d4 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -5,9 +5,12 @@
  * 2017 Marek Behun, CZ.NIC, marek.behun@nic.cz
  */
 
-#include "btrfs.h"
+#include <common.h>
+#include <log.h>
 #include <memalign.h>
+#include <part.h>
 #include <linux/compat.h>
+#include "btrfs.h"
 
 #define BTRFS_SUPER_FLAG_SUPP	(BTRFS_HEADER_FLAG_WRITTEN	\
 				 | BTRFS_HEADER_FLAG_RELOC	\
diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c
index 228f599..7ef48bb 100644
--- a/fs/cramfs/cramfs.c
+++ b/fs/cramfs/cramfs.c
@@ -25,6 +25,7 @@
  */
 
 #include <common.h>
+#include <flash.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
 #include <linux/stat.h>
diff --git a/fs/ext4/dev.c b/fs/ext4/dev.c
index 2907688..168443d 100644
--- a/fs/ext4/dev.c
+++ b/fs/ext4/dev.c
@@ -29,13 +29,14 @@
 #include <ext4fs.h>
 #include <ext_common.h>
 #include "ext4_common.h"
+#include <log.h>
 
 lbaint_t part_offset;
 
 static struct blk_desc *ext4fs_blk_desc;
-static disk_partition_t *part_info;
+static struct disk_partition *part_info;
 
-void ext4fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info)
+void ext4fs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
 {
 	assert(rbdd->blksz == (1 << rbdd->log2blksz));
 	ext4fs_blk_desc = rbdd;
diff --git a/fs/ext4/ext4_common.c b/fs/ext4/ext4_common.c
index 5bf78b5..c52cc40 100644
--- a/fs/ext4/ext4_common.c
+++ b/fs/ext4/ext4_common.c
@@ -19,10 +19,13 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <ext_common.h>
 #include <ext4fs.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <part.h>
 #include <stddef.h>
 #include <linux/stat.h>
 #include <linux/time.h>
diff --git a/fs/ext4/ext4_common.h b/fs/ext4/ext4_common.h
index 4dff191..beaee9c 100644
--- a/fs/ext4/ext4_common.h
+++ b/fs/ext4/ext4_common.h
@@ -23,6 +23,7 @@
 #include <ext_common.h>
 #include <ext4fs.h>
 #include <malloc.h>
+#include <asm/cache.h>
 #include <linux/errno.h>
 #if defined(CONFIG_EXT4_WRITE)
 #include "ext4_journal.h"
diff --git a/fs/ext4/ext4_journal.c b/fs/ext4/ext4_journal.c
index 0ceb73d..1a340b4 100644
--- a/fs/ext4/ext4_journal.c
+++ b/fs/ext4/ext4_journal.c
@@ -14,7 +14,9 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <ext4fs.h>
+#include <log.h>
 #include <malloc.h>
 #include <ext_common.h>
 #include "ext4_common.h"
diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c
index 67aeba1..f22af45 100644
--- a/fs/ext4/ext4_write.c
+++ b/fs/ext4/ext4_write.c
@@ -22,8 +22,11 @@
 
 
 #include <common.h>
+#include <blk.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <part.h>
 #include <linux/stat.h>
 #include <div64.h>
 #include "ext4_common.h"
diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c
index 966b427..4c89152 100644
--- a/fs/ext4/ext4fs.c
+++ b/fs/ext4/ext4fs.c
@@ -21,11 +21,14 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <ext_common.h>
 #include <ext4fs.h>
 #include "ext4_common.h"
 #include <div64.h>
 #include <malloc.h>
+#include <part.h>
+#include <uuid.h>
 
 int ext4fs_symlinknest;
 struct ext_filesystem ext_fs;
@@ -226,7 +229,7 @@
 }
 
 int ext4fs_probe(struct blk_desc *fs_dev_desc,
-		 disk_partition_t *fs_partition)
+		 struct disk_partition *fs_partition)
 {
 	ext4fs_set_blk_dev(fs_dev_desc, fs_partition);
 
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index 68ce658..7fd2947 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -14,10 +14,12 @@
 #include <exports.h>
 #include <fat.h>
 #include <fs.h>
+#include <log.h>
 #include <asm/byteorder.h>
 #include <part.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <asm/cache.h>
 #include <linux/compiler.h>
 #include <linux/ctype.h>
 
@@ -35,7 +37,7 @@
 }
 
 static struct blk_desc *cur_dev;
-static disk_partition_t cur_part_info;
+static struct disk_partition cur_part_info;
 
 #define DOS_BOOT_MAGIC_OFFSET	0x1fe
 #define DOS_FS_TYPE_OFFSET	0x36
@@ -56,7 +58,7 @@
 	return ret;
 }
 
-int fat_set_blk_dev(struct blk_desc *dev_desc, disk_partition_t *info)
+int fat_set_blk_dev(struct blk_desc *dev_desc, struct disk_partition *info)
 {
 	ALLOC_CACHE_ALIGN_BUFFER(unsigned char, buffer, dev_desc->blksz);
 
@@ -87,7 +89,7 @@
 
 int fat_register_device(struct blk_desc *dev_desc, int part_no)
 {
-	disk_partition_t info;
+	struct disk_partition info;
 
 	/* First close any currently found FAT filesystem */
 	cur_dev = NULL;
diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c
index 4f96699..59cc0ba 100644
--- a/fs/fat/fat_write.c
+++ b/fs/fat/fat_write.c
@@ -9,9 +9,11 @@
 #include <command.h>
 #include <config.h>
 #include <fat.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/byteorder.h>
 #include <part.h>
+#include <asm/cache.h>
 #include <linux/ctype.h>
 #include <div64.h>
 #include <linux/math64.h>
diff --git a/fs/fs.c b/fs/fs.c
index 0c66d60..ad4caae 100644
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -3,10 +3,13 @@
  * Copyright (c) 2012, NVIDIA CORPORATION.  All rights reserved.
  */
 
+#include <command.h>
 #include <config.h>
 #include <errno.h>
 #include <common.h>
 #include <env.h>
+#include <lmb.h>
+#include <log.h>
 #include <mapmem.h>
 #include <part.h>
 #include <ext4fs.h>
@@ -24,11 +27,11 @@
 
 static struct blk_desc *fs_dev_desc;
 static int fs_dev_part;
-static disk_partition_t fs_partition;
+static struct disk_partition fs_partition;
 static int fs_type = FS_TYPE_ANY;
 
 static inline int fs_probe_unsupported(struct blk_desc *fs_dev_desc,
-				      disk_partition_t *fs_partition)
+				      struct disk_partition *fs_partition)
 {
 	printf("** Unrecognized filesystem type **\n");
 	return -1;
@@ -135,7 +138,7 @@
 	 */
 	bool null_dev_desc_ok;
 	int (*probe)(struct blk_desc *fs_dev_desc,
-		     disk_partition_t *fs_partition);
+		     struct disk_partition *fs_partition);
 	int (*ls)(const char *dirname);
 	int (*exists)(const char *filename);
 	int (*size)(const char *filename, loff_t *size);
@@ -643,8 +646,8 @@
 	return ret;
 }
 
-int do_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype)
+int do_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	    int fstype)
 {
 	loff_t size;
 
@@ -662,8 +665,8 @@
 	return 0;
 }
 
-int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype)
+int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	    int fstype)
 {
 	unsigned long addr;
 	const char *addr_str;
@@ -736,8 +739,8 @@
 	return 0;
 }
 
-int do_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-	int fstype)
+int do_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	  int fstype)
 {
 	if (argc < 2)
 		return CMD_RET_USAGE;
@@ -762,8 +765,8 @@
 	return fs_exists(file);
 }
 
-int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype)
+int do_save(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	    int fstype)
 {
 	unsigned long addr;
 	const char *filename;
@@ -804,8 +807,8 @@
 	return 0;
 }
 
-int do_fs_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype)
+int do_fs_uuid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	       int fstype)
 {
 	int ret;
 	char uuid[37];
@@ -829,7 +832,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-int do_fs_type(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_fs_type(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct fstype_info *info;
 
@@ -851,7 +854,7 @@
 	return CMD_RET_SUCCESS;
 }
 
-int do_rm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+int do_rm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
 	  int fstype)
 {
 	if (argc != 4)
@@ -866,7 +869,7 @@
 	return 0;
 }
 
-int do_mkdir(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+int do_mkdir(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
 	     int fstype)
 {
 	int ret;
@@ -886,7 +889,7 @@
 	return 0;
 }
 
-int do_ln(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+int do_ln(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
 	  int fstype)
 {
 	if (argc != 5)
diff --git a/fs/fs_internal.c b/fs/fs_internal.c
index d369c43..8b19811 100644
--- a/fs/fs_internal.c
+++ b/fs/fs_internal.c
@@ -6,11 +6,13 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <compiler.h>
+#include <log.h>
 #include <part.h>
 #include <memalign.h>
 
-int fs_devread(struct blk_desc *blk, disk_partition_t *partition,
+int fs_devread(struct blk_desc *blk, struct disk_partition *partition,
 	       lbaint_t sector, int byte_offset, int byte_len, char *buf)
 {
 	unsigned block_len;
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 1115c86..a98745c 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -113,6 +113,7 @@
 
 #include <common.h>
 #include <config.h>
+#include <flash.h>
 #include <malloc.h>
 #include <div64.h>
 #include <linux/compiler.h>
diff --git a/fs/reiserfs/dev.c b/fs/reiserfs/dev.c
index c6b6779..5d9c264 100644
--- a/fs/reiserfs/dev.c
+++ b/fs/reiserfs/dev.c
@@ -12,10 +12,10 @@
 #include "reiserfs_private.h"
 
 static struct blk_desc *reiserfs_blk_desc;
-static disk_partition_t *part_info;
+static struct disk_partition *part_info;
 
 
-void reiserfs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info)
+void reiserfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
 {
 	reiserfs_blk_desc = rbdd;
 	part_info = info;
diff --git a/fs/sandbox/sandboxfs.c b/fs/sandbox/sandboxfs.c
index af47224..4ae41d5 100644
--- a/fs/sandbox/sandboxfs.c
+++ b/fs/sandbox/sandboxfs.c
@@ -7,8 +7,9 @@
 #include <fs.h>
 #include <malloc.h>
 #include <os.h>
+#include <sandboxfs.h>
 
-int sandbox_fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info)
+int sandbox_fs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
 {
 	/*
 	 * Only accept a NULL struct blk_desc for the sandbox, which is when
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index 9eb5d3f..514f15f 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -20,6 +20,7 @@
 
 #include "ubifs.h"
 #ifndef __UBOOT__
+#include <log.h>
 #include <linux/writeback.h>
 #else
 #include <linux/err.h>
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c
index 6835f86..2ff8f1a 100644
--- a/fs/ubifs/debug.c
+++ b/fs/ubifs/debug.c
@@ -16,6 +16,7 @@
  */
 
 #include <hexdump.h>
+#include <log.h>
 #include <dm/devres.h>
 
 #ifndef __UBOOT__
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index f923d07..6a4ada6 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -41,6 +41,7 @@
  * good, and GC takes extra care when moving them.
  */
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/slab.h>
 #include <linux/pagemap.h>
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 8148055..eb14b89 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -59,6 +59,8 @@
  */
 
 #ifndef __UBOOT__
+#include <init.h>
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc32.h>
 #include <linux/slab.h>
diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c
index 5cbb8aa..77ff525 100644
--- a/fs/ubifs/log.c
+++ b/fs/ubifs/log.c
@@ -16,6 +16,7 @@
  */
 
 #ifdef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/err.h>
 #endif
diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c
index a7c45dd..a9e22ab 100644
--- a/fs/ubifs/lprops.c
+++ b/fs/ubifs/lprops.c
@@ -17,6 +17,7 @@
  */
 
 #ifdef __UBOOT__
+#include <log.h>
 #include <malloc.h>
 #include <linux/err.h>
 #endif
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c
index ebfb1d4..62748b0 100644
--- a/fs/ubifs/lpt.c
+++ b/fs/ubifs/lpt.c
@@ -33,6 +33,7 @@
 
 #include "ubifs.h"
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc16.h>
 #include <linux/math64.h>
diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c
index aa5956c..897d001 100644
--- a/fs/ubifs/lpt_commit.c
+++ b/fs/ubifs/lpt_commit.c
@@ -14,11 +14,13 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc16.h>
 #include <linux/slab.h>
 #include <linux/random.h>
 #else
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/err.h>
 #include "crc16.h"
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index 2740aae..055c654 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -12,6 +12,7 @@
 
 #include "ubifs.h"
 #ifdef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/compat.h>
 #include <linux/err.h>
diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c
index a67b3ee..6aa2890 100644
--- a/fs/ubifs/orphan.c
+++ b/fs/ubifs/orphan.c
@@ -7,6 +7,7 @@
  * Author: Adrian Hunter
  */
 
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/err.h>
 #include "ubifs.h"
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 3388efe..6b6884f 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -36,6 +36,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc32.h>
 #include <linux/slab.h>
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c
index 3a9fa41..aa7f281e 100644
--- a/fs/ubifs/replay.c
+++ b/fs/ubifs/replay.c
@@ -21,6 +21,7 @@
  */
 
 #ifdef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/compat.h>
 #include <linux/err.h>
diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
index 599e1a3..1d49285 100644
--- a/fs/ubifs/sb.c
+++ b/fs/ubifs/sb.c
@@ -16,6 +16,7 @@
 
 #include "ubifs.h"
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/slab.h>
 #include <linux/random.h>
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c
index 876a6ee..7a6e46d 100644
--- a/fs/ubifs/scan.c
+++ b/fs/ubifs/scan.c
@@ -17,6 +17,7 @@
 
 #ifdef __UBOOT__
 #include <hexdump.h>
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/err.h>
 #endif
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index b385136..e3a4c0b 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -15,6 +15,7 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/init.h>
 #include <linux/slab.h>
@@ -31,12 +32,14 @@
 #include <common.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <linux/bitops.h>
 #include <linux/bug.h>
 #include <linux/log2.h>
 #include <linux/stat.h>
 #include <linux/err.h>
 #include "ubifs.h"
 #include <ubi_uboot.h>
+#include <linux/stringify.h>
 #include <mtd/ubi-user.h>
 
 struct dentry;
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index fc6fdaf..e8b8f16 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -19,11 +19,14 @@
  */
 
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/crc32.h>
 #include <linux/slab.h>
 #include <u-boot/crc.h>
 #else
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <linux/err.h>
 #include <linux/stat.h>
diff --git a/fs/ubifs/tnc_misc.c b/fs/ubifs/tnc_misc.c
index dfa9e91..e4cd785 100644
--- a/fs/ubifs/tnc_misc.c
+++ b/fs/ubifs/tnc_misc.c
@@ -16,6 +16,7 @@
  */
 
 #ifdef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/err.h>
 #endif
diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c
index e097d28..70beb84 100644
--- a/fs/ubifs/ubifs.c
+++ b/fs/ubifs/ubifs.c
@@ -14,9 +14,11 @@
 #include <common.h>
 #include <env.h>
 #include <gzip.h>
+#include <log.h>
 #include <malloc.h>
 #include <memalign.h>
 #include "ubifs.h"
+#include <part.h>
 #include <dm/devres.h>
 #include <u-boot/zlib.h>
 
@@ -549,7 +551,7 @@
 	return 0;
 }
 
-int ubifs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info)
+int ubifs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
 {
 	if (rbdd) {
 		debug("UBIFS cannot be used with normal block devices\n");
diff --git a/fs/yaffs2/yaffs_mtdif2.c b/fs/yaffs2/yaffs_mtdif2.c
index 0d9d5cc..81a4d96 100644
--- a/fs/yaffs2/yaffs_mtdif2.c
+++ b/fs/yaffs2/yaffs_mtdif2.c
@@ -15,6 +15,7 @@
 
 /* XXX U-BOOT XXX */
 #include <common.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 
 #include "yportenv.h"
diff --git a/fs/yaffs2/yportenv.h b/fs/yaffs2/yportenv.h
index 251eba0..081391a 100644
--- a/fs/yaffs2/yportenv.h
+++ b/fs/yaffs2/yportenv.h
@@ -17,6 +17,7 @@
 #ifndef __YPORTENV_H__
 #define __YPORTENV_H__
 
+#include <linux/bug.h>
 #include <linux/types.h>
 
 /* Definition of types */
diff --git a/fs/zfs/dev.c b/fs/zfs/dev.c
index 3cdb9e0..251e7d1 100644
--- a/fs/zfs/dev.c
+++ b/fs/zfs/dev.c
@@ -14,9 +14,9 @@
 #include <zfs_common.h>
 
 static struct blk_desc *zfs_blk_desc;
-static disk_partition_t *part_info;
+static struct disk_partition *part_info;
 
-void zfs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info)
+void zfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info)
 {
 	zfs_blk_desc = rbdd;
 	part_info = info;
diff --git a/fs/zfs/zfs.c b/fs/zfs/zfs.c
index 4331c16..1fec96c 100644
--- a/fs/zfs/zfs.c
+++ b/fs/zfs/zfs.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/stat.h>
 #include <linux/time.h>
diff --git a/include/_exports.h b/include/_exports.h
index 0dee05f..1e9ba86 100644
--- a/include/_exports.h
+++ b/include/_exports.h
@@ -29,7 +29,7 @@
 	EXPORT_FUNC(udelay, void, udelay, unsigned long)
 	EXPORT_FUNC(get_timer, unsigned long, get_timer, unsigned long)
 	EXPORT_FUNC(vprintf, int, vprintf, const char *, va_list)
-	EXPORT_FUNC(do_reset, int, do_reset, cmd_tbl_t *,
+	EXPORT_FUNC(do_reset, int, do_reset, struct cmd_tbl *,
 		    int , int , char * const [])
 	EXPORT_FUNC(env_get, char  *, env_get, const char*)
 	EXPORT_FUNC(env_set, int, env_set, const char *, const char *)
diff --git a/include/acpi/acpi_table.h b/include/acpi/acpi_table.h
index 3681c5c..fe9b29f 100644
--- a/include/acpi/acpi_table.h
+++ b/include/acpi/acpi_table.h
@@ -13,6 +13,8 @@
 #ifndef __ACPI_TABLE_H__
 #define __ACPI_TABLE_H__
 
+#include <linux/bitops.h>
+
 #define RSDP_SIG		"RSD PTR "	/* RSDP pointer signature */
 #define OEM_ID			"U-BOOT"	/* U-Boot */
 #define OEM_TABLE_ID		"U-BOOTBL"	/* U-Boot Table */
diff --git a/include/android_ab.h b/include/android_ab.h
index 810906d..0941eb6 100644
--- a/include/android_ab.h
+++ b/include/android_ab.h
@@ -6,7 +6,8 @@
 #ifndef __ANDROID_AB_H
 #define __ANDROID_AB_H
 
-#include <common.h>
+struct blk_desc;
+struct disk_partition;
 
 /* Android standard boot slot names are 'a', 'b', 'c', ... */
 #define BOOT_SLOT_NAME(slot_num) ('a' + (slot_num))
@@ -29,6 +30,6 @@
  * @param[in] part_info Place to store the partition information
  * @return The slot number (>= 0) on success, or a negative on error
  */
-int ab_select_slot(struct blk_desc *dev_desc, disk_partition_t *part_info);
+int ab_select_slot(struct blk_desc *dev_desc, struct disk_partition *part_info);
 
 #endif /* __ANDROID_AB_H */
diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h
index 859f41a..e16c2f3 100644
--- a/include/asm-generic/gpio.h
+++ b/include/asm-generic/gpio.h
@@ -8,6 +8,7 @@
 #define _ASM_GENERIC_GPIO_H_
 
 #include <dm/ofnode.h>
+#include <linux/bitops.h>
 
 struct ofnode_phandle_args;
 
diff --git a/include/asm-generic/u-boot.h b/include/asm-generic/u-boot.h
index cc94d39..6f74973 100644
--- a/include/asm-generic/u-boot.h
+++ b/include/asm-generic/u-boot.h
@@ -23,6 +23,7 @@
 
 #ifndef __ASSEMBLY__
 
+#include <asm/types.h>
 #include <linux/types.h>
 
 typedef struct bd_info {
diff --git a/include/atf_common.h b/include/atf_common.h
index 3a7d40e..fd5454c 100644
--- a/include/atf_common.h
+++ b/include/atf_common.h
@@ -177,6 +177,6 @@
 	struct entry_point_info bl31_ep_info;
 };
 
-#endif /*__ASSEMBLY__*/
+#endif /*__ASSEMBLY__ */
 
 #endif /* __BL_COMMON_H__ */
diff --git a/include/avb_verify.h b/include/avb_verify.h
index 18278f8..a8d7090 100644
--- a/include/avb_verify.h
+++ b/include/avb_verify.h
@@ -38,7 +38,7 @@
 	int dev_num;
 	struct mmc *mmc;
 	struct blk_desc *mmc_blk;
-	disk_partition_t info;
+	struct disk_partition info;
 };
 
 enum mmc_io_type {
diff --git a/include/bedbug/type.h b/include/bedbug/type.h
index 3754c7f..f7a719c 100644
--- a/include/bedbug/type.h
+++ b/include/bedbug/type.h
@@ -1,6 +1,8 @@
 #ifndef _TYPE_BEDBUG_H
 #define _TYPE_BEDBUG_H
 
+struct cmd_tbl;
+
 /* Supporting routines */
 int bedbug_puts (const char *);
 int bedbug_init(void);
@@ -15,7 +17,8 @@
 	int current_bp;
 	struct pt_regs *regs;
 
-	void (*do_break) (cmd_tbl_t *, int, int, char * const []);
+	void (*do_break)(struct cmd_tbl *cmd, int flags, int argc,
+			 char *const argv[]);
 	void (*break_isr) (struct pt_regs *);
 	int (*find_empty) (void);
 	int (*set) (int, unsigned long);
diff --git a/include/bitfield.h b/include/bitfield.h
index 579a69c..d3ceeed 100644
--- a/include/bitfield.h
+++ b/include/bitfield.h
@@ -36,6 +36,7 @@
  * tables which describe all bitfields in all registers.
  */
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 
 /* Produces a mask of set bits covering a range of a uint value */
diff --git a/include/blk.h b/include/blk.h
index 6f541bb..abcd4be 100644
--- a/include/blk.h
+++ b/include/blk.h
@@ -679,7 +679,7 @@
  * @cur_devnump: Current device number for this interface type
  * @return 0 if OK, CMD_RET_ERROR on error
  */
-int blk_common_cmd(int argc, char * const argv[], enum if_type if_type,
+int blk_common_cmd(int argc, char *const argv[], enum if_type if_type,
 		   int *cur_devnump);
 
 #endif
diff --git a/include/bootm.h b/include/bootm.h
index edeeacb..1e7f29e 100644
--- a/include/bootm.h
+++ b/include/bootm.h
@@ -7,9 +7,10 @@
 #ifndef _BOOTM_H
 #define _BOOTM_H
 
-#include <command.h>
 #include <image.h>
 
+struct cmd_tbl;
+
 #define BOOTM_ERR_RESET		(-1)
 #define BOOTM_ERR_OVERLAP		(-2)
 #define BOOTM_ERR_UNIMPLEMENTED	(-3)
@@ -31,13 +32,13 @@
  * @return 1 on error. On success the OS boots so this function does
  * not return.
  */
-typedef int boot_os_fn(int flag, int argc, char * const argv[],
+typedef int boot_os_fn(int flag, int argc, char *const argv[],
 			bootm_headers_t *images);
 
 extern boot_os_fn do_bootm_linux;
 extern boot_os_fn do_bootm_vxworks;
 
-int do_bootelf(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_bootelf(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 void lynxkdi_boot(image_header_t *hdr);
 
 boot_os_fn *bootm_os_get_boot_func(int os);
@@ -46,16 +47,17 @@
 int bootm_host_load_images(const void *fit, int cfg_noffset);
 #endif
 
-int boot_selected_os(int argc, char * const argv[], int state,
+int boot_selected_os(int argc, char *const argv[], int state,
 		     bootm_headers_t *images, boot_os_fn *boot_fn);
 
 ulong bootm_disable_interrupts(void);
 
 /* This is a special function used by booti/bootz */
-int bootm_find_images(int flag, int argc, char * const argv[]);
+int bootm_find_images(int flag, int argc, char *const argv[]);
 
-int do_bootm_states(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		    int states, bootm_headers_t *images, int boot_progress);
+int do_bootm_states(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[], int states, bootm_headers_t *images,
+		    int boot_progress);
 
 void arch_preboot_os(void);
 
diff --git a/include/bootstage.h b/include/bootstage.h
index 82f0307..f507271 100644
--- a/include/bootstage.h
+++ b/include/bootstage.h
@@ -199,11 +199,11 @@
 	BOOTSTAGE_ID_ACCUM_DECOMP,
 	BOOTSTAGE_ID_ACCUM_OF_LIVE,
 	BOOTSTAGE_ID_FPGA_INIT,
-	BOOTSTATE_ID_ACCUM_DM_SPL,
-	BOOTSTATE_ID_ACCUM_DM_F,
-	BOOTSTATE_ID_ACCUM_DM_R,
-	BOOTSTATE_ID_ACCUM_FSP_M,
-	BOOTSTATE_ID_ACCUM_FSP_S,
+	BOOTSTAGE_ID_ACCUM_DM_SPL,
+	BOOTSTAGE_ID_ACCUM_DM_F,
+	BOOTSTAGE_ID_ACCUM_DM_R,
+	BOOTSTAGE_ID_ACCUM_FSP_M,
+	BOOTSTAGE_ID_ACCUM_FSP_S,
 	BOOTSTAGE_ID_ACCUM_MMAP_SPI,
 
 	/* a few spare for the user, from here */
diff --git a/include/btrfs.h b/include/btrfs.h
index 5be61e3..a7605e1 100644
--- a/include/btrfs.h
+++ b/include/btrfs.h
@@ -8,7 +8,11 @@
 #ifndef __U_BOOT_BTRFS_H__
 #define __U_BOOT_BTRFS_H__
 
-int btrfs_probe(struct blk_desc *, disk_partition_t *);
+struct blk_desc;
+struct disk_partition;
+
+int btrfs_probe(struct blk_desc *fs_dev_desc,
+		struct disk_partition *fs_partition);
 int btrfs_ls(const char *);
 int btrfs_exists(const char *);
 int btrfs_size(const char *, loff_t *);
diff --git a/include/command.h b/include/command.h
index d106377..b9b5ec1 100644
--- a/include/command.h
+++ b/include/command.h
@@ -27,7 +27,7 @@
  * Monitor Command Table
  */
 
-struct cmd_tbl_s {
+struct cmd_tbl {
 	char		*name;		/* Command Name			*/
 	int		maxargs;	/* maximum number of arguments	*/
 					/*
@@ -38,54 +38,57 @@
 					 * repeatable property different for
 					 * the main command and sub-commands.
 					 */
-	int		(*cmd_rep)(struct cmd_tbl_s *cmd, int flags, int argc,
-				   char * const argv[], int *repeatable);
+	int		(*cmd_rep)(struct cmd_tbl *cmd, int flags, int argc,
+				   char *const argv[], int *repeatable);
 					/* Implementation function	*/
-	int		(*cmd)(struct cmd_tbl_s *, int, int, char * const []);
+	int		(*cmd)(struct cmd_tbl *cmd, int flags, int argc,
+			       char *const argv[]);
 	char		*usage;		/* Usage message	(short)	*/
 #ifdef	CONFIG_SYS_LONGHELP
 	char		*help;		/* Help  message	(long)	*/
 #endif
 #ifdef CONFIG_AUTO_COMPLETE
 	/* do auto completion on the arguments */
-	int		(*complete)(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]);
+	int		(*complete)(int argc, char *const argv[],
+				    char last_char, int maxv, char *cmdv[]);
 #endif
 };
 
-typedef struct cmd_tbl_s	cmd_tbl_t;
-
-
 #if defined(CONFIG_CMD_RUN)
-extern int do_run(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_run(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[]);
 #endif
 
 /* common/command.c */
-int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
-	      flag, int argc, char * const argv[]);
-cmd_tbl_t *find_cmd(const char *cmd);
-cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len);
-int complete_subcmdv(cmd_tbl_t *cmdtp, int count, int argc,
-		     char * const argv[], char last_char, int maxv,
+int _do_help(struct cmd_tbl *cmd_start, int cmd_items, struct cmd_tbl *cmdtp,
+	     int flag, int argc, char *const argv[]);
+struct cmd_tbl *find_cmd(const char *cmd);
+struct cmd_tbl *find_cmd_tbl(const char *cmd, struct cmd_tbl *table,
+			     int table_len);
+int complete_subcmdv(struct cmd_tbl *cmdtp, int count, int argc,
+		     char *const argv[], char last_char, int maxv,
 		     char *cmdv[]);
 
-extern int cmd_usage(const cmd_tbl_t *cmdtp);
+extern int cmd_usage(const struct cmd_tbl *cmdtp);
 
 /* Dummy ->cmd and ->cmd_rep wrappers. */
-int cmd_always_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[], int *repeatable);
-int cmd_never_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
-			 char * const argv[], int *repeatable);
-int cmd_discard_repeatable(cmd_tbl_t *cmdtp, int flag, int argc,
-			   char * const argv[]);
+int cmd_always_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[], int *repeatable);
+int cmd_never_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
+			 char *const argv[], int *repeatable);
+int cmd_discard_repeatable(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[]);
 
-static inline bool cmd_is_repeatable(cmd_tbl_t *cmdtp)
+static inline bool cmd_is_repeatable(struct cmd_tbl *cmdtp)
 {
 	return cmdtp->cmd_rep == cmd_always_repeatable;
 }
 
 #ifdef CONFIG_AUTO_COMPLETE
-extern int var_complete(int argc, char * const argv[], char last_char, int maxv, char *cmdv[]);
-extern int cmd_auto_complete(const char *const prompt, char *buf, int *np, int *colp);
+extern int var_complete(int argc, char *const argv[], char last_char, int maxv,
+			char *cmdv[]);
+extern int cmd_auto_complete(const char *const prompt, char *buf, int *np,
+			     int *colp);
 #endif
 
 /**
@@ -97,14 +100,15 @@
  *	   1 (CMD_RET_FAILURE) if an error is found
  *	   -1 (CMD_RET_USAGE) if 'usage' error is found
  */
-int cmd_process_error(cmd_tbl_t *cmdtp, int err);
+int cmd_process_error(struct cmd_tbl *cmdtp, int err);
 
 /*
  * Monitor Command
  *
  * All commands use a common argument format:
  *
- * void function (cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+ * void function(struct cmd_tbl *cmdtp, int flag, int argc,
+ *		 char *const argv[]);
  */
 
 #if defined(CONFIG_CMD_MEMORY) || \
@@ -117,36 +121,42 @@
 #endif
 
 #ifdef CONFIG_CMD_BOOTD
-extern int do_bootd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_bootd(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[]);
 #endif
 #ifdef CONFIG_CMD_BOOTM
-extern int do_bootm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-extern int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd);
+extern int do_bootm(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[]);
+extern int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd);
 #else
-static inline int bootm_maybe_autostart(cmd_tbl_t *cmdtp, const char *cmd)
+static inline int bootm_maybe_autostart(struct cmd_tbl *cmdtp, const char *cmd)
 {
 	return 0;
 }
 #endif
 
-extern int do_bootz(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_bootz(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[]);
 
-extern int do_booti(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_booti(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[]);
 
-extern int common_diskboot(cmd_tbl_t *cmdtp, const char *intf, int argc,
+extern int common_diskboot(struct cmd_tbl *cmdtp, const char *intf, int argc,
 			   char *const argv[]);
 
-extern int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-extern int do_poweroff(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+extern int do_reset(struct cmd_tbl *cmdtp, int flag, int argc,
+		    char *const argv[]);
+extern int do_poweroff(struct cmd_tbl *cmdtp, int flag, int argc,
+		       char *const argv[]);
 
 extern unsigned long do_go_exec(ulong (*entry)(int, char * const []), int argc,
-				char * const argv[]);
+				char *const argv[]);
 
 #if defined(CONFIG_CMD_NVEDIT_EFI)
-extern int do_env_print_efi(cmd_tbl_t *cmdtp, int flag, int argc,
-			    char * const argv[]);
-extern int do_env_set_efi(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[]);
+extern int do_env_print_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+			    char *const argv[]);
+extern int do_env_set_efi(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[]);
 #endif
 
 /*
@@ -177,10 +187,10 @@
  *			number of ticks the command took to complete.
  * @return 0 if the command succeeded, 1 if it failed
  */
-int cmd_process(int flag, int argc, char * const argv[],
-			       int *repeatable, unsigned long *ticks);
+int cmd_process(int flag, int argc, char *const argv[], int *repeatable,
+		unsigned long *ticks);
 
-void fixup_cmdtable(cmd_tbl_t *cmdtp, int size);
+void fixup_cmdtable(struct cmd_tbl *cmdtp, int size);
 
 /**
  * board_run_command() - Fallback function to execute a command
@@ -254,10 +264,11 @@
 #endif
 
 #define U_BOOT_SUBCMDS_DO_CMD(_cmdname)					\
-	static int do_##_cmdname(cmd_tbl_t *cmdtp, int flag, int argc,	\
-				 char * const argv[], int *repeatable)	\
+	static int do_##_cmdname(struct cmd_tbl *cmdtp, int flag,	\
+				 int argc, char *const argv[],		\
+				 int *repeatable)			\
 	{								\
-		cmd_tbl_t *subcmd;					\
+		struct cmd_tbl *subcmd;					\
 									\
 		_cmdname##_subcmds_reloc();				\
 									\
@@ -280,7 +291,7 @@
 
 #ifdef CONFIG_AUTO_COMPLETE
 #define U_BOOT_SUBCMDS_COMPLETE(_cmdname)				\
-	static int complete_##_cmdname(int argc, char * const argv[],	\
+	static int complete_##_cmdname(int argc, char *const argv[],	\
 				       char last_char, int maxv,	\
 				       char *cmdv[])			\
 	{								\
@@ -294,7 +305,7 @@
 #endif
 
 #define U_BOOT_SUBCMDS(_cmdname, ...)					\
-	static cmd_tbl_t _cmdname##_subcmds[] = { __VA_ARGS__ };	\
+	static struct cmd_tbl _cmdname##_subcmds[] = { __VA_ARGS__ };	\
 	U_BOOT_SUBCMDS_RELOC(_cmdname)					\
 	U_BOOT_SUBCMDS_DO_CMD(_cmdname)					\
 	U_BOOT_SUBCMDS_COMPLETE(_cmdname)
@@ -312,18 +323,18 @@
 		 _cmd, _usage, _CMD_HELP(_help) _CMD_COMPLETE(_comp) }
 
 #define U_BOOT_CMD_COMPLETE(_name, _maxargs, _rep, _cmd, _usage, _help, _comp) \
-	ll_entry_declare(cmd_tbl_t, _name, cmd) =			\
+	ll_entry_declare(struct cmd_tbl, _name, cmd) =			\
 		U_BOOT_CMD_MKENT_COMPLETE(_name, _maxargs, _rep, _cmd,	\
 						_usage, _help, _comp);
 
 #define U_BOOT_CMDREP_COMPLETE(_name, _maxargs, _cmd_rep, _usage,	\
 			       _help, _comp)				\
-	ll_entry_declare(cmd_tbl_t, _name, cmd) =			\
+	ll_entry_declare(struct cmd_tbl, _name, cmd) =			\
 		U_BOOT_CMDREP_MKENT_COMPLETE(_name, _maxargs, _cmd_rep,	\
 					     _usage, _help, _comp)
 
 #else
-#define U_BOOT_SUBCMD_START(name)	static cmd_tbl_t name[] = {};
+#define U_BOOT_SUBCMD_START(name)	static struct cmd_tbl name[] = {};
 #define U_BOOT_SUBCMD_END
 
 #define _CMD_REMOVE(_name, _cmd)					\
diff --git a/include/common.h b/include/common.h
index 0ef8505..f0679ac 100644
--- a/include/common.h
+++ b/include/common.h
@@ -16,30 +16,16 @@
 #include <config.h>
 #include <errno.h>
 #include <time.h>
-#include <asm-offsets.h>
-#include <linux/bitops.h>
-#include <linux/bug.h>
-#include <linux/delay.h>
 #include <linux/types.h>
 #include <linux/printk.h>
 #include <linux/string.h>
-#include <linux/stringify.h>
-#include <asm/ptrace.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <linux/kernel.h>
-#include <part.h>
-#include <flash.h>
-#include <image.h>
-#include <log.h>
 #include <asm/u-boot.h> /* boot information for Linux kernel */
 #include <asm/global_data.h>	/* global data used for startup functions */
-#include <init.h>
 #include <display_options.h>
-#include <uuid.h>
 #include <vsprintf.h>
-#include <net.h>
-#include <bootstage.h>
 #endif	/* __ASSEMBLY__ */
 
 /* Pull in stuff for the build system */
diff --git a/include/config_fsl_chain_trust.h b/include/config_fsl_chain_trust.h
index 4f522db..3922241 100644
--- a/include/config_fsl_chain_trust.h
+++ b/include/config_fsl_chain_trust.h
@@ -6,6 +6,8 @@
 #ifndef __CONFIG_FSL_CHAIN_TRUST_H
 #define __CONFIG_FSL_CHAIN_TRUST_H
 
+#include <linux/stringify.h>
+
 #ifdef CONFIG_CHAIN_OF_TRUST
 
 #ifndef CONFIG_EXTRA_ENV
diff --git a/include/configs/B4860QDS.h b/include/configs/B4860QDS.h
index 6763945..a515bf9 100644
--- a/include/configs/B4860QDS.h
+++ b/include/configs/B4860QDS.h
@@ -6,6 +6,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * B4860 QDS board configuration file
  */
diff --git a/include/configs/C29XPCIE.h b/include/configs/C29XPCIE.h
index 62ad50b..9a8cba6 100644
--- a/include/configs/C29XPCIE.h
+++ b/include/configs/C29XPCIE.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #ifdef CONFIG_SPIFLASH
 #define CONFIG_RAMBOOT_SPIFLASH
 #define CONFIG_RESET_VECTOR_ADDRESS	0x110bfffc
diff --git a/include/configs/M52277EVB.h b/include/configs/M52277EVB.h
index f110cac..8261f48 100644
--- a/include/configs/M52277EVB.h
+++ b/include/configs/M52277EVB.h
@@ -13,6 +13,8 @@
 #ifndef _M52277EVB_H
 #define _M52277EVB_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  * (easy to change)
diff --git a/include/configs/M5253DEMO.h b/include/configs/M5253DEMO.h
index e79a7e9..69e3fba 100644
--- a/include/configs/M5253DEMO.h
+++ b/include/configs/M5253DEMO.h
@@ -6,6 +6,8 @@
 #ifndef _M5253DEMO_H
 #define _M5253DEMO_H
 
+#include <linux/stringify.h>
+
 #define CONFIG_MCFTMR
 
 #define CONFIG_MCFUART
diff --git a/include/configs/M5373EVB.h b/include/configs/M5373EVB.h
index 6297aea..f94cc02 100644
--- a/include/configs/M5373EVB.h
+++ b/include/configs/M5373EVB.h
@@ -13,6 +13,8 @@
 #ifndef _M5373EVB_H
 #define _M5373EVB_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  * (easy to change)
diff --git a/include/configs/M54418TWR.h b/include/configs/M54418TWR.h
index cdf169f..2866bfd 100644
--- a/include/configs/M54418TWR.h
+++ b/include/configs/M54418TWR.h
@@ -13,6 +13,8 @@
 #ifndef _M54418TWR_H
 #define _M54418TWR_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  * (easy to change)
diff --git a/include/configs/M54451EVB.h b/include/configs/M54451EVB.h
index 8d0b1db..ec42842 100644
--- a/include/configs/M54451EVB.h
+++ b/include/configs/M54451EVB.h
@@ -13,6 +13,8 @@
 #ifndef _M54451EVB_H
 #define _M54451EVB_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  * (easy to change)
diff --git a/include/configs/M54455EVB.h b/include/configs/M54455EVB.h
index 6e43522..291adea 100644
--- a/include/configs/M54455EVB.h
+++ b/include/configs/M54455EVB.h
@@ -13,6 +13,8 @@
 #ifndef _M54455EVB_H
 #define _M54455EVB_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  * (easy to change)
diff --git a/include/configs/MPC8308RDB.h b/include/configs/MPC8308RDB.h
index f55e9a0..788a325 100644
--- a/include/configs/MPC8308RDB.h
+++ b/include/configs/MPC8308RDB.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/MPC8313ERDB_NAND.h b/include/configs/MPC8313ERDB_NAND.h
index 6829853..d8485f6 100644
--- a/include/configs/MPC8313ERDB_NAND.h
+++ b/include/configs/MPC8313ERDB_NAND.h
@@ -9,6 +9,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/MPC8313ERDB_NOR.h b/include/configs/MPC8313ERDB_NOR.h
index 382c39c..029d2f1 100644
--- a/include/configs/MPC8313ERDB_NOR.h
+++ b/include/configs/MPC8313ERDB_NOR.h
@@ -18,6 +18,7 @@
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */
 #endif
 
+#include <linux/stringify.h>
 #define CONFIG_PCI_INDIRECT_BRIDGE
 
 /*
diff --git a/include/configs/MPC8323ERDB.h b/include/configs/MPC8323ERDB.h
index 289cd9a..ff18d10 100644
--- a/include/configs/MPC8323ERDB.h
+++ b/include/configs/MPC8323ERDB.h
@@ -9,6 +9,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/MPC8349ITX.h b/include/configs/MPC8349ITX.h
index 90046fd..dd51763 100644
--- a/include/configs/MPC8349ITX.h
+++ b/include/configs/MPC8349ITX.h
@@ -52,6 +52,7 @@
 #define CONFIG_SYS_USB_HOST	/* use the EHCI USB controller */
 #endif
 
+#include <linux/stringify.h>
 #define CONFIG_RTC_DS1337
 #define CONFIG_SYS_I2C
 
diff --git a/include/configs/MPC837XERDB.h b/include/configs/MPC837XERDB.h
index 21bd9f0..8c2297a 100644
--- a/include/configs/MPC837XERDB.h
+++ b/include/configs/MPC837XERDB.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/MPC8536DS.h b/include/configs/MPC8536DS.h
index fb115e2..340574a 100644
--- a/include/configs/MPC8536DS.h
+++ b/include/configs/MPC8536DS.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifdef CONFIG_SDCARD
diff --git a/include/configs/MPC8544DS.h b/include/configs/MPC8544DS.h
index 2092e3d..c9f193f 100644
--- a/include/configs/MPC8544DS.h
+++ b/include/configs/MPC8544DS.h
@@ -22,6 +22,7 @@
 #define CONFIG_INTERRUPTS		/* enable pci, srio, ddr interrupts */
 
 #ifndef __ASSEMBLY__
+#include <linux/stringify.h>
 extern unsigned long get_board_sys_clk(unsigned long dummy);
 #endif
 #define CONFIG_SYS_CLK_FREQ	get_board_sys_clk(0) /* sysclk for MPC85xx */
diff --git a/include/configs/MPC8548CDS.h b/include/configs/MPC8548CDS.h
index 6e44a07..de2bfd8 100644
--- a/include/configs/MPC8548CDS.h
+++ b/include/configs/MPC8548CDS.h
@@ -27,6 +27,7 @@
 #define CONFIG_FSL_VIA
 
 #ifndef __ASSEMBLY__
+#include <linux/stringify.h>
 extern unsigned long get_clock_freq(void);
 #endif
 #define CONFIG_SYS_CLK_FREQ	get_clock_freq() /* sysclk for MPC85xx */
diff --git a/include/configs/MPC8560ADS.h b/include/configs/MPC8560ADS.h
index 866049f..97d8cc4 100644
--- a/include/configs/MPC8560ADS.h
+++ b/include/configs/MPC8560ADS.h
@@ -17,6 +17,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/delay.h>
+
 /* High Level Configuration Options */
 #define CONFIG_CPM2		1	/* has CPM2 */
 
diff --git a/include/configs/MPC8572DS.h b/include/configs/MPC8572DS.h
index 65da3d7..3243f39 100644
--- a/include/configs/MPC8572DS.h
+++ b/include/configs/MPC8572DS.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifndef CONFIG_RESET_VECTOR_ADDRESS
diff --git a/include/configs/MPC8610HPCD.h b/include/configs/MPC8610HPCD.h
index f3d603c..eb85141 100644
--- a/include/configs/MPC8610HPCD.h
+++ b/include/configs/MPC8610HPCD.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /* High Level Configuration Options */
 #define CONFIG_LINUX_RESET_VEC	0x100	/* Reset vector used by Linux */
 
diff --git a/include/configs/MPC8641HPCN.h b/include/configs/MPC8641HPCN.h
index e97d780..edbeeef 100644
--- a/include/configs/MPC8641HPCN.h
+++ b/include/configs/MPC8641HPCN.h
@@ -15,6 +15,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /* High Level Configuration Options */
 #define CONFIG_LINUX_RESET_VEC	0x100	/* Reset vector used by Linux */
 #define CONFIG_ADDR_MAP		1	/* Use addr map */
diff --git a/include/configs/P1010RDB.h b/include/configs/P1010RDB.h
index f578e0b..8f709a6 100644
--- a/include/configs/P1010RDB.h
+++ b/include/configs/P1010RDB.h
@@ -11,6 +11,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include <asm/config_mpc85xx.h>
 #define CONFIG_NAND_FSL_IFC
 
diff --git a/include/configs/P1022DS.h b/include/configs/P1022DS.h
index e99d509..2b76107 100644
--- a/include/configs/P1022DS.h
+++ b/include/configs/P1022DS.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifdef CONFIG_SDCARD
diff --git a/include/configs/P1023RDB.h b/include/configs/P1023RDB.h
index 2f3831e..6bf3cd5 100644
--- a/include/configs/P1023RDB.h
+++ b/include/configs/P1023RDB.h
@@ -9,6 +9,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #ifndef CONFIG_SYS_MONITOR_BASE
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */
 #endif
diff --git a/include/configs/P2041RDB.h b/include/configs/P2041RDB.h
index 0942777..59404cb 100644
--- a/include/configs/P2041RDB.h
+++ b/include/configs/P2041RDB.h
@@ -56,6 +56,7 @@
 
 #ifndef __ASSEMBLY__
 unsigned long get_board_sys_clk(unsigned long dummy);
+#include <linux/stringify.h>
 #endif
 #define CONFIG_SYS_CLK_FREQ	get_board_sys_clk(0)
 
diff --git a/include/configs/T102xQDS.h b/include/configs/T102xQDS.h
index 5f358c1..53ae961 100644
--- a/include/configs/T102xQDS.h
+++ b/include/configs/T102xQDS.h
@@ -11,6 +11,8 @@
 #ifndef __T1024QDS_H
 #define __T1024QDS_H
 
+#include <linux/stringify.h>
+
 /* High Level Configuration Options */
 #define CONFIG_SYS_BOOK3E_HV		/* Category E.HV supported */
 #define CONFIG_ENABLE_36BIT_PHYS
diff --git a/include/configs/T102xRDB.h b/include/configs/T102xRDB.h
index c96d6e5..f5d9657 100644
--- a/include/configs/T102xRDB.h
+++ b/include/configs/T102xRDB.h
@@ -11,6 +11,8 @@
 #ifndef __T1024RDB_H
 #define __T1024RDB_H
 
+#include <linux/stringify.h>
+
 /* High Level Configuration Options */
 #define CONFIG_SYS_BOOK3E_HV		/* Category E.HV supported */
 #define CONFIG_ENABLE_36BIT_PHYS
diff --git a/include/configs/T1040QDS.h b/include/configs/T1040QDS.h
index ca6ae77..7ad018b 100644
--- a/include/configs/T1040QDS.h
+++ b/include/configs/T1040QDS.h
@@ -24,6 +24,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * T1040 QDS board configuration file
  */
diff --git a/include/configs/T104xRDB.h b/include/configs/T104xRDB.h
index aa7bf7d..4237dfc 100644
--- a/include/configs/T104xRDB.h
+++ b/include/configs/T104xRDB.h
@@ -7,6 +7,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * T104x RDB board configuration file
  */
diff --git a/include/configs/T208xQDS.h b/include/configs/T208xQDS.h
index aed2e87..c54f7f5 100644
--- a/include/configs/T208xQDS.h
+++ b/include/configs/T208xQDS.h
@@ -11,6 +11,8 @@
 #ifndef __T208xQDS_H
 #define __T208xQDS_H
 
+#include <linux/stringify.h>
+
 #define CONFIG_ICS307_REFCLK_HZ 25000000  /* ICS307 ref clk freq */
 #if defined(CONFIG_ARCH_T2080)
 #define CONFIG_FSL_SATA_V2
diff --git a/include/configs/T208xRDB.h b/include/configs/T208xRDB.h
index 619b287..70eafc3 100644
--- a/include/configs/T208xRDB.h
+++ b/include/configs/T208xRDB.h
@@ -11,6 +11,8 @@
 #ifndef __T2080RDB_H
 #define __T2080RDB_H
 
+#include <linux/stringify.h>
+
 #define CONFIG_ICS307_REFCLK_HZ 25000000  /* ICS307 ref clk freq */
 #define CONFIG_FSL_SATA_V2
 
diff --git a/include/configs/T4240QDS.h b/include/configs/T4240QDS.h
index 5f91a52..d92af72 100644
--- a/include/configs/T4240QDS.h
+++ b/include/configs/T4240QDS.h
@@ -9,6 +9,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #define CONFIG_FSL_SATA_V2
 #define CONFIG_PCIE4
 
diff --git a/include/configs/T4240RDB.h b/include/configs/T4240RDB.h
index f051998..fcfd3b0 100644
--- a/include/configs/T4240RDB.h
+++ b/include/configs/T4240RDB.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #define CONFIG_FSL_SATA_V2
 #define CONFIG_PCIE4
 
diff --git a/include/configs/UCP1020.h b/include/configs/UCP1020.h
index 5086077..cfc9567 100644
--- a/include/configs/UCP1020.h
+++ b/include/configs/UCP1020.h
@@ -13,6 +13,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*** Arcturus FirmWare Environment */
 
 #define MAX_SERIAL_SIZE 15
diff --git a/include/configs/apalis_imx6.h b/include/configs/apalis_imx6.h
index 034eb07..6f03058 100644
--- a/include/configs/apalis_imx6.h
+++ b/include/configs/apalis_imx6.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "mx6_common.h"
 
 #undef CONFIG_DISPLAY_BOARDINFO
diff --git a/include/configs/apf27.h b/include/configs/apf27.h
index c26cf89..cecd485 100644
--- a/include/configs/apf27.h
+++ b/include/configs/apf27.h
@@ -9,6 +9,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #define CONFIG_ENV_VERSION	10
 #define CONFIG_BOARD_NAME apf27
 
diff --git a/include/configs/at91sam9263ek.h b/include/configs/at91sam9263ek.h
index 85bfacb..51ecf41 100644
--- a/include/configs/at91sam9263ek.h
+++ b/include/configs/at91sam9263ek.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * SoC must be defined first, before hardware.h is included.
  * In this case SoC is defined in boards.cfg.
@@ -178,6 +180,7 @@
 		 AT91_WDT_MR_WDD(0xfff))
 
 #endif
+#include <linux/stringify.h>
 #endif
 
 /* NAND flash */
diff --git a/include/configs/bcmstb.h b/include/configs/bcmstb.h
index ba5eb7a..e58a951 100644
--- a/include/configs/bcmstb.h
+++ b/include/configs/bcmstb.h
@@ -15,6 +15,7 @@
 
 #ifndef __ASSEMBLY__
 
+#include <linux/stringify.h>
 #include <linux/types.h>
 
 struct bcmstb_boot_parameters {
diff --git a/include/configs/brppt1.h b/include/configs/brppt1.h
index 3019b97..68931c1 100644
--- a/include/configs/brppt1.h
+++ b/include/configs/brppt1.h
@@ -13,6 +13,7 @@
 
 #include <configs/bur_cfg_common.h>
 #include <configs/bur_am335x_common.h>
+#include <linux/stringify.h>
 /* ------------------------------------------------------------------------- */
 /* memory */
 #define CONFIG_SYS_MALLOC_LEN		(5 * 1024 * 1024)
diff --git a/include/configs/brsmarc1.h b/include/configs/brsmarc1.h
index 4bff349..5aa68d1 100644
--- a/include/configs/brsmarc1.h
+++ b/include/configs/brsmarc1.h
@@ -14,6 +14,7 @@
 
 #include <configs/bur_cfg_common.h>
 #include <configs/bur_am335x_common.h>
+#include <linux/stringify.h>
 /* ------------------------------------------------------------------------- */
 #define CONFIG_BOARD_TYPES
 
diff --git a/include/configs/brxre1.h b/include/configs/brxre1.h
index 0066633..9db0113 100644
--- a/include/configs/brxre1.h
+++ b/include/configs/brxre1.h
@@ -13,6 +13,7 @@
 
 #include <configs/bur_cfg_common.h>
 #include <configs/bur_am335x_common.h>
+#include <linux/stringify.h>
 /* ------------------------------------------------------------------------- */
 #if !defined(CONFIG_AM335X_LCD)
 #define CONFIG_AM335X_LCD
diff --git a/include/configs/cgtqmx6eval.h b/include/configs/cgtqmx6eval.h
index bd4456a..fccc9b1 100644
--- a/include/configs/cgtqmx6eval.h
+++ b/include/configs/cgtqmx6eval.h
@@ -12,6 +12,8 @@
 #ifndef __CONFIG_CGTQMX6EVAL_H
 #define __CONFIG_CGTQMX6EVAL_H
 
+#include <linux/stringify.h>
+
 #include "mx6_common.h"
 
 #define CONFIG_MACH_TYPE	4122
diff --git a/include/configs/clearfog.h b/include/configs/clearfog.h
index 53ff830..459e0d9 100644
--- a/include/configs/clearfog.h
+++ b/include/configs/clearfog.h
@@ -6,6 +6,8 @@
 #ifndef _CONFIG_CLEARFOG_H
 #define _CONFIG_CLEARFOG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options (easy to change)
  */
diff --git a/include/configs/colibri-imx8x.h b/include/configs/colibri-imx8x.h
index 03bb170..da9226e 100644
--- a/include/configs/colibri-imx8x.h
+++ b/include/configs/colibri-imx8x.h
@@ -8,6 +8,7 @@
 
 #include <asm/arch/imx-regs.h>
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 
 #define CONFIG_REMAKE_ELF
 
diff --git a/include/configs/colibri_imx6.h b/include/configs/colibri_imx6.h
index 2d649e6..3d248ef 100644
--- a/include/configs/colibri_imx6.h
+++ b/include/configs/colibri_imx6.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "mx6_common.h"
 
 #undef CONFIG_DISPLAY_BOARDINFO
diff --git a/include/configs/controlcenterd.h b/include/configs/controlcenterd.h
index 5fbe773..34d268e 100644
--- a/include/configs/controlcenterd.h
+++ b/include/configs/controlcenterd.h
@@ -26,6 +26,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #ifdef CONFIG_SDCARD
 #define CONFIG_RAMBOOT_SDCARD
 #endif
diff --git a/include/configs/corenet_ds.h b/include/configs/corenet_ds.h
index 091f3c0..a49f905 100644
--- a/include/configs/corenet_ds.h
+++ b/include/configs/corenet_ds.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "../board/freescale/common/ics307_clk.h"
 
 #ifdef CONFIG_RAMBOOT_PBL
diff --git a/include/configs/cyrus.h b/include/configs/cyrus.h
index 9ab92e6..052e601 100644
--- a/include/configs/cyrus.h
+++ b/include/configs/cyrus.h
@@ -6,6 +6,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #if !defined(CONFIG_ARCH_P5020) && !defined(CONFIG_ARCH_P5040)
 #error Must call Cyrus CONFIG with a specific CPU enabled.
 #endif
diff --git a/include/configs/dart_6ul.h b/include/configs/dart_6ul.h
index 15d6884..d933f79 100644
--- a/include/configs/dart_6ul.h
+++ b/include/configs/dart_6ul.h
@@ -7,6 +7,7 @@
 #define __DART_6UL_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include "mx6_common.h"
 
 /* SPL options */
diff --git a/include/configs/el6x_common.h b/include/configs/el6x_common.h
index fe63bca..f7b96e4 100644
--- a/include/configs/el6x_common.h
+++ b/include/configs/el6x_common.h
@@ -8,6 +8,8 @@
 #ifndef __EL6Q_COMMON_CONFIG_H
 #define __EL6Q_COMMON_CONFIG_H
 
+#include <linux/stringify.h>
+
 #define CONFIG_BOARD_NAME		EL6Q
 
 #include "mx6_common.h"
diff --git a/include/configs/exynos-common.h b/include/configs/exynos-common.h
index 5ae2b42..bb34a9e 100644
--- a/include/configs/exynos-common.h
+++ b/include/configs/exynos-common.h
@@ -14,6 +14,7 @@
 
 #include <asm/arch/cpu.h>		/* get chip and board defs */
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
diff --git a/include/configs/gardena-smart-gateway-at91sam.h b/include/configs/gardena-smart-gateway-at91sam.h
index f5ee65c..78d2136 100644
--- a/include/configs/gardena-smart-gateway-at91sam.h
+++ b/include/configs/gardena-smart-gateway-at91sam.h
@@ -9,6 +9,10 @@
 #ifndef __CONFIG_H__
 #define __CONFIG_H__
 
+#ifndef __ASSEMBLY__
+#include <linux/bitops.h>
+#endif
+
 /* ARM asynchronous clock */
 #define CONFIG_SYS_AT91_SLOW_CLOCK	32768
 #define CONFIG_SYS_AT91_MAIN_CLOCK	12000000	/* 12 MHz crystal */
diff --git a/include/configs/helios4.h b/include/configs/helios4.h
index f0ca8e2..671c3d2 100644
--- a/include/configs/helios4.h
+++ b/include/configs/helios4.h
@@ -7,6 +7,7 @@
 #define _CONFIG_HELIOS4_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 
 /*
  * High Level Configuration Options (easy to change)
diff --git a/include/configs/hrcon.h b/include/configs/hrcon.h
index bf1feb8..76c4ee9 100644
--- a/include/configs/hrcon.h
+++ b/include/configs/hrcon.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/ids8313.h b/include/configs/ids8313.h
index 3274ff6..bcd8aee 100644
--- a/include/configs/ids8313.h
+++ b/include/configs/ids8313.h
@@ -11,6 +11,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/imx6-engicam.h b/include/configs/imx6-engicam.h
index 69b7f33..72ae89c 100644
--- a/include/configs/imx6-engicam.h
+++ b/include/configs/imx6-engicam.h
@@ -10,6 +10,7 @@
 #define __IMX6_ENGICAM_CONFIG_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include "mx6_common.h"
 
 /* Size of malloc() pool */
diff --git a/include/configs/imx8mm_evk.h b/include/configs/imx8mm_evk.h
index 5982522..901a1be 100644
--- a/include/configs/imx8mm_evk.h
+++ b/include/configs/imx8mm_evk.h
@@ -7,6 +7,7 @@
 #define __IMX8MM_EVK_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 
 #ifdef CONFIG_SECURE_BOOT
diff --git a/include/configs/imx8mn_evk.h b/include/configs/imx8mn_evk.h
index 395ddf5..a07440c 100644
--- a/include/configs/imx8mn_evk.h
+++ b/include/configs/imx8mn_evk.h
@@ -7,6 +7,7 @@
 #define __IMX8MN_EVK_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 
 #ifdef CONFIG_SECURE_BOOT
diff --git a/include/configs/imx8mp_evk.h b/include/configs/imx8mp_evk.h
index 80e5738..b346154 100644
--- a/include/configs/imx8mp_evk.h
+++ b/include/configs/imx8mp_evk.h
@@ -7,6 +7,7 @@
 #define __IMX8MP_EVK_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 
 #ifdef CONFIG_SECURE_BOOT
diff --git a/include/configs/imx8mq_evk.h b/include/configs/imx8mq_evk.h
index 724d572..632c4ea 100644
--- a/include/configs/imx8mq_evk.h
+++ b/include/configs/imx8mq_evk.h
@@ -7,6 +7,7 @@
 #define __IMX8M_EVK_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 
 #define CONFIG_SPL_MAX_SIZE		(124 * 1024)
diff --git a/include/configs/imx8qm_mek.h b/include/configs/imx8qm_mek.h
index 22d80f1..d7dd3e2 100644
--- a/include/configs/imx8qm_mek.h
+++ b/include/configs/imx8qm_mek.h
@@ -7,6 +7,7 @@
 #define __IMX8QM_MEK_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/include/configs/imx8qm_rom7720.h b/include/configs/imx8qm_rom7720.h
index b59641e..eebb8dc 100644
--- a/include/configs/imx8qm_rom7720.h
+++ b/include/configs/imx8qm_rom7720.h
@@ -7,6 +7,7 @@
 #define __IMX8QM_ROM7720_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 #define CONFIG_REMAKE_ELF
 
@@ -173,4 +174,5 @@
 #define CONFIG_FEC_XCV_TYPE		RGMII
 #define FEC_QUIRK_ENET_MAC
 
+#include <linux/stringify.h>
 #endif /* __IMX8QM_ROM7720_H */
diff --git a/include/configs/imx8qxp_mek.h b/include/configs/imx8qxp_mek.h
index 341e93e..a2046e1 100644
--- a/include/configs/imx8qxp_mek.h
+++ b/include/configs/imx8qxp_mek.h
@@ -7,6 +7,7 @@
 #define __IMX8QXP_MEK_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 
 #ifdef CONFIG_SPL_BUILD
diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h
index e690d8f..e9e3981 100644
--- a/include/configs/km/keymile-common.h
+++ b/include/configs/km/keymile-common.h
@@ -7,6 +7,8 @@
 #ifndef __CONFIG_KEYMILE_H
 #define __CONFIG_KEYMILE_H
 
+#include <linux/stringify.h>
+
 /*
  * Miscellaneous configurable options
  */
diff --git a/include/configs/km/km-mpc83xx.h b/include/configs/km/km-mpc83xx.h
index dfb78c5..451baf8 100644
--- a/include/configs/km/km-mpc83xx.h
+++ b/include/configs/km/km-mpc83xx.h
@@ -1,6 +1,7 @@
 /*
  * Internal Definitions
  */
+#include <linux/stringify.h>
 #define BOOTFLASH_START	0xF0000000
 
 /*
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index fa9d7b5..79edfa7 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -104,6 +104,8 @@
 
 #ifndef __ASSEMBLY__
 #include <asm/arch/gpio.h>
+#include <linux/delay.h>
+#include <linux/stringify.h>
 extern void __set_direction(unsigned pin, int high);
 void set_sda(int state);
 void set_scl(int state);
diff --git a/include/configs/liteboard.h b/include/configs/liteboard.h
index fa7d589..f9a125f 100644
--- a/include/configs/liteboard.h
+++ b/include/configs/liteboard.h
@@ -10,6 +10,7 @@
 
 #include <asm/arch/imx-regs.h>
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include "mx6_common.h"
 
 /* SPL options */
diff --git a/include/configs/mpc8308_p1m.h b/include/configs/mpc8308_p1m.h
index 97578cd..d6b21f1 100644
--- a/include/configs/mpc8308_p1m.h
+++ b/include/configs/mpc8308_p1m.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/mv-common.h b/include/configs/mv-common.h
index e3a00ed..d61c90a 100644
--- a/include/configs/mv-common.h
+++ b/include/configs/mv-common.h
@@ -16,6 +16,8 @@
 #ifndef _MV_COMMON_H
 #define _MV_COMMON_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options (easy to change)
  */
diff --git a/include/configs/mx6_common.h b/include/configs/mx6_common.h
index 07b1e06..0715509 100644
--- a/include/configs/mx6_common.h
+++ b/include/configs/mx6_common.h
@@ -6,6 +6,8 @@
 #ifndef __MX6_COMMON_H
 #define __MX6_COMMON_H
 
+#include <linux/stringify.h>
+
 #if (defined(CONFIG_MX6UL) || defined(CONFIG_MX6ULL))
 #define CONFIG_SC_TIMER_CLK 8000000 /* 8Mhz */
 #define COUNTER_FREQUENCY CONFIG_SC_TIMER_CLK
diff --git a/include/configs/mx6cuboxi.h b/include/configs/mx6cuboxi.h
index e10e768..2ccf44e 100644
--- a/include/configs/mx6cuboxi.h
+++ b/include/configs/mx6cuboxi.h
@@ -7,6 +7,8 @@
 #ifndef __MX6CUBOXI_CONFIG_H
 #define __MX6CUBOXI_CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "mx6_common.h"
 
 #include "imx6_spl.h"
diff --git a/include/configs/mx6sabre_common.h b/include/configs/mx6sabre_common.h
index cb0253c..6cea26a 100644
--- a/include/configs/mx6sabre_common.h
+++ b/include/configs/mx6sabre_common.h
@@ -8,6 +8,8 @@
 #ifndef __MX6QSABRE_COMMON_CONFIG_H
 #define __MX6QSABRE_COMMON_CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "mx6_common.h"
 
 #define CONFIG_IMX_THERMAL
diff --git a/include/configs/mx6sllevk.h b/include/configs/mx6sllevk.h
index 03c0c88..61c637d 100644
--- a/include/configs/mx6sllevk.h
+++ b/include/configs/mx6sllevk.h
@@ -135,4 +135,5 @@
 #define CONFIG_MXC_USB_PORTSC		(PORT_PTS_UTMI | PORT_PTS_PTW)
 #endif
 
+#include <linux/stringify.h>
 #endif				/* __CONFIG_H */
diff --git a/include/configs/mx6sxsabresd.h b/include/configs/mx6sxsabresd.h
index 8633756..3eea9de 100644
--- a/include/configs/mx6sxsabresd.h
+++ b/include/configs/mx6sxsabresd.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #include "mx6_common.h"
 
 #ifdef CONFIG_SPL
diff --git a/include/configs/mx6ul_14x14_evk.h b/include/configs/mx6ul_14x14_evk.h
index 7927779..8466abf 100644
--- a/include/configs/mx6ul_14x14_evk.h
+++ b/include/configs/mx6ul_14x14_evk.h
@@ -9,6 +9,7 @@
 
 #include <asm/arch/imx-regs.h>
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include "mx6_common.h"
 #include <asm/mach-imx/gpio.h>
 
diff --git a/include/configs/mx6ullevk.h b/include/configs/mx6ullevk.h
index 7e3a5c7..9cedb96 100644
--- a/include/configs/mx6ullevk.h
+++ b/include/configs/mx6ullevk.h
@@ -10,6 +10,7 @@
 
 #include <asm/arch/imx-regs.h>
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include "mx6_common.h"
 #include <asm/mach-imx/gpio.h>
 
diff --git a/include/configs/mx7_common.h b/include/configs/mx7_common.h
index b6ded77..cc07e85 100644
--- a/include/configs/mx7_common.h
+++ b/include/configs/mx7_common.h
@@ -9,6 +9,7 @@
 #define __MX7_COMMON_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/mach-imx/gpio.h>
 
diff --git a/include/configs/nitrogen6x.h b/include/configs/nitrogen6x.h
index a5ca5f9..f3081f4 100644
--- a/include/configs/nitrogen6x.h
+++ b/include/configs/nitrogen6x.h
@@ -113,6 +113,7 @@
 	DISTRO_BOOT_DEV_DHCP(func)
 
 #include <config_distro_bootcmd.h>
+#include <linux/stringify.h>
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"console=ttymxc1\0" \
diff --git a/include/configs/p1_p2_rdb_pc.h b/include/configs/p1_p2_rdb_pc.h
index af278de..219e5d2 100644
--- a/include/configs/p1_p2_rdb_pc.h
+++ b/include/configs/p1_p2_rdb_pc.h
@@ -10,6 +10,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #if defined(CONFIG_TARGET_P1020MBG)
 #define CONFIG_BOARDNAME "P1020MBG-PC"
 #define CONFIG_VSC7385_ENET
diff --git a/include/configs/p1_twr.h b/include/configs/p1_twr.h
index e99b41c..d731f9c 100644
--- a/include/configs/p1_twr.h
+++ b/include/configs/p1_twr.h
@@ -9,6 +9,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 #if defined(CONFIG_TWR_P1025)
 #define CONFIG_BOARDNAME "TWR-P1025"
 #define CONFIG_SYS_LBC_LBCR	0x00080000	/* Conversion of LBC addr */
diff --git a/include/configs/pcl063_ull.h b/include/configs/pcl063_ull.h
index 6aa77f1..4ae955d 100644
--- a/include/configs/pcl063_ull.h
+++ b/include/configs/pcl063_ull.h
@@ -10,6 +10,7 @@
 #define __PCL063_ULL_H
 
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 #include "mx6_common.h"
 
 /* SPL options */
diff --git a/include/configs/pcm052.h b/include/configs/pcm052.h
index 0bfaaf7..ba7aad8 100644
--- a/include/configs/pcm052.h
+++ b/include/configs/pcm052.h
@@ -10,6 +10,7 @@
 
 #include <asm/arch/imx-regs.h>
 #include <linux/sizes.h>
+#include <linux/stringify.h>
 
 #define CONFIG_SKIP_LOWLEVEL_INIT
 
diff --git a/include/configs/pico-imx6ul.h b/include/configs/pico-imx6ul.h
index b0e2f6c..8bfada7 100644
--- a/include/configs/pico-imx6ul.h
+++ b/include/configs/pico-imx6ul.h
@@ -111,6 +111,7 @@
 	func(DHCP, dhcp, na)
 
 #include <config_distro_bootcmd.h>
+#include <linux/stringify.h>
 
 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
 #define CONFIG_SYS_HZ			1000
diff --git a/include/configs/pico-imx7d.h b/include/configs/pico-imx7d.h
index 9a987f4..3ca3ec6 100644
--- a/include/configs/pico-imx7d.h
+++ b/include/configs/pico-imx7d.h
@@ -108,6 +108,7 @@
 	func(DHCP, dhcp, na)
 
 #include <config_distro_bootcmd.h>
+#include <linux/stringify.h>
 
 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
 #define CONFIG_SYS_HZ			1000
diff --git a/include/configs/s32v234evb.h b/include/configs/s32v234evb.h
index 5b1504d..ba0e506 100644
--- a/include/configs/s32v234evb.h
+++ b/include/configs/s32v234evb.h
@@ -144,6 +144,7 @@
 	"run distro_bootcmd"
 
 #include <config_distro_bootcmd.h>
+#include <linux/stringify.h>
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_PROMPT		"=> "
diff --git a/include/configs/sbc8548.h b/include/configs/sbc8548.h
index f546254..55c4bff 100644
--- a/include/configs/sbc8548.h
+++ b/include/configs/sbc8548.h
@@ -12,6 +12,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * Top level Makefile configuration choices
  */
diff --git a/include/configs/socfpga_arria5_secu1.h b/include/configs/socfpga_arria5_secu1.h
index b059100..ad4c3c0 100644
--- a/include/configs/socfpga_arria5_secu1.h
+++ b/include/configs/socfpga_arria5_secu1.h
@@ -7,6 +7,7 @@
 #define __CONFIG_SOCFPGA_SECU1_H__
 
 #include <asm/arch/base_addr_ac5.h>
+#include <linux/stringify.h>
 
 /* Call misc_init_r */
 #define CONFIG_MISC_INIT_R
diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 0579a00..07c9745 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -5,6 +5,8 @@
 #ifndef __CONFIG_SOCFPGA_COMMON_H__
 #define __CONFIG_SOCFPGA_COMMON_H__
 
+#include <linux/stringify.h>
+
 /*
  * High level configuration
  */
diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h
index 61f7b25..7237ec9 100644
--- a/include/configs/socfpga_soc64_common.h
+++ b/include/configs/socfpga_soc64_common.h
@@ -9,6 +9,7 @@
 
 #include <asm/arch/base_addr_s10.h>
 #include <asm/arch/handoff_s10.h>
+#include <linux/stringify.h>
 
 /*
  * U-Boot general configurations
diff --git a/include/configs/strider.h b/include/configs/strider.h
index d5f710be..4ad3401 100644
--- a/include/configs/strider.h
+++ b/include/configs/strider.h
@@ -8,6 +8,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/tqma6.h b/include/configs/tqma6.h
index 895cd03..13ab1cc 100644
--- a/include/configs/tqma6.h
+++ b/include/configs/tqma6.h
@@ -9,6 +9,8 @@
 #define __CONFIG_H
 
 #include <linux/kconfig.h>
+#include <linux/stringify.h>
+
 /* SPL */
 /* #if defined(CONFIG_SPL_BUILD) */
 /* common IMX6 SPL configuration */
diff --git a/include/configs/udoo.h b/include/configs/udoo.h
index 163cbbb..54f472d 100644
--- a/include/configs/udoo.h
+++ b/include/configs/udoo.h
@@ -70,6 +70,7 @@
 	func(DHCP, dhcp, na)
 
 #include <config_distro_bootcmd.h>
+#include <linux/stringify.h>
 
 /* Physical Memory Map */
 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
diff --git a/include/configs/ve8313.h b/include/configs/ve8313.h
index bdacd81..81b171e 100644
--- a/include/configs/ve8313.h
+++ b/include/configs/ve8313.h
@@ -12,6 +12,8 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#include <linux/stringify.h>
+
 /*
  * High Level Configuration Options
  */
diff --git a/include/configs/vf610twr.h b/include/configs/vf610twr.h
index 739219e..0ef2de3 100644
--- a/include/configs/vf610twr.h
+++ b/include/configs/vf610twr.h
@@ -9,6 +9,7 @@
 #define __CONFIG_H
 
 #include <asm/arch/imx-regs.h>
+#include <linux/stringify.h>
 
 #define CONFIG_SYS_FSL_CLK
 
diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
index 9d2bd7b..2b0576e 100644
--- a/include/configs/wandboard.h
+++ b/include/configs/wandboard.h
@@ -107,6 +107,7 @@
 	func(DHCP, dhcp, na)
 
 #include <config_distro_bootcmd.h>
+#include <linux/stringify.h>
 
 /* Physical Memory Map */
 #define PHYS_SDRAM			MMDC0_ARB_BASE_ADDR
diff --git a/include/configs/wb45n.h b/include/configs/wb45n.h
index fea0705..aecf273 100644
--- a/include/configs/wb45n.h
+++ b/include/configs/wb45n.h
@@ -7,6 +7,7 @@
 #define __CONFIG_H__
 
 #include <asm/hardware.h>
+#include <linux/stringify.h>
 
 /* ARM asynchronous clock */
 #define CONFIG_SYS_AT91_SLOW_CLOCK  32768
diff --git a/include/configs/xpedite517x.h b/include/configs/xpedite517x.h
index 6c9991f..d3bb929 100644
--- a/include/configs/xpedite517x.h
+++ b/include/configs/xpedite517x.h
@@ -51,6 +51,7 @@
 #define CONFIG_SYS_SCRATCH_VA	0xe0000000
 
 #ifndef __ASSEMBLY__
+#include <linux/stringify.h>
 extern unsigned long get_board_sys_clk(unsigned long dummy);
 #endif
 
diff --git a/include/configs/xpedite537x.h b/include/configs/xpedite537x.h
index 6d847cb..7262c86 100644
--- a/include/configs/xpedite537x.h
+++ b/include/configs/xpedite537x.h
@@ -47,6 +47,7 @@
 #define CONFIG_VERY_BIG_RAM
 
 #ifndef __ASSEMBLY__
+#include <linux/stringify.h>
 extern unsigned long get_board_sys_clk(unsigned long dummy);
 extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #endif
diff --git a/include/configs/xpedite550x.h b/include/configs/xpedite550x.h
index 106269b..b9c9ac4 100644
--- a/include/configs/xpedite550x.h
+++ b/include/configs/xpedite550x.h
@@ -46,6 +46,7 @@
 #define CONFIG_VERY_BIG_RAM
 
 #ifndef __ASSEMBLY__
+#include <linux/stringify.h>
 extern unsigned long get_board_sys_clk(unsigned long dummy);
 extern unsigned long get_board_ddr_clk(unsigned long dummy);
 #endif
diff --git a/include/cpu_func.h b/include/cpu_func.h
index f701f02..8aa825d 100644
--- a/include/cpu_func.h
+++ b/include/cpu_func.h
@@ -18,7 +18,7 @@
 int cpu_status(u32 nr);
 int cpu_reset(u32 nr);
 int cpu_disable(u32 nr);
-int cpu_release(u32 nr, int argc, char * const argv[]);
+int cpu_release(u32 nr, int argc, char *const argv[]);
 
 static inline int cpumask_next(int cpu, unsigned int mask)
 {
diff --git a/include/dma.h b/include/dma.h
index 5b247b5..6ff5919 100644
--- a/include/dma.h
+++ b/include/dma.h
@@ -9,6 +9,7 @@
 #ifndef _DMA_H_
 #define _DMA_H_
 
+#include <linux/bitops.h>
 #include <linux/errno.h>
 #include <linux/types.h>
 
diff --git a/include/dwc3-sti-glue.h b/include/dwc3-sti-glue.h
index e2856f1..3989a9b 100644
--- a/include/dwc3-sti-glue.h
+++ b/include/dwc3-sti-glue.h
@@ -8,6 +8,7 @@
 #define __DWC3_STI_UBOOT_H_
 
 /* glue registers */
+#include <linux/bitops.h>
 #define CLKRST_CTRL		0x00
 #define AUX_CLK_EN		BIT(0)
 #define SW_PIPEW_RESET_N	BIT(4)
diff --git a/include/dwmmc.h b/include/dwmmc.h
index f06720d..d8a8355 100644
--- a/include/dwmmc.h
+++ b/include/dwmmc.h
@@ -7,8 +7,10 @@
 #ifndef __DWMMC_HW_H
 #define __DWMMC_HW_H
 
+#include <asm/cache.h>
 #include <asm/io.h>
 #include <mmc.h>
+#include <linux/bitops.h>
 
 #define DWMCI_CTRL		0x000
 #define	DWMCI_PWREN		0x004
diff --git a/include/efi_loader.h b/include/efi_loader.h
index 75c20e4..4b48f99 100644
--- a/include/efi_loader.h
+++ b/include/efi_loader.h
@@ -9,11 +9,15 @@
 #define _EFI_LOADER_H 1
 
 #include <common.h>
+#include <blk.h>
+#include <log.h>
 #include <part_efi.h>
 #include <efi_api.h>
 #include <image.h>
 #include <pe.h>
 
+struct blk_desc;
+
 static inline int guidcmp(const void *g1, const void *g2)
 {
 	return memcmp(g1, g2, sizeof(efi_guid_t));
diff --git a/include/elf.h b/include/elf.h
index e7c5198..b04e746 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -9,7 +9,7 @@
 #ifndef _ELF_H
 #define _ELF_H
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 #include "compiler.h"
 
 /* This version doesn't work for 64-bit ABIs - Erik */
@@ -690,7 +690,7 @@
 #define R_RISCV_64		2
 #define R_RISCV_RELATIVE	3
 
-#ifndef __ASSEMBLER__
+#ifndef __ASSEMBLY__
 int valid_elf_image(unsigned long addr);
 unsigned long load_elf64_image_phdr(unsigned long addr);
 unsigned long load_elf64_image_shdr(unsigned long addr);
diff --git a/include/env_default.h b/include/env_default.h
index 56a8bae..a657927 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -8,6 +8,7 @@
  */
 
 #include <env_callback.h>
+#include <linux/stringify.h>
 
 #ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
 env_t embedded_environment __UBOOT_ENV_SECTION__(environment) = {
diff --git a/include/environment/ti/boot.h b/include/environment/ti/boot.h
index 11a57af..a9d8f28 100644
--- a/include/environment/ti/boot.h
+++ b/include/environment/ti/boot.h
@@ -9,6 +9,8 @@
 #ifndef __TI_BOOT_H
 #define __TI_BOOT_H
 
+#include <linux/stringify.h>
+
 #ifndef CONSOLEDEV
 #define CONSOLEDEV "ttyS2"
 #endif
diff --git a/include/exception.h b/include/exception.h
index fc02490..a7f21e7 100644
--- a/include/exception.h
+++ b/include/exception.h
@@ -5,10 +5,12 @@
  * Copyright (c) 2018, Heinrich Schuchardt <xypron.glpk@gmx.de>
  */
 
-static int do_exception(cmd_tbl_t *cmdtp, int flag, int argc,
-			char * const argv[])
+#include <command.h>
+
+static int do_exception(struct cmd_tbl *cmdtp, int flag, int argc,
+			char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc != 2)
 		return CMD_RET_USAGE;
@@ -25,12 +27,12 @@
 	return CMD_RET_USAGE;
 }
 
-static int exception_complete(int argc, char * const argv[], char last_char,
+static int exception_complete(int argc, char *const argv[], char last_char,
 			      int maxv, char *cmdv[])
 {
 	int len = 0;
 	int i = 0;
-	cmd_tbl_t *cmdtp;
+	struct cmd_tbl *cmdtp;
 
 	switch (argc) {
 	case 1:
diff --git a/include/exports.h b/include/exports.h
index cbd16fc..b300554 100644
--- a/include/exports.h
+++ b/include/exports.h
@@ -2,6 +2,7 @@
 #define __EXPORTS_H__
 
 #include <irq_func.h>
+#include <linux/delay.h>
 
 #ifndef __ASSEMBLY__
 #ifdef CONFIG_PHY_AQUANTIA
@@ -11,6 +12,7 @@
 
 #include <irq_func.h>
 
+struct cmd_tbl;
 struct spi_slave;
 
 /* Set up the jump table for use by the API */
diff --git a/include/ext4fs.h b/include/ext4fs.h
index 34585d4..cb5d9cc 100644
--- a/include/ext4fs.h
+++ b/include/ext4fs.h
@@ -28,6 +28,8 @@
 #define __EXT4__
 #include <ext_common.h>
 
+struct disk_partition;
+
 #define EXT4_INDEX_FL		0x00001000 /* Inode uses hash tree index */
 #define EXT4_EXTENTS_FL		0x00080000 /* Inode uses extents */
 #define EXT4_EXT_MAGIC			0xf30a
@@ -152,11 +154,11 @@
 int ext4fs_size(const char *filename, loff_t *size);
 void ext4fs_free_node(struct ext2fs_node *node, struct ext2fs_node *currroot);
 int ext4fs_devread(lbaint_t sector, int byte_offset, int byte_len, char *buf);
-void ext4fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info);
+void ext4fs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
 long int read_allocated_block(struct ext2_inode *inode, int fileblock,
 			      struct ext_block_cache *cache);
 int ext4fs_probe(struct blk_desc *fs_dev_desc,
-		 disk_partition_t *fs_partition);
+		 struct disk_partition *fs_partition);
 int ext4_read_file(const char *filename, void *buf, loff_t offset, loff_t len,
 		   loff_t *actread);
 int ext4_read_superblock(char *buffer);
diff --git a/include/ext_common.h b/include/ext_common.h
index 1c10c50..bc33241 100644
--- a/include/ext_common.h
+++ b/include/ext_common.h
@@ -19,7 +19,9 @@
 
 #ifndef __EXT_COMMON__
 #define __EXT_COMMON__
-#include <command.h>
+
+struct cmd_tbl;
+
 #define SECTOR_SIZE		0x200
 #define LOG2_SECTOR_SIZE	9
 
@@ -210,11 +212,11 @@
 
 extern lbaint_t part_offset;
 
-int do_ext2ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ext4_load(cmd_tbl_t *cmdtp, int flag, int argc,
-					char *const argv[]);
-int do_ext4_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_ext4_write(cmd_tbl_t *cmdtp, int flag, int argc,
-				char *const argv[]);
+int do_ext2ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ext4_load(struct cmd_tbl *cmdtp, int flag, int argc,
+		 char *const argv[]);
+int do_ext4_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ext4_write(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[]);
 #endif
diff --git a/include/faraday/ftpci100.h b/include/faraday/ftpci100.h
index b4a43f8..8801bd1 100644
--- a/include/faraday/ftpci100.h
+++ b/include/faraday/ftpci100.h
@@ -11,6 +11,7 @@
 #define __FTPCI100_H
 
 /* AHB Control Registers */
+#include <linux/bitops.h>
 struct ftpci100_ahbc {
 	unsigned int iosize;		/* 0x00 - I/O Space Size Signal */
 	unsigned int prot;		/* 0x04 - AHB Protection */
diff --git a/include/faraday/ftsdc010.h b/include/faraday/ftsdc010.h
index d3a359a..30726da 100644
--- a/include/faraday/ftsdc010.h
+++ b/include/faraday/ftsdc010.h
@@ -12,6 +12,7 @@
 #ifndef __ASSEMBLY__
 
 /* sd controller register */
+#include <linux/bitops.h>
 struct ftsdc010_mmc {
 	unsigned int	cmd;		/* 0x00 - command reg		*/
 	unsigned int	argu;		/* 0x04 - argument reg		*/
diff --git a/include/faraday/ftsdmc021.h b/include/faraday/ftsdmc021.h
index 3c979ce..e0e5eb3 100644
--- a/include/faraday/ftsdmc021.h
+++ b/include/faraday/ftsdmc021.h
@@ -14,6 +14,7 @@
 #define __FTSDMC021_H
 
 #ifndef __ASSEMBLY__
+#include <linux/bitops.h>
 struct ftsdmc021 {
 	unsigned int	tp1;		/* 0x00 - SDRAM Timing Parameter 1 */
 	unsigned int	tp2;		/* 0x04 - SDRAM Timing Parameter 2 */
diff --git a/include/fat.h b/include/fat.h
index bc139f8..02742f9 100644
--- a/include/fat.h
+++ b/include/fat.h
@@ -12,6 +12,8 @@
 #include <asm/byteorder.h>
 #include <fs.h>
 
+struct disk_partition;
+
 /* Maximum Long File Name length supported here is 128 UTF-16 code units */
 #define VFAT_MAXLEN_BYTES	256 /* Maximum LFN buffer in bytes */
 #define VFAT_MAXSEQ		9   /* Up to 9 of 13 2-byte UTF-16 entries */
@@ -193,7 +195,7 @@
 int file_fat_read_at(const char *filename, loff_t pos, void *buffer,
 		     loff_t maxsize, loff_t *actread);
 int file_fat_read(const char *filename, void *buffer, int maxsize);
-int fat_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info);
+int fat_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
 int fat_register_device(struct blk_desc *dev_desc, int part_no);
 
 int file_fat_write(const char *filename, void *buf, loff_t offset, loff_t len,
diff --git a/include/fb_mmc.h b/include/fb_mmc.h
index 95db001..76ed7cd 100644
--- a/include/fb_mmc.h
+++ b/include/fb_mmc.h
@@ -6,17 +6,21 @@
 #ifndef _FB_MMC_H_
 #define _FB_MMC_H_
 
+struct blk_desc;
+struct disk_partition;
+
 /**
  * fastboot_mmc_get_part_info() - Lookup eMMC partion by name
  *
  * @part_name: Named partition to lookup
  * @dev_desc: Pointer to returned blk_desc pointer
- * @part_info: Pointer to returned disk_partition_t
+ * @part_info: Pointer to returned struct disk_partition
  * @response: Pointer to fastboot response buffer
  */
 int fastboot_mmc_get_part_info(const char *part_name,
 			       struct blk_desc **dev_desc,
-			       disk_partition_t *part_info, char *response);
+			       struct disk_partition *part_info,
+			       char *response);
 
 /**
  * fastboot_mmc_flash_write() - Write image to eMMC for fastboot
diff --git a/include/flash.h b/include/flash.h
index 2655c72..3bf6b22 100644
--- a/include/flash.h
+++ b/include/flash.h
@@ -84,20 +84,20 @@
 
 /* Prototypes */
 
-extern unsigned long flash_init (void);
-extern void flash_print_info (flash_info_t *);
-extern int flash_erase	(flash_info_t *, int, int);
-extern int flash_sect_erase (ulong addr_first, ulong addr_last);
-extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
-extern int flash_sect_roundb (ulong *addr);
-extern unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect);
-extern void flash_set_verbose(uint);
+unsigned long flash_init(void);
+void flash_print_info(flash_info_t *info);
+int flash_erase(flash_info_t *info, int s_first, int s_last);
+int flash_sect_erase(ulong addr_first, ulong addr_last);
+int flash_sect_protect(int flag, ulong addr_first, ulong addr_last);
+int flash_sect_roundb(ulong *addr);
+unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect);
+void flash_set_verbose(uint v);
 
 /* common/flash.c */
-extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info);
-extern int flash_write (char *, ulong, ulong);
-extern flash_info_t *addr2info (ulong);
-extern int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt);
+void flash_protect(int flag, ulong from, ulong to, flash_info_t *info);
+int flash_write(char *src, ulong addr, ulong cnt);
+flash_info_t *addr2info(ulong addr);
+int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt);
 
 /* drivers/mtd/cfi_mtd.c */
 #ifdef CONFIG_FLASH_CFI_MTD
diff --git a/include/fs.h b/include/fs.h
index 37e35c2..29f737b 100644
--- a/include/fs.h
+++ b/include/fs.h
@@ -7,6 +7,8 @@
 
 #include <common.h>
 
+struct cmd_tbl;
+
 #define FS_TYPE_ANY	0
 #define FS_TYPE_FAT	1
 #define FS_TYPE_EXT	2
@@ -14,6 +16,8 @@
 #define FS_TYPE_UBIFS	4
 #define FS_TYPE_BTRFS	5
 
+struct blk_desc;
+
 /**
  * do_fat_fsload - Run the fatload command
  *
@@ -23,7 +27,8 @@
  * @argv: List of arguments
  * @return result (see enum command_ret_t)
  */
-int do_fat_fsload(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+int do_fat_fsload(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[]);
 
 /**
  * do_ext2load - Run the ext2load command
@@ -34,7 +39,7 @@
  * @argv: List of arguments
  * @return result (see enum command_ret_t)
  */
-int do_ext2load(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+int do_ext2load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 
 /*
  * Tell the fs layer which block device an partition to use for future
@@ -224,34 +229,34 @@
  * Common implementation for various filesystem commands, optionally limited
  * to a specific filesystem type via the fstype parameter.
  */
-int do_size(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype);
-int do_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype);
-int do_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype);
+int do_size(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	    int fstype);
+int do_load(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	    int fstype);
+int do_ls(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	  int fstype);
 int file_exists(const char *dev_type, const char *dev_part, const char *file,
 		int fstype);
-int do_save(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype);
-int do_rm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype);
-int do_mkdir(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype);
-int do_ln(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
+int do_save(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	    int fstype);
+int do_rm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	  int fstype);
+int do_mkdir(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	     int fstype);
+int do_ln(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
 	  int fstype);
 
 /*
  * Determine the UUID of the specified filesystem and print it. Optionally it is
  * possible to store the UUID directly in env.
  */
-int do_fs_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[],
-		int fstype);
+int do_fs_uuid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[],
+	       int fstype);
 
 /*
  * Determine the type of the specified filesystem and print it. Optionally it is
  * possible to store the type directly in env.
  */
-int do_fs_type(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_fs_type(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 
 #endif /* _FS_H */
diff --git a/include/fs_internal.h b/include/fs_internal.h
index 96d2603..3d4d25d 100644
--- a/include/fs_internal.h
+++ b/include/fs_internal.h
@@ -10,7 +10,7 @@
 
 #include <part.h>
 
-int fs_devread(struct blk_desc *, disk_partition_t *, lbaint_t, int, int,
+int fs_devread(struct blk_desc *, struct disk_partition *, lbaint_t, int, int,
 	       char *);
 
 #endif /* __U_BOOT_FS_INTERNAL_H__ */
diff --git a/include/fsl-mc/fsl_mc.h b/include/fsl-mc/fsl_mc.h
index a4d7d85..6cbcd39 100644
--- a/include/fsl-mc/fsl_mc.h
+++ b/include/fsl-mc/fsl_mc.h
@@ -7,6 +7,7 @@
 #define __FSL_MC_H__
 
 #include <common.h>
+#include <linux/bitops.h>
 
 #define MC_CCSR_BASE_ADDR \
 	((struct mc_ccsr_registers __iomem *)0x8340000)
diff --git a/include/fsl_ddr.h b/include/fsl_ddr.h
index 2476f40..025d7a1 100644
--- a/include/fsl_ddr.h
+++ b/include/fsl_ddr.h
@@ -12,6 +12,8 @@
 
 #include <common_timing_params.h>
 
+struct cmd_tbl;
+
 #ifndef CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS
 /* All controllers are for main memory */
 #define CONFIG_SYS_FSL_DDR_MAIN_NUM_CTRLS	CONFIG_SYS_NUM_DDR_CTLRS
@@ -120,7 +122,7 @@
 void fsl_ddr_get_spd(generic_spd_eeprom_t *ctrl_dimms_spd,
 		     unsigned int ctrl_num, unsigned int dimm_slots_per_ctrl);
 
-int do_reset(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_reset(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 unsigned int check_fsl_memctl_config_regs(const fsl_ddr_cfg_regs_t *ddr);
 void board_add_ram_info(int use_default);
 
diff --git a/include/fsl_ifc.h b/include/fsl_ifc.h
index 3edcc39..fd91533 100644
--- a/include/fsl_ifc.h
+++ b/include/fsl_ifc.h
@@ -10,6 +10,7 @@
 #ifdef CONFIG_FSL_IFC
 #include <config.h>
 #include <common.h>
+#include <part.h>
 #ifdef CONFIG_ARM
 #include <asm/arch/soc.h>
 #endif
diff --git a/include/fsl_validate.h b/include/fsl_validate.h
index 06951fc..252d499 100644
--- a/include/fsl_validate.h
+++ b/include/fsl_validate.h
@@ -8,9 +8,10 @@
 
 #include <fsl_sec.h>
 #include <fsl_sec_mon.h>
-#include <command.h>
 #include <linux/types.h>
 
+struct cmd_tbl;
+
 #define WORD_SIZE 4
 
 /* Minimum and maximum size of RSA signature length in bits */
@@ -261,15 +262,14 @@
 	uint32_t img_size;	/* ESBC Image Size */
 };
 
-int do_esbc_halt(cmd_tbl_t *cmdtp, int flag, int argc,
-				char * const argv[]);
+int do_esbc_halt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 
 int fsl_secboot_validate(uintptr_t haddr, char *arg_hash_str,
 	uintptr_t *img_addr_ptr);
-int fsl_secboot_blob_encap(cmd_tbl_t *cmdtp, int flag, int argc,
-	char * const argv[]);
-int fsl_secboot_blob_decap(cmd_tbl_t *cmdtp, int flag, int argc,
-	char * const argv[]);
+int fsl_secboot_blob_encap(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[]);
+int fsl_secboot_blob_decap(struct cmd_tbl *cmdtp, int flag, int argc,
+			   char *const argv[]);
 
 int fsl_check_boot_mode_secure(void);
 int fsl_setenv_chain_of_trust(void);
diff --git a/include/gzip.h b/include/gzip.h
index 2e34067..783acbb 100644
--- a/include/gzip.h
+++ b/include/gzip.h
@@ -7,6 +7,8 @@
 #ifndef __GZIP_H
 #define __GZIP_H
 
+struct blk_desc;
+
 /**
  * gzip_parse_header() - Parse a header from a gzip file
  *
diff --git a/include/hash.h b/include/hash.h
index f4019a9..835962e 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -6,6 +6,8 @@
 #ifndef _HASH_H
 #define _HASH_H
 
+struct cmd_tbl;
+
 /*
  * Maximum digest size for all algorithms we support. Having this value
  * avoids a malloc() or C99 local declaration in common/cmd_hash.c.
@@ -85,8 +87,8 @@
  * @argc:		Number of arguments (arg 0 must be the command text)
  * @argv:		Arguments
  */
-int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
-		 int argc, char * const argv[]);
+int hash_command(const char *algo_name, int flags, struct cmd_tbl *cmdtp,
+		 int flag, int argc, char *const argv[]);
 
 /**
  * hash_block() - Hash a block according to the requested algorithm
diff --git a/include/i2c.h b/include/i2c.h
index 0592001..1d792db 100644
--- a/include/i2c.h
+++ b/include/i2c.h
@@ -16,6 +16,8 @@
 #ifndef _I2C_H_
 #define _I2C_H_
 
+#include <linker_lists.h>
+
 /*
  * For now there are essentially two parts to this file - driver model
  * here at the top, and the older code below (with CONFIG_SYS_I2C being
diff --git a/include/image.h b/include/image.h
index de55b2f..ad81dad 100644
--- a/include/image.h
+++ b/include/image.h
@@ -590,10 +590,10 @@
 int genimg_get_format(const void *img_addr);
 int genimg_has_config(bootm_headers_t *images);
 
-int boot_get_fpga(int argc, char * const argv[], bootm_headers_t *images,
-		uint8_t arch, const ulong *ld_start, ulong * const ld_len);
-int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
-		uint8_t arch, ulong *rd_start, ulong *rd_end);
+int boot_get_fpga(int argc, char *const argv[], bootm_headers_t *images,
+		  uint8_t arch, const ulong *ld_start, ulong * const ld_len);
+int boot_get_ramdisk(int argc, char *const argv[], bootm_headers_t *images,
+		     uint8_t arch, ulong *rd_start, ulong *rd_end);
 
 /**
  * boot_get_loadable - routine to load a list of binaries to memory
@@ -616,8 +616,8 @@
  *     0, if only valid images or no images are found
  *     error code, if an error occurs during fit_image_load
  */
-int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
-		uint8_t arch, const ulong *ld_start, ulong * const ld_len);
+int boot_get_loadable(int argc, char *const argv[], bootm_headers_t *images,
+		      uint8_t arch, const ulong *ld_start, ulong *const ld_len);
 #endif /* !USE_HOSTCC */
 
 int boot_get_setup_fit(bootm_headers_t *images, uint8_t arch,
@@ -726,7 +726,7 @@
 int fit_get_node_from_config(bootm_headers_t *images, const char *prop_name,
 			ulong addr);
 
-int boot_get_fdt(int flag, int argc, char * const argv[], uint8_t arch,
+int boot_get_fdt(int flag, int argc, char *const argv[], uint8_t arch,
 		 bootm_headers_t *images,
 		 char **of_flat_tree, ulong *of_size);
 void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob);
diff --git a/include/initcall.h b/include/initcall.h
index b5acdd0..41b74dc 100644
--- a/include/initcall.h
+++ b/include/initcall.h
@@ -8,6 +8,11 @@
 
 typedef int (*init_fnc_t)(void);
 
+#include <log.h>
+#ifdef CONFIG_EFI_APP
+#include <efi.h>
+#endif
+
 /*
  * To enable debugging. add #define DEBUG at the top of the including file.
  *
diff --git a/include/kgdb.h b/include/kgdb.h
index b6ba742..616ce44 100644
--- a/include/kgdb.h
+++ b/include/kgdb.h
@@ -55,7 +55,7 @@
 extern void kgdb_putreg(struct pt_regs *, int, char *, int);
 extern void kgdb_putregs(struct pt_regs *, char *, int);
 extern int kgdb_trap(struct pt_regs *);
-extern void kgdb_breakpoint(int argc, char * const argv[]);
+void kgdb_breakpoint(int argc, char *const argv[]);
 
 /* these functions are provided by the platform serial driver */
 extern void kgdb_serial_init(void);
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
index a07c70f..6b509dc 100644
--- a/include/linux/bitops.h
+++ b/include/linux/bitops.h
@@ -1,6 +1,8 @@
 #ifndef _LINUX_BITOPS_H
 #define _LINUX_BITOPS_H
 
+#ifndef USE_HOSTCC
+
 #include <asm/types.h>
 #include <asm-generic/bitsperlong.h>
 #include <linux/compiler.h>
@@ -216,4 +218,6 @@
 	*p &= ~mask;
 }
 
+#endif /* !USE_HOSTCC */
+
 #endif
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 171188a..712eeae 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -1,6 +1,7 @@
 #ifndef _LINUX_COMPAT_H_
 #define _LINUX_COMPAT_H_
 
+#include <log.h>
 #include <malloc.h>
 #include <linux/types.h>
 #include <linux/err.h>
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index bd373b9..66febc6 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -16,6 +16,7 @@
 #include <config.h>
 
 #include <dm/device.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/flashchip.h>
diff --git a/include/linux/soc/ti/cppi5.h b/include/linux/soc/ti/cppi5.h
index 34038b3..cfdf7ea 100644
--- a/include/linux/soc/ti/cppi5.h
+++ b/include/linux/soc/ti/cppi5.h
@@ -10,6 +10,7 @@
 
 #include <hexdump.h>
 #include <linux/bitops.h>
+#include <linux/bug.h>
 
 /**
  * Descriptor header, present in all types of descriptors
diff --git a/include/linux/soc/ti/k3-navss-ringacc.h b/include/linux/soc/ti/k3-navss-ringacc.h
index 487dfe9..7b027f8 100644
--- a/include/linux/soc/ti/k3-navss-ringacc.h
+++ b/include/linux/soc/ti/k3-navss-ringacc.h
@@ -9,6 +9,7 @@
 #define __SOC_TI_K3_NAVSS_RINGACC_API_H_
 
 #include <dm/ofnode.h>
+#include <linux/bitops.h>
 
 /**
  * enum k3_nav_ring_mode - &struct k3_nav_ring_cfg mode
diff --git a/include/linux/soc/ti/ti_sci_protocol.h b/include/linux/soc/ti/ti_sci_protocol.h
index 8c4863e..eb916ba 100644
--- a/include/linux/soc/ti/ti_sci_protocol.h
+++ b/include/linux/soc/ti/ti_sci_protocol.h
@@ -20,6 +20,7 @@
  * @firmware_revision:	Firmware revision (not usually used).
  * @firmware_description: Firmware description (not usually used).
  */
+#include <linux/bitops.h>
 struct ti_sci_version_info {
 	u8 abi_major;
 	u8 abi_minor;
diff --git a/include/log.h b/include/log.h
index cf32351..df65398 100644
--- a/include/log.h
+++ b/include/log.h
@@ -9,10 +9,13 @@
 #ifndef __LOG_H
 #define __LOG_H
 
-#include <command.h>
+#include <stdio.h>
+#include <linker_lists.h>
 #include <dm/uclass-id.h>
 #include <linux/list.h>
 
+struct cmd_tbl;
+
 /** Log levels supported, ranging from most to least important */
 enum log_level_t {
 	LOGL_EMERG = 0,		/* U-Boot is unstable */
@@ -413,7 +416,7 @@
 };
 
 /* Handle the 'log test' command */
-int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+int do_log_test(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 
 /**
  * log_add_filter() - Add a new filter to a log device
diff --git a/include/mipi_dsi.h b/include/mipi_dsi.h
index f4a63b4..83c5163 100644
--- a/include/mipi_dsi.h
+++ b/include/mipi_dsi.h
@@ -16,6 +16,7 @@
 #define MIPI_DSI_H
 
 #include <mipi_display.h>
+#include <linux/bitops.h>
 
 struct mipi_dsi_host;
 struct mipi_dsi_device;
diff --git a/include/mmc.h b/include/mmc.h
index 6a2e973..8256219 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -9,6 +9,7 @@
 #ifndef _MMC_H_
 #define _MMC_H_
 
+#include <linux/bitops.h>
 #include <linux/list.h>
 #include <linux/sizes.h>
 #include <linux/compiler.h>
diff --git a/include/net.h b/include/net.h
index 82500ee..00a8ec0 100644
--- a/include/net.h
+++ b/include/net.h
@@ -12,12 +12,19 @@
 #ifndef __NET_H__
 #define __NET_H__
 
+#include <linux/types.h>
 #include <asm/cache.h>
 #include <asm/byteorder.h>	/* for nton* / ntoh* stuff */
 #include <env.h>
+#include <log.h>
+#include <time.h>
 #include <linux/if_ether.h>
 #include <rand.h>
 
+struct bd_info;
+struct cmd_tbl;
+struct udevice;
+
 #define DEBUG_LL_STATE 0	/* Link local state machine changes */
 #define DEBUG_DEV_PKT 0		/* Packets or info directed to the device */
 #define DEBUG_NET_PKT 0		/* Packets on info on the network at large */
@@ -59,7 +66,7 @@
  * @argv: List of arguments
  * @return result (see enum command_ret_t)
  */
-int do_tftpb(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
+int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
 
 /**
  * An incoming packet handler.
@@ -184,12 +191,12 @@
 	phys_addr_t iobase;
 	int state;
 
-	int (*init)(struct eth_device *, bd_t *);
+	int (*init)(struct eth_device *eth, struct bd_info *bd);
 	int (*send)(struct eth_device *, void *packet, int length);
 	int (*recv)(struct eth_device *);
 	void (*halt)(struct eth_device *);
 	int (*mcast)(struct eth_device *, const u8 *enetaddr, int join);
-	int (*write_hwaddr)(struct eth_device *);
+	int (*write_hwaddr)(struct eth_device *eth);
 	struct eth_device *next;
 	int index;
 	void *priv;
@@ -242,7 +249,7 @@
 int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
 		     int eth_number);
 
-int usb_eth_initialize(bd_t *bi);
+int usb_eth_initialize(struct bd_info *bi);
 #endif
 
 int eth_initialize(void);		/* Initialize network subsystem */
diff --git a/include/net/pfe_eth/pfe/cbus/class_csr.h b/include/net/pfe_eth/pfe/cbus/class_csr.h
index e2fece7..80f1f96 100644
--- a/include/net/pfe_eth/pfe/cbus/class_csr.h
+++ b/include/net/pfe_eth/pfe/cbus/class_csr.h
@@ -12,6 +12,7 @@
  * class_csr - block containing all the classifier control and status register.
  * Mapped on CBUS and accessible from all PE's and ARM.
  */
+#include <linux/bitops.h>
 #define CLASS_VERSION			(CLASS_CSR_BASE_ADDR + 0x000)
 #define CLASS_TX_CTRL			(CLASS_CSR_BASE_ADDR + 0x004)
 #define CLASS_INQ_PKTPTR		(CLASS_CSR_BASE_ADDR + 0x010)
diff --git a/include/net/pfe_eth/pfe/cbus/emac.h b/include/net/pfe_eth/pfe/cbus/emac.h
index 53db8cc..5dc2113 100644
--- a/include/net/pfe_eth/pfe/cbus/emac.h
+++ b/include/net/pfe_eth/pfe/cbus/emac.h
@@ -7,6 +7,7 @@
 #ifndef _EMAC_H_
 #define _EMAC_H_
 
+#include <linux/bitops.h>
 #define EMAC_IEVENT_REG		0x004
 #define EMAC_IMASK_REG		0x008
 #define EMAC_R_DES_ACTIVE_REG	0x010
diff --git a/include/net/pfe_eth/pfe/cbus/hif.h b/include/net/pfe_eth/pfe/cbus/hif.h
index 36722c5..aa4951e 100644
--- a/include/net/pfe_eth/pfe/cbus/hif.h
+++ b/include/net/pfe_eth/pfe/cbus/hif.h
@@ -12,6 +12,7 @@
  * hif - PFE hif block control and status register.
  * Mapped on CBUS and accessible from all PE's and ARM.
  */
+#include <linux/bitops.h>
 #define HIF_VERSION		(HIF_BASE_ADDR + 0x00)
 #define HIF_TX_CTRL		(HIF_BASE_ADDR + 0x04)
 #define HIF_TX_CURR_BD_ADDR	(HIF_BASE_ADDR + 0x08)
diff --git a/include/net/pfe_eth/pfe/cbus/tmu_csr.h b/include/net/pfe_eth/pfe/cbus/tmu_csr.h
index 1e1abe2..cfe8f8c 100644
--- a/include/net/pfe_eth/pfe/cbus/tmu_csr.h
+++ b/include/net/pfe_eth/pfe/cbus/tmu_csr.h
@@ -7,6 +7,7 @@
 #ifndef _TMU_CSR_H_
 #define _TMU_CSR_H_
 
+#include <linux/bitops.h>
 #define TMU_VERSION			(TMU_CSR_BASE_ADDR + 0x000)
 #define TMU_INQ_WATERMARK		(TMU_CSR_BASE_ADDR + 0x004)
 #define TMU_PHY_INQ_PKTPTR		(TMU_CSR_BASE_ADDR + 0x008)
diff --git a/include/net/pfe_eth/pfe/pfe_hw.h b/include/net/pfe_eth/pfe/pfe_hw.h
index 5da676b..c69fc69 100644
--- a/include/net/pfe_eth/pfe/pfe_hw.h
+++ b/include/net/pfe_eth/pfe/pfe_hw.h
@@ -8,6 +8,7 @@
 #define _PFE_H_
 
 #include <elf.h>
+#include <linux/bitops.h>
 #include "cbus.h"
 
 #define PFE_RESET_WA
diff --git a/include/net/pfe_eth/pfe_eth.h b/include/net/pfe_eth/pfe_eth.h
index 68b2e38..116a2b2 100644
--- a/include/net/pfe_eth/pfe_eth.h
+++ b/include/net/pfe_eth/pfe_eth.h
@@ -7,6 +7,7 @@
 #ifndef __PFE_ETH_H__
 #define __PFE_ETH_H__
 
+#include <linux/bitops.h>
 #include <linux/sizes.h>
 #include <asm/io.h>
 #include <miiphy.h>
diff --git a/include/part.h b/include/part.h
index 3693527..55be724 100644
--- a/include/part.h
+++ b/include/part.h
@@ -54,7 +54,7 @@
 #define PART_BOOTABLE			((int)BIT(0))
 #define PART_EFI_SYSTEM_PARTITION	((int)BIT(1))
 
-typedef struct disk_partition {
+struct disk_partition {
 	lbaint_t	start;	/* # of first block in partition	*/
 	lbaint_t	size;	/* number of blocks in partition	*/
 	ulong	blksz;		/* block size in bytes			*/
@@ -76,11 +76,11 @@
 #ifdef CONFIG_DOS_PARTITION
 	uchar	sys_ind;	/* partition type 			*/
 #endif
-} disk_partition_t;
+};
 
 struct disk_part {
 	int partnum;
-	disk_partition_t gpt_part_info;
+	struct disk_partition gpt_part_info;
 	struct list_head list;
 };
 
@@ -105,12 +105,14 @@
 int host_get_dev_err(int dev, struct blk_desc **blk_devp);
 
 /* disk/part.c */
-int part_get_info(struct blk_desc *dev_desc, int part, disk_partition_t *info);
+int part_get_info(struct blk_desc *dev_desc, int part,
+		  struct disk_partition *info);
 /**
  * part_get_info_whole_disk() - get partition info for the special case of
  * a partition occupying the entire disk.
  */
-int part_get_info_whole_disk(struct blk_desc *dev_desc, disk_partition_t *info);
+int part_get_info_whole_disk(struct blk_desc *dev_desc,
+			     struct disk_partition *info);
 
 void part_print(struct blk_desc *dev_desc);
 void part_init(struct blk_desc *dev_desc);
@@ -179,7 +181,7 @@
  */
 int blk_get_device_part_str(const char *ifname, const char *dev_part_str,
 			    struct blk_desc **dev_desc,
-			    disk_partition_t *info, int allow_whole_dev);
+			    struct disk_partition *info, int allow_whole_dev);
 
 /**
  * part_get_info_by_name_type() - Search for a partition by name
@@ -194,7 +196,7 @@
  * otherwise error
  */
 int part_get_info_by_name_type(struct blk_desc *dev_desc, const char *name,
-			       disk_partition_t *info, int part_type);
+			       struct disk_partition *info, int part_type);
 
 /**
  * part_get_info_by_name() - Search for a partition by name
@@ -208,7 +210,7 @@
  * otherwise error
  */
 int part_get_info_by_name(struct blk_desc *dev_desc,
-			      const char *name, disk_partition_t *info);
+			      const char *name, struct disk_partition *info);
 
 /**
  * Get partition info from dev number + part name, or dev number + part number.
@@ -229,7 +231,7 @@
 int part_get_info_by_dev_and_name_or_num(const char *dev_iface,
 					 const char *dev_part_str,
 					 struct blk_desc **dev_desc,
-					 disk_partition_t *part_info);
+					 struct disk_partition *part_info);
 
 /**
  * part_set_generic_name() - create generic partition like hda1 or sdb2
@@ -252,9 +254,9 @@
 static inline struct blk_desc *mg_disk_get_dev(int dev) { return NULL; }
 
 static inline int part_get_info(struct blk_desc *dev_desc, int part,
-				disk_partition_t *info) { return -1; }
+				struct disk_partition *info) { return -1; }
 static inline int part_get_info_whole_disk(struct blk_desc *dev_desc,
-					   disk_partition_t *info)
+					   struct disk_partition *info)
 { return -1; }
 static inline void part_print(struct blk_desc *dev_desc) {}
 static inline void part_init(struct blk_desc *dev_desc) {}
@@ -263,10 +265,10 @@
 					struct blk_desc **dev_desc)
 { return -1; }
 static inline int blk_get_device_part_str(const char *ifname,
-					   const char *dev_part_str,
-					   struct blk_desc **dev_desc,
-					   disk_partition_t *info,
-					   int allow_whole_dev)
+					  const char *dev_part_str,
+					  struct blk_desc **dev_desc,
+					  struct disk_partition *info,
+					  int allow_whole_dev)
 { *dev_desc = NULL; return -1; }
 #endif
 
@@ -301,7 +303,7 @@
 	 * @info:	Returns partition information
 	 */
 	int (*get_info)(struct blk_desc *dev_desc, int part,
-			disk_partition_t *info);
+			struct disk_partition *info);
 
 	/**
 	 * print() - Print partition information
@@ -353,7 +355,7 @@
  */
 int gpt_fill_pte(struct blk_desc *dev_desc,
 		 gpt_header *gpt_h, gpt_entry *gpt_e,
-		 disk_partition_t *partitions, int parts);
+		 struct disk_partition *partitions, int parts);
 
 /**
  * gpt_fill_header(): Fill the GPT header
@@ -379,7 +381,7 @@
  * @return zero on success
  */
 int gpt_restore(struct blk_desc *dev_desc, char *str_disk_guid,
-		disk_partition_t *partitions, const int parts_count);
+		struct disk_partition *partitions, const int parts_count);
 
 /**
  * is_valid_gpt_buf() - Ensure that the Primary GPT information is valid
@@ -433,7 +435,7 @@
  * @return - '0' on success, otherwise error
  */
 int gpt_verify_partitions(struct blk_desc *dev_desc,
-			  disk_partition_t *partitions, int parts,
+			  struct disk_partition *partitions, int parts,
 			  gpt_header *gpt_head, gpt_entry **gpt_pte);
 
 
diff --git a/include/pch.h b/include/pch.h
index 0b44b66..6205668 100644
--- a/include/pch.h
+++ b/include/pch.h
@@ -7,6 +7,7 @@
 #ifndef __pch_h
 #define __pch_h
 
+#include <linux/bitops.h>
 #define PCH_RCBA		0xf0
 
 #define BIOS_CTRL_BIOSWE	BIT(0)
diff --git a/include/power/stpmic1.h b/include/power/stpmic1.h
index 1493a67..d3567df 100644
--- a/include/power/stpmic1.h
+++ b/include/power/stpmic1.h
@@ -6,6 +6,7 @@
 #ifndef __PMIC_STPMIC1_H_
 #define __PMIC_STPMIC1_H_
 
+#include <linux/bitops.h>
 #define STPMIC1_MAIN_CR			0x10
 #define STPMIC1_BUCKS_MRST_CR		0x18
 #define STPMIC1_LDOS_MRST_CR		0x1a
diff --git a/include/regmap.h b/include/regmap.h
index 9ada1af..30183c5 100644
--- a/include/regmap.h
+++ b/include/regmap.h
@@ -7,6 +7,8 @@
 #ifndef __REGMAP_H
 #define __REGMAP_H
 
+#include <linux/delay.h>
+
 /**
  * DOC: Overview
  *
diff --git a/include/reiserfs.h b/include/reiserfs.h
index de41500..b61bb60 100644
--- a/include/reiserfs.h
+++ b/include/reiserfs.h
@@ -18,6 +18,9 @@
 #define SECTOR_SIZE		0x200
 #define SECTOR_BITS		9
 
+struct blk_desc;
+struct disk_partition;
+
 /* Error codes */
 typedef enum
 {
@@ -62,7 +65,7 @@
 } reiserfs_error_t;
 
 
-void reiserfs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info);
+void reiserfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
 extern int reiserfs_ls (char *dirname);
 extern int reiserfs_open (char *filename);
 extern int reiserfs_read (char *buf, unsigned len);
diff --git a/include/sandboxfs.h b/include/sandboxfs.h
index 6e6e3c6..783dd5c 100644
--- a/include/sandboxfs.h
+++ b/include/sandboxfs.h
@@ -18,7 +18,10 @@
 #ifndef __SANDBOX_FS__
 #define __SANDBOX_FS__
 
-int sandbox_fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info);
+struct blk_desc;
+struct disk_partition;
+
+int sandbox_fs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
 
 int sandbox_fs_read_at(const char *filename, loff_t pos, void *buffer,
 		       loff_t maxsize, loff_t *actread);
diff --git a/include/scsi.h b/include/scsi.h
index 61da958..96cb726 100644
--- a/include/scsi.h
+++ b/include/scsi.h
@@ -6,6 +6,7 @@
  #ifndef _SCSI_H
  #define _SCSI_H
 
+#include <asm/cache.h>
 #include <linux/dma-direction.h>
 
 struct scsi_cmd {
diff --git a/include/sdhci.h b/include/sdhci.h
index 0ef8c2e..94fc3ed 100644
--- a/include/sdhci.h
+++ b/include/sdhci.h
@@ -9,6 +9,7 @@
 #ifndef __SDHCI_HW_H
 #define __SDHCI_HW_H
 
+#include <linux/bitops.h>
 #include <linux/types.h>
 #include <asm/io.h>
 #include <mmc.h>
diff --git a/include/search.h b/include/search.h
index 8f87dc7..bca36d3 100644
--- a/include/search.h
+++ b/include/search.h
@@ -84,7 +84,7 @@
 int hdelete_r(const char *key, struct hsearch_data *htab, int flag);
 
 ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
-		  char **resp, size_t size, int argc, char * const argv[]);
+		  char **resp, size_t size, int argc, char *const argv[]);
 
 /*
  * nvars: length of vars array
diff --git a/include/spi.h b/include/spi.h
index 2b4929f..5cc6d6e 100644
--- a/include/spi.h
+++ b/include/spi.h
@@ -10,6 +10,7 @@
 #define _SPI_H_
 
 #include <common.h>
+#include <linux/bitops.h>
 
 /* SPI mode flags */
 #define SPI_CPHA	BIT(0)			/* clock phase */
diff --git a/include/spl.h b/include/spl.h
index 90395fe..b31c9bb 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -7,6 +7,7 @@
 #define	_SPL_H_
 
 #include <binman_sym.h>
+#include <linker_lists.h>
 
 /* Platform-specific defines */
 #include <linux/compiler.h>
@@ -26,6 +27,9 @@
 #define MMCSD_MODE_FS		2
 #define MMCSD_MODE_EMMCBOOT	3
 
+struct blk_desc;
+struct image_header;
+
 /*
  * u_boot_first_phase() - check if this is the first U-Boot phase
  *
diff --git a/include/tee.h b/include/tee.h
index 02bcd9e..8207d0c 100644
--- a/include/tee.h
+++ b/include/tee.h
@@ -6,6 +6,7 @@
 #ifndef __TEE_H
 #define __TEE_H
 
+#include <linux/bitops.h>
 #define TEE_UUID_LEN		16
 
 #define TEE_GEN_CAP_GP          BIT(0)	/* GlobalPlatform compliant TEE */
diff --git a/include/tee/optee.h b/include/tee/optee.h
index 121b30a..affa937 100644
--- a/include/tee/optee.h
+++ b/include/tee/optee.h
@@ -10,6 +10,7 @@
 #define _OPTEE_H
 
 #include <linux/errno.h>
+#include <image.h>
 
 #define OPTEE_MAGIC             0x4554504f
 #define OPTEE_VERSION           1
@@ -28,14 +29,16 @@
 	uint32_t paged_size;
 };
 
-static inline uint32_t optee_image_get_entry_point(const image_header_t *hdr)
+static inline uint32_t
+optee_image_get_entry_point(const struct image_header *hdr)
 {
 	struct optee_header *optee_hdr = (struct optee_header *)(hdr + 1);
 
 	return optee_hdr->init_load_addr_lo;
 }
 
-static inline uint32_t optee_image_get_load_addr(const image_header_t *hdr)
+static inline uint32_t
+optee_image_get_load_addr(const struct image_header *hdr)
 {
 	return optee_image_get_entry_point(hdr) - sizeof(struct optee_header);
 }
diff --git a/include/test/suites.h b/include/test/suites.h
index 213e3ce..f120b3a 100644
--- a/include/test/suites.h
+++ b/include/test/suites.h
@@ -7,6 +7,7 @@
 #ifndef __TEST_SUITES_H__
 #define __TEST_SUITES_H__
 
+struct cmd_tbl;
 struct unit_test;
 
 /**
@@ -23,18 +24,22 @@
  */
 int cmd_ut_category(const char *name, const char *prefix,
 		    struct unit_test *tests, int n_ents,
-		    int argc, char * const argv[]);
+		    int argc, char *const argv[]);
 
-int do_ut_bloblist(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_ut_compression(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_lib(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_optee(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_str(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]);
-int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[]);
+int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[]);
+int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ut_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ut_lib(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ut_log(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[]);
+int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[]);
+int do_ut_str(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ut_time(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+int do_ut_unicode(struct cmd_tbl *cmdtp, int flag, int argc,
+		  char *const argv[]);
 
 #endif /* __TEST_SUITES_H__ */
diff --git a/include/test/ut.h b/include/test/ut.h
index b05d719..7ddd6e8 100644
--- a/include/test/ut.h
+++ b/include/test/ut.h
@@ -8,6 +8,7 @@
 #ifndef __TEST_UT_H
 #define __TEST_UT_H
 
+#include <command.h>
 #include <hexdump.h>
 #include <linux/err.h>
 
diff --git a/include/tpm-common.h b/include/tpm-common.h
index 702cd6e..e29b10b 100644
--- a/include/tpm-common.h
+++ b/include/tpm-common.h
@@ -7,6 +7,8 @@
 #ifndef __TPM_COMMON_H
 #define __TPM_COMMON_H
 
+#include <command.h>
+
 enum tpm_duration {
 	TPM_SHORT = 0,
 	TPM_MEDIUM = 1,
@@ -173,8 +175,8 @@
 	U_BOOT_CMD_MKENT(cmd, 0, 1, do_tpm_ ## cmd, "", "")
 
 #define TPM_COMMAND_NO_ARG(cmd)				\
-int do_##cmd(cmd_tbl_t *cmdtp, int flag,		\
-	     int argc, char * const argv[])		\
+int do_##cmd(struct cmd_tbl *cmdtp, int flag,		\
+	     int argc, char *const argv[])		\
 {							\
 	struct udevice *dev;				\
 	int rc;						\
@@ -263,20 +265,20 @@
 /**
  * Retrieve the array containing all the v1 (resp. v2) commands.
  *
- * @return a cmd_tbl_t array.
+ * @return a struct cmd_tbl array.
  */
 #if defined(CONFIG_TPM_V1)
-cmd_tbl_t *get_tpm1_commands(unsigned int *size);
+struct cmd_tbl *get_tpm1_commands(unsigned int *size);
 #else
-static inline cmd_tbl_t *get_tpm1_commands(unsigned int *size)
+static inline struct cmd_tbl *get_tpm1_commands(unsigned int *size)
 {
 	return NULL;
 }
 #endif
 #if defined(CONFIG_TPM_V2)
-cmd_tbl_t *get_tpm2_commands(unsigned int *size);
+struct cmd_tbl *get_tpm2_commands(unsigned int *size);
 #else
-static inline cmd_tbl_t *get_tpm2_commands(unsigned int *size)
+static inline struct cmd_tbl *get_tpm2_commands(unsigned int *size)
 {
 	return NULL;
 }
diff --git a/include/tpm-v1.h b/include/tpm-v1.h
index 45b7a48..59ad4ae 100644
--- a/include/tpm-v1.h
+++ b/include/tpm-v1.h
@@ -8,6 +8,7 @@
 #define __TPM_V1_H
 
 #include <tpm-common.h>
+#include <linux/bitops.h>
 
 /* Useful constants */
 enum {
diff --git a/include/ubifs_uboot.h b/include/ubifs_uboot.h
index 015ce122..b025779 100644
--- a/include/ubifs_uboot.h
+++ b/include/ubifs_uboot.h
@@ -14,13 +14,16 @@
 #ifndef __UBIFS_UBOOT_H__
 #define __UBIFS_UBOOT_H__
 
+struct blk_desc;
+struct disk_partition;
+
 int ubifs_init(void);
 int uboot_ubifs_mount(char *vol_name);
 void uboot_ubifs_umount(void);
 int ubifs_is_mounted(void);
 int ubifs_load(char *filename, u32 addr, u32 size);
 
-int ubifs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info);
+int ubifs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
 int ubifs_ls(const char *dir_name);
 int ubifs_exists(const char *filename);
 int ubifs_size(const char *filename, loff_t *size);
diff --git a/include/virtio.h b/include/virtio.h
index 561dcc3..10a9c07 100644
--- a/include/virtio.h
+++ b/include/virtio.h
@@ -20,6 +20,8 @@
 #ifndef __VIRTIO_H__
 #define __VIRTIO_H__
 
+#include <linux/bitops.h>
+#include <linux/bug.h>
 #define VIRTIO_ID_NET		1 /* virtio net */
 #define VIRTIO_ID_BLOCK		2 /* virtio block */
 #define VIRTIO_ID_RNG		4 /* virtio rng */
diff --git a/include/vsc9953.h b/include/vsc9953.h
index fe072da..5d6fc77 100644
--- a/include/vsc9953.h
+++ b/include/vsc9953.h
@@ -11,6 +11,7 @@
 #include <config.h>
 #include <miiphy.h>
 #include <asm/types.h>
+#include <linux/bitops.h>
 
 #define VSC9953_OFFSET			(CONFIG_SYS_CCSRBAR_DEFAULT + 0x800000)
 
diff --git a/include/vxworks.h b/include/vxworks.h
index d90d862..c2585e6 100644
--- a/include/vxworks.h
+++ b/include/vxworks.h
@@ -9,6 +9,9 @@
 
 #include <efi_api.h>
 
+struct bootm_headers;
+struct cmd_tbl;
+
 /* Use Linux compatible standard DTB */
 #define VXWORKS_SYSFLG_STD_DTB	0x1
 
@@ -83,8 +86,8 @@
 	u32 fb_size;			/* framebuffer size */
 };
 
-int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
-void boot_prep_vxworks(bootm_headers_t *images);
-void boot_jump_vxworks(bootm_headers_t *images);
+int do_bootvx(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
+void boot_prep_vxworks(struct bootm_headers *images);
+void boot_jump_vxworks(struct bootm_headers *images);
 
 #endif
diff --git a/include/wait_bit.h b/include/wait_bit.h
index 79da081..dc2ffeb 100644
--- a/include/wait_bit.h
+++ b/include/wait_bit.h
@@ -8,9 +8,11 @@
 #ifndef __WAIT_BIT_H
 #define __WAIT_BIT_H
 
-#include <common.h>
 #include <console.h>
+#include <log.h>
+#include <time.h>
 #include <watchdog.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
 #include <asm/io.h>
 
diff --git a/include/wdt.h b/include/wdt.h
index aea5abc..d2ccfbc 100644
--- a/include/wdt.h
+++ b/include/wdt.h
@@ -7,6 +7,7 @@
 #define _WDT_H_
 
 #include <dm.h>
+#include <log.h>
 #include <dm/read.h>
 
 /*
diff --git a/include/xyzModem.h b/include/xyzModem.h
index 6fae634..a8911b6 100644
--- a/include/xyzModem.h
+++ b/include/xyzModem.h
@@ -25,6 +25,8 @@
 #ifndef _XYZMODEM_H_
 #define _XYZMODEM_H_
 
+#include <linux/delay.h>
+
 #define xyzModem_xmodem 1
 #define xyzModem_ymodem 2
 /* Don't define this until the protocol support is in place */
diff --git a/include/zfs_common.h b/include/zfs_common.h
index bca3dff..027ba91 100644
--- a/include/zfs_common.h
+++ b/include/zfs_common.h
@@ -98,7 +98,7 @@
 int zfs_ls(device_t dev, const char *path,
 		   int (*hook) (const char *, const struct zfs_dirhook_info *));
 int zfs_devread(int sector, int byte_offset, int byte_len, char *buf);
-void zfs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info);
+void zfs_set_blk_dev(struct blk_desc *rbdd, struct disk_partition *info);
 void zfs_unmount(struct zfs_data *data);
 int lzjb_decompress(void *, void *, uint32_t, uint32_t);
 #endif
diff --git a/include/zynqmppl.h b/include/zynqmppl.h
index 5214db9..a0a52ec 100644
--- a/include/zynqmppl.h
+++ b/include/zynqmppl.h
@@ -8,6 +8,7 @@
 #define _ZYNQMPPL_H_
 
 #include <xilinx.h>
+#include <linux/bitops.h>
 
 #define ZYNQMP_SIP_SVC_CSU_DMA_CHIPID		0xC2000018
 #define ZYNQMP_SIP_SVC_PM_FPGA_LOAD		0xC2000016
diff --git a/lib/acpi/acpi_table.c b/lib/acpi/acpi_table.c
index 1c253af..4317766 100644
--- a/lib/acpi/acpi_table.c
+++ b/lib/acpi/acpi_table.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <dm.h>
 #include <cpu.h>
+#include <log.h>
 #include <mapmem.h>
 #include <tables_csum.h>
 #include <version.h>
diff --git a/lib/aes.c b/lib/aes.c
index ce53c9f..c998aec 100644
--- a/lib/aes.c
+++ b/lib/aes.c
@@ -23,6 +23,7 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#include <log.h>
 #else
 #include <string.h>
 #endif
diff --git a/lib/asm-offsets.c b/lib/asm-offsets.c
index 2617513..b17651e 100644
--- a/lib/asm-offsets.c
+++ b/lib/asm-offsets.c
@@ -12,6 +12,7 @@
  */
 
 #include <common.h>
+#include <asm-offsets.h>
 
 #include <linux/kbuild.h>
 
diff --git a/lib/asn1_decoder.c b/lib/asn1_decoder.c
index db22262..bcb0390 100644
--- a/lib/asn1_decoder.c
+++ b/lib/asn1_decoder.c
@@ -6,6 +6,7 @@
  */
 
 #ifdef __UBOOT__
+#include <log.h>
 #include <linux/compat.h>
 #else
 #include <linux/export.h>
diff --git a/lib/bch.c b/lib/bch.c
index 8945d8d..de66b1a 100644
--- a/lib/bch.c
+++ b/lib/bch.c
@@ -55,6 +55,7 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <ubi_uboot.h>
 #include <dm/devres.h>
diff --git a/lib/binman.c b/lib/binman.c
index 6cf6dcf..fd7de24 100644
--- a/lib/binman.c
+++ b/lib/binman.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <binman.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 
 struct binman_info {
diff --git a/lib/bzip2/bzlib_blocksort.c b/lib/bzip2/bzlib_blocksort.c
index 2785521..36cf843 100644
--- a/lib/bzip2/bzlib_blocksort.c
+++ b/lib/bzip2/bzlib_blocksort.c
@@ -60,6 +60,7 @@
 --*/
 
 #include "bzlib_private.h"
+#include <log.h>
 
 /*---------------------------------------------*/
 /*--- Fallback O(N log(N)^2) sorting        ---*/
diff --git a/lib/circbuf.c b/lib/circbuf.c
index 071e4fb..fa79c14 100644
--- a/lib/circbuf.c
+++ b/lib/circbuf.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 
 #include <circbuf.h>
diff --git a/lib/crypto/asymmetric_type.c b/lib/crypto/asymmetric_type.c
index 7aa5509..1d0532d 100644
--- a/lib/crypto/asymmetric_type.c
+++ b/lib/crypto/asymmetric_type.c
@@ -7,12 +7,14 @@
  * Written by David Howells (dhowells@redhat.com)
  */
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <keys/asymmetric-subtype.h>
 #include <keys/asymmetric-parser.h>
 #endif
 #include <crypto/public_key.h>
 #ifdef __UBOOT__
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <linux/ctype.h>
 #include <linux/err.h>
diff --git a/lib/crypto/pkcs7_parser.c b/lib/crypto/pkcs7_parser.c
index 0ee207b..0b85fe8 100644
--- a/lib/crypto/pkcs7_parser.c
+++ b/lib/crypto/pkcs7_parser.c
@@ -7,6 +7,7 @@
 
 #define pr_fmt(fmt) "PKCS7: "fmt
 #ifdef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/bitops.h>
 #include <linux/compat.h>
diff --git a/lib/crypto/public_key.c b/lib/crypto/public_key.c
index 8b48217..e12ebbb 100644
--- a/lib/crypto/public_key.c
+++ b/lib/crypto/public_key.c
@@ -10,6 +10,7 @@
 #define pr_fmt(fmt) "PKEY: "fmt
 #ifdef __UBOOT__
 #include <dm/devres.h>
+#include <linux/bug.h>
 #include <linux/compat.h>
 #include <linux/err.h>
 #else
diff --git a/lib/crypto/x509_cert_parser.c b/lib/crypto/x509_cert_parser.c
index 18f5407..5f984b9 100644
--- a/lib/crypto/x509_cert_parser.c
+++ b/lib/crypto/x509_cert_parser.c
@@ -6,6 +6,7 @@
  */
 
 #define pr_fmt(fmt) "X.509: "fmt
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/kernel.h>
 #ifndef __UBOOT__
diff --git a/lib/dhry/cmd_dhry.c b/lib/dhry/cmd_dhry.c
index 2950483..d55ab54 100644
--- a/lib/dhry/cmd_dhry.c
+++ b/lib/dhry/cmd_dhry.c
@@ -8,7 +8,8 @@
 #include <div64.h>
 #include "dhry.h"
 
-static int do_dhry(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_dhry(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	ulong start, duration, vax_mips;
 	u64 dhry_per_sec;
diff --git a/lib/div64.c b/lib/div64.c
index 62933c9..779d752 100644
--- a/lib/div64.c
+++ b/lib/div64.c
@@ -17,6 +17,7 @@
  * or by defining a preprocessor macro in arch/include/asm/div64.h.
  */
 
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <linux/kernel.h>
 #include <linux/math64.h>
diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c
index 7c64077..b7e19c3 100644
--- a/lib/efi/efi_app.c
+++ b/lib/efi/efi_app.c
@@ -13,6 +13,7 @@
 #include <debug_uart.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
 #include <malloc.h>
 #include <linux/err.h>
 #include <linux/types.h>
diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c
index 33e66fc..e7d8745 100644
--- a/lib/efi_driver/efi_block_device.c
+++ b/lib/efi_driver/efi_block_device.c
@@ -28,6 +28,8 @@
  * iPXE uses the simple file protocol to load Grub or the Linux Kernel.
  */
 
+#include <common.h>
+#include <blk.h>
 #include <efi_driver.h>
 #include <malloc.h>
 #include <dm/device-internal.h>
diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c
index f8badad..04e4e45 100644
--- a/lib/efi_driver/efi_uclass.c
+++ b/lib/efi_driver/efi_uclass.c
@@ -18,6 +18,7 @@
  */
 
 #include <efi_driver.h>
+#include <log.h>
 #include <malloc.h>
 
 /**
diff --git a/lib/efi_loader/efi_acpi.c b/lib/efi_loader/efi_acpi.c
index 9ae9c25..585b2d2 100644
--- a/lib/efi_loader/efi_acpi.c
+++ b/lib/efi_loader/efi_acpi.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <efi_loader.h>
+#include <log.h>
 #include <acpi/acpi_table.h>
 
 static const efi_guid_t acpi_guid = EFI_ACPI_TABLE_GUID;
diff --git a/lib/efi_loader/efi_bootmgr.c b/lib/efi_loader/efi_bootmgr.c
index 2ea2144..b112f5d 100644
--- a/lib/efi_loader/efi_bootmgr.c
+++ b/lib/efi_loader/efi_bootmgr.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <charset.h>
+#include <log.h>
 #include <malloc.h>
 #include <efi_loader.h>
 #include <asm/unaligned.h>
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index a3f11ea..db34938 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -9,6 +9,7 @@
 #include <div64.h>
 #include <efi_loader.h>
 #include <irq_func.h>
+#include <log.h>
 #include <malloc.h>
 #include <time.h>
 #include <linux/libfdt_env.h>
diff --git a/lib/efi_loader/efi_device_path.c b/lib/efi_loader/efi_device_path.c
index f934948..2b537c1 100644
--- a/lib/efi_loader/efi_device_path.c
+++ b/lib/efi_loader/efi_device_path.c
@@ -8,6 +8,8 @@
 #include <common.h>
 #include <blk.h>
 #include <dm.h>
+#include <log.h>
+#include <net.h>
 #include <usb.h>
 #include <mmc.h>
 #include <nvme.h>
@@ -693,7 +695,7 @@
  */
 static void *dp_part_node(void *buf, struct blk_desc *desc, int part)
 {
-	disk_partition_t info;
+	struct disk_partition info;
 
 	part_get_info(desc, part, &info);
 
@@ -1035,7 +1037,7 @@
 {
 	int is_net;
 	struct blk_desc *desc = NULL;
-	disk_partition_t fs_partition;
+	struct disk_partition fs_partition;
 	int part = 0;
 	char filename[32] = { 0 }; /* dp->str is u16[32] long */
 	char *s;
diff --git a/lib/efi_loader/efi_device_path_to_text.c b/lib/efi_loader/efi_device_path_to_text.c
index af1adbb..49bebb5 100644
--- a/lib/efi_loader/efi_device_path_to_text.c
+++ b/lib/efi_loader/efi_device_path_to_text.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <efi_loader.h>
 
 #define MAC_OUTPUT_LEN 22
diff --git a/lib/efi_loader/efi_disk.c b/lib/efi_loader/efi_disk.c
index 0582e02..9176008 100644
--- a/lib/efi_loader/efi_disk.c
+++ b/lib/efi_loader/efi_disk.c
@@ -424,7 +424,7 @@
 	/* Store first EFI system partition */
 	if (part && !efi_system_partition.if_type) {
 		int r;
-		disk_partition_t info;
+		struct disk_partition info;
 
 		r = part_get_info(desc, part, &info);
 		if (r)
@@ -459,7 +459,7 @@
 {
 	int disks = 0;
 	char devname[32] = { 0 }; /* dp->str is u16[32] long */
-	disk_partition_t info;
+	struct disk_partition info;
 	int part;
 	struct efi_device_path *dp = NULL;
 	efi_status_t ret;
@@ -600,7 +600,7 @@
 {
 	struct efi_handler *handler;
 	struct efi_disk_obj *diskobj;
-	disk_partition_t info;
+	struct disk_partition info;
 	efi_status_t ret;
 	int r;
 
diff --git a/lib/efi_loader/efi_file.c b/lib/efi_loader/efi_file.c
index 140116d..19afa69 100644
--- a/lib/efi_loader/efi_file.c
+++ b/lib/efi_loader/efi_file.c
@@ -8,9 +8,11 @@
 #include <common.h>
 #include <charset.h>
 #include <efi_loader.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <fs.h>
+#include <part.h>
 
 /* GUID for file system information */
 const efi_guid_t efi_file_system_info_guid = EFI_FILE_SYSTEM_INFO_GUID;
@@ -634,7 +636,7 @@
 		utf8_utf16_strcpy(&dst, filename);
 	} else if (!guidcmp(info_type, &efi_file_system_info_guid)) {
 		struct efi_file_system_info *info = buffer;
-		disk_partition_t part;
+		struct disk_partition part;
 		efi_uintn_t required_size;
 		int r;
 
diff --git a/lib/efi_loader/efi_gop.c b/lib/efi_loader/efi_gop.c
index 1511e3b..53f6d97 100644
--- a/lib/efi_loader/efi_gop.c
+++ b/lib/efi_loader/efi_gop.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <efi_loader.h>
 #include <lcd.h>
+#include <log.h>
 #include <malloc.h>
 #include <video.h>
 
diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c
index c0cf1d9..44b8a2e 100644
--- a/lib/efi_loader/efi_memory.c
+++ b/lib/efi_loader/efi_memory.c
@@ -11,6 +11,7 @@
 #include <malloc.h>
 #include <mapmem.h>
 #include <watchdog.h>
+#include <asm/cache.h>
 #include <linux/list_sort.h>
 #include <linux/sizes.h>
 
diff --git a/lib/efi_loader/efi_net.c b/lib/efi_loader/efi_net.c
index 82d2595..22f0123 100644
--- a/lib/efi_loader/efi_net.c
+++ b/lib/efi_loader/efi_net.c
@@ -18,6 +18,7 @@
 #include <common.h>
 #include <efi_loader.h>
 #include <malloc.h>
+#include <net.h>
 
 static const efi_guid_t efi_net_guid = EFI_SIMPLE_NETWORK_PROTOCOL_GUID;
 static const efi_guid_t efi_pxe_base_code_protocol_guid =
diff --git a/lib/efi_loader/efi_rng.c b/lib/efi_loader/efi_rng.c
index a1d0ec8..caef408 100644
--- a/lib/efi_loader/efi_rng.c
+++ b/lib/efi_loader/efi_rng.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <efi_loader.h>
 #include <efi_rng.h>
+#include <log.h>
 #include <rng.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index a28b291..c0bd99b 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -11,6 +11,7 @@
 #include <dm.h>
 #include <elf.h>
 #include <efi_loader.h>
+#include <log.h>
 #include <malloc.h>
 #include <rtc.h>
 #include <u-boot/crc.h>
diff --git a/lib/efi_loader/efi_smbios.c b/lib/efi_loader/efi_smbios.c
index a814884..719d3e8 100644
--- a/lib/efi_loader/efi_smbios.c
+++ b/lib/efi_loader/efi_smbios.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <efi_loader.h>
+#include <log.h>
 #include <mapmem.h>
 #include <smbios.h>
 
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 1089268..fc7ae73 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -7,12 +7,15 @@
 
 #include <common.h>
 #include <efi_loader.h>
+#include <env.h>
 #include <env_internal.h>
 #include <hexdump.h>
 #include <malloc.h>
 #include <rtc.h>
 #include <search.h>
+#include <uuid.h>
 #include <crypto/pkcs7_parser.h>
+#include <linux/bitops.h>
 #include <linux/compat.h>
 #include <u-boot/crc.h>
 
diff --git a/lib/efi_selftest/efi_selftest_block_device.c b/lib/efi_selftest/efi_selftest_block_device.c
index d98a854..5eb297d 100644
--- a/lib/efi_selftest/efi_selftest_block_device.c
+++ b/lib/efi_selftest/efi_selftest_block_device.c
@@ -15,6 +15,7 @@
 
 #include <efi_selftest.h>
 #include "efi_selftest_disk_image.h"
+#include <asm/cache.h>
 
 /* Block size of compressed disk image */
 #define COMPRESSED_DISK_IMAGE_BLOCK_SIZE 8
diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c
index 42f51b6..13f3ee6 100644
--- a/lib/efi_selftest/efi_selftest_console.c
+++ b/lib/efi_selftest/efi_selftest_console.c
@@ -6,6 +6,7 @@
  */
 
 #include <efi_selftest.h>
+#include <net.h>
 #include <vsprintf.h>
 
 struct efi_simple_text_output_protocol *con_out;
diff --git a/lib/efi_selftest/efi_selftest_snp.c b/lib/efi_selftest/efi_selftest_snp.c
index 9797eca..79f0467 100644
--- a/lib/efi_selftest/efi_selftest_snp.c
+++ b/lib/efi_selftest/efi_selftest_snp.c
@@ -15,6 +15,7 @@
  */
 
 #include <efi_selftest.h>
+#include <net.h>
 
 /*
  * MAC address for broadcasts
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 0a3b860..9c4d571 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -9,7 +9,9 @@
 #include <dm.h>
 #include <hang.h>
 #include <init.h>
+#include <log.h>
 #include <malloc.h>
+#include <net.h>
 #include <dm/of_extra.h>
 #include <env.h>
 #include <errno.h>
diff --git a/lib/fdtdec_common.c b/lib/fdtdec_common.c
index 5775992..ddaca00 100644
--- a/lib/fdtdec_common.c
+++ b/lib/fdtdec_common.c
@@ -9,6 +9,7 @@
 
 #ifndef USE_HOSTCC
 #include <common.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <fdtdec.h>
 #else
diff --git a/lib/fdtdec_test.c b/lib/fdtdec_test.c
index e8bfd1f..e0c6e09 100644
--- a/lib/fdtdec_test.c
+++ b/lib/fdtdec_test.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <fdtdec.h>
 #include <linux/libfdt.h>
 #include <malloc.h>
@@ -297,8 +298,8 @@
 	return 0;
 }
 
-static int do_test_fdtdec(cmd_tbl_t *cmdtp, int flag, int argc,
-			  char * const argv[])
+static int do_test_fdtdec(struct cmd_tbl *cmdtp, int flag, int argc,
+			  char *const argv[])
 {
 	/* basic tests */
 	CHECKOK(run_test("", "", ""));
diff --git a/lib/gunzip.c b/lib/gunzip.c
index 9e6ccd6..bee3b92 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <blk.h>
 #include <command.h>
 #include <console.h>
 #include <div64.h>
diff --git a/lib/hashtable.c b/lib/hashtable.c
index f82f246..b96dbe1 100644
--- a/lib/hashtable.c
+++ b/lib/hashtable.c
@@ -13,6 +13,7 @@
  */
 
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <sort.h>
 
@@ -605,7 +606,7 @@
 
 ssize_t hexport_r(struct hsearch_data *htab, const char sep, int flag,
 		 char **resp, size_t size,
-		 int argc, char * const argv[])
+		 int argc, char *const argv[])
 {
 	struct env_entry *list[htab->size];
 	char *res, *p;
diff --git a/lib/image-sparse.c b/lib/image-sparse.c
index 0360621..187ac28 100644
--- a/lib/image-sparse.c
+++ b/lib/image-sparse.c
@@ -36,11 +36,14 @@
 
 #include <config.h>
 #include <common.h>
+#include <blk.h>
 #include <image-sparse.h>
 #include <div64.h>
+#include <log.h>
 #include <malloc.h>
 #include <part.h>
 #include <sparse_format.h>
+#include <asm/cache.h>
 
 #include <linux/math64.h>
 
diff --git a/lib/libavb/avb_cmdline.c b/lib/libavb/avb_cmdline.c
index dd859d3..cb54e65 100644
--- a/lib/libavb/avb_cmdline.c
+++ b/lib/libavb/avb_cmdline.c
@@ -7,6 +7,7 @@
 #include "avb_sha.h"
 #include "avb_util.h"
 #include "avb_version.h"
+#include <log.h>
 #include <malloc.h>
 
 #define NUM_GUIDS 3
diff --git a/lib/libavb/avb_descriptor.c b/lib/libavb/avb_descriptor.c
index 86b8d1b..56a3a91 100644
--- a/lib/libavb/avb_descriptor.c
+++ b/lib/libavb/avb_descriptor.c
@@ -6,6 +6,7 @@
 #include "avb_descriptor.h"
 #include "avb_util.h"
 #include "avb_vbmeta_image.h"
+#include <log.h>
 #include <malloc.h>
 
 bool avb_descriptor_validate_and_byteswap(const AvbDescriptor* src,
diff --git a/lib/libavb/avb_slot_verify.c b/lib/libavb/avb_slot_verify.c
index 58baf52..ae8e1df 100644
--- a/lib/libavb/avb_slot_verify.c
+++ b/lib/libavb/avb_slot_verify.c
@@ -14,6 +14,7 @@
 #include "avb_util.h"
 #include "avb_vbmeta_image.h"
 #include "avb_version.h"
+#include <log.h>
 #include <malloc.h>
 
 /* Maximum number of partitions that can be loaded with avb_slot_verify(). */
diff --git a/lib/libavb/avb_util.c b/lib/libavb/avb_util.c
index 94773b7..8719ede 100644
--- a/lib/libavb/avb_util.c
+++ b/lib/libavb/avb_util.c
@@ -4,6 +4,7 @@
  */
 
 #include "avb_util.h"
+#include <log.h>
 #include <malloc.h>
 
 #include <stdarg.h>
diff --git a/lib/linux_compat.c b/lib/linux_compat.c
index 89a6fd6..c83426f 100644
--- a/lib/linux_compat.c
+++ b/lib/linux_compat.c
@@ -2,6 +2,7 @@
 #include <common.h>
 #include <malloc.h>
 #include <memalign.h>
+#include <asm/cache.h>
 #include <linux/compat.h>
 
 struct p_current cur = {
diff --git a/lib/list_sort.c b/lib/list_sort.c
index beb7273..58e1e16 100644
--- a/lib/list_sort.c
+++ b/lib/list_sort.c
@@ -1,4 +1,5 @@
 #ifndef __UBOOT__
+#include <log.h>
 #include <dm/devres.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
diff --git a/lib/lmb.c b/lib/lmb.c
index 07b9308..008bcc7 100644
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -7,7 +7,9 @@
  */
 
 #include <common.h>
+#include <image.h>
 #include <lmb.h>
+#include <log.h>
 #include <malloc.h>
 
 #define LMB_ALLOC_ANYWHERE	0
diff --git a/lib/lzma/LzmaTools.c b/lib/lzma/LzmaTools.c
index 2537cb8..521258e 100644
--- a/lib/lzma/LzmaTools.c
+++ b/lib/lzma/LzmaTools.c
@@ -19,6 +19,7 @@
 
 #include <config.h>
 #include <common.h>
+#include <log.h>
 #include <watchdog.h>
 
 #ifdef CONFIG_LZMA
diff --git a/lib/membuff.c b/lib/membuff.c
index 45dae2d..36dc43a 100644
--- a/lib/membuff.c
+++ b/lib/membuff.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include "membuff.h"
 
diff --git a/lib/net_utils.c b/lib/net_utils.c
index 8af7782..0a8a557 100644
--- a/lib/net_utils.c
+++ b/lib/net_utils.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <net.h>
 
 struct in_addr string_to_ip(const char *s)
 {
diff --git a/lib/of_live.c b/lib/of_live.c
index c49e95e..05a45ed 100644
--- a/lib/of_live.c
+++ b/lib/of_live.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <linux/libfdt.h>
 #include <of_live.h>
 #include <malloc.h>
diff --git a/lib/optee/optee.c b/lib/optee/optee.c
index d4355c6..e59b576 100644
--- a/lib/optee/optee.c
+++ b/lib/optee/optee.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <image.h>
+#include <log.h>
 #include <malloc.h>
 #include <linux/libfdt.h>
 #include <tee/optee.h>
diff --git a/lib/panic.c b/lib/panic.c
index 8e72c26..58382ac 100644
--- a/lib/panic.c
+++ b/lib/panic.c
@@ -14,6 +14,7 @@
 #if !defined(CONFIG_PANIC_HANG)
 #include <command.h>
 #endif
+#include <linux/delay.h>
 
 static void panic_finish(void) __attribute__ ((noreturn));
 
diff --git a/lib/physmem.c b/lib/physmem.c
index 84b191d..fc90ce4 100644
--- a/lib/physmem.c
+++ b/lib/physmem.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <mapmem.h>
 #include <physmem.h>
 #include <linux/compiler.h>
diff --git a/lib/qsort.c b/lib/qsort.c
index f63d4ef..2f18588 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -15,6 +15,7 @@
  * calculation, as well as to reduce the generated code size with
  * bcc and gcc. */
 
+#include <log.h>
 #include <linux/types.h>
 #include <common.h>
 #include <exports.h>
diff --git a/lib/rsa/rsa-mod-exp.c b/lib/rsa/rsa-mod-exp.c
index 62b2557..a437cbe 100644
--- a/lib/rsa/rsa-mod-exp.c
+++ b/lib/rsa/rsa-mod-exp.c
@@ -6,6 +6,7 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <asm/types.h>
 #include <asm/byteorder.h>
 #include <linux/errno.h>
diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c
index f7ae174..1d55b99 100644
--- a/lib/rsa/rsa-verify.c
+++ b/lib/rsa/rsa-verify.c
@@ -6,6 +6,7 @@
 #ifndef USE_HOSTCC
 #include <common.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/types.h>
 #include <asm/byteorder.h>
diff --git a/lib/slre.c b/lib/slre.c
index 969c46a..e82a9e7 100644
--- a/lib/slre.c
+++ b/lib/slre.c
@@ -20,6 +20,7 @@
 #include <stdlib.h>
 #include <string.h>
 #else
+#include <log.h>
 #include <common.h>
 #include <linux/ctype.h>
 #endif /* SLRE_TEST */
diff --git a/lib/time.c b/lib/time.c
index 75de48f..65db0f6 100644
--- a/lib/time.c
+++ b/lib/time.c
@@ -5,13 +5,16 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <errno.h>
+#include <init.h>
 #include <time.h>
 #include <timer.h>
 #include <watchdog.h>
 #include <div64.h>
 #include <asm/io.h>
+#include <linux/delay.h>
 
 #ifndef CONFIG_WD_PERIOD
 # define CONFIG_WD_PERIOD	(10 * 1000 * 1000)	/* 10 seconds default */
@@ -181,7 +184,7 @@
 	do {
 		WATCHDOG_RESET();
 		kv = usec > CONFIG_WD_PERIOD ? CONFIG_WD_PERIOD : usec;
-		__udelay (kv);
+		__udelay(kv);
 		usec -= kv;
 	} while(usec);
 }
diff --git a/lib/tpm-common.c b/lib/tpm-common.c
index 86b4f41..e4af87f 100644
--- a/lib/tpm-common.c
+++ b/lib/tpm-common.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/unaligned.h>
 #include <tpm-common.h>
 #include "tpm-utils.h"
diff --git a/lib/tpm-v1.c b/lib/tpm-v1.c
index b4498e6..a846fe0 100644
--- a/lib/tpm-v1.c
+++ b/lib/tpm-v1.c
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <asm/unaligned.h>
 #include <u-boot/sha1.h>
 #include <tpm-common.h>
diff --git a/lib/tpm-v2.c b/lib/tpm-v2.c
index f89592d..5a039f6 100644
--- a/lib/tpm-v2.c
+++ b/lib/tpm-v2.c
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <tpm-common.h>
 #include <tpm-v2.h>
+#include <linux/bitops.h>
 #include "tpm-utils.h"
 
 u32 tpm2_startup(struct udevice *dev, enum tpm2_startup_types mode)
diff --git a/lib/uuid.c b/lib/uuid.c
index c1cb9df..e62d5ca 100644
--- a/lib/uuid.c
+++ b/lib/uuid.c
@@ -4,8 +4,11 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <env.h>
+#include <rand.h>
 #include <time.h>
+#include <uuid.h>
 #include <linux/ctype.h>
 #include <errno.h>
 #include <common.h>
@@ -284,7 +287,7 @@
 }
 
 #if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_CMD_UUID)
-int do_uuid(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_uuid(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	char uuid[UUID_STR_LEN + 1];
 	int str_format;
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index b4edee2..de9ef90 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -19,6 +19,7 @@
 #include <div64.h>
 #include <hexdump.h>
 #include <stdarg.h>
+#include <uuid.h>
 #include <vsprintf.h>
 #include <linux/ctype.h>
 #include <linux/err.h>
diff --git a/net/arp.c b/net/arp.c
index b49c3d3..1d06ed2 100644
--- a/net/arp.c
+++ b/net/arp.c
@@ -10,6 +10,10 @@
  */
 
 #include <common.h>
+#include <env.h>
+#include <log.h>
+#include <net.h>
+#include <linux/delay.h>
 
 #include "arp.h"
 
diff --git a/net/bootp.c b/net/bootp.c
index 5054891..de3dab4 100644
--- a/net/bootp.c
+++ b/net/bootp.c
@@ -9,10 +9,15 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <env.h>
 #include <efi_loader.h>
+#include <log.h>
 #include <net.h>
+#include <rand.h>
+#include <uuid.h>
+#include <linux/delay.h>
 #include <net/tftp.h>
 #include "bootp.h"
 #ifdef CONFIG_LED_STATUS
diff --git a/net/dns.c b/net/dns.c
index 67d761d..e35c4dc 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -25,6 +25,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <net.h>
 #include <asm/unaligned.h>
 
diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index 48560d5..7f89f65 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -6,8 +6,10 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <env.h>
+#include <log.h>
 #include <net.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
diff --git a/net/eth_common.c b/net/eth_common.c
index ed26b1b..58f899a 100644
--- a/net/eth_common.c
+++ b/net/eth_common.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <dm.h>
 #include <env.h>
 #include <miiphy.h>
diff --git a/net/eth_legacy.c b/net/eth_legacy.c
index 5d6b0d7..35f8d39 100644
--- a/net/eth_legacy.c
+++ b/net/eth_legacy.c
@@ -6,10 +6,13 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <env.h>
+#include <log.h>
 #include <net.h>
 #include <phy.h>
+#include <linux/bug.h>
 #include <linux/errno.h>
 #include <net/pcap.h>
 #include "eth_internal.h"
diff --git a/net/fastboot.c b/net/fastboot.c
index 8afc552..0c57fb9 100644
--- a/net/fastboot.c
+++ b/net/fastboot.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <command.h>
 #include <fastboot.h>
 #include <net.h>
 #include <net/fastboot.h>
diff --git a/net/link_local.c b/net/link_local.c
index 1986b9b..8aec3c7 100644
--- a/net/link_local.c
+++ b/net/link_local.c
@@ -13,6 +13,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <log.h>
 #include <net.h>
 #include <rand.h>
 #include "arp.h"
diff --git a/net/mdio-mux-uclass.c b/net/mdio-mux-uclass.c
index e425207..6674eb6 100644
--- a/net/mdio-mux-uclass.c
+++ b/net/mdio-mux-uclass.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <miiphy.h>
 #include <dm/device-internal.h>
 #include <dm/uclass-internal.h>
diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
index 8e78721..66ee2e1 100644
--- a/net/mdio-uclass.c
+++ b/net/mdio-uclass.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <miiphy.h>
 #include <dm/device-internal.h>
diff --git a/net/net.c b/net/net.c
index 087d399..3793291 100644
--- a/net/net.c
+++ b/net/net.c
@@ -88,12 +88,14 @@
 
 
 #include <common.h>
+#include <bootstage.h>
 #include <command.h>
 #include <console.h>
 #include <env.h>
 #include <env_internal.h>
 #include <errno.h>
 #include <image.h>
+#include <log.h>
 #include <net.h>
 #include <net/fastboot.h>
 #include <net/tftp.h>
diff --git a/net/nfs.c b/net/nfs.c
index 72e1018..70d0e08 100644
--- a/net/nfs.c
+++ b/net/nfs.c
@@ -30,6 +30,7 @@
 #include <command.h>
 #include <flash.h>
 #include <image.h>
+#include <log.h>
 #include <net.h>
 #include <malloc.h>
 #include <mapmem.h>
diff --git a/net/ping.c b/net/ping.c
index 633c942..0e33660 100644
--- a/net/ping.c
+++ b/net/ping.c
@@ -11,6 +11,8 @@
 
 #include "ping.h"
 #include "arp.h"
+#include <log.h>
+#include <net.h>
 
 static ushort ping_seq_number;
 
diff --git a/net/rarp.c b/net/rarp.c
index c1d9fca..a676a42 100644
--- a/net/rarp.c
+++ b/net/rarp.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <net.h>
 #include <net/tftp.h>
 #include "nfs.h"
diff --git a/net/sntp.c b/net/sntp.c
index 9c8ee34..39d7664 100644
--- a/net/sntp.c
+++ b/net/sntp.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <dm.h>
+#include <log.h>
 #include <net.h>
 #include <rtc.h>
 
diff --git a/net/tftp.c b/net/tftp.c
index be24e63..180140e 100644
--- a/net/tftp.c
+++ b/net/tftp.c
@@ -11,6 +11,8 @@
 #include <efi_loader.h>
 #include <env.h>
 #include <image.h>
+#include <lmb.h>
+#include <log.h>
 #include <mapmem.h>
 #include <net.h>
 #include <net/tftp.h>
diff --git a/post/cpu/mpc83xx/ecc.c b/post/cpu/mpc83xx/ecc.c
index 16210c6..cc971a8 100644
--- a/post/cpu/mpc83xx/ecc.c
+++ b/post/cpu/mpc83xx/ecc.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <cpu_func.h>
 #include <irq_func.h>
+#include <log.h>
 #include <mpc83xx.h>
 #include <watchdog.h>
 #include <asm/io.h>
diff --git a/post/drivers/i2c.c b/post/drivers/i2c.c
index 8b7967c..3b37892 100644
--- a/post/drivers/i2c.c
+++ b/post/drivers/i2c.c
@@ -22,6 +22,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <post.h>
 #include <i2c.h>
 
diff --git a/post/drivers/memory.c b/post/drivers/memory.c
index 571394d..9cc48b1 100644
--- a/post/drivers/memory.c
+++ b/post/drivers/memory.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 
 /* Memory test
  *
diff --git a/post/lib_powerpc/multi.c b/post/lib_powerpc/multi.c
index 7807eb1..f082e4c 100644
--- a/post/lib_powerpc/multi.c
+++ b/post/lib_powerpc/multi.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <irq_func.h>
+#include <log.h>
 
 /*
  * CPU test
diff --git a/post/post.c b/post/post.c
index 696a60f..6687e0b 100644
--- a/post/post.c
+++ b/post/post.c
@@ -5,7 +5,9 @@
  */
 
 #include <common.h>
+#include <bootstage.h>
 #include <env.h>
+#include <log.h>
 #include <malloc.h>
 #include <stdio_dev.h>
 #include <time.h>
diff --git a/test/bloblist.c b/test/bloblist.c
index bdcca02..4e537ee 100644
--- a/test/bloblist.c
+++ b/test/bloblist.c
@@ -234,7 +234,8 @@
 
 BLOBLIST_TEST(bloblist_test_checksum, 0);
 
-int do_ut_bloblist(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ut_bloblist(struct cmd_tbl *cmdtp, int flag, int argc,
+		   char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test,
 						 bloblist_test);
diff --git a/test/cmd_ut.c b/test/cmd_ut.c
index bd20a69..cc9543c 100644
--- a/test/cmd_ut.c
+++ b/test/cmd_ut.c
@@ -9,11 +9,12 @@
 #include <test/suites.h>
 #include <test/test.h>
 
-static int do_ut_all(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]);
+static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[]);
 
 int cmd_ut_category(const char *name, const char *prefix,
 		    struct unit_test *tests, int n_ents,
-		    int argc, char * const argv[])
+		    int argc, char *const argv[])
 {
 	struct unit_test_state uts = { .fail_count = 0 };
 	struct unit_test *test;
@@ -43,7 +44,7 @@
 	return uts.fail_count ? CMD_RET_FAILURE : 0;
 }
 
-static cmd_tbl_t cmd_ut_sub[] = {
+static struct cmd_tbl cmd_ut_sub[] = {
 	U_BOOT_CMD_MKENT(all, CONFIG_SYS_MAXARGS, 1, do_ut_all, "", ""),
 #if defined(CONFIG_UT_DM)
 	U_BOOT_CMD_MKENT(dm, CONFIG_SYS_MAXARGS, 1, do_ut_dm, "", ""),
@@ -79,7 +80,8 @@
 #endif
 };
 
-static int do_ut_all(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ut_all(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	int i;
 	int retval;
@@ -95,9 +97,9 @@
 	return any_fail;
 }
 
-static int do_ut(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ut(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
-	cmd_tbl_t *cp;
+	struct cmd_tbl *cp;
 
 	if (argc < 2)
 		return CMD_RET_USAGE;
diff --git a/test/command_ut.c b/test/command_ut.c
index 8e268e5..9837d10 100644
--- a/test/command_ut.c
+++ b/test/command_ut.c
@@ -7,12 +7,15 @@
 
 #include <common.h>
 #include <command.h>
+#include <env.h>
+#include <log.h>
 
 static const char test_cmd[] = "setenv list 1\n setenv list ${list}2; "
 		"setenv list ${list}3\0"
 		"setenv list ${list}4";
 
-static int do_ut_cmd(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+static int do_ut_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+		     char *const argv[])
 {
 	printf("%s: Testing commands\n", __func__);
 	run_command("env default -f -a", 0);
diff --git a/test/compression.c b/test/compression.c
index 63f929f..ad719dd 100644
--- a/test/compression.c
+++ b/test/compression.c
@@ -7,6 +7,8 @@
 #include <bootm.h>
 #include <command.h>
 #include <gzip.h>
+#include <image.h>
+#include <log.h>
 #include <lz4.h>
 #include <malloc.h>
 #include <mapmem.h>
@@ -534,7 +536,8 @@
 }
 COMPRESSION_TEST(compression_test_bootm_none, 0);
 
-int do_ut_compression(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_compression(struct cmd_tbl *cmdtp, int flag, int argc,
+		      char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test,
 						 compression_test);
diff --git a/test/dm/axi.c b/test/dm/axi.c
index e234ab8..289f07a 100644
--- a/test/dm/axi.c
+++ b/test/dm/axi.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <axi.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/test.h>
 #include <test/ut.h>
 #include <asm/axi.h>
diff --git a/test/dm/blk.c b/test/dm/blk.c
index 9c71adc..94b2855 100644
--- a/test/dm/blk.c
+++ b/test/dm/blk.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <part.h>
 #include <usb.h>
 #include <asm/state.h>
 #include <dm/test.h>
diff --git a/test/dm/board.c b/test/dm/board.c
index 0f267a1..5472c65 100644
--- a/test/dm/board.c
+++ b/test/dm/board.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/test.h>
 #include <board.h>
 #include <test/ut.h>
diff --git a/test/dm/bootcount.c b/test/dm/bootcount.c
index 0817b7d..be0c278 100644
--- a/test/dm/bootcount.c
+++ b/test/dm/bootcount.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <bootcount.h>
+#include <log.h>
 #include <asm/test.h>
 #include <dm/test.h>
 #include <test/ut.h>
diff --git a/test/dm/bus.c b/test/dm/bus.c
index 1ad45ad..73eb3ae 100644
--- a/test/dm/bus.c
+++ b/test/dm/bus.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #ifdef CONFIG_SANDBOX
+#include <log.h>
 #include <os.h>
 #endif
 #include <dm.h>
diff --git a/test/dm/clk.c b/test/dm/clk.c
index 003b789..48fc3dd 100644
--- a/test/dm/clk.c
+++ b/test/dm/clk.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/clk.h>
 #include <dm/test.h>
diff --git a/test/dm/core.c b/test/dm/core.c
index f74c430..6a930ae 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -9,6 +9,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device-internal.h>
 #include <dm/root.h>
diff --git a/test/dm/cpu.c b/test/dm/cpu.c
index def9b64..46683d8 100644
--- a/test/dm/cpu.c
+++ b/test/dm/cpu.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/test.h>
 #include <dm/uclass-internal.h>
 #include <cpu.h>
diff --git a/test/dm/devres.c b/test/dm/devres.c
index cbd0972..b5de0cb 100644
--- a/test/dm/devres.c
+++ b/test/dm/devres.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <errno.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device-internal.h>
 #include <dm/devres.h>
diff --git a/test/dm/eth.c b/test/dm/eth.c
index ad5354b..99c1672 100644
--- a/test/dm/eth.c
+++ b/test/dm/eth.c
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <env.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <net.h>
 #include <dm/test.h>
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index 7c18e5c..b5ee4e4 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <fdtdec.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/root.h>
 #include <dm/test.h>
diff --git a/test/dm/mdio.c b/test/dm/mdio.c
index dc229ae..ba1b54f 100644
--- a/test/dm/mdio.c
+++ b/test/dm/mdio.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/test.h>
 #include <misc.h>
 #include <test/ut.h>
diff --git a/test/dm/mmc.c b/test/dm/mmc.c
index 9ab0db1..49402b9 100644
--- a/test/dm/mmc.c
+++ b/test/dm/mmc.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <dm.h>
 #include <mmc.h>
+#include <part.h>
 #include <dm/test.h>
 #include <test/ut.h>
 
diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c
index 07d5c7d..1114f34 100644
--- a/test/dm/ofnode.c
+++ b/test/dm/ofnode.c
@@ -2,6 +2,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <dm/of_extra.h>
 #include <dm/test.h>
 #include <test/ut.h>
diff --git a/test/dm/phy.c b/test/dm/phy.c
index 92455d9..99f0119 100644
--- a/test/dm/phy.c
+++ b/test/dm/phy.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <generic-phy.h>
+#include <log.h>
 #include <dm/test.h>
 #include <test/ut.h>
 
diff --git a/test/dm/regmap.c b/test/dm/regmap.c
index b21f667..809494d 100644
--- a/test/dm/regmap.c
+++ b/test/dm/regmap.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <mapmem.h>
 #include <regmap.h>
 #include <syscon.h>
diff --git a/test/dm/regulator.c b/test/dm/regulator.c
index b967902..ca916ee 100644
--- a/test/dm/regulator.c
+++ b/test/dm/regulator.c
@@ -10,6 +10,7 @@
 #include <errno.h>
 #include <dm.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/device-internal.h>
 #include <dm/root.h>
diff --git a/test/dm/reset.c b/test/dm/reset.c
index 8370820..871d640 100644
--- a/test/dm/reset.c
+++ b/test/dm/reset.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <reset.h>
 #include <dm/test.h>
diff --git a/test/dm/rng.c b/test/dm/rng.c
index ce20e2d..583ce9e 100644
--- a/test/dm/rng.c
+++ b/test/dm/rng.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <rng.h>
 #include <dm/test.h>
 #include <test/ut.h>
diff --git a/test/dm/rtc.c b/test/dm/rtc.c
index 7188742..88f8658 100644
--- a/test/dm/rtc.c
+++ b/test/dm/rtc.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <dm.h>
 #include <i2c.h>
+#include <log.h>
 #include <rtc.h>
 #include <asm/io.h>
 #include <asm/test.h>
diff --git a/test/dm/serial.c b/test/dm/serial.c
index c6be6ab..6237693 100644
--- a/test/dm/serial.c
+++ b/test/dm/serial.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <serial.h>
 #include <dm.h>
 #include <dm/test.h>
diff --git a/test/dm/syscon.c b/test/dm/syscon.c
index f1021f3..06a1c69 100644
--- a/test/dm/syscon.c
+++ b/test/dm/syscon.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <syscon.h>
 #include <regmap.h>
 #include <asm/test.h>
diff --git a/test/dm/tee.c b/test/dm/tee.c
index d40f13d..632e996 100644
--- a/test/dm/tee.c
+++ b/test/dm/tee.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/test.h>
 #include <sandboxtee.h>
diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c
index abb5b71..ba85fa3 100644
--- a/test/dm/test-driver.c
+++ b/test/dm/test-driver.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/test.h>
 #include <test/ut.h>
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 1128c42..4fcae03 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -7,6 +7,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/io.h>
 #include <dm/test.h>
diff --git a/test/dm/test-main.c b/test/dm/test-main.c
index d7dc8d1f..53e5ca3 100644
--- a/test/dm/test-main.c
+++ b/test/dm/test-main.c
@@ -8,6 +8,7 @@
 #include <console.h>
 #include <dm.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <asm/state.h>
 #include <dm/test.h>
@@ -200,7 +201,7 @@
 	return uts->fail_count ? CMD_RET_FAILURE : 0;
 }
 
-int do_ut_dm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_dm(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	const char *test_name = NULL;
 
diff --git a/test/dm/test-uclass.c b/test/dm/test-uclass.c
index 25271c6..b6d629a 100644
--- a/test/dm/test-uclass.c
+++ b/test/dm/test-uclass.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm.h>
 #include <errno.h>
diff --git a/test/dm/usb.c b/test/dm/usb.c
index e396c2a..a25c2c1 100644
--- a/test/dm/usb.c
+++ b/test/dm/usb.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <console.h>
 #include <dm.h>
+#include <part.h>
 #include <usb.h>
 #include <asm/io.h>
 #include <asm/state.h>
diff --git a/test/dm/video.c b/test/dm/video.c
index f72979f..0664e3f 100644
--- a/test/dm/video.c
+++ b/test/dm/video.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <bzlib.h>
 #include <dm.h>
+#include <log.h>
 #include <malloc.h>
 #include <mapmem.h>
 #include <os.h>
diff --git a/test/env/cmd_ut_env.c b/test/env/cmd_ut_env.c
index ad67dbe..a440b1b 100644
--- a/test/env/cmd_ut_env.c
+++ b/test/env/cmd_ut_env.c
@@ -10,7 +10,7 @@
 #include <test/suites.h>
 #include <test/ut.h>
 
-int do_ut_env(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_env(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test, env_test);
 	const int n_ents = ll_entry_count(struct unit_test, env_test);
diff --git a/test/env/hashtable.c b/test/env/hashtable.c
index 5242c4c..339cc19 100644
--- a/test/env/hashtable.c
+++ b/test/env/hashtable.c
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <search.h>
 #include <stdio.h>
 #include <test/env.h>
diff --git a/test/lib/cmd_ut_lib.c b/test/lib/cmd_ut_lib.c
index c73e8d7..f5c7bf3 100644
--- a/test/lib/cmd_ut_lib.c
+++ b/test/lib/cmd_ut_lib.c
@@ -11,7 +11,7 @@
 #include <test/suites.h>
 #include <test/ut.h>
 
-int do_ut_lib(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_lib(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test, lib_test);
 	const int n_ents = ll_entry_count(struct unit_test, lib_test);
diff --git a/test/lib/lmb.c b/test/lib/lmb.c
index 1336b54..a0fe0f6 100644
--- a/test/lib/lmb.c
+++ b/test/lib/lmb.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <lmb.h>
+#include <log.h>
 #include <malloc.h>
 #include <dm/test.h>
 #include <test/ut.h>
diff --git a/test/lib/string.c b/test/lib/string.c
index 8e246ab..64234be 100644
--- a/test/lib/string.c
+++ b/test/lib/string.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <log.h>
 #include <test/lib.h>
 #include <test/test.h>
 #include <test/ut.h>
diff --git a/test/lib/test_aes.c b/test/lib/test_aes.c
index fb8a0b1..cbc712f 100644
--- a/test/lib/test_aes.c
+++ b/test/lib/test_aes.c
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <hexdump.h>
+#include <rand.h>
 #include <uboot_aes.h>
 #include <test/lib.h>
 #include <test/test.h>
diff --git a/test/log/log_test.c b/test/log/log_test.c
index febc2c1..4245372 100644
--- a/test/log/log_test.c
+++ b/test/log/log_test.c
@@ -7,6 +7,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 
 /* emit some sample log records in different ways, for testing */
 static int log_run(enum uclass_id cat, const char *file)
@@ -200,7 +202,7 @@
 }
 
 #ifdef CONFIG_LOG_TEST
-int do_log_test(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_log_test(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int testnum = 0;
 	int ret;
diff --git a/test/log/test-main.c b/test/log/test-main.c
index 855de47..c534add 100644
--- a/test/log/test-main.c
+++ b/test/log/test-main.c
@@ -7,10 +7,11 @@
 
 #include <common.h>
 #include <console.h>
+#include <log.h>
 #include <test/log.h>
 #include <test/suites.h>
 
-int do_ut_log(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_log(struct cmd_tbl *cmdtp, int flag, int argc, char * const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test, log_test);
 	const int n_ents = ll_entry_count(struct unit_test, log_test);
diff --git a/test/optee/cmd_ut_optee.c b/test/optee/cmd_ut_optee.c
index 0927103..9fa4c91 100644
--- a/test/optee/cmd_ut_optee.c
+++ b/test/optee/cmd_ut_optee.c
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <errno.h>
 #include <fdt_support.h>
+#include <log.h>
 #include <malloc.h>
 #include <tee/optee.h>
 
@@ -91,7 +92,7 @@
 }
 OPTEE_TEST(optee_fdt_protected_memory, 0);
 
-int do_ut_optee(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_optee(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test,
 						 optee_test);
diff --git a/test/overlay/cmd_ut_overlay.c b/test/overlay/cmd_ut_overlay.c
index d0083fd6b..c001fb1 100644
--- a/test/overlay/cmd_ut_overlay.c
+++ b/test/overlay/cmd_ut_overlay.c
@@ -8,6 +8,8 @@
 #include <command.h>
 #include <errno.h>
 #include <fdt_support.h>
+#include <image.h>
+#include <log.h>
 #include <malloc.h>
 
 #include <linux/sizes.h>
@@ -209,7 +211,7 @@
 }
 OVERLAY_TEST(fdt_overlay_stacked, 0);
 
-int do_ut_overlay(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_overlay(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test,
 						 overlay_test);
diff --git a/test/print_ut.c b/test/print_ut.c
index a3b9974..a456a44 100644
--- a/test/print_ut.c
+++ b/test/print_ut.c
@@ -7,9 +7,11 @@
 
 #include <common.h>
 #if CONFIG_IS_ENABLED(EFI_LOADER) && !defined(API_BUILD)
+#include <command.h>
 #include <efi_api.h>
 #endif
 #include <display_options.h>
+#include <log.h>
 #include <version.h>
 
 #define FAKE_BUILD_TAG	"jenkins-u-boot-denx_uboot_dm-master-build-aarch64" \
@@ -68,7 +70,7 @@
 #endif
 }
 
-static int do_ut_print(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_ut_print(struct cmd_tbl *cmdtp, int flag, int argc,
 		       char *const argv[])
 {
 	char big_str[400];
diff --git a/test/str_ut.c b/test/str_ut.c
index 7c80150..ef1205d 100644
--- a/test/str_ut.c
+++ b/test/str_ut.c
@@ -105,7 +105,7 @@
 }
 STR_TEST(str_simple_strtoul, 0);
 
-int do_ut_str(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+int do_ut_str(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test,
 						 str_test);
diff --git a/test/time_ut.c b/test/time_ut.c
index 40a19a5..80b82db 100644
--- a/test/time_ut.c
+++ b/test/time_ut.c
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <errno.h>
 #include <time.h>
+#include <linux/delay.h>
 
 static int test_get_timer(void)
 {
@@ -117,7 +118,7 @@
 	return 0;
 }
 
-int do_ut_time(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_time(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	int ret = 0;
 
diff --git a/test/unicode_ut.c b/test/unicode_ut.c
index d8b4aa9..5f932bf 100644
--- a/test/unicode_ut.c
+++ b/test/unicode_ut.c
@@ -9,6 +9,7 @@
 #include <charset.h>
 #include <command.h>
 #include <errno.h>
+#include <log.h>
 #include <malloc.h>
 #include <test/test.h>
 #include <test/suites.h>
@@ -591,7 +592,7 @@
 }
 UNICODE_TEST(unicode_test_u16_strsize);
 
-int do_ut_unicode(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+int do_ut_unicode(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[])
 {
 	struct unit_test *tests = ll_entry_start(struct unit_test, unicode_test);
 	const int n_ents = ll_entry_count(struct unit_test, unicode_test);
diff --git a/tools/imx8image.c b/tools/imx8image.c
index 1b428c3..133780f 100644
--- a/tools/imx8image.c
+++ b/tools/imx8image.c
@@ -6,6 +6,7 @@
  */
 
 #include "imx8image.h"
+#include <image.h>
 
 static int p_idx;
 static int sector_size;
diff --git a/tools/proftool.c b/tools/proftool.c
index fecb9d6..ea7d07a 100644
--- a/tools/proftool.c
+++ b/tools/proftool.c
@@ -532,7 +532,7 @@
 	return 0;
 }
 
-static int prof_tool(int argc, char * const argv[],
+static int prof_tool(int argc, char *const argv[],
 		     const char *prof_fname, const char *map_fname,
 		     const char *trace_config_fname)
 {