common: Make sure arch-specific map_sysmem() is defined
authorJoe Hershberger <joe.hershberger@ni.com>
Sun, 22 Mar 2015 22:08:59 +0000 (17:08 -0500)
committerSimon Glass <sjg@chromium.org>
Sat, 18 Apr 2015 17:11:09 +0000 (11:11 -0600)
In the case where the arch defines a custom map_sysmem(), make sure that
including just mapmem.h is sufficient to have these functions as they
are when the arch does not override it.

Also split the non-arch specific functions out of common.h

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
36 files changed:
arch/arm/lib/bootm.c
common/board_f.c
common/board_r.c
common/bootm.c
common/cmd_bootm.c
common/cmd_demo.c
common/cmd_fat.c
common/cmd_fdt.c
common/cmd_lzmadec.c
common/cmd_md5sum.c
common/cmd_mem.c
common/cmd_nvedit.c
common/cmd_pxe.c
common/cmd_sf.c
common/cmd_source.c
common/cmd_trace.c
common/cmd_ximg.c
common/hash.c
common/image-fdt.c
common/image-fit.c
common/image.c
common/iotrace.c
common/lcd.c
common/malloc_simple.c
drivers/demo/demo-simple.c
drivers/i2c/i2c-uniphier-f.c
drivers/i2c/i2c-uniphier.c
drivers/mtd/spi/sf_probe.c
drivers/serial/ns16550.c
drivers/serial/serial_uniphier.c
fs/fs.c
include/common.h
include/mapmem.h [new file with mode: 0644]
lib/trace.c
test/compression.c
test/dm/cmd_dm.c

index 2d6b676..b1bff8c 100644 (file)
@@ -18,6 +18,7 @@
 #include <u-boot/zlib.h>
 #include <asm/byteorder.h>
 #include <libfdt.h>
+#include <mapmem.h>
 #include <fdt_support.h>
 #include <asm/bootm.h>
 #include <asm/secure.h>
index a570390..775df14 100644 (file)
@@ -23,6 +23,7 @@
 #include <i2c.h>
 #include <initcall.h>
 #include <logbuff.h>
+#include <mapmem.h>
 
 /* TODO: Can we move these into arch/ headers? */
 #ifdef CONFIG_8xx
index af01e1c..514bac8 100644 (file)
@@ -33,6 +33,7 @@
 #endif
 #include <logbuff.h>
 #include <malloc.h>
+#include <mapmem.h>
 #ifdef CONFIG_BITBANGMII
 #include <miiphy.h>
 #endif
index 34f60bb..6842029 100644 (file)
@@ -13,6 +13,7 @@
 #include <fdt_support.h>
 #include <lmb.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <asm/io.h>
 #include <linux/lzo.h>
 #include <lzma/LzmaTypes.h>
index 4f77f22..6b6aca6 100644 (file)
@@ -16,6 +16,7 @@
 #include <image.h>
 #include <lmb.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <nand.h>
 #include <asm/byteorder.h>
 #include <linux/compiler.h>
index 8a10bdf..209dc4a 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <common.h>
 #include <dm-demo.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 struct udevice *demo_dev;
index c00fb28..aae993d 100644 (file)
@@ -14,6 +14,7 @@
 #include <net.h>
 #include <ata.h>
 #include <asm/io.h>
+#include <mapmem.h>
 #include <part.h>
 #include <fat.h>
 #include <fs.h>
index 48b3e70..682b655 100644 (file)
@@ -15,6 +15,7 @@
 #include <asm/global_data.h>
 #include <libfdt.h>
 #include <fdt_support.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 #define MAX_LEVEL      32              /* how deeply nested we will go */
index 7b0b3fd..1ad9ed6 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 #include <lzma/LzmaTools.h>
index d22ace5..23bb81e 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <mapmem.h>
 #include <u-boot/md5.h>
 #include <asm/io.h>
 
index 1cbf84f..45e471c 100644 (file)
@@ -20,6 +20,7 @@
 #endif
 #include <hash.h>
 #include <inttypes.h>
+#include <mapmem.h>
 #include <watchdog.h>
 #include <asm/io.h>
 #include <linux/compiler.h>
index 855808c..be792ae 100644 (file)
@@ -31,6 +31,7 @@
 #include <search.h>
 #include <errno.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <watchdog.h>
 #include <linux/stddef.h>
 #include <asm/byteorder.h>
index 7e32c95..96f963d 100644 (file)
@@ -8,6 +8,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
 #include <errno.h>
index 20f14d3..6aabf39 100644 (file)
@@ -10,6 +10,7 @@
 #include <div64.h>
 #include <dm.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <spi.h>
 #include <spi_flash.h>
 
index 6881bc9..d2a881d 100644 (file)
@@ -19,6 +19,7 @@
 #include <command.h>
 #include <image.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <asm/byteorder.h>
 #include <asm/io.h>
 #if defined(CONFIG_8xx)
index 8c630e6..1e62a1a 100644 (file)
@@ -6,6 +6,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <mapmem.h>
 #include <trace.h>
 #include <asm/io.h>
 
index 64b9186..8b8645c 100644 (file)
@@ -15,6 +15,7 @@
 #include <common.h>
 #include <command.h>
 #include <image.h>
+#include <mapmem.h>
 #include <watchdog.h>
 #if defined(CONFIG_BZIP2)
 #include <bzlib.h>
index 9e9f84b..c94c98b 100644 (file)
@@ -14,6 +14,7 @@
 #include <common.h>
 #include <command.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <hw_sha.h>
 #include <asm/io.h>
 #include <asm/errno.h>
index d9e4728..7e2da7b 100644 (file)
@@ -14,6 +14,7 @@
 #include <errno.h>
 #include <image.h>
 #include <libfdt.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 #ifndef CONFIG_SYS_FDT_PAD
index 778d2a1..4eb4d42 100644 (file)
@@ -16,6 +16,7 @@
 #else
 #include <common.h>
 #include <errno.h>
+#include <mapmem.h>
 #include <asm/io.h>
 DECLARE_GLOBAL_DATA_PTR;
 #endif /* !USE_HOSTCC*/
index 162b682..abc0d89 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <environment.h>
 #include <image.h>
+#include <mapmem.h>
 
 #if defined(CONFIG_FIT) || defined(CONFIG_OF_LIBFDT)
 #include <libfdt.h>
index ced426e..2725563 100644 (file)
@@ -7,6 +7,7 @@
 #define IOTRACE_IMPL
 
 #include <common.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index f33942c..6982759 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/types.h>
 #include <stdio_dev.h>
 #include <lcd.h>
+#include <mapmem.h>
 #include <watchdog.h>
 #include <asm/unaligned.h>
 #include <splash.h>
index 64ae036..d445199 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 DECLARE_GLOBAL_DATA_PTR;
index 2bcb7df..f069748 100644 (file)
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <dm-demo.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 static int simple_hello(struct udevice *dev, int ch)
index fd28c17..d29dd45 100644 (file)
@@ -14,6 +14,7 @@
 #include <dm/root.h>
 #include <i2c.h>
 #include <fdtdec.h>
+#include <mapmem.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index 666272d..c4972ff 100644 (file)
@@ -14,6 +14,7 @@
 #include <dm/root.h>
 #include <i2c.h>
 #include <fdtdec.h>
+#include <mapmem.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
index c2dac66..d19138d 100644 (file)
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <fdtdec.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <spi.h>
 #include <spi_flash.h>
 #include <asm/io.h>
index 03beab5..67b1d60 100644 (file)
@@ -8,6 +8,7 @@
 #include <dm.h>
 #include <errno.h>
 #include <fdtdec.h>
+#include <mapmem.h>
 #include <ns16550.h>
 #include <serial.h>
 #include <watchdog.h>
index 98e3b81..74547eb 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/errno.h>
 #include <dm/device.h>
 #include <dm/platform_data/serial-uniphier.h>
+#include <mapmem.h>
 #include <serial.h>
 #include <fdtdec.h>
 
diff --git a/fs/fs.c b/fs/fs.c
index 483273f..ac0897d 100644 (file)
--- a/fs/fs.c
+++ b/fs/fs.c
@@ -17,6 +17,7 @@
 #include <config.h>
 #include <errno.h>
 #include <common.h>
+#include <mapmem.h>
 #include <part.h>
 #include <ext4fs.h>
 #include <fat.h>
index 9c0f1ba..932b2fc 100644 (file)
@@ -858,23 +858,6 @@ int cpu_disable(int nr);
 int cpu_release(int nr, int argc, char * const argv[]);
 #endif
 
-/* Define a null map_sysmem() if the architecture doesn't use it */
-# ifndef CONFIG_ARCH_MAP_SYSMEM
-static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
-{
-       return (void *)(uintptr_t)paddr;
-}
-
-static inline void unmap_sysmem(const void *vaddr)
-{
-}
-
-static inline phys_addr_t map_to_sysmem(const void *ptr)
-{
-       return (phys_addr_t)(uintptr_t)ptr;
-}
-# endif
-
 #endif /* __ASSEMBLY__ */
 
 #ifdef CONFIG_PPC
diff --git a/include/mapmem.h b/include/mapmem.h
new file mode 100644 (file)
index 0000000..42ef3e8
--- /dev/null
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2015 National Instruments
+ *
+ * (C) Copyright 2015
+ * Joe Hershberger <joe.hershberger@ni.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+
+#ifndef __MAPMEM_H
+#define __MAPMEM_H
+
+/* Define a null map_sysmem() if the architecture doesn't use it */
+# ifdef CONFIG_ARCH_MAP_SYSMEM
+#include <asm/io.h>
+# else
+static inline void *map_sysmem(phys_addr_t paddr, unsigned long len)
+{
+       return (void *)(uintptr_t)paddr;
+}
+
+static inline void unmap_sysmem(const void *vaddr)
+{
+}
+
+static inline phys_addr_t map_to_sysmem(const void *ptr)
+{
+       return (phys_addr_t)(uintptr_t)ptr;
+}
+# endif
+
+#endif /* __MAPMEM_H */
index 711e5b5..ad5e07b 100644 (file)
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <mapmem.h>
 #include <trace.h>
 #include <asm/io.h>
 #include <asm/sections.h>
index ea2e4ad..7ef3a8c 100644 (file)
@@ -10,6 +10,7 @@
 #include <bootm.h>
 #include <command.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <asm/io.h>
 
 #include <u-boot/zlib.h>
index 507f260..8d531fd 100644 (file)
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <dm.h>
 #include <malloc.h>
+#include <mapmem.h>
 #include <errno.h>
 #include <asm/io.h>
 #include <dm/root.h>