aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Glass2019-11-14 12:57:16 -0700
committerTom Rini2019-12-02 18:23:08 -0500
commit3db7110857524cf1b7d0a374c1ebcde8a2680de0 (patch)
tree050b7a36ff3a6fe08b1a5d30e00daf88c4ca5094
parentb2ea91ba57a2c3d57ec3d681b4058b115a0d3e51 (diff)
crc32: Use the crc.h header for crc functions
Drop inclusion of crc.h in common.h and use the correct header directly instead. With this we can drop the conflicting definition in fw_env.h and rely on the crc.h header, which is already included. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
-rw-r--r--api/api.c1
-rw-r--r--arch/arm/mach-meson/board-common.c1
-rw-r--r--arch/arm/mach-rockchip/misc.c1
-rw-r--r--board/CZ.NIC/turris_omnia/turris_omnia.c1
-rw-r--r--board/corscience/tricorder/tricorder-eeprom.c1
-rw-r--r--board/freescale/common/sys_eeprom.c1
-rw-r--r--board/freescale/mpc8323erdb/mpc8323erdb.c1
-rw-r--r--board/gardena/smart-gateway-mt7688/board.c1
-rw-r--r--board/gdsys/a38x/hre.c1
-rw-r--r--board/gdsys/p1022/controlcenterd-id.c1
-rw-r--r--board/sunxi/board.c1
-rw-r--r--board/theobroma-systems/puma_rk3399/puma-rk3399.c1
-rw-r--r--board/varisys/common/sys_eeprom.c1
-rw-r--r--cmd/i2c.c1
-rw-r--r--cmd/nvedit.c1
-rw-r--r--common/android_ab.c1
-rw-r--r--common/bloblist.c1
-rw-r--r--common/board_r.c1
-rw-r--r--common/hash.c1
-rw-r--r--common/image-fit.c1
-rw-r--r--common/image.c1
-rw-r--r--common/iotrace.c1
-rw-r--r--common/spl/spl.c1
-rw-r--r--disk/part_efi.c1
-rw-r--r--drivers/misc/atsha204a-i2c.c1
-rw-r--r--drivers/mtd/ubi/attach.c1
-rw-r--r--drivers/mtd/ubi/crc32.c1
-rw-r--r--drivers/mtd/ubi/eba.c1
-rw-r--r--drivers/mtd/ubi/fastmap.c1
-rw-r--r--drivers/mtd/ubi/io.c1
-rw-r--r--drivers/mtd/ubi/vtbl.c1
-rw-r--r--drivers/mtd/ubispl/ubispl.c1
-rw-r--r--drivers/net/fm/fdt.c1
-rw-r--r--drivers/net/fm/fm.c1
-rw-r--r--drivers/qe/qe.c1
-rw-r--r--env/common.c1
-rw-r--r--env/eeprom.c1
-rw-r--r--env/flash.c1
-rw-r--r--env/nand.c1
-rw-r--r--env/nvram.c1
-rw-r--r--env/remote.c1
-rw-r--r--env/sf.c1
-rw-r--r--examples/api/glue.c1
-rw-r--r--fs/jffs2/jffs2_1pass.c1
-rw-r--r--fs/ubifs/io.c1
-rw-r--r--fs/ubifs/recovery.c1
-rw-r--r--fs/ubifs/tnc.c1
-rw-r--r--include/common.h3
-rw-r--r--lib/crc32.c1
-rw-r--r--lib/efi_loader/efi_boottime.c1
-rw-r--r--lib/efi_loader/efi_runtime.c1
-rw-r--r--lib/efi_loader/efi_variable.c1
-rw-r--r--lib/efi_selftest/efi_selftest_config_table.c1
-rw-r--r--lib/efi_selftest/efi_selftest_crc32.c1
-rw-r--r--lib/gunzip.c1
-rw-r--r--lib/zlib/deflate.c1
-rw-r--r--tools/default_image.c1
-rw-r--r--tools/env/fw_env.c1
-rw-r--r--tools/env/fw_env.h2
-rw-r--r--tools/envcrc.c1
-rw-r--r--tools/mkenvimage.c1
-rw-r--r--tools/mxsimage.c1
-rw-r--r--tools/pbl_crc32.c1
-rw-r--r--tools/pblimage.c1
-rw-r--r--tools/socfpgaimage.c1
65 files changed, 63 insertions, 5 deletions
diff --git a/api/api.c b/api/api.c
index 71fa03804e6..4fc451a83d1 100644
--- a/api/api.c
+++ b/api/api.c
@@ -13,6 +13,7 @@
#include <env_internal.h>
#include <linux/types.h>
#include <api_public.h>
+#include <u-boot/crc.h>
#include "api_private.h"
diff --git a/arch/arm/mach-meson/board-common.c b/arch/arm/mach-meson/board-common.c
index d261b4ea331..6c77e379669 100644
--- a/arch/arm/mach-meson/board-common.c
+++ b/arch/arm/mach-meson/board-common.c
@@ -13,6 +13,7 @@
#include <asm/armv8/mmu.h>
#include <asm/unaligned.h>
#include <efi_loader.h>
+#include <u-boot/crc.h>
#if CONFIG_IS_ENABLED(FASTBOOT)
#include <asm/psci.h>
diff --git a/arch/arm/mach-rockchip/misc.c b/arch/arm/mach-rockchip/misc.c
index bed4317f7ec..f697e937c62 100644
--- a/arch/arm/mach-rockchip/misc.c
+++ b/arch/arm/mach-rockchip/misc.c
@@ -14,6 +14,7 @@
#include <dm.h>
#include <dm/uclass-internal.h>
#include <misc.h>
+#include <u-boot/crc.h>
#include <u-boot/sha256.h>
#include <asm/arch-rockchip/misc.h>
diff --git a/board/CZ.NIC/turris_omnia/turris_omnia.c b/board/CZ.NIC/turris_omnia/turris_omnia.c
index 1d8d08a847d..4d21e62e733 100644
--- a/board/CZ.NIC/turris_omnia/turris_omnia.c
+++ b/board/CZ.NIC/turris_omnia/turris_omnia.c
@@ -18,6 +18,7 @@
#include <dm/uclass.h>
#include <fdt_support.h>
#include <time.h>
+#include <u-boot/crc.h>
# include <atsha204a-i2c.h>
#include "../drivers/ddr/marvell/a38x/ddr3_init.h"
diff --git a/board/corscience/tricorder/tricorder-eeprom.c b/board/corscience/tricorder/tricorder-eeprom.c
index 16bceea7ba7..b28189dafdc 100644
--- a/board/corscience/tricorder/tricorder-eeprom.c
+++ b/board/corscience/tricorder/tricorder-eeprom.c
@@ -6,6 +6,7 @@
*/
#include <common.h>
#include <i2c.h>
+#include <u-boot/crc.h>
#include "tricorder-eeprom.h"
diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c
index bb655ca7447..6f151b0f717 100644
--- a/board/freescale/common/sys_eeprom.c
+++ b/board/freescale/common/sys_eeprom.c
@@ -11,6 +11,7 @@
#include <env.h>
#include <i2c.h>
#include <linux/ctype.h>
+#include <u-boot/crc.h>
#ifdef CONFIG_SYS_I2C_EEPROM_CCID
#include "../common/eeprom.h"
diff --git a/board/freescale/mpc8323erdb/mpc8323erdb.c b/board/freescale/mpc8323erdb/mpc8323erdb.c
index e5aecc4e1f2..003e95cb6ba 100644
--- a/board/freescale/mpc8323erdb/mpc8323erdb.c
+++ b/board/freescale/mpc8323erdb/mpc8323erdb.c
@@ -17,6 +17,7 @@
#include <miiphy.h>
#include <command.h>
#include <linux/libfdt.h>
+#include <u-boot/crc.h>
#if defined(CONFIG_PCI)
#include <pci.h>
#endif
diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c
index e9ffd42a8a6..fea823b2d0d 100644
--- a/board/gardena/smart-gateway-mt7688/board.c
+++ b/board/gardena/smart-gateway-mt7688/board.c
@@ -10,6 +10,7 @@
#include <net.h>
#include <spi.h>
#include <spi_flash.h>
+#include <u-boot/crc.h>
#include <uuid.h>
#include <linux/ctype.h>
#include <linux/io.h>
diff --git a/board/gdsys/a38x/hre.c b/board/gdsys/a38x/hre.c
index 82b84284ef1..027ad1f57e0 100644
--- a/board/gdsys/a38x/hre.c
+++ b/board/gdsys/a38x/hre.c
@@ -10,6 +10,7 @@
#include <i2c.h>
#include <mmc.h>
#include <tpm-v1.h>
+#include <u-boot/crc.h>
#include <u-boot/sha1.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
diff --git a/board/gdsys/p1022/controlcenterd-id.c b/board/gdsys/p1022/controlcenterd-id.c
index 43f5404231f..d6798bd3382 100644
--- a/board/gdsys/p1022/controlcenterd-id.c
+++ b/board/gdsys/p1022/controlcenterd-id.c
@@ -18,6 +18,7 @@
#include <i2c.h>
#include <mmc.h>
#include <tpm-v1.h>
+#include <u-boot/crc.h>
#include <u-boot/sha1.h>
#include <asm/byteorder.h>
#include <asm/unaligned.h>
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index e3b2d13892c..b9450a0e36b 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -24,6 +24,7 @@
#include <asm/arch/gpio.h>
#include <asm/arch/mmc.h>
#include <asm/arch/spl.h>
+#include <u-boot/crc.h>
#ifndef CONFIG_ARM64
#include <asm/armv7.h>
#endif
diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
index 47259b71496..9887d202071 100644
--- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c
+++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c
@@ -9,6 +9,7 @@
#include <misc.h>
#include <spl.h>
#include <syscon.h>
+#include <u-boot/crc.h>
#include <usb.h>
#include <dm/pinctrl.h>
#include <dm/uclass-internal.h>
diff --git a/board/varisys/common/sys_eeprom.c b/board/varisys/common/sys_eeprom.c
index 77772a6923e..4c025087db0 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 <u-boot/crc.h>
#include "eeprom.h"
diff --git a/cmd/i2c.c b/cmd/i2c.c
index 038f97c261b..43a76299b3c 100644
--- a/cmd/i2c.c
+++ b/cmd/i2c.c
@@ -76,6 +76,7 @@
#include <malloc.h>
#include <asm/byteorder.h>
#include <linux/compiler.h>
+#include <u-boot/crc.h>
/* Display values from last command.
* Memory modify remembered values are different from display memory.
diff --git a/cmd/nvedit.c b/cmd/nvedit.c
index 99a3bc57b15..b5da3759133 100644
--- a/cmd/nvedit.c
+++ b/cmd/nvedit.c
@@ -33,6 +33,7 @@
#include <errno.h>
#include <malloc.h>
#include <mapmem.h>
+#include <u-boot/crc.h>
#include <watchdog.h>
#include <linux/stddef.h>
#include <asm/byteorder.h>
diff --git a/common/android_ab.c b/common/android_ab.c
index 05ffc6f4e50..6c4df419b29 100644
--- a/common/android_ab.c
+++ b/common/android_ab.c
@@ -8,6 +8,7 @@
#include <linux/err.h>
#include <memalign.h>
#include <u-boot/crc.h>
+#include <u-boot/crc.h>
/**
* Compute the CRC-32 of the bootloader control struct.
diff --git a/common/bloblist.c b/common/bloblist.c
index b4cf169b05a..ccf5e4b6f64 100644
--- a/common/bloblist.c
+++ b/common/bloblist.c
@@ -9,6 +9,7 @@
#include <log.h>
#include <mapmem.h>
#include <spl.h>
+#include <u-boot/crc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/common/board_r.c b/common/board_r.c
index c9f476ef447..c0065a5c19e 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -11,6 +11,7 @@
#include <common.h>
#include <api.h>
+#include <u-boot/crc.h>
/* TODO: can we just include all these headers whether needed or not? */
#if defined(CONFIG_CMD_BEDBUG)
#include <bedbug/type.h>
diff --git a/common/hash.c b/common/hash.c
index d0d825e3898..ff4986a6190 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -18,6 +18,7 @@
#include <hw_sha.h>
#include <asm/io.h>
#include <linux/errno.h>
+#include <u-boot/crc.h>
#else
#include "mkimage.h"
#include <time.h>
diff --git a/common/image-fit.c b/common/image-fit.c
index 5c63c769de2..c52f9451208 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -11,6 +11,7 @@
#ifdef USE_HOSTCC
#include "mkimage.h"
#include <time.h>
+#include <u-boot/crc.h>
#else
#include <linux/compiler.h>
#include <linux/kconfig.h>
diff --git a/common/image.c b/common/image.c
index f17fa40c495..992ebbad51a 100644
--- a/common/image.c
+++ b/common/image.c
@@ -9,6 +9,7 @@
#ifndef USE_HOSTCC
#include <common.h>
#include <env.h>
+#include <u-boot/crc.h>
#include <watchdog.h>
#ifdef CONFIG_SHOW_BOOT_PROGRESS
diff --git a/common/iotrace.c b/common/iotrace.c
index 5b92fabc76e..ba955afc942 100644
--- a/common/iotrace.c
+++ b/common/iotrace.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <mapmem.h>
#include <asm/io.h>
+#include <u-boot/crc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/common/spl/spl.c b/common/spl/spl.c
index f1ad8dc9dab..cc5507f7573 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -15,6 +15,7 @@
#include <asm/u-boot.h>
#include <nand.h>
#include <fat.h>
+#include <u-boot/crc.h>
#include <version.h>
#include <image.h>
#include <malloc.h>
diff --git a/disk/part_efi.c b/disk/part_efi.c
index 51fa4a74ab2..b2e157d9c1e 100644
--- a/disk/part_efi.c
+++ b/disk/part_efi.c
@@ -19,6 +19,7 @@
#include <part_efi.h>
#include <linux/compiler.h>
#include <linux/ctype.h>
+#include <u-boot/crc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/misc/atsha204a-i2c.c b/drivers/misc/atsha204a-i2c.c
index 934ba5e6b80..116c0661e75 100644
--- a/drivers/misc/atsha204a-i2c.c
+++ b/drivers/misc/atsha204a-i2c.c
@@ -15,6 +15,7 @@
#include <i2c.h>
#include <errno.h>
#include <atsha204a-i2c.h>
+#include <u-boot/crc.h>
#define ATSHA204A_TWLO 60
#define ATSHA204A_TRANSACTION_TIMEOUT 100000
diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c
index b4ba339c804..19defd88318 100644
--- a/drivers/mtd/ubi/attach.c
+++ b/drivers/mtd/ubi/attach.c
@@ -74,6 +74,7 @@
#include <linux/slab.h>
#include <linux/crc32.h>
#include <linux/random.h>
+#include <u-boot/crc.h>
#else
#include <div64.h>
#include <linux/err.h>
diff --git a/drivers/mtd/ubi/crc32.c b/drivers/mtd/ubi/crc32.c
index 9c54ea4db0c..9ce061c8613 100644
--- a/drivers/mtd/ubi/crc32.c
+++ b/drivers/mtd/ubi/crc32.c
@@ -25,6 +25,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/compiler.h>
+#include <u-boot/crc.h>
#endif
#include <linux/types.h>
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 809782b3726..0c8b998e7e1 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -31,6 +31,7 @@
#ifndef __UBOOT__
#include <linux/slab.h>
#include <linux/crc32.h>
+#include <u-boot/crc.h>
#else
#include <ubi_uboot.h>
#endif
diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c
index 14368f9738c..646c778e87c 100644
--- a/drivers/mtd/ubi/fastmap.c
+++ b/drivers/mtd/ubi/fastmap.c
@@ -8,6 +8,7 @@
#ifndef __UBOOT__
#include <linux/crc32.h>
+#include <u-boot/crc.h>
#else
#include <div64.h>
#include <malloc.h>
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
index 688fb509d2c..608dede4925 100644
--- a/drivers/mtd/ubi/io.c
+++ b/drivers/mtd/ubi/io.c
@@ -77,6 +77,7 @@
#include <linux/crc32.h>
#include <linux/err.h>
#include <linux/slab.h>
+#include <u-boot/crc.h>
#else
#include <hexdump.h>
#include <ubi_uboot.h>
diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c
index fb535c1a878..9c46ef66956 100644
--- a/drivers/mtd/ubi/vtbl.c
+++ b/drivers/mtd/ubi/vtbl.c
@@ -50,6 +50,7 @@
#include <linux/err.h>
#include <linux/slab.h>
#include <asm/div64.h>
+#include <u-boot/crc.h>
#else
#include <ubi_uboot.h>
#endif
diff --git a/drivers/mtd/ubispl/ubispl.c b/drivers/mtd/ubispl/ubispl.c
index 3f3b9b43675..00102fcf748 100644
--- a/drivers/mtd/ubispl/ubispl.c
+++ b/drivers/mtd/ubispl/ubispl.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <errno.h>
+#include <u-boot/crc.h>
#include <ubispl.h>
#include <linux/crc32.h>
diff --git a/drivers/net/fm/fdt.c b/drivers/net/fm/fdt.c
index 72d12947514..a6b0d87415f 100644
--- a/drivers/net/fm/fdt.c
+++ b/drivers/net/fm/fdt.c
@@ -5,6 +5,7 @@
#include <asm/io.h>
#include <env.h>
#include <fsl_qe.h> /* For struct qe_firmware */
+#include <u-boot/crc.h>
#ifdef CONFIG_SYS_DPAA_FMAN
/**
diff --git a/drivers/net/fm/fm.c b/drivers/net/fm/fm.c
index 4c9dce8dc57..926cf81a07f 100644
--- a/drivers/net/fm/fm.c
+++ b/drivers/net/fm/fm.c
@@ -8,6 +8,7 @@
#include <malloc.h>
#include <asm/io.h>
#include <linux/errno.h>
+#include <u-boot/crc.h>
#include "fm.h"
#include <fsl_qe.h> /* For struct qe_firmware */
diff --git a/drivers/qe/qe.c b/drivers/qe/qe.c
index 6e4d732a07a..24549ece653 100644
--- a/drivers/qe/qe.c
+++ b/drivers/qe/qe.c
@@ -14,6 +14,7 @@
#include <linux/immap_qe.h>
#include <fsl_qe.h>
#include <mmc.h>
+#include <u-boot/crc.h>
#ifdef CONFIG_ARCH_LS1021A
#include <asm/arch/immap_ls102xa.h>
diff --git a/env/common.c b/env/common.c
index 4daaa6faea6..0edb6fb04c2 100644
--- a/env/common.c
+++ b/env/common.c
@@ -15,6 +15,7 @@
#include <search.h>
#include <errno.h>
#include <malloc.h>
+#include <u-boot/crc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/env/eeprom.c b/env/eeprom.c
index cb04d2ac884..f0bdf2a1416 100644
--- a/env/eeprom.c
+++ b/env/eeprom.c
@@ -12,6 +12,7 @@
#include <env.h>
#include <env_internal.h>
#include <linux/stddef.h>
+#include <u-boot/crc.h>
#if defined(CONFIG_I2C_ENV_EEPROM_BUS)
#include <i2c.h>
#endif
diff --git a/env/flash.c b/env/flash.c
index b94ed2b04f8..b487e6701ef 100644
--- a/env/flash.c
+++ b/env/flash.c
@@ -17,6 +17,7 @@
#include <malloc.h>
#include <search.h>
#include <errno.h>
+#include <u-boot/crc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/env/nand.c b/env/nand.c
index e631bf2fdab..8b0027d3047 100644
--- a/env/nand.c
+++ b/env/nand.c
@@ -23,6 +23,7 @@
#include <nand.h>
#include <search.h>
#include <errno.h>
+#include <u-boot/crc.h>
#if defined(CONFIG_CMD_SAVEENV) && defined(CONFIG_CMD_NAND) && \
!defined(CONFIG_SPL_BUILD)
diff --git a/env/nvram.c b/env/nvram.c
index 79201bd788b..a78db216236 100644
--- a/env/nvram.c
+++ b/env/nvram.c
@@ -30,6 +30,7 @@
#include <linux/stddef.h>
#include <search.h>
#include <errno.h>
+#include <u-boot/crc.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/env/remote.c b/env/remote.c
index 55faa1e5d0e..50d77b8dfe0 100644
--- a/env/remote.c
+++ b/env/remote.c
@@ -9,6 +9,7 @@
#include <command.h>
#include <env_internal.h>
#include <linux/stddef.h>
+#include <u-boot/crc.h>
#ifdef ENV_IS_EMBEDDED
env_t *env_ptr = &environment;
diff --git a/env/sf.c b/env/sf.c
index 16dba115783..5ef40552194 100644
--- a/env/sf.c
+++ b/env/sf.c
@@ -18,6 +18,7 @@
#include <search.h>
#include <errno.h>
#include <dm/device-internal.h>
+#include <u-boot/crc.h>
#ifndef CONFIG_SPL_BUILD
#define CMD_SAVEENV
diff --git a/examples/api/glue.c b/examples/api/glue.c
index 4086616a94b..91d13157a1e 100644
--- a/examples/api/glue.c
+++ b/examples/api/glue.c
@@ -7,6 +7,7 @@
#include <env.h>
#include <linux/types.h>
#include <api_public.h>
+#include <u-boot/crc.h>
#include "glue.h"
diff --git a/fs/jffs2/jffs2_1pass.c b/fs/jffs2/jffs2_1pass.c
index 6bf19439582..5912cde8384 100644
--- a/fs/jffs2/jffs2_1pass.c
+++ b/fs/jffs2/jffs2_1pass.c
@@ -118,6 +118,7 @@
#include <linux/compiler.h>
#include <linux/stat.h>
#include <linux/time.h>
+#include <u-boot/crc.h>
#include <watchdog.h>
#include <jffs2/jffs2.h>
#include <jffs2/jffs2_1pass.h>
diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c
index 8d7f8feebb5..7fe94e1093a 100644
--- a/fs/ubifs/io.c
+++ b/fs/ubifs/io.c
@@ -61,6 +61,7 @@
#ifndef __UBOOT__
#include <linux/crc32.h>
#include <linux/slab.h>
+#include <u-boot/crc.h>
#else
#include <linux/compat.h>
#include <linux/err.h>
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index 621804c6fd2..b568012fec3 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -38,6 +38,7 @@
#ifndef __UBOOT__
#include <linux/crc32.h>
#include <linux/slab.h>
+#include <u-boot/crc.h>
#else
#include <linux/err.h>
#endif
diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c
index 86774f8fa27..8afc08ad7d7 100644
--- a/fs/ubifs/tnc.c
+++ b/fs/ubifs/tnc.c
@@ -21,6 +21,7 @@
#ifndef __UBOOT__
#include <linux/crc32.h>
#include <linux/slab.h>
+#include <u-boot/crc.h>
#else
#include <linux/compat.h>
#include <linux/err.h>
diff --git a/include/common.h b/include/common.h
index b09c7aeddd4..9c454fb1c83 100644
--- a/include/common.h
+++ b/include/common.h
@@ -322,9 +322,6 @@ int strcmp_compar(const void *, const void *);
/* lib/strmhz.c */
char * strmhz(char *buf, unsigned long hz);
-/* lib/crc32.c */
-#include <u-boot/crc.h>
-
/*
* STDIO based functions (can always be used)
*/
diff --git a/lib/crc32.c b/lib/crc32.c
index dc7e183f181..e9be3bf386e 100644
--- a/lib/crc32.c
+++ b/lib/crc32.c
@@ -10,6 +10,7 @@
#ifdef USE_HOSTCC
#include <arpa/inet.h>
+#include <u-boot/crc.h>
#else
#include <common.h>
#include <efi_loader.h>
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index 493d906c641..ea52b9539d5 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -13,6 +13,7 @@
#include <u-boot/crc.h>
#include <bootm.h>
#include <pe.h>
+#include <u-boot/crc.h>
#include <watchdog.h>
DECLARE_GLOBAL_DATA_PTR;
diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c
index ced00516f73..72555f07fc1 100644
--- a/lib/efi_loader/efi_runtime.c
+++ b/lib/efi_loader/efi_runtime.c
@@ -11,6 +11,7 @@
#include <elf.h>
#include <efi_loader.h>
#include <rtc.h>
+#include <u-boot/crc.h>
/* For manual relocation support */
DECLARE_GLOBAL_DATA_PTR;
diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
index 46f35bc60ba..c316bdfec0e 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -11,6 +11,7 @@
#include <hexdump.h>
#include <malloc.h>
#include <search.h>
+#include <u-boot/crc.h>
#define READ_ONLY BIT(31)
diff --git a/lib/efi_selftest/efi_selftest_config_table.c b/lib/efi_selftest/efi_selftest_config_table.c
index 4467f492ac5..2bf12b5bb68 100644
--- a/lib/efi_selftest/efi_selftest_config_table.c
+++ b/lib/efi_selftest/efi_selftest_config_table.c
@@ -9,6 +9,7 @@
*/
#include <efi_selftest.h>
+#include <u-boot/crc.h>
static const struct efi_system_table *sys_table;
static struct efi_boot_services *boottime;
diff --git a/lib/efi_selftest/efi_selftest_crc32.c b/lib/efi_selftest/efi_selftest_crc32.c
index 4881e8ac6f2..19153c759aa 100644
--- a/lib/efi_selftest/efi_selftest_crc32.c
+++ b/lib/efi_selftest/efi_selftest_crc32.c
@@ -10,6 +10,7 @@
*/
#include <efi_selftest.h>
+#include <u-boot/crc.h>
const struct efi_system_table *st;
efi_status_t (EFIAPI *bs_crc32)(const void *data, efi_uintn_t data_size,
diff --git a/lib/gunzip.c b/lib/gunzip.c
index 1d65616c13d..9e6ccd692a3 100644
--- a/lib/gunzip.c
+++ b/lib/gunzip.c
@@ -12,6 +12,7 @@
#include <image.h>
#include <malloc.h>
#include <memalign.h>
+#include <u-boot/crc.h>
#include <watchdog.h>
#include <u-boot/zlib.h>
diff --git a/lib/zlib/deflate.c b/lib/zlib/deflate.c
index 9a20b703448..1fe58d5da6c 100644
--- a/lib/zlib/deflate.c
+++ b/lib/zlib/deflate.c
@@ -50,6 +50,7 @@
/* @(#) $Id$ */
#include "deflate.h"
+#include <u-boot/crc.h>
const char deflate_copyright[] =
" deflate 1.2.5 Copyright 1995-2010 Jean-loup Gailly and Mark Adler ";
diff --git a/tools/default_image.c b/tools/default_image.c
index f7990e28c06..e164c0c27d1 100644
--- a/tools/default_image.c
+++ b/tools/default_image.c
@@ -15,6 +15,7 @@
#include "imagetool.h"
#include "mkimage.h"
+#include <u-boot/crc.h>
#include <image.h>
#include <tee/optee.h>
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index e2801f595f6..30b5a190ab9 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -25,6 +25,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#include <u-boot/crc.h>
#include <unistd.h>
#include <dirent.h>
diff --git a/tools/env/fw_env.h b/tools/env/fw_env.h
index 3d2b457b31f..b60fbfc8f8d 100644
--- a/tools/env/fw_env.h
+++ b/tools/env/fw_env.h
@@ -160,5 +160,3 @@ int fw_env_close(struct env_opts *opts);
* version string of the library
*/
char *fw_env_version(void);
-
-unsigned long crc32(unsigned long, const unsigned char *, unsigned);
diff --git a/tools/envcrc.c b/tools/envcrc.c
index 6e436080271..bce77902476 100644
--- a/tools/envcrc.c
+++ b/tools/envcrc.c
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+#include <u-boot/crc.h>
#include <unistd.h>
#include <linux/kconfig.h>
diff --git a/tools/mkenvimage.c b/tools/mkenvimage.c
index a8eebab6c33..b05f83415f0 100644
--- a/tools/mkenvimage.c
+++ b/tools/mkenvimage.c
@@ -14,6 +14,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
+#include <u-boot/crc.h>
#include <unistd.h>
#include <libgen.h>
#include <sys/types.h>
diff --git a/tools/mxsimage.c b/tools/mxsimage.c
index 0bb5c6aa6b9..002f4b525aa 100644
--- a/tools/mxsimage.c
+++ b/tools/mxsimage.c
@@ -11,6 +11,7 @@
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
+#include <u-boot/crc.h>
#include <unistd.h>
#include <limits.h>
diff --git a/tools/pbl_crc32.c b/tools/pbl_crc32.c
index 06da1d92ffd..9b1ca55348b 100644
--- a/tools/pbl_crc32.c
+++ b/tools/pbl_crc32.c
@@ -5,6 +5,7 @@
* Cleaned up and refactored by Charles Manning.
*/
#include "pblimage.h"
+#include <u-boot/crc.h>
static uint32_t crc_table[256];
static int crc_table_valid;
diff --git a/tools/pblimage.c b/tools/pblimage.c
index d11f9afe245..3c823e96cf1 100644
--- a/tools/pblimage.c
+++ b/tools/pblimage.c
@@ -6,6 +6,7 @@
#include <image.h>
#include "pblimage.h"
#include "pbl_crc32.h"
+#include <u-boot/crc.h>
#define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
#define PBL_ACS_CONT_CMD 0x81000000
diff --git a/tools/socfpgaimage.c b/tools/socfpgaimage.c
index 72d8b96f541..8fa098338b2 100644
--- a/tools/socfpgaimage.c
+++ b/tools/socfpgaimage.c
@@ -55,6 +55,7 @@
#include "pbl_crc32.h"
#include "imagetool.h"
#include "mkimage.h"
+#include <u-boot/crc.h>
#include <image.h>