common: Drop asm/global_data.h from common header

Move this out of the common header and include it only where needed.  In
a number of cases this requires adding "struct udevice;" to avoid adding
another large header or in other cases replacing / adding missing header
files that had been pulled in, very indirectly.   Finally, we have a few
cases where we did not need to include <asm/global_data.h> at all, so
remove that include.

Signed-off-by: Simon Glass <sjg@chromium.org>
Signed-off-by: Tom Rini <trini@konsulko.com>
diff --git a/cmd/acpi.c b/cmd/acpi.c
index a3419b4..157261b 100644
--- a/cmd/acpi.c
+++ b/cmd/acpi.c
@@ -8,6 +8,7 @@
 #include <mapmem.h>
 #include <acpi/acpi_table.h>
 #include <asm/acpi_table.h>
+#include <asm/global_data.h>
 #include <dm/acpi.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index 8d8daa6..84dab7d 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -15,6 +15,7 @@
 #include <video.h>
 #include <vsprintf.h>
 #include <asm/cache.h>
+#include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/cmd/bedbug.c b/cmd/bedbug.c
index 684e4a9..bef617b 100644
--- a/cmd/bedbug.c
+++ b/cmd/bedbug.c
@@ -6,6 +6,7 @@
 #include <cli.h>
 #include <command.h>
 #include <console.h>
+#include <asm/global_data.h>
 #include <asm/ptrace.h>
 #include <linux/ctype.h>
 #include <net.h>
diff --git a/cmd/bloblist.c b/cmd/bloblist.c
index bb2e682..97b5734 100644
--- a/cmd/bloblist.c
+++ b/cmd/bloblist.c
@@ -9,6 +9,7 @@
 #include <common.h>
 #include <bloblist.h>
 #include <command.h>
+#include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 81dd8e0..1583a96 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -19,6 +19,7 @@
 #include <image.h>
 #include <log.h>
 #include <malloc.h>
+#include <asm/global_data.h>
 #include <linux/libfdt.h>
 #include <linux/libfdt_env.h>
 #include <mapmem.h>
diff --git a/cmd/booti.c b/cmd/booti.c
index 76d1255..3df70ea 100644
--- a/cmd/booti.c
+++ b/cmd/booti.c
@@ -12,6 +12,7 @@
 #include <lmb.h>
 #include <log.h>
 #include <mapmem.h>
+#include <asm/global_data.h>
 #include <linux/kernel.h>
 #include <linux/sizes.h>
 
diff --git a/cmd/bootm.c b/cmd/bootm.c
index e6b0e04..7732b97 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -16,6 +16,7 @@
 #include <malloc.h>
 #include <nand.h>
 #include <asm/byteorder.h>
+#include <asm/global_data.h>
 #include <linux/ctype.h>
 #include <linux/err.h>
 #include <u-boot/zlib.h>
diff --git a/cmd/date.c b/cmd/date.c
index 75a032c..0e11894 100644
--- a/cmd/date.c
+++ b/cmd/date.c
@@ -12,6 +12,7 @@
 #include <dm.h>
 #include <rtc.h>
 #include <i2c.h>
+#include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/cmd/efi.c b/cmd/efi.c
index 1558cb1..f2ed26b 100644
--- a/cmd/efi.c
+++ b/cmd/efi.c
@@ -11,6 +11,7 @@
 #include <log.h>
 #include <malloc.h>
 #include <sort.h>
+#include <asm/global_data.h>
 
 static const char *const type_name[] = {
 	"reserved",
diff --git a/cmd/load.c b/cmd/load.c
index f252c74..5bbc39b 100644
--- a/cmd/load.c
+++ b/cmd/load.c
@@ -20,6 +20,7 @@
 #include <serial.h>
 #include <xyzModem.h>
 #include <asm/cache.h>
+#include <asm/global_data.h>
 #include <linux/delay.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/cmd/log.c b/cmd/log.c
index ca1c51e..72380c5 100644
--- a/cmd/log.c
+++ b/cmd/log.c
@@ -10,6 +10,7 @@
 #include <getopt.h>
 #include <log.h>
 #include <malloc.h>
+#include <asm/global_data.h>
 
 static char log_fmt_chars[LOGF_COUNT] = "clFLfm";
 
diff --git a/cmd/mem.c b/cmd/mem.c
index 1d4f2ba..1eb83b7 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -22,6 +22,7 @@
 #include <mapmem.h>
 #include <rand.h>
 #include <watchdog.h>
+#include <asm/global_data.h>
 #include <asm/io.h>
 #include <linux/bitops.h>
 #include <linux/compiler.h>
diff --git a/cmd/mtdparts.c b/cmd/mtdparts.c
index 5220142..ed373a8 100644
--- a/cmd/mtdparts.c
+++ b/cmd/mtdparts.c
@@ -75,6 +75,7 @@
 #include <env.h>
 #include <log.h>
 #include <malloc.h>
+#include <asm/global_data.h>
 #include <jffs2/load_kernel.h>
 #include <linux/list.h>
 #include <linux/ctype.h>
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index d0d2eca..d14ba10 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -35,6 +35,7 @@
 #include <errno.h>
 #include <malloc.h>
 #include <mapmem.h>
+#include <asm/global_data.h>
 #include <linux/bitops.h>
 #include <u-boot/crc.h>
 #include <watchdog.h>
diff --git a/cmd/pstore.c b/cmd/pstore.c
index 9a8b38c..5656bae 100644
--- a/cmd/pstore.c
+++ b/cmd/pstore.c
@@ -5,6 +5,7 @@
 
 #include <config.h>
 #include <command.h>
+#include <fdtdec.h>
 #include <fs.h>
 #include <log.h>
 #include <mapmem.h>
diff --git a/cmd/pxe_utils.h b/cmd/pxe_utils.h
index 6af9523..bf58e15 100644
--- a/cmd/pxe_utils.h
+++ b/cmd/pxe_utils.h
@@ -3,6 +3,8 @@
 #ifndef __PXE_UTILS_H
 #define __PXE_UTILS_H
 
+#include <linux/list.h>
+
 /*
  * A note on the pxe file parser.
  *
diff --git a/cmd/sb.c b/cmd/sb.c
index f7eb921..0d55818 100644
--- a/cmd/sb.c
+++ b/cmd/sb.c
@@ -8,6 +8,7 @@
 #include <command.h>
 #include <dm.h>
 #include <spl.h>
+#include <asm/global_data.h>
 #include <asm/state.h>
 
 static int do_sb_handoff(struct cmd_tbl *cmdtp, int flag, int argc,
diff --git a/cmd/sound.c b/cmd/sound.c
index 7fc1967..fdcde36 100644
--- a/cmd/sound.c
+++ b/cmd/sound.c
@@ -9,6 +9,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <sound.h>
+#include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/cmd/spl.c b/cmd/spl.c
index 28b40dd..472703f 100644
--- a/cmd/spl.c
+++ b/cmd/spl.c
@@ -10,6 +10,7 @@
 #include <env.h>
 #include <image.h>
 #include <log.h>
+#include <asm/global_data.h>
 #include <linux/libfdt.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/cmd/ti/ddr3.c b/cmd/ti/ddr3.c
index 623b63b..6b43a73 100644
--- a/cmd/ti/ddr3.c
+++ b/cmd/ti/ddr3.c
@@ -14,6 +14,7 @@
 #include <asm/emif.h>
 #include <common.h>
 #include <command.h>
+#include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/cmd/tlv_eeprom.c b/cmd/tlv_eeprom.c
index eab0531..5099cbd 100644
--- a/cmd/tlv_eeprom.c
+++ b/cmd/tlv_eeprom.c
@@ -17,6 +17,7 @@
 #include <env.h>
 #include <init.h>
 #include <net.h>
+#include <asm/global_data.h>
 #include <linux/ctype.h>
 #include <u-boot/crc.h>
 
diff --git a/cmd/x86/fsp.c b/cmd/x86/fsp.c
index 8017eda..82e4415 100644
--- a/cmd/x86/fsp.c
+++ b/cmd/x86/fsp.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <command.h>
 #include <asm/fsp/fsp_support.h>
+#include <asm/global_data.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
diff --git a/cmd/x86/hob.c b/cmd/x86/hob.c
index 9e555c7..01db93e 100644
--- a/cmd/x86/hob.c
+++ b/cmd/x86/hob.c
@@ -7,6 +7,7 @@
 #include <command.h>
 #include <efi.h>
 #include <uuid.h>
+#include <asm/global_data.h>
 #include <asm/hob.h>
 #include <asm/fsp/fsp_hob.h>