[U-Boot] [PATCH 01/30] lib: Allow crc32 to be disabled.

Unfortunately this table seems to appear in TPL with gcc 7.3 even if it is not used. Fix it by creating a Kconfig that can be used to disable this routine.
It is enabled by default, since most boards use it.
Signed-off-by: Simon Glass sjg@chromium.org ---
lib/Kconfig | 29 +++++++++++++++++++++++++++++ lib/Makefile | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/lib/Kconfig b/lib/Kconfig index 135f0b372b..be5f9d343a 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -353,6 +353,35 @@ config SHA_PROG_HW_ACCEL config MD5 bool
+config CRC32 + bool "Enable crc32 routine" + default y + help + This enables a 32-bit CRC (cyclic-redundancy check) routine. It is + typically used to check for changes in a group of bytes. Even a + small change typically produces a very different CRC value. This + algorithm is simple and quite fast. + +config SPL_CRC32 + bool "Enable crc32 routine in SPL" + depends on SPL + default y + help + This enables a 32-bit CRC (cyclic-redundancy check) routine in SPL. It + is typically used to check for changes in a group of bytes. Even a + small change typically produces a very different CRC value. This + algorithm is simple and quite fast. + +config TPL_CRC32 + bool "Enable crc32 routine in SPL" + depends on TPL + default y + help + This enables a 32-bit CRC (cyclic-redundancy check) routine in SPL. It + is typically used to check for changes in a group of bytes. Even a + small change typically produces a very different CRC value. This + algorithm is simple and quite fast. + config CRC32C bool
diff --git a/lib/Makefile b/lib/Makefile index d248d8626c..8adc08fd73 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -84,7 +84,7 @@ obj-y += errno.o obj-y += display_options.o CFLAGS_display_options.o := $(if $(BUILD_TAG),-DBUILD_TAG='"$(BUILD_TAG)"') obj-$(CONFIG_BCH) += bch.o -obj-y += crc32.o +obj-$(CONFIG_$(SPL_TPL_)CRC32) += crc32.o obj-$(CONFIG_CRC32C) += crc32c.o obj-y += ctype.o obj-y += div64.o

In some cases SPL needs to be able to erase but TPL just needs to read. Allow these to have separate settings for SPI_FLASH_TINY.
Signed-off-by: Simon Glass sjg@chromium.org ---
common/spl/Kconfig | 10 ++++++++++ drivers/mtd/spi/Makefile | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/common/spl/Kconfig b/common/spl/Kconfig index 86d7edfee1..604bb69d69 100644 --- a/common/spl/Kconfig +++ b/common/spl/Kconfig @@ -1423,6 +1423,16 @@ config TPL_SPI_FLASH_SUPPORT Enable support for using SPI flash in TPL. See SPL_SPI_FLASH_SUPPORT for details.
+config TPL_SPI_FLASH_TINY + bool "Enable low footprint TPL SPI Flash support" + depends on TPL_SPI_FLASH_SUPPORT && !SPI_FLASH_BAR + default y if SPI_FLASH + help + Enable lightweight TPL SPI Flash support that supports just reading + data/images from flash. No support to write/erase flash. Enable + this if you have TPL size limitations and don't need full-fledged + SPI flash support. + config TPL_SPI_LOAD bool "Support loading from SPI flash" depends on TPL_SPI_FLASH_SUPPORT diff --git a/drivers/mtd/spi/Makefile b/drivers/mtd/spi/Makefile index 20db1015d9..df04297671 100644 --- a/drivers/mtd/spi/Makefile +++ b/drivers/mtd/spi/Makefile @@ -8,7 +8,7 @@ spi-nor-y := sf_probe.o spi-nor-ids.o
ifdef CONFIG_SPL_BUILD obj-$(CONFIG_SPL_SPI_BOOT) += fsl_espi_spl.o -ifeq ($(CONFIG_SPL_SPI_FLASH_TINY),y) +ifeq ($(CONFIG_$(SPL_TPL_)SPI_FLASH_TINY),y) spi-nor-y += spi-nor-tiny.o else spi-nor-y += spi-nor-core.o

The -ENODEV error value in spi_nor_read_id() is incorrect since there clearly is a device - it just cannot be supported. Use -ENOMEDIUM instead which has the virtue of being less common.
Fix the return value in spi_nor_scan().
Also there are a few printf() statements which should be debug() since they bloat the code with unused strings at present. Fix those while here.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/mtd/spi/sf_probe.c | 2 +- drivers/mtd/spi/spi-nor-core.c | 2 +- drivers/mtd/spi/spi-nor-tiny.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 73297e1a0a..277241d6f6 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -119,7 +119,7 @@ static int spi_flash_std_erase(struct udevice *dev, u32 offset, size_t len) struct erase_info instr;
if (offset % mtd->erasesize || len % mtd->erasesize) { - printf("SF: Erase offset/length not multiple of erase size\n"); + debug("SF: Erase offset/length not multiple of erase size\n"); return -EINVAL; }
diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 990e39d7c2..98405d421d 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -2399,7 +2399,7 @@ static int spi_nor_init(struct spi_nor *nor) * designer) that this is bad. */ if (nor->flags & SNOR_F_BROKEN_RESET) - printf("enabling reset hack; may not recover from unexpected reboots\n"); + debug("enabling reset hack; may not recover from unexpected reboots\n"); set_4byte(nor, nor->info, 1); }
diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c index c19d468d62..d8fcd6db24 100644 --- a/drivers/mtd/spi/spi-nor-tiny.c +++ b/drivers/mtd/spi/spi-nor-tiny.c @@ -375,7 +375,7 @@ static const struct flash_info *spi_nor_read_id(struct spi_nor *nor) } dev_dbg(nor->dev, "unrecognized JEDEC id bytes: %02x, %02x, %02x\n", id[0], id[1], id[2]); - return ERR_PTR(-ENODEV); + return ERR_PTR(-EMEDIUMTYPE); }
static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len, @@ -731,7 +731,7 @@ int spi_nor_scan(struct spi_nor *nor)
info = spi_nor_read_id(nor); if (IS_ERR_OR_NULL(info)) - return -ENOENT; + return PTR_ERR(info); /* Parse the Serial Flash Discoverable Parameters table. */ ret = spi_nor_init_params(nor, info, ¶ms); if (ret)

With of-platdata we need to create drivers for particular chips, or at least drivers that are separate from the standard code, since C structures are created by dtoc which are private to that driver.
To avoid duplicating the probing code, export this probe function for use by these drivers.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/mtd/spi/sf_probe.c | 2 +- include/spi_flash.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi/sf_probe.c b/drivers/mtd/spi/sf_probe.c index 277241d6f6..7ab8b69c2b 100644 --- a/drivers/mtd/spi/sf_probe.c +++ b/drivers/mtd/spi/sf_probe.c @@ -137,7 +137,7 @@ static int spi_flash_std_get_sw_write_prot(struct udevice *dev) return spi_flash_cmd_get_sw_write_prot(flash); }
-static int spi_flash_std_probe(struct udevice *dev) +int spi_flash_std_probe(struct udevice *dev) { struct spi_slave *slave = dev_get_parent_priv(dev); struct dm_spi_slave_platdata *plat = dev_get_parent_platdata(dev); diff --git a/include/spi_flash.h b/include/spi_flash.h index 55b4721813..0b23f57a71 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -102,6 +102,18 @@ int spi_flash_erase_dm(struct udevice *dev, u32 offset, size_t len); */ int spl_flash_get_sw_write_prot(struct udevice *dev);
+/** + * spi_flash_std_probe() - Probe a SPI flash device + * + * This is the standard internal method for probing a SPI flash device to + * determine its type. It can be used in chip-specific drivers which need to + * do this, typically with of-platdata + * + * @dev: SPI-flash device to probe + * @return 0 if OK, -ve on error + */ +int spi_flash_std_probe(struct udevice *dev); + int spi_flash_probe_bus_cs(unsigned int busnum, unsigned int cs, unsigned int max_hz, unsigned int spi_mode, struct udevice **devp);

We should not have C code in a header file. Move it into a shared C file so it can be used by U-Boot and SPL.
Signed-off-by: Simon Glass sjg@chromium.org ---
common/init/Makefile | 1 + common/init/wdt.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ include/init.h | 7 +++++++ include/wdt.h | 38 ------------------------------------ 4 files changed, 54 insertions(+), 38 deletions(-) create mode 100644 common/init/wdt.c
diff --git a/common/init/Makefile b/common/init/Makefile index 853b56d1e5..a76dedf350 100644 --- a/common/init/Makefile +++ b/common/init/Makefile @@ -6,3 +6,4 @@
obj-y += board_init.o obj-$(CONFIG_$(SPL_TPL_)HANDOFF) += handoff.o +obj-$(CONFIG_$(SPL_TPL_)WDT) += wdt.o diff --git a/common/init/wdt.c b/common/init/wdt.c new file mode 100644 index 0000000000..79146fb293 --- /dev/null +++ b/common/init/wdt.c @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright 2017 Google, Inc + */ + +#include <common.h> +#include <dm.h> +#include <wdt.h> + +DECLARE_GLOBAL_DATA_PTR; + +#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS +#define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000) +#endif +#define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000) + +int initr_watchdog(void) +{ + u32 timeout = WATCHDOG_TIMEOUT_SECS; + + /* + * Init watchdog: This will call the probe function of the + * watchdog driver, enabling the use of the device + */ + if (uclass_get_device_by_seq(UCLASS_WDT, 0, + (struct udevice **)&gd->watchdog_dev)) { + debug("WDT: Not found by seq!\n"); + if (uclass_get_device(UCLASS_WDT, 0, + (struct udevice **)&gd->watchdog_dev)) { + printf("WDT: Not found!\n"); + return 0; + } + } + + if (CONFIG_IS_ENABLED(OF_CONTROL)) { + timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec", + WATCHDOG_TIMEOUT_SECS); + } + + wdt_start(gd->watchdog_dev, timeout * 1000, 0); + gd->flags |= GD_FLG_WDT_READY; + printf("WDT: Started with%s servicing (%ds timeout)\n", + IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout); + + return 0; +} diff --git a/include/init.h b/include/init.h index afc953d51e..3e5857f07f 100644 --- a/include/init.h +++ b/include/init.h @@ -181,6 +181,13 @@ int init_func_vid(void); int checkboard(void); int show_board_info(void);
+/** + * initr_watchdog() - Init the watchdog + * + * @return 0 if OK, -ve on error + */ +int initr_watchdog(void); + #endif /* __ASSEMBLY__ */ /* Put only stuff here that the assembler can digest */
diff --git a/include/wdt.h b/include/wdt.h index 5bcff24ab3..5698605c02 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -106,42 +106,4 @@ struct wdt_ops { int (*expire_now)(struct udevice *dev, ulong flags); };
-#if CONFIG_IS_ENABLED(WDT) -#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS -#define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000) -#endif -#define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000) - -static inline int initr_watchdog(void) -{ - u32 timeout = WATCHDOG_TIMEOUT_SECS; - - /* - * Init watchdog: This will call the probe function of the - * watchdog driver, enabling the use of the device - */ - if (uclass_get_device_by_seq(UCLASS_WDT, 0, - (struct udevice **)&gd->watchdog_dev)) { - debug("WDT: Not found by seq!\n"); - if (uclass_get_device(UCLASS_WDT, 0, - (struct udevice **)&gd->watchdog_dev)) { - printf("WDT: Not found!\n"); - return 0; - } - } - - if (CONFIG_IS_ENABLED(OF_CONTROL)) { - timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec", - WATCHDOG_TIMEOUT_SECS); - } - - wdt_start(gd->watchdog_dev, timeout * 1000, 0); - gd->flags |= GD_FLG_WDT_READY; - printf("WDT: Started with%s servicing (%ds timeout)\n", - IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout); - - return 0; -} -#endif - #endif /* _WDT_H_ */

On 27.10.19 16:53, Simon Glass wrote:
We should not have C code in a header file. Move it into a shared C file so it can be used by U-Boot and SPL.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan
common/init/Makefile | 1 + common/init/wdt.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ include/init.h | 7 +++++++ include/wdt.h | 38 ------------------------------------ 4 files changed, 54 insertions(+), 38 deletions(-) create mode 100644 common/init/wdt.c
diff --git a/common/init/Makefile b/common/init/Makefile index 853b56d1e5..a76dedf350 100644 --- a/common/init/Makefile +++ b/common/init/Makefile @@ -6,3 +6,4 @@
obj-y += board_init.o obj-$(CONFIG_$(SPL_TPL_)HANDOFF) += handoff.o +obj-$(CONFIG_$(SPL_TPL_)WDT) += wdt.o diff --git a/common/init/wdt.c b/common/init/wdt.c new file mode 100644 index 0000000000..79146fb293 --- /dev/null +++ b/common/init/wdt.c @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: GPL-2.0+ +/*
- Copyright 2017 Google, Inc
- */
+#include <common.h> +#include <dm.h> +#include <wdt.h>
+DECLARE_GLOBAL_DATA_PTR;
+#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS +#define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000) +#endif +#define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000)
+int initr_watchdog(void) +{
- u32 timeout = WATCHDOG_TIMEOUT_SECS;
- /*
* Init watchdog: This will call the probe function of the
* watchdog driver, enabling the use of the device
*/
- if (uclass_get_device_by_seq(UCLASS_WDT, 0,
(struct udevice **)&gd->watchdog_dev)) {
debug("WDT: Not found by seq!\n");
if (uclass_get_device(UCLASS_WDT, 0,
(struct udevice **)&gd->watchdog_dev)) {
printf("WDT: Not found!\n");
return 0;
}
- }
- if (CONFIG_IS_ENABLED(OF_CONTROL)) {
timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
WATCHDOG_TIMEOUT_SECS);
- }
- wdt_start(gd->watchdog_dev, timeout * 1000, 0);
- gd->flags |= GD_FLG_WDT_READY;
- printf("WDT: Started with%s servicing (%ds timeout)\n",
IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout);
- return 0;
+} diff --git a/include/init.h b/include/init.h index afc953d51e..3e5857f07f 100644 --- a/include/init.h +++ b/include/init.h @@ -181,6 +181,13 @@ int init_func_vid(void); int checkboard(void); int show_board_info(void);
+/**
- initr_watchdog() - Init the watchdog
- @return 0 if OK, -ve on error
- */
+int initr_watchdog(void);
- #endif /* __ASSEMBLY__ */ /* Put only stuff here that the assembler can digest */
diff --git a/include/wdt.h b/include/wdt.h index 5bcff24ab3..5698605c02 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -106,42 +106,4 @@ struct wdt_ops { int (*expire_now)(struct udevice *dev, ulong flags); };
-#if CONFIG_IS_ENABLED(WDT) -#ifndef CONFIG_WATCHDOG_TIMEOUT_MSECS -#define CONFIG_WATCHDOG_TIMEOUT_MSECS (60 * 1000) -#endif -#define WATCHDOG_TIMEOUT_SECS (CONFIG_WATCHDOG_TIMEOUT_MSECS / 1000)
-static inline int initr_watchdog(void) -{
- u32 timeout = WATCHDOG_TIMEOUT_SECS;
- /*
* Init watchdog: This will call the probe function of the
* watchdog driver, enabling the use of the device
*/
- if (uclass_get_device_by_seq(UCLASS_WDT, 0,
(struct udevice **)&gd->watchdog_dev)) {
debug("WDT: Not found by seq!\n");
if (uclass_get_device(UCLASS_WDT, 0,
(struct udevice **)&gd->watchdog_dev)) {
printf("WDT: Not found!\n");
return 0;
}
- }
- if (CONFIG_IS_ENABLED(OF_CONTROL)) {
timeout = dev_read_u32_default(gd->watchdog_dev, "timeout-sec",
WATCHDOG_TIMEOUT_SECS);
- }
- wdt_start(gd->watchdog_dev, timeout * 1000, 0);
- gd->flags |= GD_FLG_WDT_READY;
- printf("WDT: Started with%s servicing (%ds timeout)\n",
IS_ENABLED(CONFIG_WATCHDOG) ? "" : "out", timeout);
- return 0;
-} -#endif
- #endif /* _WDT_H_ */
Viele Grüße, Stefan

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
include/wdt.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/wdt.h b/include/wdt.h index 5698605c02..62f4b34c30 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -6,8 +6,7 @@ #ifndef _WDT_H_ #define _WDT_H_
-#include <dm.h> -#include <dm/read.h> +struct udevice;
/* * Implement a simple watchdog uclass. Watchdog is basically a timer that

On 27.10.19 16:53, Simon Glass wrote:
This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org
include/wdt.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/include/wdt.h b/include/wdt.h index 5698605c02..62f4b34c30 100644 --- a/include/wdt.h +++ b/include/wdt.h @@ -6,8 +6,7 @@ #ifndef _WDT_H_ #define _WDT_H_
-#include <dm.h> -#include <dm/read.h> +struct udevice;
I'm not a big fan of forward declarations. But if this helps with overall cleanup and compile speed:
Reviewed-by: Stefan Roese sr@denx.de
Thanks, Stefan

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/spi/spi-mem-nodm.c | 1 + drivers/spi/spi-mem.c | 5 +++++ drivers/spi/stm32_qspi.c | 2 ++ include/spi-mem.h | 5 +---- 4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-mem-nodm.c b/drivers/spi/spi-mem-nodm.c index 4447d44991..83dde4806e 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 <malloc.h> #include <spi.h> #include <spi-mem.h>
diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c index 7788ab9953..e5a8109058 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -11,6 +11,11 @@ #include <linux/pm_runtime.h> #include "internals.h" #else +#include <common.h> +#include <dm.h> +#include <errno.h> +#include <malloc.h> +#include <spi.h> #include <spi.h> #include <spi-mem.h> #endif diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index 958c394a1a..c8c81396c5 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -9,7 +9,9 @@
#include <common.h> #include <clk.h> +#include <dm.h> #include <reset.h> +#include <spi.h> #include <spi-mem.h> #include <linux/iopoll.h> #include <linux/ioport.h> diff --git a/include/spi-mem.h b/include/spi-mem.h index 36814efa86..2f3f0156d0 100644 --- a/include/spi-mem.h +++ b/include/spi-mem.h @@ -11,10 +11,7 @@ #ifndef __UBOOT_SPI_MEM_H #define __UBOOT_SPI_MEM_H
-#include <common.h> -#include <dm.h> -#include <errno.h> -#include <spi.h> +struct udevice;
#define SPI_MEM_OP_CMD(__opcode, __buswidth) \ { \

These two defines are no-longer supported. Drop them.
Signed-off-by: Simon Glass sjg@chromium.org ---
include/spi.h | 2 -- 1 file changed, 2 deletions(-)
diff --git a/include/spi.h b/include/spi.h index 5eec0c4775..f5001a2cb2 100644 --- a/include/spi.h +++ b/include/spi.h @@ -113,8 +113,6 @@ struct spi_slave { #define SPI_XFER_BEGIN BIT(0) /* Assert CS before transfer */ #define SPI_XFER_END BIT(1) /* Deassert CS after transfer */ #define SPI_XFER_ONCE (SPI_XFER_BEGIN | SPI_XFER_END) -#define SPI_XFER_MMAP BIT(2) /* Memory Mapped start */ -#define SPI_XFER_MMAP_END BIT(3) /* Memory Mapped End */ };
/**

This header file should not be included in other header files. Remove it and add it to the cmd file instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
cmd/demo.c | 1 + include/dm-demo.h | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/cmd/demo.c b/cmd/demo.c index 52c6e7ec15..2c81bf2822 100644 --- a/cmd/demo.c +++ b/cmd/demo.c @@ -7,6 +7,7 @@ */
#include <common.h> +#include <dm.h> #include <dm-demo.h> #include <mapmem.h> #include <asm/io.h> diff --git a/include/dm-demo.h b/include/dm-demo.h index c9a82c7e52..7b6d0d80ff 100644 --- a/include/dm-demo.h +++ b/include/dm-demo.h @@ -6,8 +6,6 @@ #ifndef __DM_DEMO_H #define __DM_DEMO_H
-#include <dm.h> - /** * struct dm_demo_pdata - configuration data for demo instance *

These header file should not be included in other header files. Remove them and add to each individual file.
Signed-off-by: Simon Glass sjg@chromium.org ---
include/dm/test.h | 3 --- test/dm/adc.c | 1 + test/dm/audio.c | 1 + test/dm/axi.c | 3 ++- test/dm/blk.c | 1 + test/dm/board.c | 1 + test/dm/bootcount.c | 1 + test/dm/bus.c | 1 + test/dm/clk.c | 1 + test/dm/clk_ccf.c | 1 + test/dm/core.c | 1 + test/dm/cpu.c | 1 + test/dm/dma.c | 1 + test/dm/dsi_host.c | 1 + test/dm/eth.c | 3 ++- test/dm/firmware.c | 1 + test/dm/gpio.c | 3 ++- test/dm/hwspinlock.c | 1 + test/dm/i2c.c | 1 + test/dm/i2s.c | 3 ++- test/dm/led.c | 1 + test/dm/mailbox.c | 1 + test/dm/mdio.c | 5 +++-- test/dm/mdio_mux.c | 5 +++-- test/dm/misc.c | 1 + test/dm/mmc.c | 1 + test/dm/nop.c | 1 + test/dm/ofnode.c | 1 + test/dm/osd.c | 5 +++-- test/dm/panel.c | 3 ++- test/dm/pch.c | 1 + test/dm/pci.c | 1 + test/dm/pci_ep.c | 5 +++-- test/dm/phy.c | 1 + test/dm/pmic.c | 5 +++-- test/dm/power-domain.c | 1 + test/dm/pwm.c | 1 + test/dm/ram.c | 1 + test/dm/regmap.c | 1 + test/dm/regulator.c | 1 + test/dm/remoteproc.c | 2 ++ test/dm/reset.c | 1 + test/dm/rtc.c | 1 + test/dm/serial.c | 1 + test/dm/sf.c | 1 + test/dm/smem.c | 1 + test/dm/sound.c | 1 + test/dm/spi.c | 1 + test/dm/spmi.c | 1 + test/dm/syscon.c | 1 + test/dm/sysreset.c | 1 + test/dm/tee.c | 1 + test/dm/test-driver.c | 3 ++- test/dm/test-fdt.c | 1 + test/dm/test-main.c | 2 ++ test/dm/test-uclass.c | 1 + test/dm/timer.c | 1 + test/dm/usb.c | 1 + test/dm/video.c | 1 + test/dm/virtio.c | 3 ++- test/dm/wdt.c | 1 + test/lib/lmb.c | 2 ++ 62 files changed, 81 insertions(+), 20 deletions(-)
diff --git a/include/dm/test.h b/include/dm/test.h index 07385cd531..b528b35617 100644 --- a/include/dm/test.h +++ b/include/dm/test.h @@ -6,9 +6,6 @@ #ifndef __DM_TEST_H #define __DM_TEST_H
-#include <dm.h> -#include <test/test.h> - /** * struct dm_test_cdata - configuration data for test instance * diff --git a/test/dm/adc.c b/test/dm/adc.c index da7bd4bf1f..7fa1d48dd9 100644 --- a/test/dm/adc.c +++ b/test/dm/adc.c @@ -17,6 +17,7 @@ #include <power/regulator.h> #include <power/sandbox_pmic.h> #include <sandbox-adc.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_adc_bind(struct unit_test_state *uts) diff --git a/test/dm/audio.c b/test/dm/audio.c index 77c3a3625b..4bb86e3214 100644 --- a/test/dm/audio.c +++ b/test/dm/audio.c @@ -8,6 +8,7 @@ #include <audio_codec.h> #include <dm.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> #include <asm/test.h>
diff --git a/test/dm/axi.c b/test/dm/axi.c index e234ab82e6..d84dfdeb4b 100644 --- a/test/dm/axi.c +++ b/test/dm/axi.c @@ -7,9 +7,10 @@ #include <common.h> #include <axi.h> #include <dm.h> +#include <asm/axi.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <asm/axi.h>
/* Test that sandbox AXI works correctly */ static int dm_test_axi_base(struct unit_test_state *uts) diff --git a/test/dm/blk.c b/test/dm/blk.c index 9c71adc69d..e1a40a31d4 100644 --- a/test/dm/blk.c +++ b/test/dm/blk.c @@ -8,6 +8,7 @@ #include <usb.h> #include <asm/state.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/board.c b/test/dm/board.c index 0f267a1926..f3fd51cac8 100644 --- a/test/dm/board.c +++ b/test/dm/board.c @@ -8,6 +8,7 @@ #include <dm.h> #include <dm/test.h> #include <board.h> +#include <test/test.h> #include <test/ut.h>
#include "../../drivers/board/sandbox.h" diff --git a/test/dm/bootcount.c b/test/dm/bootcount.c index 0817b7d3ec..2d2aac6674 100644 --- a/test/dm/bootcount.c +++ b/test/dm/bootcount.c @@ -8,6 +8,7 @@ #include <bootcount.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_bootcount(struct unit_test_state *uts) diff --git a/test/dm/bus.c b/test/dm/bus.c index 1ad45adb60..f0e1cae7fc 100644 --- a/test/dm/bus.c +++ b/test/dm/bus.c @@ -13,6 +13,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <dm/util.h> +#include <test/test.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/clk.c b/test/dm/clk.c index 676ef217f0..abb6531b50 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -9,6 +9,7 @@ #include <asm/clk.h> #include <dm/test.h> #include <linux/err.h> +#include <test/test.h> #include <test/ut.h>
/* Base test of the clk uclass */ diff --git a/test/dm/clk_ccf.c b/test/dm/clk_ccf.c index ae3a4d8a76..da2292a51a 100644 --- a/test/dm/clk_ccf.c +++ b/test/dm/clk_ccf.c @@ -11,6 +11,7 @@ #include <dm/test.h> #include <dm/uclass.h> #include <linux/err.h> +#include <test/test.h> #include <test/ut.h> #include <sandbox-clk.h>
diff --git a/test/dm/core.c b/test/dm/core.c index f74c430843..9690dcb6d7 100644 --- a/test/dm/core.c +++ b/test/dm/core.c @@ -15,6 +15,7 @@ #include <dm/util.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/cpu.c b/test/dm/cpu.c index f5f1caef71..36bd14c14e 100644 --- a/test/dm/cpu.c +++ b/test/dm/cpu.c @@ -9,6 +9,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <cpu.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_cpu(struct unit_test_state *uts) diff --git a/test/dm/dma.c b/test/dm/dma.c index b56d17731d..4113519ecf 100644 --- a/test/dm/dma.c +++ b/test/dm/dma.c @@ -10,6 +10,7 @@ #include <dm.h> #include <dm/test.h> #include <dma.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_dma_m2m(struct unit_test_state *uts) diff --git a/test/dm/dsi_host.c b/test/dm/dsi_host.c index 59fcd5558f..97917a17c1 100644 --- a/test/dm/dsi_host.c +++ b/test/dm/dsi_host.c @@ -10,6 +10,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_dsi_host_phy_init(void *priv_data) diff --git a/test/dm/eth.c b/test/dm/eth.c index ad5354b4bf..35c17ed7fb 100644 --- a/test/dm/eth.c +++ b/test/dm/eth.c @@ -12,10 +12,11 @@ #include <fdtdec.h> #include <malloc.h> #include <net.h> +#include <asm/eth.h> #include <dm/test.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> -#include <asm/eth.h> +#include <test/test.h> #include <test/ut.h>
#define DM_TEST_ETH_NUM 4 diff --git a/test/dm/firmware.c b/test/dm/firmware.c index 60fdcbb33f..2b4f49af80 100644 --- a/test/dm/firmware.c +++ b/test/dm/firmware.c @@ -8,6 +8,7 @@ #include <syscon.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Base test of firmware probe */ diff --git a/test/dm/gpio.c b/test/dm/gpio.c index bb4b20cea9..3caba9516e 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -6,10 +6,11 @@ #include <common.h> #include <fdtdec.h> #include <dm.h> +#include <asm/gpio.h> #include <dm/root.h> #include <dm/test.h> #include <dm/util.h> -#include <asm/gpio.h> +#include <test/test.h> #include <test/ut.h>
/* Test that sandbox GPIOs work correctly */ diff --git a/test/dm/hwspinlock.c b/test/dm/hwspinlock.c index 09ec38b4f3..49c52bcd63 100644 --- a/test/dm/hwspinlock.c +++ b/test/dm/hwspinlock.c @@ -9,6 +9,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Test that hwspinlock driver functions are called */ diff --git a/test/dm/i2c.c b/test/dm/i2c.c index cbbd4aa29a..8a35c1be2e 100644 --- a/test/dm/i2c.c +++ b/test/dm/i2c.c @@ -15,6 +15,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <dm/util.h> +#include <test/test.h> #include <test/ut.h>
static const int busnum; diff --git a/test/dm/i2s.c b/test/dm/i2s.c index 49ebc3523c..7a017be064 100644 --- a/test/dm/i2s.c +++ b/test/dm/i2s.c @@ -7,9 +7,10 @@ #include <common.h> #include <dm.h> #include <i2s.h> +#include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <asm/test.h>
/* Basic test of the i2s codec uclass */ static int dm_test_i2s(struct unit_test_state *uts) diff --git a/test/dm/led.c b/test/dm/led.c index 00de7b3997..3d5ad9363b 100644 --- a/test/dm/led.c +++ b/test/dm/led.c @@ -8,6 +8,7 @@ #include <led.h> #include <asm/gpio.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Base test of the led uclass */ diff --git a/test/dm/mailbox.c b/test/dm/mailbox.c index 4562d2ac4f..195b9a9695 100644 --- a/test/dm/mailbox.c +++ b/test/dm/mailbox.c @@ -7,6 +7,7 @@ #include <dm.h> #include <dm/test.h> #include <asm/mbox.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_mailbox(struct unit_test_state *uts) diff --git a/test/dm/mdio.c b/test/dm/mdio.c index dc229aed6d..9ad21ccde4 100644 --- a/test/dm/mdio.c +++ b/test/dm/mdio.c @@ -6,10 +6,11 @@
#include <common.h> #include <dm.h> -#include <dm/test.h> +#include <miiphy.h> #include <misc.h> +#include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <miiphy.h>
/* macros copied over from mdio_sandbox.c */ #define SANDBOX_PHY_ADDR 5 diff --git a/test/dm/mdio_mux.c b/test/dm/mdio_mux.c index f962e09dbc..0b3f85a53b 100644 --- a/test/dm/mdio_mux.c +++ b/test/dm/mdio_mux.c @@ -6,10 +6,11 @@
#include <common.h> #include <dm.h> -#include <dm/test.h> +#include <miiphy.h> #include <misc.h> +#include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <miiphy.h>
/* macros copied over from mdio_sandbox.c */ #define SANDBOX_PHY_ADDR 5 diff --git a/test/dm/misc.c b/test/dm/misc.c index 4d4232adf1..15f475abb3 100644 --- a/test/dm/misc.c +++ b/test/dm/misc.c @@ -8,6 +8,7 @@ #include <dm.h> #include <dm/test.h> #include <misc.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_misc(struct unit_test_state *uts) diff --git a/test/dm/mmc.c b/test/dm/mmc.c index 9ab0db1b66..204137b5ac 100644 --- a/test/dm/mmc.c +++ b/test/dm/mmc.c @@ -7,6 +7,7 @@ #include <dm.h> #include <mmc.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* diff --git a/test/dm/nop.c b/test/dm/nop.c index 2df29f3d15..8b3b646892 100644 --- a/test/dm/nop.c +++ b/test/dm/nop.c @@ -13,6 +13,7 @@ #include <dm/device.h> #include <dm/test.h> #include <misc.h> +#include <test/test.h> #include <test/ut.h>
static int noptest_bind(struct udevice *parent) diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 745de50c7b..9127cb1bbe 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -4,6 +4,7 @@ #include <dm.h> #include <dm/of_extra.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_ofnode_compatible(struct unit_test_state *uts) diff --git a/test/dm/osd.c b/test/dm/osd.c index 6910690b3a..c63dfbcdb1 100644 --- a/test/dm/osd.c +++ b/test/dm/osd.c @@ -7,10 +7,11 @@ #include <common.h> #include <display_options.h> #include <dm.h> -#include <dm/test.h> -#include <test/ut.h> #include <video_osd.h> #include <asm/test.h> +#include <dm/test.h> +#include <test/test.h> +#include <test/ut.h>
#include "../../drivers/video/sandbox_osd.h"
diff --git a/test/dm/panel.c b/test/dm/panel.c index 7e4ebd6d81..410e8f3907 100644 --- a/test/dm/panel.c +++ b/test/dm/panel.c @@ -14,8 +14,9 @@ #include <asm/gpio.h> #include <asm/test.h> #include <dm/test.h> -#include <test/ut.h> #include <power/regulator.h> +#include <test/test.h> +#include <test/ut.h>
/* Basic test of the panel uclass */ static int dm_test_panel(struct unit_test_state *uts) diff --git a/test/dm/pch.c b/test/dm/pch.c index 54e33d187b..bf17a31ccf 100644 --- a/test/dm/pch.c +++ b/test/dm/pch.c @@ -8,6 +8,7 @@ #include <pch.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Test that sandbox PCH works correctly */ diff --git a/test/dm/pci.c b/test/dm/pci.c index fb93e4c78a..43b045d429 100644 --- a/test/dm/pci.c +++ b/test/dm/pci.c @@ -8,6 +8,7 @@ #include <asm/io.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Test that sandbox PCI works correctly */ diff --git a/test/dm/pci_ep.c b/test/dm/pci_ep.c index 101f861751..a29d00eebe 100644 --- a/test/dm/pci_ep.c +++ b/test/dm/pci_ep.c @@ -5,12 +5,13 @@
#include <common.h> #include <dm.h> +#include <hexdump.h> +#include <pci_ep.h> #include <asm/io.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <hexdump.h> -#include <pci_ep.h>
/* Test that sandbox PCI EP works correctly */ static int dm_test_pci_ep_base(struct unit_test_state *uts) diff --git a/test/dm/phy.c b/test/dm/phy.c index 21d92194b9..c5761cf3e7 100644 --- a/test/dm/phy.c +++ b/test/dm/phy.c @@ -8,6 +8,7 @@ #include <dm.h> #include <generic-phy.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Base test of the phy uclass */ diff --git a/test/dm/pmic.c b/test/dm/pmic.c index b582329a9c..8c2766aeac 100644 --- a/test/dm/pmic.c +++ b/test/dm/pmic.c @@ -10,16 +10,17 @@ #include <errno.h> #include <dm.h> #include <fdtdec.h> +#include <fsl_pmic.h> #include <malloc.h> #include <dm/device-internal.h> #include <dm/root.h> -#include <dm/util.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <dm/util.h> #include <power/pmic.h> #include <power/sandbox_pmic.h> +#include <test/test.h> #include <test/ut.h> -#include <fsl_pmic.h>
/* Test PMIC get method */
diff --git a/test/dm/power-domain.c b/test/dm/power-domain.c index 48318218a9..84b4c90f69 100644 --- a/test/dm/power-domain.c +++ b/test/dm/power-domain.c @@ -7,6 +7,7 @@ #include <dm.h> #include <dm/test.h> #include <asm/power-domain.h> +#include <test/test.h> #include <test/ut.h>
/* This must match the specifier for power-domains in the DT node */ diff --git a/test/dm/pwm.c b/test/dm/pwm.c index b52ee21a69..8cc911e1ad 100644 --- a/test/dm/pwm.c +++ b/test/dm/pwm.c @@ -7,6 +7,7 @@ #include <dm.h> #include <pwm.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Basic test of the pwm uclass */ diff --git a/test/dm/ram.c b/test/dm/ram.c index 3efdb6b80b..2456466b56 100644 --- a/test/dm/ram.c +++ b/test/dm/ram.c @@ -7,6 +7,7 @@ #include <dm.h> #include <ram.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/regmap.c b/test/dm/regmap.c index 82de295cb8..64699dd792 100644 --- a/test/dm/regmap.c +++ b/test/dm/regmap.c @@ -10,6 +10,7 @@ #include <syscon.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Base test of register maps */ diff --git a/test/dm/regulator.c b/test/dm/regulator.c index e510539542..91eebc6909 100644 --- a/test/dm/regulator.c +++ b/test/dm/regulator.c @@ -19,6 +19,7 @@ #include <power/pmic.h> #include <power/regulator.h> #include <power/sandbox_pmic.h> +#include <test/test.h> #include <test/ut.h>
enum { diff --git a/test/dm/remoteproc.c b/test/dm/remoteproc.c index 1d9a9b32d5..1ebb7c2466 100644 --- a/test/dm/remoteproc.c +++ b/test/dm/remoteproc.c @@ -10,7 +10,9 @@ #include <remoteproc.h> #include <asm/io.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> + /** * dm_test_remoteproc_base() - test the operations after initializations * @uts: unit test state diff --git a/test/dm/reset.c b/test/dm/reset.c index c61daed490..ab0a38a18e 100644 --- a/test/dm/reset.c +++ b/test/dm/reset.c @@ -8,6 +8,7 @@ #include <reset.h> #include <dm/test.h> #include <asm/reset.h> +#include <test/test.h> #include <test/ut.h>
/* This must match the specifier for mbox-names="test" in the DT node */ diff --git a/test/dm/rtc.c b/test/dm/rtc.c index 7188742764..2653dd0fd2 100644 --- a/test/dm/rtc.c +++ b/test/dm/rtc.c @@ -11,6 +11,7 @@ #include <asm/io.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Simple RTC sanity check */ diff --git a/test/dm/serial.c b/test/dm/serial.c index 3d741a8c36..175e19dbc6 100644 --- a/test/dm/serial.c +++ b/test/dm/serial.c @@ -7,6 +7,7 @@ #include <serial.h> #include <dm.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
static int dm_test_serial(struct unit_test_state *uts) diff --git a/test/dm/sf.c b/test/dm/sf.c index 3788d59052..e70bc78e91 100644 --- a/test/dm/sf.c +++ b/test/dm/sf.c @@ -14,6 +14,7 @@ #include <asm/test.h> #include <dm/test.h> #include <dm/util.h> +#include <test/test.h> #include <test/ut.h>
/* Simple test of sandbox SPI flash */ diff --git a/test/dm/smem.c b/test/dm/smem.c index 4099a5f66c..21dd96e409 100644 --- a/test/dm/smem.c +++ b/test/dm/smem.c @@ -7,6 +7,7 @@ #include <dm.h> #include <smem.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Basic test of the smem uclass */ diff --git a/test/dm/sound.c b/test/dm/sound.c index 3767abbd1c..bb2b7285e2 100644 --- a/test/dm/sound.c +++ b/test/dm/sound.c @@ -9,6 +9,7 @@ #include <sound.h> #include <dm/test.h> #include <test/ut.h> +#include <test/test.h> #include <asm/test.h>
/* Basic test of the sound codec uclass */ diff --git a/test/dm/spi.c b/test/dm/spi.c index ffd789cd7f..978997786a 100644 --- a/test/dm/spi.c +++ b/test/dm/spi.c @@ -13,6 +13,7 @@ #include <dm/test.h> #include <dm/uclass-internal.h> #include <dm/util.h> +#include <test/test.h> #include <test/ut.h>
/* Test that we can find buses and chip-selects */ diff --git a/test/dm/spmi.c b/test/dm/spmi.c index e6a910859e..aa8d6961fd 100644 --- a/test/dm/spmi.c +++ b/test/dm/spmi.c @@ -13,6 +13,7 @@ #include <power/pmic.h> #include <spmi/spmi.h> #include <asm/gpio.h> +#include <test/test.h> #include <test/ut.h>
/* Test if bus childs got probed propperly*/ diff --git a/test/dm/syscon.c b/test/dm/syscon.c index 0ff9da7ec6..533e328449 100644 --- a/test/dm/syscon.c +++ b/test/dm/syscon.c @@ -9,6 +9,7 @@ #include <regmap.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Base test of system controllers */ diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c index 5b2358ef67..e5cd18cd82 100644 --- a/test/dm/sysreset.c +++ b/test/dm/sysreset.c @@ -9,6 +9,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Test that we can use particular sysreset devices */ diff --git a/test/dm/tee.c b/test/dm/tee.c index 22f05a4219..c59a515b8b 100644 --- a/test/dm/tee.c +++ b/test/dm/tee.c @@ -8,6 +8,7 @@ #include <dm/test.h> #include <sandboxtee.h> #include <tee.h> +#include <test/test.h> #include <test/ut.h> #include <tee/optee_ta_avb.h>
diff --git a/test/dm/test-driver.c b/test/dm/test-driver.c index abb5b7115a..3261a823f5 100644 --- a/test/dm/test-driver.c +++ b/test/dm/test-driver.c @@ -10,9 +10,10 @@ #include <dm.h> #include <errno.h> #include <malloc.h> +#include <asm/io.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h> -#include <asm/io.h>
int dm_testdrv_op_count[DM_TEST_OP_COUNT]; static struct unit_test_state *uts = &global_dm_test_state; diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 1fb8b5c248..b24d5056c3 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -16,6 +16,7 @@ #include <dm/util.h> #include <dm/lists.h> #include <dm/of_access.h> +#include <test/test.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 72648162a9..1441f029e7 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -13,6 +13,8 @@ #include <dm/test.h> #include <dm/root.h> #include <dm/uclass-internal.h> +#include <test/test.h> +#include <test/test.h> #include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR; diff --git a/test/dm/test-uclass.c b/test/dm/test-uclass.c index 25271c6ba0..eabaca72e4 100644 --- a/test/dm/test-uclass.c +++ b/test/dm/test-uclass.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <dm/test.h> #include <linux/list.h> +#include <test/test.h> #include <test/ut.h>
static struct unit_test_state *uts = &global_dm_test_state; diff --git a/test/dm/timer.c b/test/dm/timer.c index 9367dab5d5..4aa5eeac75 100644 --- a/test/dm/timer.c +++ b/test/dm/timer.c @@ -7,6 +7,7 @@ #include <dm.h> #include <timer.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* diff --git a/test/dm/usb.c b/test/dm/usb.c index ef454b0ae5..47cb9b9b49 100644 --- a/test/dm/usb.c +++ b/test/dm/usb.c @@ -13,6 +13,7 @@ #include <dm/device-internal.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h>
/* Test that sandbox USB works correctly */ diff --git a/test/dm/video.c b/test/dm/video.c index 3151ebb73f..5d93aefd34 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -13,6 +13,7 @@ #include <video_console.h> #include <dm/test.h> #include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h>
/* diff --git a/test/dm/virtio.c b/test/dm/virtio.c index 4b317d2ec3..a2ed36a2fe 100644 --- a/test/dm/virtio.c +++ b/test/dm/virtio.c @@ -9,9 +9,10 @@ #include <virtio.h> #include <virtio_ring.h> #include <dm/device-internal.h> -#include <dm/uclass-internal.h> #include <dm/root.h> #include <dm/test.h> +#include <dm/uclass-internal.h> +#include <test/test.h> #include <test/ut.h>
/* Basic test of the virtio uclass */ diff --git a/test/dm/wdt.c b/test/dm/wdt.c index 1d31ec55c6..c704098b24 100644 --- a/test/dm/wdt.c +++ b/test/dm/wdt.c @@ -9,6 +9,7 @@ #include <asm/state.h> #include <asm/test.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
/* Test that watchdog driver functions are called */ diff --git a/test/lib/lmb.c b/test/lib/lmb.c index ec68227bb6..1f50a51cd6 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -4,8 +4,10 @@ */
#include <common.h> +#include <dm.h> #include <lmb.h> #include <dm/test.h> +#include <test/test.h> #include <test/ut.h>
static int check_lmb(struct unit_test_state *uts, struct lmb *lmb,

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/fpga/socfpga_arria10.c | 1 + include/fs_loader.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/fpga/socfpga_arria10.c b/drivers/fpga/socfpga_arria10.c index 5fb9d6a191..d94366a39a 100644 --- a/drivers/fpga/socfpga_arria10.c +++ b/drivers/fpga/socfpga_arria10.c @@ -11,6 +11,7 @@ #include <altera.h> #include <asm/arch/pinmux.h> #include <common.h> +#include <dm.h> #include <dm/ofnode.h> #include <errno.h> #include <fs_loader.h> diff --git a/include/fs_loader.h b/include/fs_loader.h index b728c06fcf..1b3c58086f 100644 --- a/include/fs_loader.h +++ b/include/fs_loader.h @@ -6,7 +6,7 @@ #ifndef _FS_LOADER_H_ #define _FS_LOADER_H_
-#include <dm.h> +struct udevice;
/** * struct phandle_part - A place for storing phandle of node and its partition

This header file should not be included in other header files. Remove it and use other headers and C inclusions instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
cmd/mdio.c | 1 + cmd/mii.c | 1 + include/dm/read.h | 1 + include/phy.h | 5 ++++- net/eth_legacy.c | 1 + 5 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/cmd/mdio.c b/cmd/mdio.c index 22c8fbe856..4e985302a4 100644 --- a/cmd/mdio.c +++ b/cmd/mdio.c @@ -10,6 +10,7 @@
#include <common.h> #include <command.h> +#include <dm.h> #include <miiphy.h> #include <phy.h>
diff --git a/cmd/mii.c b/cmd/mii.c index 23ee1e6cfa..fb2769c138 100644 --- a/cmd/mii.c +++ b/cmd/mii.c @@ -10,6 +10,7 @@
#include <common.h> #include <command.h> +#include <dm.h> #include <miiphy.h>
typedef struct _MII_field_desc_t { diff --git a/include/dm/read.h b/include/dm/read.h index d37fcb504d..75970619f1 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -9,6 +9,7 @@ #ifndef _DM_READ_H #define _DM_READ_H
+#include <dm/device.h> #include <dm/fdtaddr.h> #include <dm/ofnode.h> #include <dm/uclass.h> diff --git a/include/phy.h b/include/phy.h index e50f56b6eb..4518ddad50 100644 --- a/include/phy.h +++ b/include/phy.h @@ -9,13 +9,16 @@ #ifndef _PHY_H #define _PHY_H
-#include <dm.h> +#include <dm/ofnode.h> +#include <dm/read.h> #include <linux/list.h> #include <linux/mii.h> #include <linux/ethtool.h> #include <linux/mdio.h> #include <phy_interface.h>
+struct udevice; + #define PHY_FIXED_ID 0xa5a55a5a /* * There is no actual id for this. diff --git a/net/eth_legacy.c b/net/eth_legacy.c index 41f5263526..8cdef5b827 100644 --- a/net/eth_legacy.c +++ b/net/eth_legacy.c @@ -7,6 +7,7 @@
#include <common.h> #include <command.h> +#include <dm.h> #include <env.h> #include <net.h> #include <phy.h>

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/x86/cpu/ivybridge/sdram.c | 1 + include/spi_flash.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/cpu/ivybridge/sdram.c b/arch/x86/cpu/ivybridge/sdram.c index 8a58d0383d..d2d51ebca1 100644 --- a/arch/x86/cpu/ivybridge/sdram.c +++ b/arch/x86/cpu/ivybridge/sdram.c @@ -10,6 +10,7 @@ */
#include <common.h> +#include <dm.h> #include <errno.h> #include <fdtdec.h> #include <malloc.h> diff --git a/include/spi_flash.h b/include/spi_flash.h index 0b23f57a71..0d302a7938 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -9,10 +9,11 @@ #ifndef _SPI_FLASH_H_ #define _SPI_FLASH_H_
-#include <dm.h> /* Because we dereference struct udevice here */ #include <linux/types.h> #include <linux/mtd/spi-nor.h>
+struct udevice; + /* by default ENV use the same parameters than SF command */ #ifndef CONFIG_ENV_SPI_BUS # define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/arm/mach-imx/cpu.c | 1 + include/thermal.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-imx/cpu.c b/arch/arm/mach-imx/cpu.c index d39f607e3f..68268bd515 100644 --- a/arch/arm/mach-imx/cpu.c +++ b/arch/arm/mach-imx/cpu.c @@ -8,6 +8,7 @@
#include <bootm.h> #include <common.h> +#include <dm.h> #include <netdev.h> #include <linux/errno.h> #include <asm/io.h> diff --git a/include/thermal.h b/include/thermal.h index 11d75256e0..52a3317fd5 100644 --- a/include/thermal.h +++ b/include/thermal.h @@ -7,7 +7,7 @@ #ifndef _THERMAL_H_ #define _THERMAL_H_
-#include <dm.h> +struct udevice;
int thermal_get_temp(struct udevice *dev, int *temp);

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
board/atmel/common/board.c | 1 + cmd/w1.c | 1 + include/w1.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/board/atmel/common/board.c b/board/atmel/common/board.c index c41706c400..eee5c357bd 100644 --- a/board/atmel/common/board.c +++ b/board/atmel/common/board.c @@ -5,6 +5,7 @@ */
#include <common.h> +#include <dm.h> #include <env.h> #include <w1.h> #include <w1-eeprom.h> diff --git a/cmd/w1.c b/cmd/w1.c index 9c95fcf9cd..c7e2b62bfa 100644 --- a/cmd/w1.c +++ b/cmd/w1.c @@ -6,6 +6,7 @@ */ #include <common.h> #include <command.h> +#include <dm.h> #include <w1.h> #include <w1-eeprom.h> #include <dm/device-internal.h> diff --git a/include/w1.h b/include/w1.h index b958b1c92c..77f439e587 100644 --- a/include/w1.h +++ b/include/w1.h @@ -8,7 +8,7 @@ #ifndef __W1_H #define __W1_H
-#include <dm.h> +struct udevice;
#define W1_FAMILY_DS24B33 0x23 #define W1_FAMILY_DS2431 0x2d

Two files relay on efi_driver.h to include common.h and dm.h which is incorrect. The former should always be included in a non-host C file and the latter should be included if driver model is used.
Signed-off-by: Simon Glass sjg@chromium.org ---
include/efi_driver.h | 2 -- lib/efi_driver/efi_block_device.c | 2 ++ lib/efi_driver/efi_uclass.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/efi_driver.h b/include/efi_driver.h index 840483a416..2b62219c5b 100644 --- a/include/efi_driver.h +++ b/include/efi_driver.h @@ -8,8 +8,6 @@ #ifndef _EFI_DRIVER_H #define _EFI_DRIVER_H 1
-#include <common.h> -#include <dm.h> #include <efi_loader.h>
/* diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index cf02341931..c7e7946cdd 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 <dm.h> #include <efi_driver.h> #include <dm/device-internal.h> #include <dm/root.h> diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c index b14746e6b1..c837db165c 100644 --- a/lib/efi_driver/efi_uclass.c +++ b/lib/efi_driver/efi_uclass.c @@ -17,6 +17,8 @@ * controllers. */
+#include <common.h> +#include <dm.h> #include <efi_driver.h>
/**

On 10/27/19 4:53 PM, Simon Glass wrote:> Two files relay on efi_driver.h to include common.h and dm.h which is %s/relay/rely/
incorrect. The former should always be included in a non-host C file and the latter should be included if driver model is used.
https://www.denx.de/wiki/U-Boot/CodingStyle does no mention these requirements. Does the wiki need an update?
Non-host C files not including common.h at all or not as the first include call for trouble, cf.
https://lists.denx.de/pipermail/u-boot/2019-October/388406.html https://lists.denx.de/pipermail/u-boot/2019-October/388408.html
As your patch makes it obvious that common.h is included first:
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de
Signed-off-by: Simon Glass sjg@chromium.org
include/efi_driver.h | 2 -- lib/efi_driver/efi_block_device.c | 2 ++ lib/efi_driver/efi_uclass.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/include/efi_driver.h b/include/efi_driver.h index 840483a416..2b62219c5b 100644 --- a/include/efi_driver.h +++ b/include/efi_driver.h @@ -8,8 +8,6 @@ #ifndef _EFI_DRIVER_H #define _EFI_DRIVER_H 1
-#include <common.h> -#include <dm.h> #include <efi_loader.h>
/* diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index cf02341931..c7e7946cdd 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 <dm.h> #include <efi_driver.h> #include <dm/device-internal.h> #include <dm/root.h> diff --git a/lib/efi_driver/efi_uclass.c b/lib/efi_driver/efi_uclass.c index b14746e6b1..c837db165c 100644 --- a/lib/efi_driver/efi_uclass.c +++ b/lib/efi_driver/efi_uclass.c @@ -17,6 +17,8 @@
- controllers.
*/
+#include <common.h> +#include <dm.h> #include <efi_driver.h>
/**

Hi Heinrich,
On Sun, 27 Oct 2019 at 11:42, Heinrich Schuchardt xypron.glpk@gmx.de wrote:
On 10/27/19 4:53 PM, Simon Glass wrote:> Two files relay on efi_driver.h to include common.h and dm.h which is %s/relay/rely/
incorrect. The former should always be included in a non-host C file and the latter should be included if driver model is used.
https://www.denx.de/wiki/U-Boot/CodingStyle does no mention these requirements. Does the wiki need an update?
OK I added a bit of an update. Feel free to improve it.
Non-host C files not including common.h at all or not as the first include call for trouble, cf.
https://lists.denx.de/pipermail/u-boot/2019-October/388406.html https://lists.denx.de/pipermail/u-boot/2019-October/388408.html
As your patch makes it obvious that common.h is included first:
Reviewed-by: Heinrich Schuchardt xypron.glpk@gmx.de
Thanks...at some point we might consider running a tool over the code base to sort the includes.
Regards, Simon

This file should not include common.h and dm.h so remove them. Also move the inclusion of this file to after the normal includes.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/power/regulator/fixed.c | 3 ++- drivers/power/regulator/gpio-regulator.c | 3 ++- drivers/power/regulator/regulator_common.c | 4 +++- drivers/power/regulator/regulator_common.h | 2 -- 4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/power/regulator/fixed.c b/drivers/power/regulator/fixed.c index 763e671d54..5c93e6523b 100644 --- a/drivers/power/regulator/fixed.c +++ b/drivers/power/regulator/fixed.c @@ -5,13 +5,14 @@ * Przemyslaw Marczak p.marczak@samsung.com */
-#include "regulator_common.h" #include <common.h> #include <errno.h> #include <dm.h> #include <power/pmic.h> #include <power/regulator.h>
+#include "regulator_common.h" + static int fixed_regulator_ofdata_to_platdata(struct udevice *dev) { struct dm_regulator_uclass_platdata *uc_pdata; diff --git a/drivers/power/regulator/gpio-regulator.c b/drivers/power/regulator/gpio-regulator.c index ec1dcb64b3..730aea833f 100644 --- a/drivers/power/regulator/gpio-regulator.c +++ b/drivers/power/regulator/gpio-regulator.c @@ -4,7 +4,6 @@ * Keerthy j-keerthy@ti.com */
-#include "regulator_common.h" #include <common.h> #include <fdtdec.h> #include <errno.h> @@ -14,6 +13,8 @@ #include <power/pmic.h> #include <power/regulator.h>
+#include "regulator_common.h" + #define GPIO_REGULATOR_MAX_STATES 2
DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/power/regulator/regulator_common.c b/drivers/power/regulator/regulator_common.c index 2041086567..242668a55b 100644 --- a/drivers/power/regulator/regulator_common.c +++ b/drivers/power/regulator/regulator_common.c @@ -4,10 +4,12 @@ * Sven Schwermer sven.svenschwermer@disruptive-technologies.com */
-#include "regulator_common.h" #include <common.h> +#include <dm.h> #include <power/regulator.h>
+#include "regulator_common.h" + int regulator_common_ofdata_to_platdata(struct udevice *dev, struct regulator_common_platdata *dev_pdata, const char *enable_gpio_name) { diff --git a/drivers/power/regulator/regulator_common.h b/drivers/power/regulator/regulator_common.h index 18a525880a..bf80439c78 100644 --- a/drivers/power/regulator/regulator_common.h +++ b/drivers/power/regulator/regulator_common.h @@ -7,9 +7,7 @@ #ifndef _REGULATOR_COMMON_H #define _REGULATOR_COMMON_H
-#include <common.h> #include <asm/gpio.h> -#include <dm.h>
struct regulator_common_platdata { struct gpio_desc gpio; /* GPIO for regulator enable control */

We only need to include this header once. Drop the duplicate.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/mmc/sdhci.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index fbc576fd72..c081bfde5f 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -13,7 +13,6 @@ #include <malloc.h> #include <mmc.h> #include <sdhci.h> -#include <dm.h>
#if defined(CONFIG_FIXED_SDHCI_ALIGNED_BUFFER) void *aligned_buffer = (void *)CONFIG_FIXED_SDHCI_ALIGNED_BUFFER;

We only need to include this header once. Drop the duplicate.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/spi/mscc_bb_spi.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/spi/mscc_bb_spi.c b/drivers/spi/mscc_bb_spi.c index c3c7b80426..22fa2efd34 100644 --- a/drivers/spi/mscc_bb_spi.c +++ b/drivers/spi/mscc_bb_spi.c @@ -10,7 +10,6 @@ #include <errno.h> #include <malloc.h> #include <spi.h> -#include <dm.h> #include <asm/gpio.h> #include <asm/io.h> #include <linux/delay.h>

We only need to include this header once. Drop the duplicate.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/ram/k3-am654-ddrss.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c index 7015d8cfe7..00673e80a9 100644 --- a/drivers/ram/k3-am654-ddrss.c +++ b/drivers/ram/k3-am654-ddrss.c @@ -12,7 +12,6 @@ #include <ram.h> #include <asm/io.h> #include <power-domain.h> -#include <dm.h> #include <asm/arch/sys_proto.h> #include <power/regulator.h> #include "k3-am654-ddrss.h"

On 27/10/19 9:24 PM, Simon Glass wrote:
We only need to include this header once. Drop the duplicate.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Lokesh Vutla lokeshvutla@ti.com
Thanks and regards, Lokesh
drivers/ram/k3-am654-ddrss.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c index 7015d8cfe7..00673e80a9 100644 --- a/drivers/ram/k3-am654-ddrss.c +++ b/drivers/ram/k3-am654-ddrss.c @@ -12,7 +12,6 @@ #include <ram.h> #include <asm/io.h> #include <power-domain.h> -#include <dm.h> #include <asm/arch/sys_proto.h> #include <power/regulator.h> #include "k3-am654-ddrss.h"

We only need to include this header once. Drop the duplicate.
Signed-off-by: Simon Glass sjg@chromium.org ---
board/liebherr/display5/display5.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index 85ca777c1d..14bae67886 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -23,7 +23,6 @@ #include <netdev.h> #include <i2c.h>
-#include <dm.h> #include <dm/platform_data/serial_mxc.h> #include <dm/platdata.h>

On Sun, 27 Oct 2019 09:54:01 -0600 Simon Glass sjg@chromium.org wrote:
We only need to include this header once. Drop the duplicate.
Signed-off-by: Simon Glass sjg@chromium.org
board/liebherr/display5/display5.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/board/liebherr/display5/display5.c b/board/liebherr/display5/display5.c index 85ca777c1d..14bae67886 100644 --- a/board/liebherr/display5/display5.c +++ b/board/liebherr/display5/display5.c @@ -23,7 +23,6 @@ #include <netdev.h> #include <i2c.h>
-#include <dm.h> #include <dm/platform_data/serial_mxc.h> #include <dm/platdata.h>
Thanks Simon for spotting it.
Acked-by: Lukasz Majewski lukma@denx.de
Best regards,
Lukasz Majewski
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de

The layerscape header should not include dm.h so remove it.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/pci/pcie_layerscape.h | 1 - drivers/pci/pcie_layerscape_fixup.c | 1 + drivers/pci/pcie_layerscape_gen4.h | 1 - drivers/pci/pcie_layerscape_gen4_fixup.c | 1 + 4 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pcie_layerscape.h b/drivers/pci/pcie_layerscape.h index ddfbba6538..9423d963b1 100644 --- a/drivers/pci/pcie_layerscape.h +++ b/drivers/pci/pcie_layerscape.h @@ -8,7 +8,6 @@ #ifndef _PCIE_LAYERSCAPE_H_ #define _PCIE_LAYERSCAPE_H_ #include <pci.h> -#include <dm.h>
#ifndef CONFIG_SYS_PCI_MEMORY_BUS #define CONFIG_SYS_PCI_MEMORY_BUS CONFIG_SYS_SDRAM_BASE diff --git a/drivers/pci/pcie_layerscape_fixup.c b/drivers/pci/pcie_layerscape_fixup.c index 089e031724..bd7c01d296 100644 --- a/drivers/pci/pcie_layerscape_fixup.c +++ b/drivers/pci/pcie_layerscape_fixup.c @@ -6,6 +6,7 @@ */
#include <common.h> +#include <dm.h> #include <pci.h> #include <asm/arch/fsl_serdes.h> #include <asm/io.h> diff --git a/drivers/pci/pcie_layerscape_gen4.h b/drivers/pci/pcie_layerscape_gen4.h index 27c2d09332..f681e63b30 100644 --- a/drivers/pci/pcie_layerscape_gen4.h +++ b/drivers/pci/pcie_layerscape_gen4.h @@ -9,7 +9,6 @@ #ifndef _PCIE_LAYERSCAPE_GEN4_H_ #define _PCIE_LAYERSCAPE_GEN4_H_ #include <pci.h> -#include <dm.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 1c9e5750bd..e42a31da82 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 <dm.h> #include <pci.h> #include <asm/arch/fsl_serdes.h> #include <asm/io.h>

These files should not be included in meson header files. Drop them and tidy up the affected C files.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/video/meson/meson_canvas.c | 4 ++++ drivers/video/meson/meson_plane.c | 5 +++++ drivers/video/meson/meson_vclk.c | 2 ++ drivers/video/meson/meson_venc.c | 4 ++++ drivers/video/meson/meson_vpu.c | 18 +++++++++++++++--- drivers/video/meson/meson_vpu.h | 17 +++++------------ drivers/video/meson/meson_vpu_init.c | 4 ++++ include/video.h | 2 ++ 8 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/drivers/video/meson/meson_canvas.c b/drivers/video/meson/meson_canvas.c index b71cbfcc0b..eccac2f8f2 100644 --- a/drivers/video/meson/meson_canvas.c +++ b/drivers/video/meson/meson_canvas.c @@ -6,6 +6,10 @@ * Author: Neil Armstrong narmstrong@baylibre.com */
+#include <common.h> +#include <dm.h> +#include <asm/io.h> + #include "meson_vpu.h"
/* DMC Registers */ diff --git a/drivers/video/meson/meson_plane.c b/drivers/video/meson/meson_plane.c index 2bc9327e1e..8edf451f13 100644 --- a/drivers/video/meson/meson_plane.c +++ b/drivers/video/meson/meson_plane.c @@ -6,6 +6,11 @@ * Author: Neil Armstrong narmstrong@baylibre.com */
+#include <common.h> +#include <dm.h> +#include <asm/io.h> +#include <linux/bitfield.h> + #include "meson_vpu.h"
/* OSDx_BLKx_CFG */ diff --git a/drivers/video/meson/meson_vclk.c b/drivers/video/meson/meson_vclk.c index 0f628e920b..01bfa4bcb8 100644 --- a/drivers/video/meson/meson_vclk.c +++ b/drivers/video/meson/meson_vclk.c @@ -6,6 +6,8 @@ * Author: Neil Armstrong narmstrong@baylibre.com */
+#include <common.h> +#include <dm.h> #include <edid.h> #include "meson_vpu.h" #include <linux/iopoll.h> diff --git a/drivers/video/meson/meson_venc.c b/drivers/video/meson/meson_venc.c index 5da4b3f096..89e859b02a 100644 --- a/drivers/video/meson/meson_venc.c +++ b/drivers/video/meson/meson_venc.c @@ -6,7 +6,11 @@ * Author: Neil Armstrong narmstrong@baylibre.com */
+#include <common.h> +#include <dm.h> #include <edid.h> +#include <fdtdec.h> +#include <asm/io.h> #include "meson_vpu.h"
enum { diff --git a/drivers/video/meson/meson_vpu.c b/drivers/video/meson/meson_vpu.c index c3af9b013c..4eb66398d0 100644 --- a/drivers/video/meson/meson_vpu.c +++ b/drivers/video/meson/meson_vpu.c @@ -6,13 +6,17 @@ * Author: Neil Armstrong narmstrong@baylibre.com */
-#include "meson_vpu.h" +#include <common.h> +#include <display.h> +#include <dm.h> #include <efi_loader.h> -#include <dm/device-internal.h> -#include <dm/uclass-internal.h> #include <fdt_support.h> #include <linux/sizes.h> #include <asm/arch/mem.h> +#include <dm/device-internal.h> +#include <dm/uclass-internal.h> + +#include "meson_vpu.h" #include "meson_registers.h" #include "simplefb_common.h"
@@ -27,6 +31,14 @@ static struct meson_framebuffer { bool is_cvbs; } meson_fb = { 0 };
+bool meson_vpu_is_compatible(struct meson_vpu_priv *priv, + enum vpu_compatible family) +{ + enum vpu_compatible compat = dev_get_driver_data(priv->dev); + + return compat == family; +} + static int meson_vpu_setup_mode(struct udevice *dev, struct udevice *disp) { struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); diff --git a/drivers/video/meson/meson_vpu.h b/drivers/video/meson/meson_vpu.h index 0d9fddad2e..d9588c3775 100644 --- a/drivers/video/meson/meson_vpu.h +++ b/drivers/video/meson/meson_vpu.h @@ -9,14 +9,12 @@ #ifndef __MESON_VPU_H__ #define __MESON_VPU_H__
-#include <common.h> -#include <dm.h> #include <video.h> -#include <display.h> -#include <linux/io.h> -#include <linux/bitfield.h> #include "meson_registers.h"
+struct display_timing; +struct udevice; + enum { /* Maximum size we support */ VPU_MAX_WIDTH = 3840, @@ -38,13 +36,8 @@ struct meson_vpu_priv { void __iomem *dmc_base; };
-static inline bool meson_vpu_is_compatible(struct meson_vpu_priv *priv, - enum vpu_compatible family) -{ - enum vpu_compatible compat = dev_get_driver_data(priv->dev); - - return compat == family; -} +bool meson_vpu_is_compatible(struct meson_vpu_priv *priv, + enum vpu_compatible family);
#define hhi_update_bits(offset, mask, value) \ writel_bits(mask, value, priv->hhi_base + offset) diff --git a/drivers/video/meson/meson_vpu_init.c b/drivers/video/meson/meson_vpu_init.c index 12f8c4194a..8408c59eaa 100644 --- a/drivers/video/meson/meson_vpu_init.c +++ b/drivers/video/meson/meson_vpu_init.c @@ -8,6 +8,10 @@
#define DEBUG
+#include <common.h> +#include <dm.h> +#include <asm/io.h> + #include "meson_vpu.h"
/* HHI Registers */ diff --git a/include/video.h b/include/video.h index 485071d072..e7c58e86cb 100644 --- a/include/video.h +++ b/include/video.h @@ -17,6 +17,8 @@
#include <stdio_dev.h>
+struct udevice; + struct video_uc_platdata { uint align; uint size;

On Sun, 27 Oct 2019 09:54:03 -0600 Simon Glass sjg@chromium.org wrote:
These files should not be included in meson header files. Drop them and tidy up the affected C files.
Signed-off-by: Simon Glass sjg@chromium.org
Reviewed-by: Anatolij Gustschin agust@denx.de

On 27/10/2019 16:54, Simon Glass wrote:
These files should not be included in meson header files. Drop them and tidy up the affected C files.
Signed-off-by: Simon Glass sjg@chromium.org
drivers/video/meson/meson_canvas.c | 4 ++++ drivers/video/meson/meson_plane.c | 5 +++++ drivers/video/meson/meson_vclk.c | 2 ++ drivers/video/meson/meson_venc.c | 4 ++++ drivers/video/meson/meson_vpu.c | 18 +++++++++++++++--- drivers/video/meson/meson_vpu.h | 17 +++++------------ drivers/video/meson/meson_vpu_init.c | 4 ++++ include/video.h | 2 ++ 8 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/drivers/video/meson/meson_canvas.c b/drivers/video/meson/meson_canvas.c index b71cbfcc0b..eccac2f8f2 100644 --- a/drivers/video/meson/meson_canvas.c +++ b/drivers/video/meson/meson_canvas.c @@ -6,6 +6,10 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> +#include <asm/io.h>
#include "meson_vpu.h"
/* DMC Registers */ diff --git a/drivers/video/meson/meson_plane.c b/drivers/video/meson/meson_plane.c index 2bc9327e1e..8edf451f13 100644 --- a/drivers/video/meson/meson_plane.c +++ b/drivers/video/meson/meson_plane.c @@ -6,6 +6,11 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> +#include <asm/io.h> +#include <linux/bitfield.h>
#include "meson_vpu.h"
/* OSDx_BLKx_CFG */ diff --git a/drivers/video/meson/meson_vclk.c b/drivers/video/meson/meson_vclk.c index 0f628e920b..01bfa4bcb8 100644 --- a/drivers/video/meson/meson_vclk.c +++ b/drivers/video/meson/meson_vclk.c @@ -6,6 +6,8 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> #include <edid.h> #include "meson_vpu.h" #include <linux/iopoll.h> diff --git a/drivers/video/meson/meson_venc.c b/drivers/video/meson/meson_venc.c index 5da4b3f096..89e859b02a 100644 --- a/drivers/video/meson/meson_venc.c +++ b/drivers/video/meson/meson_venc.c @@ -6,7 +6,11 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> #include <edid.h> +#include <fdtdec.h> +#include <asm/io.h> #include "meson_vpu.h"
enum { diff --git a/drivers/video/meson/meson_vpu.c b/drivers/video/meson/meson_vpu.c index c3af9b013c..4eb66398d0 100644 --- a/drivers/video/meson/meson_vpu.c +++ b/drivers/video/meson/meson_vpu.c @@ -6,13 +6,17 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
-#include "meson_vpu.h" +#include <common.h> +#include <display.h> +#include <dm.h> #include <efi_loader.h> -#include <dm/device-internal.h> -#include <dm/uclass-internal.h> #include <fdt_support.h> #include <linux/sizes.h> #include <asm/arch/mem.h> +#include <dm/device-internal.h> +#include <dm/uclass-internal.h>
+#include "meson_vpu.h" #include "meson_registers.h" #include "simplefb_common.h"
@@ -27,6 +31,14 @@ static struct meson_framebuffer { bool is_cvbs; } meson_fb = { 0 };
+bool meson_vpu_is_compatible(struct meson_vpu_priv *priv,
enum vpu_compatible family)
+{
- enum vpu_compatible compat = dev_get_driver_data(priv->dev);
- return compat == family;
+}
static int meson_vpu_setup_mode(struct udevice *dev, struct udevice *disp) { struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); diff --git a/drivers/video/meson/meson_vpu.h b/drivers/video/meson/meson_vpu.h index 0d9fddad2e..d9588c3775 100644 --- a/drivers/video/meson/meson_vpu.h +++ b/drivers/video/meson/meson_vpu.h @@ -9,14 +9,12 @@ #ifndef __MESON_VPU_H__ #define __MESON_VPU_H__
-#include <common.h> -#include <dm.h> #include <video.h> -#include <display.h> -#include <linux/io.h> -#include <linux/bitfield.h> #include "meson_registers.h"
+struct display_timing; +struct udevice;
enum { /* Maximum size we support */ VPU_MAX_WIDTH = 3840, @@ -38,13 +36,8 @@ struct meson_vpu_priv { void __iomem *dmc_base; };
-static inline bool meson_vpu_is_compatible(struct meson_vpu_priv *priv,
enum vpu_compatible family)
-{
- enum vpu_compatible compat = dev_get_driver_data(priv->dev);
- return compat == family;
-} +bool meson_vpu_is_compatible(struct meson_vpu_priv *priv,
enum vpu_compatible family);
#define hhi_update_bits(offset, mask, value) \ writel_bits(mask, value, priv->hhi_base + offset) diff --git a/drivers/video/meson/meson_vpu_init.c b/drivers/video/meson/meson_vpu_init.c index 12f8c4194a..8408c59eaa 100644 --- a/drivers/video/meson/meson_vpu_init.c +++ b/drivers/video/meson/meson_vpu_init.c @@ -8,6 +8,10 @@
#define DEBUG
+#include <common.h> +#include <dm.h> +#include <asm/io.h>
#include "meson_vpu.h"
/* HHI Registers */ diff --git a/include/video.h b/include/video.h index 485071d072..e7c58e86cb 100644 --- a/include/video.h +++ b/include/video.h @@ -17,6 +17,8 @@
#include <stdio_dev.h>
+struct udevice;
struct video_uc_platdata { uint align; uint size;
Acked-by: Neil Armstrong narmstrong@baylibre.com

On 27/10/2019 18:48, Neil Armstrong wrote:
On 27/10/2019 16:54, Simon Glass wrote:
These files should not be included in meson header files. Drop them and tidy up the affected C files.
Signed-off-by: Simon Glass sjg@chromium.org
drivers/video/meson/meson_canvas.c | 4 ++++ drivers/video/meson/meson_plane.c | 5 +++++ drivers/video/meson/meson_vclk.c | 2 ++ drivers/video/meson/meson_venc.c | 4 ++++ drivers/video/meson/meson_vpu.c | 18 +++++++++++++++--- drivers/video/meson/meson_vpu.h | 17 +++++------------ drivers/video/meson/meson_vpu_init.c | 4 ++++ include/video.h | 2 ++ 8 files changed, 41 insertions(+), 15 deletions(-)
diff --git a/drivers/video/meson/meson_canvas.c b/drivers/video/meson/meson_canvas.c index b71cbfcc0b..eccac2f8f2 100644 --- a/drivers/video/meson/meson_canvas.c +++ b/drivers/video/meson/meson_canvas.c @@ -6,6 +6,10 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> +#include <asm/io.h>
#include "meson_vpu.h"
/* DMC Registers */ diff --git a/drivers/video/meson/meson_plane.c b/drivers/video/meson/meson_plane.c index 2bc9327e1e..8edf451f13 100644 --- a/drivers/video/meson/meson_plane.c +++ b/drivers/video/meson/meson_plane.c @@ -6,6 +6,11 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> +#include <asm/io.h> +#include <linux/bitfield.h>
#include "meson_vpu.h"
/* OSDx_BLKx_CFG */ diff --git a/drivers/video/meson/meson_vclk.c b/drivers/video/meson/meson_vclk.c index 0f628e920b..01bfa4bcb8 100644 --- a/drivers/video/meson/meson_vclk.c +++ b/drivers/video/meson/meson_vclk.c @@ -6,6 +6,8 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> #include <edid.h> #include "meson_vpu.h" #include <linux/iopoll.h> diff --git a/drivers/video/meson/meson_venc.c b/drivers/video/meson/meson_venc.c index 5da4b3f096..89e859b02a 100644 --- a/drivers/video/meson/meson_venc.c +++ b/drivers/video/meson/meson_venc.c @@ -6,7 +6,11 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
+#include <common.h> +#include <dm.h> #include <edid.h> +#include <fdtdec.h> +#include <asm/io.h> #include "meson_vpu.h"
enum { diff --git a/drivers/video/meson/meson_vpu.c b/drivers/video/meson/meson_vpu.c index c3af9b013c..4eb66398d0 100644 --- a/drivers/video/meson/meson_vpu.c +++ b/drivers/video/meson/meson_vpu.c @@ -6,13 +6,17 @@
- Author: Neil Armstrong narmstrong@baylibre.com
*/
-#include "meson_vpu.h" +#include <common.h> +#include <display.h> +#include <dm.h> #include <efi_loader.h> -#include <dm/device-internal.h> -#include <dm/uclass-internal.h> #include <fdt_support.h> #include <linux/sizes.h> #include <asm/arch/mem.h> +#include <dm/device-internal.h> +#include <dm/uclass-internal.h>
+#include "meson_vpu.h" #include "meson_registers.h" #include "simplefb_common.h"
@@ -27,6 +31,14 @@ static struct meson_framebuffer { bool is_cvbs; } meson_fb = { 0 };
+bool meson_vpu_is_compatible(struct meson_vpu_priv *priv,
enum vpu_compatible family)
+{
- enum vpu_compatible compat = dev_get_driver_data(priv->dev);
- return compat == family;
+}
static int meson_vpu_setup_mode(struct udevice *dev, struct udevice *disp) { struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); diff --git a/drivers/video/meson/meson_vpu.h b/drivers/video/meson/meson_vpu.h index 0d9fddad2e..d9588c3775 100644 --- a/drivers/video/meson/meson_vpu.h +++ b/drivers/video/meson/meson_vpu.h @@ -9,14 +9,12 @@ #ifndef __MESON_VPU_H__ #define __MESON_VPU_H__
-#include <common.h> -#include <dm.h> #include <video.h> -#include <display.h> -#include <linux/io.h> -#include <linux/bitfield.h> #include "meson_registers.h"
+struct display_timing; +struct udevice;
enum { /* Maximum size we support */ VPU_MAX_WIDTH = 3840, @@ -38,13 +36,8 @@ struct meson_vpu_priv { void __iomem *dmc_base; };
-static inline bool meson_vpu_is_compatible(struct meson_vpu_priv *priv,
enum vpu_compatible family)
-{
- enum vpu_compatible compat = dev_get_driver_data(priv->dev);
- return compat == family;
-} +bool meson_vpu_is_compatible(struct meson_vpu_priv *priv,
enum vpu_compatible family);
#define hhi_update_bits(offset, mask, value) \ writel_bits(mask, value, priv->hhi_base + offset) diff --git a/drivers/video/meson/meson_vpu_init.c b/drivers/video/meson/meson_vpu_init.c index 12f8c4194a..8408c59eaa 100644 --- a/drivers/video/meson/meson_vpu_init.c +++ b/drivers/video/meson/meson_vpu_init.c @@ -8,6 +8,10 @@
#define DEBUG
+#include <common.h> +#include <dm.h> +#include <asm/io.h>
#include "meson_vpu.h"
/* HHI Registers */ diff --git a/include/video.h b/include/video.h index 485071d072..e7c58e86cb 100644 --- a/include/video.h +++ b/include/video.h @@ -17,6 +17,8 @@
#include <stdio_dev.h>
+struct udevice;
struct video_uc_platdata { uint align; uint size;
Acked-by: Neil Armstrong narmstrong@baylibre.com
Applied to u-boot-amlogic
Neil

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/arm/include/asm/arch-mediatek/reset.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/arch-mediatek/reset.h b/arch/arm/include/asm/arch-mediatek/reset.h index 9704666d24..4ba0bad94e 100644 --- a/arch/arm/include/asm/arch-mediatek/reset.h +++ b/arch/arm/include/asm/arch-mediatek/reset.h @@ -6,7 +6,7 @@ #ifndef __MEDIATEK_RESET_H #define __MEDIATEK_RESET_H
-#include <dm.h> +struct udevice;
int mediatek_reset_bind(struct udevice *pdev, u32 regofs, u32 num_regs);

This header file should not be included in other header files. Remove it from each one and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
arch/mips/mach-mscc/include/mach/jr2/jr2.h | 3 --- arch/mips/mach-mscc/include/mach/luton/luton.h | 3 --- arch/mips/mach-mscc/include/mach/ocelot/ocelot.h | 3 --- arch/mips/mach-mscc/include/mach/serval/serval.h | 3 --- arch/mips/mach-mscc/include/mach/servalt/servalt.h | 3 --- board/mscc/servalt/servalt.c | 2 ++ 6 files changed, 2 insertions(+), 15 deletions(-)
diff --git a/arch/mips/mach-mscc/include/mach/jr2/jr2.h b/arch/mips/mach-mscc/include/mach/jr2/jr2.h index 67244f63fa..3a779e7035 100644 --- a/arch/mips/mach-mscc/include/mach/jr2/jr2.h +++ b/arch/mips/mach-mscc/include/mach/jr2/jr2.h @@ -8,9 +8,6 @@ #ifndef _MSCC_JR2_H_ #define _MSCC_JR2_H_
-#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/luton/luton.h b/arch/mips/mach-mscc/include/mach/luton/luton.h index 19f02ede66..dda665fc15 100644 --- a/arch/mips/mach-mscc/include/mach/luton/luton.h +++ b/arch/mips/mach-mscc/include/mach/luton/luton.h @@ -8,9 +8,6 @@ #ifndef _MSCC_OCELOT_H_ #define _MSCC_OCELOT_H_
-#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h b/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h index 2cb2135d37..72b07c33cd 100644 --- a/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h +++ b/arch/mips/mach-mscc/include/mach/ocelot/ocelot.h @@ -8,9 +8,6 @@ #ifndef _MSCC_OCELOT_H_ #define _MSCC_OCELOT_H_
-#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/serval/serval.h b/arch/mips/mach-mscc/include/mach/serval/serval.h index 763d18fe62..a78c6e59bb 100644 --- a/arch/mips/mach-mscc/include/mach/serval/serval.h +++ b/arch/mips/mach-mscc/include/mach/serval/serval.h @@ -8,9 +8,6 @@ #ifndef _MSCC_SERVAL_H_ #define _MSCC_SERVAL_H_
-#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/arch/mips/mach-mscc/include/mach/servalt/servalt.h b/arch/mips/mach-mscc/include/mach/servalt/servalt.h index 9015bc7dad..4d7d0886dd 100644 --- a/arch/mips/mach-mscc/include/mach/servalt/servalt.h +++ b/arch/mips/mach-mscc/include/mach/servalt/servalt.h @@ -8,9 +8,6 @@ #ifndef _MSCC_SERVALT_H_ #define _MSCC_SERVALT_H_
-#include <linux/bitops.h> -#include <dm.h> - /* * Target offset base(s) */ diff --git a/board/mscc/servalt/servalt.c b/board/mscc/servalt/servalt.c index 566f9765c2..541a84c9cf 100644 --- a/board/mscc/servalt/servalt.c +++ b/board/mscc/servalt/servalt.c @@ -7,6 +7,8 @@ #include <asm/io.h> #include <led.h>
+DECLARE_GLOBAL_DATA_PTR; + enum { BOARD_TYPE_PCB116 = 0xAABBCE00, };

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Drop the common.h inclusion also.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/adc/stm32-adc-core.c | 1 + drivers/adc/stm32-adc-core.h | 4 ++-- drivers/adc/stm32-adc.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/adc/stm32-adc-core.c b/drivers/adc/stm32-adc-core.c index 04b6a8a2f5..d61c23b91a 100644 --- a/drivers/adc/stm32-adc-core.c +++ b/drivers/adc/stm32-adc-core.c @@ -7,6 +7,7 @@ */
#include <common.h> +#include <dm.h> #include <asm/io.h> #include <power/regulator.h> #include "stm32-adc-core.h" diff --git a/drivers/adc/stm32-adc-core.h b/drivers/adc/stm32-adc-core.h index ba0e10e6cc..05968dbcc8 100644 --- a/drivers/adc/stm32-adc-core.h +++ b/drivers/adc/stm32-adc-core.h @@ -26,9 +26,9 @@ #define STM32_ADC_MAX_ADCS 3 #define STM32_ADCX_COMN_OFFSET 0x300
-#include <common.h> #include <clk.h> -#include <dm.h> + +struct udevice;
/** * struct stm32_adc_common - stm32 ADC driver common data (for all instances) diff --git a/drivers/adc/stm32-adc.c b/drivers/adc/stm32-adc.c index 029338e4af..c928980e1d 100644 --- a/drivers/adc/stm32-adc.c +++ b/drivers/adc/stm32-adc.c @@ -8,6 +8,7 @@
#include <common.h> #include <adc.h> +#include <dm.h> #include <asm/io.h> #include <linux/iopoll.h> #include "stm32-adc-core.h"

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c | 4 ++++ drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c index 96b27e6e5a..01c2b922c8 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c @@ -1,6 +1,10 @@ // SPDX-License-Identifier: GPL-2.0+
#include <common.h> +#include <clk.h> +#include <dm.h> +#include <linux/err.h> + #include "brcmnand_compat.h"
struct clk *devm_clk_get(struct udevice *dev, const char *id) diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h index 02cab0f828..408b2d809a 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.h @@ -3,8 +3,8 @@ #ifndef __BRCMNAND_COMPAT_H #define __BRCMNAND_COMPAT_H
-#include <clk.h> -#include <dm.h> +struct clk; +struct udevice;
struct clk *devm_clk_get(struct udevice *dev, const char *id); int clk_prepare_enable(struct clk *clk);

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Also drop asm.io
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/ufs/cdns-platform.c | 1 + drivers/ufs/ufs.c | 2 +- drivers/ufs/ufs.h | 5 ++--- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/ufs/cdns-platform.c b/drivers/ufs/cdns-platform.c index c80f4253e4..341fd217c7 100644 --- a/drivers/ufs/cdns-platform.c +++ b/drivers/ufs/cdns-platform.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> #include <ufs.h> +#include <asm/io.h>
#include "ufs.h"
diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 23306863d5..89a32d38cd 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -16,7 +16,7 @@ #include <malloc.h> #include <hexdump.h> #include <scsi.h> - +#include <asm/io.h> #include <asm/dma-mapping.h>
#include "ufs.h" diff --git a/drivers/ufs/ufs.h b/drivers/ufs/ufs.h index e0bde93776..069888fdd9 100644 --- a/drivers/ufs/ufs.h +++ b/drivers/ufs/ufs.h @@ -2,11 +2,10 @@ #ifndef __UFS_H #define __UFS_H
-#include <asm/io.h> -#include <dm.h> - #include "unipro.h"
+struct udevice; + #define UFS_CDB_SIZE 16 #define UPIU_TRANSACTION_UIC_CMD 0x1F #define UIC_CMD_SIZE (sizeof(u32) * 4)

This header file should not be included in other header files. Remove it and use a forward declaration instead.
Also move the inline function out into a C file. We should not include C code in headers.
Signed-off-by: Simon Glass sjg@chromium.org ---
drivers/usb/musb-new/musb_uboot.c | 37 +++++++++++++++++++++++++ drivers/usb/musb-new/pic32.c | 1 + drivers/usb/musb-new/usb-compat.h | 45 +++++++------------------------ 3 files changed, 47 insertions(+), 36 deletions(-)
diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index 9eb593402e..98df080e50 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -1,5 +1,6 @@ #include <common.h> #include <console.h> +#include <dm.h> #include <watchdog.h> #include <linux/errno.h> #include <linux/usb/ch9.h> @@ -449,3 +450,39 @@ struct musb *musb_register(struct musb_hdrc_platform_data *plat, void *bdata,
return *musbp; } + +#if CONFIG_IS_ENABLED(DM_USB) +struct usb_device *usb_dev_get_parent(struct usb_device *udev) +{ + struct udevice *parent = udev->dev->parent; + + /* + * When called from usb-uclass.c: usb_scan_device() udev->dev points + * to the parent udevice, not the actual udevice belonging to the + * udev as the device is not instantiated yet. + * + * If dev is an usb-bus, then we are called from usb_scan_device() for + * an usb-device plugged directly into the root port, return NULL. + */ + if (device_get_uclass_id(udev->dev) == UCLASS_USB) + return NULL; + + /* + * If these 2 are not the same we are being called from + * usb_scan_device() and udev itself is the parent. + */ + if (dev_get_parent_priv(udev->dev) != udev) + return udev; + + /* We are being called normally, use the parent pointer */ + if (device_get_uclass_id(parent) == UCLASS_USB_HUB) + return dev_get_parent_priv(parent); + + return NULL; +} +#else +struct usb_device *usb_dev_get_parent(struct usb_device *udev) +{ + return udev->parent; +} +#endif diff --git a/drivers/usb/musb-new/pic32.c b/drivers/usb/musb-new/pic32.c index 3a19900e21..b41b7ee154 100644 --- a/drivers/usb/musb-new/pic32.c +++ b/drivers/usb/musb-new/pic32.c @@ -10,6 +10,7 @@ */
#include <common.h> +#include <dm.h> #include <linux/usb/musb.h> #include "linux-compat.h" #include "musb_core.h" diff --git a/drivers/usb/musb-new/usb-compat.h b/drivers/usb/musb-new/usb-compat.h index f2c18ad3a2..1c66c4fe36 100644 --- a/drivers/usb/musb-new/usb-compat.h +++ b/drivers/usb/musb-new/usb-compat.h @@ -1,9 +1,10 @@ #ifndef __USB_COMPAT_H__ #define __USB_COMPAT_H__
-#include <dm.h> #include "usb.h"
+struct udevice; + struct usb_hcd { void *hcd_priv; }; @@ -67,40 +68,12 @@ static inline int usb_hcd_unmap_urb_for_dma(struct usb_hcd *hcd, return 0; }
-#if CONFIG_IS_ENABLED(DM_USB) -static inline struct usb_device *usb_dev_get_parent(struct usb_device *udev) -{ - struct udevice *parent = udev->dev->parent; - - /* - * When called from usb-uclass.c: usb_scan_device() udev->dev points - * to the parent udevice, not the actual udevice belonging to the - * udev as the device is not instantiated yet. - * - * If dev is an usb-bus, then we are called from usb_scan_device() for - * an usb-device plugged directly into the root port, return NULL. - */ - if (device_get_uclass_id(udev->dev) == UCLASS_USB) - return NULL; - - /* - * If these 2 are not the same we are being called from - * usb_scan_device() and udev itself is the parent. - */ - if (dev_get_parent_priv(udev->dev) != udev) - return udev; - - /* We are being called normally, use the parent pointer */ - if (device_get_uclass_id(parent) == UCLASS_USB_HUB) - return dev_get_parent_priv(parent); - - return NULL; -} -#else -static inline struct usb_device *usb_dev_get_parent(struct usb_device *dev) -{ - return dev->parent; -} -#endif +/** + * usb_dev_get_parent() - Get the parent of a USB device + * + * @udev: USB struct containing information about the device + * @return associated device for which udev == dev_get_parent_priv(dev) + */ +struct usb_device *usb_dev_get_parent(struct usb_device *udev);
#endif /* __USB_COMPAT_H__ */

Header files generally should not include header files just for a struct, since forward declarations work just as well and reduce overhead.
Add a warning for dm.h being included, since this has crept into U-Boot.
Signed-off-by: Simon Glass sjg@chromium.org dm: Avoid including dm.h in header files At present a small number of header files include the dm.h header file. The intent with driver model is for C files that use it to define dm.h themselves. This helps indicate that driver model is supported and also reduces the amount of code pointlessly included and relying on header guards. Ultimately (combined with the reduction in size of common.h) this should speed up U-Boot compilation.
This series removes all uses of dm.h in header files and adds a warning to avert more such activity. END
---
include/dm.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/include/dm.h b/include/dm.h index 2e1afda440..a1b84169e6 100644 --- a/include/dm.h +++ b/include/dm.h @@ -3,6 +3,10 @@ * Copyright (c) 2013 Google, Inc */
+#ifdef _DM_H_ +#warning "Suspect dm.h is included from a header file - please fix" +#endif + #ifndef _DM_H_ #define _DM_H_

On 10/27/19 4:53 PM, Simon Glass wrote:
Unfortunately this table seems to appear in TPL with gcc 7.3 even if it is not used. Fix it by creating a Kconfig that can be used to disable this routine.
It is enabled by default, since most boards use it.
Signed-off-by: Simon Glass sjg@chromium.org
lib/Kconfig | 29 +++++++++++++++++++++++++++++ lib/Makefile | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/lib/Kconfig b/lib/Kconfig index 135f0b372b..be5f9d343a 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -353,6 +353,35 @@ config SHA_PROG_HW_ACCEL config MD5 bool
+config CRC32
- bool "Enable crc32 routine"
env/common.c uses crc32(). I could not find how to disable building it. So this configuration option seems to be superfluous. Otherwise please, add all reverse dependencies like EFI_LOADER, CMD_UBIFS, ...
- default y
- help
This enables a 32-bit CRC (cyclic-redundancy check) routine. It is
typically used to check for changes in a group of bytes. Even a
small change typically produces a very different CRC value. This
algorithm is simple and quite fast.
+config SPL_CRC32
- bool "Enable crc32 routine in SPL"
- depends on SPL
Reverse dependencies are missing here, e.g.
selected by SPL_EFI_PARTITION
Best regards
Heinrich
- default y
- help
This enables a 32-bit CRC (cyclic-redundancy check) routine in SPL. It
is typically used to check for changes in a group of bytes. Even a
small change typically produces a very different CRC value. This
algorithm is simple and quite fast.
+config TPL_CRC32
- bool "Enable crc32 routine in SPL"
- depends on TPL
- default y
- help
This enables a 32-bit CRC (cyclic-redundancy check) routine in SPL. It
is typically used to check for changes in a group of bytes. Even a
small change typically produces a very different CRC value. This
algorithm is simple and quite fast.
- config CRC32C bool
diff --git a/lib/Makefile b/lib/Makefile index d248d8626c..8adc08fd73 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -84,7 +84,7 @@ obj-y += errno.o obj-y += display_options.o CFLAGS_display_options.o := $(if $(BUILD_TAG),-DBUILD_TAG='"$(BUILD_TAG)"') obj-$(CONFIG_BCH) += bch.o -obj-y += crc32.o +obj-$(CONFIG_$(SPL_TPL_)CRC32) += crc32.o obj-$(CONFIG_CRC32C) += crc32c.o obj-y += ctype.o obj-y += div64.o

On Sun, Oct 27, 2019 at 05:48:39PM +0100, Heinrich Schuchardt wrote:
On 10/27/19 4:53 PM, Simon Glass wrote:
Unfortunately this table seems to appear in TPL with gcc 7.3 even if it is not used. Fix it by creating a Kconfig that can be used to disable this routine.
It is enabled by default, since most boards use it.
Signed-off-by: Simon Glass sjg@chromium.org
lib/Kconfig | 29 +++++++++++++++++++++++++++++ lib/Makefile | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-)
diff --git a/lib/Kconfig b/lib/Kconfig index 135f0b372b..be5f9d343a 100644 --- a/lib/Kconfig +++ b/lib/Kconfig @@ -353,6 +353,35 @@ config SHA_PROG_HW_ACCEL config MD5 bool
+config CRC32
- bool "Enable crc32 routine"
env/common.c uses crc32(). I could not find how to disable building it. So this configuration option seems to be superfluous. Otherwise please, add all reverse dependencies like EFI_LOADER, CMD_UBIFS, ...
- default y
- help
This enables a 32-bit CRC (cyclic-redundancy check) routine. It is
typically used to check for changes in a group of bytes. Even a
small change typically produces a very different CRC value. This
algorithm is simple and quite fast.
+config SPL_CRC32
- bool "Enable crc32 routine in SPL"
- depends on SPL
Reverse dependencies are missing here, e.g.
selected by SPL_EFI_PARTITION
I think the problem is that for 'CRC32' itself, we need to not have it be a visible symbol as it's non-optional in main U-Boot. And then it should be select'd as needed by SPL_xxx and TPL_xxx symbols. Thanks!
participants (8)
-
Anatolij Gustschin
-
Heinrich Schuchardt
-
Lokesh Vutla
-
Lukasz Majewski
-
Neil Armstrong
-
Simon Glass
-
Stefan Roese
-
Tom Rini