diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e20a789ac1505f92ab07307c28218bbec0c20fc3..1f8a4c93cfb71a60834edad09684b19d72e05e0d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,7 +31,8 @@ stages: # use clang only do one configuration. - if [[ "${BUILDMAN}" != "" ]]; then ret=0; - tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} ${OVERRIDE}|| ret=$?; + NO_SDL=1 tools/buildman/buildman -o /tmp -P -E ${BUILDMAN} + ${OVERRIDE}|| ret=$?; if [[ $ret -ne 0 && $ret -ne 129 ]]; then tools/buildman/buildman -o /tmp -sdeP ${BUILDMAN}; exit $ret; @@ -163,7 +164,7 @@ Run binman, buildman, dtoc and patman testsuites: export UBOOT_TRAVIS_BUILD_DIR=/tmp/.bm-work/sandbox_spl; export PYTHONPATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc/pylibfdt"; export PATH="${UBOOT_TRAVIS_BUILD_DIR}/scripts/dtc:${PATH}"; - ./tools/buildman/buildman -o /tmp -P sandbox_spl; + NO_SDL=1 ./tools/buildman/buildman -o /tmp -P sandbox_spl; ./tools/binman/binman --toolpath ${UBOOT_TRAVIS_BUILD_DIR}/tools test; ./tools/buildman/buildman -t; ./tools/dtoc/dtoc -t; diff --git a/.travis.yml b/.travis.yml index 3991eb7716fb42c35638d52f2e053a5f97e5ba21..44e539038acd63f1220283b11b3261d1a8c7a3f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,7 @@ addons: - sparse - bc - build-essential - - libsdl1.2-dev + - libsdl2-dev - python - python-pyelftools - python3-virtualenv diff --git a/arch/arm/mach-aspeed/ast2500/clk_ast2500.c b/arch/arm/mach-aspeed/ast2500/clk_ast2500.c index 7d864a4088036b065036803f385731223e23d9db..3e9f5e57ed012c9c34104027d82109b1093208f6 100644 --- a/arch/arm/mach-aspeed/ast2500/clk_ast2500.c +++ b/arch/arm/mach-aspeed/ast2500/clk_ast2500.c @@ -7,6 +7,7 @@ #include <dm.h> #include <asm/io.h> #include <asm/arch/scu_ast2500.h> +#include <linux/err.h> int ast_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-imx/cmd_nandbcb.c b/arch/arm/mach-imx/cmd_nandbcb.c index 334cc0766eedef7280fddc042cb4d24c45f50f35..b3e59b1b003550c0ec92b67186105268ff47f5bc 100644 --- a/arch/arm/mach-imx/cmd_nandbcb.c +++ b/arch/arm/mach-imx/cmd_nandbcb.c @@ -10,7 +10,9 @@ */ #include <common.h> +#include <malloc.h> #include <nand.h> +#include <dm/devres.h> #include <asm/io.h> #include <jffs2/jffs2.h> diff --git a/arch/arm/mach-imx/imx8/image.c b/arch/arm/mach-imx/imx8/image.c index 58a29e8a03cb37a589b6e8f49f68f876512777df..c956a8092d888be44634bddcea74ce1a122d7684 100644 --- a/arch/arm/mach-imx/imx8/image.c +++ b/arch/arm/mach-imx/imx8/image.c @@ -5,6 +5,7 @@ #include <common.h> #include <errno.h> +#include <malloc.h> #include <asm/io.h> #include <mmc.h> #include <spi_flash.h> diff --git a/arch/arm/mach-meson/board-info.c b/arch/arm/mach-meson/board-info.c index 0d3b40a2491b69d1880afb113a0496481b8981f9..4b88afa9b7b77a49d393eadffafec82fdf9cac51 100644 --- a/arch/arm/mach-meson/board-info.c +++ b/arch/arm/mach-meson/board-info.c @@ -10,6 +10,7 @@ #include <linux/bitfield.h> #include <regmap.h> #include <syscon.h> +#include <linux/err.h> #define AO_SEC_SD_CFG8 0xe0 #define AO_SEC_SOCINFO_OFFSET AO_SEC_SD_CFG8 diff --git a/arch/arm/mach-meson/sm.c b/arch/arm/mach-meson/sm.c index fabcb3bfd7478f40c7c5744cd1998513d64d3686..fac286b9c851703cac77a5a61961d2067bb73e01 100644 --- a/arch/arm/mach-meson/sm.c +++ b/arch/arm/mach-meson/sm.c @@ -7,6 +7,7 @@ #include <common.h> #include <asm/arch/sm.h> +#include <linux/err.h> #include <linux/kernel.h> #include <dm.h> #include <linux/bitfield.h> diff --git a/arch/arm/mach-mvebu/mbus.c b/arch/arm/mach-mvebu/mbus.c index c68e93ba10070e17ac2c4e2acea754abbf8f91a6..a95db5e5c3c7e3f8ad917cf77dd7fbae2b34e80c 100644 --- a/arch/arm/mach-mvebu/mbus.c +++ b/arch/arm/mach-mvebu/mbus.c @@ -47,6 +47,7 @@ */ #include <common.h> +#include <malloc.h> #include <linux/errno.h> #include <asm/io.h> #include <asm/arch/cpu.h> diff --git a/arch/arm/mach-rockchip/px30/clk_px30.c b/arch/arm/mach-rockchip/px30/clk_px30.c index 0bd6b471dae034b35790491b92fa62bd4ac54fb7..98a1bcd224fafc84064e31825847e225c63d839d 100644 --- a/arch/arm/mach-rockchip/px30/clk_px30.c +++ b/arch/arm/mach-rockchip/px30/clk_px30.c @@ -8,6 +8,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_px30.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3036/clk_rk3036.c b/arch/arm/mach-rockchip/rk3036/clk_rk3036.c index 20e2ed681321950576fb0210283cde34dc038a89..5d0def3b524c71c7515fcd2947776df990fd36aa 100644 --- a/arch/arm/mach-rockchip/rk3036/clk_rk3036.c +++ b/arch/arm/mach-rockchip/rk3036/clk_rk3036.c @@ -9,6 +9,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3036.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3128/clk_rk3128.c b/arch/arm/mach-rockchip/rk3128/clk_rk3128.c index 827750bf98b69e43643cc2715a6c6931b252965f..f9ce1f723488d276a9a89104a618c8ea4e0c658d 100644 --- a/arch/arm/mach-rockchip/rk3128/clk_rk3128.c +++ b/arch/arm/mach-rockchip/rk3128/clk_rk3128.c @@ -8,6 +8,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3128.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3188/clk_rk3188.c b/arch/arm/mach-rockchip/rk3188/clk_rk3188.c index 9d4fc37eda91e84444362f6708ce69991ebe54a5..a0dcac373248732a9330115a1f4ad0ed2a6af6f1 100644 --- a/arch/arm/mach-rockchip/rk3188/clk_rk3188.c +++ b/arch/arm/mach-rockchip/rk3188/clk_rk3188.c @@ -9,6 +9,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3188.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3188/rk3188.c b/arch/arm/mach-rockchip/rk3188/rk3188.c index 61d410d780e4ddf26c1383e8baf6732763e3fd5c..e52466fb6fbd777da6dfbab88b574a8d594ef599 100644 --- a/arch/arm/mach-rockchip/rk3188/rk3188.c +++ b/arch/arm/mach-rockchip/rk3188/rk3188.c @@ -11,6 +11,7 @@ #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/grf_rk3188.h> #include <asm/arch-rockchip/hardware.h> +#include <linux/err.h> #define GRF_BASE 0x20008000 diff --git a/arch/arm/mach-rockchip/rk322x/clk_rk322x.c b/arch/arm/mach-rockchip/rk322x/clk_rk322x.c index 958c7b82b92a0cdfa20fe88381338961713473f3..fc5abd736e8e09451225750f2880c3dee37b578c 100644 --- a/arch/arm/mach-rockchip/rk322x/clk_rk322x.c +++ b/arch/arm/mach-rockchip/rk322x/clk_rk322x.c @@ -8,6 +8,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk322x.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3288/clk_rk3288.c b/arch/arm/mach-rockchip/rk3288/clk_rk3288.c index 1730f1244397f980295edccc87772d929855dfa3..e05bd06a8d2e95648083013abb7f058bf7812806 100644 --- a/arch/arm/mach-rockchip/rk3288/clk_rk3288.c +++ b/arch/arm/mach-rockchip/rk3288/clk_rk3288.c @@ -9,6 +9,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3288/rk3288.c b/arch/arm/mach-rockchip/rk3288/rk3288.c index 18ea7f35fbf869c8b67e342f48bcc2a1637ee636..812f3bd5f316873b15fca27ff61d7b1c2e975901 100644 --- a/arch/arm/mach-rockchip/rk3288/rk3288.c +++ b/arch/arm/mach-rockchip/rk3288/rk3288.c @@ -7,6 +7,7 @@ #include <env.h> #include <clk.h> #include <init.h> +#include <malloc.h> #include <asm/armv7.h> #include <asm/io.h> #include <asm/arch-rockchip/bootrom.h> @@ -17,6 +18,7 @@ #include <asm/arch-rockchip/pmu_rk3288.h> #include <asm/arch-rockchip/qos_rk3288.h> #include <asm/arch-rockchip/sdram.h> +#include <linux/err.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-rockchip/rk3308/clk_rk3308.c b/arch/arm/mach-rockchip/rk3308/clk_rk3308.c index 51b43153e8613f50d2a3e5210f85e9142b9ad30d..1feb23722408e008edb7259e15aef40befc6e4c9 100644 --- a/arch/arm/mach-rockchip/rk3308/clk_rk3308.c +++ b/arch/arm/mach-rockchip/rk3308/clk_rk3308.c @@ -8,6 +8,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch/cru_rk3308.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3308/rk3308.c b/arch/arm/mach-rockchip/rk3308/rk3308.c index b6815ddc55f154743d8fbd46a4d447044169b7d3..edf59947094f0bb0fe0ba5ee6c547529b099e669 100644 --- a/arch/arm/mach-rockchip/rk3308/rk3308.c +++ b/arch/arm/mach-rockchip/rk3308/rk3308.c @@ -3,6 +3,7 @@ *Copyright (c) 2018 Rockchip Electronics Co., Ltd */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <asm/arch/grf_rk3308.h> #include <asm/arch-rockchip/hardware.h> diff --git a/arch/arm/mach-rockchip/rk3328/clk_rk3328.c b/arch/arm/mach-rockchip/rk3328/clk_rk3328.c index f64f0cbbe5600790c6ad84c5de1659e32aaac7b1..e5375514def68032edfe83374cf3b3eea8a83161 100644 --- a/arch/arm/mach-rockchip/rk3328/clk_rk3328.c +++ b/arch/arm/mach-rockchip/rk3328/clk_rk3328.c @@ -7,6 +7,7 @@ #include <dm.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3328.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3368/clk_rk3368.c b/arch/arm/mach-rockchip/rk3368/clk_rk3368.c index 55e5dd768a9ff2184578ce4595b91b3d19fc6a72..9a33c67bc94df70efe8705d9355e989e87e5bad8 100644 --- a/arch/arm/mach-rockchip/rk3368/clk_rk3368.c +++ b/arch/arm/mach-rockchip/rk3368/clk_rk3368.c @@ -9,6 +9,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3368.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rk3399/clk_rk3399.c b/arch/arm/mach-rockchip/rk3399/clk_rk3399.c index a80a46f1dbce9646370f3fbe6f48f9e90f5a459d..d23a5e9435cb8fb0554624f4dad884fc8234e4d1 100644 --- a/arch/arm/mach-rockchip/rk3399/clk_rk3399.c +++ b/arch/arm/mach-rockchip/rk3399/clk_rk3399.c @@ -9,6 +9,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru.h> +#include <linux/err.h> static int rockchip_get_cruclk(struct udevice **devp) { diff --git a/arch/arm/mach-rockchip/rv1108/clk_rv1108.c b/arch/arm/mach-rockchip/rv1108/clk_rv1108.c index 58a7e889cc36d145232090ee5beaa45219c5799b..b37ae1c494569ab9934d1a7a38bd91ec729d5e25 100644 --- a/arch/arm/mach-rockchip/rv1108/clk_rv1108.c +++ b/arch/arm/mach-rockchip/rv1108/clk_rv1108.c @@ -9,6 +9,7 @@ #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rv1108.h> +#include <linux/err.h> int rockchip_get_clk(struct udevice **devp) { diff --git a/arch/arm/mach-socfpga/clock_manager_agilex.c b/arch/arm/mach-socfpga/clock_manager_agilex.c index 791066d25b0ac7c6b2e63fc60b3e043648e7ffc9..4ee2b7b4bbe33a4379810995ae04cdc7f3bb6d89 100644 --- a/arch/arm/mach-socfpga/clock_manager_agilex.c +++ b/arch/arm/mach-socfpga/clock_manager_agilex.c @@ -7,6 +7,7 @@ #include <clk.h> #include <common.h> #include <dm.h> +#include <malloc.h> #include <asm/arch/clock_manager.h> #include <asm/arch/system_manager.h> #include <asm/io.h> diff --git a/arch/arm/mach-socfpga/clock_manager_arria10.c b/arch/arm/mach-socfpga/clock_manager_arria10.c index 392f2eb915a9e4e5e724826f3a7446c2acb84bc5..d7c8eaf47dc89da1fe6046270d8d033858a281f2 100644 --- a/arch/arm/mach-socfpga/clock_manager_arria10.c +++ b/arch/arm/mach-socfpga/clock_manager_arria10.c @@ -5,6 +5,7 @@ #include <common.h> #include <fdtdec.h> +#include <malloc.h> #include <asm/io.h> #include <dm.h> #include <clk.h> diff --git a/arch/arm/mach-stm32mp/pwr_regulator.c b/arch/arm/mach-stm32mp/pwr_regulator.c index 9484645dbdd59a35efc5b2d1423259491b2148d1..4559ef599d7b61ad9850e553b4f0b422eaa8c600 100644 --- a/arch/arm/mach-stm32mp/pwr_regulator.c +++ b/arch/arm/mach-stm32mp/pwr_regulator.c @@ -8,6 +8,8 @@ #include <errno.h> #include <regmap.h> #include <syscon.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <power/pmic.h> #include <power/regulator.h> diff --git a/arch/arm/mach-tegra/cboot.c b/arch/arm/mach-tegra/cboot.c index c5361ca73d4e630f92893a872ef4973909258e0e..390229436ecfeb56cda515c2d8291dfb9b11439a 100644 --- a/arch/arm/mach-tegra/cboot.c +++ b/arch/arm/mach-tegra/cboot.c @@ -8,6 +8,7 @@ #include <fdt_support.h> #include <fdtdec.h> #include <hang.h> +#include <malloc.h> #include <stdlib.h> #include <string.h> diff --git a/arch/arm/mach-zynq/clk.c b/arch/arm/mach-zynq/clk.c index 1a6acd46cd57a2684a0d8ced9d08fca56fd1aef8..b578f6538ab02fb3328a98457b69a3a2f3dec696 100644 --- a/arch/arm/mach-zynq/clk.c +++ b/arch/arm/mach-zynq/clk.c @@ -6,6 +6,7 @@ #include <clk.h> #include <common.h> #include <dm.h> +#include <malloc.h> #include <asm/arch/clk.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/arch/arm/mach-zynq/timer.c b/arch/arm/mach-zynq/timer.c index 211ea15884cee0201b9cd14f61ae482ea699b2bf..d822e20d2b230f2b2af2915d6dfc4fd2bbd6a954 100644 --- a/arch/arm/mach-zynq/timer.c +++ b/arch/arm/mach-zynq/timer.c @@ -32,6 +32,7 @@ #include <div64.h> #include <dm.h> #include <time.h> +#include <malloc.h> #include <asm/io.h> #include <asm/arch/hardware.h> #include <asm/arch/clk.h> diff --git a/arch/mips/mach-mtmips/cpu.c b/arch/mips/mach-mtmips/cpu.c index cee3c0cb0a63ab96595ec58fe1eae11d5b4e1ba7..8976ef57c7031c0a4f9c07d171bbcc92a56c4628 100644 --- a/arch/mips/mach-mtmips/cpu.c +++ b/arch/mips/mach-mtmips/cpu.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <init.h> +#include <malloc.h> #include <ram.h> #include <wdt.h> #include <asm/io.h> diff --git a/arch/mips/mach-pic32/cpu.c b/arch/mips/mach-pic32/cpu.c index 8bb12a52c6dba8fcf88ae9913e6682a1fcacf5cb..8075d93d411deba1cfdede5e3a1c8dc0265fcc76 100644 --- a/arch/mips/mach-pic32/cpu.c +++ b/arch/mips/mach-pic32/cpu.c @@ -7,6 +7,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <mach/pic32.h> #include <mach/ddr.h> #include <dt-bindings/clock/microchip,clock.h> diff --git a/arch/riscv/lib/andes_plic.c b/arch/riscv/lib/andes_plic.c index 3868569a65a96d1ad4a7ad34901661d7ef87c0d0..20529ab3eb58899ffca8790558494e34e9a370b3 100644 --- a/arch/riscv/lib/andes_plic.c +++ b/arch/riscv/lib/andes_plic.c @@ -17,6 +17,7 @@ #include <asm/io.h> #include <asm/syscon.h> #include <cpu.h> +#include <linux/err.h> /* pending register */ #define PENDING_REG(base, hart) ((ulong)(base) + 0x1000 + ((hart) / 4) * 4) diff --git a/arch/riscv/lib/andes_plmt.c b/arch/riscv/lib/andes_plmt.c index 84f46075003507e7cc30dc5c664590cd6212a401..a7e90ca992c6b5eebe1afb5ece6d54aa2318b488 100644 --- a/arch/riscv/lib/andes_plmt.c +++ b/arch/riscv/lib/andes_plmt.c @@ -13,6 +13,7 @@ #include <syscon.h> #include <asm/io.h> #include <asm/syscon.h> +#include <linux/err.h> /* mtime register */ #define MTIME_REG(base) ((ulong)(base)) diff --git a/arch/riscv/lib/sifive_clint.c b/arch/riscv/lib/sifive_clint.c index d7899d16d7a2be5fe988c450afa262d1eb99eb3d..5e0d25720bdabd6d4aaf0608afe230cb2395c0f9 100644 --- a/arch/riscv/lib/sifive_clint.c +++ b/arch/riscv/lib/sifive_clint.c @@ -13,6 +13,7 @@ #include <syscon.h> #include <asm/io.h> #include <asm/syscon.h> +#include <linux/err.h> /* MSIP registers */ #define MSIP_REG(base, hart) ((ulong)(base) + (hart) * 4) diff --git a/arch/sandbox/config.mk b/arch/sandbox/config.mk index a225c9cbfa74dc5764c1e71739f06a98095e3c82..189e9c2b0c6d3fc20ffaec6ad13ef7f2b27942c8 100644 --- a/arch/sandbox/config.mk +++ b/arch/sandbox/config.mk @@ -5,7 +5,7 @@ PLATFORM_CPPFLAGS += -D__SANDBOX__ -U_FORTIFY_SOURCE PLATFORM_CPPFLAGS += -DCONFIG_ARCH_MAP_SYSMEM PLATFORM_CPPFLAGS += -fPIC PLATFORM_LIBS += -lrt -SDL_CONFIG ?= sdl-config +SDL_CONFIG ?= sdl2-config # Define this to avoid linking with SDL, which requires SDL libraries # This can solve 'sdl-config: Command not found' errors diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c index ff7430393ffe80cc31e67e741b9002af46978869..56ee3f5826030160d04068c5f71fe9183a8d5783 100644 --- a/arch/sandbox/cpu/cpu.c +++ b/arch/sandbox/cpu/cpu.c @@ -10,6 +10,7 @@ #include <linux/libfdt.h> #include <os.h> #include <asm/io.h> +#include <asm/malloc.h> #include <asm/setjmp.h> #include <asm/state.h> #include <dm/root.h> diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index 8d05bc2eda039a21598950075bc9bb0ae74bffe1..da01d1addf9c2af3026589e41d78b10e08fad621 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -74,7 +74,7 @@ static int _raw_packet_start(struct eth_sandbox_raw_priv *priv, /* Prepare device struct */ priv->local_bind_sd = -1; - priv->device = os_malloc(sizeof(struct sockaddr_ll)); + priv->device = malloc(sizeof(struct sockaddr_ll)); if (priv->device == NULL) return -ENOMEM; device = priv->device; @@ -147,7 +147,7 @@ static int _local_inet_start(struct eth_sandbox_raw_priv *priv) /* Prepare device struct */ priv->local_bind_sd = -1; priv->local_bind_udp_port = 0; - priv->device = os_malloc(sizeof(struct sockaddr_in)); + priv->device = malloc(sizeof(struct sockaddr_in)); if (priv->device == NULL) return -ENOMEM; device = priv->device; @@ -282,7 +282,7 @@ int sandbox_eth_raw_os_recv(void *packet, int *length, void sandbox_eth_raw_os_stop(struct eth_sandbox_raw_priv *priv) { - os_free(priv->device); + free(priv->device); priv->device = NULL; close(priv->sd); priv->sd = -1; diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 79094fb7f353b4981d9f446c8c0eb6d34d4c3ce0..f7c73e3a0b15b785022365fe99196f51bae16650 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -137,7 +137,7 @@ int os_read_file(const char *fname, void **bufp, int *sizep) printf("Cannot seek to start of file '%s'\n", fname); goto err; } - *bufp = os_malloc(size); + *bufp = malloc(size); if (!*bufp) { printf("Not enough memory to read file '%s'\n", fname); ret = -ENOMEM; @@ -238,29 +238,6 @@ void os_free(void *ptr) } } -void *os_realloc(void *ptr, size_t length) -{ - int page_size = getpagesize(); - struct os_mem_hdr *hdr; - void *buf = NULL; - - if (length) { - buf = os_malloc(length); - if (!buf) - return buf; - if (ptr) { - hdr = ptr - page_size; - if (length > hdr->length) - length = hdr->length; - memcpy(buf, ptr, length); - } - } - if (ptr) - os_free(ptr); - - return buf; -} - void os_usleep(unsigned long usec) { usleep(usec); @@ -306,8 +283,8 @@ int os_parse_args(struct sandbox_state *state, int argc, char *argv[]) state->argv = argv; /* dynamically construct the arguments to the system getopt_long */ - short_opts = os_malloc(sizeof(*short_opts) * num_options * 2 + 1); - long_opts = os_malloc(sizeof(*long_opts) * num_options); + short_opts = malloc(sizeof(*short_opts) * num_options * 2 + 1); + long_opts = malloc(sizeof(*long_opts) * (num_options + 1)); if (!short_opts || !long_opts) return 1; @@ -337,6 +314,7 @@ int os_parse_args(struct sandbox_state *state, int argc, char *argv[]) /* we need to handle output ourselves since u-boot provides printf */ opterr = 0; + memset(&long_opts[num_options], '\0', sizeof(*long_opts)); /* * walk all of the options the user gave us on the command line, * figure out what u-boot option structure they belong to (via @@ -385,7 +363,7 @@ void os_dirent_free(struct os_dirent_node *node) while (node) { next = node->next; - os_free(node); + free(node); node = next; } } @@ -410,7 +388,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) /* Create a buffer upfront, with typically sufficient size */ dirlen = strlen(dirname) + 2; len = dirlen + 256; - fname = os_malloc(len); + fname = malloc(len); if (!fname) { ret = -ENOMEM; goto done; @@ -423,7 +401,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) ret = errno; break; } - next = os_malloc(sizeof(*node) + strlen(entry->d_name) + 1); + next = malloc(sizeof(*node) + strlen(entry->d_name) + 1); if (!next) { os_dirent_free(head); ret = -ENOMEM; @@ -432,10 +410,10 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) if (dirlen + strlen(entry->d_name) > len) { len = dirlen + strlen(entry->d_name); old_fname = fname; - fname = os_realloc(fname, len); + fname = realloc(fname, len); if (!fname) { - os_free(old_fname); - os_free(next); + free(old_fname); + free(next); os_dirent_free(head); ret = -ENOMEM; goto done; @@ -469,7 +447,7 @@ int os_dirent_ls(const char *dirname, struct os_dirent_node **headp) done: closedir(dir); - os_free(fname); + free(fname); return ret; } @@ -586,7 +564,7 @@ static int add_args(char ***argvp, char *add_args[], int count) for (argc = 0; (*argvp)[argc]; argc++) ; - argv = os_malloc((argc + count + 1) * sizeof(char *)); + argv = malloc((argc + count + 1) * sizeof(char *)); if (!argv) { printf("Out of memory for %d argv\n", count); return -ENOMEM; @@ -669,7 +647,7 @@ static int os_jump_to_file(const char *fname) os_exit(2); err = execv(fname, argv); - os_free(argv); + free(argv); if (err) { perror("Unable to run image"); printf("Image filename '%s'\n", fname); diff --git a/arch/sandbox/cpu/sdl.c b/arch/sandbox/cpu/sdl.c index 080c7c8d74d21dcf892e8aec7748823cf350f9ed..6416cab96c1e318b074e6e8a41a76f47d03d0e32 100644 --- a/arch/sandbox/cpu/sdl.c +++ b/arch/sandbox/cpu/sdl.c @@ -5,8 +5,9 @@ #include <errno.h> #include <unistd.h> +#include <stdbool.h> #include <linux/input.h> -#include <SDL.h> +#include <SDL2/SDL.h> #include <asm/state.h> /** @@ -24,19 +25,42 @@ struct buf_info { uint8_t *data; }; +/** + * struct sdl_info - Information about our use of the SDL library + * + * @width: Width of simulated LCD display + * @height: Height of simulated LCD display + * @vis_width: Visible width (may be larger to allow for scaling up) + * @vis_height: Visible height (may be larger to allow for scaling up) + * @depth: Depth of the display in bits per pixel (16 or 32) + * @pitch: Number of bytes per line of the display + * @sample_rate: Current sample rate for audio + * @audio_active: true if audio can be used + * @inited: true if this module is initialised + * @cur_buf: Current audio buffer being used by sandbox_sdl_fill_audio (0 or 1) + * @buf: The two available audio buffers. SDL can be reading from one while we + * are setting up the next + * @running: true if audio is running + * @stopping: true if audio will stop once it runs out of data + * @texture: SDL texture to use for U-Boot display contents + * @renderer: SDL renderer to use + */ static struct sdl_info { - SDL_Surface *screen; int width; int height; + int vis_width; + int vis_height; int depth; int pitch; - uint frequency; uint sample_rate; bool audio_active; bool inited; int cur_buf; struct buf_info buf[2]; bool running; + bool stopping; + SDL_Texture *texture; + SDL_Renderer *renderer; } sdl; static void sandbox_sdl_poll_events(void) @@ -62,7 +86,7 @@ static int sandbox_sdl_ensure_init(void) { if (!sdl.inited) { if (SDL_Init(0) < 0) { - printf("Unable to initialize SDL: %s\n", + printf("Unable to initialise SDL: %s\n", SDL_GetError()); return -EIO; } @@ -74,7 +98,8 @@ static int sandbox_sdl_ensure_init(void) return 0; } -int sandbox_sdl_init_display(int width, int height, int log2_bpp) +int sandbox_sdl_init_display(int width, int height, int log2_bpp, + bool double_size) { struct sandbox_state *state = state_get_current(); int err; @@ -85,16 +110,52 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp) if (err) return err; if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) { - printf("Unable to initialize SDL LCD: %s\n", SDL_GetError()); + printf("Unable to initialise SDL LCD: %s\n", SDL_GetError()); return -EPERM; } - SDL_WM_SetCaption("U-Boot", "U-Boot"); - sdl.width = width; sdl.height = height; + if (double_size) { + sdl.vis_width = sdl.width * 2; + sdl.vis_height = sdl.height * 2; + } else { + sdl.vis_width = sdl.width; + sdl.vis_height = sdl.height; + } + sdl.depth = 1 << log2_bpp; sdl.pitch = sdl.width * sdl.depth / 8; - sdl.screen = SDL_SetVideoMode(width, height, 0, 0); + SDL_Window *screen = SDL_CreateWindow("U-Boot", SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + sdl.vis_width, sdl.vis_height, 0); + if (!screen) { + printf("Unable to initialise SDL screen: %s\n", + SDL_GetError()); + return -EIO; + } + if (log2_bpp != 4 && log2_bpp != 5) { + printf("U-Boot SDL does not support depth %d\n", log2_bpp); + return -EINVAL; + } + sdl.renderer = SDL_CreateRenderer(screen, -1, + SDL_RENDERER_ACCELERATED | + SDL_RENDERER_PRESENTVSYNC); + if (!sdl.renderer) { + printf("Unable to initialise SDL renderer: %s\n", + SDL_GetError()); + return -EIO; + } + + sdl.texture = SDL_CreateTexture(sdl.renderer, log2_bpp == 4 ? + SDL_PIXELFORMAT_RGB565 : + SDL_PIXELFORMAT_RGB888, + SDL_TEXTUREACCESS_STREAMING, + width, height); + if (!sdl.texture) { + printf("Unable to initialise SDL texture: %s\n", + SDL_GetError()); + return -EBADF; + } sandbox_sdl_poll_events(); return 0; @@ -102,136 +163,137 @@ int sandbox_sdl_init_display(int width, int height, int log2_bpp) int sandbox_sdl_sync(void *lcd_base) { - SDL_Surface *frame; - - frame = SDL_CreateRGBSurfaceFrom(lcd_base, sdl.width, sdl.height, - sdl.depth, sdl.pitch, - 0x1f << 11, 0x3f << 5, 0x1f << 0, 0); - SDL_BlitSurface(frame, NULL, sdl.screen, NULL); - SDL_FreeSurface(frame); - SDL_UpdateRect(sdl.screen, 0, 0, 0, 0); + SDL_UpdateTexture(sdl.texture, NULL, lcd_base, sdl.pitch); + SDL_RenderCopy(sdl.renderer, sdl.texture, NULL, NULL); + SDL_RenderPresent(sdl.renderer); sandbox_sdl_poll_events(); return 0; } -#define NONE (-1) -#define NUM_SDL_CODES (SDLK_UNDO + 1) - -static int16_t sdl_to_keycode[NUM_SDL_CODES] = { - /* 0 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, KEY_BACKSPACE, KEY_TAB, - NONE, NONE, NONE, KEY_ENTER, NONE, - NONE, NONE, NONE, NONE, KEY_POWER, /* use PAUSE as POWER */ - - /* 20 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, KEY_ESC, NONE, NONE, - NONE, NONE, KEY_SPACE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 40 */ - NONE, NONE, NONE, NONE, KEY_COMMA, - KEY_MINUS, KEY_DOT, KEY_SLASH, KEY_0, KEY_1, - KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, - KEY_7, KEY_8, KEY_9, NONE, KEY_SEMICOLON, - - /* 60 */ - NONE, KEY_EQUAL, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 80 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, KEY_BACKSLASH, NONE, NONE, - NONE, KEY_GRAVE, KEY_A, KEY_B, KEY_C, - - /* 100 */ - KEY_D, KEY_E, KEY_F, KEY_G, KEY_H, - KEY_I, KEY_J, KEY_K, KEY_L, KEY_M, - KEY_N, KEY_O, KEY_P, KEY_Q, KEY_R, - KEY_S, KEY_T, KEY_U, KEY_V, KEY_W, - - /* 120 */ - KEY_X, KEY_Y, KEY_Z, NONE, NONE, - NONE, NONE, KEY_DELETE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 140 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 160 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 180 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 200 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 220 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 240 */ - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, - NONE, KEY_KP0, KEY_KP1, KEY_KP2, KEY_KP3, - - /* 260 */ - KEY_KP4, KEY_KP5, KEY_KP6, KEY_KP7, KEY_KP8, - KEY_KP9, KEY_KPDOT, KEY_KPSLASH, KEY_KPASTERISK, KEY_KPMINUS, - KEY_KPPLUS, KEY_KPENTER, KEY_KPEQUAL, KEY_UP, KEY_DOWN, - KEY_RIGHT, KEY_LEFT, KEY_INSERT, KEY_HOME, KEY_END, - - /* 280 */ - KEY_PAGEUP, KEY_PAGEDOWN, KEY_F1, KEY_F2, KEY_F3, - KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, - KEY_F9, KEY_F10, KEY_F11, KEY_F12, NONE, - NONE, NONE, NONE, NONE, NONE, - - /* 300 */ - KEY_NUMLOCK, KEY_CAPSLOCK, KEY_SCROLLLOCK, KEY_RIGHTSHIFT, - KEY_LEFTSHIFT, - KEY_RIGHTCTRL, KEY_LEFTCTRL, KEY_RIGHTALT, KEY_LEFTALT, KEY_RIGHTMETA, - KEY_LEFTMETA, NONE, KEY_FN, NONE, KEY_COMPOSE, - NONE, KEY_PRINT, KEY_SYSRQ, KEY_PAUSE, NONE, - - /* 320 */ - NONE, NONE, NONE, +static const unsigned short sdl_to_keycode[SDL_NUM_SCANCODES] = { + [SDL_SCANCODE_A] = KEY_A, + [SDL_SCANCODE_B] = KEY_B, + [SDL_SCANCODE_C] = KEY_C, + [SDL_SCANCODE_D] = KEY_D, + [SDL_SCANCODE_E] = KEY_E, + [SDL_SCANCODE_F] = KEY_F, + [SDL_SCANCODE_G] = KEY_G, + [SDL_SCANCODE_H] = KEY_H, + [SDL_SCANCODE_I] = KEY_I, + [SDL_SCANCODE_J] = KEY_J, + [SDL_SCANCODE_K] = KEY_K, + [SDL_SCANCODE_L] = KEY_L, + [SDL_SCANCODE_M] = KEY_M, + [SDL_SCANCODE_N] = KEY_N, + [SDL_SCANCODE_O] = KEY_O, + [SDL_SCANCODE_P] = KEY_P, + [SDL_SCANCODE_Q] = KEY_Q, + [SDL_SCANCODE_R] = KEY_R, + [SDL_SCANCODE_S] = KEY_S, + [SDL_SCANCODE_T] = KEY_T, + [SDL_SCANCODE_U] = KEY_U, + [SDL_SCANCODE_V] = KEY_V, + [SDL_SCANCODE_W] = KEY_W, + [SDL_SCANCODE_X] = KEY_X, + [SDL_SCANCODE_Y] = KEY_Y, + [SDL_SCANCODE_Z] = KEY_Z, + + [SDL_SCANCODE_1] = KEY_1, + [SDL_SCANCODE_2] = KEY_2, + [SDL_SCANCODE_3] = KEY_3, + [SDL_SCANCODE_4] = KEY_4, + [SDL_SCANCODE_5] = KEY_5, + [SDL_SCANCODE_6] = KEY_6, + [SDL_SCANCODE_7] = KEY_7, + [SDL_SCANCODE_8] = KEY_8, + [SDL_SCANCODE_9] = KEY_9, + [SDL_SCANCODE_0] = KEY_0, + + [SDL_SCANCODE_RETURN] = KEY_ENTER, + [SDL_SCANCODE_ESCAPE] = KEY_ESC, + [SDL_SCANCODE_BACKSPACE] = KEY_BACKSPACE, + [SDL_SCANCODE_TAB] = KEY_TAB, + [SDL_SCANCODE_SPACE] = KEY_SPACE, + + [SDL_SCANCODE_MINUS] = KEY_MINUS, + [SDL_SCANCODE_EQUALS] = KEY_EQUAL, + [SDL_SCANCODE_BACKSLASH] = KEY_BACKSLASH, + [SDL_SCANCODE_SEMICOLON] = KEY_SEMICOLON, + [SDL_SCANCODE_APOSTROPHE] = KEY_APOSTROPHE, + [SDL_SCANCODE_GRAVE] = KEY_GRAVE, + [SDL_SCANCODE_COMMA] = KEY_COMMA, + [SDL_SCANCODE_PERIOD] = KEY_DOT, + [SDL_SCANCODE_SLASH] = KEY_SLASH, + + [SDL_SCANCODE_CAPSLOCK] = KEY_CAPSLOCK, + + [SDL_SCANCODE_F1] = KEY_F1, + [SDL_SCANCODE_F2] = KEY_F2, + [SDL_SCANCODE_F3] = KEY_F3, + [SDL_SCANCODE_F4] = KEY_F4, + [SDL_SCANCODE_F5] = KEY_F5, + [SDL_SCANCODE_F6] = KEY_F6, + [SDL_SCANCODE_F7] = KEY_F7, + [SDL_SCANCODE_F8] = KEY_F8, + [SDL_SCANCODE_F9] = KEY_F9, + [SDL_SCANCODE_F10] = KEY_F10, + [SDL_SCANCODE_F11] = KEY_F11, + [SDL_SCANCODE_F12] = KEY_F12, + + [SDL_SCANCODE_PRINTSCREEN] = KEY_PRINT, + [SDL_SCANCODE_SCROLLLOCK] = KEY_SCROLLLOCK, + [SDL_SCANCODE_PAUSE] = KEY_PAUSE, + [SDL_SCANCODE_INSERT] = KEY_INSERT, + [SDL_SCANCODE_HOME] = KEY_HOME, + [SDL_SCANCODE_PAGEUP] = KEY_PAGEUP, + [SDL_SCANCODE_DELETE] = KEY_DELETE, + [SDL_SCANCODE_END] = KEY_END, + [SDL_SCANCODE_PAGEDOWN] = KEY_PAGEDOWN, + [SDL_SCANCODE_RIGHT] = KEY_RIGHT, + [SDL_SCANCODE_LEFT] = KEY_LEFT, + [SDL_SCANCODE_DOWN] = KEY_DOWN, + [SDL_SCANCODE_UP] = KEY_UP, + + [SDL_SCANCODE_NUMLOCKCLEAR] = KEY_NUMLOCK, + [SDL_SCANCODE_KP_DIVIDE] = KEY_KPSLASH, + [SDL_SCANCODE_KP_MULTIPLY] = KEY_KPASTERISK, + [SDL_SCANCODE_KP_MINUS] = KEY_KPMINUS, + [SDL_SCANCODE_KP_PLUS] = KEY_KPPLUS, + [SDL_SCANCODE_KP_ENTER] = KEY_KPENTER, + [SDL_SCANCODE_KP_1] = KEY_KP1, + [SDL_SCANCODE_KP_2] = KEY_KP2, + [SDL_SCANCODE_KP_3] = KEY_KP3, + [SDL_SCANCODE_KP_4] = KEY_KP4, + [SDL_SCANCODE_KP_5] = KEY_KP5, + [SDL_SCANCODE_KP_6] = KEY_KP6, + [SDL_SCANCODE_KP_7] = KEY_KP7, + [SDL_SCANCODE_KP_8] = KEY_KP8, + [SDL_SCANCODE_KP_9] = KEY_KP9, + [SDL_SCANCODE_KP_0] = KEY_KP0, + [SDL_SCANCODE_KP_PERIOD] = KEY_KPDOT, + + [SDL_SCANCODE_KP_EQUALS] = KEY_KPEQUAL, + [SDL_SCANCODE_KP_COMMA] = KEY_KPCOMMA, + + [SDL_SCANCODE_SYSREQ] = KEY_SYSRQ, }; int sandbox_sdl_scan_keys(int key[], int max_keys) { - Uint8 *keystate; + const Uint8 *keystate; + int num_keys; int i, count; sandbox_sdl_poll_events(); - keystate = SDL_GetKeyState(NULL); - for (i = count = 0; i < NUM_SDL_CODES; i++) { - if (count >= max_keys) - break; - else if (keystate[i]) - key[count++] = sdl_to_keycode[i]; + keystate = SDL_GetKeyboardState(&num_keys); + for (i = count = 0; i < num_keys; i++) { + if (count < max_keys && keystate[i]) { + int keycode = sdl_to_keycode[i]; + + if (keycode) + key[count++] = keycode; + } } return count; @@ -256,6 +318,7 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len) { struct buf_info *buf; int avail; + bool have_data = false; int i; for (i = 0; i < 2; i++) { @@ -267,6 +330,7 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len) } if (avail > len) avail = len; + have_data = true; SDL_MixAudio(stream, buf->data + buf->pos, avail, SDL_MIX_MAXVOLUME); @@ -279,11 +343,12 @@ void sandbox_sdl_fill_audio(void *udata, Uint8 *stream, int len) else break; } + sdl.stopping = !have_data; } int sandbox_sdl_sound_init(int rate, int channels) { - SDL_AudioSpec wanted; + SDL_AudioSpec wanted, have; int i; if (sandbox_sdl_ensure_init()) @@ -316,19 +381,23 @@ int sandbox_sdl_sound_init(int rate, int channels) } if (SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { - printf("Unable to initialize SDL audio: %s\n", SDL_GetError()); + printf("Unable to initialise SDL audio: %s\n", SDL_GetError()); goto err; } /* Open the audio device, forcing the desired format */ - if (SDL_OpenAudio(&wanted, NULL) < 0) { + if (SDL_OpenAudio(&wanted, &have) < 0) { printf("Couldn't open audio: %s\n", SDL_GetError()); goto err; } + if (have.format != wanted.format) { + printf("Couldn't select required audio format\n"); + goto err; + } sdl.audio_active = true; sdl.sample_rate = wanted.freq; sdl.cur_buf = 0; - sdl.running = 0; + sdl.running = false; return 0; @@ -359,7 +428,8 @@ int sandbox_sdl_sound_play(const void *data, uint size) buf->pos = 0; if (!sdl.running) { SDL_PauseAudio(0); - sdl.running = 1; + sdl.running = true; + sdl.stopping = false; } return 0; @@ -368,8 +438,12 @@ int sandbox_sdl_sound_play(const void *data, uint size) int sandbox_sdl_sound_stop(void) { if (sdl.running) { + while (!sdl.stopping) + SDL_Delay(100); + SDL_PauseAudio(1); sdl.running = 0; + sdl.stopping = false; } return 0; diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index fff9cbdd79dbb2b5399a898ed2d6a0a091353002..b6ff5c3d647262f97337e91d07071cb8b825ad46 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -8,14 +8,46 @@ #include <errno.h> #include <os.h> #include <cli.h> -#include <malloc.h> +#include <sort.h> #include <asm/getopt.h> #include <asm/io.h> +#include <asm/malloc.h> #include <asm/sections.h> #include <asm/state.h> +#include <linux/ctype.h> DECLARE_GLOBAL_DATA_PTR; +/* Compare two options so that they can be sorted into alphabetical order */ +static int h_compare_opt(const void *p1, const void *p2) +{ + const struct sandbox_cmdline_option *opt1 = p1; + const struct sandbox_cmdline_option *opt2 = p2; + const char *str1, *str2; + char flag1[2], flag2[2]; + + opt1 = *(struct sandbox_cmdline_option **)p1; + opt2 = *(struct sandbox_cmdline_option **)p2; + flag1[1] = '\0'; + flag2[1] = '\0'; + + *flag1 = opt1->flag_short < 0x100 ? opt1->flag_short : '\0'; + *flag2 = opt2->flag_short < 0x100 ? opt2->flag_short : '\0'; + + str1 = *flag1 ? flag1 : opt1->flag; + str2 = *flag2 ? flag2 : opt2->flag; + + /* + * Force lower-case flags to come before upper-case ones. We only + * support upper-case for short flags. + */ + if (isalpha(*str1) && isalpha(*str2) && + tolower(*str1) == tolower(*str2)) + return isupper(*str1) - isupper(*str2); + + return strcasecmp(str1, str2); +} + int sandbox_early_getopt_check(void) { struct sandbox_state *state = state_get_current(); @@ -23,6 +55,8 @@ int sandbox_early_getopt_check(void) size_t num_options = __u_boot_sandbox_option_count(); size_t i; int max_arg_len, max_noarg_len; + struct sandbox_cmdline_option **sorted_opt; + int size; /* parse_err will be a string of the faulting option */ if (!state->parse_err) @@ -45,8 +79,18 @@ int sandbox_early_getopt_check(void) max_arg_len = max((int)strlen(sb_opt[i]->flag), max_arg_len); max_noarg_len = max_arg_len + 7; + /* Sort the options */ + size = sizeof(*sorted_opt) * num_options; + sorted_opt = malloc(size); + if (!sorted_opt) { + printf("No memory to sort options\n"); + os_exit(1); + } + memcpy(sorted_opt, sb_opt, size); + qsort(sorted_opt, num_options, sizeof(*sorted_opt), h_compare_opt); + for (i = 0; i < num_options; ++i) { - struct sandbox_cmdline_option *opt = sb_opt[i]; + struct sandbox_cmdline_option *opt = sorted_opt[i]; /* first output the short flag if it has one */ if (opt->flag_short >= 0x100) @@ -137,7 +181,7 @@ static int sandbox_cmdline_cb_default_fdt(struct sandbox_state *state, int len; len = strlen(state->argv[0]) + strlen(fmt) + 1; - fname = os_malloc(len); + fname = malloc(len); if (!fname) return -ENOMEM; snprintf(fname, len, fmt, state->argv[0]); @@ -157,7 +201,7 @@ static int sandbox_cmdline_cb_test_fdt(struct sandbox_state *state, int len; len = strlen(state->argv[0]) + strlen(fmt) + 1; - fname = os_malloc(len); + fname = malloc(len); if (!fname) return -ENOMEM; strcpy(fname, state->argv[0]); @@ -264,6 +308,16 @@ static int sandbox_cmdline_cb_show_lcd(struct sandbox_state *state, SANDBOX_CMDLINE_OPT_SHORT(show_lcd, 'l', 0, "Show the sandbox LCD display"); +static int sandbox_cmdline_cb_double_lcd(struct sandbox_state *state, + const char *arg) +{ + state->double_lcd = true; + + return 0; +} +SANDBOX_CMDLINE_OPT_SHORT(double_lcd, 'K', 0, + "Double the LCD display size in each direction"); + static const char *term_args[STATE_TERM_COUNT] = { "raw-with-sigs", "raw", @@ -319,13 +373,6 @@ static int sandbox_cmdline_cb_show_of_platdata(struct sandbox_state *state, } SANDBOX_CMDLINE_OPT(show_of_platdata, 0, "Show of-platdata in SPL"); -int board_run_command(const char *cmdline) -{ - printf("## Commands are disabled. Please enable CONFIG_CMDLINE.\n"); - - return 1; -} - static void setup_ram_buf(struct sandbox_state *state) { /* Zero the RAM buffer if we didn't read it, to keep valgrind happy */ diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index cd46e000f5e9e77abce85fb864e72282992ac977..a347cec5284e99652ffe98c4bd99f015d05a0eb2 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -7,6 +7,7 @@ #include <errno.h> #include <fdtdec.h> #include <os.h> +#include <asm/malloc.h> #include <asm/state.h> /* Main state record for the sandbox */ @@ -16,28 +17,28 @@ static struct sandbox_state *state; /* Pointer to current state record */ static int state_ensure_space(int extra_size) { void *blob = state->state_fdt; - int used, size, free; + int used, size, free_bytes; void *buf; int ret; used = fdt_off_dt_strings(blob) + fdt_size_dt_strings(blob); size = fdt_totalsize(blob); - free = size - used; - if (free > extra_size) + free_bytes = size - used; + if (free_bytes > extra_size) return 0; size = used + extra_size; - buf = os_malloc(size); + buf = malloc(size); if (!buf) return -ENOMEM; ret = fdt_open_into(blob, buf, size); if (ret) { - os_free(buf); + free(buf); return -EIO; } - os_free(blob); + free(blob); state->state_fdt = buf; return 0; } @@ -53,7 +54,7 @@ static int state_read_file(struct sandbox_state *state, const char *fname) printf("Cannot find sandbox state file '%s'\n", fname); return -ENOENT; } - state->state_fdt = os_malloc(size); + state->state_fdt = malloc(size); if (!state->state_fdt) { puts("No memory to read sandbox state\n"); return -ENOMEM; @@ -75,7 +76,7 @@ static int state_read_file(struct sandbox_state *state, const char *fname) err_read: os_close(fd); err_open: - os_free(state->state_fdt); + free(state->state_fdt); state->state_fdt = NULL; return ret; @@ -242,7 +243,7 @@ int sandbox_write_state(struct sandbox_state *state, const char *fname) /* Create a state FDT if we don't have one */ if (!state->state_fdt) { size = 0x4000; - state->state_fdt = os_malloc(size); + state->state_fdt = malloc(size); if (!state->state_fdt) { puts("No memory to create FDT\n"); return -ENOMEM; @@ -300,7 +301,7 @@ int sandbox_write_state(struct sandbox_state *state, const char *fname) err_write: os_close(fd); err_create: - os_free(state->state_fdt); + free(state->state_fdt); return ret; } @@ -418,7 +419,7 @@ int state_uninit(void) os_unlink(state->jumped_fname); if (state->state_fdt) - os_free(state->state_fdt); + free(state->state_fdt); memset(state, '\0', sizeof(*state)); return 0; diff --git a/arch/sandbox/dts/sandbox.dtsi b/arch/sandbox/dts/sandbox.dtsi index 7bf144f53265a0be85932f0dfe820355ddc3e128..7cd56c14f289207ebf1de3c46d8aae835b158bd2 100644 --- a/arch/sandbox/dts/sandbox.dtsi +++ b/arch/sandbox/dts/sandbox.dtsi @@ -83,6 +83,7 @@ compatible = "sandbox,lcd-sdl"; xres = <1366>; yres = <768>; + log2-depth = <5>; }; leds { diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts index c228447431435722b9a0448ffbbb0bf0c72176e2..4a277934a711383add30ef3b9facec4a0ff24539 100644 --- a/arch/sandbox/dts/test.dts +++ b/arch/sandbox/dts/test.dts @@ -816,6 +816,9 @@ chosen { #address-cells = <1>; #size-cells = <1>; + setting = "sunrise ohoka"; + other-node = "/some-bus/c-test@5"; + int-values = <0x1937 72993>; chosen-test { compatible = "denx,u-boot-fdt-test"; reg = <9 1>; diff --git a/arch/sandbox/include/asm/malloc.h b/arch/sandbox/include/asm/malloc.h new file mode 100644 index 0000000000000000000000000000000000000000..a1467b5eaddf1c75b131b803b2a3954fe4aa7e17 --- /dev/null +++ b/arch/sandbox/include/asm/malloc.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Sandbox access to system malloc (i.e. not U-Boot's) + * + * Copyright 2020 Google LLC + */ + +#ifndef __ASM_MALLOC_H + +void *malloc(size_t size); +void free(void *ptr); +void *calloc(size_t nmemb, size_t size); +void *realloc(void *ptr, size_t size); +void *reallocarray(void *ptr, size_t nmemb, size_t size); + +/* + * This header allows calling the system allocation routines. It makes no + * sense to also include U-Boot's malloc.h since that redfines malloc to + * have a 'dl' prefix. These two implementations cannot be mixed and matched + * in the same file. + */ +#ifdef __MALLOC_H__ +#error "This sandbox header file cannot be included with malloc.h" +#endif + +#endif diff --git a/arch/sandbox/include/asm/sdl.h b/arch/sandbox/include/asm/sdl.h index c45dbddd70003dfda2571cd343075bc307f31642..47fc4889d2074c2c7d734cb1e86d8acf95413262 100644 --- a/arch/sandbox/include/asm/sdl.h +++ b/arch/sandbox/include/asm/sdl.h @@ -17,10 +17,13 @@ * @height Window height in pixels * @log2_bpp: Log to base 2 of the number of bits per pixel. So a 32bpp * display will pass 5, since 2*5 = 32 + * @double_size: true to double the visible size in each direction for high-DPI + * displays * @return 0 if OK, -ENODEV if no device, -EIO if SDL failed to initialize * and -EPERM if the video failed to come up. */ -int sandbox_sdl_init_display(int width, int height, int log2_bpp); +int sandbox_sdl_init_display(int width, int height, int log2_bpp, + bool double_size); /** * sandbox_sdl_sync() - Sync current U-Boot LCD frame buffer to SDL @@ -78,8 +81,8 @@ int sandbox_sdl_sound_stop(void); int sandbox_sdl_sound_init(int rate, int channels); #else -static inline int sandbox_sdl_init_display(int width, int height, - int log2_bpp) +static inline int sandbox_sdl_init_display(int width, int height, int log2_bpp, + bool double_size) { return -ENODEV; } diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index ad3e94beb9a77e79e6167cf2852b2eb7614ecf52..705645d7144814c0e26181588b8d3e6ea198a3f6 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -83,6 +83,7 @@ struct sandbox_state { bool write_state; /* Write sandbox state on exit */ bool ignore_missing_state_on_read; /* No error if state missing */ bool show_lcd; /* Show LCD on start-up */ + bool double_lcd; /* Double display size for high-DPI */ enum sysreset_t last_sysreset; /* Last system reset type */ bool sysreset_allowed[SYSRESET_COUNT]; /* Allowed system reset types */ enum state_terminal_raw term_raw; /* Terminal raw/cooked */ diff --git a/arch/sandbox/include/asm/test.h b/arch/sandbox/include/asm/test.h index 7775794eaa86e9ae88e8fadc0b2cf43cb269e4cc..7f99d07c47fcf95ccf1ddf427d8dbf0b570548ff 100644 --- a/arch/sandbox/include/asm/test.h +++ b/arch/sandbox/include/asm/test.h @@ -169,6 +169,13 @@ int sandbox_get_i2s_sum(struct udevice *dev); */ int sandbox_get_setup_called(struct udevice *dev); +/** + * sandbox_get_sound_active() - Returns whether sound play is in progress + * + * @return true if active, false if not + */ +int sandbox_get_sound_active(struct udevice *dev); + /** * sandbox_get_sound_sum() - Read back the sum of the sound data so far * diff --git a/arch/x86/cpu/apollolake/fsp_s.c b/arch/x86/cpu/apollolake/fsp_s.c index b2d91308411f4b32e6c963a046bab51fff34c835..1f22c1ea3c68f748280604058ccaae040fc05b5b 100644 --- a/arch/x86/cpu/apollolake/fsp_s.c +++ b/arch/x86/cpu/apollolake/fsp_s.c @@ -9,6 +9,7 @@ #include <binman.h> #include <dm.h> #include <irq.h> +#include <malloc.h> #include <asm/intel_pinctrl.h> #include <asm/io.h> #include <asm/intel_regs.h> diff --git a/arch/x86/cpu/apollolake/spl.c b/arch/x86/cpu/apollolake/spl.c index 7ab7243311c5fcf05177842c68e72dd767b1f5ed..d32f2a989876b3f38284869f5c79a7721bb381f8 100644 --- a/arch/x86/cpu/apollolake/spl.c +++ b/arch/x86/cpu/apollolake/spl.c @@ -6,6 +6,7 @@ #include <common.h> #include <binman_sym.h> #include <dm.h> +#include <malloc.h> #include <spi.h> #include <spl.h> #include <spi_flash.h> diff --git a/arch/x86/cpu/apollolake/uart.c b/arch/x86/cpu/apollolake/uart.c index f2b356eb447bca4ad4fee2f7c9232fe467e7202c..f368f7d2db4e9ef55d532a73dec6968e24a1412f 100644 --- a/arch/x86/cpu/apollolake/uart.c +++ b/arch/x86/cpu/apollolake/uart.c @@ -10,6 +10,7 @@ #include <common.h> #include <dm.h> #include <dt-structs.h> +#include <malloc.h> #include <ns16550.h> #include <spl.h> #include <asm/io.h> diff --git a/arch/x86/cpu/intel_common/itss.c b/arch/x86/cpu/intel_common/itss.c index b6b57cc9a0e2c11d42cfa3c845b02a277d1df1ba..e4f785ce895dcb46f741708a99314478a09cd759 100644 --- a/arch/x86/cpu/intel_common/itss.c +++ b/arch/x86/cpu/intel_common/itss.c @@ -13,6 +13,7 @@ #include <dm.h> #include <dt-structs.h> #include <irq.h> +#include <malloc.h> #include <p2sb.h> #include <spl.h> #include <asm/itss.h> diff --git a/arch/x86/cpu/qemu/e820.c b/arch/x86/cpu/qemu/e820.c index a4136eb98cfd14372b67c45b262f8476a41d9774..0da36bddeaecb20e1d8ab9addd8e95026b020a24 100644 --- a/arch/x86/cpu/qemu/e820.c +++ b/arch/x86/cpu/qemu/e820.c @@ -8,6 +8,7 @@ #include <common.h> #include <env_internal.h> +#include <malloc.h> #include <asm/e820.h> #include <asm/arch/qemu.h> diff --git a/arch/x86/cpu/qfw_cpu.c b/arch/x86/cpu/qfw_cpu.c index 49e9dfcf69199f0b74b5fd99cc3e98b3036a7d70..349bab1583ac69d150807817c6f66c1962f13396 100644 --- a/arch/x86/cpu/qfw_cpu.c +++ b/arch/x86/cpu/qfw_cpu.c @@ -6,6 +6,7 @@ #include <common.h> #include <cpu.h> #include <dm.h> +#include <malloc.h> #include <qfw.h> #include <dm/lists.h> #include <dm/uclass-internal.h> diff --git a/arch/x86/lib/coreboot_table.c b/arch/x86/lib/coreboot_table.c index 8685aa30467bf4e419e7074c0ad8b68f0020bb02..2943e11d2a40a77b88920a5f8468d8d4dd01f2c9 100644 --- a/arch/x86/lib/coreboot_table.c +++ b/arch/x86/lib/coreboot_table.c @@ -5,6 +5,7 @@ #include <common.h> #include <acpi_s3.h> +#include <malloc.h> #include <vbe.h> #include <asm/coreboot_tables.h> #include <asm/e820.h> diff --git a/arch/x86/lib/fsp1/fsp_common.c b/arch/x86/lib/fsp1/fsp_common.c index ec9c218778d2eae7d93f23fb15720b4421a46142..aee2a05044f8ab0ccda947e27e2924e71b4b494a 100644 --- a/arch/x86/lib/fsp1/fsp_common.c +++ b/arch/x86/lib/fsp1/fsp_common.c @@ -7,6 +7,7 @@ #include <acpi_s3.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <rtc.h> #include <asm/cmos_layout.h> #include <asm/early_cmos.h> diff --git a/arch/x86/lib/mrccache.c b/arch/x86/lib/mrccache.c index b9420a4cab5201efffb66832c140f03ccc82bdcb..8914960226dcbdf5dc90ebc79e2342881d437bea 100644 --- a/arch/x86/lib/mrccache.c +++ b/arch/x86/lib/mrccache.c @@ -10,6 +10,7 @@ #include <dm.h> #include <errno.h> #include <fdtdec.h> +#include <malloc.h> #include <net.h> #include <spi.h> #include <spi_flash.h> diff --git a/arch/x86/lib/tables.c b/arch/x86/lib/tables.c index 99f142936318da1c78a110aafd8df586d2312eca..7aea722d0b8dd7a1041d346f1cd7b162c86073a9 100644 --- a/arch/x86/lib/tables.c +++ b/arch/x86/lib/tables.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <malloc.h> #include <smbios.h> #include <asm/sfi.h> #include <asm/mpspec.h> diff --git a/board/compulab/common/common.c b/board/compulab/common/common.c index cbac112dd8423f0bb86d8a35ad5764aaffe7147c..2f92c6564d7867255dc720f7c7e79db8341fe992 100644 --- a/board/compulab/common/common.c +++ b/board/compulab/common/common.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/bootm.h> #include <asm/gpio.h> #include <asm/setup.h> diff --git a/board/corscience/tricorder/tricorder.c b/board/corscience/tricorder/tricorder.c index da33f8441cec9b23fa8cc6c760f43178e1bace38..cec819b36fbed11ff58576a5b79fe0f00925e36b 100644 --- a/board/corscience/tricorder/tricorder.c +++ b/board/corscience/tricorder/tricorder.c @@ -10,6 +10,7 @@ * Frederik Kriewitz <frederik@kriewitz.eu> */ #include <common.h> +#include <malloc.h> #include <twl4030.h> #include <status_led.h> #include <asm/io.h> diff --git a/board/gardena/smart-gateway-mt7688/board.c b/board/gardena/smart-gateway-mt7688/board.c index ae03f0a434fa1f715f3a226bfed7688ab15847fd..48cf3091e99792db5365f6743467b5da077dd970 100644 --- a/board/gardena/smart-gateway-mt7688/board.c +++ b/board/gardena/smart-gateway-mt7688/board.c @@ -8,6 +8,7 @@ #include <env_internal.h> #include <init.h> #include <led.h> +#include <malloc.h> #include <net.h> #include <spi.h> #include <spi_flash.h> diff --git a/board/ge/common/vpd_reader.c b/board/ge/common/vpd_reader.c index 4df411cf10008ecfc476ae6bf9f9e8065e2c1b0c..d42b00da2fe6c72a08a674f83b08dc921e35556c 100644 --- a/board/ge/common/vpd_reader.c +++ b/board/ge/common/vpd_reader.c @@ -4,6 +4,7 @@ */ #include "vpd_reader.h" +#include <malloc.h> #include <i2c.h> #include <linux/bch.h> diff --git a/board/google/veyron/veyron.c b/board/google/veyron/veyron.c index dd2c014c60a6a73c76e35ff44f78917200f34268..6b9c34818b35bac94dc4535b273c2d810e6a38b9 100644 --- a/board/google/veyron/veyron.c +++ b/board/google/veyron/veyron.c @@ -8,6 +8,7 @@ #include <dm.h> #include <asm/arch-rockchip/clock.h> #include <dt-bindings/clock/rk3288-cru.h> +#include <linux/err.h> #include <power/regulator.h> /* diff --git a/board/hisilicon/poplar/poplar.c b/board/hisilicon/poplar/poplar.c index 36999bdcea78d7309a9b3fb62a22e18ad0e721cc..4937dc374c7877b4ae9d959804aae3a3c0a13539 100644 --- a/board/hisilicon/poplar/poplar.c +++ b/board/hisilicon/poplar/poplar.c @@ -4,9 +4,9 @@ * Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> */ +#include <common.h> #include <cpu_func.h> #include <dm.h> -#include <common.h> #include <init.h> #include <asm/io.h> #include <dm/platform_data/serial_pl01x.h> diff --git a/board/isee/igep003x/board.c b/board/isee/igep003x/board.c index bc9fdcd1e6c8267d3fd13eabcbe74addf6039fe2..b0f8d8a314a5cf8e53f50faaccc8400c49a9a0ae 100644 --- a/board/isee/igep003x/board.c +++ b/board/isee/igep003x/board.c @@ -9,6 +9,7 @@ #include <env.h> #include <errno.h> #include <init.h> +#include <malloc.h> #include <serial.h> #include <spl.h> #include <asm/arch/cpu.h> diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c index 74fc5f08900ae7128415c45f44508cb449ad5bfc..1b871fdcc5af4190f633d4f3b35bc7fa1a3238a7 100644 --- a/board/isee/igep00x0/igep00x0.c +++ b/board/isee/igep00x0/igep00x0.c @@ -5,6 +5,7 @@ */ #include <common.h> #include <env.h> +#include <malloc.h> #include <status_led.h> #include <dm.h> #include <ns16550.h> diff --git a/board/menlo/m53menlo/m53menlo.c b/board/menlo/m53menlo/m53menlo.c index 065e6a2ccc444d1f2e736c6f481b8a6dc7b2700b..70a13aa17b3d932944ceffae50a4a886300397f7 100644 --- a/board/menlo/m53menlo/m53menlo.c +++ b/board/menlo/m53menlo/m53menlo.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> #include <init.h> +#include <malloc.h> #include <asm/io.h> #include <asm/arch/imx-regs.h> #include <asm/arch/sys_proto.h> diff --git a/board/microchip/pic32mzda/pic32mzda.c b/board/microchip/pic32mzda/pic32mzda.c index 8bfdee91e56ecda00b9e3bd2a189214f5d40dcc1..aa8aab39cec2128835ec2ee85947e53528b41bfd 100644 --- a/board/microchip/pic32mzda/pic32mzda.c +++ b/board/microchip/pic32mzda/pic32mzda.c @@ -10,6 +10,7 @@ #include <common.h> #include <dm.h> #include <clk.h> +#include <malloc.h> #include <dt-bindings/clock/microchip,clock.h> #include <mach/pic32.h> diff --git a/board/overo/overo.c b/board/overo/overo.c index 442028a764c71f3473a81f35bbe791a05ceb357a..baa7997477efe9cc4b088a6b7c966ca0b47f6296 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -14,6 +14,7 @@ #include <common.h> #include <dm.h> #include <env.h> +#include <malloc.h> #include <ns16550.h> #include <netdev.h> #include <twl4030.h> diff --git a/board/siemens/common/board.c b/board/siemens/common/board.c index 5f5e2eb544cc32645904ced6619da2b8d0c7af18..24429d2837345b8cd9d722308afa4cab1747410a 100644 --- a/board/siemens/common/board.c +++ b/board/siemens/common/board.c @@ -12,6 +12,7 @@ #include <common.h> #include <env.h> #include <errno.h> +#include <malloc.h> #include <serial.h> #include <spl.h> #include <asm/arch/cpu.h> diff --git a/board/siemens/pxm2/board.c b/board/siemens/pxm2/board.c index b5a10ebf8be1add8298bf4811b4426bffb94c054..58bb5bab1a144e3007717f734c7685141f7e4c4b 100644 --- a/board/siemens/pxm2/board.c +++ b/board/siemens/pxm2/board.c @@ -16,6 +16,7 @@ #include <env.h> #include <errno.h> #include <init.h> +#include <malloc.h> #include <spl.h> #include <asm/arch/cpu.h> #include <asm/arch/hardware.h> diff --git a/board/siemens/rut/board.c b/board/siemens/rut/board.c index d7d9738a6d0a1cd30403b0b185779fac4e37b2a5..bd4eaa4f3a597cc41bd402797cf69ab1b30f81c4 100644 --- a/board/siemens/rut/board.c +++ b/board/siemens/rut/board.c @@ -14,6 +14,7 @@ #include <env.h> #include <errno.h> #include <init.h> +#include <malloc.h> #include <spi.h> #include <spl.h> #include <asm/arch/cpu.h> diff --git a/board/st/stm32mp1/stm32mp1.c b/board/st/stm32mp1/stm32mp1.c index e82a43074fb9dd0f7857879ca097c1e95e3b239c..ca76579405d1f100eca989fa1e18d5da6bf18e20 100644 --- a/board/st/stm32mp1/stm32mp1.c +++ b/board/st/stm32mp1/stm32mp1.c @@ -16,6 +16,7 @@ #include <i2c.h> #include <init.h> #include <led.h> +#include <malloc.h> #include <memalign.h> #include <misc.h> #include <mtd.h> @@ -32,6 +33,7 @@ #include <asm/arch/stm32.h> #include <asm/arch/sys_proto.h> #include <jffs2/load_kernel.h> +#include <linux/err.h> #include <power/regulator.h> #include <usb/dwc2_udc.h> diff --git a/board/synopsys/hsdk/clk-lib.c b/board/synopsys/hsdk/clk-lib.c index 6c75ce08702d695109faa605f48aaf8cedac1a53..6b6bb70e3cb6071e53c8a03e98a51b59dc013447 100644 --- a/board/synopsys/hsdk/clk-lib.c +++ b/board/synopsys/hsdk/clk-lib.c @@ -5,6 +5,7 @@ */ #include <clk.h> +#include <malloc.h> #include <dm/device.h> #include "clk-lib.h" diff --git a/board/technexion/tao3530/tao3530.c b/board/technexion/tao3530/tao3530.c index 22d26e550e01d5c7693bc601e4093b41464cbb2a..7d7c427392f1355dfc068ac2aa406a3ca6185d6b 100644 --- a/board/technexion/tao3530/tao3530.c +++ b/board/technexion/tao3530/tao3530.c @@ -4,6 +4,7 @@ * Tapani Utriainen <linuxfae@technexion.com> */ #include <common.h> +#include <malloc.h> #include <netdev.h> #include <twl4030.h> #include <asm/io.h> diff --git a/board/theobroma-systems/puma_rk3399/puma-rk3399.c b/board/theobroma-systems/puma_rk3399/puma-rk3399.c index 9887d2020717af06043d226d50d88d5cb73e70c3..7ff47669471a516c57d9f5cdfcac7108653ed3dc 100644 --- a/board/theobroma-systems/puma_rk3399/puma-rk3399.c +++ b/board/theobroma-systems/puma_rk3399/puma-rk3399.c @@ -49,7 +49,7 @@ static void setup_iodomain(void) static int setup_boottargets(void) { const char *boot_device = - ofnode_get_chosen_prop("u-boot,spl-boot-device"); + ofnode_read_chosen_string("u-boot,spl-boot-device"); char *env_default, *env; if (!boot_device) { diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c index 3d7f73843c94e896e481a2a5fe3e7f79f99cf6b8..01b28e8da46b31fffce2cfe8ab821dd835a88ace 100644 --- a/board/ti/am335x/board.c +++ b/board/ti/am335x/board.c @@ -12,6 +12,7 @@ #include <env.h> #include <errno.h> #include <init.h> +#include <malloc.h> #include <spl.h> #include <serial.h> #include <asm/arch/cpu.h> diff --git a/board/ti/am57xx/board.c b/board/ti/am57xx/board.c index d70ab0c4d01c66a87e16dc1855ce702ecdcc5278..7528de3e5c3c9955b7f5e54f7a38ff0887d3d7a0 100644 --- a/board/ti/am57xx/board.c +++ b/board/ti/am57xx/board.c @@ -11,6 +11,7 @@ #include <env.h> #include <fdt_support.h> #include <init.h> +#include <malloc.h> #include <palmas.h> #include <sata.h> #include <serial.h> diff --git a/board/timll/devkit8000/devkit8000.c b/board/timll/devkit8000/devkit8000.c index 490d8cbcd061f6b56024aff51db8d4a47814546f..b037d725c3af0ed3b8bd4533d6cd36e1cc84517e 100644 --- a/board/timll/devkit8000/devkit8000.c +++ b/board/timll/devkit8000/devkit8000.c @@ -18,6 +18,7 @@ #include <common.h> #include <dm.h> #include <env.h> +#include <malloc.h> #include <ns16550.h> #include <twl4030.h> #include <asm/io.h> diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index ae5fe2729f7ebe9948b2947913530aae2ff3a5de..f87e2e91059e3f82c36ea68a3cfb68b87451fefa 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -22,7 +22,7 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) return -ENODEV; debug("%s: Path to EEPROM %s\n", __func__, - ofnode_get_chosen_prop("xlnx,eeprom")); + ofnode_read_chosen_string("xlnx,eeprom")); ret = uclass_get_device_by_ofnode(UCLASS_I2C_EEPROM, eeprom, &dev); if (ret) diff --git a/cmd/bootefi.c b/cmd/bootefi.c index 56bdff33c64732fc6f6671b08478121133d9e742..d347bd5ec064a2737f24da8a536d83a9cd45b3e6 100644 --- a/cmd/bootefi.c +++ b/cmd/bootefi.c @@ -13,6 +13,7 @@ #include <efi_selftest.h> #include <env.h> #include <errno.h> +#include <malloc.h> #include <linux/libfdt.h> #include <linux/libfdt_env.h> #include <mapmem.h> diff --git a/cmd/dm.c b/cmd/dm.c index 7b271db0bbe7b1ad7da85adb337b29216bb49fde..108707c298a4d6fb35e148b7768e34bdd796b8b4 100644 --- a/cmd/dm.c +++ b/cmd/dm.c @@ -40,10 +40,19 @@ static int do_dm_dump_devres(cmd_tbl_t *cmdtp, int flag, int argc, return 0; } +static int do_dm_dump_drivers(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + dm_dump_drivers(); + + return 0; +} + static cmd_tbl_t test_commands[] = { U_BOOT_CMD_MKENT(tree, 0, 1, do_dm_dump_all, "", ""), U_BOOT_CMD_MKENT(uclass, 1, 1, do_dm_dump_uclass, "", ""), U_BOOT_CMD_MKENT(devres, 1, 1, do_dm_dump_devres, "", ""), + U_BOOT_CMD_MKENT(drivers, 1, 1, do_dm_dump_drivers, "", ""), }; static __maybe_unused void dm_reloc(void) @@ -84,5 +93,6 @@ U_BOOT_CMD( "Driver model low level access", "tree Dump driver model tree ('*' = activated)\n" "dm uclass Dump list of instances for each uclass\n" - "dm devres Dump list of device resources for each device" + "dm devres Dump list of device resources for each device\n" + "dm drivers Dump list of drivers and their compatible strings\n" ); diff --git a/cmd/gpio.c b/cmd/gpio.c index 67eef83c951c73326e3a458c4417b51a70a1c172..16c2cebb3d4bf6a125e452de7b852f718d681acf 100644 --- a/cmd/gpio.c +++ b/cmd/gpio.c @@ -10,7 +10,9 @@ #include <command.h> #include <errno.h> #include <dm.h> +#include <malloc.h> #include <asm/gpio.h> +#include <linux/err.h> __weak int name_to_gpio(const char *name) { diff --git a/cmd/gpt.c b/cmd/gpt.c index 964702bad43e91281d4e0a937143babdd5250dd0..efaf1bcecb2bae46c83268b5e69564f6857b40bd 100644 --- a/cmd/gpt.c +++ b/cmd/gpt.c @@ -20,6 +20,7 @@ #include <div64.h> #include <memalign.h> #include <linux/compat.h> +#include <linux/err.h> #include <linux/sizes.h> #include <stdlib.h> diff --git a/cmd/host.c b/cmd/host.c index 98c4d2a099e972354114d6fcfb0efb158e33dbad..eefc4f255ef2fcfe3b69f57cc4ce789ca033bd08 100644 --- a/cmd/host.c +++ b/cmd/host.c @@ -8,6 +8,7 @@ #include <fs.h> #include <part.h> #include <sandboxblockdev.h> +#include <dm/device_compat.h> #include <linux/errno.h> static int host_curr_device = -1; diff --git a/cmd/mtd.c b/cmd/mtd.c index a559b5a4a35aaeb18106703dd72f6d18e493a546..f407c5e4450ac438b0b62c685c37adbac99e14a8 100644 --- a/cmd/mtd.c +++ b/cmd/mtd.c @@ -14,6 +14,8 @@ #include <malloc.h> #include <mapmem.h> #include <mtd.h> +#include <dm/devres.h> +#include <linux/err.h> #include <linux/ctype.h> diff --git a/cmd/rng.c b/cmd/rng.c index 36ca7a101c1fd5b2cc4dc261aecf5dd0ebe60ec8..76367fed94b7a0a67648a3329149dcc4ad39f375 100644 --- a/cmd/rng.c +++ b/cmd/rng.c @@ -8,6 +8,7 @@ #include <command.h> #include <dm.h> #include <hexdump.h> +#include <malloc.h> #include <rng.h> static int do_rng(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) diff --git a/cmd/tpm-common.c b/cmd/tpm-common.c index 38900fb1590bbfc2bee376961f7e89dffd1a51c9..30142552290635cea1448abb56eab3f0d71ac9f5 100644 --- a/cmd/tpm-common.c +++ b/cmd/tpm-common.c @@ -7,11 +7,14 @@ #include <command.h> #include <dm.h> #include <env.h> +#include <malloc.h> #include <asm/unaligned.h> #include <linux/string.h> #include <tpm-common.h> #include "tpm-user-utils.h" +static struct udevice *tpm_dev; + /** * Print a byte string in hexdecimal format, 16-bytes per line. * @@ -231,19 +234,86 @@ int type_string_write_vars(const char *type_str, u8 *data, return 0; } +static int tpm_show_device(void) +{ + struct udevice *dev; + char buf[80]; + int n = 0, rc; + + for_each_tpm_device(dev) { + rc = tpm_get_desc(dev, buf, sizeof(buf)); + if (rc < 0) + printf("device %d: can't get info\n", n); + else + printf("device %d: %s\n", n, buf); + + n++; + }; + + return 0; +} + +static int tpm_set_device(unsigned long num) +{ + struct udevice *dev; + unsigned long n = 0; + int rc = CMD_RET_FAILURE; + + for_each_tpm_device(dev) { + if (n == num) { + rc = 0; + break; + } + + n++; + } + + if (!rc) + tpm_dev = dev; + + return rc; +} + int get_tpm(struct udevice **devp) { int rc; - rc = uclass_first_device_err(UCLASS_TPM, devp); - if (rc) { - printf("Could not find TPM (ret=%d)\n", rc); - return CMD_RET_FAILURE; + /* + * To keep a backward compatibility with previous code, + * if a tpm device is not explicitly set, we set the first one. + */ + if (!tpm_dev) { + rc = tpm_set_device(0); + if (rc) { + printf("Couldn't set TPM 0 (rc = %d)\n", rc); + return CMD_RET_FAILURE; + } } + if (devp) + *devp = tpm_dev; + return 0; } +int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) +{ + unsigned long num; + int rc; + + if (argc == 2) { + num = simple_strtoul(argv[1], NULL, 10); + + rc = tpm_set_device(num); + if (rc) + printf("Couldn't set TPM %lu (rc = %d)\n", num, rc); + } else { + rc = tpm_show_device(); + } + + return rc; +} + int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]) { struct udevice *dev; diff --git a/cmd/tpm-user-utils.h b/cmd/tpm-user-utils.h index 8ce98617843b23d318461d4445f34e38648ec89c..a851d9c4af2373cfbede182f1d2a80a9335d5770 100644 --- a/cmd/tpm-user-utils.h +++ b/cmd/tpm-user-utils.h @@ -17,6 +17,7 @@ int type_string_pack(const char *type_str, char * const values[], u8 *data); int type_string_write_vars(const char *type_str, u8 *data, char * const vars[]); int get_tpm(struct udevice **devp); +int do_tpm_device(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); int do_tpm_init(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); int do_tpm_info(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[]); int do_tpm(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]); diff --git a/cmd/tpm-v1.c b/cmd/tpm-v1.c index 2807331524aa811d10d17357406baae2f3f5d535..bc34e0654f9d58a043345737c797e80f853a0091 100644 --- a/cmd/tpm-v1.c +++ b/cmd/tpm-v1.c @@ -645,6 +645,7 @@ TPM_COMMAND_NO_ARG(tpm_physical_enable) TPM_COMMAND_NO_ARG(tpm_physical_disable) static cmd_tbl_t tpm1_commands[] = { + U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""), U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""), U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""), U_BOOT_CMD_MKENT(startup, 0, 1, @@ -721,6 +722,8 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm, "cmd args...\n" " - Issue TPM command <cmd> with arguments <args...>.\n" "Admin Startup and State Commands:\n" +" device [num device]\n" +" - Show all devices or set the specified device\n" " info - Show information about the TPM\n" " init\n" " - Put TPM into a state where it waits for 'startup' command.\n" diff --git a/cmd/tpm-v2.c b/cmd/tpm-v2.c index 459a955d2907394cfec1df03a8c86d12af2c8f39..0cd39821bfff41c905113e0782e98ecef9c52ebe 100644 --- a/cmd/tpm-v2.c +++ b/cmd/tpm-v2.c @@ -354,6 +354,7 @@ static int do_tpm_pcr_setauthvalue(cmd_tbl_t *cmdtp, int flag, } static cmd_tbl_t tpm2_commands[] = { + U_BOOT_CMD_MKENT(device, 0, 1, do_tpm_device, "", ""), U_BOOT_CMD_MKENT(info, 0, 1, do_tpm_info, "", ""), U_BOOT_CMD_MKENT(init, 0, 1, do_tpm_init, "", ""), U_BOOT_CMD_MKENT(startup, 0, 1, do_tpm2_startup, "", ""), @@ -381,6 +382,8 @@ cmd_tbl_t *get_tpm2_commands(unsigned int *size) U_BOOT_CMD(tpm2, CONFIG_SYS_MAXARGS, 1, do_tpm, "Issue a TPMv2.x command", "<command> [<arguments>]\n" "\n" +"device [num device]\n" +" Show all devices or set the specified device\n" "info\n" " Show information about the TPM.\n" "init\n" diff --git a/cmd/ubi.c b/cmd/ubi.c index 22ba5b1a2cedefe2f843f3464f10cce72e65adc9..cecf251fdb917145ff9550696b1362ed3aa67799 100644 --- a/cmd/ubi.c +++ b/cmd/ubi.c @@ -15,10 +15,12 @@ #include <command.h> #include <env.h> #include <exports.h> +#include <malloc.h> #include <memalign.h> #include <mtd.h> #include <nand.h> #include <onenand_uboot.h> +#include <dm/devres.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <linux/err.h> diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c index 570cf3aa508bd03828b1b654043d844feb237ab2..c5c6899787c84a746afb30317433ab9c779f39e8 100644 --- a/cmd/usb_mass_storage.c +++ b/cmd/usb_mass_storage.c @@ -11,6 +11,7 @@ #include <command.h> #include <console.h> #include <g_dnl.h> +#include <malloc.h> #include <part.h> #include <usb.h> #include <usb_mass_storage.h> diff --git a/cmd/ximg.c b/cmd/ximg.c index dccd1143a7a5bc5c3dc46ad13bc3a7a13c27f278..770f6a3eede78bf2edce966cf831f3f5e027dc24 100644 --- a/cmd/ximg.c +++ b/cmd/ximg.c @@ -17,6 +17,7 @@ #include <env.h> #include <gzip.h> #include <image.h> +#include <malloc.h> #include <mapmem.h> #include <watchdog.h> #if defined(CONFIG_BZIP2) diff --git a/common/android_ab.c b/common/android_ab.c index 6c4df419b29ac45e3db4b6ace36abb838c3d3e38..e0fe32d24da5b1cd616a3bd3f08ba16547c8c871 100644 --- a/common/android_ab.c +++ b/common/android_ab.c @@ -5,6 +5,7 @@ #include <common.h> #include <android_ab.h> #include <android_bootloader_message.h> +#include <malloc.h> #include <linux/err.h> #include <memalign.h> #include <u-boot/crc.h> diff --git a/common/autoboot.c b/common/autoboot.c index 94a1b4abebac941858909b7e89cfd838ee40f5b1..4ea9be6da9e626a91063c483742607d67a84518c 100644 --- a/common/autoboot.c +++ b/common/autoboot.c @@ -13,6 +13,7 @@ #include <env.h> #include <fdtdec.h> #include <hash.h> +#include <malloc.h> #include <memalign.h> #include <menu.h> #include <post.h> diff --git a/common/bloblist.c b/common/bloblist.c index ccf5e4b6f64576c028607292e120beb01ddef298..99501951e0c068a57d3bfb8d988f96dbb85b1cc0 100644 --- a/common/bloblist.c +++ b/common/bloblist.c @@ -59,11 +59,10 @@ static int bloblist_addrec(uint tag, int size, struct bloblist_rec **recp) struct bloblist_rec *rec; int new_alloced; - new_alloced = hdr->alloced + sizeof(*rec) + - ALIGN(size, BLOBLIST_ALIGN); + new_alloced = hdr->alloced + sizeof(*rec) + ALIGN(size, BLOBLIST_ALIGN); if (new_alloced >= hdr->size) { log(LOGC_BLOBLIST, LOGL_ERR, - "Failed to allocate %x bytes size=%x, need size>=%x\n", + "Failed to allocate %x bytes size=%x, need size=%x\n", size, hdr->size, new_alloced); return log_msg_ret("bloblist add", -ENOSPC); } @@ -74,6 +73,9 @@ static int bloblist_addrec(uint tag, int size, struct bloblist_rec **recp) rec->hdr_size = sizeof(*rec); rec->size = size; rec->spare = 0; + + /* Zero the record data */ + memset(rec + 1, '\0', rec->size); *recp = rec; return 0; @@ -85,8 +87,10 @@ static int bloblist_ensurerec(uint tag, struct bloblist_rec **recp, int size) rec = bloblist_findrec(tag); if (rec) { - if (size && size != rec->size) + if (size && size != rec->size) { + *recp = rec; return -ESPIPE; + } } else { int ret; @@ -145,6 +149,21 @@ void *bloblist_ensure(uint tag, int size) return (void *)rec + rec->hdr_size; } +int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp) +{ + struct bloblist_rec *rec; + int ret; + + ret = bloblist_ensurerec(tag, &rec, *sizep); + if (ret == -ESPIPE) + *sizep = rec->size; + else if (ret) + return ret; + *blobp = (void *)rec + rec->hdr_size; + + return 0; +} + static u32 bloblist_calc_chksum(struct bloblist_hdr *hdr) { struct bloblist_rec *rec; diff --git a/common/cli.c b/common/cli.c index 7ffe902b88dd13c06d67035a3eac91047a9aeee5..38bba17585ca5a56970ad61317d12408833cd657 100644 --- a/common/cli.c +++ b/common/cli.c @@ -71,6 +71,13 @@ int run_command_repeatable(const char *cmd, int flag) return 0; #endif } +#else +__weak int board_run_command(const char *cmdline) +{ + printf("## Commands are disabled. Please enable CONFIG_CMDLINE.\n"); + + return 1; +} #endif /* CONFIG_CMDLINE */ int run_command_list(const char *cmd, int len, int flag) diff --git a/common/console.c b/common/console.c index 168ba60d0d9e84bcd6255e17f3301aa87ed5a55b..7681da19a2f8b2b7780af672da0721f8183f02fc 100644 --- a/common/console.c +++ b/common/console.c @@ -621,6 +621,17 @@ void console_record_reset_enable(void) console_record_reset(); gd->flags |= GD_FLG_RECORD; } + +int console_record_readline(char *str, int maxlen) +{ + return membuff_readline(&gd->console_out, str, maxlen, ' '); +} + +int console_record_avail(void) +{ + return membuff_avail(&gd->console_out); +} + #endif /* test if ctrl-c was pressed */ diff --git a/common/exports.c b/common/exports.c index b4f1f7af152997607aeab793637d2a832380abab..18af38a5f6e91d60f65cfe4bfe6b81c41765a750 100644 --- a/common/exports.c +++ b/common/exports.c @@ -1,5 +1,6 @@ #include <common.h> #include <exports.h> +#include <malloc.h> #include <spi.h> #include <i2c.h> diff --git a/common/image-fdt.c b/common/image-fdt.c index dbb1e6e131c8e06c745320a6b27eb8d9b435b462..3002948b6b0e219f25a31ce40125ec92ce46e6df 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -14,6 +14,7 @@ #include <env.h> #include <errno.h> #include <image.h> +#include <malloc.h> #include <linux/libfdt.h> #include <mapmem.h> #include <asm/io.h> @@ -122,7 +123,7 @@ void boot_fdt_add_mem_rsv_regions(struct lmb *lmb, void *fdt_blob) /* check if this subnode has a reg property */ ret = fdt_get_resource(fdt_blob, subnode, "reg", 0, &res); - if (!ret) { + if (!ret && fdtdec_get_is_enabled(fdt_blob, subnode)) { addr = res.start; size = res.end - res.start + 1; boot_fdt_reserve_region(lmb, addr, size); diff --git a/common/image.c b/common/image.c index 2288cff1266132529e462b8112d63796862b5c2a..94873cb6ed50cb4c37e142393d5d244bd3159181 100644 --- a/common/image.c +++ b/common/image.c @@ -10,6 +10,7 @@ #include <common.h> #include <cpu_func.h> #include <env.h> +#include <malloc.h> #include <u-boot/crc.h> #include <watchdog.h> diff --git a/common/usb.c b/common/usb.c index d9bcb5a57e89f5922aaba1e353a120d82490ef34..349e838f1d57785dff86eb5e8ee04d682d3841ec 100644 --- a/common/usb.c +++ b/common/usb.c @@ -28,6 +28,7 @@ #include <common.h> #include <command.h> #include <dm.h> +#include <malloc.h> #include <memalign.h> #include <asm/processor.h> #include <linux/compiler.h> diff --git a/common/usb_hub.c b/common/usb_hub.c index 25c2ac43450db8b92cba39fbab8dd9c9b47ebe21..c642b683e7ebc74dab4056001d8b2179265c68bb 100644 --- a/common/usb_hub.c +++ b/common/usb_hub.c @@ -26,6 +26,7 @@ #include <dm.h> #include <env.h> #include <errno.h> +#include <malloc.h> #include <memalign.h> #include <asm/processor.h> #include <asm/unaligned.h> diff --git a/doc/README.bloblist b/doc/README.bloblist index b0e787b97dba90a35c5f42b4f931a2cddd118ea0..274c46055717fe589f2ba8465d72f63922780b0d 100644 --- a/doc/README.bloblist +++ b/doc/README.bloblist @@ -55,8 +55,8 @@ a single bloblist. API --- -Bloblist provides a fairly simple API which allows blobs to be created and -found. All access is via the blob's tag. +Bloblist provides a fairly simple API which allows blobs to be created and +found. All access is via the blob's tag. Blob records are zeroed when added. Finishing the bloblist diff --git a/doc/arch/sandbox.rst b/doc/arch/sandbox.rst index e1f4dde6f86f58d7f9b66069a503fbb0fe56fa4a..e577a957169b6634651d674de439ae44dda5d840 100644 --- a/doc/arch/sandbox.rst +++ b/doc/arch/sandbox.rst @@ -43,7 +43,7 @@ To run sandbox U-Boot use something like:: ./u-boot Note: If you get errors about 'sdl-config: Command not found' you may need to -install libsdl1.2-dev or similar to get SDL support. Alternatively you can +install libsdl2.0-dev or similar to get SDL support. Alternatively you can build sandbox without SDL (i.e. no display/keyboard support) by removing the CONFIG_SANDBOX_SDL line in include/configs/sandbox.h or using:: diff --git a/doc/device-tree-bindings/video/sandbox-fb.txt b/doc/device-tree-bindings/video/sandbox-fb.txt index eb91b30e3f8e5717a855ecfcc74c346b982ed86c..230d25c23bb969ce3cb22f197b31c090ef245249 100644 --- a/doc/device-tree-bindings/video/sandbox-fb.txt +++ b/doc/device-tree-bindings/video/sandbox-fb.txt @@ -2,7 +2,10 @@ Sandbox LCD =========== This uses the displaymode.txt binding except that only xres and yres are -required properties. +required properties. Also an additional optional property is defined: + +log2-depth: Log base 2 of the U-Boot display buffer depth (4=16bpp, 5=32bpp). + If not provided, a value of 4 is used. Example: @@ -10,4 +13,5 @@ Example: compatible = "sandbox,lcd-sdl"; xres = <800>; yres = <600>; + log2-depth = <5>; }; diff --git a/doc/driver-model/debugging.rst b/doc/driver-model/debugging.rst index 4f4a8d4805f57e4a5b96ac8ed2165f07de28f604..c59bf6763bd0236dffd9c2ce15949980be496a2b 100644 --- a/doc/driver-model/debugging.rst +++ b/doc/driver-model/debugging.rst @@ -58,5 +58,5 @@ If you are using of-platdata (e.g. CONFIG_SPL_OF_PLATDATA), check that the driver name is the same as the first compatible string in the device tree (with invalid-variable characters converted to underscore). -If you are really stuck, #define DEBUG at the top of lists.c should show you -what is going on. +If you are really stuck, putting '#define LOG_DEBUG' at the top of +drivers/core/lists.c should show you what is going on. diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c index ed773b9642b0ebf553b9f5c2dbe8763609d0c139..850142cce377b5a6ea661e75dd7e7c567c05ea8b 100644 --- a/drivers/adc/rockchip-saradc.c +++ b/drivers/adc/rockchip-saradc.c @@ -11,6 +11,7 @@ #include <dm.h> #include <errno.h> #include <asm/io.h> +#include <linux/err.h> #define SARADC_CTRL_CHN_MASK GENMASK(2, 0) #define SARADC_CTRL_POWER_CTRL BIT(3) diff --git a/drivers/adc/stm32-adc-core.c b/drivers/adc/stm32-adc-core.c index 04b6a8a2f5b5db216c0b4c8290b7dc03500c6001..2ca0fb4f108b3df3973f1cfe2a319e735e9a3903 100644 --- a/drivers/adc/stm32-adc-core.c +++ b/drivers/adc/stm32-adc-core.c @@ -8,6 +8,7 @@ #include <common.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <power/regulator.h> #include "stm32-adc-core.h" diff --git a/drivers/adc/stm32-adc.c b/drivers/adc/stm32-adc.c index 029338e4af6093ad0fa4f9d70a6e2853bed5301d..ca1ac3e757ee8a5ede1a73906ff0d247e64b5567 100644 --- a/drivers/adc/stm32-adc.c +++ b/drivers/adc/stm32-adc.c @@ -9,6 +9,7 @@ #include <common.h> #include <adc.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/iopoll.h> #include "stm32-adc-core.h" diff --git a/drivers/axi/sandbox_store.c b/drivers/axi/sandbox_store.c index d724f190798fe87c73b79d80fdb3cc03698c6802..a6f483ed2511a9da7fba9a867a4e9c5ccb823d6f 100644 --- a/drivers/axi/sandbox_store.c +++ b/drivers/axi/sandbox_store.c @@ -7,6 +7,7 @@ #include <common.h> #include <axi.h> #include <dm.h> +#include <malloc.h> /** * struct sandbox_store_priv - Private data structure of a AXI store device diff --git a/drivers/block/blk-uclass.c b/drivers/block/blk-uclass.c index ca8978f0e1404a437f7ed5e15a6386cf99b5aa71..7c39aa5f2f5fd99c34101a1f636e7dba95bd9d28 100644 --- a/drivers/block/blk-uclass.c +++ b/drivers/block/blk-uclass.c @@ -7,9 +7,11 @@ #include <common.h> #include <blk.h> #include <dm.h> +#include <malloc.h> #include <dm/device-internal.h> #include <dm/lists.h> #include <dm/uclass-internal.h> +#include <linux/err.h> static const char *if_typename_str[IF_TYPE_COUNT] = { [IF_TYPE_IDE] = "ide", diff --git a/drivers/block/sandbox.c b/drivers/block/sandbox.c index d3b1aaaba36d77921ad306f39e9606821ed8b92e..cca2237136a6edfa2e41b7d15da8f62a0b039235 100644 --- a/drivers/block/sandbox.c +++ b/drivers/block/sandbox.c @@ -11,6 +11,7 @@ #include <os.h> #include <malloc.h> #include <sandboxblockdev.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <dm/device-internal.h> diff --git a/drivers/clk/altera/clk-arria10.c b/drivers/clk/altera/clk-arria10.c index 179869df45f7b1407633361af964de8999f520ab..affeb31fc2e974f40e80ae8d295de408412bbe8b 100644 --- a/drivers/clk/altera/clk-arria10.c +++ b/drivers/clk/altera/clk-arria10.c @@ -4,9 +4,12 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <clk-uclass.h> #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/lists.h> #include <dm/util.h> diff --git a/drivers/clk/aspeed/clk_ast2500.c b/drivers/clk/aspeed/clk_ast2500.c index b3a3f3d4dd9f7e9541939c4ce740236a24eaf6c0..f4a441ad684a5e5830882970dcf8f35314a5205c 100644 --- a/drivers/clk/aspeed/clk_ast2500.c +++ b/drivers/clk/aspeed/clk_ast2500.c @@ -10,6 +10,7 @@ #include <asm/arch/scu_ast2500.h> #include <dm/lists.h> #include <dt-bindings/clock/ast2500-scu.h> +#include <linux/err.h> /* * MAC Clock Delay settings, taken from Aspeed SDK diff --git a/drivers/clk/at91/clk-generated.c b/drivers/clk/at91/clk-generated.c index 70b277e26f72b969fc9d8c39112d925e3934401b..a80f259a72cf26a86cbf7a7ea15d3f19f371fbbb 100644 --- a/drivers/clk/at91/clk-generated.c +++ b/drivers/clk/at91/clk-generated.c @@ -7,6 +7,8 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <malloc.h> +#include <linux/err.h> #include <linux/io.h> #include <mach/at91_pmc.h> #include "pmc.h" diff --git a/drivers/clk/at91/clk-h32mx.c b/drivers/clk/at91/clk-h32mx.c index 8f02d73d8dae0501d9204ef0cb109fbe6a42080b..86bb71f6128ba49381dfeef8b4072327c719a500 100644 --- a/drivers/clk/at91/clk-h32mx.c +++ b/drivers/clk/at91/clk-h32mx.c @@ -7,6 +7,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <dm/device_compat.h> #include <dm/util.h> #include <linux/io.h> #include <mach/at91_pmc.h> diff --git a/drivers/clk/at91/clk-peripheral.c b/drivers/clk/at91/clk-peripheral.c index c880af8155f1daf210fec67bc1a850ba3cacc3b3..c55e6214b2267abdae9a259e9526d10ef8e69c18 100644 --- a/drivers/clk/at91/clk-peripheral.c +++ b/drivers/clk/at91/clk-peripheral.c @@ -7,6 +7,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <malloc.h> #include <linux/io.h> #include <mach/at91_pmc.h> #include "pmc.h" diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c index 24af183b55066ed0722a386e92b5523349e3859a..c3cb2ba0146fff57cb06cad3588766222b14d5ca 100644 --- a/drivers/clk/at91/clk-usb.c +++ b/drivers/clk/at91/clk-usb.c @@ -7,6 +7,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm/device.h> +#include <linux/err.h> #include <linux/io.h> #include <mach/at91_pmc.h> #include "pmc.h" diff --git a/drivers/clk/clk-cdce9xx.c b/drivers/clk/clk-cdce9xx.c index 5d1489ab0ec060b4dca95281892b987be8724f52..f1f76b0a4da8061d1955804a030c2cf6ae7dd6eb 100644 --- a/drivers/clk/clk-cdce9xx.c +++ b/drivers/clk/clk-cdce9xx.c @@ -13,6 +13,7 @@ #include <errno.h> #include <clk-uclass.h> #include <i2c.h> +#include <dm/device_compat.h> #define MAX_NUMBER_OF_PLLS 4 #define MAX_NUMER_OF_OUTPUTS 9 diff --git a/drivers/clk/clk-composite.c b/drivers/clk/clk-composite.c index a5626c33d1e3e67b5f792adb36173c6ab49913ed..414185031e2b1b7801644f5847f1289d8a97eb5c 100644 --- a/drivers/clk/clk-composite.c +++ b/drivers/clk/clk-composite.c @@ -9,8 +9,10 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <clk.h> +#include <linux/err.h> #include "clk.h" diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c index 822e09b084492ee80942a3f649d4a438f6ea3d79..d79ae367b8077547d11d8fc926b2d2b969d4e1e3 100644 --- a/drivers/clk/clk-divider.c +++ b/drivers/clk/clk-divider.c @@ -14,10 +14,12 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <dm/uclass.h> #include <dm/lists.h> #include <dm/device-internal.h> #include <linux/clk-provider.h> +#include <linux/err.h> #include <linux/log2.h> #include <div64.h> #include <clk.h> diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c index 711b0588bc39fe57c35e4675913107f19ee32dc1..2ceb6bb171c00f8b2dbbd43f3de7940a1664d122 100644 --- a/drivers/clk/clk-fixed-factor.c +++ b/drivers/clk/clk-fixed-factor.c @@ -9,10 +9,12 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <div64.h> #include <clk.h> #include "clk.h" +#include <linux/err.h> #define UBOOT_DM_CLK_IMX_FIXED_FACTOR "ccf_clk_fixed_factor" diff --git a/drivers/clk/clk-gate.c b/drivers/clk/clk-gate.c index 70b879455452c3ec447794bd1fb3cecf897b5d02..6415c2f1b91dfa661ca716a74e479e5dbbdfd95a 100644 --- a/drivers/clk/clk-gate.c +++ b/drivers/clk/clk-gate.c @@ -12,9 +12,11 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <clk.h> #include "clk.h" +#include <linux/err.h> #define UBOOT_DM_CLK_GATE "clk_gate" diff --git a/drivers/clk/clk-mux.c b/drivers/clk/clk-mux.c index 5acc0b8cbd06ce4706cc59d8e758697cf0234bd0..b9d2ae6778fc0d82cefb5b0df1316a8c91b19de9 100644 --- a/drivers/clk/clk-mux.c +++ b/drivers/clk/clk-mux.c @@ -26,9 +26,11 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <clk.h> #include "clk.h" +#include <linux/err.h> #define UBOOT_DM_CLK_CCF_MUX "ccf_clk_mux" diff --git a/drivers/clk/clk-ti-sci.c b/drivers/clk/clk-ti-sci.c index ed1facbbcd7063c17371d5e73a0117edfc128137..82241d9f3f527e89ddcd1827a103bf2608829c7d 100644 --- a/drivers/clk/clk-ti-sci.c +++ b/drivers/clk/clk-ti-sci.c @@ -12,6 +12,9 @@ #include <dm.h> #include <errno.h> #include <clk-uclass.h> +#include <malloc.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/soc/ti/ti_sci_protocol.h> #include <k3-avs.h> @@ -203,7 +206,7 @@ static const struct udevice_id ti_sci_clk_of_match[] = { static struct clk_ops ti_sci_clk_ops = { .of_xlate = ti_sci_clk_of_xlate, .request = ti_sci_clk_request, - .free = ti_sci_clk_free, + .rfree = ti_sci_clk_free, .get_rate = ti_sci_clk_get_rate, .set_rate = ti_sci_clk_set_rate, .set_parent = ti_sci_clk_set_parent, diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c index 0df38bd06a497e22cc3a68250dd219b00ee8d3c3..71878474ebe1a1648fcca53dac2228611c955760 100644 --- a/drivers/clk/clk-uclass.c +++ b/drivers/clk/clk-uclass.c @@ -10,10 +10,13 @@ #include <clk.h> #include <clk-uclass.h> #include <dm.h> -#include <dm/read.h> #include <dt-structs.h> #include <errno.h> +#include <malloc.h> +#include <dm/devres.h> +#include <dm/read.h> #include <linux/clk-provider.h> +#include <linux/err.h> static inline const struct clk_ops *clk_dev_ops(struct udevice *dev) { @@ -423,10 +426,10 @@ int clk_free(struct clk *clk) return 0; ops = clk_dev_ops(clk->dev); - if (!ops->free) + if (!ops->rfree) return 0; - return ops->free(clk); + return ops->rfree(clk); } ulong clk_get_rate(struct clk *clk) diff --git a/drivers/clk/clk_fixed_factor.c b/drivers/clk/clk_fixed_factor.c index dcdb6ddf5cf898d40ffec551b0c742b55734e58e..cf9c4ae367fd25c054ab797523b7571db13e8337 100644 --- a/drivers/clk/clk_fixed_factor.c +++ b/drivers/clk/clk_fixed_factor.c @@ -9,6 +9,7 @@ #include <clk-uclass.h> #include <div64.h> #include <dm.h> +#include <linux/err.h> struct clk_fixed_factor { struct clk parent; diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c index de6b2f7c82f29f4604a455214e734b961152a428..768fbb7c52030f58e8c996ef464bdb7af03d46e6 100644 --- a/drivers/clk/clk_sandbox.c +++ b/drivers/clk/clk_sandbox.c @@ -7,6 +7,7 @@ #include <clk-uclass.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <asm/clk.h> struct sandbox_clk_priv { @@ -107,7 +108,7 @@ static struct clk_ops sandbox_clk_ops = { .enable = sandbox_clk_enable, .disable = sandbox_clk_disable, .request = sandbox_clk_request, - .free = sandbox_clk_free, + .rfree = sandbox_clk_free, }; static int sandbox_clk_probe(struct udevice *dev) diff --git a/drivers/clk/clk_sandbox_ccf.c b/drivers/clk/clk_sandbox_ccf.c index 9fa27229e18668305e41d65d7e6a8e1390f4d657..3543bea70d2b32f5b21920d57b2103a76e22377d 100644 --- a/drivers/clk/clk_sandbox_ccf.c +++ b/drivers/clk/clk_sandbox_ccf.c @@ -9,10 +9,13 @@ #include <common.h> #include <dm.h> #include <clk.h> +#include <malloc.h> #include <asm/clk.h> #include <clk-uclass.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <sandbox-clk.h> +#include <linux/err.h> /* * Sandbox implementation of CCF primitives necessary for clk-uclass testing diff --git a/drivers/clk/clk_sandbox_test.c b/drivers/clk/clk_sandbox_test.c index 41954660ea139ee7c962de70af7e4afd5fc8ad22..873383856f9233c090991393c636c25be877a6da 100644 --- a/drivers/clk/clk_sandbox_test.c +++ b/drivers/clk/clk_sandbox_test.c @@ -6,7 +6,10 @@ #include <common.h> #include <dm.h> #include <clk.h> +#include <malloc.h> #include <asm/clk.h> +#include <dm/device_compat.h> +#include <linux/err.h> struct sandbox_clk_test { struct clk clks[SANDBOX_CLK_TEST_NON_DEVM_COUNT]; diff --git a/drivers/clk/clk_versal.c b/drivers/clk/clk_versal.c index 7e97b0c4bf3a19df17ad79b01f417e1b2542ae46..9d4d2149e327fe32b37378929756662d9d416f68 100644 --- a/drivers/clk/clk_versal.c +++ b/drivers/clk/clk_versal.c @@ -5,6 +5,7 @@ */ #include <common.h> +#include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/bitfield.h> #include <malloc.h> @@ -13,6 +14,7 @@ #include <dm.h> #include <asm/arch/sys_proto.h> #include <zynqmp_firmware.h> +#include <linux/err.h> #define MAX_PARENT 100 #define MAX_NODES 6 diff --git a/drivers/clk/clk_vexpress_osc.c b/drivers/clk/clk_vexpress_osc.c index c692a6d0b89992698e5ccc98cadfa14913753111..82e589e239fe1aba952283753d5856ab118cd70f 100644 --- a/drivers/clk/clk_vexpress_osc.c +++ b/drivers/clk/clk_vexpress_osc.c @@ -8,6 +8,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <errno.h> #include <misc.h> diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c index b09c37db40f1565ab95bdf3704b739ed6183180e..4ca1cc0d52a22c7edde7b075e2dce90028a09639 100644 --- a/drivers/clk/clk_zynq.c +++ b/drivers/clk/clk_zynq.c @@ -10,6 +10,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <errno.h> #include <asm/io.h> diff --git a/drivers/clk/clk_zynqmp.c b/drivers/clk/clk_zynqmp.c index 72fc39fa47a816fb70d9b230d23f0e527e684f6f..e0eb897da892c69e94f0ef6d7726514adb08b1fc 100644 --- a/drivers/clk/clk_zynqmp.c +++ b/drivers/clk/clk_zynqmp.c @@ -6,11 +6,14 @@ */ #include <common.h> +#include <malloc.h> +#include <dm/device_compat.h> #include <linux/bitops.h> #include <clk-uclass.h> #include <clk.h> #include <asm/arch/sys_proto.h> #include <dm.h> +#include <linux/err.h> static const resource_size_t zynqmp_crf_apb_clkc_base = 0xfd1a0020; static const resource_size_t zynqmp_crl_apb_clkc_base = 0xff5e0020; diff --git a/drivers/clk/imx/clk-composite-8m.c b/drivers/clk/imx/clk-composite-8m.c index 95120d6559cd96ffcee3709d9a8d56bfef233485..3e99c528de543993e8fbbef10351817693ae86fc 100644 --- a/drivers/clk/imx/clk-composite-8m.c +++ b/drivers/clk/imx/clk-composite-8m.c @@ -8,9 +8,11 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <clk.h> #include "clk.h" +#include <linux/err.h> #define UBOOT_DM_CLK_IMX_COMPOSITE "imx_clk_composite" diff --git a/drivers/clk/imx/clk-gate2.c b/drivers/clk/imx/clk-gate2.c index 1b9db6e791f1ef9e8fff65638da1a331f008ef2c..b38890d5ba5bd6fb17d3d77e722416eb6b90dc5b 100644 --- a/drivers/clk/imx/clk-gate2.c +++ b/drivers/clk/imx/clk-gate2.c @@ -19,9 +19,11 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <clk.h> #include "clk.h" +#include <linux/err.h> #define UBOOT_DM_CLK_IMX_GATE2 "imx_clk_gate2" diff --git a/drivers/clk/imx/clk-imx8.c b/drivers/clk/imx/clk-imx8.c index a755e2650161c1e62252cb1b4d807e720df3ccea..671054d9befa9c1b56dd291e058cd6a7f8c4bf97 100644 --- a/drivers/clk/imx/clk-imx8.c +++ b/drivers/clk/imx/clk-imx8.c @@ -7,6 +7,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <malloc.h> #include <asm/arch/sci/sci.h> #include <asm/arch/clock.h> #include <dt-bindings/clock/imx8qxp-clock.h> diff --git a/drivers/clk/imx/clk-pfd.c b/drivers/clk/imx/clk-pfd.c index 4ae55f5a0777e178e3144b542b2cf2d2e4e15c8a..b8be3167c4cd9f6374df121fcf76541428bb60ed 100644 --- a/drivers/clk/imx/clk-pfd.c +++ b/drivers/clk/imx/clk-pfd.c @@ -19,10 +19,12 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> #include <div64.h> #include <clk.h> #include "clk.h" +#include <linux/err.h> #define UBOOT_DM_CLK_IMX_PFD "imx_clk_pfd" diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c index 2246beb21b2889e7d9779a2986c52035f105d79e..1673eb26b2c7e7ebea710a0f5e72e6f143dcd81a 100644 --- a/drivers/clk/imx/clk-pll14xx.c +++ b/drivers/clk/imx/clk-pll14xx.c @@ -10,7 +10,9 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <linux/clk-provider.h> +#include <linux/err.h> #include <linux/iopoll.h> #include <clk.h> #include <div64.h> diff --git a/drivers/clk/imx/clk-pllv3.c b/drivers/clk/imx/clk-pllv3.c index 0cdb9df45d997b84ac4b3a88ea8af7e52440a105..525442debf06a0d4b205af9b64fb6c7e8caf7e50 100644 --- a/drivers/clk/imx/clk-pllv3.c +++ b/drivers/clk/imx/clk-pllv3.c @@ -10,9 +10,11 @@ #include <malloc.h> #include <clk-uclass.h> #include <dm/device.h> +#include <dm/devres.h> #include <dm/uclass.h> #include <clk.h> #include "clk.h" +#include <linux/err.h> #define UBOOT_DM_CLK_IMX_PLLV3_GENERIC "imx_clk_pllv3_generic" #define UBOOT_DM_CLK_IMX_PLLV3_SYS "imx_clk_pllv3_sys" diff --git a/drivers/clk/meson/axg.c b/drivers/clk/meson/axg.c index 32cbf752aed81727564c1f28012feb35cd6d7d82..7035b59a13794a51e64c9739fa860dbec84d72df 100644 --- a/drivers/clk/meson/axg.c +++ b/drivers/clk/meson/axg.c @@ -15,6 +15,7 @@ #include <div64.h> #include <dt-bindings/clock/axg-clkc.h> #include "clk_meson.h" +#include <linux/err.h> #define XTAL_RATE 24000000 diff --git a/drivers/clk/meson/g12a.c b/drivers/clk/meson/g12a.c index 1b2523bbf1feca51f8f5a8a018e38b40b07bb793..686d94ebfe858d0f3280dbcd7e36881d945ca980 100644 --- a/drivers/clk/meson/g12a.c +++ b/drivers/clk/meson/g12a.c @@ -14,6 +14,7 @@ #include <syscon.h> #include <div64.h> #include <dt-bindings/clock/g12a-clkc.h> +#include <linux/err.h> #include <linux/kernel.h> #include "clk_meson.h" diff --git a/drivers/clk/meson/gxbb.c b/drivers/clk/meson/gxbb.c index abb5337e78295a70d9352a18e9b48f929af1df41..e781e08d9d5d92d4ec3760fbfb1bf574dd102350 100644 --- a/drivers/clk/meson/gxbb.c +++ b/drivers/clk/meson/gxbb.c @@ -15,6 +15,7 @@ #include <syscon.h> #include <dt-bindings/clock/gxbb-clkc.h> #include "clk_meson.h" +#include <linux/err.h> /* This driver support only basic clock tree operations : * - Can calculate clock frequency on a limited tree diff --git a/drivers/clk/mvebu/armada-37xx-periph.c b/drivers/clk/mvebu/armada-37xx-periph.c index b1a35968e15c72d533096db6b3c8c9e4a8b7d249..068e48ea040cc064a48289480240dd83aafed313 100644 --- a/drivers/clk/mvebu/armada-37xx-periph.c +++ b/drivers/clk/mvebu/armada-37xx-periph.c @@ -15,6 +15,7 @@ #include <dm.h> #include <asm/io.h> #include <asm/arch/cpu.h> +#include <dm/device_compat.h> #define TBG_SEL 0x0 #define DIV_SEL0 0x4 diff --git a/drivers/clk/mvebu/armada-37xx-tbg.c b/drivers/clk/mvebu/armada-37xx-tbg.c index aa7ccd690f726669266d32b88b1ffdd3dc34fa55..233926e9b6a877b2029598dff89004cb673aed43 100644 --- a/drivers/clk/mvebu/armada-37xx-tbg.c +++ b/drivers/clk/mvebu/armada-37xx-tbg.c @@ -14,6 +14,7 @@ #include <dm.h> #include <asm/io.h> #include <asm/arch/cpu.h> +#include <dm/device_compat.h> #define NUM_TBG 4 diff --git a/drivers/clk/rockchip/clk_px30.c b/drivers/clk/rockchip/clk_px30.c index 36764c128b05443eecefef7fd9ca4d4d06048924..b88534145efb0bee0210c59528277426f29ed545 100644 --- a/drivers/clk/rockchip/clk_px30.c +++ b/drivers/clk/rockchip/clk_px30.c @@ -8,6 +8,7 @@ #include <clk-uclass.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_px30.h> diff --git a/drivers/clk/rockchip/clk_rk3036.c b/drivers/clk/rockchip/clk_rk3036.c index 6d5ae3d003143be4bfe6d32bf2bd3eab4097a59e..6e085c41368719d75abe5c5b279e4466e8ce3a63 100644 --- a/drivers/clk/rockchip/clk_rk3036.c +++ b/drivers/clk/rockchip/clk_rk3036.c @@ -7,6 +7,7 @@ #include <clk-uclass.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <syscon.h> #include <asm/io.h> #include <asm/arch-rockchip/clock.h> diff --git a/drivers/clk/rockchip/clk_rk3128.c b/drivers/clk/rockchip/clk_rk3128.c index efda8c830b07fc8c754224ba85948e9ae8646157..a6f7902941a717d9065b09101fba30d8395bf0ee 100644 --- a/drivers/clk/rockchip/clk_rk3128.c +++ b/drivers/clk/rockchip/clk_rk3128.c @@ -7,6 +7,7 @@ #include <clk-uclass.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <syscon.h> #include <asm/io.h> #include <asm/arch-rockchip/clock.h> diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c index 3ea9a81b32456c1afe69344acf9c7a659610f6f2..2b82a40d2819fbe79918fcd9e0daac76b3174dcb 100644 --- a/drivers/clk/rockchip/clk_rk3188.c +++ b/drivers/clk/rockchip/clk_rk3188.c @@ -9,6 +9,7 @@ #include <dm.h> #include <dt-structs.h> #include <errno.h> +#include <malloc.h> #include <mapmem.h> #include <syscon.h> #include <asm/io.h> @@ -20,6 +21,7 @@ #include <dm/device-internal.h> #include <dm/lists.h> #include <dm/uclass-internal.h> +#include <linux/err.h> #include <linux/log2.h> enum rk3188_clk_type { diff --git a/drivers/clk/rockchip/clk_rk322x.c b/drivers/clk/rockchip/clk_rk322x.c index 6e8a164d6220594bce61f7ca3c3062275765648d..ef33adbf2941308296130b1d49e9d0a18e3c4ac9 100644 --- a/drivers/clk/rockchip/clk_rk322x.c +++ b/drivers/clk/rockchip/clk_rk322x.c @@ -7,6 +7,7 @@ #include <clk-uclass.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <syscon.h> #include <asm/io.h> #include <asm/arch-rockchip/clock.h> diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c index cc1c1e81e95c2bef07e1d0e7603c30d2430af10b..81cdb8ee9c7610f36f846b1fe356a3818c625782 100644 --- a/drivers/clk/rockchip/clk_rk3288.c +++ b/drivers/clk/rockchip/clk_rk3288.c @@ -10,6 +10,7 @@ #include <dm.h> #include <dt-structs.h> #include <errno.h> +#include <malloc.h> #include <mapmem.h> #include <syscon.h> #include <asm/io.h> @@ -21,6 +22,7 @@ #include <dm/device-internal.h> #include <dm/lists.h> #include <dm/uclass-internal.h> +#include <linux/err.h> #include <linux/log2.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/clk/rockchip/clk_rk3308.c b/drivers/clk/rockchip/clk_rk3308.c index f212c5ffc2c632a1e91462aa95103371b274db5c..c0f1285e4c707b529e7bfede18ffc41202f0c6a7 100644 --- a/drivers/clk/rockchip/clk_rk3308.c +++ b/drivers/clk/rockchip/clk_rk3308.c @@ -8,6 +8,7 @@ #include <dm.h> #include <div64.h> #include <errno.h> +#include <malloc.h> #include <syscon.h> #include <asm/io.h> #include <asm/arch/cru_rk3308.h> diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c index e700a1bc25cb0e5ed431e085b247c8b80c407f96..8e867c58dfec93a98d47fc9cff773edd1c49a7c7 100644 --- a/drivers/clk/rockchip/clk_rk3328.c +++ b/drivers/clk/rockchip/clk_rk3328.c @@ -8,6 +8,7 @@ #include <clk-uclass.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <syscon.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru_rk3328.h> diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c index b51d529adea02858e33242d1122d01533649f0c6..2cce1b967d175c4bb31534b055f918e44c8cf5cc 100644 --- a/drivers/clk/rockchip/clk_rk3368.c +++ b/drivers/clk/rockchip/clk_rk3368.c @@ -10,6 +10,7 @@ #include <dm.h> #include <dt-structs.h> #include <errno.h> +#include <malloc.h> #include <mapmem.h> #include <syscon.h> #include <bitfield.h> diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c index 37fc142a7a88a8559d63f3a52bff9d509a11b410..865b80cc0fb296aeef2ed8eb284a311ee4d4b4d2 100644 --- a/drivers/clk/rockchip/clk_rk3399.c +++ b/drivers/clk/rockchip/clk_rk3399.c @@ -9,6 +9,7 @@ #include <dm.h> #include <dt-structs.h> #include <errno.h> +#include <malloc.h> #include <mapmem.h> #include <syscon.h> #include <bitfield.h> diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c index 97fdd099ef39a04e6f151cbe63c3bdb40565ae25..da9c48b962ab636e4178b630af779437d02e60cf 100644 --- a/drivers/clk/rockchip/clk_rv1108.c +++ b/drivers/clk/rockchip/clk_rv1108.c @@ -9,6 +9,7 @@ #include <clk-uclass.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <syscon.h> #include <asm/io.h> #include <asm/arch-rockchip/clock.h> diff --git a/drivers/clk/sifive/fu540-prci.c b/drivers/clk/sifive/fu540-prci.c index ce0769f2d136d9b482069ebefeb905e06afb85a6..8847178001bdbbdd72d1a37d4d67e8d256cdd911 100644 --- a/drivers/clk/sifive/fu540-prci.c +++ b/drivers/clk/sifive/fu540-prci.c @@ -35,6 +35,7 @@ #include <div64.h> #include <dm.h> #include <errno.h> +#include <linux/err.h> #include <linux/math64.h> #include <linux/clk/analogbits-wrpll-cln28hpc.h> diff --git a/drivers/clk/tegra/tegra-car-clk.c b/drivers/clk/tegra/tegra-car-clk.c index 98be7602b3d666c9d290c7da072a6998fec9a599..6083f14e751480d2125f14091fb027cbc4f306d2 100644 --- a/drivers/clk/tegra/tegra-car-clk.c +++ b/drivers/clk/tegra/tegra-car-clk.c @@ -6,6 +6,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <malloc.h> #include <asm/arch/clock.h> #include <asm/arch-tegra/clk_rst.h> @@ -80,7 +81,7 @@ static int tegra_car_clk_disable(struct clk *clk) static struct clk_ops tegra_car_clk_ops = { .request = tegra_car_clk_request, - .free = tegra_car_clk_free, + .rfree = tegra_car_clk_free, .get_rate = tegra_car_clk_get_rate, .set_rate = tegra_car_clk_set_rate, .enable = tegra_car_clk_enable, diff --git a/drivers/clk/uniphier/clk-uniphier-core.c b/drivers/clk/uniphier/clk-uniphier-core.c index 1da63819e7db62f86b95d8ce3d4561dac8dad7bb..9f24050992566728309a7128dad1032454bd680a 100644 --- a/drivers/clk/uniphier/clk-uniphier-core.c +++ b/drivers/clk/uniphier/clk-uniphier-core.c @@ -7,6 +7,7 @@ #include <common.h> #include <clk-uclass.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/io.h> #include <linux/sizes.h> diff --git a/drivers/core/device.c b/drivers/core/device.c index 9f39218423e1e1f9b4d734d3d4a73d9f9b9ed710..89ea820d487e294cc39cdf84e2ba4d4ee8b35a33 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -591,7 +591,8 @@ static int device_find_by_ofnode(ofnode node, struct udevice **devp) } #endif -int device_get_child(struct udevice *parent, int index, struct udevice **devp) +int device_get_child(const struct udevice *parent, int index, + struct udevice **devp) { struct udevice *dev; @@ -603,7 +604,7 @@ int device_get_child(struct udevice *parent, int index, struct udevice **devp) return -ENODEV; } -int device_get_child_count(struct udevice *parent) +int device_get_child_count(const struct udevice *parent) { struct udevice *dev; int count = 0; @@ -614,7 +615,7 @@ int device_get_child_count(struct udevice *parent) return count; } -int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq, +int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq, bool find_req_seq, struct udevice **devp) { struct udevice *dev; @@ -634,7 +635,7 @@ int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq, return -ENODEV; } -int device_get_child_by_seq(struct udevice *parent, int seq, +int device_get_child_by_seq(const struct udevice *parent, int seq, struct udevice **devp) { struct udevice *dev; @@ -652,7 +653,7 @@ int device_get_child_by_seq(struct udevice *parent, int seq, return device_get_device_tail(dev, ret, devp); } -int device_find_child_by_of_offset(struct udevice *parent, int of_offset, +int device_find_child_by_of_offset(const struct udevice *parent, int of_offset, struct udevice **devp) { struct udevice *dev; @@ -669,7 +670,7 @@ int device_find_child_by_of_offset(struct udevice *parent, int of_offset, return -ENODEV; } -int device_get_child_by_of_offset(struct udevice *parent, int node, +int device_get_child_by_of_offset(const struct udevice *parent, int node, struct udevice **devp) { struct udevice *dev; @@ -712,7 +713,7 @@ int device_get_global_by_ofnode(ofnode ofnode, struct udevice **devp) return device_get_device_tail(dev, dev ? 0 : -ENOENT, devp); } -int device_find_first_child(struct udevice *parent, struct udevice **devp) +int device_find_first_child(const struct udevice *parent, struct udevice **devp) { if (list_empty(&parent->child_head)) { *devp = NULL; @@ -739,7 +740,7 @@ int device_find_next_child(struct udevice **devp) return 0; } -int device_find_first_inactive_child(struct udevice *parent, +int device_find_first_inactive_child(const struct udevice *parent, enum uclass_id uclass_id, struct udevice **devp) { @@ -757,7 +758,7 @@ int device_find_first_inactive_child(struct udevice *parent, return -ENODEV; } -int device_find_first_child_by_uclass(struct udevice *parent, +int device_find_first_child_by_uclass(const struct udevice *parent, enum uclass_id uclass_id, struct udevice **devp) { @@ -774,7 +775,7 @@ int device_find_first_child_by_uclass(struct udevice *parent, return -ENODEV; } -int device_find_child_by_name(struct udevice *parent, const char *name, +int device_find_child_by_name(const struct udevice *parent, const char *name, struct udevice **devp) { struct udevice *dev; @@ -791,6 +792,64 @@ int device_find_child_by_name(struct udevice *parent, const char *name, return -ENODEV; } +int device_first_child_err(struct udevice *parent, struct udevice **devp) +{ + struct udevice *dev; + + device_find_first_child(parent, &dev); + if (!dev) + return -ENODEV; + + return device_get_device_tail(dev, 0, devp); +} + +int device_next_child_err(struct udevice **devp) +{ + struct udevice *dev = *devp; + + device_find_next_child(&dev); + if (!dev) + return -ENODEV; + + return device_get_device_tail(dev, 0, devp); +} + +int device_first_child_ofdata_err(struct udevice *parent, struct udevice **devp) +{ + struct udevice *dev; + int ret; + + device_find_first_child(parent, &dev); + if (!dev) + return -ENODEV; + + ret = device_ofdata_to_platdata(dev); + if (ret) + return ret; + + *devp = dev; + + return 0; +} + +int device_next_child_ofdata_err(struct udevice **devp) +{ + struct udevice *dev = *devp; + int ret; + + device_find_next_child(&dev); + if (!dev) + return -ENODEV; + + ret = device_ofdata_to_platdata(dev); + if (ret) + return ret; + + *devp = dev; + + return 0; +} + struct udevice *dev_get_parent(const struct udevice *child) { return child->parent; @@ -827,7 +886,7 @@ bool device_has_children(const struct udevice *dev) return !list_empty(&dev->child_head); } -bool device_has_active_children(struct udevice *dev) +bool device_has_active_children(const struct udevice *dev) { struct udevice *child; @@ -841,7 +900,7 @@ bool device_has_active_children(struct udevice *dev) return false; } -bool device_is_last_sibling(struct udevice *dev) +bool device_is_last_sibling(const struct udevice *dev) { struct udevice *parent = dev->parent; @@ -867,7 +926,7 @@ int device_set_name(struct udevice *dev, const char *name) } #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) -bool device_is_compatible(struct udevice *dev, const char *compat) +bool device_is_compatible(const struct udevice *dev, const char *compat) { return ofnode_device_is_compatible(dev_ofnode(dev), compat); } diff --git a/drivers/core/devres.c b/drivers/core/devres.c index 237b42653c6beb51e6cdc8043a8ec0941b925f6b..457e1309c54e43fac2737a92b4c98ece84b03c75 100644 --- a/drivers/core/devres.c +++ b/drivers/core/devres.c @@ -10,10 +10,12 @@ #define LOG_CATEGORY LOGC_DEVRES #include <common.h> +#include <malloc.h> #include <linux/compat.h> #include <linux/kernel.h> #include <linux/list.h> #include <dm/device.h> +#include <dm/devres.h> #include <dm/root.h> #include <dm/util.h> diff --git a/drivers/core/dump.c b/drivers/core/dump.c index 4704049aee5e16113c7d08fdd27fdd46e547359c..e73ebeabcc9a6a8d2bb876d4b1390b8e9fc976bd 100644 --- a/drivers/core/dump.c +++ b/drivers/core/dump.c @@ -96,3 +96,22 @@ void dm_dump_uclass(void) puts("\n"); } } + +void dm_dump_drivers(void) +{ + struct driver *d = ll_entry_start(struct driver, driver); + const int n_ents = ll_entry_count(struct driver, driver); + struct driver *entry; + const struct udevice_id *match; + + puts("Driver Compatible\n"); + puts("--------------------------------\n"); + for (entry = d; entry < d + n_ents; entry++) { + for (match = entry->of_match; match->compatible; match++) + printf("%-20.20s %s\n", + match == entry->of_match ? entry->name : "", + match->compatible); + if (match == entry->of_match) + printf("%-20.20s\n", entry->name); + } +} diff --git a/drivers/core/fdtaddr.c b/drivers/core/fdtaddr.c index 575798fae93c3d97a8984c62c60493a4adfb2b07..33811e62f7a094efd935040e675ef06bd3b085f3 100644 --- a/drivers/core/fdtaddr.c +++ b/drivers/core/fdtaddr.c @@ -16,7 +16,7 @@ DECLARE_GLOBAL_DATA_PTR; -fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index) +fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index) { #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) fdt_addr_t addr; @@ -91,8 +91,8 @@ fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index) #endif } -fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index, - fdt_size_t *size) +fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index, + fdt_size_t *size) { #if CONFIG_IS_ENABLED(OF_CONTROL) /* @@ -113,7 +113,7 @@ fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index, #endif } -fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name) +fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name) { #if CONFIG_IS_ENABLED(OF_CONTROL) int index; @@ -129,8 +129,8 @@ fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name) #endif } -fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name, - fdt_size_t *size) +fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev, + const char *name, fdt_size_t *size) { #if CONFIG_IS_ENABLED(OF_CONTROL) int index; @@ -146,17 +146,17 @@ fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name, #endif } -fdt_addr_t devfdt_get_addr(struct udevice *dev) +fdt_addr_t devfdt_get_addr(const struct udevice *dev) { return devfdt_get_addr_index(dev, 0); } -void *devfdt_get_addr_ptr(struct udevice *dev) +void *devfdt_get_addr_ptr(const struct udevice *dev) { return (void *)(uintptr_t)devfdt_get_addr_index(dev, 0); } -void *devfdt_remap_addr_index(struct udevice *dev, int index) +void *devfdt_remap_addr_index(const struct udevice *dev, int index) { fdt_addr_t addr = devfdt_get_addr_index(dev, index); @@ -166,7 +166,7 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index) return map_physmem(addr, 0, MAP_NOCACHE); } -void *devfdt_remap_addr_name(struct udevice *dev, const char *name) +void *devfdt_remap_addr_name(const struct udevice *dev, const char *name) { fdt_addr_t addr = devfdt_get_addr_name(dev, name); @@ -176,12 +176,12 @@ void *devfdt_remap_addr_name(struct udevice *dev, const char *name) return map_physmem(addr, 0, MAP_NOCACHE); } -void *devfdt_remap_addr(struct udevice *dev) +void *devfdt_remap_addr(const struct udevice *dev) { return devfdt_remap_addr_index(dev, 0); } -void *devfdt_map_physmem(struct udevice *dev, unsigned long size) +void *devfdt_map_physmem(const struct udevice *dev, unsigned long size) { fdt_addr_t addr = devfdt_get_addr(dev); @@ -191,7 +191,7 @@ void *devfdt_map_physmem(struct udevice *dev, unsigned long size) return map_physmem(addr, size, MAP_NOCACHE); } -fdt_addr_t devfdt_get_addr_pci(struct udevice *dev) +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev) { ulong addr; diff --git a/drivers/core/of_access.c b/drivers/core/of_access.c index 945b81448ccef04fc9aa308695ea3f82e38d5003..acd745c1211973fd375cdb8f28461fabb63bdfdc 100644 --- a/drivers/core/of_access.c +++ b/drivers/core/of_access.c @@ -20,6 +20,7 @@ */ #include <common.h> +#include <malloc.h> #include <linux/libfdt.h> #include <dm/of_access.h> #include <linux/ctype.h> diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 8f0eab2ca6241856c0c958fe546c73b9043add29..96a5dd20bd155db3bcaecfa7f967135b254c7b3e 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -8,6 +8,7 @@ #include <dm.h> #include <fdtdec.h> #include <fdt_support.h> +#include <malloc.h> #include <linux/libfdt.h> #include <dm/of_access.h> #include <dm/of_addr.h> @@ -101,30 +102,47 @@ bool ofnode_read_bool(ofnode node, const char *propname) return prop ? true : false; } -const char *ofnode_read_string(ofnode node, const char *propname) +const void *ofnode_read_prop(ofnode node, const char *propname, int *sizep) { - const char *str = NULL; - int len = -1; + const char *val = NULL; + int len; assert(ofnode_valid(node)); debug("%s: %s: ", __func__, propname); if (ofnode_is_np(node)) { struct property *prop = of_find_property( - ofnode_to_np(node), propname, NULL); + ofnode_to_np(node), propname, &len); if (prop) { - str = prop->value; + val = prop->value; len = prop->length; } } else { - str = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), + val = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname, &len); } - if (!str) { + if (!val) { debug("<not found>\n"); + if (sizep) + *sizep = -FDT_ERR_NOTFOUND; return NULL; } + if (sizep) + *sizep = len; + + return val; +} + +const char *ofnode_read_string(ofnode node, const char *propname) +{ + const char *str; + int len; + + str = ofnode_read_prop(node, propname, &len); + if (!str) + return NULL; + if (strnlen(str, len) >= len) { debug("<invalid>\n"); return NULL; @@ -134,6 +152,16 @@ const char *ofnode_read_string(ofnode node, const char *propname) return str; } +int ofnode_read_size(ofnode node, const char *propname) +{ + int len; + + if (!ofnode_read_prop(node, propname, &len)) + return -EINVAL; + + return len; +} + ofnode ofnode_find_subnode(ofnode node, const char *subnode_name) { ofnode subnode; @@ -236,25 +264,6 @@ ofnode ofnode_get_by_phandle(uint phandle) return node; } -int ofnode_read_size(ofnode node, const char *propname) -{ - int len; - - if (ofnode_is_np(node)) { - struct property *prop = of_find_property( - ofnode_to_np(node), propname, NULL); - - if (prop) - return prop->length; - } else { - if (fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname, - &len)) - return len; - } - - return -EINVAL; -} - fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size) { int na, ns; @@ -419,20 +428,25 @@ ofnode ofnode_path(const char *path) return offset_to_ofnode(fdt_path_offset(gd->fdt_blob, path)); } -const char *ofnode_get_chosen_prop(const char *name) +const void *ofnode_read_chosen_prop(const char *propname, int *sizep) { ofnode chosen_node; chosen_node = ofnode_path("/chosen"); - return ofnode_read_string(chosen_node, name); + return ofnode_read_prop(chosen_node, propname, sizep); +} + +const char *ofnode_read_chosen_string(const char *propname) +{ + return ofnode_read_chosen_prop(propname, NULL); } ofnode ofnode_get_chosen_node(const char *name) { const char *prop; - prop = ofnode_get_chosen_prop(name); + prop = ofnode_read_chosen_prop(name, NULL); if (!prop) return ofnode_null(); diff --git a/drivers/core/read.c b/drivers/core/read.c index 9602e52d1b1d3dcd8afbe8d5ef31c9fffa044936..1f999b1b316c01fabb643c5ccfa631a50549a130 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -11,27 +11,29 @@ #include <mapmem.h> #include <dm/of_access.h> -int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp) +int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp) { return ofnode_read_u32(dev_ofnode(dev), propname, outp); } -int dev_read_u32_default(struct udevice *dev, const char *propname, int def) +int dev_read_u32_default(const struct udevice *dev, const char *propname, + int def) { return ofnode_read_u32_default(dev_ofnode(dev), propname, def); } -int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp) +int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp) { return ofnode_read_u32(dev_ofnode(dev), propname, (u32 *)outp); } -int dev_read_s32_default(struct udevice *dev, const char *propname, int def) +int dev_read_s32_default(const struct udevice *dev, const char *propname, + int def) { return ofnode_read_u32_default(dev_ofnode(dev), propname, def); } -int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp) +int dev_read_u32u(const struct udevice *dev, const char *propname, uint *outp) { u32 val; int ret; @@ -44,32 +46,33 @@ int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp) return 0; } -int dev_read_u64(struct udevice *dev, const char *propname, u64 *outp) +int dev_read_u64(const struct udevice *dev, const char *propname, u64 *outp) { return ofnode_read_u64(dev_ofnode(dev), propname, outp); } -u64 dev_read_u64_default(struct udevice *dev, const char *propname, u64 def) +u64 dev_read_u64_default(const struct udevice *dev, const char *propname, + u64 def) { return ofnode_read_u64_default(dev_ofnode(dev), propname, def); } -const char *dev_read_string(struct udevice *dev, const char *propname) +const char *dev_read_string(const struct udevice *dev, const char *propname) { return ofnode_read_string(dev_ofnode(dev), propname); } -bool dev_read_bool(struct udevice *dev, const char *propname) +bool dev_read_bool(const struct udevice *dev, const char *propname) { return ofnode_read_bool(dev_ofnode(dev), propname); } -ofnode dev_read_subnode(struct udevice *dev, const char *subnode_name) +ofnode dev_read_subnode(const struct udevice *dev, const char *subnode_name) { return ofnode_find_subnode(dev_ofnode(dev), subnode_name); } -ofnode dev_read_first_subnode(struct udevice *dev) +ofnode dev_read_first_subnode(const struct udevice *dev) { return ofnode_first_subnode(dev_ofnode(dev)); } @@ -79,12 +82,12 @@ ofnode dev_read_next_subnode(ofnode node) return ofnode_next_subnode(node); } -int dev_read_size(struct udevice *dev, const char *propname) +int dev_read_size(const struct udevice *dev, const char *propname) { return ofnode_read_size(dev_ofnode(dev), propname); } -fdt_addr_t dev_read_addr_index(struct udevice *dev, int index) +fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index) { if (ofnode_is_np(dev_ofnode(dev))) return ofnode_get_addr_index(dev_ofnode(dev), index); @@ -92,7 +95,7 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index) return devfdt_get_addr_index(dev, index); } -fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index, +fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size) { if (ofnode_is_np(dev_ofnode(dev))) @@ -101,7 +104,7 @@ fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index, return devfdt_get_addr_size_index(dev, index, size); } -void *dev_remap_addr_index(struct udevice *dev, int index) +void *dev_remap_addr_index(const struct udevice *dev, int index) { fdt_addr_t addr = dev_read_addr_index(dev, index); @@ -111,7 +114,7 @@ void *dev_remap_addr_index(struct udevice *dev, int index) return map_physmem(addr, 0, MAP_NOCACHE); } -fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name) +fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name) { int index = dev_read_stringlist_search(dev, "reg-names", name); @@ -121,7 +124,7 @@ fdt_addr_t dev_read_addr_name(struct udevice *dev, const char *name) return dev_read_addr_index(dev, index); } -fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name, +fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name, fdt_size_t *size) { int index = dev_read_stringlist_search(dev, "reg-names", name); @@ -132,7 +135,7 @@ fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name, return dev_read_addr_size_index(dev, index, size); } -void *dev_remap_addr_name(struct udevice *dev, const char *name) +void *dev_remap_addr_name(const struct udevice *dev, const char *name) { fdt_addr_t addr = dev_read_addr_name(dev, name); @@ -142,52 +145,52 @@ void *dev_remap_addr_name(struct udevice *dev, const char *name) return map_physmem(addr, 0, MAP_NOCACHE); } -fdt_addr_t dev_read_addr(struct udevice *dev) +fdt_addr_t dev_read_addr(const struct udevice *dev) { return dev_read_addr_index(dev, 0); } -void *dev_read_addr_ptr(struct udevice *dev) +void *dev_read_addr_ptr(const struct udevice *dev) { fdt_addr_t addr = dev_read_addr(dev); return (addr == FDT_ADDR_T_NONE) ? NULL : map_sysmem(addr, 0); } -void *dev_remap_addr(struct udevice *dev) +void *dev_remap_addr(const struct udevice *dev) { return dev_remap_addr_index(dev, 0); } -fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *property, +fdt_addr_t dev_read_addr_size(const struct udevice *dev, const char *property, fdt_size_t *sizep) { return ofnode_get_addr_size(dev_ofnode(dev), property, sizep); } -const char *dev_read_name(struct udevice *dev) +const char *dev_read_name(const struct udevice *dev) { return ofnode_get_name(dev_ofnode(dev)); } -int dev_read_stringlist_search(struct udevice *dev, const char *property, +int dev_read_stringlist_search(const struct udevice *dev, const char *property, const char *string) { return ofnode_stringlist_search(dev_ofnode(dev), property, string); } -int dev_read_string_index(struct udevice *dev, const char *propname, int index, - const char **outp) +int dev_read_string_index(const struct udevice *dev, const char *propname, + int index, const char **outp) { return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp); } -int dev_read_string_count(struct udevice *dev, const char *propname) +int dev_read_string_count(const struct udevice *dev, const char *propname) { return ofnode_read_string_count(dev_ofnode(dev), propname); } -int dev_read_phandle_with_args(struct udevice *dev, const char *list_name, +int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name, const char *cells_name, int cell_count, int index, struct ofnode_phandle_args *out_args) { @@ -196,34 +199,34 @@ int dev_read_phandle_with_args(struct udevice *dev, const char *list_name, out_args); } -int dev_count_phandle_with_args(struct udevice *dev, const char *list_name, - const char *cells_name) +int dev_count_phandle_with_args(const struct udevice *dev, + const char *list_name, const char *cells_name) { return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name, cells_name); } -int dev_read_addr_cells(struct udevice *dev) +int dev_read_addr_cells(const struct udevice *dev) { return ofnode_read_addr_cells(dev_ofnode(dev)); } -int dev_read_size_cells(struct udevice *dev) +int dev_read_size_cells(const struct udevice *dev) { return ofnode_read_size_cells(dev_ofnode(dev)); } -int dev_read_simple_addr_cells(struct udevice *dev) +int dev_read_simple_addr_cells(const struct udevice *dev) { return ofnode_read_simple_addr_cells(dev_ofnode(dev)); } -int dev_read_simple_size_cells(struct udevice *dev) +int dev_read_simple_size_cells(const struct udevice *dev) { return ofnode_read_simple_size_cells(dev_ofnode(dev)); } -int dev_read_phandle(struct udevice *dev) +int dev_read_phandle(const struct udevice *dev) { ofnode node = dev_ofnode(dev); @@ -233,12 +236,13 @@ int dev_read_phandle(struct udevice *dev) return fdt_get_phandle(gd->fdt_blob, ofnode_to_offset(node)); } -const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp) +const void *dev_read_prop(const struct udevice *dev, const char *propname, + int *lenp) { return ofnode_get_property(dev_ofnode(dev), propname, lenp); } -int dev_read_alias_seq(struct udevice *dev, int *devnump) +int dev_read_alias_seq(const struct udevice *dev, int *devnump) { ofnode node = dev_ofnode(dev); const char *uc_name = dev->uclass->uc_drv->name; @@ -256,19 +260,19 @@ int dev_read_alias_seq(struct udevice *dev, int *devnump) return ret; } -int dev_read_u32_array(struct udevice *dev, const char *propname, +int dev_read_u32_array(const struct udevice *dev, const char *propname, u32 *out_values, size_t sz) { return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz); } -const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname, - size_t sz) +const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev, + const char *propname, size_t sz) { return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz); } -int dev_read_enabled(struct udevice *dev) +int dev_read_enabled(const struct udevice *dev) { ofnode node = dev_ofnode(dev); @@ -279,23 +283,24 @@ int dev_read_enabled(struct udevice *dev) ofnode_to_offset(node)); } -int dev_read_resource(struct udevice *dev, uint index, struct resource *res) +int dev_read_resource(const struct udevice *dev, uint index, + struct resource *res) { return ofnode_read_resource(dev_ofnode(dev), index, res); } -int dev_read_resource_byname(struct udevice *dev, const char *name, +int dev_read_resource_byname(const struct udevice *dev, const char *name, struct resource *res) { return ofnode_read_resource_byname(dev_ofnode(dev), name, res); } -u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr) +u64 dev_translate_address(const struct udevice *dev, const fdt32_t *in_addr) { return ofnode_translate_address(dev_ofnode(dev), in_addr); } -u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr) +u64 dev_translate_dma_address(const struct udevice *dev, const fdt32_t *in_addr) { return ofnode_translate_dma_address(dev_ofnode(dev), in_addr); } @@ -308,7 +313,7 @@ int dev_read_alias_highest_id(const char *stem) return fdtdec_get_alias_highest_id(gd->fdt_blob, stem); } -fdt_addr_t dev_read_addr_pci(struct udevice *dev) +fdt_addr_t dev_read_addr_pci(const struct udevice *dev) { ulong addr; diff --git a/drivers/core/syscon-uclass.c b/drivers/core/syscon-uclass.c index b9ae82174ee357f1229d3933ee268e432e5f8ad0..15f0e42a85b45629fda20ecef539cd5e1f7ef5ec 100644 --- a/drivers/core/syscon-uclass.c +++ b/drivers/core/syscon-uclass.c @@ -10,6 +10,7 @@ #include <errno.h> #include <regmap.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <dm/root.h> #include <linux/err.h> diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 61192d8a9ff03c9c9afb3335abc6ff50320b01b3..58b19a4210910d68862911f5ddebd4bf7fc0f2f6 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -271,9 +271,6 @@ int uclass_find_device_by_name(enum uclass_id id, const char *name, return -ENODEV; } -#if !CONFIG_IS_ENABLED(OF_CONTROL) || \ - CONFIG_IS_ENABLED(OF_PLATDATA) || \ - CONFIG_IS_ENABLED(OF_PRIOR_STAGE) int uclass_find_next_free_req_seq(enum uclass_id id) { struct uclass *uc; @@ -295,7 +292,6 @@ int uclass_find_next_free_req_seq(enum uclass_id id) return max + 1; } -#endif int uclass_find_device_by_seq(enum uclass_id id, int seq_or_req_seq, bool find_req_seq, struct udevice **devp) diff --git a/drivers/ddr/altera/sdram_gen5.c b/drivers/ddr/altera/sdram_gen5.c index 3ea5a7c0c0d1a944eb4f4e9e785d1efa69609b5d..314c7aea00ef3a1774e0c02a104b50fba3c482bc 100644 --- a/drivers/ddr/altera/sdram_gen5.c +++ b/drivers/ddr/altera/sdram_gen5.c @@ -15,6 +15,7 @@ #include <asm/arch/sdram.h> #include <asm/arch/system_manager.h> #include <asm/io.h> +#include <dm/device_compat.h> #include "sequencer.h" diff --git a/drivers/ddr/altera/sdram_soc64.c b/drivers/ddr/altera/sdram_soc64.c index e0d04ccca2812a7cb25aa71dca8c0160e804e421..1f7ead0c674798ca4eb82d6e636f42a5ab3f267c 100644 --- a/drivers/ddr/altera/sdram_soc64.c +++ b/drivers/ddr/altera/sdram_soc64.c @@ -19,6 +19,7 @@ #include <asm/arch/system_manager.h> #include <asm/arch/reset_manager.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/sizes.h> #define PGTABLE_OFF 0x4000 diff --git a/drivers/dfu/dfu_mtd.c b/drivers/dfu/dfu_mtd.c index 9528a7b4eecb8a099e6b1d0325cc974780febafe..36cd4e945b2a5db57402a787cc7ab2c5b1be8839 100644 --- a/drivers/dfu/dfu_mtd.c +++ b/drivers/dfu/dfu_mtd.c @@ -11,6 +11,7 @@ #include <dfu.h> #include <mtd.h> #include <jffs2/load_kernel.h> +#include <linux/err.h> static bool mtd_is_aligned_with_block_size(struct mtd_info *mtd, u64 size) { diff --git a/drivers/dma/bcm6348-iudma.c b/drivers/dma/bcm6348-iudma.c index 96250eb5d2a09f1c2363de451e6fa9cdeb252758..d99460f2fb2bc965fb4df4915f47332f42cfaa84 100644 --- a/drivers/dma/bcm6348-iudma.c +++ b/drivers/dma/bcm6348-iudma.c @@ -20,6 +20,7 @@ #include <cpu_func.h> #include <dm.h> #include <dma-uclass.h> +#include <malloc.h> #include <memalign.h> #include <reset.h> #include <asm/io.h> diff --git a/drivers/dma/dma-uclass.c b/drivers/dma/dma-uclass.c index 5598bca21c5e64298cf5b6e5a74d989fc62e6624..9d5a7fc796c488e708cfba2f05ed74b18edf7880 100644 --- a/drivers/dma/dma-uclass.c +++ b/drivers/dma/dma-uclass.c @@ -12,6 +12,7 @@ #include <common.h> #include <cpu_func.h> #include <dm.h> +#include <malloc.h> #include <dm/read.h> #include <dma-uclass.h> #include <dt-structs.h> @@ -122,10 +123,10 @@ int dma_free(struct dma *dma) debug("%s(dma=%p)\n", __func__, dma); - if (!ops->free) + if (!ops->rfree) return 0; - return ops->free(dma); + return ops->rfree(dma); } int dma_enable(struct dma *dma) diff --git a/drivers/dma/sandbox-dma-test.c b/drivers/dma/sandbox-dma-test.c index 8fcef1863e242f45962526364045b59973db9019..234a7d2134dc34750bf01ddf3f73690550a6614b 100644 --- a/drivers/dma/sandbox-dma-test.c +++ b/drivers/dma/sandbox-dma-test.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/read.h> #include <dma-uclass.h> #include <dt-structs.h> @@ -88,7 +89,7 @@ static int sandbox_dma_request(struct dma *dma) return 0; } -static int sandbox_dma_free(struct dma *dma) +static int sandbox_dma_rfree(struct dma *dma) { struct sandbox_dma_dev *ud = dev_get_priv(dma->dev); struct sandbox_dma_chan *uc; @@ -229,7 +230,7 @@ static const struct dma_ops sandbox_dma_ops = { .transfer = sandbox_dma_transfer, .of_xlate = sandbox_dma_of_xlate, .request = sandbox_dma_request, - .free = sandbox_dma_free, + .rfree = sandbox_dma_rfree, .enable = sandbox_dma_enable, .disable = sandbox_dma_disable, .send = sandbox_dma_send, diff --git a/drivers/dma/ti/k3-udma.c b/drivers/dma/ti/k3-udma.c index 95f6b5a93a313128a8c93a293b97208ab34d0f2f..f274100f32227b6df1df2e3baae4ff218a78dc57 100644 --- a/drivers/dma/ti/k3-udma.c +++ b/drivers/dma/ti/k3-udma.c @@ -12,7 +12,8 @@ #include <malloc.h> #include <asm/dma-mapping.h> #include <dm.h> -#include <dm/device.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/read.h> #include <dm/of_access.h> #include <dma.h> @@ -20,6 +21,7 @@ #include <linux/delay.h> #include <dt-bindings/dma/k3-udma.h> #include <linux/bitmap.h> +#include <linux/err.h> #include <linux/soc/ti/k3-navss-ringacc.h> #include <linux/soc/ti/cppi5.h> #include <linux/soc/ti/ti-udma.h> @@ -1551,7 +1553,7 @@ static int udma_request(struct dma *dma) return 0; } -static int udma_free(struct dma *dma) +static int udma_rfree(struct dma *dma) { struct udma_dev *ud = dev_get_priv(dma->dev); struct udma_chan *uc; @@ -1846,7 +1848,7 @@ static const struct dma_ops udma_ops = { .transfer = udma_transfer, .of_xlate = udma_of_xlate, .request = udma_request, - .free = udma_free, + .rfree = udma_rfree, .enable = udma_enable, .disable = udma_disable, .send = udma_send, diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c index 62b1dc2006403b337b577de8916821f99d195503..99b2e5dfed41ef03c74b49a42ff5fc1fc835e299 100644 --- a/drivers/firmware/ti_sci.c +++ b/drivers/firmware/ti_sci.c @@ -11,7 +11,10 @@ #include <dm.h> #include <errno.h> #include <mailbox.h> +#include <malloc.h> #include <dm/device.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/compat.h> #include <linux/err.h> #include <linux/soc/ti/k3-sec-proxy.h> diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c index 7e8bd7eae881d23c641eb1869b099db19c82f652..0917871d49b8c6319d867a53da52136c6f70d805 100644 --- a/drivers/fpga/fpga.c +++ b/drivers/fpga/fpga.c @@ -9,6 +9,7 @@ #include <xilinx.h> /* xilinx specific definitions */ #include <altera.h> /* altera specific definitions */ #include <lattice.h> +#include <dm/device_compat.h> /* Local definitions */ #ifndef CONFIG_MAX_FPGA_DEVICES diff --git a/drivers/gpio/74x164_gpio.c b/drivers/gpio/74x164_gpio.c index dcb1c1b3699770f5404fc64c7c2f9c8f6b14d2fb..64717a6780e066d6ce5a3dfae9e7a40671142a76 100644 --- a/drivers/gpio/74x164_gpio.c +++ b/drivers/gpio/74x164_gpio.c @@ -15,6 +15,7 @@ #include <malloc.h> #include <asm/gpio.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <dt-bindings/gpio/gpio.h> #include <spi.h> diff --git a/drivers/gpio/adi_gpio2.c b/drivers/gpio/adi_gpio2.c index 1012f2d8eb8d2093621976ed91c9b8dab3432f58..9d293b6994ddbfd0e7d851d7505217e6b0320cd8 100644 --- a/drivers/gpio/adi_gpio2.c +++ b/drivers/gpio/adi_gpio2.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <malloc.h> #include <linux/errno.h> #include <asm/gpio.h> diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 5ea3e77b2d14783bffa3d65cf4e6b0c3e6baa495..3621cf240888a0e550a873b7b10377d7a27f4637 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -11,6 +11,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <asm/io.h> #include <linux/sizes.h> #include <asm/gpio.h> diff --git a/drivers/gpio/atmel_pio4.c b/drivers/gpio/atmel_pio4.c index 8e6f32de1f3b9fa31fda819cf5e97a89006868be..a3f5e7a2e0a0481bc34501cc8ce27854376974a4 100644 --- a/drivers/gpio/atmel_pio4.c +++ b/drivers/gpio/atmel_pio4.c @@ -9,6 +9,7 @@ #include <clk.h> #include <dm.h> #include <fdtdec.h> +#include <malloc.h> #include <asm/arch/hardware.h> #include <asm/gpio.h> #include <mach/gpio.h> diff --git a/drivers/gpio/da8xx_gpio.c b/drivers/gpio/da8xx_gpio.c index ac88f0ca8d8e195fbb92cf0f4d7830b240045987..0d0e9d22549de90a5d04f8ba41aeaf2ad422d57e 100644 --- a/drivers/gpio/da8xx_gpio.c +++ b/drivers/gpio/da8xx_gpio.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> #include <fdtdec.h> +#include <malloc.h> #include <asm/io.h> #include <asm/gpio.h> #include <dt-bindings/gpio/gpio.h> diff --git a/drivers/gpio/dwapb_gpio.c b/drivers/gpio/dwapb_gpio.c index 2eb1547b4f36de3f41f24218484c034b720076da..e3439eebb5b689f8cffdbd40124a39ab4547e91c 100644 --- a/drivers/gpio/dwapb_gpio.c +++ b/drivers/gpio/dwapb_gpio.c @@ -12,6 +12,8 @@ #include <asm/io.h> #include <dm.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/lists.h> #include <dm/root.h> #include <errno.h> diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 594e0a470a99c92f9b912e61a4dd6e591337d917..9dc4cd6042271263f98c421e6b39268ec8573b4e 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -6,6 +6,8 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> +#include <dm/device_compat.h> #include <dm/pinctrl.h> #include <errno.h> #include <asm/gpio.h> @@ -128,7 +130,7 @@ static int rcar_gpio_free(struct udevice *dev, unsigned offset) static const struct dm_gpio_ops rcar_gpio_ops = { .request = rcar_gpio_request, - .free = rcar_gpio_free, + .rfree = rcar_gpio_free, .direction_input = rcar_gpio_direction_input, .direction_output = rcar_gpio_direction_output, .get_value = rcar_gpio_get_value, diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 90fbed455b8da8269f49a3062032e199dab2beb7..0a22441d38a4eeb99818b45ba80dbc2430809386 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -364,8 +364,8 @@ int _dm_gpio_free(struct udevice *dev, uint offset) uc_priv = dev_get_uclass_priv(dev); if (!uc_priv->name[offset]) return -ENXIO; - if (gpio_get_ops(dev)->free) { - ret = gpio_get_ops(dev)->free(dev, offset); + if (gpio_get_ops(dev)->rfree) { + ret = gpio_get_ops(dev)->rfree(dev, offset); if (ret) return ret; } @@ -1043,8 +1043,8 @@ static int gpio_post_bind(struct udevice *dev) if (!reloc_done) { if (ops->request) ops->request += gd->reloc_off; - if (ops->free) - ops->free += gd->reloc_off; + if (ops->rfree) + ops->rfree += gd->reloc_off; if (ops->direction_input) ops->direction_input += gd->reloc_off; if (ops->direction_output) diff --git a/drivers/gpio/kona_gpio.c b/drivers/gpio/kona_gpio.c index 912a4cac59bad02e25b687ab9479a09933371f25..29791882a340fb0af6c9676b3ebd45abd2abfb47 100644 --- a/drivers/gpio/kona_gpio.c +++ b/drivers/gpio/kona_gpio.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <asm/arch/sysmap.h> diff --git a/drivers/gpio/mpc83xx_gpio.c b/drivers/gpio/mpc83xx_gpio.c index dcd78e7e88e5356bb6a5ee8bc02de5ce692a93dd..276a3b350dc2393263a51ec529c225892f7bf0f1 100644 --- a/drivers/gpio/mpc83xx_gpio.c +++ b/drivers/gpio/mpc83xx_gpio.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <malloc.h> #include <mpc83xx.h> #include <asm/gpio.h> #include <asm/io.h> diff --git a/drivers/gpio/mscc_sgpio.c b/drivers/gpio/mscc_sgpio.c index c899454ec41e8a1080cfbd5c7dea68e9d5060227..c65ca8172814f9ff28462ef5f48ebb37b1ddc8dd 100644 --- a/drivers/gpio/mscc_sgpio.c +++ b/drivers/gpio/mscc_sgpio.c @@ -13,6 +13,8 @@ #include <asm/io.h> #include <errno.h> #include <clk.h> +#include <dm/device_compat.h> +#include <linux/err.h> #define MSCC_SGPIOS_PER_BANK 32 #define MSCC_SGPIO_BANK_DEPTH 4 diff --git a/drivers/gpio/mvgpio.c b/drivers/gpio/mvgpio.c index ea2f689d60ef334029180e50d5eee4152efb3b14..12e7197daf7bba0ffe541f3f8a11a9115dbc10bd 100644 --- a/drivers/gpio/mvgpio.c +++ b/drivers/gpio/mvgpio.c @@ -9,6 +9,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <linux/errno.h> #include "mvgpio.h" diff --git a/drivers/gpio/mxs_gpio.c b/drivers/gpio/mxs_gpio.c index 77778e9ce57fa51a45e6dce684b6d5c40dfb15c9..405e9ac135be707b6359216b3f9dd76989dbe4b8 100644 --- a/drivers/gpio/mxs_gpio.c +++ b/drivers/gpio/mxs_gpio.c @@ -7,6 +7,7 @@ */ #include <common.h> +#include <malloc.h> #include <linux/errno.h> #include <asm/io.h> #include <asm/arch/iomux.h> diff --git a/drivers/gpio/pca953x_gpio.c b/drivers/gpio/pca953x_gpio.c index 5c2944067bc15374519e7ec5f7c87a167460f27f..d06b834a3bcb41a9249ff13d3c40490e825206fd 100644 --- a/drivers/gpio/pca953x_gpio.c +++ b/drivers/gpio/pca953x_gpio.c @@ -26,6 +26,7 @@ #include <malloc.h> #include <asm/gpio.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <dt-bindings/gpio/gpio.h> #define PCA953X_INPUT 0 diff --git a/drivers/gpio/pca9698.c b/drivers/gpio/pca9698.c index ab0c4c1b971f9d673e345603a7641673ac72b7ae..11274c781017a0ca1cc6180e142931575d8b9d67 100644 --- a/drivers/gpio/pca9698.c +++ b/drivers/gpio/pca9698.c @@ -10,6 +10,7 @@ #include <common.h> #include <i2c.h> +#include <malloc.h> #include <linux/errno.h> #include <pca9698.h> diff --git a/drivers/gpio/sh_pfc.c b/drivers/gpio/sh_pfc.c index ad8da9ef284a6cb808c9732c10c3e3be7fcfce7b..6320a6280d56d775549e21939c63c100e83ab763 100644 --- a/drivers/gpio/sh_pfc.c +++ b/drivers/gpio/sh_pfc.c @@ -10,6 +10,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/bitops.h> #include <asm/io.h> #include <sh_pfc.h> diff --git a/drivers/gpio/spear_gpio.c b/drivers/gpio/spear_gpio.c index 525aa3b9ac577b8745eefdfa6d67e2920baa04f1..4e4cd125457dcb930a346d9f59d2b3c10173f33e 100644 --- a/drivers/gpio/spear_gpio.c +++ b/drivers/gpio/spear_gpio.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/arch/hardware.h> #include <asm/gpio.h> #include <asm/io.h> diff --git a/drivers/gpio/stm32_gpio.c b/drivers/gpio/stm32_gpio.c index 302a4349477a080b51e3fcf1b6a2bcf1b373fba4..f55f834e7d667dcbd98665137a3c95eff5b51cc3 100644 --- a/drivers/gpio/stm32_gpio.c +++ b/drivers/gpio/stm32_gpio.c @@ -12,6 +12,7 @@ #include <asm/arch/stm32.h> #include <asm/gpio.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <linux/io.h> diff --git a/drivers/hwspinlock/hwspinlock-uclass.c b/drivers/hwspinlock/hwspinlock-uclass.c index 195f079707cd646a7f9707ca8ece3e0f3aa85b66..61d226bcbb5eb79e6cdedea5253b7dc81317726c 100644 --- a/drivers/hwspinlock/hwspinlock-uclass.c +++ b/drivers/hwspinlock/hwspinlock-uclass.c @@ -8,6 +8,8 @@ #include <errno.h> #include <hwspinlock.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> +#include <linux/compat.h> static inline const struct hwspinlock_ops * hwspinlock_dev_ops(struct udevice *dev) diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c index a32bde4906ddfb14170cce71365a90b1b266a5d6..74afb4aec22b8812e951aecb399c22e5c94903e9 100644 --- a/drivers/hwspinlock/stm32_hwspinlock.c +++ b/drivers/hwspinlock/stm32_hwspinlock.c @@ -7,6 +7,7 @@ #include <clk.h> #include <dm.h> #include <hwspinlock.h> +#include <malloc.h> #include <asm/io.h> #define STM32_MUTEX_COREID BIT(8) diff --git a/drivers/i2c/ast_i2c.c b/drivers/i2c/ast_i2c.c index 35dc234160d9acd2bcd61667894357633582f05d..c84d75ac922fa1e2ad45062d6e3e46297018bdf6 100644 --- a/drivers/i2c/ast_i2c.c +++ b/drivers/i2c/ast_i2c.c @@ -13,6 +13,7 @@ #include <i2c.h> #include <asm/io.h> #include <asm/arch/scu_ast2500.h> +#include <linux/err.h> #include "ast_i2c.h" diff --git a/drivers/i2c/at91_i2c.c b/drivers/i2c/at91_i2c.c index 846b3d5320b7786e9d5770b1501425e9e95d3f47..c817ed6bf9597e343d4c2b308d7f375240241941 100644 --- a/drivers/i2c/at91_i2c.c +++ b/drivers/i2c/at91_i2c.c @@ -5,6 +5,7 @@ * (C) Copyright 2016 Songjun Wu <songjun.wu@atmel.com> */ +#include <malloc.h> #include <asm/io.h> #include <common.h> #include <clk.h> diff --git a/drivers/i2c/designware_i2c.c b/drivers/i2c/designware_i2c.c index c8c5d2c331026e18308a6ef192e96320e44ba2be..e1d5aeb19db9e670219053bd021269aa7e2ec43d 100644 --- a/drivers/i2c/designware_i2c.c +++ b/drivers/i2c/designware_i2c.c @@ -8,10 +8,13 @@ #include <clk.h> #include <dm.h> #include <i2c.h> +#include <malloc.h> #include <pci.h> #include <reset.h> #include <asm/io.h> #include "designware_i2c.h" +#include <dm/device_compat.h> +#include <linux/err.h> #ifdef CONFIG_SYS_I2C_DW_ENABLE_STATUS_UNSUPPORTED static int dw_i2c_enable(struct i2c_regs *i2c_base, bool enable) diff --git a/drivers/i2c/i2c-uniphier-f.c b/drivers/i2c/i2c-uniphier-f.c index 62acd28e1bc0c2db4cb6bc86cf89b16e04d0fcd3..d8b4a683bcedebb945d95e4e87a119d3ebabaa35 100644 --- a/drivers/i2c/i2c-uniphier-f.c +++ b/drivers/i2c/i2c-uniphier-f.c @@ -5,6 +5,7 @@ * Author: Masahiro Yamada <yamada.masahiro@socionext.com> */ +#include <dm/device_compat.h> #include <linux/errno.h> #include <linux/io.h> #include <linux/iopoll.h> diff --git a/drivers/i2c/i2c-uniphier.c b/drivers/i2c/i2c-uniphier.c index 07a7e03033d9cbe5432c61cd2ab554716154f99a..f06523ab99b2fa6ea826e6521e7fa952c45ace73 100644 --- a/drivers/i2c/i2c-uniphier.c +++ b/drivers/i2c/i2c-uniphier.c @@ -5,6 +5,7 @@ * Author: Masahiro Yamada <yamada.masahiro@socionext.com> */ +#include <dm/device_compat.h> #include <linux/delay.h> #include <linux/errno.h> #include <linux/io.h> diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c index c9d3faa9119f30fad2cf5b65dfa6183eb188deb3..62e68046d6c7c35bf4fb5c92e78d5853d4e528c9 100644 --- a/drivers/i2c/imx_lpi2c.c +++ b/drivers/i2c/imx_lpi2c.c @@ -13,6 +13,7 @@ #include <dm.h> #include <fdtdec.h> #include <i2c.h> +#include <dm/device_compat.h> #define LPI2C_FIFO_SIZE 4 #define LPI2C_NACK_TOUT_MS 1 diff --git a/drivers/i2c/meson_i2c.c b/drivers/i2c/meson_i2c.c index ee59bac123628c6e2cb21a7a62d0d368d3791264..bcf45160d8d8f327e408b9d0f64cd6e1e41db35c 100644 --- a/drivers/i2c/meson_i2c.c +++ b/drivers/i2c/meson_i2c.c @@ -7,6 +7,7 @@ #include <clk.h> #include <dm.h> #include <i2c.h> +#include <linux/err.h> #define I2C_TIMEOUT_MS 100 diff --git a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c index 413aaa6ba314d73a44295531c95593fabf7ca189..5029c71adc78c74ce6f79b9993ebda8dfcd16783 100644 --- a/drivers/i2c/muxes/i2c-arb-gpio-challenge.c +++ b/drivers/i2c/muxes/i2c-arb-gpio-challenge.c @@ -8,6 +8,7 @@ #include <dm.h> #include <errno.h> #include <i2c.h> +#include <malloc.h> #include <asm/gpio.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/i2c/muxes/i2c-mux-gpio.c b/drivers/i2c/muxes/i2c-mux-gpio.c index e8b124f4f5fc972d8a4898238a2014ebe89d7ba6..0575bd8937f016e71bed4543ef44e74e34106f9c 100644 --- a/drivers/i2c/muxes/i2c-mux-gpio.c +++ b/drivers/i2c/muxes/i2c-mux-gpio.c @@ -11,6 +11,8 @@ #include <asm-generic/gpio.h> #include <common.h> #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/pinctrl.h> #include <fdtdec.h> #include <i2c.h> diff --git a/drivers/i2c/muxes/i2c-mux-uclass.c b/drivers/i2c/muxes/i2c-mux-uclass.c index 8b1149997a19d67dab33d603233e2158b1bd3b7d..9a3dd7ec4a94659b71ff268b981efce56f9639cb 100644 --- a/drivers/i2c/muxes/i2c-mux-uclass.c +++ b/drivers/i2c/muxes/i2c-mux-uclass.c @@ -8,6 +8,7 @@ #include <dm.h> #include <errno.h> #include <i2c.h> +#include <malloc.h> #include <dm/lists.h> #include <dm/root.h> diff --git a/drivers/i2c/muxes/pca954x.c b/drivers/i2c/muxes/pca954x.c index bb2935f8ec084893860e2f8fb4a2f2e7d3811204..be90a7b24a8e82ef7ad41549886568eaf7633acb 100644 --- a/drivers/i2c/muxes/pca954x.c +++ b/drivers/i2c/muxes/pca954x.c @@ -9,6 +9,7 @@ #include <dm.h> #include <errno.h> #include <i2c.h> +#include <malloc.h> #include <asm-generic/gpio.h> diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 6b7ce985b3aaa4a6754da4295bed6f14cf21bb6f..a03c465c8f3ff75393eeab7bb3e2de1de2290f1c 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -16,6 +16,7 @@ #include <common.h> #include <asm/arch/clock.h> #include <asm/arch/imx-regs.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <asm/mach-imx/mxc_i2c.h> #include <asm/io.h> diff --git a/drivers/i2c/rcar_i2c.c b/drivers/i2c/rcar_i2c.c index 05d0dc601210ebf788569f701db9a9f82443cbb5..b877602aab6f9ecb78fdb20b5b99fade649b4513 100644 --- a/drivers/i2c/rcar_i2c.c +++ b/drivers/i2c/rcar_i2c.c @@ -17,6 +17,7 @@ #include <i2c.h> #include <asm/io.h> #include <wait_bit.h> +#include <dm/device_compat.h> #define RCAR_I2C_ICSCR 0x00 /* slave ctrl */ #define RCAR_I2C_ICMCR 0x04 /* master ctrl */ diff --git a/drivers/i2c/stm32f7_i2c.c b/drivers/i2c/stm32f7_i2c.c index 21dfa5023bdf94428c67d82cab2f4467c6c39fed..7d046c1a1e62a5bedb091d08b080e810c8bfdebf 100644 --- a/drivers/i2c/stm32f7_i2c.c +++ b/drivers/i2c/stm32f7_i2c.c @@ -7,6 +7,7 @@ #include <clk.h> #include <dm.h> #include <i2c.h> +#include <malloc.h> #include <reset.h> #include <dm/device.h> diff --git a/drivers/i2c/tegra_i2c.c b/drivers/i2c/tegra_i2c.c index 142463ef4405feb922f71dcb761c0e8e7c548ced..66a0148254c215d4157c9ff41b6f932bcdb6e3a3 100644 --- a/drivers/i2c/tegra_i2c.c +++ b/drivers/i2c/tegra_i2c.c @@ -18,6 +18,7 @@ #endif #include <asm/arch/gpio.h> #include <asm/arch-tegra/tegra_i2c.h> +#include <linux/err.h> enum i2c_type { TYPE_114, diff --git a/drivers/i2c/xilinx_xiic.c b/drivers/i2c/xilinx_xiic.c index 5ce0f869c70631e6a34389fbea2755abdc57b8be..149bd327bdfe7ab42d4513de69adb33c8aa80013 100644 --- a/drivers/i2c/xilinx_xiic.c +++ b/drivers/i2c/xilinx_xiic.c @@ -15,6 +15,7 @@ #include <i2c.h> #include <wait_bit.h> #include <asm/io.h> +#include <dm/device_compat.h> struct xilinx_xiic_priv { void __iomem *base; diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c index 93f6b913c6477de33a82387f8c24c95bd2faa53f..af6b8245c97d591b244a43aefccf45281f754199 100644 --- a/drivers/led/led_gpio.c +++ b/drivers/led/led_gpio.c @@ -8,6 +8,7 @@ #include <dm.h> #include <errno.h> #include <led.h> +#include <malloc.h> #include <asm/gpio.h> #include <dm/lists.h> diff --git a/drivers/mailbox/k3-sec-proxy.c b/drivers/mailbox/k3-sec-proxy.c index b07b56cf97b9ebd539dc8a3a26af36e9bb6117c3..a560209f035f264c26269bc3a3880c89f66e6dfd 100644 --- a/drivers/mailbox/k3-sec-proxy.c +++ b/drivers/mailbox/k3-sec-proxy.c @@ -7,7 +7,9 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/types.h> #include <linux/bitops.h> #include <linux/soc/ti/k3-sec-proxy.h> @@ -291,7 +293,7 @@ static int k3_sec_proxy_recv(struct mbox_chan *chan, void *data) struct mbox_ops k3_sec_proxy_mbox_ops = { .of_xlate = k3_sec_proxy_of_xlate, .request = k3_sec_proxy_request, - .free = k3_sec_proxy_free, + .rfree = k3_sec_proxy_free, .send = k3_sec_proxy_send, .recv = k3_sec_proxy_recv, }; diff --git a/drivers/mailbox/mailbox-uclass.c b/drivers/mailbox/mailbox-uclass.c index 5968c9b7eb67505fbae7c2f03edeab989d084c98..291f5c218e536166936c4f99fc00cc17ecbe51b6 100644 --- a/drivers/mailbox/mailbox-uclass.c +++ b/drivers/mailbox/mailbox-uclass.c @@ -7,6 +7,7 @@ #include <dm.h> #include <mailbox.h> #include <mailbox-uclass.h> +#include <malloc.h> #include <time.h> static inline struct mbox_ops *mbox_dev_ops(struct udevice *dev) @@ -105,8 +106,8 @@ int mbox_free(struct mbox_chan *chan) debug("%s(chan=%p)\n", __func__, chan); - if (ops->free) - return ops->free(chan); + if (ops->rfree) + return ops->rfree(chan); return 0; } diff --git a/drivers/mailbox/sandbox-mbox-test.c b/drivers/mailbox/sandbox-mbox-test.c index ba1bb1cf957bd0245b4aef80b5cd01228b86d9ee..faca8fcc441c97c1c6718117c96b13812e134ca9 100644 --- a/drivers/mailbox/sandbox-mbox-test.c +++ b/drivers/mailbox/sandbox-mbox-test.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <mailbox.h> +#include <malloc.h> #include <asm/io.h> struct sandbox_mbox_test { diff --git a/drivers/mailbox/sandbox-mbox.c b/drivers/mailbox/sandbox-mbox.c index bc917b3de49413b0228a6c280b29d18b1d75b36b..25e23eb05b765f4fa0ae28b607679a7da99f7f04 100644 --- a/drivers/mailbox/sandbox-mbox.c +++ b/drivers/mailbox/sandbox-mbox.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <mailbox-uclass.h> +#include <malloc.h> #include <asm/io.h> #include <asm/mbox.h> @@ -87,7 +88,7 @@ static const struct udevice_id sandbox_mbox_ids[] = { struct mbox_ops sandbox_mbox_mbox_ops = { .request = sandbox_mbox_request, - .free = sandbox_mbox_free, + .rfree = sandbox_mbox_free, .send = sandbox_mbox_send, .recv = sandbox_mbox_recv, }; diff --git a/drivers/mailbox/stm32-ipcc.c b/drivers/mailbox/stm32-ipcc.c index c3df9678a7472fb516249712f7cf79ad5465a67b..13e642ab70347419be385f0b7b74741f399549a8 100644 --- a/drivers/mailbox/stm32-ipcc.c +++ b/drivers/mailbox/stm32-ipcc.c @@ -7,7 +7,9 @@ #include <clk.h> #include <dm.h> #include <mailbox-uclass.h> +#include <malloc.h> #include <asm/io.h> +#include <dm/device_compat.h> /* * IPCC has one set of registers per CPU @@ -152,7 +154,7 @@ static const struct udevice_id stm32_ipcc_ids[] = { struct mbox_ops stm32_ipcc_mbox_ops = { .request = stm32_ipcc_request, - .free = stm32_ipcc_free, + .rfree = stm32_ipcc_free, .send = stm32_ipcc_send, .recv = stm32_ipcc_recv, }; diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c index 9bee886561c5296cdd8a226ef7d6e1478db0c9bd..60f6a38321e1ce364b825b0680715312019b1db9 100644 --- a/drivers/mailbox/tegra-hsp.c +++ b/drivers/mailbox/tegra-hsp.c @@ -4,6 +4,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <dm.h> #include <mailbox-uclass.h> @@ -175,7 +176,7 @@ static const struct udevice_id tegra_hsp_ids[] = { struct mbox_ops tegra_hsp_mbox_ops = { .of_xlate = tegra_hsp_of_xlate, .request = tegra_hsp_request, - .free = tegra_hsp_free, + .rfree = tegra_hsp_free, .send = tegra_hsp_send, .recv = tegra_hsp_recv, }; diff --git a/drivers/mailbox/zynqmp-ipi.c b/drivers/mailbox/zynqmp-ipi.c index c181a7b817682c597f79ed62c112a9e845a0ea91..17b46545f5f9d7df46fdde18c33bbed4d5238c43 100644 --- a/drivers/mailbox/zynqmp-ipi.c +++ b/drivers/mailbox/zynqmp-ipi.c @@ -9,6 +9,7 @@ #include <asm/io.h> #include <dm.h> #include <mailbox-uclass.h> +#include <dm/device_compat.h> #include <mach/sys_proto.h> #include <linux/ioport.h> #include <linux/io.h> diff --git a/drivers/misc/cros_ec_sandbox.c b/drivers/misc/cros_ec_sandbox.c index 4fcb2d96f513e924a0612fea1cd213d6644bf11d..9dd6a18b2b5cc465b5e7976e0c97a25f44c16e5b 100644 --- a/drivers/misc/cros_ec_sandbox.c +++ b/drivers/misc/cros_ec_sandbox.c @@ -11,10 +11,10 @@ #include <ec_commands.h> #include <errno.h> #include <hash.h> -#include <malloc.h> #include <os.h> #include <u-boot/sha256.h> #include <spi.h> +#include <asm/malloc.h> #include <asm/state.h> #include <asm/sdl.h> #include <linux/input.h> @@ -115,7 +115,7 @@ static int cros_ec_read_state(const void *blob, int node) prop = fdt_getprop(blob, node, "flash-data", &len); if (prop) { ec->flash_data_len = len; - ec->flash_data = os_malloc(len); + ec->flash_data = malloc(len); if (!ec->flash_data) return -ENOMEM; memcpy(ec->flash_data, prop, len); @@ -545,14 +545,14 @@ int cros_ec_probe(struct udevice *dev) ec->flash_data_len != ec->ec_config.flash.length) { printf("EC data length is %x, expected %x, discarding data\n", ec->flash_data_len, ec->ec_config.flash.length); - os_free(ec->flash_data); + free(ec->flash_data); ec->flash_data = NULL; } /* Otherwise allocate the memory */ if (!ec->flash_data) { ec->flash_data_len = ec->ec_config.flash.length; - ec->flash_data = os_malloc(ec->flash_data_len); + ec->flash_data = malloc(ec->flash_data_len); if (!ec->flash_data) return -ENOMEM; } diff --git a/drivers/misc/imx8/scu_api.c b/drivers/misc/imx8/scu_api.c index b34191753b1becccc95dc9fd0e009fc2f9025757..3ad21c1ea0a4a4a9c518206caffb7f766e7e23d2 100644 --- a/drivers/misc/imx8/scu_api.c +++ b/drivers/misc/imx8/scu_api.c @@ -7,6 +7,7 @@ #include <common.h> #include <hang.h> +#include <malloc.h> #include <asm/io.h> #include <dm.h> #include <asm/arch/sci/sci.h> diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c index c19c3c0646b793018a4c943abd4ddcaef8eb89c2..47e42738e04764a093e5344c471f5ccafb01be74 100644 --- a/drivers/misc/k3_avs.c +++ b/drivers/misc/k3_avs.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <i2c.h> #include <k3-avs.h> +#include <dm/device_compat.h> #include <power/regulator.h> #define AM6_VTM_DEVINFO(i) (priv->base + 0x100 + 0x20 * (i)) diff --git a/drivers/misc/microchip_flexcom.c b/drivers/misc/microchip_flexcom.c index 1bc19edfcbac2bd7a186cea854da0e53a1625335..4cff160d8876a3298555e0d9993b77bd457bc765 100644 --- a/drivers/misc/microchip_flexcom.c +++ b/drivers/misc/microchip_flexcom.c @@ -9,6 +9,7 @@ #include <errno.h> #include <misc.h> #include <asm/io.h> +#include <linux/err.h> struct microchip_flexcom_regs { u32 cr; diff --git a/drivers/misc/p2sb-uclass.c b/drivers/misc/p2sb-uclass.c index a198700b5f5391447deca81d68ad98edef6c4aae..9fe0aca34264e373fee0bc5aa52a8e3a971d89d4 100644 --- a/drivers/misc/p2sb-uclass.c +++ b/drivers/misc/p2sb-uclass.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <mapmem.h> #include <p2sb.h> #include <spl.h> diff --git a/drivers/misc/p2sb_emul.c b/drivers/misc/p2sb_emul.c index c3795c59c0881344b501c2f558842c8c664f4bc1..a6ee9a235e3b0a46ca6b4cebb55a6dc7013163fd 100644 --- a/drivers/misc/p2sb_emul.c +++ b/drivers/misc/p2sb_emul.c @@ -48,8 +48,9 @@ struct p2sb_emul_priv { u8 regs[16]; }; -static int sandbox_p2sb_emul_read_config(struct udevice *emul, uint offset, - ulong *valuep, enum pci_size_t size) +static int sandbox_p2sb_emul_read_config(const struct udevice *emul, + uint offset, ulong *valuep, + enum pci_size_t size) { struct p2sb_emul_platdata *plat = dev_get_platdata(emul); diff --git a/drivers/misc/stm32_rcc.c b/drivers/misc/stm32_rcc.c index e7efcdeafa3434c2ebebb39337a09e78ce6cf4c9..980b84453e1973efed2cea8778f2528fc81d26f4 100644 --- a/drivers/misc/stm32_rcc.c +++ b/drivers/misc/stm32_rcc.c @@ -9,6 +9,7 @@ #include <misc.h> #include <stm32_rcc.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> struct stm32_rcc_clk stm32_rcc_clk_f42x = { diff --git a/drivers/misc/swap_case.c b/drivers/misc/swap_case.c index 11189d16c83ae87fa5227d3b198368db8e288048..97e2afa67650547dba8109369f1ec31747d60892 100644 --- a/drivers/misc/swap_case.c +++ b/drivers/misc/swap_case.c @@ -51,7 +51,7 @@ struct swap_case_priv { char mem_text[MEM_TEXT_SIZE]; }; -static int sandbox_swap_case_use_ea(struct udevice *dev) +static int sandbox_swap_case_use_ea(const struct udevice *dev) { return !!ofnode_get_property(dev->node, "use-ea", NULL); } @@ -82,7 +82,7 @@ static const u32 ea_regs[] = { PCI_CAP_EA_SIZE_HI, }; -static int sandbox_swap_case_read_ea(struct udevice *emul, uint offset, +static int sandbox_swap_case_read_ea(const struct udevice *emul, uint offset, ulong *valuep, enum pci_size_t size) { u32 reg; @@ -95,8 +95,9 @@ static int sandbox_swap_case_read_ea(struct udevice *emul, uint offset, return 0; } -static int sandbox_swap_case_read_config(struct udevice *emul, uint offset, - ulong *valuep, enum pci_size_t size) +static int sandbox_swap_case_read_config(const struct udevice *emul, + uint offset, ulong *valuep, + enum pci_size_t size) { struct swap_case_platdata *plat = dev_get_platdata(emul); diff --git a/drivers/misc/tegra186_bpmp.c b/drivers/misc/tegra186_bpmp.c index 89e27dd526afdec724b1eb6da96e46d9f30a687c..ce2b92517385f00d0069c7f401dbc797d559752d 100644 --- a/drivers/misc/tegra186_bpmp.c +++ b/drivers/misc/tegra186_bpmp.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <time.h> #include <dm/lists.h> #include <dm/root.h> @@ -12,6 +13,7 @@ #include <misc.h> #include <asm/arch-tegra/bpmp_abi.h> #include <asm/arch-tegra/ivc.h> +#include <linux/err.h> #define BPMP_IVC_FRAME_COUNT 1 #define BPMP_IVC_FRAME_SIZE 128 diff --git a/drivers/misc/vexpress_config.c b/drivers/misc/vexpress_config.c index 9f5baa5288542e91a482c50df16df77a326d53e4..53d7e1d154a367ed1d93c6b0effb9f2d2fbc13a9 100644 --- a/drivers/misc/vexpress_config.c +++ b/drivers/misc/vexpress_config.c @@ -6,6 +6,7 @@ */ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/read.h> #include <asm/io.h> #include <linux/delay.h> diff --git a/drivers/mmc/am654_sdhci.c b/drivers/mmc/am654_sdhci.c index 41a90834ffc14a86416fb13ba98eef009701d149..aad9d8b85b461ebd125837b21c8381b9666d31db 100644 --- a/drivers/mmc/am654_sdhci.c +++ b/drivers/mmc/am654_sdhci.c @@ -12,6 +12,8 @@ #include <power-domain.h> #include <regmap.h> #include <sdhci.h> +#include <dm/device_compat.h> +#include <linux/err.h> /* CTL_CFG Registers */ #define CTL_CFG_2 0x14 diff --git a/drivers/mmc/arm_pl180_mmci.c b/drivers/mmc/arm_pl180_mmci.c index ea8eb0d5091dcfa949b763ebf167bb5d6dc5d445..d396afc14cefd3b162760c9ac4eab3f7bb960b1a 100644 --- a/drivers/mmc/arm_pl180_mmci.c +++ b/drivers/mmc/arm_pl180_mmci.c @@ -16,6 +16,7 @@ #include <errno.h> #include <malloc.h> #include <mmc.h> +#include <dm/device_compat.h> #include <asm/io.h> #include <asm-generic/gpio.h> diff --git a/drivers/mmc/aspeed_sdhci.c b/drivers/mmc/aspeed_sdhci.c index 1321ec37e1bfa18e80f9d5b42b855573137c0133..8929e603f3384099ca1de53d7ae8ec061c03489f 100644 --- a/drivers/mmc/aspeed_sdhci.c +++ b/drivers/mmc/aspeed_sdhci.c @@ -9,6 +9,7 @@ #include <dm.h> #include <malloc.h> #include <sdhci.h> +#include <linux/err.h> struct aspeed_sdhci_plat { struct mmc_config cfg; diff --git a/drivers/mmc/bcm2835_sdhost.c b/drivers/mmc/bcm2835_sdhost.c index 7f70acaf3996082ced9c41c3867a586c22e60f41..8cebf99c589dc6db12fe71f3c632bdfa452ebca3 100644 --- a/drivers/mmc/bcm2835_sdhost.c +++ b/drivers/mmc/bcm2835_sdhost.c @@ -36,6 +36,7 @@ #include <asm/arch/msg.h> #include <asm/arch/mbox.h> #include <asm/unaligned.h> +#include <dm/device_compat.h> #include <linux/compat.h> #include <linux/io.h> #include <linux/iopoll.h> diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index 112f1150158c3f453001bbe615bdd4dd966eb3ac..ab40019ccbea866b7ff96aa01cf020e3d79a90b4 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -22,6 +22,7 @@ #include <fdt_support.h> #include <asm/io.h> #include <dm.h> +#include <dm/device_compat.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/mmc/fsl_esdhc_imx.c b/drivers/mmc/fsl_esdhc_imx.c index 462ad2878a2b37c90ba98271c8a05645af47287e..4900498e9b6b22675f596709d4957bb5ccd3b27e 100644 --- a/drivers/mmc/fsl_esdhc_imx.c +++ b/drivers/mmc/fsl_esdhc_imx.c @@ -19,6 +19,8 @@ #include <hwconfig.h> #include <mmc.h> #include <part.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <power/regulator.h> #include <malloc.h> #include <fsl_esdhc_imx.h> diff --git a/drivers/mmc/jz_mmc.c b/drivers/mmc/jz_mmc.c index cb2a7c3eb5e1602911f909a163f268808e18fc5a..8d4f886cb49ae589e54b20110822bfa95be7fcd3 100644 --- a/drivers/mmc/jz_mmc.c +++ b/drivers/mmc/jz_mmc.c @@ -12,6 +12,7 @@ #include <asm/io.h> #include <asm/unaligned.h> #include <errno.h> +#include <dm/device_compat.h> #include <mach/jz4780.h> #include <wait_bit.h> diff --git a/drivers/mmc/mmc-uclass.c b/drivers/mmc/mmc-uclass.c index c7a832ca900a6bfe0b8cee2aa17e6d351ca8cd2f..0b90a97650148da0b05a96e6c1a5c39b246210c5 100644 --- a/drivers/mmc/mmc-uclass.c +++ b/drivers/mmc/mmc-uclass.c @@ -8,7 +8,9 @@ #include <mmc.h> #include <dm.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> +#include <linux/compat.h> #include "mmc_private.h" int dm_mmc_send_cmd(struct udevice *dev, struct mmc_cmd *cmd, diff --git a/drivers/mmc/msm_sdhci.c b/drivers/mmc/msm_sdhci.c index cae42ec4acebb75f192f977dc314510dc86337df..da3ae2ec3585e5ba214ca29d0773114517f4128f 100644 --- a/drivers/mmc/msm_sdhci.c +++ b/drivers/mmc/msm_sdhci.c @@ -10,6 +10,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <sdhci.h> #include <wait_bit.h> #include <asm/io.h> diff --git a/drivers/mmc/mtk-sd.c b/drivers/mmc/mtk-sd.c index d4870818a806291e85e8e492cd52d4a48f3b62a3..bd1fb09d1c9baa81469c933f5f8c60d51b32a258 100644 --- a/drivers/mmc/mtk-sd.c +++ b/drivers/mmc/mtk-sd.c @@ -15,6 +15,7 @@ #include <mapmem.h> #include <stdbool.h> #include <asm/gpio.h> +#include <dm/device_compat.h> #include <dm/pinctrl.h> #include <linux/bitops.h> #include <linux/io.h> diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index 5d0cfb2ebdd48bf154a19bb60fa55928ceffd6d3..5334723a9f0d7d230a0be63d5df1724134afa8b2 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -47,6 +47,8 @@ #include <asm/arch/mux.h> #endif #include <dm.h> +#include <dm/devres.h> +#include <linux/err.h> #include <power/regulator.h> #include <thermal.h> diff --git a/drivers/mmc/renesas-sdhi.c b/drivers/mmc/renesas-sdhi.c index e01ac310e9ff346aabc6cdfdbdda1542d1847771..c3b13136f80aed1f2eb36393689351d1cb598282 100644 --- a/drivers/mmc/renesas-sdhi.c +++ b/drivers/mmc/renesas-sdhi.c @@ -6,8 +6,10 @@ #include <common.h> #include <clk.h> #include <fdtdec.h> +#include <malloc.h> #include <mmc.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/compat.h> #include <linux/dma-direction.h> #include <linux/io.h> diff --git a/drivers/mmc/rockchip_sdhci.c b/drivers/mmc/rockchip_sdhci.c index dd3d5574dbc74dd5f46baae1d1f7d912983e074d..b440996b269e41b20a5e35dbcb96daa165fef59d 100644 --- a/drivers/mmc/rockchip_sdhci.c +++ b/drivers/mmc/rockchip_sdhci.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> #include <dt-structs.h> +#include <linux/err.h> #include <linux/libfdt.h> #include <malloc.h> #include <mapmem.h> diff --git a/drivers/mmc/sdhci-cadence.c b/drivers/mmc/sdhci-cadence.c index 4736263bf2a690c285bad5c33d32e133d31fb68d..e9108dabd1a7de19283048f987adc6eda8e1a143 100644 --- a/drivers/mmc/sdhci-cadence.c +++ b/drivers/mmc/sdhci-cadence.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/bitfield.h> #include <linux/io.h> #include <linux/iopoll.h> diff --git a/drivers/mmc/sh_mmcif.c b/drivers/mmc/sh_mmcif.c index c8875ce8f8150950566c6b18869b30738b5640cb..29bbb4b3a6f9d3ce57ea068d5e6ca1faf94cc210 100644 --- a/drivers/mmc/sh_mmcif.c +++ b/drivers/mmc/sh_mmcif.c @@ -13,6 +13,7 @@ #include <clk.h> #include <dm.h> #include <malloc.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <linux/compat.h> #include <linux/io.h> diff --git a/drivers/mmc/sh_sdhi.c b/drivers/mmc/sh_sdhi.c index e38e8abfef40a9e1aa66f421ecbfc2ab356d930a..2202158c88afa03fdb42109bb5fe2ceefd3035ea 100644 --- a/drivers/mmc/sh_sdhi.c +++ b/drivers/mmc/sh_sdhi.c @@ -13,6 +13,7 @@ #include <malloc.h> #include <mmc.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <linux/compat.h> #include <linux/io.h> diff --git a/drivers/mmc/snps_dw_mmc.c b/drivers/mmc/snps_dw_mmc.c index 5a413f0ec7837f700f40524bf46de1595b32e180..c606ef011bff614d9e99350efc8d50d48aa9a84a 100644 --- a/drivers/mmc/snps_dw_mmc.c +++ b/drivers/mmc/snps_dw_mmc.c @@ -13,6 +13,7 @@ #include <dwmmc.h> #include <errno.h> #include <fdtdec.h> +#include <dm/device_compat.h> #include <linux/libfdt.h> #include <linux/err.h> #include <malloc.h> diff --git a/drivers/mmc/socfpga_dw_mmc.c b/drivers/mmc/socfpga_dw_mmc.c index 568a3e77d372d981d143085fb8c15c3f6a1ba169..786cdc700a56b7486b9096cf2e0cf6250fc04d0a 100644 --- a/drivers/mmc/socfpga_dw_mmc.c +++ b/drivers/mmc/socfpga_dw_mmc.c @@ -11,6 +11,7 @@ #include <dwmmc.h> #include <errno.h> #include <fdtdec.h> +#include <dm/device_compat.h> #include <linux/libfdt.h> #include <linux/err.h> #include <malloc.h> diff --git a/drivers/mmc/stm32_sdmmc2.c b/drivers/mmc/stm32_sdmmc2.c index 0a7a2fe624881de23ffe285d59ea7c466f87f73a..6f3b2ad653ae7c7c623a48219dbb1259539c614d 100644 --- a/drivers/mmc/stm32_sdmmc2.c +++ b/drivers/mmc/stm32_sdmmc2.c @@ -9,6 +9,7 @@ #include <cpu_func.h> #include <dm.h> #include <fdtdec.h> +#include <malloc.h> #include <linux/libfdt.h> #include <mmc.h> #include <reset.h> diff --git a/drivers/mmc/tegra_mmc.c b/drivers/mmc/tegra_mmc.c index 22990fa98b78d1314fa6c654dde5dd8643774481..f022e93552521f8d414fbfcae363d7f3373b2bce 100644 --- a/drivers/mmc/tegra_mmc.c +++ b/drivers/mmc/tegra_mmc.c @@ -14,6 +14,7 @@ #include <asm/gpio.h> #include <asm/io.h> #include <asm/arch-tegra/tegra_mmc.h> +#include <linux/err.h> struct tegra_mmc_plat { struct mmc_config cfg; diff --git a/drivers/mmc/tmio-common.c b/drivers/mmc/tmio-common.c index 5a8506dcb6bdecadaccbb5db5690be5682e9997e..092b740f564eefb01cedd8d635f545019688ba4b 100644 --- a/drivers/mmc/tmio-common.c +++ b/drivers/mmc/tmio-common.c @@ -11,6 +11,7 @@ #include <fdtdec.h> #include <mmc.h> #include <dm.h> +#include <dm/device_compat.h> #include <dm/pinctrl.h> #include <linux/compat.h> #include <linux/dma-direction.h> diff --git a/drivers/mmc/uniphier-sd.c b/drivers/mmc/uniphier-sd.c index 8f89bda2331c35c13e51ded41e9d2530874743d2..4dbe71fa2e1ef081368f91daae85fd6311a8b103 100644 --- a/drivers/mmc/uniphier-sd.c +++ b/drivers/mmc/uniphier-sd.c @@ -7,8 +7,10 @@ #include <common.h> #include <clk.h> #include <fdtdec.h> +#include <malloc.h> #include <mmc.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/compat.h> #include <linux/dma-direction.h> #include <linux/io.h> diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index 529eec9c45cd6cc4c438dd506dbe364b1470f4bd..24fabeee953d78eee44994b2cdb8de66c0115aea 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -10,6 +10,8 @@ #include <dm.h> #include <fdtdec.h> #include "mmc_private.h" +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/libfdt.h> #include <malloc.h> #include <sdhci.h> diff --git a/drivers/mtd/hbmc-am654.c b/drivers/mtd/hbmc-am654.c index 5a560f1253bac60bae9aef235b0a1b5bcfa37141..846b0e832b75f883192d52341653eb7b766aa552 100644 --- a/drivers/mtd/hbmc-am654.c +++ b/drivers/mtd/hbmc-am654.c @@ -8,6 +8,7 @@ #include <dm.h> #include <regmap.h> #include <syscon.h> +#include <dm/device_compat.h> #define FSS_SYSC_REG 0x4 diff --git a/drivers/mtd/mtd_uboot.c b/drivers/mtd/mtd_uboot.c index 8aeccb016dc39fb1147e07320ac378754f4f4e3e..db20a6b0b245182ce41110389b646a1b0e94177b 100644 --- a/drivers/mtd/mtd_uboot.c +++ b/drivers/mtd/mtd_uboot.c @@ -5,8 +5,10 @@ */ #include <common.h> #include <env.h> +#include <malloc.h> #include <dm/device.h> #include <dm/uclass-internal.h> +#include <linux/err.h> #include <linux/mtd/mtd.h> #include <linux/mtd/partitions.h> #include <mtd.h> diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 592f58dcd36c6a48d55827057a111dc8d3880a12..5621c3fd266e48d532a453029df7a36d3fcfe7b1 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -10,6 +10,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index dd04d676d56c37199fee42056484248d75c6c763..f8d3f4d246ce0c02bee5059b67870d6023b6c2c1 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -9,6 +9,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/ptrace.h> @@ -1179,10 +1180,10 @@ int mtd_ooblayout_free(struct mtd_info *mtd, int section, if (!mtd || section < 0) return -EINVAL; - if (!mtd->ooblayout || !mtd->ooblayout->free) + if (!mtd->ooblayout || !mtd->ooblayout->rfree) return -ENOTSUPP; - return mtd->ooblayout->free(mtd, section, oobfree); + return mtd->ooblayout->rfree(mtd, section, oobfree); } EXPORT_SYMBOL_GPL(mtd_ooblayout_free); diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index fd8d8e5ea7295ac44c2bb25677d2e3df06f6d1cc..56acdbf65ba998c9eed092222fe2715d00497c42 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -9,6 +9,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> diff --git a/drivers/mtd/nand/bbt.c b/drivers/mtd/nand/bbt.c index f3d05e6757fc0455be8d31f5b705bde0c18f0b7e..133670cb19983698d511a1d136665024814d9f01 100644 --- a/drivers/mtd/nand/bbt.c +++ b/drivers/mtd/nand/bbt.c @@ -10,6 +10,7 @@ #define pr_fmt(fmt) "nand-bbt: " fmt #include <common.h> +#include <dm/devres.h> #include <linux/mtd/nand.h> #ifndef __UBOOT__ #include <linux/slab.h> diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c index 3abaef23c53999f48f9fe9f9de332c357ddd1f10..bc0accf8c66e25ac01988b4be906a7263c4a726f 100644 --- a/drivers/mtd/nand/core.c +++ b/drivers/mtd/nand/core.c @@ -11,6 +11,7 @@ #include <common.h> #ifndef __UBOOT__ +#include <linux/compat.h> #include <linux/module.h> #endif #include <linux/mtd/nand.h> diff --git a/drivers/mtd/nand/raw/atmel_nand.c b/drivers/mtd/nand/raw/atmel_nand.c index 31ad2cfa8882eb6c354e56a09c2589e7c0b1cd8e..996d3dbb710f340b4e53e5265e34c053b6aff21a 100644 --- a/drivers/mtd/nand/raw/atmel_nand.c +++ b/drivers/mtd/nand/raw/atmel_nand.c @@ -13,6 +13,8 @@ #include <common.h> #include <asm/gpio.h> #include <asm/arch/gpio.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <malloc.h> #include <nand.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c index 16b0d4440a79d7c6f87a01d4cc6afe21428e9881..ea7c65a1f6bae43b3e5140710c5cb696381061f1 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm63158_nand.c @@ -4,6 +4,7 @@ #include <asm/io.h> #include <memalign.h> #include <nand.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/io.h> #include <linux/ioport.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c index ece944485ce7011e25ec21fb87b987f4b1ec3824..3a136155dd92984bd2669c5bb9c9f6571c97af9c 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6838_nand.c @@ -4,6 +4,7 @@ #include <asm/io.h> #include <memalign.h> #include <nand.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/io.h> #include <linux/ioport.h> diff --git a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c index 3586baa4fa0057a92843a69941a5774da0adc13b..6aca011db252fec9acf85096920c200ad1a0b181 100644 --- a/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c +++ b/drivers/mtd/nand/raw/brcmnand/bcm6858_nand.c @@ -4,6 +4,7 @@ #include <asm/io.h> #include <memalign.h> #include <nand.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/io.h> #include <linux/ioport.h> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c index 074592925386bc5abe01d359830f264cec1f0d6c..5232328e1e4a21308b8b8b29e14f2158d166cffb 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c @@ -17,6 +17,9 @@ #include <memalign.h> #include <nand.h> #include <clk.h> +#include <dm/device_compat.h> +#include <dm/devres.h> +#include <linux/err.h> #include <linux/ioport.h> #include <linux/completion.h> #include <linux/errno.h> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c index 883948355ca8edf3323876157e804f1f3146926c..c58679834ed02194b94854bbbfb33623cad43373 100644 --- a/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand_compat.c @@ -1,6 +1,8 @@ // SPDX-License-Identifier: GPL-2.0+ #include <common.h> +#include <malloc.h> +#include <dm/devres.h> #include "brcmnand_compat.h" static char *devm_kvasprintf(struct udevice *dev, gfp_t gfp, const char *fmt, diff --git a/drivers/mtd/nand/raw/denali.c b/drivers/mtd/nand/raw/denali.c index be1b3627ad0878711c05212d8e2ec0388853c21a..f51d3e25c762c28b867b16293bad46fa66c67d76 100644 --- a/drivers/mtd/nand/raw/denali.c +++ b/drivers/mtd/nand/raw/denali.c @@ -7,9 +7,13 @@ #include <asm/dma-mapping.h> #include <dm.h> +#include <malloc.h> #include <nand.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/bitfield.h> #include <linux/dma-direction.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/io.h> #include <linux/mtd/mtd.h> @@ -1156,7 +1160,7 @@ static int denali_ooblayout_free(struct mtd_info *mtd, int section, static const struct mtd_ooblayout_ops denali_ooblayout_ops = { .ecc = denali_ooblayout_ecc, - .free = denali_ooblayout_free, + .rfree = denali_ooblayout_free, }; static int denali_multidev_fixup(struct denali_nand_info *denali) diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c index 759ad40e517871e4b543ea33a37d49d4865e07b0..41b93e660a0ac6e9e2bc116ba963af2c85e45260 100644 --- a/drivers/mtd/nand/raw/denali_dt.c +++ b/drivers/mtd/nand/raw/denali_dt.c @@ -6,6 +6,7 @@ #include <clk.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/io.h> #include <linux/ioport.h> #include <linux/printk.h> diff --git a/drivers/mtd/nand/raw/fsl_elbc_nand.c b/drivers/mtd/nand/raw/fsl_elbc_nand.c index cbf689af63d2b23bcb8a16bb1aa00d3164479ff7..0c1bd7b4740ac9a8246212a64d4be5312c2a237c 100644 --- a/drivers/mtd/nand/raw/fsl_elbc_nand.c +++ b/drivers/mtd/nand/raw/fsl_elbc_nand.c @@ -11,6 +11,7 @@ #include <command.h> #include <malloc.h> #include <nand.h> +#include <dm/devres.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> diff --git a/drivers/mtd/nand/raw/fsl_ifc_nand.c b/drivers/mtd/nand/raw/fsl_ifc_nand.c index e2419e18a9956e0d193db0a10aa9cd232e282cf7..cf20238782c696fe0bb6ef19872662643d8e2be9 100644 --- a/drivers/mtd/nand/raw/fsl_ifc_nand.c +++ b/drivers/mtd/nand/raw/fsl_ifc_nand.c @@ -10,6 +10,7 @@ #include <command.h> #include <malloc.h> #include <nand.h> +#include <dm/devres.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> diff --git a/drivers/mtd/nand/raw/mxs_nand_spl.c b/drivers/mtd/nand/raw/mxs_nand_spl.c index 975a91a37d2e25e7ac89c4520bb02f4e24656546..a653dfa5edfd7aad5483fb3192cf3b0ba3f742ce 100644 --- a/drivers/mtd/nand/raw/mxs_nand_spl.c +++ b/drivers/mtd/nand/raw/mxs_nand_spl.c @@ -7,6 +7,7 @@ #include <nand.h> #include <malloc.h> #include <mxs_nand.h> +#include <linux/err.h> static struct mtd_info *mtd; static struct nand_chip nand_chip; diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c index aba8ac019d3e0a31d7be5babfe37c05a53577e0e..49d5e261b561caca371c6194966bdbb291647dc3 100644 --- a/drivers/mtd/nand/raw/nand_base.c +++ b/drivers/mtd/nand/raw/nand_base.c @@ -34,6 +34,7 @@ #endif #include <malloc.h> #include <watchdog.h> +#include <dm/devres.h> #include <linux/err.h> #include <linux/compat.h> #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c index ba785c5d53590f11b4323611c3b16cee29251821..a6e6e0ef6d75c879dd7264b909e99840c4ac87e4 100644 --- a/drivers/mtd/nand/raw/nand_bbt.c +++ b/drivers/mtd/nand/raw/nand_bbt.c @@ -59,6 +59,7 @@ #include <common.h> #include <malloc.h> +#include <dm/devres.h> #include <linux/compat.h> #include <linux/mtd/mtd.h> #include <linux/mtd/bbm.h> diff --git a/drivers/mtd/nand/raw/nand_bch.c b/drivers/mtd/nand/raw/nand_bch.c index afa04181681885917c90e63e3bce058b86045d03..11a22e021d09f03a8e76302edef8518c400879e7 100644 --- a/drivers/mtd/nand/raw/nand_bch.c +++ b/drivers/mtd/nand/raw/nand_bch.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <dm/devres.h> /*#include <asm/io.h>*/ #include <linux/types.h> diff --git a/drivers/mtd/nand/raw/nand_timings.c b/drivers/mtd/nand/raw/nand_timings.c index c0545a4fb1590045036589a48fb0791dd5ee189d..e6aa79039131ce1e0c4c172dcaae0a8f9f87b929 100644 --- a/drivers/mtd/nand/raw/nand_timings.c +++ b/drivers/mtd/nand/raw/nand_timings.c @@ -9,6 +9,7 @@ * */ #include <common.h> +#include <linux/err.h> #include <linux/kernel.h> #include <linux/mtd/rawnand.h> diff --git a/drivers/mtd/nand/raw/nand_util.c b/drivers/mtd/nand/raw/nand_util.c index fc2235c1a0ec5d82d25797e02e979ebbc3d11b7b..f3c8f7f2cb13a3fd67ddb16381de5617f362df84 100644 --- a/drivers/mtd/nand/raw/nand_util.c +++ b/drivers/mtd/nand/raw/nand_util.c @@ -24,6 +24,7 @@ #include <malloc.h> #include <memalign.h> #include <div64.h> +#include <dm/devres.h> #include <linux/errno.h> #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/nand/raw/pxa3xx_nand.c b/drivers/mtd/nand/raw/pxa3xx_nand.c index 4d2712df4c7a483243943171277e1f80dda15698..03f210bdb0b3f9bcc998505f370a98dfc14cc733 100644 --- a/drivers/mtd/nand/raw/pxa3xx_nand.c +++ b/drivers/mtd/nand/raw/pxa3xx_nand.c @@ -10,6 +10,9 @@ #include <malloc.h> #include <fdtdec.h> #include <nand.h> +#include <dm/device_compat.h> +#include <dm/devres.h> +#include <linux/err.h> #include <linux/errno.h> #include <asm/io.h> #include <asm/arch/cpu.h> diff --git a/drivers/mtd/nand/raw/stm32_fmc2_nand.c b/drivers/mtd/nand/raw/stm32_fmc2_nand.c index f3179cc21f521a5ce0de9a3c425f48c6ec18e4b2..1c212daa1dca87b7667dda82965ad56fdbaf7bef 100644 --- a/drivers/mtd/nand/raw/stm32_fmc2_nand.c +++ b/drivers/mtd/nand/raw/stm32_fmc2_nand.c @@ -9,6 +9,7 @@ #include <dm.h> #include <nand.h> #include <reset.h> +#include <linux/err.h> #include <linux/iopoll.h> #include <linux/ioport.h> diff --git a/drivers/mtd/nand/raw/sunxi_nand.c b/drivers/mtd/nand/raw/sunxi_nand.c index 3ccb168d1371584dd7a99affac105731ece471ba..9b99be10e6e3c8838df675137cd20c1f041643fd 100644 --- a/drivers/mtd/nand/raw/sunxi_nand.c +++ b/drivers/mtd/nand/raw/sunxi_nand.c @@ -26,8 +26,12 @@ #include <common.h> #include <fdtdec.h> +#include <malloc.h> #include <memalign.h> #include <nand.h> +#include <dm/device_compat.h> +#include <dm/devres.h> +#include <linux/err.h> #include <linux/kernel.h> #include <linux/mtd/mtd.h> diff --git a/drivers/mtd/nand/raw/tegra_nand.c b/drivers/mtd/nand/raw/tegra_nand.c index 74acdfb3081248a9870517ab48e58cdaa8109b29..ae699d1da51b69d851ff5da5c3a6ad29c5db177c 100644 --- a/drivers/mtd/nand/raw/tegra_nand.c +++ b/drivers/mtd/nand/raw/tegra_nand.c @@ -13,6 +13,7 @@ #include <asm/arch/clock.h> #include <asm/arch/funcmux.h> #include <asm/arch-tegra/clk_rst.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <asm/gpio.h> #include <fdtdec.h> diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c index 3326c2b096bf50f452a4f2e341f32fdc5e979863..52c8a94778cb664998b6d3f597e7e3dadaa199fb 100644 --- a/drivers/mtd/nand/raw/vf610_nfc.c +++ b/drivers/mtd/nand/raw/vf610_nfc.c @@ -23,6 +23,7 @@ #include <common.h> #include <malloc.h> +#include <dm/device_compat.h> #include <linux/mtd/mtd.h> #include <linux/mtd/rawnand.h> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index cb8ffa3fa96a16dd40dda3553bbb171107e71df7..cd624ec6ae64926223354dfb0864ffb21c79146b 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -24,6 +24,8 @@ #include <errno.h> #include <spi.h> #include <spi-mem.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/mtd/spinand.h> #endif @@ -1021,7 +1023,7 @@ static int spinand_noecc_ooblayout_free(struct mtd_info *mtd, int section, static const struct mtd_ooblayout_ops spinand_noecc_ooblayout = { .ecc = spinand_noecc_ooblayout_ecc, - .free = spinand_noecc_ooblayout_free, + .rfree = spinand_noecc_ooblayout_free, }; static int spinand_init(struct spinand_device *spinand) diff --git a/drivers/mtd/nand/spi/gigadevice.c b/drivers/mtd/nand/spi/gigadevice.c index 3681c5eed9acf0ebc38f34350c706cec2b6731ac..0b228dcb5b1d4a4488732929d123ed55e16753e7 100644 --- a/drivers/mtd/nand/spi/gigadevice.c +++ b/drivers/mtd/nand/spi/gigadevice.c @@ -7,6 +7,7 @@ */ #ifndef __UBOOT__ +#include <malloc.h> #include <linux/device.h> #include <linux/kernel.h> #endif @@ -103,7 +104,7 @@ static int gd5fxgq4xexxg_ecc_get_status(struct spinand_device *spinand, static const struct mtd_ooblayout_ops gd5fxgq4xexxg_ooblayout = { .ecc = gd5fxgq4xexxg_ooblayout_ecc, - .free = gd5fxgq4xexxg_ooblayout_free, + .rfree = gd5fxgq4xexxg_ooblayout_free, }; static const struct spinand_info gigadevice_spinand_table[] = { diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c index 662c561e501b150ab84a12f958b684540dfbda41..67d092be2cf191b649b60c4daa16c1d99bdd769c 100644 --- a/drivers/mtd/nand/spi/macronix.c +++ b/drivers/mtd/nand/spi/macronix.c @@ -6,6 +6,7 @@ */ #ifndef __UBOOT__ +#include <malloc.h> #include <linux/device.h> #include <linux/kernel.h> #endif @@ -47,7 +48,7 @@ static int mx35lfxge4ab_ooblayout_free(struct mtd_info *mtd, int section, static const struct mtd_ooblayout_ops mx35lfxge4ab_ooblayout = { .ecc = mx35lfxge4ab_ooblayout_ecc, - .free = mx35lfxge4ab_ooblayout_free, + .rfree = mx35lfxge4ab_ooblayout_free, }; static int mx35lf1ge4ab_get_eccsr(struct spinand_device *spinand, u8 *eccsr) diff --git a/drivers/mtd/nand/spi/micron.c b/drivers/mtd/nand/spi/micron.c index 83951c5d0f7290ff195d55977ea559ee7aae7c56..687306e33e685ff75c3272e70b9323b44bd43947 100644 --- a/drivers/mtd/nand/spi/micron.c +++ b/drivers/mtd/nand/spi/micron.c @@ -7,6 +7,7 @@ */ #ifndef __UBOOT__ +#include <malloc.h> #include <linux/device.h> #include <linux/kernel.h> #endif @@ -63,7 +64,7 @@ static int mt29f2g01abagd_ooblayout_free(struct mtd_info *mtd, int section, static const struct mtd_ooblayout_ops mt29f2g01abagd_ooblayout = { .ecc = mt29f2g01abagd_ooblayout_ecc, - .free = mt29f2g01abagd_ooblayout_free, + .rfree = mt29f2g01abagd_ooblayout_free, }; static int mt29f2g01abagd_ecc_get_status(struct spinand_device *spinand, diff --git a/drivers/mtd/nand/spi/winbond.c b/drivers/mtd/nand/spi/winbond.c index 6ba8bc5c7b8c25c8a0c7b975b9a170496014c137..6ede98c85d217b2b9d61218b0c073c9344dac8d0 100644 --- a/drivers/mtd/nand/spi/winbond.c +++ b/drivers/mtd/nand/spi/winbond.c @@ -8,6 +8,7 @@ */ #ifndef __UBOOT__ +#include <malloc.h> #include <linux/device.h> #include <linux/kernel.h> #endif @@ -59,7 +60,7 @@ static int w25m02gv_ooblayout_free(struct mtd_info *mtd, int section, static const struct mtd_ooblayout_ops w25m02gv_ooblayout = { .ecc = w25m02gv_ooblayout_ecc, - .free = w25m02gv_ooblayout_free, + .rfree = w25m02gv_ooblayout_free, }; static int w25m02gv_select_target(struct spinand_device *spinand, diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c index 371e2ecaa70fd85302b3f65e3f0b475f0224aae3..693bb78b87cfe287d306f9518acd6719af2a8200 100644 --- a/drivers/mtd/onenand/onenand_base.c +++ b/drivers/mtd/onenand/onenand_base.c @@ -21,6 +21,7 @@ #include <common.h> #include <watchdog.h> +#include <dm/devres.h> #include <linux/compat.h> #include <linux/mtd/mtd.h> #include "linux/mtd/flashchip.h" diff --git a/drivers/mtd/renesas_rpc_hf.c b/drivers/mtd/renesas_rpc_hf.c index f5c6515c9bf529fb7b7cd252873296657b031430..fc2aa22d7f3847e6614576a6244b418733f0a157 100644 --- a/drivers/mtd/renesas_rpc_hf.c +++ b/drivers/mtd/renesas_rpc_hf.c @@ -8,9 +8,11 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <clk.h> #include <dm.h> +#include <dm/device_compat.h> #include <dm/of_access.h> #include <errno.h> #include <fdt_support.h> diff --git a/drivers/mtd/spi/sf-uclass.c b/drivers/mtd/spi/sf-uclass.c index c6107522be033eb8c0a0ed3dd94f093e2cf04bf6..5ebcca590a2795b8db187889d2dfb9f61e90a0bc 100644 --- a/drivers/mtd/spi/sf-uclass.c +++ b/drivers/mtd/spi/sf-uclass.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <spi.h> #include <spi_flash.h> #include <dm/device-internal.h> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index d7020c190bad29d4508b25c53e34dd79a054b20f..7b6ad495ace34c221c3ae188f7c82e74ba1fb95c 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -10,6 +10,8 @@ */ #include <common.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/err.h> #include <linux/errno.h> #include <linux/log2.h> diff --git a/drivers/mtd/spi/spi-nor-tiny.c b/drivers/mtd/spi/spi-nor-tiny.c index c19d468d62cfa8f00a7496aff72dd72f574e4d83..ccc0ab07af5a705a12199d9e22a49335e707c245 100644 --- a/drivers/mtd/spi/spi-nor-tiny.c +++ b/drivers/mtd/spi/spi-nor-tiny.c @@ -10,6 +10,7 @@ */ #include <common.h> +#include <dm/device_compat.h> #include <linux/err.h> #include <linux/errno.h> #include <linux/log2.h> diff --git a/drivers/mtd/ubi/attach.c b/drivers/mtd/ubi/attach.c index 19defd883182193cc418a700d47065882e6dea4d..f02a06fc35d5301aeacaf23d7faf3cb75db0bc11 100644 --- a/drivers/mtd/ubi/attach.c +++ b/drivers/mtd/ubi/attach.c @@ -70,6 +70,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/err.h> #include <linux/slab.h> #include <linux/crc32.h> diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 42c5270c7f7338f621a69d20f9e0981df17b8ad0..7de65bc7c3ef608b75846e1e3c2bf902c2426aee 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -17,6 +17,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/stringify.h> diff --git a/drivers/mtd/ubi/debug.c b/drivers/mtd/ubi/debug.c index f3d348da833b2cff1dabe23970236eaa7a8425de..d2b7ca5e33fd0b42aa1649396a40c120f3cdedf3 100644 --- a/drivers/mtd/ubi/debug.c +++ b/drivers/mtd/ubi/debug.c @@ -6,10 +6,12 @@ */ #include <hexdump.h> +#include <malloc.h> #include <ubi_uboot.h> #include "ubi.h" #ifndef __UBOOT__ #include <linux/debugfs.h> +#include <linux/err.h> #include <linux/uaccess.h> #include <linux/module.h> #endif diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 0c8b998e7e14b9fc1033c3e88698da5e3caa1153..8428278e215fdf3ddd431b92381d2190d7c3cf5b 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c @@ -29,6 +29,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/slab.h> #include <linux/crc32.h> #include <u-boot/crc.h> diff --git a/drivers/mtd/ubi/fastmap.c b/drivers/mtd/ubi/fastmap.c index 646c778e87c5ad6894396ac229c92c78ea6ff755..a3f5e3e1a9307cda22797e78e0a9c2f45dcc03c3 100644 --- a/drivers/mtd/ubi/fastmap.c +++ b/drivers/mtd/ubi/fastmap.c @@ -7,7 +7,9 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc32.h> +#include <linux/err.h> #include <u-boot/crc.h> #else #include <div64.h> diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 608dede49251f5a5e146be04487647c8a016fc1a..8ba22d814226411ecee68a5afbe6155c54a14c5d 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c @@ -74,6 +74,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc32.h> #include <linux/err.h> #include <linux/slab.h> diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c index bcea71b1b2364f0f86121a4c51f5e2e308ce83e4..41680cdad13fd889e67759631fcbd73c2cecbdd7 100644 --- a/drivers/mtd/ubi/kapi.c +++ b/drivers/mtd/ubi/kapi.c @@ -8,6 +8,7 @@ /* This file mostly implements UBI kernel API functions */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/module.h> #include <linux/slab.h> #include <linux/namei.h> diff --git a/drivers/mtd/ubi/misc.c b/drivers/mtd/ubi/misc.c index 685324d7d2ccd00bcd5b442f48a612d291b825bb..3f7ee59c946b6962ad61da7e25c524623c816fcf 100644 --- a/drivers/mtd/ubi/misc.c +++ b/drivers/mtd/ubi/misc.c @@ -7,6 +7,7 @@ /* Here we keep miscellaneous functions which are used all over the UBI code */ +#include <malloc.h> #include <ubi_uboot.h> #include "ubi.h" diff --git a/drivers/mtd/ubi/upd.c b/drivers/mtd/ubi/upd.c index d0a6a1bd186ff8bb93ab17473eb46c1f2898168c..0f7951c8590e8aa527d22bd479d2749fb8936289 100644 --- a/drivers/mtd/ubi/upd.c +++ b/drivers/mtd/ubi/upd.c @@ -26,6 +26,7 @@ */ #ifndef __UBOOT__ +#include <malloc.h> #include <linux/uaccess.h> #else #include <div64.h> diff --git a/drivers/mtd/ubi/vmt.c b/drivers/mtd/ubi/vmt.c index a2ff1b5769d092c2f3cb7846fea0e9e8e955768f..2114abbe7c365390a6e01758a1eaaf58c372247e 100644 --- a/drivers/mtd/ubi/vmt.c +++ b/drivers/mtd/ubi/vmt.c @@ -11,6 +11,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/err.h> #include <linux/slab.h> #include <linux/export.h> diff --git a/drivers/mtd/ubi/vtbl.c b/drivers/mtd/ubi/vtbl.c index 9c46ef669569858e4e5ae3fac9269336bfd70390..123c2f344de152597f107d22f38e22fc33f4a4df 100644 --- a/drivers/mtd/ubi/vtbl.c +++ b/drivers/mtd/ubi/vtbl.c @@ -46,6 +46,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc32.h> #include <linux/err.h> #include <linux/slab.h> diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 89ca90feb342678562b2c286ebd5b4de6dca0d08..4038b7f04e0419eba6eb5ad24b5016f6ce6e2480 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -86,6 +86,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/slab.h> #include <linux/crc32.h> #include <linux/freezer.h> diff --git a/drivers/net/bcm6348-eth.c b/drivers/net/bcm6348-eth.c index 7100e68bd20a385a83621f5a0d02d641ea6e5e6d..fe3532930aa4112e22e708a668b89e915214761b 100644 --- a/drivers/net/bcm6348-eth.c +++ b/drivers/net/bcm6348-eth.c @@ -10,6 +10,7 @@ #include <clk.h> #include <dm.h> #include <dma.h> +#include <malloc.h> #include <miiphy.h> #include <net.h> #include <phy.h> diff --git a/drivers/net/bcm6368-eth.c b/drivers/net/bcm6368-eth.c index 110985ed1dc247db4398ffeeb88da4c6aca26c3e..1200049007e9739f474fa5a9f32d84bd04c3ed43 100644 --- a/drivers/net/bcm6368-eth.c +++ b/drivers/net/bcm6368-eth.c @@ -10,11 +10,13 @@ #include <clk.h> #include <dm.h> #include <dma.h> +#include <malloc.h> #include <miiphy.h> #include <net.h> #include <reset.h> #include <wait_bit.h> #include <asm/io.h> +#include <dm/device_compat.h> #define ETH_PORT_STR "brcm,enetsw-port" diff --git a/drivers/net/designware.c b/drivers/net/designware.c index 19fc34f771cb6af93dd2b5cdcabe5e557a1ad4c1..baac277a84dba0d722a95036900492095b891675 100644 --- a/drivers/net/designware.c +++ b/drivers/net/designware.c @@ -17,6 +17,8 @@ #include <malloc.h> #include <pci.h> #include <reset.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/compiler.h> #include <linux/err.h> #include <linux/kernel.h> diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 46321116352a567463db5368afb17a0102707c53..0564bebf76c007ae2fb37c819febf371951b731a 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -31,6 +31,7 @@ #include <cpu_func.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <memalign.h> #include <miiphy.h> #include <net.h> diff --git a/drivers/net/dwmac_socfpga.c b/drivers/net/dwmac_socfpga.c index b7bf5dbe69a8e4bc6b7333b2a6ba6aeef24c55f1..e93561dffa871d32be7faa798bd10dec1c81b637 100644 --- a/drivers/net/dwmac_socfpga.c +++ b/drivers/net/dwmac_socfpga.c @@ -14,6 +14,8 @@ #include <reset.h> #include <syscon.h> #include "designware.h" +#include <dm/device_compat.h> +#include <linux/err.h> #include <asm/arch/system_manager.h> diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index 09460118445e02c551da5420c78c366aaad1cd3d..9212920549dd617f45ae5875aa22c45c549f4de4 100644 --- a/drivers/net/e1000.c +++ b/drivers/net/e1000.c @@ -33,6 +33,7 @@ tested on both gig copper and gig fiber boards #include <cpu_func.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <memalign.h> #include <pci.h> #include "e1000.h" diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c index aecd290d72939f4a34a6348a85aec0c99e48b0c2..52b3c79794aebd5f4d7aafd4f03a4376960da287 100644 --- a/drivers/net/e1000_spi.c +++ b/drivers/net/e1000_spi.c @@ -1,6 +1,7 @@ #include <common.h> #include <console.h> #include "e1000.h" +#include <malloc.h> #include <linux/compiler.h> /*----------------------------------------------------------------------- diff --git a/drivers/net/fsl-mc/dpio/qbman_portal.c b/drivers/net/fsl-mc/dpio/qbman_portal.c index c51354cfa14a5feda1bbbf9393d383f81fda0d83..e161b4e077ac14aeb40b35caf9116223ff913a95 100644 --- a/drivers/net/fsl-mc/dpio/qbman_portal.c +++ b/drivers/net/fsl-mc/dpio/qbman_portal.c @@ -3,6 +3,7 @@ * Copyright (C) 2014 Freescale Semiconductor */ +#include <malloc.h> #include <asm/arch/clock.h> #include "qbman_portal.h" diff --git a/drivers/net/fsl-mc/mc.c b/drivers/net/fsl-mc/mc.c index 8ff43a91c7620c15cc3b6d7d536fdbc51b572da7..07bbcc9b2311b87e8dd57bc1653284f0831f4357 100644 --- a/drivers/net/fsl-mc/mc.c +++ b/drivers/net/fsl-mc/mc.c @@ -8,6 +8,7 @@ #include <cpu_func.h> #include <env.h> #include <errno.h> +#include <malloc.h> #include <linux/bug.h> #include <asm/io.h> #include <linux/libfdt.h> diff --git a/drivers/net/fsl_enetc.c b/drivers/net/fsl_enetc.c index f0d15febcc8e0fc65664bafc65d166c6053b8329..bee73153d0efeaf5c1abe0506ae33023f392cfe0 100644 --- a/drivers/net/fsl_enetc.c +++ b/drivers/net/fsl_enetc.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <memalign.h> #include <asm/io.h> #include <pci.h> diff --git a/drivers/net/ftgmac100.c b/drivers/net/ftgmac100.c index ebb74339b27ef5bd248bf613c43c0f93a1df5d5f..40e6b3ba3950e94833b1940b955e2a6b2ed041e4 100644 --- a/drivers/net/ftgmac100.c +++ b/drivers/net/ftgmac100.c @@ -14,9 +14,11 @@ #include <clk.h> #include <cpu_func.h> #include <dm.h> +#include <malloc.h> #include <miiphy.h> #include <net.h> #include <wait_bit.h> +#include <dm/device_compat.h> #include <linux/io.h> #include <linux/iopoll.h> diff --git a/drivers/net/higmacv300.c b/drivers/net/higmacv300.c index 897741ab821c32f29953859cc0c3cb549f86e71f..0c1dd6834a3c75a70e4c164e88ce750f94fdcb94 100644 --- a/drivers/net/higmacv300.c +++ b/drivers/net/higmacv300.c @@ -4,6 +4,7 @@ */ #include <cpu_func.h> +#include <malloc.h> #include <asm/io.h> #include <common.h> #include <console.h> diff --git a/drivers/net/mscc_eswitch/jr2_switch.c b/drivers/net/mscc_eswitch/jr2_switch.c index 665517775e8122bfd372ab91d2470d31849eb627..33dd002146c1ee035f5b660f9e58993199ade696 100644 --- a/drivers/net/mscc_eswitch/jr2_switch.c +++ b/drivers/net/mscc_eswitch/jr2_switch.c @@ -6,6 +6,7 @@ #include <common.h> #include <config.h> #include <dm.h> +#include <malloc.h> #include <dm/of_access.h> #include <dm/of_addr.h> #include <fdt_support.h> diff --git a/drivers/net/mscc_eswitch/luton_switch.c b/drivers/net/mscc_eswitch/luton_switch.c index dffe81d873500e2adee0d2af96f4a608c571f682..9d24c005c12d2f3496da07d37124caf614252225 100644 --- a/drivers/net/mscc_eswitch/luton_switch.c +++ b/drivers/net/mscc_eswitch/luton_switch.c @@ -6,6 +6,7 @@ #include <common.h> #include <config.h> #include <dm.h> +#include <malloc.h> #include <dm/of_access.h> #include <dm/of_addr.h> #include <fdt_support.h> diff --git a/drivers/net/mscc_eswitch/ocelot_switch.c b/drivers/net/mscc_eswitch/ocelot_switch.c index 0ba84ab78a0b3b027ad043f335add4e060313f96..fe48f371c319ecde951e1349783e8e8727f0dbc4 100644 --- a/drivers/net/mscc_eswitch/ocelot_switch.c +++ b/drivers/net/mscc_eswitch/ocelot_switch.c @@ -6,6 +6,7 @@ #include <common.h> #include <config.h> #include <dm.h> +#include <malloc.h> #include <dm/of_access.h> #include <dm/of_addr.h> #include <fdt_support.h> diff --git a/drivers/net/mscc_eswitch/serval_switch.c b/drivers/net/mscc_eswitch/serval_switch.c index 1a21360a9669b7a0e190fc467171902d79026271..f05fa42ff3f4f58b5df3f7e7ca84f934d377bd87 100644 --- a/drivers/net/mscc_eswitch/serval_switch.c +++ b/drivers/net/mscc_eswitch/serval_switch.c @@ -6,6 +6,7 @@ #include <common.h> #include <config.h> #include <dm.h> +#include <malloc.h> #include <dm/of_access.h> #include <dm/of_addr.h> #include <fdt_support.h> diff --git a/drivers/net/mscc_eswitch/servalt_switch.c b/drivers/net/mscc_eswitch/servalt_switch.c index d20ec49d5610d3c46825d2df22443bf835161d40..bf95a38354d6b8f933f03f33ca5bbbe78bc0aec9 100644 --- a/drivers/net/mscc_eswitch/servalt_switch.c +++ b/drivers/net/mscc_eswitch/servalt_switch.c @@ -6,6 +6,7 @@ #include <common.h> #include <config.h> #include <dm.h> +#include <malloc.h> #include <dm/of_access.h> #include <dm/of_addr.h> #include <fdt_support.h> diff --git a/drivers/net/mtk_eth.c b/drivers/net/mtk_eth.c index edfa5d1ce8934911b493029c81165010563c024e..126b824b1a8f9ccd974fe0d28931a59cf513af03 100644 --- a/drivers/net/mtk_eth.c +++ b/drivers/net/mtk_eth.c @@ -17,6 +17,7 @@ #include <wait_bit.h> #include <asm/gpio.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/err.h> #include <linux/ioport.h> #include <linux/mdio.h> diff --git a/drivers/net/mvneta.c b/drivers/net/mvneta.c index 5fe850019959984133f1729a0ae4b7767f973655..d737400a20d93f6dc65865c608ad300cebd6d969 100644 --- a/drivers/net/mvneta.c +++ b/drivers/net/mvneta.c @@ -20,6 +20,8 @@ #include <config.h> #include <malloc.h> #include <asm/io.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/errno.h> #include <phy.h> #include <miiphy.h> diff --git a/drivers/net/mvpp2.c b/drivers/net/mvpp2.c index b234b41956a81bb749766d1670fd387415f710e5..fcd24868af48605c25e0ec5bf0fc639e970e6c3c 100644 --- a/drivers/net/mvpp2.c +++ b/drivers/net/mvpp2.c @@ -17,12 +17,15 @@ #include <cpu_func.h> #include <dm.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/lists.h> #include <net.h> #include <netdev.h> #include <config.h> #include <malloc.h> #include <asm/io.h> +#include <linux/err.h> #include <linux/errno.h> #include <phy.h> #include <miiphy.h> diff --git a/drivers/net/pch_gbe.c b/drivers/net/pch_gbe.c index e4507bf7fd34b7232fad4ed2396f5a19dbf9fa4c..b2823701a4118cdf9a76fa867ce696ffe8d5e779 100644 --- a/drivers/net/pch_gbe.c +++ b/drivers/net/pch_gbe.c @@ -9,6 +9,7 @@ #include <cpu_func.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <asm/io.h> #include <pci.h> #include <miiphy.h> diff --git a/drivers/net/pfe_eth/pfe_driver.c b/drivers/net/pfe_eth/pfe_driver.c index 14a8c68276a648cac7793de3de01a9d0f43a0256..f70a23521776ceac9bcb389117e162df32477f3b 100644 --- a/drivers/net/pfe_eth/pfe_driver.c +++ b/drivers/net/pfe_eth/pfe_driver.c @@ -4,6 +4,7 @@ * Copyright 2017 NXP */ +#include <malloc.h> #include <net/pfe_eth/pfe_eth.h> #include <net/pfe_eth/pfe_firmware.h> diff --git a/drivers/net/pfe_eth/pfe_eth.c b/drivers/net/pfe_eth/pfe_eth.c index c525674fb8826fbb98f0ee315603734ce9f74c70..1b5d11ef323c863aa0f31bd467a724b1f71db53d 100644 --- a/drivers/net/pfe_eth/pfe_eth.c +++ b/drivers/net/pfe_eth/pfe_eth.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/platform_data/pfe_dm_eth.h> #include <net.h> #include <net/pfe_eth/pfe_eth.h> diff --git a/drivers/net/pfe_eth/pfe_firmware.c b/drivers/net/pfe_eth/pfe_firmware.c index e4563f192bf21f2b53b042c8ba482a12cb6a319e..13112d9c1a35bb69f51df53f94d4fb9d10d91a7c 100644 --- a/drivers/net/pfe_eth/pfe_firmware.c +++ b/drivers/net/pfe_eth/pfe_firmware.c @@ -10,6 +10,7 @@ * files. */ +#include <malloc.h> #include <net/pfe_eth/pfe_eth.h> #include <net/pfe_eth/pfe_firmware.h> #ifdef CONFIG_CHAIN_OF_TRUST diff --git a/drivers/net/pfe_eth/pfe_mdio.c b/drivers/net/pfe_eth/pfe_mdio.c index 62309670fabf3591d3babb20ae3a875b7532cf36..b990e7fbe222423f446ddeaf783f24740ff2ca8f 100644 --- a/drivers/net/pfe_eth/pfe_mdio.c +++ b/drivers/net/pfe_eth/pfe_mdio.c @@ -5,6 +5,7 @@ */ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/platform_data/pfe_dm_eth.h> #include <net.h> #include <net/pfe_eth/pfe_eth.h> diff --git a/drivers/net/phy/dp83867.c b/drivers/net/phy/dp83867.c index a43793cd4274040fc75014c861a5614d6632ad1e..08935d9c15fccb8be842d4b1bbf2e0cbf24ae0fe 100644 --- a/drivers/net/phy/dp83867.c +++ b/drivers/net/phy/dp83867.c @@ -5,6 +5,7 @@ */ #include <common.h> #include <phy.h> +#include <dm/devres.h> #include <linux/compat.h> #include <malloc.h> diff --git a/drivers/net/phy/fixed.c b/drivers/net/phy/fixed.c index 0ae0edd0e1723ae4888bde60b51d035a5e6c097a..9d9f746e1dba9ec2f7a33b3b89fb840878a42f5f 100644 --- a/drivers/net/phy/fixed.c +++ b/drivers/net/phy/fixed.c @@ -7,6 +7,7 @@ #include <config.h> #include <common.h> +#include <malloc.h> #include <phy.h> #include <dm.h> #include <fdt_support.h> diff --git a/drivers/net/pic32_eth.c b/drivers/net/pic32_eth.c index 3458440b6ff7ff59924cc7a0d36b6f6063131d1a..e966be038a644a4ec6ebc842426301898ec6af1b 100644 --- a/drivers/net/pic32_eth.c +++ b/drivers/net/pic32_eth.c @@ -7,6 +7,7 @@ #include <cpu_func.h> #include <errno.h> #include <dm.h> +#include <malloc.h> #include <net.h> #include <miiphy.h> #include <console.h> diff --git a/drivers/net/sandbox-raw-bus.c b/drivers/net/sandbox-raw-bus.c index 0086f25fc1fa8c8cf8354d41b9aaec2819fb07d9..fb1ba5a8c83a79939673006fdb0334f9e3f76331 100644 --- a/drivers/net/sandbox-raw-bus.c +++ b/drivers/net/sandbox-raw-bus.c @@ -8,6 +8,7 @@ #include <asm/eth-raw-os.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <dm/device-internal.h> #include <dm/lists.h> diff --git a/drivers/net/sni_ave.c b/drivers/net/sni_ave.c index 6d333e24eeb89d7cd14b4c30ff29f02df8c60724..5d66a63a8bf337df00411c9b679287d08eb0b85c 100644 --- a/drivers/net/sni_ave.c +++ b/drivers/net/sni_ave.c @@ -8,13 +8,16 @@ #include <cpu_func.h> #include <dm.h> #include <fdt_support.h> -#include <linux/io.h> -#include <linux/iopoll.h> +#include <malloc.h> #include <miiphy.h> #include <net.h> #include <regmap.h> #include <reset.h> #include <syscon.h> +#include <dm/device_compat.h> +#include <linux/err.h> +#include <linux/io.h> +#include <linux/iopoll.h> #define AVE_GRST_DELAY_MSEC 40 #define AVE_MIN_XMITSIZE 60 diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c index 6f10578c884acf9b877493b8e604713348379a35..1ae776b4464375ddf5b443a93b3ca9ad2c05ea49 100644 --- a/drivers/net/sun8i_emac.c +++ b/drivers/net/sun8i_emac.c @@ -18,6 +18,7 @@ #include <clk.h> #include <dm.h> #include <fdt_support.h> +#include <dm/device_compat.h> #include <linux/err.h> #include <malloc.h> #include <miiphy.h> diff --git a/drivers/net/sunxi_emac.c b/drivers/net/sunxi_emac.c index 9a5f7fd3c7bcbb80458b5746736f1f411017c745..a9874e4220d4d9cfe46e05442caa270c10837043 100644 --- a/drivers/net/sunxi_emac.c +++ b/drivers/net/sunxi_emac.c @@ -8,6 +8,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/err.h> #include <malloc.h> #include <miiphy.h> diff --git a/drivers/net/ti/am65-cpsw-nuss.c b/drivers/net/ti/am65-cpsw-nuss.c index 25904868102d3ee9d536f7ebb21b1df3f01caa6f..2b77213001f5a2d7c48bf1e05a9ee56fbad9928c 100644 --- a/drivers/net/ti/am65-cpsw-nuss.c +++ b/drivers/net/ti/am65-cpsw-nuss.c @@ -7,10 +7,12 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <asm/processor.h> #include <clk.h> #include <dm.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <dma-uclass.h> #include <dm/of_access.h> diff --git a/drivers/net/ti/cpsw-common.c b/drivers/net/ti/cpsw-common.c index 21b8bbda3d5b61cd900642c5c9cf0fc109c8a347..ca93edb70e3183ea1e58123bedb377d3beff8aa6 100644 --- a/drivers/net/ti/cpsw-common.c +++ b/drivers/net/ti/cpsw-common.c @@ -10,6 +10,7 @@ #include <fdt_support.h> #include <asm/io.h> #include <cpsw.h> +#include <dm/device_compat.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/net/ti/cpsw.c b/drivers/net/ti/cpsw.c index 57625623c262361f77c2231ff8ffa1134a45efa1..04b01a81298f578abae507768ac50cc9d1e8396e 100644 --- a/drivers/net/ti/cpsw.c +++ b/drivers/net/ti/cpsw.c @@ -14,6 +14,7 @@ #include <net.h> #include <netdev.h> #include <cpsw.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <asm/gpio.h> #include <asm/io.h> diff --git a/drivers/net/ti/cpsw_mdio.c b/drivers/net/ti/cpsw_mdio.c index 6e8f6520118f65c3c7d0e7d42fb5183ce8ae18da..1fa520be0f281105e801031150a1957913a552be 100644 --- a/drivers/net/ti/cpsw_mdio.c +++ b/drivers/net/ti/cpsw_mdio.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <miiphy.h> #include <wait_bit.h> diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index c3fe8e3c563f9b23380482203cf524adba430e3c..288037e2a0f5af01f2a2d216e0ef3382af6f26ac 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -25,6 +25,8 @@ #include <asm/system.h> #include <asm/arch/hardware.h> #include <asm/arch/sys_proto.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/errno.h> /* Bit/mask specification */ diff --git a/drivers/nvme/nvme.c b/drivers/nvme/nvme.c index 2593eb174bf190e9a65d4e42d900a9fb2aac12aa..ef4382da1a1f17f9d9ebebd52dbbc83dfceb178d 100644 --- a/drivers/nvme/nvme.c +++ b/drivers/nvme/nvme.c @@ -8,10 +8,12 @@ #include <cpu_func.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <memalign.h> #include <pci.h> #include <time.h> #include <dm/device-internal.h> +#include <linux/compat.h> #include "nvme.h" #define NVME_Q_DEPTH 2 diff --git a/drivers/pci/pci-aardvark.c b/drivers/pci/pci-aardvark.c index aa0b4bc84563743e11d0278ec3d12606ec432e82..d678e0b599c0c6511f63a665bd88681121af66d4 100644 --- a/drivers/pci/pci-aardvark.c +++ b/drivers/pci/pci-aardvark.c @@ -29,6 +29,7 @@ #include <pci.h> #include <asm/io.h> #include <asm-generic/gpio.h> +#include <dm/device_compat.h> #include <linux/ioport.h> /* PCIe core registers */ @@ -297,7 +298,7 @@ static int pcie_advk_check_pio_status(struct pcie_advk *pcie, * * Return: 0 on success */ -static int pcie_advk_read_config(struct udevice *bus, pci_dev_t bdf, +static int pcie_advk_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pci-emul-uclass.c b/drivers/pci/pci-emul-uclass.c index 0f63e491a79645614641e5c273e8f9f5a9a78e60..9486e1cb96e86daf5264c53e5ba76b035b53dcb3 100644 --- a/drivers/pci/pci-emul-uclass.c +++ b/drivers/pci/pci-emul-uclass.c @@ -15,7 +15,7 @@ struct sandbox_pci_emul_priv { int dev_count; }; -int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn, +int sandbox_pci_get_emul(const struct udevice *bus, pci_dev_t find_devfn, struct udevice **containerp, struct udevice **emulp) { struct pci_emul_uc_priv *upriv; diff --git a/drivers/pci/pci-rcar-gen2.c b/drivers/pci/pci-rcar-gen2.c index d913d53f3c3382dd3060a60021920190d010ac2d..014d8704788b3eaa3dc9778e3e89eb16ad5d65f6 100644 --- a/drivers/pci/pci-rcar-gen2.c +++ b/drivers/pci/pci-rcar-gen2.c @@ -107,7 +107,7 @@ static int rcar_gen2_pci_addr_valid(pci_dev_t d, uint offset) return 0; } -static u32 get_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset) +static u32 get_bus_address(const struct udevice *dev, pci_dev_t bdf, u32 offset) { struct rcar_gen2_pci_priv *priv = dev_get_priv(dev); @@ -126,7 +126,7 @@ static u32 setup_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset) return get_bus_address(dev, bdf, offset); } -static int rcar_gen2_pci_read_config(struct udevice *dev, pci_dev_t bdf, +static int rcar_gen2_pci_read_config(const struct udevice *dev, pci_dev_t bdf, uint offset, ulong *value, enum pci_size_t size) { diff --git a/drivers/pci/pci-rcar-gen3.c b/drivers/pci/pci-rcar-gen3.c index 52ca13b70cb2db30315ad9104aa9e4a4e80f729d..30eff67dca222d6c98e56da9e21dfae68ccfbcde 100644 --- a/drivers/pci/pci-rcar-gen3.c +++ b/drivers/pci/pci-rcar-gen3.c @@ -143,7 +143,7 @@ static void rcar_rmw32(struct udevice *dev, int where, u32 mask, u32 data) mask << shift, data << shift); } -static u32 rcar_read_conf(struct udevice *dev, int where) +static u32 rcar_read_conf(const struct udevice *dev, int where) { struct rcar_gen3_pcie_priv *priv = dev_get_platdata(dev); int shift = 8 * (where & 3); @@ -151,7 +151,7 @@ static u32 rcar_read_conf(struct udevice *dev, int where) return readl(priv->regs + (where & ~3)) >> shift; } -static int rcar_pcie_config_access(struct udevice *udev, +static int rcar_pcie_config_access(const struct udevice *udev, unsigned char access_type, pci_dev_t bdf, int where, ulong *data) { @@ -204,7 +204,7 @@ static int rcar_gen3_pcie_addr_valid(pci_dev_t d, uint where) return 0; } -static int rcar_gen3_pcie_read_config(struct udevice *dev, pci_dev_t bdf, +static int rcar_gen3_pcie_read_config(const struct udevice *dev, pci_dev_t bdf, uint where, ulong *val, enum pci_size_t size) { diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index 5be2dfd0bf64b19d633477d2bcbdeda6bc334fb0..e2882e3b634f777afb8a988c55c602d88f51c8a8 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <pci.h> #include <asm/io.h> #include <dm/device-internal.h> @@ -43,7 +44,7 @@ struct udevice *pci_get_controller(struct udevice *dev) return dev; } -pci_dev_t dm_pci_get_bdf(struct udevice *dev) +pci_dev_t dm_pci_get_bdf(const struct udevice *dev) { struct pci_child_platdata *pplat = dev_get_parent_platdata(dev); struct udevice *bus = dev->parent; @@ -124,7 +125,7 @@ static void pci_dev_find_ofnode(struct udevice *bus, phys_addr_t bdf, } }; -int pci_bus_find_devfn(struct udevice *bus, pci_dev_t find_devfn, +int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn, struct udevice **devp) { struct udevice *dev; @@ -349,7 +350,7 @@ int dm_pci_write_config32(struct udevice *dev, int offset, u32 value) return dm_pci_write_config(dev, offset, value, PCI_SIZE_32); } -int pci_bus_read_config(struct udevice *bus, pci_dev_t bdf, int offset, +int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset, unsigned long *valuep, enum pci_size_t size) { struct dm_pci_ops *ops; @@ -373,10 +374,10 @@ int pci_read_config(pci_dev_t bdf, int offset, unsigned long *valuep, return pci_bus_read_config(bus, bdf, offset, valuep, size); } -int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep, - enum pci_size_t size) +int dm_pci_read_config(const struct udevice *dev, int offset, + unsigned long *valuep, enum pci_size_t size) { - struct udevice *bus; + const struct udevice *bus; for (bus = dev; device_is_on_pci_bus(bus);) bus = bus->parent; @@ -423,7 +424,7 @@ int pci_read_config8(pci_dev_t bdf, int offset, u8 *valuep) return 0; } -int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep) +int dm_pci_read_config8(const struct udevice *dev, int offset, u8 *valuep) { unsigned long value; int ret; @@ -436,7 +437,7 @@ int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep) return 0; } -int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep) +int dm_pci_read_config16(const struct udevice *dev, int offset, u16 *valuep) { unsigned long value; int ret; @@ -449,7 +450,7 @@ int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep) return 0; } -int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep) +int dm_pci_read_config32(const struct udevice *dev, int offset, u32 *valuep) { unsigned long value; int ret; @@ -551,8 +552,9 @@ int pci_auto_config_devices(struct udevice *bus) } int pci_generic_mmap_write_config( - struct udevice *bus, - int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp), + const struct udevice *bus, + int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset, + void **addrp), pci_dev_t bdf, uint offset, ulong value, @@ -579,8 +581,9 @@ int pci_generic_mmap_write_config( } int pci_generic_mmap_read_config( - struct udevice *bus, - int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp), + const struct udevice *bus, + int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset, + void **addrp), pci_dev_t bdf, uint offset, ulong *valuep, @@ -1054,7 +1057,7 @@ static int pci_uclass_child_post_bind(struct udevice *dev) return 0; } -static int pci_bridge_read_config(struct udevice *bus, pci_dev_t bdf, +static int pci_bridge_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { @@ -1201,7 +1204,7 @@ int pci_get_regions(struct udevice *dev, struct pci_region **iop, return (*iop != NULL) + (*memp != NULL) + (*prefp != NULL); } -u32 dm_pci_read_bar32(struct udevice *dev, int barnum) +u32 dm_pci_read_bar32(const struct udevice *dev, int barnum) { u32 addr; int bar; diff --git a/drivers/pci/pci_mpc85xx.c b/drivers/pci/pci_mpc85xx.c index e58ab60ee04dc030b6c290903e8f1de3aa19a71e..8dff68dbd0e9df1823dd1e5a116c1126cd514af6 100644 --- a/drivers/pci/pci_mpc85xx.c +++ b/drivers/pci/pci_mpc85xx.c @@ -15,7 +15,7 @@ struct mpc85xx_pci_priv { void __iomem *cfg_data; }; -static int mpc85xx_pci_dm_read_config(struct udevice *dev, pci_dev_t bdf, +static int mpc85xx_pci_dm_read_config(const struct udevice *dev, pci_dev_t bdf, uint offset, ulong *value, enum pci_size_t size) { diff --git a/drivers/pci/pci_mvebu.c b/drivers/pci/pci_mvebu.c index f9b08f38a1516cd16601ca7a3f349ea97e137771..483a87db7dd621cffd4600dbda7d19db7e9dc165 100644 --- a/drivers/pci/pci_mvebu.c +++ b/drivers/pci/pci_mvebu.c @@ -11,6 +11,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/device-internal.h> #include <dm/lists.h> #include <dm/of_access.h> @@ -136,7 +137,7 @@ static inline struct mvebu_pcie *hose_to_pcie(struct pci_controller *hose) return container_of(hose, struct mvebu_pcie, hose); } -static int mvebu_pcie_read_config(struct udevice *bus, pci_dev_t bdf, +static int mvebu_pcie_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pci_sandbox.c b/drivers/pci/pci_sandbox.c index 2af2b79c05dc624e57c368b1dff91952533ca8b4..fa4c47659787e5b47ac20503ed8073f976a5e1f2 100644 --- a/drivers/pci/pci_sandbox.c +++ b/drivers/pci/pci_sandbox.c @@ -39,7 +39,7 @@ static int sandbox_pci_write_config(struct udevice *bus, pci_dev_t devfn, return ops->write_config(emul, offset, value, size); } -static int sandbox_pci_read_config(struct udevice *bus, pci_dev_t devfn, +static int sandbox_pci_read_config(const struct udevice *bus, pci_dev_t devfn, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pci_sh7751.c b/drivers/pci/pci_sh7751.c index 53e1668c99f060caf3a60b106f1d13e57b4b7708..2f48b9671934927b17786e8397fca5748398c2f7 100644 --- a/drivers/pci/pci_sh7751.c +++ b/drivers/pci/pci_sh7751.c @@ -80,12 +80,12 @@ static int sh7751_pci_addr_valid(pci_dev_t d, uint offset) return 0; } -static u32 get_bus_address(struct udevice *dev, pci_dev_t bdf, u32 offset) +static u32 get_bus_address(const struct udevice *dev, pci_dev_t bdf, u32 offset) { return BIT(31) | (PCI_DEV(bdf) << 8) | (offset & ~3); } -static int sh7751_pci_read_config(struct udevice *dev, pci_dev_t bdf, +static int sh7751_pci_read_config(const struct udevice *dev, pci_dev_t bdf, uint offset, ulong *value, enum pci_size_t size) { diff --git a/drivers/pci/pci_tegra.c b/drivers/pci/pci_tegra.c index 56c08585e6da54ae841af86b743f1e127cb80bd0..96d308f7bfd2462f5433b496036631eee616cc41 100644 --- a/drivers/pci/pci_tegra.c +++ b/drivers/pci/pci_tegra.c @@ -308,7 +308,7 @@ static int tegra_pcie_conf_address(struct tegra_pcie *pcie, pci_dev_t bdf, } } -static int pci_tegra_read_config(struct udevice *bus, pci_dev_t bdf, +static int pci_tegra_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pci_x86.c b/drivers/pci/pci_x86.c index e76a9c6e44fe50ddc4aff96d8bb52a383a31c3bf..8d036930e73b9e936285cf265f0ab834eb27e705 100644 --- a/drivers/pci/pci_x86.c +++ b/drivers/pci/pci_x86.c @@ -8,8 +8,9 @@ #include <pci.h> #include <asm/pci.h> -static int _pci_x86_read_config(struct udevice *bus, pci_dev_t bdf, uint offset, - ulong *valuep, enum pci_size_t size) +static int _pci_x86_read_config(const struct udevice *bus, pci_dev_t bdf, + uint offset, ulong *valuep, + enum pci_size_t size) { return pci_x86_read_config(bdf, offset, valuep, size); } diff --git a/drivers/pci/pcie_dw_mvebu.c b/drivers/pci/pcie_dw_mvebu.c index 693591e37502dc6f0ef52c48f1dae6ba95d60120..1f216e1c6803a1cbe2ee869cc4d487a062147a4e 100644 --- a/drivers/pci/pcie_dw_mvebu.c +++ b/drivers/pci/pcie_dw_mvebu.c @@ -240,7 +240,7 @@ static int pcie_dw_addr_valid(pci_dev_t d, int first_busno) * * Return: 0 on success */ -static int pcie_dw_mvebu_read_config(struct udevice *bus, pci_dev_t bdf, +static int pcie_dw_mvebu_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_dw_ti.c b/drivers/pci/pcie_dw_ti.c index b37fc2de7fb8184902037a074a8aa01b6aa28edd..f62264cbba752ddb968fb80e5c3db99e85134d23 100644 --- a/drivers/pci/pcie_dw_ti.c +++ b/drivers/pci/pcie_dw_ti.c @@ -12,6 +12,8 @@ #include <syscon.h> #include <asm/io.h> #include <asm-generic/gpio.h> +#include <dm/device_compat.h> +#include <linux/err.h> DECLARE_GLOBAL_DATA_PTR; @@ -289,7 +291,7 @@ static int pcie_dw_addr_valid(pci_dev_t d, int first_busno) * * Return: 0 on success */ -static int pcie_dw_ti_read_config(struct udevice *bus, pci_dev_t bdf, +static int pcie_dw_ti_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_ecam_generic.c b/drivers/pci/pcie_ecam_generic.c index 00644edd2646c3e844e7d3f2285efccf968d3ada..c875f3a5b7d2f5378d16420c04d21fc55a5a9c4a 100644 --- a/drivers/pci/pcie_ecam_generic.c +++ b/drivers/pci/pcie_ecam_generic.c @@ -35,8 +35,9 @@ struct generic_ecam_pcie { * code. Otherwise the address to access will be written to the pointer pointed * to by @paddress. */ -static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf, - uint offset, void **paddress) +static int pci_generic_ecam_conf_address(const struct udevice *bus, + pci_dev_t bdf, uint offset, + void **paddress) { struct generic_ecam_pcie *pcie = dev_get_priv(bus); void *addr; @@ -63,9 +64,9 @@ static int pci_generic_ecam_conf_address(struct udevice *bus, pci_dev_t bdf, * space of the device identified by the bus, device & function numbers in @bdf * on the PCI bus @bus. */ -static int pci_generic_ecam_read_config(struct udevice *bus, pci_dev_t bdf, - uint offset, ulong *valuep, - enum pci_size_t size) +static int pci_generic_ecam_read_config(const struct udevice *bus, + pci_dev_t bdf, uint offset, + ulong *valuep, enum pci_size_t size) { return pci_generic_mmap_read_config(bus, pci_generic_ecam_conf_address, bdf, offset, valuep, size); diff --git a/drivers/pci/pcie_fsl.c b/drivers/pci/pcie_fsl.c index ab25aeee731827c244a70ac800d78dc0fe50c34a..dc994b748ad532dd19ef0ca5e9eb7da3569b55ea 100644 --- a/drivers/pci/pcie_fsl.c +++ b/drivers/pci/pcie_fsl.c @@ -15,6 +15,7 @@ #include <asm/fsl_serdes.h> #include <asm/io.h> #include "pcie_fsl.h" +#include <dm/device_compat.h> LIST_HEAD(fsl_pcie_list); @@ -42,7 +43,7 @@ static int fsl_pcie_addr_valid(struct fsl_pcie *pcie, pci_dev_t bdf) return 0; } -static int fsl_pcie_read_config(struct udevice *bus, pci_dev_t bdf, +static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_imx.c b/drivers/pci/pcie_imx.c index 3621636cb28918da7f276655ad6323bcb47f89fc..f34a157902fc837acee71137eefbd9859895ac54 100644 --- a/drivers/pci/pcie_imx.c +++ b/drivers/pci/pcie_imx.c @@ -11,6 +11,7 @@ #include <common.h> #include <init.h> +#include <malloc.h> #include <pci.h> #include <asm/arch/clock.h> #include <asm/arch/iomux.h> @@ -748,7 +749,7 @@ void pci_init_board(void) imx_pcie_init(); } #else -static int imx_pcie_dm_read_config(struct udevice *dev, pci_dev_t bdf, +static int imx_pcie_dm_read_config(const struct udevice *dev, pci_dev_t bdf, uint offset, ulong *value, enum pci_size_t size) { diff --git a/drivers/pci/pcie_intel_fpga.c b/drivers/pci/pcie_intel_fpga.c index a5ea4888f344d4595730282c4b6f67542d8742a8..6a9f29c5c805b3a69c87506ab524e43feacdb437 100644 --- a/drivers/pci/pcie_intel_fpga.c +++ b/drivers/pci/pcie_intel_fpga.c @@ -10,6 +10,7 @@ #include <dm.h> #include <pci.h> #include <asm/io.h> +#include <dm/device_compat.h> #define RP_TX_REG0 0x2000 #define RP_TX_CNTRL 0x2004 @@ -226,7 +227,7 @@ static int tlp_cfg_dword_write(struct intel_fpga_pcie *pcie, pci_dev_t bdf, return tlp_read_packet(pcie, NULL); } -int intel_fpga_rp_conf_addr(struct udevice *bus, pci_dev_t bdf, +int intel_fpga_rp_conf_addr(const struct udevice *bus, pci_dev_t bdf, uint offset, void **paddress) { struct intel_fpga_pcie *pcie = dev_get_priv(bus); @@ -326,7 +327,7 @@ static int _pcie_intel_fpga_write_config(struct intel_fpga_pcie *pcie, byte_en, data); } -static int pcie_intel_fpga_read_config(struct udevice *bus, pci_dev_t bdf, +static int pcie_intel_fpga_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c index 2ab67d1fc954324213913a4674550ad15d567ecd..8b313e927861f5118113ac1ff9fceb1457dd81c7 100644 --- a/drivers/pci/pcie_layerscape.c +++ b/drivers/pci/pcie_layerscape.c @@ -243,7 +243,7 @@ static int ls_pcie_addr_valid(struct ls_pcie *pcie, pci_dev_t bdf) return 0; } -int ls_pcie_conf_address(struct udevice *bus, pci_dev_t bdf, +int ls_pcie_conf_address(const struct udevice *bus, pci_dev_t bdf, uint offset, void **paddress) { struct ls_pcie *pcie = dev_get_priv(bus); @@ -271,7 +271,7 @@ int ls_pcie_conf_address(struct udevice *bus, pci_dev_t bdf, return 0; } -static int ls_pcie_read_config(struct udevice *bus, pci_dev_t bdf, +static int ls_pcie_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_layerscape_gen4.c b/drivers/pci/pcie_layerscape_gen4.c index 1fd8761bbcc1aa615f6013ebb7c15995f8a53b66..cec61fa7d65552b9eb4e3bfac6e7affdf23dbc1f 100644 --- a/drivers/pci/pcie_layerscape_gen4.c +++ b/drivers/pci/pcie_layerscape_gen4.c @@ -227,7 +227,7 @@ void *ls_pcie_g4_conf_address(struct ls_pcie_g4 *pcie, pci_dev_t bdf, return pcie->cfg + offset; } -static int ls_pcie_g4_read_config(struct udevice *bus, pci_dev_t bdf, +static int ls_pcie_g4_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_mediatek.c b/drivers/pci/pcie_mediatek.c index a0dcb258b02a6b61a2e70f16aa74f2505d808e3f..d8a32d53f63289906645e3c6bf010314dafd79bc 100644 --- a/drivers/pci/pcie_mediatek.c +++ b/drivers/pci/pcie_mediatek.c @@ -11,9 +11,11 @@ #include <clk.h> #include <dm.h> #include <generic-phy.h> +#include <malloc.h> #include <pci.h> #include <reset.h> #include <asm/io.h> +#include <dm/devres.h> #include <linux/iopoll.h> #include <linux/list.h> @@ -66,7 +68,7 @@ struct mtk_pcie { struct list_head ports; }; -static int mtk_pcie_config_address(struct udevice *udev, pci_dev_t bdf, +static int mtk_pcie_config_address(const struct udevice *udev, pci_dev_t bdf, uint offset, void **paddress) { struct mtk_pcie *pcie = dev_get_priv(udev); @@ -77,7 +79,7 @@ static int mtk_pcie_config_address(struct udevice *udev, pci_dev_t bdf, return 0; } -static int mtk_pcie_read_config(struct udevice *bus, pci_dev_t bdf, +static int mtk_pcie_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_phytium.c b/drivers/pci/pcie_phytium.c index 92e281e7c2f7437dd2507ae1dae5efbaf56707dd..51b2171f9fa0039a137155df301cc16430c50cf8 100644 --- a/drivers/pci/pcie_phytium.c +++ b/drivers/pci/pcie_phytium.c @@ -75,9 +75,8 @@ static int phytium_pci_skip_dev(pci_dev_t parent) * code. Otherwise the address to access will be written to the pointer pointed * to by @paddress. */ -static int pci_phytium_conf_address(struct udevice *bus, pci_dev_t bdf, - uint offset, - void **paddress) +static int pci_phytium_conf_address(const struct udevice *bus, pci_dev_t bdf, + uint offset, void **paddress) { struct phytium_pcie *pcie = dev_get_priv(bus); void *addr; @@ -119,7 +118,7 @@ static int pci_phytium_conf_address(struct udevice *bus, pci_dev_t bdf, * space of the device identified by the bus, device & function numbers in @bdf * on the PCI bus @bus. */ -static int pci_phytium_read_config(struct udevice *bus, pci_dev_t bdf, +static int pci_phytium_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/pci/pcie_xilinx.c b/drivers/pci/pcie_xilinx.c index 44a5f1e1f4fc96d60021b4a193157ea61e27d92e..05787ae1448671de899a8ec1d6186da694ac222b 100644 --- a/drivers/pci/pcie_xilinx.c +++ b/drivers/pci/pcie_xilinx.c @@ -54,7 +54,7 @@ static bool pcie_xilinx_link_up(struct xilinx_pcie *pcie) * * Return: 0 on success, else -ENODEV */ -static int pcie_xilinx_config_address(struct udevice *udev, pci_dev_t bdf, +static int pcie_xilinx_config_address(const struct udevice *udev, pci_dev_t bdf, uint offset, void **paddress) { struct xilinx_pcie *pcie = dev_get_priv(udev); @@ -97,7 +97,7 @@ static int pcie_xilinx_config_address(struct udevice *udev, pci_dev_t bdf, * * Return: 0 on success, else -ENODEV or -EINVAL */ -static int pcie_xilinx_read_config(struct udevice *bus, pci_dev_t bdf, +static int pcie_xilinx_read_config(const struct udevice *bus, pci_dev_t bdf, uint offset, ulong *valuep, enum pci_size_t size) { diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index f7309057b9124ae6f7a185616110fa8eb98b3135..612c428cf56888bda0362ca2e6f7c8542378b4c5 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -21,6 +21,8 @@ #include <asm/io.h> #include <asm/arch/clock.h> #include <asm/arch/cpu.h> +#include <dm/device_compat.h> +#include <linux/err.h> #define REG_ISCR 0x00 #define REG_PHYCTL_A10 0x04 diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c index de055a3585f77280e3d4cf508638cd867d639565..2de343de290bfcc31cc586947a8c11b3e03d5833 100644 --- a/drivers/phy/bcm6318-usbh-phy.c +++ b/drivers/phy/bcm6318-usbh-phy.c @@ -11,6 +11,7 @@ #include <clk.h> #include <dm.h> #include <generic-phy.h> +#include <malloc.h> #include <power-domain.h> #include <reset.h> #include <asm/io.h> diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c index e7761e3b286ce4323a4cc818c1f705a2e2f285e6..ed9f02b375cf57ff8b0704fd3f3dbd10bf786806 100644 --- a/drivers/phy/bcm6348-usbh-phy.c +++ b/drivers/phy/bcm6348-usbh-phy.c @@ -11,6 +11,7 @@ #include <clk.h> #include <dm.h> #include <generic-phy.h> +#include <malloc.h> #include <reset.h> #include <asm/io.h> #include <dm/device.h> diff --git a/drivers/phy/bcm6358-usbh-phy.c b/drivers/phy/bcm6358-usbh-phy.c index 189a1c11d385251f383fe4534f4a4d16f75cf737..f0fda0290e9032cd4879752d81b69f69197f9031 100644 --- a/drivers/phy/bcm6358-usbh-phy.c +++ b/drivers/phy/bcm6358-usbh-phy.c @@ -10,6 +10,7 @@ #include <common.h> #include <dm.h> #include <generic-phy.h> +#include <malloc.h> #include <reset.h> #include <asm/io.h> #include <dm/device.h> diff --git a/drivers/phy/bcm6368-usbh-phy.c b/drivers/phy/bcm6368-usbh-phy.c index 99da97aa0cd106ab67904526e9de9eac342425e7..53d1f45bb96f933610d2bbacb7b0c9da44d438d1 100644 --- a/drivers/phy/bcm6368-usbh-phy.c +++ b/drivers/phy/bcm6368-usbh-phy.c @@ -11,6 +11,7 @@ #include <clk.h> #include <dm.h> #include <generic-phy.h> +#include <malloc.h> #include <power-domain.h> #include <reset.h> #include <asm/io.h> diff --git a/drivers/phy/marvell/comphy_core.c b/drivers/phy/marvell/comphy_core.c index 9c24692629bb3ff0288a0986586f4bf23afe5720..244beef18ddaaa252c5b9dc98d0a6bfb91620b7a 100644 --- a/drivers/phy/marvell/comphy_core.c +++ b/drivers/phy/marvell/comphy_core.c @@ -8,6 +8,8 @@ #include <common.h> #include <dm.h> #include <fdtdec.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/errno.h> #include <asm/io.h> diff --git a/drivers/phy/meson-g12a-usb2.c b/drivers/phy/meson-g12a-usb2.c index ad1a77fcfcaac35711143ae27590ae9cf5340a98..c23bc87d0f816faa1b5ffabaf3d91e38756fa75f 100644 --- a/drivers/phy/meson-g12a-usb2.c +++ b/drivers/phy/meson-g12a-usb2.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <bitfield.h> #include <dm.h> diff --git a/drivers/phy/meson-g12a-usb3-pcie.c b/drivers/phy/meson-g12a-usb3-pcie.c index 920675dc999518ac70c9f9f19818740bfff8624e..82655f26dd6e1a40efa2a11affb1ff6ee0729cd5 100644 --- a/drivers/phy/meson-g12a-usb3-pcie.c +++ b/drivers/phy/meson-g12a-usb3-pcie.c @@ -10,6 +10,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <regmap.h> #include <errno.h> #include <asm/io.h> diff --git a/drivers/phy/meson-gxl-usb2.c b/drivers/phy/meson-gxl-usb2.c index 86e69c73ba26ba5b487ea4ff7b189c7c88aeac73..c98d12b627da3da9910086d083d66d40e8eba9bc 100644 --- a/drivers/phy/meson-gxl-usb2.c +++ b/drivers/phy/meson-gxl-usb2.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <bitfield.h> #include <dm.h> diff --git a/drivers/phy/meson-gxl-usb3.c b/drivers/phy/meson-gxl-usb3.c index 5cbbd4d8f7ba49d03596cd112df15ebe6f921a9c..c2a8593b39f51518a3f7da8f7ee0ed741be6a134 100644 --- a/drivers/phy/meson-gxl-usb3.c +++ b/drivers/phy/meson-gxl-usb3.c @@ -8,6 +8,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <bitfield.h> #include <dm.h> diff --git a/drivers/phy/omap-usb2-phy.c b/drivers/phy/omap-usb2-phy.c index 923f2c105d678c651baa0e772a69f43bd0a16734..160a386801e902cc230e583cb39d074d9f8ed72f 100644 --- a/drivers/phy/omap-usb2-phy.c +++ b/drivers/phy/omap-usb2-phy.c @@ -13,6 +13,7 @@ #include <generic-phy.h> #include <regmap.h> #include <syscon.h> +#include <linux/err.h> #define OMAP_USB2_CALIBRATE_FALSE_DISCONNECT BIT(0) diff --git a/drivers/phy/phy-mtk-tphy.c b/drivers/phy/phy-mtk-tphy.c index fd33062ae4e32cc4699ea327bb7931adbfc186b5..bd089b7a435176f521952920a64f1cedc6cc69ce 100644 --- a/drivers/phy/phy-mtk-tphy.c +++ b/drivers/phy/phy-mtk-tphy.c @@ -9,8 +9,11 @@ #include <clk.h> #include <dm.h> #include <generic-phy.h> +#include <malloc.h> #include <mapmem.h> #include <asm/io.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dt-bindings/phy/phy.h> diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c index ee70b81d882a85279ec6787de3d71c59ef6d8298..e93130aee610abfc8d3192fffb956cc7822bda4c 100644 --- a/drivers/phy/phy-rcar-gen2.c +++ b/drivers/phy/phy-rcar-gen2.c @@ -11,10 +11,12 @@ #include <dm.h> #include <fdtdec.h> #include <generic-phy.h> +#include <malloc.h> #include <reset.h> #include <syscon.h> #include <usb.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/bitops.h> #include <power/regulator.h> diff --git a/drivers/phy/phy-rcar-gen3.c b/drivers/phy/phy-rcar-gen3.c index b662935626404c9422f0303f613aeddc4db8d303..ce39cd8f9e25076338b189d0a590db1e8f7f428e 100644 --- a/drivers/phy/phy-rcar-gen3.c +++ b/drivers/phy/phy-rcar-gen3.c @@ -11,6 +11,7 @@ #include <dm.h> #include <fdtdec.h> #include <generic-phy.h> +#include <malloc.h> #include <reset.h> #include <syscon.h> #include <usb.h> diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c index 6f1119036d787573bfab94ab803587087c238616..6ba37213cb8cd8413ab89f2d599b51ed368dd8d0 100644 --- a/drivers/phy/phy-stm32-usbphyc.c +++ b/drivers/phy/phy-stm32-usbphyc.c @@ -13,6 +13,7 @@ #include <syscon.h> #include <usb.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/bitops.h> #include <power/regulator.h> diff --git a/drivers/phy/phy-ti-am654.c b/drivers/phy/phy-ti-am654.c index 39490124eabf2a5fdabb3ef3b11e489978cc290e..0b2b2410b27ed77d05c1b763a995e63da6ddaf45 100644 --- a/drivers/phy/phy-ti-am654.c +++ b/drivers/phy/phy-ti-am654.c @@ -10,6 +10,7 @@ #include <clk-uclass.h> #include <dm.h> #include <dm/device.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <dt-bindings/phy/phy.h> #include <generic-phy.h> @@ -18,6 +19,7 @@ #include <power-domain.h> #include <regmap.h> #include <syscon.h> +#include <linux/err.h> #define CMU_R07C 0x7c #define CMU_MASTER_CDN_O BIT(24) diff --git a/drivers/phy/ti-pipe3-phy.c b/drivers/phy/ti-pipe3-phy.c index 0c59552bb86f9c189ac99713e889d1caf2098483..7fc36319cbad0650daee62b91812af9dcef8e742 100644 --- a/drivers/phy/ti-pipe3-phy.c +++ b/drivers/phy/ti-pipe3-phy.c @@ -12,6 +12,7 @@ #include <asm/arch/sys_proto.h> #include <syscon.h> #include <regmap.h> +#include <linux/err.h> /* PLLCTRL Registers */ #define PLL_STATUS 0x00000004 diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm6838.c b/drivers/pinctrl/broadcom/pinctrl-bcm6838.c index 48c0b6b3747c3b552ed8667b0e2ab50dbbdb83b5..6c8a990f57b057219eb71409298d2d915beb0fe8 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm6838.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm6838.c @@ -4,6 +4,7 @@ #include <dm.h> #include <regmap.h> #include <syscon.h> +#include <dm/device_compat.h> #include <dm/pinctrl.h> #define BCM6838_CMD_LOAD_MUX 0x21 diff --git a/drivers/pinctrl/intel/pinctrl.c b/drivers/pinctrl/intel/pinctrl.c index f4cc55aa3b4f6fd4cf888b525c12ae86e29d167c..e280054f94574ce2db198be4aca53dd17dd94727 100644 --- a/drivers/pinctrl/intel/pinctrl.c +++ b/drivers/pinctrl/intel/pinctrl.c @@ -19,6 +19,7 @@ #include <common.h> #include <dm.h> #include <irq.h> +#include <malloc.h> #include <p2sb.h> #include <spl.h> #include <asm-generic/gpio.h> @@ -28,6 +29,7 @@ #include <asm/itss.h> #include <dm/device-internal.h> #include <dt-bindings/gpio/gpio.h> +#include <linux/err.h> #define GPIO_DW_SIZE(x) (sizeof(u32) * (x)) #define PAD_CFG_OFFSET(x, dw_num) ((x) + GPIO_DW_SIZE(dw_num)) diff --git a/drivers/pinctrl/meson/pinctrl-meson.c b/drivers/pinctrl/meson/pinctrl-meson.c index f664d76b54ec4c9f1b879e43010d2d276929ceb7..7fbe2810a2923784faf275652571220c7b413a8e 100644 --- a/drivers/pinctrl/meson/pinctrl-meson.c +++ b/drivers/pinctrl/meson/pinctrl-meson.c @@ -5,7 +5,9 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <dm/pinctrl.h> #include <fdt_support.h> diff --git a/drivers/pinctrl/mscc/mscc-common.c b/drivers/pinctrl/mscc/mscc-common.c index bd3e6ea328c75ce69f686dc5d0cc5304633acf9e..90c54b45c3e345b7d0f3253a328a1a4525e5d7a5 100644 --- a/drivers/pinctrl/mscc/mscc-common.c +++ b/drivers/pinctrl/mscc/mscc-common.c @@ -14,6 +14,8 @@ #include <config.h> #include <dm.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/lists.h> #include <dm/pinctrl.h> #include <dm/root.h> diff --git a/drivers/pinctrl/mtmips/pinctrl-mtmips-common.c b/drivers/pinctrl/mtmips/pinctrl-mtmips-common.c index ee6a9d1fc80493b6560b1ade453ffe0bd51fd157..e361916eb2856a57cecee2008fa5b3dd069e3465 100644 --- a/drivers/pinctrl/mtmips/pinctrl-mtmips-common.c +++ b/drivers/pinctrl/mtmips/pinctrl-mtmips-common.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/pinctrl.h> #include <linux/io.h> diff --git a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c index f197f4a142923a07bc4b8ae80c7566241f172236..6e0bcae991282f683e740b45ac67bd1fea0e02d7 100644 --- a/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +++ b/drivers/pinctrl/mvebu/pinctrl-armada-37xx.c @@ -19,7 +19,10 @@ #include <common.h> #include <config.h> #include <dm.h> +#include <malloc.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/lists.h> #include <dm/pinctrl.h> #include <dm/root.h> diff --git a/drivers/pinctrl/nxp/pinctrl-imx.c b/drivers/pinctrl/nxp/pinctrl-imx.c index 69c4144365541d1481478bd991dbb02845951e9a..474c38a0497601c0aed35f178fbf951f10fa2321 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx.c +++ b/drivers/pinctrl/nxp/pinctrl-imx.c @@ -4,7 +4,10 @@ */ #include <common.h> +#include <malloc.h> #include <mapmem.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/io.h> #include <linux/err.h> #include <dm.h> diff --git a/drivers/pinctrl/nxp/pinctrl-mxs.c b/drivers/pinctrl/nxp/pinctrl-mxs.c index 6f6ca84674ab8c6287b76b0128921e1400d022f3..8d61dfe863941d807cf56be6f1b04407ba7c9d61 100644 --- a/drivers/pinctrl/nxp/pinctrl-mxs.c +++ b/drivers/pinctrl/nxp/pinctrl-mxs.c @@ -5,6 +5,8 @@ */ #include <common.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/io.h> #include <linux/err.h> #include <dm.h> diff --git a/drivers/pinctrl/pinctrl-generic.c b/drivers/pinctrl/pinctrl-generic.c index eecf0f5dc183b17470e76d122b23cf52d83d1fc8..1098366b5f4bb089051f2b05ed3614e952502657 100644 --- a/drivers/pinctrl/pinctrl-generic.c +++ b/drivers/pinctrl/pinctrl-generic.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/compat.h> #include <dm/pinctrl.h> diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index 1dfc97dceae5a4f3d9e1a09ed1d0c1966108aca1..380b0da27141588a9fd3b9020f1c4fc89582f65f 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <dm/device_compat.h> #include <dm/pinctrl.h> #include <linux/libfdt.h> #include <asm/io.h> diff --git a/drivers/pinctrl/pinctrl-stmfx.c b/drivers/pinctrl/pinctrl-stmfx.c index 0b5a0433cd03497b76f645bd87b8b3da15ecf43c..c8e61e2918d4d493e3894aec257e036f0fd023d9 100644 --- a/drivers/pinctrl/pinctrl-stmfx.c +++ b/drivers/pinctrl/pinctrl-stmfx.c @@ -11,6 +11,7 @@ #include <asm/gpio.h> #include <dm/device.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <dm/pinctrl.h> #include <linux/bitfield.h> diff --git a/drivers/pinctrl/pinctrl-uclass.c b/drivers/pinctrl/pinctrl-uclass.c index 3425ed11b16479942a807234d3eda92a861535ef..aba881047479849b95f5866b04f723a69791f0c7 100644 --- a/drivers/pinctrl/pinctrl-uclass.c +++ b/drivers/pinctrl/pinctrl-uclass.c @@ -4,6 +4,8 @@ */ #include <common.h> +#include <malloc.h> +#include <dm/device_compat.h> #include <linux/libfdt.h> #include <linux/err.h> #include <linux/list.h> diff --git a/drivers/pinctrl/pinctrl_stm32.c b/drivers/pinctrl/pinctrl_stm32.c index 3a235ae5a7c3c039a16dfdfd9307b81b5000e857..9926235b52e0067626e332cc3f2c0d272bfd698e 100644 --- a/drivers/pinctrl/pinctrl_stm32.c +++ b/drivers/pinctrl/pinctrl_stm32.c @@ -1,11 +1,14 @@ #include <common.h> #include <dm.h> #include <hwspinlock.h> +#include <malloc.h> #include <asm/arch/gpio.h> #include <asm/gpio.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <dm/pinctrl.h> +#include <linux/err.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/pinctrl/renesas/pfc.c b/drivers/pinctrl/renesas/pfc.c index 5ec560ec0f49088484ac199f1227756ccf2225aa..ab64f4f0c86796080fd19968b74591a88ec968c9 100644 --- a/drivers/pinctrl/renesas/pfc.c +++ b/drivers/pinctrl/renesas/pfc.c @@ -14,6 +14,8 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/pinctrl.h> #include <linux/io.h> #include <linux/sizes.h> diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c index a5935e84de3e15fa22bccd81a568da9d16e90468..abeba965c4996197ec159ec6c0a46ad6c468e24b 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/io.h> #include <linux/err.h> #include <linux/kernel.h> diff --git a/drivers/power/acpi_pmc/pmc_emul.c b/drivers/power/acpi_pmc/pmc_emul.c index 15cc7acaf33028f50b83a1624d240922c169f1bd..dfff335e54e29c0c4b8aaae415ed43488fba04dd 100644 --- a/drivers/power/acpi_pmc/pmc_emul.c +++ b/drivers/power/acpi_pmc/pmc_emul.c @@ -42,7 +42,7 @@ struct pmc_emul_priv { u8 regs[MEMMAP_SIZE]; }; -static int sandbox_pmc_emul_read_config(struct udevice *emul, uint offset, +static int sandbox_pmc_emul_read_config(const struct udevice *emul, uint offset, ulong *valuep, enum pci_size_t size) { struct pmc_emul_platdata *plat = dev_get_platdata(emul); diff --git a/drivers/power/domain/bcm6328-power-domain.c b/drivers/power/domain/bcm6328-power-domain.c index a90b2c83df8498a55f0ba93007f2b5863c52975e..a6426bee27f94599df2cbe731ec171b24d690158 100644 --- a/drivers/power/domain/bcm6328-power-domain.c +++ b/drivers/power/domain/bcm6328-power-domain.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <asm/io.h> @@ -62,7 +63,7 @@ static const struct udevice_id bcm6328_power_domain_ids[] = { }; struct power_domain_ops bcm6328_power_domain_ops = { - .free = bcm6328_power_domain_free, + .rfree = bcm6328_power_domain_free, .off = bcm6328_power_domain_off, .on = bcm6328_power_domain_on, .request = bcm6328_power_domain_request, diff --git a/drivers/power/domain/imx8-power-domain-legacy.c b/drivers/power/domain/imx8-power-domain-legacy.c index d51dbaa6c07b242336089533fd700602a2c8f708..6f01a60b3467a0765d2efc59317d289554a5030d 100644 --- a/drivers/power/domain/imx8-power-domain-legacy.c +++ b/drivers/power/domain/imx8-power-domain-legacy.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <asm/io.h> #include <asm/arch/power-domain.h> @@ -296,7 +297,7 @@ static const struct udevice_id imx8_power_domain_ids[] = { struct power_domain_ops imx8_power_domain_ops = { .request = imx8_power_domain_request, - .free = imx8_power_domain_free, + .rfree = imx8_power_domain_free, .on = imx8_power_domain_on, .off = imx8_power_domain_off, .of_xlate = imx8_power_domain_of_xlate, diff --git a/drivers/power/domain/imx8-power-domain.c b/drivers/power/domain/imx8-power-domain.c index aa768365b47eccba757cd00a994616d10d168b91..571146e19d2696c4ee8db64f30a9d952f9d96f8a 100644 --- a/drivers/power/domain/imx8-power-domain.c +++ b/drivers/power/domain/imx8-power-domain.c @@ -6,6 +6,7 @@ #define DEBUG #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <asm/arch/power-domain.h> #include <asm/arch/sci/sci.h> @@ -73,7 +74,7 @@ static const struct udevice_id imx8_power_domain_ids[] = { struct power_domain_ops imx8_power_domain_ops_v2 = { .request = imx8_power_domain_request, - .free = imx8_power_domain_free, + .rfree = imx8_power_domain_free, .on = imx8_power_domain_on, .off = imx8_power_domain_off, }; diff --git a/drivers/power/domain/imx8m-power-domain.c b/drivers/power/domain/imx8m-power-domain.c index 40ece9ee3fa7e6c645e6820e3eed261420bdd4f1..5b6467cda70ea11cc22f14362edcec50fa3565fc 100644 --- a/drivers/power/domain/imx8m-power-domain.c +++ b/drivers/power/domain/imx8m-power-domain.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <asm/io.h> #include <asm/arch/power-domain.h> @@ -121,7 +122,7 @@ static const struct udevice_id imx8m_power_domain_ids[] = { struct power_domain_ops imx8m_power_domain_ops = { .request = imx8m_power_domain_request, - .free = imx8m_power_domain_free, + .rfree = imx8m_power_domain_free, .on = imx8m_power_domain_on, .off = imx8m_power_domain_off, .of_xlate = imx8m_power_domain_of_xlate, diff --git a/drivers/power/domain/meson-ee-pwrc.c b/drivers/power/domain/meson-ee-pwrc.c index 21d4c9d4dd91779ff8684407b2d2aa8539e9305a..7082c80bfab09d4befc99b8a5571a6aa5082e000 100644 --- a/drivers/power/domain/meson-ee-pwrc.c +++ b/drivers/power/domain/meson-ee-pwrc.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <regmap.h> #include <syscon.h> @@ -13,6 +14,7 @@ #include <clk.h> #include <dt-bindings/power/meson-g12a-power.h> #include <dt-bindings/power/meson-sm1-power.h> +#include <linux/err.h> /* AO Offsets */ @@ -352,7 +354,7 @@ static int meson_ee_pwrc_of_xlate(struct power_domain *power_domain, } struct power_domain_ops meson_ee_pwrc_ops = { - .free = meson_ee_pwrc_free, + .rfree = meson_ee_pwrc_free, .off = meson_ee_pwrc_off, .on = meson_ee_pwrc_on, .request = meson_ee_pwrc_request, diff --git a/drivers/power/domain/meson-gx-pwrc-vpu.c b/drivers/power/domain/meson-gx-pwrc-vpu.c index f44e33bacb25e3ff98eca5d469fbe7dc49a676fa..12cdfcdd1f51c4b47711022ec7596a828237d251 100644 --- a/drivers/power/domain/meson-gx-pwrc-vpu.c +++ b/drivers/power/domain/meson-gx-pwrc-vpu.c @@ -8,11 +8,13 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <regmap.h> #include <syscon.h> #include <reset.h> #include <clk.h> +#include <linux/err.h> enum { VPU_PWRC_COMPATIBLE_GX = 0, @@ -269,7 +271,7 @@ static int meson_pwrc_vpu_of_xlate(struct power_domain *power_domain, } struct power_domain_ops meson_gx_pwrc_vpu_ops = { - .free = meson_pwrc_vpu_free, + .rfree = meson_pwrc_vpu_free, .off = meson_pwrc_vpu_off, .on = meson_pwrc_vpu_on, .request = meson_pwrc_vpu_request, diff --git a/drivers/power/domain/mtk-power-domain.c b/drivers/power/domain/mtk-power-domain.c index 0bf8a16447ba257ddb137e3aa6e465eecf4cd011..3ff7ca1befadada704108779c14a2fe5e28abde3 100644 --- a/drivers/power/domain/mtk-power-domain.c +++ b/drivers/power/domain/mtk-power-domain.c @@ -7,11 +7,13 @@ #include <clk.h> #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <regmap.h> #include <syscon.h> #include <asm/io.h> #include <asm/processor.h> +#include <linux/err.h> #include <linux/iopoll.h> #include <dt-bindings/power/mt7623-power.h> @@ -396,7 +398,7 @@ static const struct udevice_id mtk_power_domain_ids[] = { }; struct power_domain_ops mtk_power_domain_ops = { - .free = scpsys_power_free, + .rfree = scpsys_power_free, .off = scpsys_power_off, .on = scpsys_power_on, .request = scpsys_power_request, diff --git a/drivers/power/domain/power-domain-uclass.c b/drivers/power/domain/power-domain-uclass.c index 80df5aff5018b1280e5e1c3ffacd1aacd99a4b3f..d9c623b56e772cb9fea84519aebe1faaec02d510 100644 --- a/drivers/power/domain/power-domain-uclass.c +++ b/drivers/power/domain/power-domain-uclass.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain.h> #include <power-domain-uclass.h> #include <dm/device-internal.h> @@ -87,7 +88,7 @@ int power_domain_free(struct power_domain *power_domain) debug("%s(power_domain=%p)\n", __func__, power_domain); - return ops->free(power_domain); + return ops->rfree(power_domain); } int power_domain_on(struct power_domain *power_domain) diff --git a/drivers/power/domain/sandbox-power-domain-test.c b/drivers/power/domain/sandbox-power-domain-test.c index 148b6b1707d4696c70495e60a0983e5c6525cda8..2191a9414694f31b53ece4877c52ed9dc78ab54d 100644 --- a/drivers/power/domain/sandbox-power-domain-test.c +++ b/drivers/power/domain/sandbox-power-domain-test.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain.h> #include <asm/io.h> #include <asm/power-domain.h> diff --git a/drivers/power/domain/sandbox-power-domain.c b/drivers/power/domain/sandbox-power-domain.c index 74db2eba7e23cd3cadc9ade0f4c5987ba25fb8ed..3a834a9f1ee5fd658ad26497b9e19614d1e25e9b 100644 --- a/drivers/power/domain/sandbox-power-domain.c +++ b/drivers/power/domain/sandbox-power-domain.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <power-domain-uclass.h> #include <asm/io.h> #include <asm/power-domain.h> @@ -75,7 +76,7 @@ static const struct udevice_id sandbox_power_domain_ids[] = { struct power_domain_ops sandbox_power_domain_ops = { .request = sandbox_power_domain_request, - .free = sandbox_power_domain_free, + .rfree = sandbox_power_domain_free, .on = sandbox_power_domain_on, .off = sandbox_power_domain_off, }; diff --git a/drivers/power/domain/tegra186-power-domain.c b/drivers/power/domain/tegra186-power-domain.c index f3445582272818776da93ae958d3e395f2ef5544..e87244197f8fccc82fccfdaab0cd535e1010851d 100644 --- a/drivers/power/domain/tegra186-power-domain.c +++ b/drivers/power/domain/tegra186-power-domain.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <misc.h> #include <power-domain-uclass.h> #include <asm/arch-tegra/bpmp_abi.h> @@ -71,7 +72,7 @@ static int tegra186_power_domain_off(struct power_domain *power_domain) struct power_domain_ops tegra186_power_domain_ops = { .request = tegra186_power_domain_request, - .free = tegra186_power_domain_free, + .rfree = tegra186_power_domain_free, .on = tegra186_power_domain_on, .off = tegra186_power_domain_off, }; diff --git a/drivers/power/domain/ti-sci-power-domain.c b/drivers/power/domain/ti-sci-power-domain.c index 4c4351d2d9982909c62963f483b556acf823d424..a5866703ae37899d9a69d0d32d6cf72755ff8470 100644 --- a/drivers/power/domain/ti-sci-power-domain.c +++ b/drivers/power/domain/ti-sci-power-domain.c @@ -11,7 +11,10 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <power-domain-uclass.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/soc/ti/ti_sci_protocol.h> #include <dt-bindings/soc/ti,sci_pm_domain.h> @@ -120,7 +123,7 @@ static const struct udevice_id ti_sci_power_domain_of_match[] = { static struct power_domain_ops ti_sci_power_domain_ops = { .request = ti_sci_power_domain_request, - .free = ti_sci_power_domain_free, + .rfree = ti_sci_power_domain_free, .on = ti_sci_power_domain_on, .off = ti_sci_power_domain_off, .of_xlate = ti_sci_power_domain_of_xlate, diff --git a/drivers/power/pmic/fan53555.c b/drivers/power/pmic/fan53555.c index 11304d2146af436d5de47be9071c1e2f52a25b6c..a5f855ce2a3187470c33f727f825d8fee48233f9 100644 --- a/drivers/power/pmic/fan53555.c +++ b/drivers/power/pmic/fan53555.c @@ -6,6 +6,7 @@ #include <common.h> #include <dm.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <i2c.h> #include <power/fan53555.h> diff --git a/drivers/power/pmic/i2c_pmic_emul.c b/drivers/power/pmic/i2c_pmic_emul.c index 80efc0265d9fa8096b9ce3cf46baedd6e0175229..86d7b89b1f02e8032bf317432a4b3373027d1563 100644 --- a/drivers/power/pmic/i2c_pmic_emul.c +++ b/drivers/power/pmic/i2c_pmic_emul.c @@ -8,6 +8,7 @@ #include <errno.h> #include <dm.h> #include <i2c.h> +#include <malloc.h> #include <power/pmic.h> #include <power/sandbox_pmic.h> @@ -105,12 +106,21 @@ static int sandbox_i2c_pmic_ofdata_to_platdata(struct udevice *emul) { struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul); struct udevice *pmic_dev = i2c_emul_get_device(emul); - struct uc_pmic_priv *priv = dev_get_uclass_priv(pmic_dev); - const u8 *reg_defaults; debug("%s:%d Setting PMIC default registers\n", __func__, __LINE__); plat->reg_count = pmic_reg_count(pmic_dev); - plat->trans_len = priv->trans_len; + + return 0; +} + +static int sandbox_i2c_pmic_probe(struct udevice *emul) +{ + struct sandbox_i2c_pmic_plat_data *plat = dev_get_platdata(emul); + struct udevice *pmic_dev = i2c_emul_get_device(emul); + struct uc_pmic_priv *upriv = dev_get_uclass_priv(pmic_dev); + const u8 *reg_defaults; + + plat->trans_len = upriv->trans_len; plat->buf_size = plat->reg_count * plat->trans_len; plat->reg = calloc(1, plat->buf_size); @@ -149,6 +159,7 @@ U_BOOT_DRIVER(sandbox_i2c_pmic_emul) = { .id = UCLASS_I2C_EMUL, .of_match = sandbox_i2c_pmic_ids, .ofdata_to_platdata = sandbox_i2c_pmic_ofdata_to_platdata, + .probe = sandbox_i2c_pmic_probe, .platdata_auto_alloc_size = sizeof(struct sandbox_i2c_pmic_plat_data), .ops = &sandbox_i2c_pmic_emul_ops, }; diff --git a/drivers/power/pmic/stpmic1.c b/drivers/power/pmic/stpmic1.c index 2297af4157a4513fc631174cd4708026bd85f64b..2c85410b1bf539d33d9ed7d7ffe2419ef9b85727 100644 --- a/drivers/power/pmic/stpmic1.c +++ b/drivers/power/pmic/stpmic1.c @@ -11,6 +11,7 @@ #include <sysreset.h> #include <time.h> #include <dm/device.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <power/pmic.h> #include <power/stpmic1.h> diff --git a/drivers/power/regulator/pbias_regulator.c b/drivers/power/regulator/pbias_regulator.c index 88dc9f273aebed4db07729cc4a082d46c7d1bfe8..60255eeab02f72f8401d18310da03ca8eff3b0c9 100644 --- a/drivers/power/regulator/pbias_regulator.c +++ b/drivers/power/regulator/pbias_regulator.c @@ -7,6 +7,7 @@ #include <common.h> #include <errno.h> #include <dm.h> +#include <linux/err.h> #include <power/pmic.h> #include <power/regulator.h> #include <regmap.h> diff --git a/drivers/power/regulator/pwm_regulator.c b/drivers/power/regulator/pwm_regulator.c index cd05c9b6035dfd0d41e3bb5d04c2dcb7fea7ffca..4030144dd3618a544429809211c7e074c55eba08 100644 --- a/drivers/power/regulator/pwm_regulator.c +++ b/drivers/power/regulator/pwm_regulator.c @@ -11,6 +11,7 @@ #include <dm.h> #include <errno.h> #include <pwm.h> +#include <dm/device_compat.h> #include <power/regulator.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/power/regulator/stm32-vrefbuf.c b/drivers/power/regulator/stm32-vrefbuf.c index 645528e84e86a982ff9217dc9e8c7867f89bede4..08a10f05b412f3fdf89faa9dd3872d4cfbc4b097 100644 --- a/drivers/power/regulator/stm32-vrefbuf.c +++ b/drivers/power/regulator/stm32-vrefbuf.c @@ -10,6 +10,7 @@ #include <clk.h> #include <dm.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/iopoll.h> #include <linux/kernel.h> #include <power/regulator.h> diff --git a/drivers/power/regulator/tps62360_regulator.c b/drivers/power/regulator/tps62360_regulator.c index 2c076c0db5bf8c6cae6dd5288996df77dc4b675f..ce54495490d179513d8e1d925e55d6df7ff3f3a5 100644 --- a/drivers/power/regulator/tps62360_regulator.c +++ b/drivers/power/regulator/tps62360_regulator.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <i2c.h> +#include <dm/device_compat.h> #include <power/regulator.h> #define TPS62360_REG_SET0 0 diff --git a/drivers/ram/imxrt_sdram.c b/drivers/ram/imxrt_sdram.c index af7400be82a8efc8fcf10d3dc71a1aa0de10daea..ac15e94f008a98d7df861c403bae7154fe51bf7c 100644 --- a/drivers/ram/imxrt_sdram.c +++ b/drivers/ram/imxrt_sdram.c @@ -9,6 +9,7 @@ #include <dm.h> #include <ram.h> #include <asm/io.h> +#include <linux/err.h> /* SDRAM Command Code */ #define SD_CC_ARD 0x0 /* Master Bus (AXI) command - Read */ diff --git a/drivers/ram/k3-am654-ddrss.c b/drivers/ram/k3-am654-ddrss.c index 7015d8cfe72c970956c0d5e803388007e9269f49..8cf74861a8a4e8fa5b487eeceddeb4f45a344599 100644 --- a/drivers/ram/k3-am654-ddrss.c +++ b/drivers/ram/k3-am654-ddrss.c @@ -14,6 +14,7 @@ #include <power-domain.h> #include <dm.h> #include <asm/arch/sys_proto.h> +#include <dm/device_compat.h> #include <power/regulator.h> #include "k3-am654-ddrss.h" diff --git a/drivers/ram/k3-j721e/k3-j721e-ddrss.c b/drivers/ram/k3-j721e/k3-j721e-ddrss.c index a9b7d40890b3cc9c004f28a39b163a3ace82c23d..352483c4d7419519c70b1a34a56e0080fddd498b 100644 --- a/drivers/ram/k3-j721e/k3-j721e-ddrss.c +++ b/drivers/ram/k3-j721e/k3-j721e-ddrss.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <power-domain.h> #include <wait_bit.h> +#include <dm/device_compat.h> #include "lpddr4_obj_if.h" #include "lpddr4_if.h" diff --git a/drivers/ram/rockchip/dmc-rk3368.c b/drivers/ram/rockchip/dmc-rk3368.c index 8addee8cc30e03d39e61a5f1f378373c2e39e466..2d82a176db7c569b70927edfb27bd296a3e3f722 100644 --- a/drivers/ram/rockchip/dmc-rk3368.c +++ b/drivers/ram/rockchip/dmc-rk3368.c @@ -19,6 +19,7 @@ #include <asm/arch-rockchip/ddr_rk3368.h> #include <asm/arch-rockchip/sdram.h> #include <asm/arch-rockchip/sdram_rk3288.h> +#include <linux/err.h> struct dram_info { struct ram_info info; diff --git a/drivers/ram/stm32_sdram.c b/drivers/ram/stm32_sdram.c index f6cac8eb90bfd542f70b07862a1e6e07808befb4..2d03333b1b6dcd1646a31cd37556c7f6072dbb00 100644 --- a/drivers/ram/stm32_sdram.c +++ b/drivers/ram/stm32_sdram.c @@ -9,6 +9,7 @@ #include <dm.h> #include <ram.h> #include <asm/io.h> +#include <dm/device_compat.h> #define MEM_MODE_MASK GENMASK(2, 0) #define SWP_FMC_OFFSET 10 diff --git a/drivers/remoteproc/k3_system_controller.c b/drivers/remoteproc/k3_system_controller.c index 44e56c759fb0b849e3edefdac764b877b660a420..88430299c9281ea5703df6421958b5494658e669 100644 --- a/drivers/remoteproc/k3_system_controller.c +++ b/drivers/remoteproc/k3_system_controller.c @@ -11,6 +11,7 @@ #include <remoteproc.h> #include <errno.h> #include <mailbox.h> +#include <dm/device_compat.h> #include <linux/soc/ti/k3-sec-proxy.h> #define K3_MSG_R5_TO_M3_M3FW 0x8105 diff --git a/drivers/remoteproc/rproc-elf-loader.c b/drivers/remoteproc/rproc-elf-loader.c index d2345924452e4dbcfd915773381503c11bca6e61..f2e033aa741e14f83d8e33d4bfffbc9c5eba8d59 100644 --- a/drivers/remoteproc/rproc-elf-loader.c +++ b/drivers/remoteproc/rproc-elf-loader.c @@ -7,6 +7,8 @@ #include <dm.h> #include <elf.h> #include <remoteproc.h> +#include <dm/device_compat.h> +#include <linux/compat.h> /** * struct resource_table - firmware resource table header diff --git a/drivers/remoteproc/stm32_copro.c b/drivers/remoteproc/stm32_copro.c index c25488f54d543636330b8197539608ad47305358..e9dce0d173a14f559910f0d9f47880c8f1510b46 100644 --- a/drivers/remoteproc/stm32_copro.c +++ b/drivers/remoteproc/stm32_copro.c @@ -12,6 +12,8 @@ #include <reset.h> #include <syscon.h> #include <asm/io.h> +#include <dm/device_compat.h> +#include <linux/err.h> #define RCC_GCR_HOLD_BOOT 0 #define RCC_GCR_RELEASE_BOOT 1 diff --git a/drivers/remoteproc/ti_k3_arm64_rproc.c b/drivers/remoteproc/ti_k3_arm64_rproc.c index 3e35293514ed6ffa287dc601b962cbfce24da4d8..28c6ddb691913d98a3a18802a88a213e7777d888 100644 --- a/drivers/remoteproc/ti_k3_arm64_rproc.c +++ b/drivers/remoteproc/ti_k3_arm64_rproc.c @@ -15,6 +15,8 @@ #include <reset.h> #include <asm/io.h> #include <power-domain.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/soc/ti/ti_sci_protocol.h> #include "ti_sci_proc.h" diff --git a/drivers/remoteproc/ti_k3_dsp_rproc.c b/drivers/remoteproc/ti_k3_dsp_rproc.c index c5dc6b25da89126f1e311aff147fe9da18821a8a..09e050ffb2d3ab76f49ce8b7fd8da60c61b4b14c 100644 --- a/drivers/remoteproc/ti_k3_dsp_rproc.c +++ b/drivers/remoteproc/ti_k3_dsp_rproc.c @@ -9,12 +9,15 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <remoteproc.h> #include <errno.h> #include <clk.h> #include <reset.h> #include <asm/io.h> #include <power-domain.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/soc/ti/ti_sci_protocol.h> #include "ti_sci_proc.h" diff --git a/drivers/remoteproc/ti_k3_r5f_rproc.c b/drivers/remoteproc/ti_k3_r5f_rproc.c index ae1e4b9e04f18e4d9c63019d2ba675ba89ee60b3..ea56689552aa6cf1ee6ad061fba512a1d77c7493 100644 --- a/drivers/remoteproc/ti_k3_r5f_rproc.c +++ b/drivers/remoteproc/ti_k3_r5f_rproc.c @@ -8,11 +8,14 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <remoteproc.h> #include <errno.h> #include <clk.h> #include <reset.h> #include <asm/io.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/kernel.h> #include <linux/soc/ti/ti_sci_protocol.h> #include "ti_sci_proc.h" diff --git a/drivers/reset/reset-bcm6345.c b/drivers/reset/reset-bcm6345.c index 753c1108a9605fda275d491ef2f4bc519daabec5..c1f1e7f70bf4fa5aefbb9839f8e153047b31ac0d 100644 --- a/drivers/reset/reset-bcm6345.c +++ b/drivers/reset/reset-bcm6345.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <reset-uclass.h> #include <asm/io.h> @@ -52,7 +53,7 @@ static int bcm6345_reset_request(struct reset_ctl *rst) } struct reset_ops bcm6345_reset_reset_ops = { - .free = bcm6345_reset_free, + .rfree = bcm6345_reset_free, .request = bcm6345_reset_request, .rst_assert = bcm6345_reset_assert, .rst_deassert = bcm6345_reset_deassert, diff --git a/drivers/reset/reset-hisilicon.c b/drivers/reset/reset-hisilicon.c index a9f052a0c56e7014d3ff211b2cfcad19bbe42c01..a678b8f745696719df6566fa249791accdfd89a6 100644 --- a/drivers/reset/reset-hisilicon.c +++ b/drivers/reset/reset-hisilicon.c @@ -3,6 +3,7 @@ * Copyright (c) 2019, Linaro Limited */ +#include <malloc.h> #include <asm/io.h> #include <common.h> #include <dm.h> @@ -72,7 +73,7 @@ static int hisi_reset_of_xlate(struct reset_ctl *rst, static const struct reset_ops hisi_reset_reset_ops = { .of_xlate = hisi_reset_of_xlate, .request = hisi_reset_request, - .free = hisi_reset_free, + .rfree = hisi_reset_free, .rst_assert = hisi_reset_assert, .rst_deassert = hisi_reset_deassert, }; diff --git a/drivers/reset/reset-hsdk.c b/drivers/reset/reset-hsdk.c index 213d6c87be189f8ccfce16e3ae17bf32a344ceab..f9a432a7a2c3a6ccf59614cad1e74cb9fde99e37 100644 --- a/drivers/reset/reset-hsdk.c +++ b/drivers/reset/reset-hsdk.c @@ -81,7 +81,7 @@ static int hsdk_reset_noop(struct reset_ctl *rst_ctl) static const struct reset_ops hsdk_reset_ops = { .request = hsdk_reset_noop, - .free = hsdk_reset_noop, + .rfree = hsdk_reset_noop, .rst_assert = hsdk_reset_noop, .rst_deassert = hsdk_reset_reset, }; diff --git a/drivers/reset/reset-imx7.c b/drivers/reset/reset-imx7.c index f2ca5cf80152264f74563367e1f015c3e8d3a717..a61855e9edfd6c50046a4e280ad4a13e9410887a 100644 --- a/drivers/reset/reset-imx7.c +++ b/drivers/reset/reset-imx7.c @@ -3,6 +3,7 @@ * Copyright (c) 2017, Impinj, Inc. */ +#include <malloc.h> #include <asm/io.h> #include <common.h> #include <dm.h> @@ -272,7 +273,7 @@ static int imx7_reset_request(struct reset_ctl *rst) static const struct reset_ops imx7_reset_reset_ops = { .request = imx7_reset_request, - .free = imx7_reset_free, + .rfree = imx7_reset_free, .rst_assert = imx7_reset_assert, .rst_deassert = imx7_reset_deassert, }; diff --git a/drivers/reset/reset-mediatek.c b/drivers/reset/reset-mediatek.c index e3614e6e2aef13e9cddbb779983b1fe4a4a21c80..6d17f52ac78b6de7ee249de58923dae757d56a1e 100644 --- a/drivers/reset/reset-mediatek.c +++ b/drivers/reset/reset-mediatek.c @@ -8,10 +8,12 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/lists.h> #include <regmap.h> #include <reset-uclass.h> #include <syscon.h> +#include <linux/err.h> struct mediatek_reset_priv { struct regmap *regmap; @@ -55,7 +57,7 @@ static int mediatek_reset_deassert(struct reset_ctl *reset_ctl) struct reset_ops mediatek_reset_ops = { .request = mediatek_reset_request, - .free = mediatek_reset_free, + .rfree = mediatek_reset_free, .rst_assert = mediatek_reset_assert, .rst_deassert = mediatek_reset_deassert, }; diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 31aa4d41e8d6d4a54c113d5eb7fc1ac538cc68d4..70f96355b376aed6564c09b7302cc2daf40893b1 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <reset-uclass.h> #include <regmap.h> @@ -62,7 +63,7 @@ static int meson_reset_deassert(struct reset_ctl *reset_ctl) struct reset_ops meson_reset_ops = { .request = meson_reset_request, - .free = meson_reset_free, + .rfree = meson_reset_free, .rst_assert = meson_reset_assert, .rst_deassert = meson_reset_deassert, }; diff --git a/drivers/reset/reset-mtmips.c b/drivers/reset/reset-mtmips.c index 59734565d779bccc9d877f6b1883ce5a16f21ebc..677de0a6f91bf0bded4f4c96795ae23164561c84 100644 --- a/drivers/reset/reset-mtmips.c +++ b/drivers/reset/reset-mtmips.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <reset-uclass.h> #include <linux/io.h> @@ -45,7 +46,7 @@ static int mtmips_reset_deassert(struct reset_ctl *reset_ctl) static const struct reset_ops mtmips_reset_ops = { .request = mtmips_reset_request, - .free = mtmips_reset_free, + .rfree = mtmips_reset_free, .rst_assert = mtmips_reset_assert, .rst_deassert = mtmips_reset_deassert, }; diff --git a/drivers/reset/reset-rockchip.c b/drivers/reset/reset-rockchip.c index 3871fc00d0743e33eab7533bae2807c2f5b2ef95..100afc8103b7e3ff838880a146dc764fd6e02e48 100644 --- a/drivers/reset/reset-rockchip.c +++ b/drivers/reset/reset-rockchip.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <reset-uclass.h> #include <linux/io.h> #include <asm/arch-rockchip/hardware.h> @@ -76,7 +77,7 @@ static int rockchip_reset_deassert(struct reset_ctl *reset_ctl) struct reset_ops rockchip_reset_ops = { .request = rockchip_reset_request, - .free = rockchip_reset_free, + .rfree = rockchip_reset_free, .rst_assert = rockchip_reset_assert, .rst_deassert = rockchip_reset_deassert, }; diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c index 105ce94c71a3752e3af367a980a4bd5549c0f62a..c0930a624b73a4559dfb6cce000dd0ebce00e74a 100644 --- a/drivers/reset/reset-socfpga.c +++ b/drivers/reset/reset-socfpga.c @@ -14,6 +14,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/lists.h> #include <dm/of_access.h> #include <env.h> @@ -105,7 +106,7 @@ static int socfpga_reset_free(struct reset_ctl *reset_ctl) static const struct reset_ops socfpga_reset_ops = { .request = socfpga_reset_request, - .free = socfpga_reset_free, + .rfree = socfpga_reset_free, .rst_assert = socfpga_reset_assert, .rst_deassert = socfpga_reset_deassert, }; diff --git a/drivers/reset/reset-sunxi.c b/drivers/reset/reset-sunxi.c index 364dc52fb74d6cb6612c120b653a57f6b0b42f96..f21bf3b1ae0813fa22940672d30d0549b90a00a1 100644 --- a/drivers/reset/reset-sunxi.c +++ b/drivers/reset/reset-sunxi.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <reset-uclass.h> #include <asm/io.h> #include <dm/lists.h> @@ -81,7 +82,7 @@ static int sunxi_reset_deassert(struct reset_ctl *reset_ctl) struct reset_ops sunxi_reset_ops = { .request = sunxi_reset_request, - .free = sunxi_reset_free, + .rfree = sunxi_reset_free, .rst_assert = sunxi_reset_assert, .rst_deassert = sunxi_reset_deassert, }; diff --git a/drivers/reset/reset-ti-sci.c b/drivers/reset/reset-ti-sci.c index c8a76dfb045fc875f83da091dad003215125ca51..f5d82b56810b22f985d976f3b46278df948eb206 100644 --- a/drivers/reset/reset-ti-sci.c +++ b/drivers/reset/reset-ti-sci.c @@ -11,7 +11,10 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <reset-uclass.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/soc/ti/ti_sci_protocol.h> /** @@ -190,7 +193,7 @@ static const struct udevice_id ti_sci_reset_of_match[] = { static struct reset_ops ti_sci_reset_ops = { .of_xlate = ti_sci_reset_of_xlate, .request = ti_sci_reset_request, - .free = ti_sci_reset_free, + .rfree = ti_sci_reset_free, .rst_assert = ti_sci_reset_assert, .rst_deassert = ti_sci_reset_deassert, .rst_status = ti_sci_reset_status, diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c index ee1a423ffbc8f534bae753196b6bc321ae426a76..8ec8e462e62ddf94c191b74621d06b552869c59a 100644 --- a/drivers/reset/reset-uclass.c +++ b/drivers/reset/reset-uclass.c @@ -6,8 +6,10 @@ #include <common.h> #include <dm.h> #include <fdtdec.h> +#include <malloc.h> #include <reset.h> #include <reset-uclass.h> +#include <dm/devres.h> static inline struct reset_ops *reset_dev_ops(struct udevice *dev) { @@ -164,7 +166,7 @@ int reset_free(struct reset_ctl *reset_ctl) debug("%s(reset_ctl=%p)\n", __func__, reset_ctl); - return ops->free(reset_ctl); + return ops->rfree(reset_ctl); } int reset_assert(struct reset_ctl *reset_ctl) diff --git a/drivers/reset/reset-uniphier.c b/drivers/reset/reset-uniphier.c index 39d684be4a18c1052daf9797d4a598569f1081fe..348f3886d1046310fbe3d85567ddbeaad620db68 100644 --- a/drivers/reset/reset-uniphier.c +++ b/drivers/reset/reset-uniphier.c @@ -6,7 +6,9 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <reset-uclass.h> +#include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/io.h> #include <linux/sizes.h> @@ -234,7 +236,7 @@ static int uniphier_reset_deassert(struct reset_ctl *reset_ctl) static const struct reset_ops uniphier_reset_ops = { .request = uniphier_reset_request, - .free = uniphier_reset_free, + .rfree = uniphier_reset_free, .rst_assert = uniphier_reset_assert, .rst_deassert = uniphier_reset_deassert, }; diff --git a/drivers/reset/sandbox-reset-test.c b/drivers/reset/sandbox-reset-test.c index 95ce2ca1171fede219e280a8a4d6d40e40689c84..ae79be0730dab90b4624f567d34f77adc5a3c1cf 100644 --- a/drivers/reset/sandbox-reset-test.c +++ b/drivers/reset/sandbox-reset-test.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <reset.h> #include <asm/io.h> #include <asm/reset.h> diff --git a/drivers/reset/sandbox-reset.c b/drivers/reset/sandbox-reset.c index 40f2654d8e437cbbc1e60b8adcb55ce060a3ad5a..bdf53a3de9f8a3c9da6a7ace481a6d707c869ef7 100644 --- a/drivers/reset/sandbox-reset.c +++ b/drivers/reset/sandbox-reset.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <reset-uclass.h> #include <asm/io.h> #include <asm/reset.h> @@ -79,7 +80,7 @@ static const struct udevice_id sandbox_reset_ids[] = { struct reset_ops sandbox_reset_reset_ops = { .request = sandbox_reset_request, - .free = sandbox_reset_free, + .rfree = sandbox_reset_free, .rst_assert = sandbox_reset_assert, .rst_deassert = sandbox_reset_deassert, }; diff --git a/drivers/reset/sti-reset.c b/drivers/reset/sti-reset.c index d8cc485ce6a544756bba3659ad8c79aabff42a8d..31b3e48e0e9eed16e8e2a7eed8e7fb67657a6a37 100644 --- a/drivers/reset/sti-reset.c +++ b/drivers/reset/sti-reset.c @@ -6,6 +6,7 @@ #include <common.h> #include <errno.h> +#include <malloc.h> #include <wait_bit.h> #include <dm.h> #include <reset-uclass.h> @@ -298,7 +299,7 @@ static int sti_reset_deassert(struct reset_ctl *reset_ctl) struct reset_ops sti_reset_ops = { .request = sti_reset_request, - .free = sti_reset_free, + .rfree = sti_reset_free, .rst_assert = sti_reset_assert, .rst_deassert = sti_reset_deassert, }; diff --git a/drivers/reset/stm32-reset.c b/drivers/reset/stm32-reset.c index 16d3dba749421ab40f1593e091c40fbbb611439b..5dda522a4eb7fedab2238a4312a9e235812915c1 100644 --- a/drivers/reset/stm32-reset.c +++ b/drivers/reset/stm32-reset.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <reset-uclass.h> #include <stm32_rcc.h> #include <asm/io.h> @@ -64,7 +65,7 @@ static int stm32_reset_deassert(struct reset_ctl *reset_ctl) static const struct reset_ops stm32_reset_ops = { .request = stm32_reset_request, - .free = stm32_reset_free, + .rfree = stm32_reset_free, .rst_assert = stm32_reset_assert, .rst_deassert = stm32_reset_deassert, }; diff --git a/drivers/reset/tegra-car-reset.c b/drivers/reset/tegra-car-reset.c index 25947822f1e8d7206ba4cc0ef9bacfdc97f9c39a..23c6facff27cb14bcdb92fd058dff48e6fccd34f 100644 --- a/drivers/reset/tegra-car-reset.c +++ b/drivers/reset/tegra-car-reset.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <reset-uclass.h> #include <asm/arch/clock.h> #include <asm/arch-tegra/clk_rst.h> @@ -51,7 +52,7 @@ static int tegra_car_reset_deassert(struct reset_ctl *reset_ctl) struct reset_ops tegra_car_reset_ops = { .request = tegra_car_reset_request, - .free = tegra_car_reset_free, + .rfree = tegra_car_reset_free, .rst_assert = tegra_car_reset_assert, .rst_deassert = tegra_car_reset_deassert, }; diff --git a/drivers/reset/tegra186-reset.c b/drivers/reset/tegra186-reset.c index 9927c063c3252796598b857da2cd57b7d60557ec..e85f42b3a3461dcbaf0d1cebd101aad39c3054b5 100644 --- a/drivers/reset/tegra186-reset.c +++ b/drivers/reset/tegra186-reset.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <misc.h> #include <reset-uclass.h> #include <asm/arch-tegra/bpmp_abi.h> @@ -60,7 +61,7 @@ static int tegra186_reset_deassert(struct reset_ctl *reset_ctl) struct reset_ops tegra186_reset_ops = { .request = tegra186_reset_request, - .free = tegra186_reset_free, + .rfree = tegra186_reset_free, .rst_assert = tegra186_reset_assert, .rst_deassert = tegra186_reset_deassert, }; diff --git a/drivers/rtc/ds3232.c b/drivers/rtc/ds3232.c index 09a106aa4e9ecc2e1289a6288e94b932d116ccfb..e3b3579c4aad8f8f4f052162572fd0f4f6e0f806 100644 --- a/drivers/rtc/ds3232.c +++ b/drivers/rtc/ds3232.c @@ -8,6 +8,7 @@ #include <dm.h> #include <i2c.h> #include <rtc.h> +#include <dm/device_compat.h> /* * RTC register addresses diff --git a/drivers/rtc/rv3029.c b/drivers/rtc/rv3029.c index 23670627770af714e96048eca8705b95ec5847a2..87c4320d5f4f8cc07233d5d750ea47161783432d 100644 --- a/drivers/rtc/rv3029.c +++ b/drivers/rtc/rv3029.c @@ -13,6 +13,7 @@ #include <eeprom.h> #include <i2c.h> #include <rtc.h> +#include <dm/device_compat.h> #define RTC_RV3029_PAGE_LEN 7 diff --git a/drivers/rtc/stm32_rtc.c b/drivers/rtc/stm32_rtc.c index 26747144425fcae995016a85cb424be913bac704..3e12f57ce0b7ba819f5ce1bb8edd635ee282ba4c 100644 --- a/drivers/rtc/stm32_rtc.c +++ b/drivers/rtc/stm32_rtc.c @@ -5,8 +5,10 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <rtc.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/iopoll.h> #define STM32_RTC_TR 0x00 diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index c450a4e08a3dc3f33c15a07829c22fd4950e083b..98d209072d1f4b9efb109c1a06b362ff954f35d4 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -9,6 +9,7 @@ #include <clk.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <watchdog.h> #include <serial.h> #include <debug_uart.h> diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index 31f6cfe421c26e6e59b7301096a3525779b422dc..1fcbc3501545afed38a1d87721831cc035230256 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -13,6 +13,7 @@ #include <reset.h> #include <serial.h> #include <watchdog.h> +#include <linux/err.h> #include <linux/types.h> #include <asm/io.h> diff --git a/drivers/serial/serial-uclass.c b/drivers/serial/serial-uclass.c index 0f5f1fa4068cfe719000ee9e74916a729318f1fb..30f9b8c9394e9a3236e6ec87251fa955b5171554 100644 --- a/drivers/serial/serial-uclass.c +++ b/drivers/serial/serial-uclass.c @@ -7,6 +7,7 @@ #include <dm.h> #include <env_internal.h> #include <errno.h> +#include <malloc.h> #include <os.h> #include <serial.h> #include <stdio_dev.h> diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c index 9ad8c770d51e23084df21c192af2c4ead6b35a4e..5b963ce45bc0a1f6341f11d686f2bc6acc80f460 100644 --- a/drivers/serial/serial_bcm6345.c +++ b/drivers/serial/serial_bcm6345.c @@ -10,6 +10,7 @@ #include <dm.h> #include <debug_uart.h> #include <errno.h> +#include <malloc.h> #include <serial.h> #include <asm/io.h> #include <asm/types.h> diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c index ccb3ce6701abf35a4a5ff7cabd2e95665ecc3c50..d7907a228fec935218ec3e005a62c52dab27d35f 100644 --- a/drivers/serial/serial_lpuart.c +++ b/drivers/serial/serial_lpuart.c @@ -11,6 +11,7 @@ #include <watchdog.h> #include <asm/io.h> #include <serial.h> +#include <dm/device_compat.h> #include <linux/compiler.h> #include <asm/arch/imx-regs.h> #include <asm/arch/clock.h> diff --git a/drivers/serial/serial_msm.c b/drivers/serial/serial_msm.c index c462394dbdcd22b82b6b240ee84e50aef1b1a83e..0cc1aadce4a5b677b5137995059850cb8f4984fc 100644 --- a/drivers/serial/serial_msm.c +++ b/drivers/serial/serial_msm.c @@ -12,6 +12,7 @@ #include <clk.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <serial.h> #include <watchdog.h> #include <asm/io.h> diff --git a/drivers/serial/serial_mtk.c b/drivers/serial/serial_mtk.c index 18530a4fd15e27b7e5e305b82d59cdc222914bd6..e63f2306f0340ae95652e6f17555a6888b90577d 100644 --- a/drivers/serial/serial_mtk.c +++ b/drivers/serial/serial_mtk.c @@ -15,6 +15,7 @@ #include <watchdog.h> #include <asm/io.h> #include <asm/types.h> +#include <linux/err.h> struct mtk_serial_regs { u32 rbr; @@ -454,4 +455,4 @@ static inline void _debug_uart_putc(int ch) DEBUG_UART_FUNCS -#endif \ No newline at end of file +#endif diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c index a31d73766dd1def368649156f599ad85fe87f825..4d4d919358616c7f337993526a6b8cef7b8ec7c9 100644 --- a/drivers/serial/serial_omap.c +++ b/drivers/serial/serial_omap.c @@ -12,6 +12,7 @@ #include <ns16550.h> #include <serial.h> #include <clk.h> +#include <linux/err.h> #ifndef CONFIG_SYS_NS16550_CLK #define CONFIG_SYS_NS16550_CLK 0 diff --git a/drivers/serial/serial_pic32.c b/drivers/serial/serial_pic32.c index 84600b12014bea12c17e885192a797d4ce74f792..bac506ed79d558037f990e173aacd14551748764 100644 --- a/drivers/serial/serial_pic32.c +++ b/drivers/serial/serial_pic32.c @@ -6,6 +6,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <serial.h> #include <wait_bit.h> #include <mach/pic32.h> diff --git a/drivers/serial/serial_sifive.c b/drivers/serial/serial_sifive.c index c142ccdf3d57bb376496b88da95fc67570b9a1ec..5a02f0c8feb5b5e46b010cee702791716d8055ff 100644 --- a/drivers/serial/serial_sifive.c +++ b/drivers/serial/serial_sifive.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <linux/compiler.h> #include <serial.h> +#include <linux/err.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c index 00a8e7249b55717c172d4ed0eb4b18df73d6bf4e..016082814f6a7be333ebd6249fc036bf876c4e60 100644 --- a/drivers/serial/serial_stm32.c +++ b/drivers/serial/serial_stm32.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <asm/arch/stm32.h> #include "serial_stm32.h" +#include <dm/device_compat.h> static void _stm32_serial_setbrg(fdt_addr_t base, struct stm32_uart_info *uart_info, diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index 7e486a68ffc9c067595d161af185d2c857cebb8a..e4e4c3928582c89b51129e9c4885845128cf78c1 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -12,8 +12,10 @@ #include <fdtdec.h> #include <watchdog.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/compiler.h> #include <serial.h> +#include <linux/err.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/smem/msm_smem.c b/drivers/smem/msm_smem.c index 9fa653ad28ba97a7c76e27dad52f895056f0cadd..5557fd29ce6cd5ef3147ad1c601c39243a24e162 100644 --- a/drivers/smem/msm_smem.c +++ b/drivers/smem/msm_smem.c @@ -8,9 +8,12 @@ #include <common.h> #include <errno.h> #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/of_access.h> #include <dm/of_addr.h> #include <asm/io.h> +#include <linux/err.h> #include <linux/ioport.h> #include <linux/io.h> #include <smem.h> diff --git a/drivers/soc/ti/k3-navss-ringacc.c b/drivers/soc/ti/k3-navss-ringacc.c index 17949d2d0a67a4df916af0a435ec98f5ff9b8c43..8cbfe2bf49c36bcce71bf306f6c3698d3732bf0d 100644 --- a/drivers/soc/ti/k3-navss-ringacc.c +++ b/drivers/soc/ti/k3-navss-ringacc.c @@ -12,9 +12,12 @@ #include <asm/dma-mapping.h> #include <asm/bitops.h> #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/read.h> #include <dm/uclass.h> #include <linux/compat.h> +#include <linux/err.h> #include <linux/soc/ti/k3-navss-ringacc.h> #include <linux/soc/ti/ti_sci_protocol.h> diff --git a/drivers/sound/sandbox.c b/drivers/sound/sandbox.c index 363c687bafd11d2ebcf16ba3dda3c69157352c35..9034a8385a8c78b1e868070585a5499728d662ca 100644 --- a/drivers/sound/sandbox.c +++ b/drivers/sound/sandbox.c @@ -26,7 +26,8 @@ struct sandbox_i2s_priv { }; struct sandbox_sound_priv { - int setup_called; + int setup_called; /* Incremented when setup() method is called */ + bool active; /* TX data is being sent */ int sum; /* Use to sum the provided audio data */ bool allow_beep; /* true to allow the start_beep() interface */ int frequency_hz; /* Beep frequency if active, else 0 */ @@ -59,6 +60,13 @@ int sandbox_get_setup_called(struct udevice *dev) return priv->setup_called; } +int sandbox_get_sound_active(struct udevice *dev) +{ + struct sandbox_sound_priv *priv = dev_get_priv(dev); + + return priv->active; +} + int sandbox_get_sound_sum(struct udevice *dev) { struct sandbox_sound_priv *priv = dev_get_priv(dev); @@ -163,6 +171,16 @@ static int sandbox_sound_play(struct udevice *dev, void *data, uint data_size) return i2s_tx_data(uc_priv->i2s, data, data_size); } +static int sandbox_sound_stop_play(struct udevice *dev) +{ + struct sandbox_sound_priv *priv = dev_get_priv(dev); + + sandbox_sdl_sound_stop(); + priv->active = false; + + return 0; +} + int sandbox_sound_start_beep(struct udevice *dev, int frequency_hz) { struct sandbox_sound_priv *priv = dev_get_priv(dev); @@ -228,6 +246,7 @@ U_BOOT_DRIVER(sandbox_i2s) = { static const struct sound_ops sandbox_sound_ops = { .setup = sandbox_sound_setup, .play = sandbox_sound_play, + .stop_play = sandbox_sound_stop_play, .start_beep = sandbox_sound_start_beep, .stop_beep = sandbox_sound_stop_beep, }; diff --git a/drivers/sound/sound-uclass.c b/drivers/sound/sound-uclass.c index d49f29bcd5b81cea57cf1c3673599050adea83b9..d9b3a38f18c7ea903a211db887647eb19465d123 100644 --- a/drivers/sound/sound-uclass.c +++ b/drivers/sound/sound-uclass.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <i2s.h> +#include <malloc.h> #include <sound.h> #define SOUND_BITS_IN_BYTE 8 @@ -31,6 +32,16 @@ int sound_play(struct udevice *dev, void *data, uint data_size) return ops->play(dev, data, data_size); } +int sound_stop_play(struct udevice *dev) +{ + struct sound_ops *ops = sound_get_ops(dev); + + if (!ops->play) + return -ENOSYS; + + return ops->stop_play(dev); +} + int sound_start_beep(struct udevice *dev, int frequency_hz) { struct sound_ops *ops = sound_get_ops(dev); @@ -87,16 +98,20 @@ int sound_beep(struct udevice *dev, int msecs, int frequency_hz) sound_create_square_wave(i2s_uc_priv->samplingrate, data, data_size, frequency_hz, i2s_uc_priv->channels); + ret = 0; while (msecs >= 1000) { ret = sound_play(dev, data, data_size); + if (ret) + break; msecs -= 1000; } - if (msecs) { + if (!ret && msecs) { unsigned long size = (data_size * msecs) / (sizeof(int) * 1000); ret = sound_play(dev, data, size); } + sound_stop_play(dev); free(data); diff --git a/drivers/spi/atmel-quadspi.c b/drivers/spi/atmel-quadspi.c index 7d9a54011ddacf0432efea26a4daca77de136c59..a09bf884e837d7b605602050566bb58c8e0ed651 100644 --- a/drivers/spi/atmel-quadspi.c +++ b/drivers/spi/atmel-quadspi.c @@ -9,12 +9,15 @@ * Author: Piotr Bugalski <bugalski.piotr@gmail.com> */ +#include <malloc.h> #include <asm/io.h> #include <clk.h> #include <common.h> #include <dm.h> #include <errno.h> #include <fdtdec.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/io.h> #include <linux/iopoll.h> #include <linux/ioport.h> diff --git a/drivers/spi/bcm63xx_hsspi.c b/drivers/spi/bcm63xx_hsspi.c index 529adfbc4e6e7ee4cb07c70b933187ffd4c68534..f88702df4dc293c64ddf2e30287b7404d901f9bf 100644 --- a/drivers/spi/bcm63xx_hsspi.c +++ b/drivers/spi/bcm63xx_hsspi.c @@ -10,6 +10,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <spi.h> #include <reset.h> #include <wait_bit.h> diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c index 69f88c9e0873e7006bd4c6cdc5564ea26017c759..719f53d08e06ce9824252bef05ae9a9f9364cc0b 100644 --- a/drivers/spi/bcm63xx_spi.c +++ b/drivers/spi/bcm63xx_spi.c @@ -10,6 +10,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <spi.h> #include <reset.h> #include <wait_bit.h> diff --git a/drivers/spi/cadence_qspi.c b/drivers/spi/cadence_qspi.c index f8b69406d4b9293e81f39f6fb4aae21f4e9f35de..83b114ffe741cfc6f8e90b4c648840f6acb48402 100644 --- a/drivers/spi/cadence_qspi.c +++ b/drivers/spi/cadence_qspi.c @@ -13,6 +13,8 @@ #include <reset.h> #include <spi.h> #include <spi-mem.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/sizes.h> #include "cadence_qspi.h" diff --git a/drivers/spi/designware_spi.c b/drivers/spi/designware_spi.c index 66ff8eeccdebde3da7980b2006a9d8fe5c70d04c..2dc16736a3ec577e4a6bf4adecb3ab7a56e8a8bc 100644 --- a/drivers/spi/designware_spi.c +++ b/drivers/spi/designware_spi.c @@ -18,6 +18,7 @@ #include <spi.h> #include <fdtdec.h> #include <reset.h> +#include <dm/device_compat.h> #include <linux/compat.h> #include <linux/iopoll.h> #include <asm/io.h> diff --git a/drivers/spi/mvebu_a3700_spi.c b/drivers/spi/mvebu_a3700_spi.c index 99ad505f24e4daf3c964596a5fdb3a8667b1cc6c..1469771619e4b4580129e6016a2e1df00ed70178 100644 --- a/drivers/spi/mvebu_a3700_spi.c +++ b/drivers/spi/mvebu_a3700_spi.c @@ -12,6 +12,7 @@ #include <clk.h> #include <wait_bit.h> #include <asm/io.h> +#include <dm/device_compat.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c index d94aaf9fdbd2048da4f3e6c7e262fa544e160ada..4d1317c36464cb2f9e732e601baab2c4209206a8 100644 --- a/drivers/spi/mxc_spi.c +++ b/drivers/spi/mxc_spi.c @@ -7,6 +7,7 @@ #include <dm.h> #include <malloc.h> #include <spi.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <asm/io.h> #include <asm/gpio.h> diff --git a/drivers/spi/nxp_fspi.c b/drivers/spi/nxp_fspi.c index a2fab7ad0a255bdc909a4fc994008315a2ac35d0..0e6c7be785afd0525bab31e5cbea2fbe1ba21060 100644 --- a/drivers/spi/nxp_fspi.c +++ b/drivers/spi/nxp_fspi.c @@ -44,6 +44,7 @@ #include <linux/sizes.h> #include <linux/iopoll.h> #include <linux/bug.h> +#include <linux/err.h> /* * The driver only uses one single LUT entry, that is updated on diff --git a/drivers/spi/spi-mem-nodm.c b/drivers/spi/spi-mem-nodm.c index 4447d44991352a83ff68d96b652d3c191bf634be..83dde4806e050de8ab618851a9627401ff8603b3 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 cc358bd4f7ce836a2fbeaf0834e1084c0359d2f4..e900c997bd7f529d4a71c63b3ab732a6d7159c0c 100644 --- a/drivers/spi/spi-mem.c +++ b/drivers/spi/spi-mem.c @@ -7,10 +7,12 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/dmaengine.h> #include <linux/pm_runtime.h> #include "internals.h" #else +#include <dm/device_compat.h> #include <spi.h> #include <spi-mem.h> #endif diff --git a/drivers/spi/spi-sunxi.c b/drivers/spi/spi-sunxi.c index dbfeac77eecf1f2fd7f09c3c2e31bc14365140b2..c59fee10a89e2020ddba975531696f51020b8961 100644 --- a/drivers/spi/spi-sunxi.c +++ b/drivers/spi/spi-sunxi.c @@ -26,6 +26,7 @@ #include <fdt_support.h> #include <reset.h> #include <wait_bit.h> +#include <dm/device_compat.h> #include <asm/bitops.h> #include <asm/gpio.h> diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c index 958c394a1a0f7f6ec41965ff59ce72a44ae83f0f..6857a87dc5f5f8050f5075fbf3fba98244e3c88d 100644 --- a/drivers/spi/stm32_qspi.c +++ b/drivers/spi/stm32_qspi.c @@ -11,6 +11,7 @@ #include <clk.h> #include <reset.h> #include <spi-mem.h> +#include <dm/device_compat.h> #include <linux/iopoll.h> #include <linux/ioport.h> #include <linux/sizes.h> diff --git a/drivers/spi/stm32_spi.c b/drivers/spi/stm32_spi.c index 75b6006b45404948702ca2760f6399bceff9e5a5..ebf2b98fcd45955e71f11956bb89b72a269c5fc7 100644 --- a/drivers/spi/stm32_spi.c +++ b/drivers/spi/stm32_spi.c @@ -8,8 +8,10 @@ #include <clk.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <reset.h> #include <spi.h> +#include <dm/device_compat.h> #include <asm/io.h> #include <asm/gpio.h> diff --git a/drivers/spi/ti_qspi.c b/drivers/spi/ti_qspi.c index 664b9cad79d9397e9abbc0e6ba27753a59414556..e3750b0b171f5e673db06dd308da107b87a2da7f 100644 --- a/drivers/spi/ti_qspi.c +++ b/drivers/spi/ti_qspi.c @@ -17,6 +17,7 @@ #include <asm/omap_gpio.h> #include <asm/omap_common.h> #include <asm/ti-common/ti-edma3.h> +#include <linux/err.h> #include <linux/kernel.h> #include <regmap.h> #include <syscon.h> diff --git a/drivers/spi/uniphier_spi.c b/drivers/spi/uniphier_spi.c index e47b969864b9962680c29d3ff9a3d7ab8515d19b..153fbb2889a1e2261b9be794fd62ab7fb7acc4f3 100644 --- a/drivers/spi/uniphier_spi.c +++ b/drivers/spi/uniphier_spi.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> #include <time.h> +#include <dm/device_compat.h> #include <linux/bitfield.h> #include <linux/io.h> #include <spi.h> diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index 4cca4180126c65824bc5935fc25f87cfc6a706a3..02b78df843715ad8357e0061d352bce3e6a3987b 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -16,6 +16,8 @@ #include <spi.h> #include <ubi_uboot.h> #include <wait_bit.h> +#include <dm/device_compat.h> +#include <linux/err.h> #define GQSPI_GFIFO_STRT_MODE_MASK BIT(29) #define GQSPI_CONFIG_MODE_EN_MASK (3 << 30) diff --git a/drivers/spmi/spmi-msm.c b/drivers/spmi/spmi-msm.c index 6f1114699e5143482a62f6ec7dea0386cc28ecf4..ed93faffcb1300618355755403e5ff27352509a4 100644 --- a/drivers/spmi/spmi-msm.c +++ b/drivers/spmi/spmi-msm.c @@ -12,6 +12,7 @@ #include <errno.h> #include <fdtdec.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <spmi/spmi.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/sysreset/sysreset-ti-sci.c b/drivers/sysreset/sysreset-ti-sci.c index 890a607c4b19c3751eaae83d6fd8c1a5db4207f2..e7fcfcd4d1fb7e47c631d3aa242510bd3fb4850c 100644 --- a/drivers/sysreset/sysreset-ti-sci.c +++ b/drivers/sysreset/sysreset-ti-sci.c @@ -10,6 +10,8 @@ #include <dm.h> #include <errno.h> #include <sysreset.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/soc/ti/ti_sci_protocol.h> /** diff --git a/drivers/sysreset/sysreset_syscon.c b/drivers/sysreset/sysreset_syscon.c index d0e586f66f6ddaa4a90eaae202d82d93f8b6efb5..f64701aab3c834ad967a30f04b1ef3ca0a217e81 100644 --- a/drivers/sysreset/sysreset_syscon.c +++ b/drivers/sysreset/sysreset_syscon.c @@ -13,6 +13,7 @@ #include <regmap.h> #include <sysreset.h> #include <syscon.h> +#include <linux/err.h> struct syscon_reboot_priv { struct regmap *regmap; diff --git a/drivers/tee/optee/core.c b/drivers/tee/optee/core.c index 7f870f2f735d15975ba806c12c22cff8bb0d50e5..9fb5e658f921da24299a6af5f4ef4ef5f6463b7d 100644 --- a/drivers/tee/optee/core.c +++ b/drivers/tee/optee/core.c @@ -6,8 +6,10 @@ #include <common.h> #include <dm.h> #include <log.h> +#include <malloc.h> #include <tee.h> #include <linux/arm-smccc.h> +#include <linux/err.h> #include <linux/io.h> #include "optee_smc.h" diff --git a/drivers/tee/optee/rpmb.c b/drivers/tee/optee/rpmb.c index cf1ce77e6e19e68ea5fb2300fcfb48d4d32675e9..0804fc963cf53059de42fd243153dff8e6a79f6b 100644 --- a/drivers/tee/optee/rpmb.c +++ b/drivers/tee/optee/rpmb.c @@ -8,6 +8,7 @@ #include <log.h> #include <tee.h> #include <mmc.h> +#include <dm/device_compat.h> #include "optee_msg.h" #include "optee_private.h" diff --git a/drivers/tee/optee/supplicant.c b/drivers/tee/optee/supplicant.c index c5726ecb91bf6096920045528fcbf6dae74d01c7..ae042b9a20472f1873d05b44fb17d5e843adfc8f 100644 --- a/drivers/tee/optee/supplicant.c +++ b/drivers/tee/optee/supplicant.c @@ -5,6 +5,7 @@ #include <common.h> #include <log.h> +#include <malloc.h> #include <tee.h> #include <linux/types.h> diff --git a/drivers/tee/tee-uclass.c b/drivers/tee/tee-uclass.c index abb88c0fee53f04fbbea846e4d365c55f4446941..1fb3c16a14134446c4c1f88231f952aa10fb93b6 100644 --- a/drivers/tee/tee-uclass.c +++ b/drivers/tee/tee-uclass.c @@ -5,9 +5,10 @@ #include <common.h> #include <dm.h> +#include <malloc.h> +#include <tee.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> -#include <tee.h> /** * struct tee_uclass_priv - information of a TEE, stored by the uclass diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 21ffdbf575a18f08b708ff77f36b5d7bad1a58a8..3838601f54d1c6b166f3e8e0b466160b79c0157e 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c @@ -9,6 +9,7 @@ #include <timer.h> #include <asm/io.h> #include <asm/arch/timer.h> +#include <linux/err.h> #define AST_TICK_TIMER 1 #define AST_TMC_RELOAD_VAL 0xffffffff diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c index 75263c5375e065dabd218c38620aec6910dd1b51..ed48a145f2ce509a0c6f8da45a346790dc86b140 100644 --- a/drivers/timer/cadence-ttc.c +++ b/drivers/timer/cadence-ttc.c @@ -8,6 +8,7 @@ #include <errno.h> #include <timer.h> #include <asm/io.h> +#include <linux/err.h> #define CNT_CNTRL_RESET BIT(4) diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c index fad22be8c91e9a39f07f6e27147f21fbc2a44eb8..35271b20c891e9585cf95bb16ca5e42177a0435b 100644 --- a/drivers/timer/dw-apb-timer.c +++ b/drivers/timer/dw-apb-timer.c @@ -8,8 +8,10 @@ #include <common.h> #include <dm.h> #include <clk.h> +#include <malloc.h> #include <reset.h> #include <timer.h> +#include <dm/device_compat.h> #include <asm/io.h> #include <asm/arch/timer.h> diff --git a/drivers/timer/ostm_timer.c b/drivers/timer/ostm_timer.c index f0e25093ca4bb0977283e5394e6fe3ab08a02e1d..48a5055b05e12e65d2154245981edef10f329fc5 100644 --- a/drivers/timer/ostm_timer.c +++ b/drivers/timer/ostm_timer.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <dm.h> #include <clk.h> diff --git a/drivers/timer/stm32_timer.c b/drivers/timer/stm32_timer.c index 76315100e22f2e3b2e77a57e1c4e2b63e2e21fdc..76d99a2b86597416863ae8f7a0ebe79237539154 100644 --- a/drivers/timer/stm32_timer.c +++ b/drivers/timer/stm32_timer.c @@ -9,6 +9,7 @@ #include <dm.h> #include <fdtdec.h> #include <timer.h> +#include <dm/device_compat.h> #include <asm/io.h> diff --git a/drivers/timer/timer-uclass.c b/drivers/timer/timer-uclass.c index 97a4c7485189bbb5877681268f70ea8b6cadadcb..b619200f00fa47e14498e82d6f1c78140213adcb 100644 --- a/drivers/timer/timer-uclass.c +++ b/drivers/timer/timer-uclass.c @@ -11,6 +11,7 @@ #include <clk.h> #include <errno.h> #include <timer.h> +#include <linux/err.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/tpm/Kconfig b/drivers/tpm/Kconfig index 555a76bb1e314243a7f96753bea9caa8075da2a8..9eebab5cfd90ef716df8faa2214ce2642830d931 100644 --- a/drivers/tpm/Kconfig +++ b/drivers/tpm/Kconfig @@ -155,6 +155,12 @@ config TPM2_TIS_SPI to the device using the standard TPM Interface Specification (TIS) protocol. +config TPM2_FTPM_TEE + bool "TEE based fTPM Interface" + depends on TEE && OPTEE && TPM_V2 + help + This driver supports firmware TPM running in TEE. + endif # TPM_V2 endmenu diff --git a/drivers/tpm/Makefile b/drivers/tpm/Makefile index 4c866b37c501eb5b75b70b40d9bd0b88bb1f6b67..8f075b9f45fbe467daf5634638224ae6c15b8e47 100644 --- a/drivers/tpm/Makefile +++ b/drivers/tpm/Makefile @@ -13,3 +13,4 @@ obj-$(CONFIG_TPM_ST33ZP24_SPI) += tpm_tis_st33zp24_spi.o obj-$(CONFIG_TPM2_CR50_I2C) += cr50_i2c.o obj-$(CONFIG_TPM2_TIS_SANDBOX) += tpm2_tis_sandbox.o obj-$(CONFIG_TPM2_TIS_SPI) += tpm2_tis_spi.o +obj-$(CONFIG_TPM2_FTPM_TEE) += tpm2_ftpm_tee.o diff --git a/drivers/tpm/tpm2_ftpm_tee.c b/drivers/tpm/tpm2_ftpm_tee.c new file mode 100644 index 0000000000000000000000000000000000000000..4b79d4ada0823b4b63353187c8675e9dabcc09df --- /dev/null +++ b/drivers/tpm/tpm2_ftpm_tee.c @@ -0,0 +1,250 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (C) Microsoft Corporation + * + * Authors: + * Thirupathaiah Annapureddy <thiruan@microsoft.com> + * + * Description: + * Device Driver for a firmware TPM as described here: + * https://www.microsoft.com/en-us/research/publication/ftpm-software-implementation-tpm-chip/ + * + * A reference implementation is available here: + * https://github.com/microsoft/ms-tpm-20-ref/tree/master/Samples/ARM32-FirmwareTPM/optee_ta/fTPM + */ + +#include <common.h> +#include <dm.h> +#include <tpm-v2.h> +#include <tee.h> + +#include "tpm_tis.h" +#include "tpm2_ftpm_tee.h" + +/** + * ftpm_tee_transceive() - send fTPM commands and retrieve fTPM response. + * @sendbuf - address of the data to send, byte by byte + * @send_size - length of the data to send + * @recvbuf - address where to read the response, byte by byte. + * @recv_len - pointer to the size of buffer + * + * Return: + * In case of success, returns 0. + * On failure, -errno + */ +static int ftpm_tee_transceive(struct udevice *dev, const u8 *sendbuf, + size_t send_size, u8 *recvbuf, + size_t *recv_len) +{ + struct ftpm_tee_private *context = dev_get_priv(dev); + int rc = 0; + size_t resp_len; + u8 *resp_buf; + struct tpm_output_header *resp_header; + struct tee_invoke_arg transceive_args; + struct tee_param command_params[4]; + struct tee_shm *shm; + + if (send_size > MAX_COMMAND_SIZE) { + debug("%s:send_size=%zd exceeds MAX_COMMAND_SIZE\n", + __func__, send_size); + return -EIO; + } + + shm = context->shm; + memset(&transceive_args, 0, sizeof(transceive_args)); + memset(command_params, 0, sizeof(command_params)); + + /* Invoke FTPM_OPTEE_TA_SUBMIT_COMMAND function of fTPM TA */ + transceive_args = (struct tee_invoke_arg) { + .func = FTPM_OPTEE_TA_SUBMIT_COMMAND, + .session = context->session, + }; + + /* Fill FTPM_OPTEE_TA_SUBMIT_COMMAND parameters */ + /* request */ + command_params[0] = (struct tee_param) { + .attr = TEE_PARAM_ATTR_TYPE_MEMREF_INPUT, + .u.memref = { + .shm = shm, + .size = send_size, + .shm_offs = 0, + }, + }; + memset(command_params[0].u.memref.shm->addr, 0, + (MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE)); + memcpy(command_params[0].u.memref.shm->addr, sendbuf, send_size); + + /* response */ + command_params[1] = (struct tee_param) { + .attr = TEE_PARAM_ATTR_TYPE_MEMREF_INOUT, + .u.memref = { + .shm = shm, + .size = MAX_RESPONSE_SIZE, + .shm_offs = MAX_COMMAND_SIZE, + }, + }; + + rc = tee_invoke_func(context->tee_dev, &transceive_args, 4, + command_params); + if ((rc < 0) || (transceive_args.ret != 0)) { + debug("%s:SUBMIT_COMMAND invoke error: 0x%x\n", + __func__, transceive_args.ret); + return (rc < 0) ? rc : transceive_args.ret; + } + + resp_buf = command_params[1].u.memref.shm->addr + + command_params[1].u.memref.shm_offs; + resp_header = (struct tpm_output_header *)resp_buf; + resp_len = be32_to_cpu(resp_header->length); + + /* sanity check resp_len*/ + if (resp_len < TPM_HEADER_SIZE) { + debug("%s:tpm response header too small\n", __func__); + return -EIO; + } + if (resp_len > MAX_RESPONSE_SIZE) { + debug("%s:resp_len=%zd exceeds MAX_RESPONSE_SIZE\n", + __func__, resp_len); + return -EIO; + } + if (resp_len > *recv_len) { + debug("%s:response length is bigger than receive buffer\n", + __func__); + return -EIO; + } + + /* sanity checks look good, copy the response */ + memcpy(recvbuf, resp_buf, resp_len); + *recv_len = resp_len; + + return 0; +} + +static int ftpm_tee_open(struct udevice *dev) +{ + struct ftpm_tee_private *context = dev_get_priv(dev); + + if (context->is_open) + return -EBUSY; + + context->is_open = 1; + + return 0; +} + +static int ftpm_tee_close(struct udevice *dev) +{ + struct ftpm_tee_private *context = dev_get_priv(dev); + + if (context->is_open) + context->is_open = 0; + + return 0; +} + +static int ftpm_tee_desc(struct udevice *dev, char *buf, int size) +{ + if (size < 32) + return -ENOSPC; + + return snprintf(buf, size, "Microsoft OP-TEE fTPM"); +} + +static int ftpm_tee_match(struct tee_version_data *vers, const void *data) +{ + debug("%s:vers->gen_caps =0x%x\n", __func__, vers->gen_caps); + + /* + * Currently this driver only support GP Complaint OPTEE based fTPM TA + */ + return vers->gen_caps & TEE_GEN_CAP_GP; +} + +static int ftpm_tee_probe(struct udevice *dev) +{ + int rc; + struct tpm_chip_priv *priv = dev_get_uclass_priv(dev); + struct ftpm_tee_private *context = dev_get_priv(dev); + struct tee_open_session_arg sess_arg; + const struct tee_optee_ta_uuid uuid = TA_FTPM_UUID; + + memset(context, 0, sizeof(*context)); + + /* Use the TPM v2 stack */ + priv->version = TPM_V2; + priv->pcr_count = 24; + priv->pcr_select_min = 3; + + /* Find TEE device */ + context->tee_dev = tee_find_device(NULL, ftpm_tee_match, NULL, NULL); + if (!context->tee_dev) { + debug("%s:tee_find_device failed\n", __func__); + return -ENODEV; + } + + /* Open a session with the fTPM TA */ + memset(&sess_arg, 0, sizeof(sess_arg)); + tee_optee_ta_uuid_to_octets(sess_arg.uuid, &uuid); + + rc = tee_open_session(context->tee_dev, &sess_arg, 0, NULL); + if ((rc < 0) || (sess_arg.ret != 0)) { + debug("%s:tee_open_session failed, err=%x\n", + __func__, sess_arg.ret); + return -EIO; + } + context->session = sess_arg.session; + + /* Allocate dynamic shared memory with fTPM TA */ + rc = tee_shm_alloc(context->tee_dev, + MAX_COMMAND_SIZE + MAX_RESPONSE_SIZE, + 0, &context->shm); + if (rc) { + debug("%s:tee_shm_alloc failed with rc = %d\n", __func__, rc); + goto out_shm_alloc; + } + + return 0; + +out_shm_alloc: + tee_close_session(context->tee_dev, context->session); + + return rc; +} + +static int ftpm_tee_remove(struct udevice *dev) +{ + struct ftpm_tee_private *context = dev_get_priv(dev); + int rc; + + /* tee_pre_remove frees any leftover TEE shared memory */ + + /* close the existing session with fTPM TA*/ + rc = tee_close_session(context->tee_dev, context->session); + debug("%s: tee_close_session - rc =%d\n", __func__, rc); + + return 0; +} + +static const struct tpm_ops ftpm_tee_ops = { + .open = ftpm_tee_open, + .close = ftpm_tee_close, + .get_desc = ftpm_tee_desc, + .xfer = ftpm_tee_transceive, +}; + +static const struct udevice_id ftpm_tee_ids[] = { + { .compatible = "microsoft,ftpm" }, + { } +}; + +U_BOOT_DRIVER(ftpm_tee) = { + .name = "ftpm_tee", + .id = UCLASS_TPM, + .of_match = ftpm_tee_ids, + .ops = &ftpm_tee_ops, + .probe = ftpm_tee_probe, + .remove = ftpm_tee_remove, + .flags = DM_FLAG_OS_PREPARE, + .priv_auto_alloc_size = sizeof(struct ftpm_tee_private), +}; diff --git a/drivers/tpm/tpm2_ftpm_tee.h b/drivers/tpm/tpm2_ftpm_tee.h new file mode 100644 index 0000000000000000000000000000000000000000..44f9598c28ace65218c2a8996503e1715502ee6a --- /dev/null +++ b/drivers/tpm/tpm2_ftpm_tee.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) Microsoft Corporation + */ + +#ifndef __TPM2_FTPM_TEE_H__ +#define __TPM2_FTPM_TEE_H__ + +/* This UUID is generated with uuidgen */ +#define TA_FTPM_UUID { 0xBC50D971, 0xD4C9, 0x42C4, \ + {0x82, 0xCB, 0x34, 0x3F, 0xB7, 0xF3, 0x78, 0x96} } + +/* The TAFs ID implemented in this TA */ +#define FTPM_OPTEE_TA_SUBMIT_COMMAND (0) +#define FTPM_OPTEE_TA_EMULATE_PPI (1) + +/* max. buffer size supported by fTPM */ +#define MAX_COMMAND_SIZE 4096 +#define MAX_RESPONSE_SIZE 4096 + +/** + * struct ftpm_tee_private - fTPM's private context + * @tee_dev: struct udevice for TEE. + * @session: fTPM TA session identifier. + * @is_open: Indicates whether the driver is already opened by client or not. + * @shm: Memory pool shared with fTPM TA in TEE. + */ +struct ftpm_tee_private { + struct udevice *tee_dev; + u32 session; + int is_open; + struct tee_shm *shm; +}; + +#endif /* __TPM2_FTPM_TEE_H__ */ diff --git a/drivers/ufs/cdns-platform.c b/drivers/ufs/cdns-platform.c index c80f4253e4fefb309774f3340ec887b56e263339..41ee6a60c9644fb1cc85aa4bf31ff22ae2bbb533 100644 --- a/drivers/ufs/cdns-platform.c +++ b/drivers/ufs/cdns-platform.c @@ -9,6 +9,8 @@ #include <common.h> #include <dm.h> #include <ufs.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include "ufs.h" diff --git a/drivers/ufs/ti-j721e-ufs.c b/drivers/ufs/ti-j721e-ufs.c index 24ec3ebea178bab89a9152602d689b4c1f63265a..4990fba6ebb278d5abfb727e0f6b0366ae3ba2ab 100644 --- a/drivers/ufs/ti-j721e-ufs.c +++ b/drivers/ufs/ti-j721e-ufs.c @@ -7,6 +7,8 @@ #include <clk.h> #include <common.h> #include <dm.h> +#include <dm/device_compat.h> +#include <linux/err.h> #define UFS_SS_CTRL 0x4 #define UFS_SS_RST_N_PCS BIT(0) diff --git a/drivers/ufs/ufs.c b/drivers/ufs/ufs.c index 23306863d52b7ac1a45cbe457c0e3fae98fe3087..c9346c2edc8f265662a8702cb8017699a5496485 100644 --- a/drivers/ufs/ufs.c +++ b/drivers/ufs/ufs.c @@ -11,6 +11,8 @@ #include <charset.h> #include <common.h> #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/lists.h> #include <dm/device-internal.h> #include <malloc.h> diff --git a/drivers/usb/cdns3/cdns3-ti.c b/drivers/usb/cdns3/cdns3-ti.c index 2fa0104f1beec48eb1f76c44a5ee21d042e47d20..652cd5cb17ad9265b76bff036f348473be9eb4e5 100644 --- a/drivers/usb/cdns3/cdns3-ti.c +++ b/drivers/usb/cdns3/cdns3-ti.c @@ -9,6 +9,7 @@ #include <asm-generic/io.h> #include <clk.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/io.h> #include <linux/usb/otg.h> #include <malloc.h> diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c index 8c8e02169e811ab8bcff4594641cd43969d14a13..f947e6983c05d956e97d8d4405ca40be979005cc 100644 --- a/drivers/usb/cdns3/core.c +++ b/drivers/usb/cdns3/core.c @@ -14,6 +14,8 @@ #include <common.h> #include <dm.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/lists.h> #include <linux/kernel.h> #include <linux/io.h> diff --git a/drivers/usb/cdns3/drd.c b/drivers/usb/cdns3/drd.c index 13eb4899d49c940611d17a5add3869c391990f9f..47874fec29eb3b9fbab65c16fb287aee6e5ae293 100644 --- a/drivers/usb/cdns3/drd.c +++ b/drivers/usb/cdns3/drd.c @@ -11,6 +11,7 @@ * */ #include <dm.h> +#include <dm/device_compat.h> #include <linux/delay.h> #include <linux/iopoll.h> #include <linux/kernel.h> diff --git a/drivers/usb/cdns3/ep0.c b/drivers/usb/cdns3/ep0.c index f35a92483948a0038aa88a520c488dc29f7f1d69..1957a3b91d5d8bfd4549c5fc1662713047f27ceb 100644 --- a/drivers/usb/cdns3/ep0.c +++ b/drivers/usb/cdns3/ep0.c @@ -11,6 +11,7 @@ */ #include <cpu_func.h> +#include <dm/device_compat.h> #include <linux/usb/composite.h> #include <linux/iopoll.h> diff --git a/drivers/usb/cdns3/gadget.c b/drivers/usb/cdns3/gadget.c index 0e02b779656c3b9ea0490145db0981906d8890d2..22e90a57179fde5d3c29008eb55c15a41d5c0627 100644 --- a/drivers/usb/cdns3/gadget.c +++ b/drivers/usb/cdns3/gadget.c @@ -57,6 +57,9 @@ */ #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> +#include <linux/err.h> #include <linux/usb/gadget.h> #include <linux/compat.h> #include <linux/iopoll.h> diff --git a/drivers/usb/cdns3/host.c b/drivers/usb/cdns3/host.c index 425d9d053ddbfdd1bf168fcef0eebee5d7bdf870..b44e7df11319db4ad8df3108349e071addf97210 100644 --- a/drivers/usb/cdns3/host.c +++ b/drivers/usb/cdns3/host.c @@ -9,6 +9,7 @@ * Pawel Laszczak <pawell@cadence.com> */ #include <dm.h> +#include <dm/devres.h> #include <linux/compat.h> #include <usb.h> #include <usb/xhci.h> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 77c555e769240c2c4a0dfded17393aecb94781c9..c5066529b7d0a50f597775f9f03ac1e1835e512d 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -18,6 +18,9 @@ #include <malloc.h> #include <dwc3-uboot.h> #include <asm/dma-mapping.h> +#include <dm/device_compat.h> +#include <dm/devres.h> +#include <linux/err.h> #include <linux/ioport.h> #include <dm.h> #include <generic-phy.h> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c index 8b1914018297bf94e6607b8e405257cbb470f500..9596bf144c370a5bcfa4fff0e5c03a3f58671715 100644 --- a/drivers/usb/dwc3/dwc3-omap.c +++ b/drivers/usb/dwc3/dwc3-omap.c @@ -18,6 +18,8 @@ #include <asm/io.h> #include <dm.h> #include <dwc3-omap-uboot.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/usb/dwc3-omap.h> #include <linux/ioport.h> diff --git a/drivers/usb/dwc3/dwc3-uniphier.c b/drivers/usb/dwc3/dwc3-uniphier.c index 6e9c52189dd72453f29a5b0263bf2cc4c887c55b..88317b19ac050ebcf39de98a9d6aa3d28af0a030 100644 --- a/drivers/usb/dwc3/dwc3-uniphier.c +++ b/drivers/usb/dwc3/dwc3-uniphier.c @@ -7,6 +7,7 @@ */ #include <dm.h> +#include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/errno.h> #include <linux/io.h> diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index 0c8c11d743fa58e9d6c474f8c2b98b491f363e74..4af58941d823c9ace8652a0766bb42c3e1b09ec9 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -14,6 +14,7 @@ */ #include <common.h> #include <cpu_func.h> +#include <dm/device_compat.h> #include <linux/kernel.h> #include <linux/list.h> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 4353dffb6b128cf6126dc2da470ee71514fa2f51..1502d67362a962c2c5425b1787a12b60bdcafd40 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -17,6 +17,8 @@ #include <cpu_func.h> #include <malloc.h> #include <asm/dma-mapping.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/bug.h> #include <linux/list.h> diff --git a/drivers/usb/dwc3/ti_usb_phy.c b/drivers/usb/dwc3/ti_usb_phy.c index e7ea12c163a85b9df61ce0b7924e5656d52b0243..6b0166a1e0603388c4bdce369d7b1b1ce44f05d9 100644 --- a/drivers/usb/dwc3/ti_usb_phy.c +++ b/drivers/usb/dwc3/ti_usb_phy.c @@ -19,6 +19,8 @@ #include <common.h> #include <malloc.h> #include <ti-usb-phy-uboot.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/ioport.h> #include <asm/io.h> #include <asm/arch/sys_proto.h> diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 2a6626b44318bac582e7b7a1040f00bd57f1a7ee..13dec517f62a74ce54418774db0f0656cf68dc4a 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c @@ -14,6 +14,8 @@ #undef PACKET_TRACE #include <common.h> +#include <dm/devres.h> +#include <linux/err.h> #include <linux/errno.h> #include <asm/io.h> #include <asm/gpio.h> diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index 4a6f4271d5bf61c84eba29a07ffe744dba6b21ff..b2b279358e1d0c4d13339cb7539090248100d025 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -7,6 +7,7 @@ */ #undef DEBUG +#include <dm/devres.h> #include <linux/bitops.h> #include <linux/usb/composite.h> diff --git a/drivers/usb/gadget/dwc2_udc_otg.c b/drivers/usb/gadget/dwc2_udc_otg.c index 49f342eb211f321520060083f5b5cf143e4acb22..496abf38e7217d285d70a2d6e180220a7ddbb0f2 100644 --- a/drivers/usb/gadget/dwc2_udc_otg.c +++ b/drivers/usb/gadget/dwc2_udc_otg.c @@ -23,6 +23,8 @@ #include <generic-phy.h> #include <malloc.h> #include <reset.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/errno.h> #include <linux/list.h> diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index c1e6506659cc9c65ceb9161e302832aaff0be41f..5250fc8b264d7eb35027f173eaaadc7706eb69a0 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -245,6 +245,7 @@ #include <common.h> #include <console.h> #include <g_dnl.h> +#include <dm/devres.h> #include <linux/err.h> #include <linux/usb/ch9.h> diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c index 09c0a30b2ba029044da8a571535e4830aac6acf1..6e1e57f9fdae889e704fbeef3ec77c5ba43b702c 100644 --- a/drivers/usb/gadget/pxa25x_udc.c +++ b/drivers/usb/gadget/pxa25x_udc.c @@ -22,6 +22,7 @@ #include <asm/system.h> #include <asm/mach-types.h> #include <asm/unaligned.h> +#include <dm/devres.h> #include <linux/compat.h> #include <malloc.h> #include <asm/io.h> diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index 4bbd030aad7d7537e31c8d5a442cebce1b981079..f40779b13a20cac1f7679a81f7a7f4cb8f641ae6 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@ -269,6 +269,7 @@ struct device_attribute { int i; }; #define ETOOSMALL 525 #include <usb_mass_storage.h> +#include <dm/device_compat.h> /*-------------------------------------------------------------------------*/ diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c index 8d1d90e3e39fa7f425ca414e9c8e8bf55205c57f..a33ab5c95d4ebb0a875df6c61f7d0d684ad22ed5 100644 --- a/drivers/usb/gadget/udc/udc-core.c +++ b/drivers/usb/gadget/udc/udc-core.c @@ -13,6 +13,8 @@ * usb_ */ +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/compat.h> #include <malloc.h> #include <asm/cache.h> diff --git a/drivers/usb/host/dwc2.c b/drivers/usb/host/dwc2.c index b9c56f763b30a4a498151fa2d4eccbef523c8f95..e4efaf1e5939eaebfb8a3556e74c9be96dfd53f0 100644 --- a/drivers/usb/host/dwc2.c +++ b/drivers/usb/host/dwc2.c @@ -15,6 +15,7 @@ #include <usbroothubdes.h> #include <wait_bit.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <power/regulator.h> #include <reset.h> diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c index 6900848df1e95cdb27e3c38675a94561b0fe35ed..67eec0e0bb64ffe6cb080b6ac1ec0f9e23ac2a3f 100644 --- a/drivers/usb/host/ehci-atmel.c +++ b/drivers/usb/host/ehci-atmel.c @@ -8,6 +8,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <usb.h> #include <asm/io.h> #include <asm/arch/clk.h> diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index 682a0703060f41d733d01f8ecab2473bd31abb5c..0643681846139f461bf4abc144421b8e2d43c92c 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -5,6 +5,8 @@ #include <common.h> #include <clk.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/ofnode.h> #include <generic-phy.h> #include <reset.h> diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index ef20c3c982b53d782cdfceddd45c65a85912c5fa..1cc02052f5425120adbd1fe2c33eaf9747adbd69 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -17,6 +17,7 @@ #include <malloc.h> #include <memalign.h> #include <watchdog.h> +#include <dm/device_compat.h> #include <linux/compiler.h> #include "ehci.h" diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 233df57b4da465fc6ffeac00b3c58e44113644ae..692018243c8e8bfa1dcf0079a57c09b17d91f4fe 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -4,9 +4,12 @@ */ #include <common.h> +#include <malloc.h> #include <asm/io.h> #include <clk.h> #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/ofnode.h> #include <generic-phy.h> #include <reset.h> diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c index 916ea0b9555809406e93f465a5273d6238dd9a8e..04d5fdb2a8676796b3f5d67deefdcdb90612d420 100644 --- a/drivers/usb/host/ohci-generic.c +++ b/drivers/usb/host/ohci-generic.c @@ -6,6 +6,8 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <dm/device_compat.h> +#include <dm/devres.h> #include <dm/ofnode.h> #include <generic-phy.h> #include <reset.h> diff --git a/drivers/usb/host/r8a66597-hcd.c b/drivers/usb/host/r8a66597-hcd.c index a37696d83faf2626dc217f54395c3bbe276af242..8fc9d211db516a89dc69084679f49011160160c6 100644 --- a/drivers/usb/host/r8a66597-hcd.c +++ b/drivers/usb/host/r8a66597-hcd.c @@ -10,6 +10,7 @@ #include <dm.h> #include <usb.h> #include <asm/io.h> +#include <dm/device_compat.h> #include <linux/iopoll.h> #include <power/regulator.h> diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c index c4d8811343a1e1336f812d8d47cedb24b3bb6f16..d86584b847d48bd17b848ddba168c81116ae5b43 100644 --- a/drivers/usb/host/xhci-rcar.c +++ b/drivers/usb/host/xhci-rcar.c @@ -9,8 +9,10 @@ #include <clk.h> #include <dm.h> #include <fdtdec.h> +#include <malloc.h> #include <usb.h> #include <wait_bit.h> +#include <dm/device_compat.h> #include <usb/xhci.h> #include "xhci-rcar-r8a779x_usb3_v3.h" diff --git a/drivers/usb/musb-new/am35x.c b/drivers/usb/musb-new/am35x.c index bda099c63f4e25b8793e0e00e318bb39f80cfcad..6e5be90fe531bd6b8a9df385fb61f13572884a5b 100644 --- a/drivers/usb/musb-new/am35x.c +++ b/drivers/usb/musb-new/am35x.c @@ -12,6 +12,8 @@ */ #ifndef __UBOOT__ +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/init.h> #include <linux/module.h> #include <linux/clk.h> diff --git a/drivers/usb/musb-new/da8xx.c b/drivers/usb/musb-new/da8xx.c index 899b30db68448b72e115d8208ad3430202d35043..2ddcf33b5f022ae665cc553643410f6a0efd0b6c 100644 --- a/drivers/usb/musb-new/da8xx.c +++ b/drivers/usb/musb-new/da8xx.c @@ -16,6 +16,7 @@ #include <common.h> #include <dm.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <asm/arch/hardware.h> #include <asm/arch/da8xx-usb.h> diff --git a/drivers/usb/musb-new/musb_core.c b/drivers/usb/musb-new/musb_core.c index ab5e3aa9d13a3e9c120cd7dfa3fa6eb79e85528d..f678aa48265da17474ba361f4e51a765df92b671 100644 --- a/drivers/usb/musb-new/musb_core.c +++ b/drivers/usb/musb-new/musb_core.c @@ -65,6 +65,8 @@ */ #ifndef __UBOOT__ +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/sched.h> diff --git a/drivers/usb/musb-new/musb_dsps.c b/drivers/usb/musb-new/musb_dsps.c index 0c794b310a3a615ad475ea5a3dad2112db2aa508..eb590885bc538fbd9657b505a70dc238db185cde 100644 --- a/drivers/usb/musb-new/musb_dsps.c +++ b/drivers/usb/musb-new/musb_dsps.c @@ -15,6 +15,8 @@ */ #ifndef __UBOOT__ +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/init.h> #include <linux/io.h> #include <linux/err.h> diff --git a/drivers/usb/musb-new/musb_gadget.c b/drivers/usb/musb-new/musb_gadget.c index b35d33ffedf444d177f5bff915fc4e6ae6e6b555..35d2123dddeeb78a04fea121d46d3820ee8f2085 100644 --- a/drivers/usb/musb-new/musb_gadget.c +++ b/drivers/usb/musb-new/musb_gadget.c @@ -9,6 +9,8 @@ */ #ifndef __UBOOT__ +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/timer.h> diff --git a/drivers/usb/musb-new/musb_gadget_ep0.c b/drivers/usb/musb-new/musb_gadget_ep0.c index 3ef8fe13732d26220017a5df7047ac5f63e0d1f1..79e8222e3b3f7766ea6117154601e545dacb85de 100644 --- a/drivers/usb/musb-new/musb_gadget_ep0.c +++ b/drivers/usb/musb-new/musb_gadget_ep0.c @@ -9,6 +9,7 @@ */ #ifndef __UBOOT__ +#include <dm/device_compat.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/timer.h> diff --git a/drivers/usb/musb-new/musb_host.c b/drivers/usb/musb-new/musb_host.c index 8e92ade471818ffe6a9dcea31c43889800da0df7..b98f0ed40ee0ee059294d9070e81d9e9a50fb9e8 100644 --- a/drivers/usb/musb-new/musb_host.c +++ b/drivers/usb/musb-new/musb_host.c @@ -9,6 +9,8 @@ */ #ifndef __UBOOT__ +#include <dm/device_compat.h> +#include <dm/devres.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/delay.h> diff --git a/drivers/usb/musb-new/musb_uboot.c b/drivers/usb/musb-new/musb_uboot.c index 9eb593402ea0c55c625adc09b052a38805e11995..72f14b93438780411e7d2cd334443db9f8b51925 100644 --- a/drivers/usb/musb-new/musb_uboot.c +++ b/drivers/usb/musb-new/musb_uboot.c @@ -1,6 +1,8 @@ #include <common.h> #include <console.h> +#include <malloc.h> #include <watchdog.h> +#include <linux/err.h> #include <linux/errno.h> #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> diff --git a/drivers/usb/musb-new/omap2430.c b/drivers/usb/musb-new/omap2430.c index 05059ce3cbdef1cd03a4795ba0e4070facce0941..0d34dcfc5d18ce53562b2f8a0a8add42cf5e1d2b 100644 --- a/drivers/usb/musb-new/omap2430.c +++ b/drivers/usb/musb-new/omap2430.c @@ -12,7 +12,9 @@ #include <dm.h> #include <serial.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> +#include <linux/err.h> #include <linux/usb/otg.h> #include <asm/omap_common.h> #include <asm/omap_musb.h> diff --git a/drivers/usb/musb-new/pic32.c b/drivers/usb/musb-new/pic32.c index 3a19900e21c1a9d525c2784c71f2601599922c93..c7867fef8acb4354015b463f6b39b675d1ff42f9 100644 --- a/drivers/usb/musb-new/pic32.c +++ b/drivers/usb/musb-new/pic32.c @@ -10,6 +10,7 @@ */ #include <common.h> +#include <dm/device_compat.h> #include <linux/usb/musb.h> #include "linux-compat.h" #include "musb_core.h" diff --git a/drivers/usb/musb-new/sunxi.c b/drivers/usb/musb-new/sunxi.c index 45eecfeee6c0c040b53e61a2a0e42a96e1ef522f..98bf73697872e7129a5be9d50fd36a1bfc8441d9 100644 --- a/drivers/usb/musb-new/sunxi.c +++ b/drivers/usb/musb-new/sunxi.c @@ -19,12 +19,14 @@ #include <clk.h> #include <dm.h> #include <generic-phy.h> +#include <malloc.h> #include <phy-sun4i-usb.h> #include <reset.h> #include <asm/arch/cpu.h> #include <asm/arch/clock.h> #include <asm/arch/gpio.h> #include <asm-generic/gpio.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <dm/root.h> #include <linux/usb/musb.h> diff --git a/drivers/usb/musb-new/ti-musb.c b/drivers/usb/musb-new/ti-musb.c index 20ca2731b49a8dc50a8bae944f79839a582ddd70..00759f3e832e70879819b83c70de5464b6ba90fd 100644 --- a/drivers/usb/musb-new/ti-musb.c +++ b/drivers/usb/musb-new/ti-musb.c @@ -9,6 +9,7 @@ #include <command.h> #include <console.h> #include <dm.h> +#include <malloc.h> #include <linux/usb/otg.h> #include <dm/device-internal.h> #include <dm/lists.h> diff --git a/drivers/usb/phy/omap_usb_phy.c b/drivers/usb/phy/omap_usb_phy.c index 897e6f19f7853d600ef8872a02406fd5cc0f677e..9209942430a42118183f21a31151d9fdb5392631 100644 --- a/drivers/usb/phy/omap_usb_phy.c +++ b/drivers/usb/phy/omap_usb_phy.c @@ -10,6 +10,7 @@ #include <common.h> #include <usb.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <asm/omap_common.h> #include <asm/arch/cpu.h> diff --git a/drivers/video/atmel_hlcdfb.c b/drivers/video/atmel_hlcdfb.c index 734bc12c7bb4dba241e88d313932e9af4a62433e..62acccedf377ee1ba6d823f7129bb8fae9262c5c 100644 --- a/drivers/video/atmel_hlcdfb.c +++ b/drivers/video/atmel_hlcdfb.c @@ -7,6 +7,7 @@ #include <common.h> #include <cpu_func.h> +#include <malloc.h> #include <asm/io.h> #include <asm/arch/gpio.h> #include <asm/arch/clk.h> diff --git a/drivers/video/console_truetype.c b/drivers/video/console_truetype.c index 30086600fb1fd973b5b7b094c4494e7498f254c3..6d7661db89d7e3020e84f171e2f3bee014cf24d1 100644 --- a/drivers/video/console_truetype.c +++ b/drivers/video/console_truetype.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <video.h> #include <video_console.h> @@ -286,6 +287,27 @@ static int console_truetype_putc_xy(struct udevice *dev, uint x, uint y, } break; } +#endif +#ifdef CONFIG_VIDEO_BPP32 + case VIDEO_BPP32: { + u32 *dst = (u32 *)line + xoff; + int i; + + for (i = 0; i < width; i++) { + int val = *bits; + int out; + + if (vid_priv->colour_bg) + val = 255 - val; + out = val | val << 8 | val << 16; + if (vid_priv->colour_fg) + *dst++ |= out; + else + *dst++ &= out; + bits++; + } + break; + } #endif default: free(data); diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 285633b14d6c275fea880b9e6c2a7cdef43bc593..5fb68865ef4631adffba5be54598ed35ef6d2360 100644 --- a/drivers/video/da8xx-fb.c +++ b/drivers/video/da8xx-fb.c @@ -13,6 +13,7 @@ */ #include <common.h> +#include <malloc.h> #include <memalign.h> #include <video_fb.h> #include <linux/list.h> diff --git a/drivers/video/dw_mipi_dsi.c b/drivers/video/dw_mipi_dsi.c index 83d7c7b2c0476692b36637536670eb449c25c58d..5dd75e7ec82c6d7d6f548597f5a3dbb9eb481e81 100644 --- a/drivers/video/dw_mipi_dsi.c +++ b/drivers/video/dw_mipi_dsi.c @@ -19,6 +19,7 @@ #include <asm/io.h> #include <asm/arch/gpio.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <linux/iopoll.h> #include <video_bridge.h> diff --git a/drivers/video/exynos/exynos_mipi_dsi.c b/drivers/video/exynos/exynos_mipi_dsi.c index 74a66e83d224b2c8214a18832bb3771946501b45..ad5ef93e01f9e3e6be98b3dec85db27d32f67cd4 100644 --- a/drivers/video/exynos/exynos_mipi_dsi.c +++ b/drivers/video/exynos/exynos_mipi_dsi.c @@ -9,6 +9,7 @@ #include <common.h> #include <malloc.h> #include <fdtdec.h> +#include <dm/devres.h> #include <linux/libfdt.h> #include <linux/compat.h> #include <linux/err.h> diff --git a/drivers/video/hitachi_tx18d42vm_lcd.c b/drivers/video/hitachi_tx18d42vm_lcd.c index 1629f558d0f182e6d5adec66a0dd822528438920..a57abd23f73b42ba117d6379f9a52738ffc6c899 100644 --- a/drivers/video/hitachi_tx18d42vm_lcd.c +++ b/drivers/video/hitachi_tx18d42vm_lcd.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/gpio.h> #include <errno.h> diff --git a/drivers/video/mali_dp.c b/drivers/video/mali_dp.c index 71151a87aaca9f3782ce3878fcac4a55a1980e06..87a75a9ca2abbeb05f2e9c676ebdc274e0e66c2a 100644 --- a/drivers/video/mali_dp.c +++ b/drivers/video/mali_dp.c @@ -6,6 +6,7 @@ */ #define DEBUG #include <common.h> +#include <malloc.h> #include <video.h> #include <dm.h> #ifdef CONFIG_DISPLAY @@ -16,6 +17,7 @@ #include <os.h> #include <fdt_support.h> #include <clk.h> +#include <dm/device_compat.h> #include <linux/sizes.h> #define MALIDP_CORE_ID 0x0018 diff --git a/drivers/video/mipi_dsi.c b/drivers/video/mipi_dsi.c index cdc3ef58ab1a6e0ee189bc850e34318c6d71962d..ecacea1dbebdf549417dd375568bdebaf2580873 100644 --- a/drivers/video/mipi_dsi.c +++ b/drivers/video/mipi_dsi.c @@ -38,6 +38,7 @@ #include <dm.h> #include <mipi_display.h> #include <mipi_dsi.h> +#include <dm/devres.h> /** * DOC: dsi helpers diff --git a/drivers/video/mvebu_lcd.c b/drivers/video/mvebu_lcd.c index dc6254514adb428530dc9227fd1cb810bec77f72..3ff5b28ae2fd9206bbf63d21fedef9faa7642948 100644 --- a/drivers/video/mvebu_lcd.c +++ b/drivers/video/mvebu_lcd.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> #include <video.h> +#include <dm/device_compat.h> #include <linux/mbus.h> #include <asm/io.h> #include <asm/arch/cpu.h> diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c index c097682d00ae19f061684f96fb71509a052765d0..585af3d5714635c774b3554aa487581fc445c8f5 100644 --- a/drivers/video/mxsfb.c +++ b/drivers/video/mxsfb.c @@ -7,6 +7,7 @@ #include <common.h> #include <dm.h> #include <env.h> +#include <dm/device_compat.h> #include <linux/errno.h> #include <malloc.h> #include <video.h> diff --git a/drivers/video/orisetech_otm8009a.c b/drivers/video/orisetech_otm8009a.c index 89d9cfdbb333564a5aa1fa55cf38944b9208ae5d..650ed0723932ebcae0af53c7c2b03c018d91540f 100644 --- a/drivers/video/orisetech_otm8009a.c +++ b/drivers/video/orisetech_otm8009a.c @@ -13,6 +13,7 @@ #include <mipi_dsi.h> #include <panel.h> #include <asm/gpio.h> +#include <dm/device_compat.h> #include <power/regulator.h> #define OTM8009A_BACKLIGHT_DEFAULT 240 diff --git a/drivers/video/pwm_backlight.c b/drivers/video/pwm_backlight.c index ad20bf2441f38a1e0980a7664ced5b1a31a18c80..742579aba71940bdcf991da560de801c27a15108 100644 --- a/drivers/video/pwm_backlight.c +++ b/drivers/video/pwm_backlight.c @@ -9,6 +9,7 @@ #include <common.h> #include <dm.h> #include <backlight.h> +#include <malloc.h> #include <pwm.h> #include <asm/gpio.h> #include <power/regulator.h> diff --git a/drivers/video/raydium-rm68200.c b/drivers/video/raydium-rm68200.c index 91555e26edaf718e73582637ae38aabc71782883..853dbc52d61268ef0ab6e74a2a690e53cc19fa73 100644 --- a/drivers/video/raydium-rm68200.c +++ b/drivers/video/raydium-rm68200.c @@ -13,6 +13,7 @@ #include <mipi_dsi.h> #include <panel.h> #include <asm/gpio.h> +#include <dm/device_compat.h> #include <power/regulator.h> /*** Manufacturer Command Set ***/ diff --git a/drivers/video/rockchip/rk3288_hdmi.c b/drivers/video/rockchip/rk3288_hdmi.c index 3d25ce924c28ebe221c352d5106cfd5e6f97cb48..51eb41540bc2a1f7b8bab9d86ef90e4c76854ce5 100644 --- a/drivers/video/rockchip/rk3288_hdmi.c +++ b/drivers/video/rockchip/rk3288_hdmi.c @@ -9,6 +9,7 @@ #include <dm.h> #include <dw_hdmi.h> #include <edid.h> +#include <malloc.h> #include <regmap.h> #include <syscon.h> #include <asm/gpio.h> diff --git a/drivers/video/rockchip/rk3288_mipi.c b/drivers/video/rockchip/rk3288_mipi.c index 65891ce45c240c9d9c09c93ad7b557c5e1a5bd9c..f4444b9c3487494d20ef524967ea512d3bd354b1 100644 --- a/drivers/video/rockchip/rk3288_mipi.c +++ b/drivers/video/rockchip/rk3288_mipi.c @@ -16,6 +16,7 @@ #include <asm/gpio.h> #include <asm/io.h> #include <dm/uclass-internal.h> +#include <linux/err.h> #include <linux/kernel.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru.h> diff --git a/drivers/video/rockchip/rk3399_mipi.c b/drivers/video/rockchip/rk3399_mipi.c index a5b7ba69a8b8e00fdd0e3423710fd6a5d060ff64..74ebe770a9521b13d7b515aa79592de404fb3fed 100644 --- a/drivers/video/rockchip/rk3399_mipi.c +++ b/drivers/video/rockchip/rk3399_mipi.c @@ -16,6 +16,7 @@ #include <asm/gpio.h> #include <asm/io.h> #include <dm/uclass-internal.h> +#include <linux/err.h> #include <linux/kernel.h> #include <asm/arch-rockchip/clock.h> #include <asm/arch-rockchip/cru.h> diff --git a/drivers/video/rockchip/rk_edp.c b/drivers/video/rockchip/rk_edp.c index 4330725a251380e5be1e3365fa75a707c40715a7..8703df0ec081d05e757eedd6cc45f1f9cd17d930 100644 --- a/drivers/video/rockchip/rk_edp.c +++ b/drivers/video/rockchip/rk_edp.c @@ -9,6 +9,7 @@ #include <display.h> #include <dm.h> #include <edid.h> +#include <malloc.h> #include <panel.h> #include <regmap.h> #include <syscon.h> diff --git a/drivers/video/rockchip/rk_vop.c b/drivers/video/rockchip/rk_vop.c index b56c3f336c99f4f4b5d3052a54f76feb3a2d72ec..e91d4dfa7fba6080280ff6df574074a342c9645c 100644 --- a/drivers/video/rockchip/rk_vop.c +++ b/drivers/video/rockchip/rk_vop.c @@ -19,6 +19,7 @@ #include <asm/arch-rockchip/vop_rk3288.h> #include <dm/device-internal.h> #include <dm/uclass-internal.h> +#include <linux/err.h> #include <power/regulator.h> #include "rk_vop.h" diff --git a/drivers/video/sandbox_osd.c b/drivers/video/sandbox_osd.c index dd84489add0640b3e6f58d708186556bf32356b5..7e722326b3d9364e57a651ea37711fcd7e15425a 100644 --- a/drivers/video/sandbox_osd.c +++ b/drivers/video/sandbox_osd.c @@ -6,6 +6,7 @@ #include <common.h> #include <display.h> #include <dm.h> +#include <malloc.h> #include <video_osd.h> #include "sandbox_osd.h" diff --git a/drivers/video/sandbox_sdl.c b/drivers/video/sandbox_sdl.c index 913651c565c8affe67c7ccbd22899fe220cd59ca..1196e6c671771d849b35b041da71a4ea574412af 100644 --- a/drivers/video/sandbox_sdl.c +++ b/drivers/video/sandbox_sdl.c @@ -8,6 +8,7 @@ #include <fdtdec.h> #include <video.h> #include <asm/sdl.h> +#include <asm/state.h> #include <asm/u-boot-sandbox.h> #include <dm/test.h> @@ -23,9 +24,11 @@ static int sandbox_sdl_probe(struct udevice *dev) { struct sandbox_sdl_plat *plat = dev_get_platdata(dev); struct video_priv *uc_priv = dev_get_uclass_priv(dev); + struct sandbox_state *state = state_get_current(); int ret; - ret = sandbox_sdl_init_display(plat->xres, plat->yres, plat->bpix); + ret = sandbox_sdl_init_display(plat->xres, plat->yres, plat->bpix, + state->double_lcd); if (ret) { puts("LCD init failed\n"); return ret; @@ -44,13 +47,11 @@ static int sandbox_sdl_bind(struct udevice *dev) { struct video_uc_platdata *uc_plat = dev_get_uclass_platdata(dev); struct sandbox_sdl_plat *plat = dev_get_platdata(dev); - const void *blob = gd->fdt_blob; - int node = dev_of_offset(dev); int ret = 0; - plat->xres = fdtdec_get_int(blob, node, "xres", LCD_MAX_WIDTH); - plat->yres = fdtdec_get_int(blob, node, "yres", LCD_MAX_HEIGHT); - plat->bpix = VIDEO_BPP16; + plat->xres = dev_read_u32_default(dev, "xres", LCD_MAX_WIDTH); + plat->yres = dev_read_u32_default(dev, "yres", LCD_MAX_HEIGHT); + plat->bpix = dev_read_u32_default(dev, "log2-depth", VIDEO_BPP16); uc_plat->size = plat->xres * plat->yres * (1 << plat->bpix) / 8; debug("%s: Frame buffer size %x\n", __func__, uc_plat->size); diff --git a/drivers/video/scf0403_lcd.c b/drivers/video/scf0403_lcd.c index 58564e8cfe33f668daafd44b85a7854e99a43ade..60075a6cf325d34bf3c0618248017193ff9591ad 100644 --- a/drivers/video/scf0403_lcd.c +++ b/drivers/video/scf0403_lcd.c @@ -14,6 +14,7 @@ */ #include <common.h> +#include <malloc.h> #include <asm/gpio.h> #include <spi.h> diff --git a/drivers/video/ssd2828.c b/drivers/video/ssd2828.c index 4d40dca0c8e360660179549a5f1ab3f369f08218..83566bc6d66736789dd43bd275531b2710122282 100644 --- a/drivers/video/ssd2828.c +++ b/drivers/video/ssd2828.c @@ -10,6 +10,7 @@ */ #include <common.h> +#include <malloc.h> #include <mipi_display.h> #include <asm/arch/gpio.h> #include <asm/gpio.h> diff --git a/drivers/video/stm32/stm32_dsi.c b/drivers/video/stm32/stm32_dsi.c index 12895a8f5d8c5ff0918e02df543a5e9d73e5f49b..ded03b109c90fb911e1e96fac9ded79f79ccd36d 100644 --- a/drivers/video/stm32/stm32_dsi.c +++ b/drivers/video/stm32/stm32_dsi.c @@ -20,6 +20,7 @@ #include <asm/io.h> #include <asm/arch/gpio.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/lists.h> #include <linux/iopoll.h> #include <power/regulator.h> diff --git a/drivers/video/stm32/stm32_ltdc.c b/drivers/video/stm32/stm32_ltdc.c index 59ff692b0b4cf98cf3ca036a9ca8142e2a239108..be7e9bff01bce275a4451e96793a8d0dea524efa 100644 --- a/drivers/video/stm32/stm32_ltdc.c +++ b/drivers/video/stm32/stm32_ltdc.c @@ -16,6 +16,7 @@ #include <asm/io.h> #include <asm/arch/gpio.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> struct stm32_ltdc_priv { void __iomem *regs; diff --git a/drivers/video/tegra124/sor.c b/drivers/video/tegra124/sor.c index 172bb14d6c8175c0b32f7066bdb9ae7004dfed88..8dc3df61aad14c88dce594740af221f0486478e0 100644 --- a/drivers/video/tegra124/sor.c +++ b/drivers/video/tegra124/sor.c @@ -15,6 +15,7 @@ #include <asm/arch-tegra/dc.h> #include "displayport.h" #include "sor.h" +#include <linux/err.h> #define DEBUG_SOR 0 diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c index 12057c8a5beaacb0acb96f63fb6bf7f623a33de1..3d658e61d7c6ccba03164ca239b6962a85478fb2 100644 --- a/drivers/video/video-uclass.c +++ b/drivers/video/video-uclass.c @@ -6,6 +6,7 @@ #include <common.h> #include <cpu_func.h> #include <dm.h> +#include <malloc.h> #include <mapmem.h> #include <stdio_dev.h> #include <video.h> diff --git a/drivers/virtio/virtio-uclass.c b/drivers/virtio/virtio-uclass.c index 436faa46eecffafffa67f7a22153c2d9c761cf42..23f281cd6eb2f9af135ba69097773c68313e334f 100644 --- a/drivers/virtio/virtio-uclass.c +++ b/drivers/virtio/virtio-uclass.c @@ -17,6 +17,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <virtio_types.h> #include <virtio.h> #include <dm/lists.h> diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index a67b35412240f36ce95baedcb4b6a232359f23dc..60ece133abe51eeb9bce6c03c95c682a46e678c9 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -13,6 +13,7 @@ #include <virtio.h> #include <virtio_ring.h> #include <linux/compat.h> +#include <linux/err.h> #include <linux/io.h> #include "virtio_mmio.h" diff --git a/drivers/virtio/virtio_pci_legacy.c b/drivers/virtio/virtio_pci_legacy.c index 202e5ab1d31bea62541ce7e5707dad3b29a4d4db..d9be2601bbab450afcb68f3331ed4ce1708a7065 100644 --- a/drivers/virtio/virtio_pci_legacy.c +++ b/drivers/virtio/virtio_pci_legacy.c @@ -13,6 +13,7 @@ #include <virtio_ring.h> #include <dm/device.h> #include <linux/compat.h> +#include <linux/err.h> #include <linux/io.h> #include "virtio_pci.h" diff --git a/drivers/virtio/virtio_pci_modern.c b/drivers/virtio/virtio_pci_modern.c index da76aea8d178401a498fda0dcae9081695855f52..4673f4ab550a68d33bd26b8651e7bb7b14a0e980 100644 --- a/drivers/virtio/virtio_pci_modern.c +++ b/drivers/virtio/virtio_pci_modern.c @@ -13,6 +13,7 @@ #include <virtio_ring.h> #include <dm/device.h> #include <linux/compat.h> +#include <linux/err.h> #include <linux/io.h> #include "virtio_pci.h" diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 0eeb3501c20536db7a7e42eac36cc9a837dcccce..45c48a927a5f08ce647bdeb8f6a7ac0b2256ced0 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -12,6 +12,7 @@ #include <virtio_types.h> #include <virtio.h> #include <virtio_ring.h> +#include <linux/compat.h> int virtqueue_add(struct virtqueue *vq, struct virtio_sg *sgs[], unsigned int out_sgs, unsigned int in_sgs) diff --git a/drivers/virtio/virtio_sandbox.c b/drivers/virtio/virtio_sandbox.c index 2addb1ebc5e2f30fea82dfff0979bde6c17fe016..61f6a9600831974709a420c8fb784d1be9379d6f 100644 --- a/drivers/virtio/virtio_sandbox.c +++ b/drivers/virtio/virtio_sandbox.c @@ -11,6 +11,7 @@ #include <virtio.h> #include <virtio_ring.h> #include <linux/compat.h> +#include <linux/err.h> #include <linux/io.h> struct virtio_sandbox_priv { diff --git a/drivers/w1-eeprom/ds2502.c b/drivers/w1-eeprom/ds2502.c index 76ca460ed7f44869b0a3bc6c5abfcd7dcf639054..19ee4b17ea54507d47020fc17a562e15af94fe41 100644 --- a/drivers/w1-eeprom/ds2502.c +++ b/drivers/w1-eeprom/ds2502.c @@ -22,6 +22,7 @@ #include <common.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/err.h> #include <w1-eeprom.h> #include <w1.h> diff --git a/drivers/w1/mxc_w1.c b/drivers/w1/mxc_w1.c index 9279ba32b85478ce9b7df5c6b3b6cf89005e41c5..08715c6a666a431550644cfaf0cc014e712deeba 100644 --- a/drivers/w1/mxc_w1.c +++ b/drivers/w1/mxc_w1.c @@ -20,6 +20,7 @@ #include <asm/arch/clock.h> #include <common.h> #include <dm.h> +#include <dm/device_compat.h> #include <linux/io.h> #include <w1.h> diff --git a/drivers/watchdog/armada-37xx-wdt.c b/drivers/watchdog/armada-37xx-wdt.c index 91cd8a6e6a2ac3b74ae9c3dde9fa6adaffe0560e..5da8e56505fb2143637b893b291ea5940944eeab 100644 --- a/drivers/watchdog/armada-37xx-wdt.c +++ b/drivers/watchdog/armada-37xx-wdt.c @@ -11,6 +11,7 @@ #include <asm/io.h> #include <asm/arch/cpu.h> #include <asm/arch/soc.h> +#include <dm/device_compat.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c index d344d54aee828fdeb2ff72dbe79ec557fc998d52..fe2f6be5a74dbe1c7326c42a4f602e3c6eeff93c 100644 --- a/drivers/watchdog/ast_wdt.c +++ b/drivers/watchdog/ast_wdt.c @@ -9,6 +9,7 @@ #include <wdt.h> #include <asm/io.h> #include <asm/arch/wdt.h> +#include <linux/err.h> #define WDT_AST2500 2500 #define WDT_AST2400 2400 diff --git a/drivers/watchdog/cdns_wdt.c b/drivers/watchdog/cdns_wdt.c index 6a608b6371fdacc5eacfeae1e92dcfcb5e7232d0..775f06a6e1c20b46ab86affbbc76794f9b320d16 100644 --- a/drivers/watchdog/cdns_wdt.c +++ b/drivers/watchdog/cdns_wdt.c @@ -11,6 +11,8 @@ #include <wdt.h> #include <clk.h> #include <div64.h> +#include <dm/device_compat.h> +#include <linux/err.h> #include <linux/io.h> DECLARE_GLOBAL_DATA_PTR; diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c index f1e781e4e6ecea10841ad8a9653d1662a8e47a7d..ca3ccbe76cbad1ea35b8d74ee9d94eab6e303da3 100644 --- a/drivers/watchdog/sp805_wdt.c +++ b/drivers/watchdog/sp805_wdt.c @@ -13,6 +13,7 @@ #include <linux/bitops.h> #include <watchdog.h> #include <wdt.h> +#include <linux/err.h> #define WDTLOAD 0x000 #define WDTCONTROL 0x008 diff --git a/drivers/watchdog/xilinx_tb_wdt.c b/drivers/watchdog/xilinx_tb_wdt.c index 929c8e60d37cc3e4eebbe4a3a8d467968f123922..5580764da7ce8d88fe1a6f8c65af28668f94447b 100644 --- a/drivers/watchdog/xilinx_tb_wdt.c +++ b/drivers/watchdog/xilinx_tb_wdt.c @@ -11,6 +11,7 @@ #include <common.h> #include <dm.h> #include <wdt.h> +#include <linux/err.h> #include <linux/io.h> #define XWT_CSR0_WRS_MASK 0x00000008 /* Reset status Mask */ diff --git a/fs/ext4/ext4_write.c b/fs/ext4/ext4_write.c index 3368bd8c005ae0a343987558c47f08177b30a383..67aeba1339d84298fb2c9b4335b6be391322dec4 100644 --- a/fs/ext4/ext4_write.c +++ b/fs/ext4/ext4_write.c @@ -22,6 +22,7 @@ #include <common.h> +#include <malloc.h> #include <memalign.h> #include <linux/stat.h> #include <div64.h> diff --git a/fs/ext4/ext4fs.c b/fs/ext4/ext4fs.c index 37b31d9f0fcc4d5674ce64277a1e28c0f3035712..1c616a26a272ba7c15736b317bbd9f50a2524dbe 100644 --- a/fs/ext4/ext4fs.c +++ b/fs/ext4/ext4fs.c @@ -25,6 +25,7 @@ #include <ext4fs.h> #include "ext4_common.h" #include <div64.h> +#include <malloc.h> int ext4fs_symlinknest; struct ext_filesystem ext_fs; diff --git a/fs/fat/fat_write.c b/fs/fat/fat_write.c index 8e4a235d7cba63a69123c9b10c541811d268aee6..4f96699e36331427aa20e7134742d8f641bd99cf 100644 --- a/fs/fat/fat_write.c +++ b/fs/fat/fat_write.c @@ -9,6 +9,7 @@ #include <command.h> #include <config.h> #include <fat.h> +#include <malloc.h> #include <asm/byteorder.h> #include <part.h> #include <linux/ctype.h> diff --git a/fs/sandbox/sandboxfs.c b/fs/sandbox/sandboxfs.c index 1e253611c367fe2f0b2fbd8be36ce2f54f69d684..af47224b6c6aa623644658ffba83c865a774ef9f 100644 --- a/fs/sandbox/sandboxfs.c +++ b/fs/sandbox/sandboxfs.c @@ -5,6 +5,7 @@ #include <common.h> #include <fs.h> +#include <malloc.h> #include <os.h> int sandbox_fs_set_blk_dev(struct blk_desc *rbdd, disk_partition_t *info) diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 782aa9a2509fda82d65f42b811aca7ce64576365..6835f86fec738ead9e737492b827565b35b1fbec 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c @@ -16,6 +16,7 @@ */ #include <hexdump.h> +#include <dm/devres.h> #ifndef __UBOOT__ #include <linux/module.h> diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c index 42f22a487e113f68c868427156f51637e90d95d9..f923d076525f19b4c32ce895ced911da3bc52ac6 100644 --- a/fs/ubifs/gc.c +++ b/fs/ubifs/gc.c @@ -41,6 +41,7 @@ * good, and GC takes extra care when moving them. */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/slab.h> #include <linux/pagemap.h> #include <linux/list_sort.h> diff --git a/fs/ubifs/io.c b/fs/ubifs/io.c index 7fe94e1093a44bd26d2672df3457ef2f833d61ba..8148055f6781f17489fe82a737a07c7564c2ff0a 100644 --- a/fs/ubifs/io.c +++ b/fs/ubifs/io.c @@ -59,6 +59,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc32.h> #include <linux/slab.h> #include <u-boot/crc.h> diff --git a/fs/ubifs/log.c b/fs/ubifs/log.c index 331a891a576d3a3323ddbdc13affd6ebc839ed50..5cbb8aa1b2e91fee12e70c4fb7b387e5ad9bcd64 100644 --- a/fs/ubifs/log.c +++ b/fs/ubifs/log.c @@ -16,6 +16,7 @@ */ #ifdef __UBOOT__ +#include <dm/devres.h> #include <linux/err.h> #endif #include "ubifs.h" diff --git a/fs/ubifs/lprops.c b/fs/ubifs/lprops.c index 5473d339978584d8777057c10a50a57e1ac6edbc..a7c45dd5ecb045a58ce1ef6d7d83af7fac692875 100644 --- a/fs/ubifs/lprops.c +++ b/fs/ubifs/lprops.c @@ -17,6 +17,7 @@ */ #ifdef __UBOOT__ +#include <malloc.h> #include <linux/err.h> #endif #include "ubifs.h" diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index c0076bde7428da3b3b51ecfee6d1e4191f018f2f..ebfb1d4dd78e738e8daff0e70534881233c87881 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c @@ -33,6 +33,7 @@ #include "ubifs.h" #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc16.h> #include <linux/math64.h> #include <linux/slab.h> diff --git a/fs/ubifs/lpt_commit.c b/fs/ubifs/lpt_commit.c index 260216205d9144f5784a389d1c65cef9be1f5770..aa5956c52e8d812bd1fd50988dc63b1e5456bad5 100644 --- a/fs/ubifs/lpt_commit.c +++ b/fs/ubifs/lpt_commit.c @@ -14,6 +14,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc16.h> #include <linux/slab.h> #include <linux/random.h> diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c index 5654d45dfbd970fbebe718edcbd83c44bbad7077..2740aaee8bec2a8e5ae2e195fd8c99056941d552 100644 --- a/fs/ubifs/master.c +++ b/fs/ubifs/master.c @@ -12,6 +12,7 @@ #include "ubifs.h" #ifdef __UBOOT__ +#include <dm/devres.h> #include <linux/compat.h> #include <linux/err.h> #include <ubi_uboot.h> diff --git a/fs/ubifs/orphan.c b/fs/ubifs/orphan.c index c807ff1beb96dd9a7084228679cc7ae0c7c6ca12..a67b3eec93a69bd8add879eb355db493d6f353e3 100644 --- a/fs/ubifs/orphan.c +++ b/fs/ubifs/orphan.c @@ -7,6 +7,7 @@ * Author: Adrian Hunter */ +#include <dm/devres.h> #include <linux/err.h> #include "ubifs.h" diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index b568012fec30bfa90205ce57d8776e43e7856293..3388efe2b78ed340d8663402dc69f66d53ecd329 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -36,6 +36,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc32.h> #include <linux/slab.h> #include <u-boot/crc.h> diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index 4064157f15497bb4d31389bb2660bf970f8257e0..3a9fa4130e0ea85101ae7e1b2ad69802a7a7100a 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c @@ -21,6 +21,7 @@ */ #ifdef __UBOOT__ +#include <dm/devres.h> #include <linux/compat.h> #include <linux/err.h> #endif diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c index 52db611d1c7bf60301b8fb743f8672518c4c711a..599e1a35fbf42b776c30847386bc16b3f7b518a1 100644 --- a/fs/ubifs/sb.c +++ b/fs/ubifs/sb.c @@ -16,6 +16,7 @@ #include "ubifs.h" #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/slab.h> #include <linux/random.h> #include <linux/math64.h> diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c index 8ff668eec6adac9cf35e2938f5507585a568fe28..876a6ee6616b0eed2d7ff3d7371a528ed9fbf715 100644 --- a/fs/ubifs/scan.c +++ b/fs/ubifs/scan.c @@ -17,6 +17,7 @@ #ifdef __UBOOT__ #include <hexdump.h> +#include <dm/devres.h> #include <linux/err.h> #endif #include "ubifs.h" diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index 9939b4404f0878c0fc453258c4d2de51778b327d..b38513660b6a2ab757c22b6be1da8b27b922f540 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c @@ -15,6 +15,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/init.h> #include <linux/slab.h> #include <linux/module.h> diff --git a/fs/ubifs/tnc.c b/fs/ubifs/tnc.c index 8afc08ad7d701924f9ba1a396ed53e5b4906abf7..fc6fdaff8d19d37203e549134f309ca469902cf9 100644 --- a/fs/ubifs/tnc.c +++ b/fs/ubifs/tnc.c @@ -19,6 +19,7 @@ */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/crc32.h> #include <linux/slab.h> #include <u-boot/crc.h> diff --git a/fs/ubifs/tnc_misc.c b/fs/ubifs/tnc_misc.c index b8ea7e9ddb67b5aa7f99fabee8ae30b381ae2b66..dfa9e91903ddbbb7b41421e87c4a05998ea814c3 100644 --- a/fs/ubifs/tnc_misc.c +++ b/fs/ubifs/tnc_misc.c @@ -16,6 +16,7 @@ */ #ifdef __UBOOT__ +#include <dm/devres.h> #include <linux/err.h> #endif #include "ubifs.h" diff --git a/fs/ubifs/ubifs.c b/fs/ubifs/ubifs.c index 1ffdfe0d9089ff5cc0232a74b9b3b531a9f9cb70..e097d284444959c857996b40d1b5b6bc6a515f23 100644 --- a/fs/ubifs/ubifs.c +++ b/fs/ubifs/ubifs.c @@ -14,8 +14,10 @@ #include <common.h> #include <env.h> #include <gzip.h> +#include <malloc.h> #include <memalign.h> #include "ubifs.h" +#include <dm/devres.h> #include <u-boot/zlib.h> #include <linux/compat.h> diff --git a/fs/yaffs2/yaffs_allocator.c b/fs/yaffs2/yaffs_allocator.c index 611061fb45ca14960cb261629912e9ada0ef168b..961dc22ef3d8fa7fde7af1c444216f6fdb614235 100644 --- a/fs/yaffs2/yaffs_allocator.c +++ b/fs/yaffs2/yaffs_allocator.c @@ -15,6 +15,7 @@ #include "yaffs_guts.h" #include "yaffs_trace.h" #include "yportenv.h" +#include <dm/devres.h> /* * Each entry in yaffs_tnode_list and yaffs_obj_list hold blocks diff --git a/fs/yaffs2/yaffs_checkptrw.c b/fs/yaffs2/yaffs_checkptrw.c index 997a618aee86c80435e722a22e87a58f7bc9b620..628f02bb48d25a15cc4dc64b7a1f993f42ea5599 100644 --- a/fs/yaffs2/yaffs_checkptrw.c +++ b/fs/yaffs2/yaffs_checkptrw.c @@ -13,6 +13,7 @@ #include "yaffs_checkptrw.h" #include "yaffs_getblockinfo.h" +#include <dm/devres.h> static int yaffs2_checkpt_space_ok(struct yaffs_dev *dev) { diff --git a/fs/yaffs2/yaffs_guts.c b/fs/yaffs2/yaffs_guts.c index c8b27adda91dee49989013366bc3de98bc42868d..e13a73298b4ccffc385dd1cb730001c5482cc1fd 100644 --- a/fs/yaffs2/yaffs_guts.c +++ b/fs/yaffs2/yaffs_guts.c @@ -13,6 +13,7 @@ #include "yportenv.h" #include "yaffs_trace.h" +#include <dm/devres.h> #include "yaffs_guts.h" #include "yaffs_getblockinfo.h" diff --git a/fs/yaffs2/yaffs_nandif.c b/fs/yaffs2/yaffs_nandif.c index 79b00ab3b7b40b492b823caeef66a69f979029f0..ee5a17206072e70a714b38c21127df84459e6b33 100644 --- a/fs/yaffs2/yaffs_nandif.c +++ b/fs/yaffs2/yaffs_nandif.c @@ -13,6 +13,7 @@ #include "yportenv.h" #include "yaffs_guts.h" +#include <malloc.h> #include "yaffs_nandif.h" diff --git a/fs/yaffs2/yaffs_summary.c b/fs/yaffs2/yaffs_summary.c index e9e1b5d85776939c20e37e272343c9eb44f1bf1a..4f9449a8447237af72fe7129dbfae6a35edd8296 100644 --- a/fs/yaffs2/yaffs_summary.c +++ b/fs/yaffs2/yaffs_summary.c @@ -28,6 +28,7 @@ #include "yaffs_nand.h" #include "yaffs_getblockinfo.h" #include "yaffs_bitmap.h" +#include <dm/devres.h> /* * The summary is built up in an array of summary tags. diff --git a/fs/yaffs2/yaffs_uboot_glue.c b/fs/yaffs2/yaffs_uboot_glue.c index 2a70e4a543e0b9e8608c6e6fd803988ac3af3a3e..7a15a02974d07c6b2aee58eb767cda7ca5bfd3ef 100644 --- a/fs/yaffs2/yaffs_uboot_glue.c +++ b/fs/yaffs2/yaffs_uboot_glue.c @@ -21,6 +21,7 @@ #include <common.h> #include <div64.h> +#include <malloc.h> #include <config.h> #include "nand.h" diff --git a/fs/yaffs2/yaffs_yaffs1.c b/fs/yaffs2/yaffs_yaffs1.c index 357d8f75dd8b3b22e30a50965d2d4e2bfbc83d7a..8c176b982fa28e53d2d9aa0e881a0830c8f462c4 100644 --- a/fs/yaffs2/yaffs_yaffs1.c +++ b/fs/yaffs2/yaffs_yaffs1.c @@ -18,6 +18,7 @@ #include "yaffs_getblockinfo.h" #include "yaffs_nand.h" #include "yaffs_attribs.h" +#include <dm/devres.h> int yaffs1_scan(struct yaffs_dev *dev) { diff --git a/fs/yaffs2/yaffs_yaffs2.c b/fs/yaffs2/yaffs_yaffs2.c index f76dcaeeb18c5027f1bccd3be136319589a6112d..14d497eb99b04755eff4ec6bb377d0a4d8567419 100644 --- a/fs/yaffs2/yaffs_yaffs2.c +++ b/fs/yaffs2/yaffs_yaffs2.c @@ -21,6 +21,7 @@ #include "yaffs_verify.h" #include "yaffs_attribs.h" #include "yaffs_summary.h" +#include <dm/devres.h> /* * Checkpoints are really no benefit on very small partitions. diff --git a/fs/yaffs2/yaffsfs.c b/fs/yaffs2/yaffsfs.c index 47abc6bedae7bf85c7eaea34dfdf1705065f297b..510faaeed14966ae1c12cd392778f66bbbb129e9 100644 --- a/fs/yaffs2/yaffsfs.c +++ b/fs/yaffs2/yaffsfs.c @@ -17,6 +17,7 @@ #include "yaffscfg.h" #include "yportenv.h" #include "yaffs_trace.h" +#include <dm/devres.h> #define YAFFSFS_MAX_SYMLINK_DEREFERENCES 5 diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index d6cf18744fda47e2103a597677c9bf560c00022f..05777e6afe0066aaa6c2fe476da52c3867932808 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -248,7 +248,7 @@ int gpio_xlate_offs_flags(struct udevice *dev, struct gpio_desc *desc, */ struct dm_gpio_ops { int (*request)(struct udevice *dev, unsigned offset, const char *label); - int (*free)(struct udevice *dev, unsigned offset); + int (*rfree)(struct udevice *dev, unsigned int offset); int (*direction_input)(struct udevice *dev, unsigned offset); int (*direction_output)(struct udevice *dev, unsigned offset, int value); diff --git a/include/bloblist.h b/include/bloblist.h index 85144010abea9e00edf67fddf288373e8f0303fc..609ac421d668368f58771b5de54f486d83bd4031 100644 --- a/include/bloblist.h +++ b/include/bloblist.h @@ -151,6 +151,19 @@ int bloblist_ensure_size(uint tag, int size, void **blobp); */ void *bloblist_ensure(uint tag, int size); +/** + * bloblist_ensure_size_ret() - Find or add a blob + * + * Find an existing blob, or add a new one if not found + * + * @tag: Tag to add (enum bloblist_tag_t) + * @sizep: Size of the blob to create; returns size of actual blob + * @blobp: Returns a pointer to blob on success + * @return 0 if OK, -ENOSPC if it is missing and could not be added due to lack + * of space + */ +int bloblist_ensure_size_ret(uint tag, int *sizep, void **blobp); + /** * bloblist_new() - Create a new, empty bloblist of a given size * @@ -170,7 +183,8 @@ int bloblist_new(ulong addr, uint size, uint flags); * @return 0 if OK, -ENOENT if the magic number doesn't match (indicating that * there problem is no bloblist at the given address), -EPROTONOSUPPORT * if the version does not match, -EIO if the checksum does not match, - * -EFBIG if the expected size does not match the detected size + * -EFBIG if the expected size does not match the detected size, -ENOSPC + * if the size is not large enough to hold the headers */ int bloblist_check(ulong addr, uint size); diff --git a/include/clk-uclass.h b/include/clk-uclass.h index e76d98e2f6751611de309f7c2764d852c08e67d3..dac42dab3681287bbe777a2effea7a25f5a1dfbf 100644 --- a/include/clk-uclass.h +++ b/include/clk-uclass.h @@ -53,14 +53,14 @@ struct clk_ops { */ int (*request)(struct clk *clock); /** - * free - Free a previously requested clock. + * rfree - Free a previously requested clock. * * This is the implementation of the client clk_free() API. * * @clock: The clock to free. * @return 0 if OK, or a negative error code. */ - int (*free)(struct clk *clock); + int (*rfree)(struct clk *clock); /** * get_rate() - Get current clock rate. * diff --git a/include/console.h b/include/console.h index e935c601f124d586ef8fa1ca4f5823e76c87de23..74afe22b7e8045c95852b2ed9c0793739cf10143 100644 --- a/include/console.h +++ b/include/console.h @@ -41,6 +41,25 @@ void console_record_reset(void); */ void console_record_reset_enable(void); +/** + * console_record_readline() - Read a line from the console output + * + * This reads the next available line from the console output previously + * recorded. + * + * @str: Place to put string + * @maxlen: Maximum length of @str including nul terminator + * @return length of string returned + */ +int console_record_readline(char *str, int maxlen); + +/** + * console_record_avail() - Get the number of available bytes in console output + * + * @return available bytes (0 if empty) + */ +int console_record_avail(void); + /** * console_announce_r() - print a U-Boot console on non-serial consoles * diff --git a/include/dm/device.h b/include/dm/device.h index 1138a09149f4b8c1222e5c03eff1a786e9537c44..ab806d0b7e9ef16028303cfc43c073970a011ee1 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -14,7 +14,6 @@ #include <dm/uclass-id.h> #include <fdtdec.h> #include <linker_lists.h> -#include <linux/compat.h> #include <linux/kernel.h> #include <linux/list.h> #include <linux/printk.h> @@ -409,7 +408,8 @@ const char *dev_get_uclass_name(const struct udevice *dev); * @return 0 if OK, -ENODEV if no such device, other error if the device fails * to probe */ -int device_get_child(struct udevice *parent, int index, struct udevice **devp); +int device_get_child(const struct udevice *parent, int index, + struct udevice **devp); /** * device_get_child_count() - Get the available child count of a device @@ -418,7 +418,7 @@ int device_get_child(struct udevice *parent, int index, struct udevice **devp); * * @parent: Parent device to check */ -int device_get_child_count(struct udevice *parent); +int device_get_child_count(const struct udevice *parent); /** * device_find_child_by_seq() - Find a child device based on a sequence @@ -439,7 +439,7 @@ int device_get_child_count(struct udevice *parent); * Set to NULL if none is found * @return 0 if OK, -ve on error */ -int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq, +int device_find_child_by_seq(const struct udevice *parent, int seq_or_req_seq, bool find_req_seq, struct udevice **devp); /** @@ -457,7 +457,7 @@ int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq, * Set to NULL if none is found * @return 0 if OK, -ve on error */ -int device_get_child_by_seq(struct udevice *parent, int seq, +int device_get_child_by_seq(const struct udevice *parent, int seq, struct udevice **devp); /** @@ -470,7 +470,7 @@ int device_get_child_by_seq(struct udevice *parent, int seq, * @devp: Returns pointer to device if found, otherwise this is set to NULL * @return 0 if OK, -ve on error */ -int device_find_child_by_of_offset(struct udevice *parent, int of_offset, +int device_find_child_by_of_offset(const struct udevice *parent, int of_offset, struct udevice **devp); /** @@ -485,7 +485,7 @@ int device_find_child_by_of_offset(struct udevice *parent, int of_offset, * @devp: Returns pointer to device if found, otherwise this is set to NULL * @return 0 if OK, -ve on error */ -int device_get_child_by_of_offset(struct udevice *parent, int of_offset, +int device_get_child_by_of_offset(const struct udevice *parent, int of_offset, struct udevice **devp); /** @@ -524,7 +524,8 @@ int device_get_global_by_ofnode(ofnode node, struct udevice **devp); * @devp: Returns first child device, or NULL if none * @return 0 */ -int device_find_first_child(struct udevice *parent, struct udevice **devp); +int device_find_first_child(const struct udevice *parent, + struct udevice **devp); /** * device_find_next_child() - Find the next child of a device @@ -548,7 +549,7 @@ int device_find_next_child(struct udevice **devp); * @devp: Returns device found, if any * @return 0 if found, else -ENODEV */ -int device_find_first_inactive_child(struct udevice *parent, +int device_find_first_inactive_child(const struct udevice *parent, enum uclass_id uclass_id, struct udevice **devp); @@ -560,7 +561,7 @@ int device_find_first_inactive_child(struct udevice *parent, * @devp: Returns first child device in that uclass, if any * @return 0 if found, else -ENODEV */ -int device_find_first_child_by_uclass(struct udevice *parent, +int device_find_first_child_by_uclass(const struct udevice *parent, enum uclass_id uclass_id, struct udevice **devp); @@ -572,9 +573,56 @@ int device_find_first_child_by_uclass(struct udevice *parent, * @devp: Returns device found, if any * @return 0 if found, else -ENODEV */ -int device_find_child_by_name(struct udevice *parent, const char *name, +int device_find_child_by_name(const struct udevice *parent, const char *name, struct udevice **devp); +/** + * device_first_child_ofdata_err() - Find the first child and reads its platdata + * + * The ofdata_to_platdata() method is called on the child before it is returned, + * but the child is not probed. + * + * @parent: Parent to check + * @devp: Returns child that was found, if any + * @return 0 on success, -ENODEV if no children, other -ve on error + */ +int device_first_child_ofdata_err(struct udevice *parent, + struct udevice **devp); + +/* + * device_next_child_ofdata_err() - Find the next child and read its platdata + * + * The ofdata_to_platdata() method is called on the child before it is returned, + * but the child is not probed. + * + * @devp: On entry, points to the previous child; on exit returns the child that + * was found, if any + * @return 0 on success, -ENODEV if no children, other -ve on error + */ +int device_next_child_ofdata_err(struct udevice **devp); + +/** + * device_first_child_err() - Get the first child of a device + * + * The device returned is probed if necessary, and ready for use + * + * @parent: Parent device to search + * @devp: Returns device found, if any + * @return 0 if found, -ENODEV if not, -ve error if device failed to probe + */ +int device_first_child_err(struct udevice *parent, struct udevice **devp); + +/** + * device_next_child_err() - Get the next child of a parent device + * + * The device returned is probed if necessary, and ready for use + * + * @devp: On entry, pointer to device to lookup. On exit, returns pointer + * to the next sibling if no error occurred + * @return 0 if found, -ENODEV if not, -ve error if device failed to probe + */ +int device_next_child_err(struct udevice **devp); + /** * device_has_children() - check if a device has any children * @@ -590,7 +638,7 @@ bool device_has_children(const struct udevice *dev); * @return true if the device has one or more children and at least one of * them is active (probed). */ -bool device_has_active_children(struct udevice *dev); +bool device_has_active_children(const struct udevice *dev); /** * device_is_last_sibling() - check if a device is the last sibling @@ -603,7 +651,7 @@ bool device_has_active_children(struct udevice *dev); * @return true if there are no more siblings after this one - i.e. is it * last in the list. */ -bool device_is_last_sibling(struct udevice *dev); +bool device_is_last_sibling(const struct udevice *dev); /** * device_set_name() - set the name of a device @@ -643,7 +691,7 @@ void device_set_name_alloced(struct udevice *dev); * device * @return true if OK, false if the compatible is not found */ -bool device_is_compatible(struct udevice *dev, const char *compat); +bool device_is_compatible(const struct udevice *dev, const char *compat); /** * of_machine_is_compatible() - check if the machine is compatible with @@ -678,7 +726,7 @@ int dev_enable_by_path(const char *path); * @dev: device to test * @return: true if it is on a PCI bus, false otherwise */ -static inline bool device_is_on_pci_bus(struct udevice *dev) +static inline bool device_is_on_pci_bus(const struct udevice *dev) { return device_get_uclass_id(dev->parent) == UCLASS_PCI; } @@ -704,6 +752,40 @@ static inline bool device_is_on_pci_bus(struct udevice *dev) #define device_foreach_child(pos, parent) \ list_for_each_entry(pos, &parent->child_head, sibling_node) +/** + * device_foreach_child_ofdata_to_platdata() - iterate through children + * + * This stops when it gets an error, with @pos set to the device that failed to + * read ofdata. + + * This creates a for() loop which works through the available children of + * a device in order from start to end. Device ofdata is read by calling + * device_ofdata_to_platdata() on each one. The devices are not probed. + * + * @pos: struct udevice * for the current device + * @parent: parent device to scan + */ +#define device_foreach_child_ofdata_to_platdata(pos, parent) \ + for (int _ret = device_first_child_ofdata_err(parent, &dev); !_ret; \ + _ret = device_next_child_ofdata_err(&dev)) + +/** + * device_foreach_child_probe() - iterate through children, probing them + * + * This creates a for() loop which works through the available children of + * a device in order from start to end. Devices are probed if necessary, + * and ready for use. + * + * This stops when it gets an error, with @pos set to the device that failed to + * probe + * + * @pos: struct udevice * for the current device + * @parent: parent device to scan + */ +#define device_foreach_child_probe(pos, parent) \ + for (int _ret = device_first_child_err(parent, &dev); !_ret; \ + _ret = device_next_child_err(&dev)) + /** * dm_scan_fdt_dev() - Bind child device in a the device tree * @@ -720,77 +802,4 @@ static inline bool device_is_on_pci_bus(struct udevice *dev) */ int dm_scan_fdt_dev(struct udevice *dev); -#include <dm/devres.h> - -/* - * REVISIT: - * remove the following after resolving conflicts with <linux/compat.h> - */ -#ifdef dev_dbg -#undef dev_dbg -#endif -#ifdef dev_vdbg -#undef dev_vdbg -#endif -#ifdef dev_info -#undef dev_info -#endif -#ifdef dev_err -#undef dev_err -#endif -#ifdef dev_warn -#undef dev_warn -#endif - -/* - * REVISIT: - * print device name like Linux - */ -#define dev_printk(dev, fmt, ...) \ -({ \ - printk(fmt, ##__VA_ARGS__); \ -}) - -#define __dev_printk(level, dev, fmt, ...) \ -({ \ - if (level < CONFIG_VAL(LOGLEVEL)) \ - dev_printk(dev, fmt, ##__VA_ARGS__); \ -}) - -#define dev_emerg(dev, fmt, ...) \ - __dev_printk(0, dev, fmt, ##__VA_ARGS__) -#define dev_alert(dev, fmt, ...) \ - __dev_printk(1, dev, fmt, ##__VA_ARGS__) -#define dev_crit(dev, fmt, ...) \ - __dev_printk(2, dev, fmt, ##__VA_ARGS__) -#define dev_err(dev, fmt, ...) \ - __dev_printk(3, dev, fmt, ##__VA_ARGS__) -#define dev_warn(dev, fmt, ...) \ - __dev_printk(4, dev, fmt, ##__VA_ARGS__) -#define dev_notice(dev, fmt, ...) \ - __dev_printk(5, dev, fmt, ##__VA_ARGS__) -#define dev_info(dev, fmt, ...) \ - __dev_printk(6, dev, fmt, ##__VA_ARGS__) - -#ifdef DEBUG -#define dev_dbg(dev, fmt, ...) \ - __dev_printk(7, dev, fmt, ##__VA_ARGS__) -#else -#define dev_dbg(dev, fmt, ...) \ -({ \ - if (0) \ - __dev_printk(7, dev, fmt, ##__VA_ARGS__); \ -}) -#endif - -#ifdef VERBOSE_DEBUG -#define dev_vdbg dev_dbg -#else -#define dev_vdbg(dev, fmt, ...) \ -({ \ - if (0) \ - __dev_printk(7, dev, fmt, ##__VA_ARGS__); \ -}) -#endif - #endif diff --git a/include/dm/device_compat.h b/include/dm/device_compat.h new file mode 100644 index 0000000000000000000000000000000000000000..3d8cd09f4c0efce96f649677e5b4c2f155ec198d --- /dev/null +++ b/include/dm/device_compat.h @@ -0,0 +1,86 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (c) 2013 Google, Inc + * + * (C) Copyright 2012 + * Pavel Herrmann <morpheus.ibis@gmail.com> + * Marek Vasut <marex@denx.de> + */ + +#ifndef _DM_DEVICE_COMPAT_H +#define _DM_DEVICE_COMPAT_H + +#include <linux/compat.h> + +/* + * REVISIT: + * remove the following after resolving conflicts with <linux/compat.h> + */ +#ifdef dev_dbg +#undef dev_dbg +#endif +#ifdef dev_vdbg +#undef dev_vdbg +#endif +#ifdef dev_info +#undef dev_info +#endif +#ifdef dev_err +#undef dev_err +#endif +#ifdef dev_warn +#undef dev_warn +#endif + +/* + * REVISIT: + * print device name like Linux + */ +#define dev_printk(dev, fmt, ...) \ +({ \ + printk(fmt, ##__VA_ARGS__); \ +}) + +#define __dev_printk(level, dev, fmt, ...) \ +({ \ + if (level < CONFIG_VAL(LOGLEVEL)) \ + dev_printk(dev, fmt, ##__VA_ARGS__); \ +}) + +#define dev_emerg(dev, fmt, ...) \ + __dev_printk(0, dev, fmt, ##__VA_ARGS__) +#define dev_alert(dev, fmt, ...) \ + __dev_printk(1, dev, fmt, ##__VA_ARGS__) +#define dev_crit(dev, fmt, ...) \ + __dev_printk(2, dev, fmt, ##__VA_ARGS__) +#define dev_err(dev, fmt, ...) \ + __dev_printk(3, dev, fmt, ##__VA_ARGS__) +#define dev_warn(dev, fmt, ...) \ + __dev_printk(4, dev, fmt, ##__VA_ARGS__) +#define dev_notice(dev, fmt, ...) \ + __dev_printk(5, dev, fmt, ##__VA_ARGS__) +#define dev_info(dev, fmt, ...) \ + __dev_printk(6, dev, fmt, ##__VA_ARGS__) + +#ifdef DEBUG +#define dev_dbg(dev, fmt, ...) \ + __dev_printk(7, dev, fmt, ##__VA_ARGS__) +#else +#define dev_dbg(dev, fmt, ...) \ +({ \ + if (0) \ + __dev_printk(7, dev, fmt, ##__VA_ARGS__); \ +}) +#endif + +#ifdef VERBOSE_DEBUG +#define dev_vdbg dev_dbg +#else +#define dev_vdbg(dev, fmt, ...) \ +({ \ + if (0) \ + __dev_printk(7, dev, fmt, ##__VA_ARGS__); \ +}) +#endif + +#endif diff --git a/include/dm/devres.h b/include/dm/devres.h index 9c6919605454bf12839be16f93697f493c35dade..17bb1ee8dad1b9b7ce377e5f12258540ac450c01 100644 --- a/include/dm/devres.h +++ b/include/dm/devres.h @@ -11,6 +11,10 @@ #ifndef _DM_DEVRES_H #define _DM_DEVRES_H +#include <linux/compat.h> + +struct udevice; + /* device resource management */ typedef void (*dr_release_t)(struct udevice *dev, void *res); typedef int (*dr_match_t)(struct udevice *dev, void *res, void *match_data); diff --git a/include/dm/fdtaddr.h b/include/dm/fdtaddr.h index 959d3bc2d69934937b217932867c53ffc60fcbaa..a4fda581a77a3a91c10f6d0d5b1fcf03fb6b38e3 100644 --- a/include/dm/fdtaddr.h +++ b/include/dm/fdtaddr.h @@ -21,7 +21,7 @@ struct udevice; * * @return addr */ -fdt_addr_t devfdt_get_addr(struct udevice *dev); +fdt_addr_t devfdt_get_addr(const struct udevice *dev); /** * devfdt_get_addr_ptr() - Return pointer to the address of the reg property @@ -31,7 +31,7 @@ fdt_addr_t devfdt_get_addr(struct udevice *dev); * * @return Pointer to addr, or NULL if there is no such property */ -void *devfdt_get_addr_ptr(struct udevice *dev); +void *devfdt_get_addr_ptr(const struct udevice *dev); /** * devfdt_remap_addr() - Return pointer to the memory-mapped I/O address @@ -41,7 +41,7 @@ void *devfdt_get_addr_ptr(struct udevice *dev); * * @return Pointer to addr, or NULL if there is no such property */ -void *devfdt_remap_addr(struct udevice *dev); +void *devfdt_remap_addr(const struct udevice *dev); /** * devfdt_remap_addr_index() - Return indexed pointer to the memory-mapped @@ -53,7 +53,7 @@ void *devfdt_remap_addr(struct udevice *dev); * * @return Pointer to addr, or NULL if there is no such property */ -void *devfdt_remap_addr_index(struct udevice *dev, int index); +void *devfdt_remap_addr_index(const struct udevice *dev, int index); /** * devfdt_remap_addr_name() - Get the reg property of a device, indexed by @@ -66,7 +66,7 @@ void *devfdt_remap_addr_index(struct udevice *dev, int index); * * @return Pointer to addr, or NULL if there is no such property */ -void *devfdt_remap_addr_name(struct udevice *dev, const char *name); +void *devfdt_remap_addr_name(const struct udevice *dev, const char *name); /** * devfdt_map_physmem() - Read device address from reg property of the @@ -79,7 +79,7 @@ void *devfdt_remap_addr_name(struct udevice *dev, const char *name); * @return mapped address, or NULL if the device does not have reg * property. */ -void *devfdt_map_physmem(struct udevice *dev, unsigned long size); +void *devfdt_map_physmem(const struct udevice *dev, unsigned long size); /** * devfdt_get_addr_index() - Get the indexed reg property of a device @@ -90,7 +90,7 @@ void *devfdt_map_physmem(struct udevice *dev, unsigned long size); * * @return addr */ -fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index); +fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index); /** * devfdt_get_addr_size_index() - Get the indexed reg property of a device @@ -105,8 +105,8 @@ fdt_addr_t devfdt_get_addr_index(struct udevice *dev, int index); * * @return addr */ -fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index, - fdt_size_t *size); +fdt_addr_t devfdt_get_addr_size_index(const struct udevice *dev, int index, + fdt_size_t *size); /** * devfdt_get_addr_name() - Get the reg property of a device, indexed by name @@ -118,7 +118,7 @@ fdt_addr_t devfdt_get_addr_size_index(struct udevice *dev, int index, * * @return addr */ -fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name); +fdt_addr_t devfdt_get_addr_name(const struct udevice *dev, const char *name); /** * devfdt_get_addr_size_name() - Get the reg property and its size for a device, @@ -135,8 +135,8 @@ fdt_addr_t devfdt_get_addr_name(struct udevice *dev, const char *name); * * @return addr */ -fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name, - fdt_size_t *size); +fdt_addr_t devfdt_get_addr_size_name(const struct udevice *dev, + const char *name, fdt_size_t *size); /** * devfdt_get_addr_pci() - Read an address and handle PCI address translation @@ -144,6 +144,6 @@ fdt_addr_t devfdt_get_addr_size_name(struct udevice *dev, const char *name, * @dev: Device to read from * @return address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t devfdt_get_addr_pci(struct udevice *dev); +fdt_addr_t devfdt_get_addr_pci(const struct udevice *dev); #endif diff --git a/include/dm/ofnode.h b/include/dm/ofnode.h index 4282169706c112eac434df7a9f3a572485974220..b5a50e88499a04d15b7e0c3cee29367a7ed31454 100644 --- a/include/dm/ofnode.h +++ b/include/dm/ofnode.h @@ -256,10 +256,21 @@ int ofnode_read_u64(ofnode node, const char *propname, u64 *outp); */ u64 ofnode_read_u64_default(ofnode node, const char *propname, u64 def); +/** + * ofnode_read_prop() - Read a property from a node + * + * @node: valid node reference to read property from + * @propname: name of the property to read + * @sizep: if non-NULL, returns the size of the property, or an error code + if not found + * @return property value, or NULL if there is no such property + */ +const void *ofnode_read_prop(ofnode node, const char *propname, int *sizep); + /** * ofnode_read_string() - Read a string from a property * - * @ref: valid node reference to read property from + * @node: valid node reference to read property from * @propname: name of the property to read * @return string from property value, or NULL if there is no such property */ @@ -510,21 +521,37 @@ int ofnode_count_phandle_with_args(ofnode node, const char *list_name, ofnode ofnode_path(const char *path); /** - * ofnode_get_chosen_prop() - get the value of a chosen property + * ofnode_read_chosen_prop() - get the value of a chosen property * * This looks for a property within the /chosen node and returns its value * * @propname: Property name to look for + * @sizep: Returns size of property, or FDT_ERR_... error code if function + * returns NULL * @return property value if found, else NULL */ -const char *ofnode_get_chosen_prop(const char *propname); +const void *ofnode_read_chosen_prop(const char *propname, int *sizep); /** - * ofnode_get_chosen_node() - get the chosen node + * ofnode_read_chosen_string() - get the string value of a chosen property + * + * This looks for a property within the /chosen node and returns its value, + * checking that it is a valid nul-terminated string + * + * @propname: Property name to look for + * @return string value if found, else NULL + */ +const char *ofnode_read_chosen_string(const char *propname); + +/** + * ofnode_get_chosen_node() - get a referenced node from the chosen node + * + * This looks up a named property in the chosen node and uses that as a path to + * look up a code. * - * @return the chosen node if present, else ofnode_null() + * @return the referenced node if present, else ofnode_null() */ -ofnode ofnode_get_chosen_node(const char *name); +ofnode ofnode_get_chosen_node(const char *propname); struct display_timing; /** diff --git a/include/dm/read.h b/include/dm/read.h index d37fcb504d3471d48455fb769008a1321af820ab..da8c7f25e7ca08421fe4f4d13cc368b051ff31f1 100644 --- a/include/dm/read.h +++ b/include/dm/read.h @@ -16,12 +16,12 @@ struct resource; #if CONFIG_IS_ENABLED(OF_LIVE) -static inline const struct device_node *dev_np(struct udevice *dev) +static inline const struct device_node *dev_np(const struct udevice *dev) { return ofnode_to_np(dev->node); } #else -static inline const struct device_node *dev_np(struct udevice *dev) +static inline const struct device_node *dev_np(const struct udevice *dev) { return NULL; } @@ -33,12 +33,12 @@ static inline const struct device_node *dev_np(struct udevice *dev) * @dev: device to check * @return reference of the the device's DT node */ -static inline ofnode dev_ofnode(struct udevice *dev) +static inline ofnode dev_ofnode(const struct udevice *dev) { return dev->node; } -static inline bool dev_of_valid(struct udevice *dev) +static inline bool dev_of_valid(const struct udevice *dev) { return ofnode_valid(dev_ofnode(dev)); } @@ -53,7 +53,7 @@ static inline bool dev_of_valid(struct udevice *dev) * @outp: place to put value (if found) * @return 0 if OK, -ve on error */ -int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp); +int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp); /** * dev_read_u32_default() - read a 32-bit integer from a device's DT property @@ -63,7 +63,8 @@ int dev_read_u32(struct udevice *dev, const char *propname, u32 *outp); * @def: default value to return if the property has no value * @return property value, or @def if not found */ -int dev_read_u32_default(struct udevice *dev, const char *propname, int def); +int dev_read_u32_default(const struct udevice *dev, const char *propname, + int def); /** * dev_read_s32() - read a signed 32-bit integer from a device's DT property @@ -73,7 +74,7 @@ int dev_read_u32_default(struct udevice *dev, const char *propname, int def); * @outp: place to put value (if found) * @return 0 if OK, -ve on error */ -int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp); +int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp); /** * dev_read_s32_default() - read a signed 32-bit int from a device's DT property @@ -83,7 +84,8 @@ int dev_read_s32(struct udevice *dev, const char *propname, s32 *outp); * @def: default value to return if the property has no value * @return property value, or @def if not found */ -int dev_read_s32_default(struct udevice *dev, const char *propname, int def); +int dev_read_s32_default(const struct udevice *dev, const char *propname, + int def); /** * dev_read_u32u() - read a 32-bit integer from a device's DT property @@ -95,7 +97,7 @@ int dev_read_s32_default(struct udevice *dev, const char *propname, int def); * @outp: place to put value (if found) * @return 0 if OK, -ve on error */ -int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp); +int dev_read_u32u(const struct udevice *dev, const char *propname, uint *outp); /** * dev_read_u64() - read a 64-bit integer from a device's DT property @@ -105,7 +107,7 @@ int dev_read_u32u(struct udevice *dev, const char *propname, uint *outp); * @outp: place to put value (if found) * @return 0 if OK, -ve on error */ -int dev_read_u64(struct udevice *dev, const char *propname, u64 *outp); +int dev_read_u64(const struct udevice *dev, const char *propname, u64 *outp); /** * dev_read_u64_default() - read a 64-bit integer from a device's DT property @@ -115,7 +117,8 @@ int dev_read_u64(struct udevice *dev, const char *propname, u64 *outp); * @def: default value to return if the property has no value * @return property value, or @def if not found */ -u64 dev_read_u64_default(struct udevice *dev, const char *propname, u64 def); +u64 dev_read_u64_default(const struct udevice *dev, const char *propname, + u64 def); /** * dev_read_string() - Read a string from a device's DT property @@ -124,7 +127,7 @@ u64 dev_read_u64_default(struct udevice *dev, const char *propname, u64 def); * @propname: name of the property to read * @return string from property value, or NULL if there is no such property */ -const char *dev_read_string(struct udevice *dev, const char *propname); +const char *dev_read_string(const struct udevice *dev, const char *propname); /** * dev_read_bool() - read a boolean value from a device's DT property @@ -133,7 +136,7 @@ const char *dev_read_string(struct udevice *dev, const char *propname); * @propname: name of property to read * @return true if property is present (meaning true), false if not present */ -bool dev_read_bool(struct udevice *dev, const char *propname); +bool dev_read_bool(const struct udevice *dev, const char *propname); /** * dev_read_subnode() - find a named subnode of a device @@ -143,7 +146,7 @@ bool dev_read_bool(struct udevice *dev, const char *propname); * @return reference to subnode (which can be invalid if there is no such * subnode) */ -ofnode dev_read_subnode(struct udevice *dev, const char *subbnode_name); +ofnode dev_read_subnode(const struct udevice *dev, const char *subbnode_name); /** * dev_read_size() - read the size of a property @@ -152,7 +155,7 @@ ofnode dev_read_subnode(struct udevice *dev, const char *subbnode_name); * @propname: property to check * @return size of property if present, or -EINVAL if not */ -int dev_read_size(struct udevice *dev, const char *propname); +int dev_read_size(const struct udevice *dev, const char *propname); /** * dev_read_addr_index() - Get the indexed reg property of a device @@ -163,7 +166,7 @@ int dev_read_size(struct udevice *dev, const char *propname); * * @return address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t dev_read_addr_index(struct udevice *dev, int index); +fdt_addr_t dev_read_addr_index(const struct udevice *dev, int index); /** * dev_read_addr_size_index() - Get the indexed reg property of a device @@ -175,7 +178,7 @@ fdt_addr_t dev_read_addr_index(struct udevice *dev, int index); * * @return address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index, +fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size); /** @@ -188,7 +191,7 @@ fdt_addr_t dev_read_addr_size_index(struct udevice *dev, int index, * * @return pointer or NULL if not found */ -void *dev_remap_addr_index(struct udevice *dev, int index); +void *dev_remap_addr_index(const struct udevice *dev, int index); /** * dev_read_addr_name() - Get the reg property of a device, indexed by name @@ -200,7 +203,7 @@ void *dev_remap_addr_index(struct udevice *dev, int index); * * @return address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name); +fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name); /** * dev_read_addr_size_name() - Get the reg property of a device, indexed by name @@ -213,7 +216,7 @@ fdt_addr_t dev_read_addr_name(struct udevice *dev, const char* name); * * @return address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name, +fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name, fdt_size_t *size); /** @@ -227,7 +230,7 @@ fdt_addr_t dev_read_addr_size_name(struct udevice *dev, const char *name, * * @return pointer or NULL if not found */ -void *dev_remap_addr_name(struct udevice *dev, const char* name); +void *dev_remap_addr_name(const struct udevice *dev, const char *name); /** * dev_read_addr() - Get the reg property of a device @@ -236,7 +239,7 @@ void *dev_remap_addr_name(struct udevice *dev, const char* name); * * @return address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t dev_read_addr(struct udevice *dev); +fdt_addr_t dev_read_addr(const struct udevice *dev); /** * dev_read_addr_ptr() - Get the reg property of a device @@ -246,7 +249,7 @@ fdt_addr_t dev_read_addr(struct udevice *dev); * * @return pointer or NULL if not found */ -void *dev_read_addr_ptr(struct udevice *dev); +void *dev_read_addr_ptr(const struct udevice *dev); /** * dev_read_addr_pci() - Read an address and handle PCI address translation @@ -266,7 +269,7 @@ void *dev_read_addr_ptr(struct udevice *dev); * @dev: Device to read from * @return address or FDT_ADDR_T_NONE if not found */ -fdt_addr_t dev_read_addr_pci(struct udevice *dev); +fdt_addr_t dev_read_addr_pci(const struct udevice *dev); /** * dev_remap_addr() - Get the reg property of a device as a @@ -276,7 +279,7 @@ fdt_addr_t dev_read_addr_pci(struct udevice *dev); * * @return pointer or NULL if not found */ -void *dev_remap_addr(struct udevice *dev); +void *dev_remap_addr(const struct udevice *dev); /** * dev_read_addr_size() - get address and size from a device property @@ -289,8 +292,8 @@ void *dev_remap_addr(struct udevice *dev); * @sizep: place to put size value (on success) * @return address value, or FDT_ADDR_T_NONE on error */ -fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname, - fdt_size_t *sizep); +fdt_addr_t dev_read_addr_size(const struct udevice *dev, const char *propname, + fdt_size_t *sizep); /** * dev_read_name() - get the name of a device's node @@ -298,7 +301,7 @@ fdt_addr_t dev_read_addr_size(struct udevice *dev, const char *propname, * @dev: Device to read from * @return name of node */ -const char *dev_read_name(struct udevice *dev); +const char *dev_read_name(const struct udevice *dev); /** * dev_read_stringlist_search() - find string in a string list and return index @@ -318,8 +321,8 @@ const char *dev_read_name(struct udevice *dev); * -ENODATA if the property is not found * -EINVAL on some other error */ -int dev_read_stringlist_search(struct udevice *dev, const char *property, - const char *string); +int dev_read_stringlist_search(const struct udevice *dev, const char *property, + const char *string); /** * dev_read_string_index() - obtain an indexed string from a string list @@ -332,8 +335,8 @@ int dev_read_stringlist_search(struct udevice *dev, const char *property, * @return: * length of string, if found or -ve error value if not found */ -int dev_read_string_index(struct udevice *dev, const char *propname, int index, - const char **outp); +int dev_read_string_index(const struct udevice *dev, const char *propname, + int index, const char **outp); /** * dev_read_string_count() - find the number of strings in a string list @@ -343,7 +346,7 @@ int dev_read_string_index(struct udevice *dev, const char *propname, int index, * @return: * number of strings in the list, or -ve error value if not found */ -int dev_read_string_count(struct udevice *dev, const char *propname); +int dev_read_string_count(const struct udevice *dev, const char *propname); /** * dev_read_phandle_with_args() - Find a node pointed by phandle in a list * @@ -382,10 +385,9 @@ int dev_read_string_count(struct udevice *dev, const char *propname); * @cells_name could not be found, the arguments were truncated or there * were too many arguments. */ -int dev_read_phandle_with_args(struct udevice *dev, const char *list_name, - const char *cells_name, int cell_count, - int index, - struct ofnode_phandle_args *out_args); +int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name, + const char *cells_name, int cell_count, + int index, struct ofnode_phandle_args *out_args); /** * dev_count_phandle_with_args() - Return phandle number in a list @@ -402,8 +404,8 @@ int dev_read_phandle_with_args(struct udevice *dev, const char *list_name, * errno value. */ -int dev_count_phandle_with_args(struct udevice *dev, const char *list_name, - const char *cells_name); +int dev_count_phandle_with_args(const struct udevice *dev, + const char *list_name, const char *cells_name); /** * dev_read_addr_cells() - Get the number of address cells for a device's node @@ -414,7 +416,7 @@ int dev_count_phandle_with_args(struct udevice *dev, const char *list_name, * @dev: device to check * @return number of address cells this node uses */ -int dev_read_addr_cells(struct udevice *dev); +int dev_read_addr_cells(const struct udevice *dev); /** * dev_read_size_cells() - Get the number of size cells for a device's node @@ -425,7 +427,7 @@ int dev_read_addr_cells(struct udevice *dev); * @dev: device to check * @return number of size cells this node uses */ -int dev_read_size_cells(struct udevice *dev); +int dev_read_size_cells(const struct udevice *dev); /** * dev_read_addr_cells() - Get the address cells property in a node @@ -435,7 +437,7 @@ int dev_read_size_cells(struct udevice *dev); * @dev: device to check * @return number of address cells this node uses */ -int dev_read_simple_addr_cells(struct udevice *dev); +int dev_read_simple_addr_cells(const struct udevice *dev); /** * dev_read_size_cells() - Get the size cells property in a node @@ -445,7 +447,7 @@ int dev_read_simple_addr_cells(struct udevice *dev); * @dev: device to check * @return number of size cells this node uses */ -int dev_read_simple_size_cells(struct udevice *dev); +int dev_read_simple_size_cells(const struct udevice *dev); /** * dev_read_phandle() - Get the phandle from a device @@ -453,7 +455,7 @@ int dev_read_simple_size_cells(struct udevice *dev); * @dev: device to check * @return phandle (1 or greater), or 0 if no phandle or other error */ -int dev_read_phandle(struct udevice *dev); +int dev_read_phandle(const struct udevice *dev); /** * dev_read_prop()- - read a property from a device's node @@ -463,7 +465,8 @@ int dev_read_phandle(struct udevice *dev); * @lenp: place to put length on success * @return pointer to property, or NULL if not found */ -const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp); +const void *dev_read_prop(const struct udevice *dev, const char *propname, + int *lenp); /** * dev_read_alias_seq() - Get the alias sequence number of a node @@ -476,7 +479,7 @@ const void *dev_read_prop(struct udevice *dev, const char *propname, int *lenp); * @devnump: set to the sequence number if one is found * @return 0 if a sequence was found, -ve if not */ -int dev_read_alias_seq(struct udevice *dev, int *devnump); +int dev_read_alias_seq(const struct udevice *dev, int *devnump); /** * dev_read_u32_array() - Find and read an array of 32 bit integers @@ -494,7 +497,7 @@ int dev_read_alias_seq(struct udevice *dev, int *devnump); * property does not have a value, and -EOVERFLOW if the property data isn't * large enough. */ -int dev_read_u32_array(struct udevice *dev, const char *propname, +int dev_read_u32_array(const struct udevice *dev, const char *propname, u32 *out_values, size_t sz); /** @@ -504,7 +507,7 @@ int dev_read_u32_array(struct udevice *dev, const char *propname, * @return reference to the first subnode (which can be invalid if the device's * node has no subnodes) */ -ofnode dev_read_first_subnode(struct udevice *dev); +ofnode dev_read_first_subnode(const struct udevice *dev); /** * ofnode_next_subnode() - find the next sibling of a subnode @@ -529,8 +532,8 @@ ofnode dev_read_next_subnode(ofnode node); * @return pointer to byte array if found, or NULL if the property is not * found or there is not enough data */ -const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname, - size_t sz); +const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev, + const char *propname, size_t sz); /** * dev_read_enabled() - check whether a node is enabled @@ -543,7 +546,7 @@ const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, const char *propname, * @dev: device to examine * @return integer value 0 (not enabled) or 1 (enabled) */ -int dev_read_enabled(struct udevice *dev); +int dev_read_enabled(const struct udevice *dev); /** * dev_read_resource() - obtain an indexed resource from a device. @@ -553,7 +556,8 @@ int dev_read_enabled(struct udevice *dev); * @res returns the resource * @return 0 if ok, negative on error */ -int dev_read_resource(struct udevice *dev, uint index, struct resource *res); +int dev_read_resource(const struct udevice *dev, uint index, + struct resource *res); /** * dev_read_resource_byname() - obtain a named resource from a device. @@ -563,7 +567,7 @@ int dev_read_resource(struct udevice *dev, uint index, struct resource *res); * @res: returns the resource * @return 0 if ok, negative on error */ -int dev_read_resource_byname(struct udevice *dev, const char *name, +int dev_read_resource_byname(const struct udevice *dev, const char *name, struct resource *res); /** @@ -577,7 +581,7 @@ int dev_read_resource_byname(struct udevice *dev, const char *name, * @in_addr: pointer to the address to translate * @return the translated address; OF_BAD_ADDR on error */ -u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr); +u64 dev_translate_address(const struct udevice *dev, const fdt32_t *in_addr); /** * dev_translate_dma_address() - Translate a device-tree DMA address @@ -590,7 +594,8 @@ u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr); * @in_addr: pointer to the DMA address to translate * @return the translated DMA address; OF_BAD_ADDR on error */ -u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr); +u64 dev_translate_dma_address(const struct udevice *dev, + const fdt32_t *in_addr); /** * dev_read_alias_highest_id - Get highest alias id for the given stem @@ -604,31 +609,31 @@ int dev_read_alias_highest_id(const char *stem); #else /* CONFIG_DM_DEV_READ_INLINE is enabled */ -static inline int dev_read_u32(struct udevice *dev, +static inline int dev_read_u32(const struct udevice *dev, const char *propname, u32 *outp) { return ofnode_read_u32(dev_ofnode(dev), propname, outp); } -static inline int dev_read_u32_default(struct udevice *dev, +static inline int dev_read_u32_default(const struct udevice *dev, const char *propname, int def) { return ofnode_read_u32_default(dev_ofnode(dev), propname, def); } -static inline int dev_read_s32(struct udevice *dev, +static inline int dev_read_s32(const struct udevice *dev, const char *propname, s32 *outp) { return ofnode_read_s32(dev_ofnode(dev), propname, outp); } -static inline int dev_read_s32_default(struct udevice *dev, +static inline int dev_read_s32_default(const struct udevice *dev, const char *propname, int def) { return ofnode_read_s32_default(dev_ofnode(dev), propname, def); } -static inline int dev_read_u32u(struct udevice *dev, +static inline int dev_read_u32u(const struct udevice *dev, const char *propname, uint *outp) { u32 val; @@ -642,128 +647,131 @@ static inline int dev_read_u32u(struct udevice *dev, return 0; } -static inline int dev_read_u64(struct udevice *dev, +static inline int dev_read_u64(const struct udevice *dev, const char *propname, u64 *outp) { return ofnode_read_u64(dev_ofnode(dev), propname, outp); } -static inline u64 dev_read_u64_default(struct udevice *dev, +static inline u64 dev_read_u64_default(const struct udevice *dev, const char *propname, u64 def) { return ofnode_read_u64_default(dev_ofnode(dev), propname, def); } -static inline const char *dev_read_string(struct udevice *dev, +static inline const char *dev_read_string(const struct udevice *dev, const char *propname) { return ofnode_read_string(dev_ofnode(dev), propname); } -static inline bool dev_read_bool(struct udevice *dev, const char *propname) +static inline bool dev_read_bool(const struct udevice *dev, + const char *propname) { return ofnode_read_bool(dev_ofnode(dev), propname); } -static inline ofnode dev_read_subnode(struct udevice *dev, +static inline ofnode dev_read_subnode(const struct udevice *dev, const char *subbnode_name) { return ofnode_find_subnode(dev_ofnode(dev), subbnode_name); } -static inline int dev_read_size(struct udevice *dev, const char *propname) +static inline int dev_read_size(const struct udevice *dev, const char *propname) { return ofnode_read_size(dev_ofnode(dev), propname); } -static inline fdt_addr_t dev_read_addr_index(struct udevice *dev, int index) +static inline fdt_addr_t dev_read_addr_index(const struct udevice *dev, + int index) { return devfdt_get_addr_index(dev, index); } -static inline fdt_addr_t dev_read_addr_size_index(struct udevice *dev, +static inline fdt_addr_t dev_read_addr_size_index(const struct udevice *dev, int index, fdt_size_t *size) { return devfdt_get_addr_size_index(dev, index, size); } -static inline fdt_addr_t dev_read_addr_name(struct udevice *dev, +static inline fdt_addr_t dev_read_addr_name(const struct udevice *dev, const char *name) { return devfdt_get_addr_name(dev, name); } -static inline fdt_addr_t dev_read_addr_size_name(struct udevice *dev, +static inline fdt_addr_t dev_read_addr_size_name(const struct udevice *dev, const char *name, fdt_size_t *size) { return devfdt_get_addr_size_name(dev, name, size); } -static inline fdt_addr_t dev_read_addr(struct udevice *dev) +static inline fdt_addr_t dev_read_addr(const struct udevice *dev) { return devfdt_get_addr(dev); } -static inline void *dev_read_addr_ptr(struct udevice *dev) +static inline void *dev_read_addr_ptr(const struct udevice *dev) { return devfdt_get_addr_ptr(dev); } -static inline fdt_addr_t dev_read_addr_pci(struct udevice *dev) +static inline fdt_addr_t dev_read_addr_pci(const struct udevice *dev) { return devfdt_get_addr_pci(dev); } -static inline void *dev_remap_addr(struct udevice *dev) +static inline void *dev_remap_addr(const struct udevice *dev) { return devfdt_remap_addr(dev); } -static inline void *dev_remap_addr_index(struct udevice *dev, int index) +static inline void *dev_remap_addr_index(const struct udevice *dev, int index) { return devfdt_remap_addr_index(dev, index); } -static inline void *dev_remap_addr_name(struct udevice *dev, const char *name) +static inline void *dev_remap_addr_name(const struct udevice *dev, + const char *name) { return devfdt_remap_addr_name(dev, name); } -static inline fdt_addr_t dev_read_addr_size(struct udevice *dev, +static inline fdt_addr_t dev_read_addr_size(const struct udevice *dev, const char *propname, fdt_size_t *sizep) { return ofnode_get_addr_size(dev_ofnode(dev), propname, sizep); } -static inline const char *dev_read_name(struct udevice *dev) +static inline const char *dev_read_name(const struct udevice *dev) { return ofnode_get_name(dev_ofnode(dev)); } -static inline int dev_read_stringlist_search(struct udevice *dev, +static inline int dev_read_stringlist_search(const struct udevice *dev, const char *propname, const char *string) { return ofnode_stringlist_search(dev_ofnode(dev), propname, string); } -static inline int dev_read_string_index(struct udevice *dev, +static inline int dev_read_string_index(const struct udevice *dev, const char *propname, int index, const char **outp) { return ofnode_read_string_index(dev_ofnode(dev), propname, index, outp); } -static inline int dev_read_string_count(struct udevice *dev, +static inline int dev_read_string_count(const struct udevice *dev, const char *propname) { return ofnode_read_string_count(dev_ofnode(dev), propname); } -static inline int dev_read_phandle_with_args(struct udevice *dev, +static inline int dev_read_phandle_with_args(const struct udevice *dev, const char *list_name, const char *cells_name, int cell_count, int index, struct ofnode_phandle_args *out_args) { @@ -772,59 +780,60 @@ static inline int dev_read_phandle_with_args(struct udevice *dev, out_args); } -static inline int dev_count_phandle_with_args(struct udevice *dev, +static inline int dev_count_phandle_with_args(const struct udevice *dev, const char *list_name, const char *cells_name) { return ofnode_count_phandle_with_args(dev_ofnode(dev), list_name, cells_name); } -static inline int dev_read_addr_cells(struct udevice *dev) +static inline int dev_read_addr_cells(const struct udevice *dev) { /* NOTE: this call should walk up the parent stack */ return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); } -static inline int dev_read_size_cells(struct udevice *dev) +static inline int dev_read_size_cells(const struct udevice *dev) { /* NOTE: this call should walk up the parent stack */ return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); } -static inline int dev_read_simple_addr_cells(struct udevice *dev) +static inline int dev_read_simple_addr_cells(const struct udevice *dev) { return fdt_address_cells(gd->fdt_blob, dev_of_offset(dev)); } -static inline int dev_read_simple_size_cells(struct udevice *dev) +static inline int dev_read_simple_size_cells(const struct udevice *dev) { return fdt_size_cells(gd->fdt_blob, dev_of_offset(dev)); } -static inline int dev_read_phandle(struct udevice *dev) +static inline int dev_read_phandle(const struct udevice *dev) { return fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev)); } -static inline const void *dev_read_prop(struct udevice *dev, +static inline const void *dev_read_prop(const struct udevice *dev, const char *propname, int *lenp) { return ofnode_get_property(dev_ofnode(dev), propname, lenp); } -static inline int dev_read_alias_seq(struct udevice *dev, int *devnump) +static inline int dev_read_alias_seq(const struct udevice *dev, int *devnump) { return fdtdec_get_alias_seq(gd->fdt_blob, dev->uclass->uc_drv->name, dev_of_offset(dev), devnump); } -static inline int dev_read_u32_array(struct udevice *dev, const char *propname, - u32 *out_values, size_t sz) +static inline int dev_read_u32_array(const struct udevice *dev, + const char *propname, u32 *out_values, + size_t sz) { return ofnode_read_u32_array(dev_ofnode(dev), propname, out_values, sz); } -static inline ofnode dev_read_first_subnode(struct udevice *dev) +static inline ofnode dev_read_first_subnode(const struct udevice *dev) { return ofnode_first_subnode(dev_ofnode(dev)); } @@ -834,36 +843,39 @@ static inline ofnode dev_read_next_subnode(ofnode node) return ofnode_next_subnode(node); } -static inline const uint8_t *dev_read_u8_array_ptr(struct udevice *dev, - const char *propname, size_t sz) +static inline const uint8_t *dev_read_u8_array_ptr(const struct udevice *dev, + const char *propname, + size_t sz) { return ofnode_read_u8_array_ptr(dev_ofnode(dev), propname, sz); } -static inline int dev_read_enabled(struct udevice *dev) +static inline int dev_read_enabled(const struct udevice *dev) { return fdtdec_get_is_enabled(gd->fdt_blob, dev_of_offset(dev)); } -static inline int dev_read_resource(struct udevice *dev, uint index, +static inline int dev_read_resource(const struct udevice *dev, uint index, struct resource *res) { return ofnode_read_resource(dev_ofnode(dev), index, res); } -static inline int dev_read_resource_byname(struct udevice *dev, +static inline int dev_read_resource_byname(const struct udevice *dev, const char *name, struct resource *res) { return ofnode_read_resource_byname(dev_ofnode(dev), name, res); } -static inline u64 dev_translate_address(struct udevice *dev, const fdt32_t *in_addr) +static inline u64 dev_translate_address(const struct udevice *dev, + const fdt32_t *in_addr) { return ofnode_translate_address(dev_ofnode(dev), in_addr); } -static inline u64 dev_translate_dma_address(struct udevice *dev, const fdt32_t *in_addr) +static inline u64 dev_translate_dma_address(const struct udevice *dev, + const fdt32_t *in_addr) { return ofnode_translate_dma_address(dev_ofnode(dev), in_addr); } diff --git a/include/dm/util.h b/include/dm/util.h index 348c2ace3c3bdea8152a47fef647700927b670ba..0ccb3fbadf4bdd17a662fb485adcee188b11322e 100644 --- a/include/dm/util.h +++ b/include/dm/util.h @@ -39,6 +39,9 @@ static inline void dm_dump_devres(void) } #endif +/* Dump out a list of drivers */ +void dm_dump_drivers(void); + /** * Check if an of node should be or was bound before relocation. * diff --git a/include/dma-uclass.h b/include/dma-uclass.h index a1d9d26ac56f146524f68f7efe659190124dd70a..340437acc134a078a3610b5f8aea90769321babe 100644 --- a/include/dma-uclass.h +++ b/include/dma-uclass.h @@ -58,14 +58,14 @@ struct dma_ops { */ int (*request)(struct dma *dma); /** - * free - Free a previously requested dma. + * rfree - Free a previously requested dma. * * This is the implementation of the client dma_free() API. * * @dma: The DMA to free. * @return 0 if OK, or a negative error code. */ - int (*free)(struct dma *dma); + int (*rfree)(struct dma *dma); /** * enable() - Enable a DMA Channel. * diff --git a/include/fdtdec.h b/include/fdtdec.h index c8a143db5f161f6a789a9cc6e43ee35c30d85834..166f29c55bbeb36ac7fa0ea6edaee6a66df8df3c 100644 --- a/include/fdtdec.h +++ b/include/fdtdec.h @@ -441,7 +441,7 @@ int fdtdec_get_pci_vendev(const void *blob, int node, * @param bar returns base address of the pci device's registers * @return 0 if ok, negative on error */ -int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr, +int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr, u32 *bar); /** diff --git a/include/linux/clk-provider.h b/include/linux/clk-provider.h index 0ef6e685ad698bf72c52b239ffacbd11c6d5e8ec..8a20743ad84513742e6c521ba19bc7331499e516 100644 --- a/include/linux/clk-provider.h +++ b/include/linux/clk-provider.h @@ -13,6 +13,7 @@ #include <linux/bitops.h> #include <linux/err.h> #include <clk-uclass.h> +#include <linux/err.h> static inline void clk_dm(ulong id, struct clk *clk) { diff --git a/include/linux/compat.h b/include/linux/compat.h index d0f51baab407b67d8c7010f8c325bc2d81fc792e..171188a76f0c1d670472050f060ff0947ca696f5 100644 --- a/include/linux/compat.h +++ b/include/linux/compat.h @@ -123,7 +123,10 @@ static inline void kmem_cache_destroy(struct kmem_cache *cachep) #define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) +/* This is also defined in ARMv8's mmu.h */ +#ifndef PAGE_SIZE #define PAGE_SIZE 4096 +#endif /* drivers/char/random.c */ #define get_random_bytes(...) diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index ceffd994de8f2e4976c53d036ab67fc7fa113252..1b9151714c0bf11828c8779f3555887b29cae4c8 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h @@ -129,8 +129,8 @@ struct mtd_oob_region { struct mtd_ooblayout_ops { int (*ecc)(struct mtd_info *mtd, int section, struct mtd_oob_region *oobecc); - int (*free)(struct mtd_info *mtd, int section, - struct mtd_oob_region *oobfree); + int (*rfree)(struct mtd_info *mtd, int section, + struct mtd_oob_region *oobfree); }; /* diff --git a/include/linux/string.h b/include/linux/string.h index 5d63be4ce5b065a1b81fd57ca6612f04716af7db..d67998e5c41a40d8a94f3de0f1474a19d173bf0f 100644 --- a/include/linux/string.h +++ b/include/linux/string.h @@ -91,10 +91,15 @@ extern __kernel_size_t strnlen(const char *,__kernel_size_t); size_t strcspn(const char *s, const char *reject); #endif +#ifdef CONFIG_SANDBOX +# define strdup sandbox_strdup +# define strndup sandbox_strndup +#endif + #ifndef __HAVE_ARCH_STRDUP extern char * strdup(const char *); -#endif extern char * strndup(const char *, size_t); +#endif #ifndef __HAVE_ARCH_STRSWAB extern char * strswab(const char *); #endif diff --git a/include/mailbox-uclass.h b/include/mailbox-uclass.h index e0618aad97b95165c6d6238af905833aa3a4b4ee..3c60c7650686f9ddea07665cbcd1f5c652909d1b 100644 --- a/include/mailbox-uclass.h +++ b/include/mailbox-uclass.h @@ -49,14 +49,14 @@ struct mbox_ops { */ int (*request)(struct mbox_chan *chan); /** - * free - Free a previously requested channel. + * rfree - Free a previously requested channel. * * This is the implementation of the client mbox_free() API. * * @chan: The channel to free. * @return 0 if OK, or a negative error code. */ - int (*free)(struct mbox_chan *chan); + int (*rfree)(struct mbox_chan *chan); /** * send - Send a message over a mailbox channel * diff --git a/include/malloc.h b/include/malloc.h index 5efa6920b2a17ee83b45f18f4a30004426a72ed0..f66c2e86176c3bda6eba8359d2c5d4ac15baf115 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -788,8 +788,13 @@ struct mallinfo { */ -/* #define USE_DL_PREFIX */ - +/* + * Rename the U-Boot alloc functions so that sandbox can still use the system + * ones + */ +#ifdef CONFIG_SANDBOX +#define USE_DL_PREFIX +#endif /* @@ -892,6 +897,21 @@ void malloc_simple_info(void); # define pvALLOc dlpvalloc # define mALLINFo dlmallinfo # define mALLOPt dlmallopt + +/* Ensure that U-Boot actually uses these too */ +#define calloc dlcalloc +#define free(ptr) dlfree(ptr) +#define malloc(x) dlmalloc(x) +#define memalign dlmemalign +#define realloc dlrealloc +#define valloc dlvalloc +#define pvalloc dlpvalloc +#define mallinfo() dlmallinfo() +#define mallopt dlmallopt +#define malloc_trim dlmalloc_trim +#define malloc_usable_size dlmalloc_usable_size +#define malloc_stats dlmalloc_stats + # else /* USE_DL_PREFIX */ # define cALLOc calloc # define fREe free diff --git a/include/os.h b/include/os.h index 7a4f78b9b1fa7919e4a37940831ee976be323e89..1874ae674f2b5d1da4861a96546c6b484f01ef55 100644 --- a/include/os.h +++ b/include/os.h @@ -119,7 +119,7 @@ void os_fd_restore(void); void *os_malloc(size_t length); /** - * Free memory previous allocated with os_malloc()/os_realloc() + * Free memory previous allocated with os_malloc() * * This returns the memory to the OS. * @@ -127,26 +127,6 @@ void *os_malloc(size_t length); */ void os_free(void *ptr); -/** - * Reallocate previously-allocated memory to increase/decrease space - * - * This works in a similar way to the C library realloc() function. If - * length is 0, then ptr is freed. Otherwise the space used by ptr is - * expanded or reduced depending on whether length is larger or smaller - * than before. - * - * If ptr is NULL, then this is similar to calling os_malloc(). - * - * This function may need to move the memory block to make room for any - * extra space, in which case the new pointer is returned. - * - * \param ptr Pointer to memory block to reallocate - * \param length New length for memory block - * \return pointer to new memory block, or NULL on failure or if length - * is 0. - */ -void *os_realloc(void *ptr, size_t length); - /** * Access to the usleep function of the os * diff --git a/include/pci.h b/include/pci.h index 8c761d8da3b9b69e24c9946bc67ef38ad62fc85b..50ca249f2d600806718e86ea5cf7378c8966b96c 100644 --- a/include/pci.h +++ b/include/pci.h @@ -899,8 +899,8 @@ struct dm_pci_ops { * @size: Access size * @return 0 if OK, -ve on error */ - int (*read_config)(struct udevice *bus, pci_dev_t bdf, uint offset, - ulong *valuep, enum pci_size_t size); + int (*read_config)(const struct udevice *bus, pci_dev_t bdf, + uint offset, ulong *valuep, enum pci_size_t size); /** * write_config() - Write a PCI configuration value * @@ -924,7 +924,7 @@ struct dm_pci_ops { * @dev: Device to check * @return bus/device/function value (see PCI_BDF()) */ -pci_dev_t dm_pci_get_bdf(struct udevice *dev); +pci_dev_t dm_pci_get_bdf(const struct udevice *dev); /** * pci_bind_bus_devices() - scan a PCI bus and bind devices @@ -974,7 +974,7 @@ int dm_pci_bus_find_bdf(pci_dev_t bdf, struct udevice **devp); * @devp: Returns the device for this address, if found * @return 0 if OK, -ENODEV if not found */ -int pci_bus_find_devfn(struct udevice *bus, pci_dev_t find_devfn, +int pci_bus_find_devfn(const struct udevice *bus, pci_dev_t find_devfn, struct udevice **devp); /** @@ -1067,7 +1067,7 @@ int dm_pci_hose_probe_bus(struct udevice *bus); * @size: Access size * @return 0 if OK, -ve on error */ -int pci_bus_read_config(struct udevice *bus, pci_dev_t bdf, int offset, +int pci_bus_read_config(const struct udevice *bus, pci_dev_t bdf, int offset, unsigned long *valuep, enum pci_size_t size); /** @@ -1102,12 +1102,12 @@ int pci_bus_clrset_config32(struct udevice *bus, pci_dev_t bdf, int offset, * Driver model PCI config access functions. Use these in preference to others * when you have a valid device */ -int dm_pci_read_config(struct udevice *dev, int offset, unsigned long *valuep, - enum pci_size_t size); +int dm_pci_read_config(const struct udevice *dev, int offset, + unsigned long *valuep, enum pci_size_t size); -int dm_pci_read_config8(struct udevice *dev, int offset, u8 *valuep); -int dm_pci_read_config16(struct udevice *dev, int offset, u16 *valuep); -int dm_pci_read_config32(struct udevice *dev, int offset, u32 *valuep); +int dm_pci_read_config8(const struct udevice *dev, int offset, u8 *valuep); +int dm_pci_read_config16(const struct udevice *dev, int offset, u16 *valuep); +int dm_pci_read_config32(const struct udevice *dev, int offset, u32 *valuep); int dm_pci_write_config(struct udevice *dev, int offset, unsigned long value, enum pci_size_t size); @@ -1155,8 +1155,9 @@ int pci_read_config8(pci_dev_t pcidev, int offset, u8 *valuep); * Return: 0 on success, else -EINVAL */ int pci_generic_mmap_write_config( - struct udevice *bus, - int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp), + const struct udevice *bus, + int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset, + void **addrp), pci_dev_t bdf, uint offset, ulong value, @@ -1180,8 +1181,9 @@ int pci_generic_mmap_write_config( * Return: 0 on success, else -EINVAL */ int pci_generic_mmap_read_config( - struct udevice *bus, - int (*addr_f)(struct udevice *bus, pci_dev_t bdf, uint offset, void **addrp), + const struct udevice *bus, + int (*addr_f)(const struct udevice *bus, pci_dev_t bdf, uint offset, + void **addrp), pci_dev_t bdf, uint offset, ulong *valuep, @@ -1311,7 +1313,7 @@ void dm_pci_write_bar32(struct udevice *dev, int barnum, u32 addr); * @barnum: Bar number to read (numbered from 0) * @return: value of BAR */ -u32 dm_pci_read_bar32(struct udevice *dev, int barnum); +u32 dm_pci_read_bar32(const struct udevice *dev, int barnum); /** * dm_pci_bus_to_phys() - convert a PCI bus address to a physical address @@ -1523,8 +1525,8 @@ struct dm_pci_emul_ops { * @size: Access size * @return 0 if OK, -ve on error */ - int (*read_config)(struct udevice *dev, uint offset, ulong *valuep, - enum pci_size_t size); + int (*read_config)(const struct udevice *dev, uint offset, + ulong *valuep, enum pci_size_t size); /** * write_config() - Write a PCI configuration value * @@ -1609,7 +1611,7 @@ struct dm_pci_emul_ops { * @emulp: Returns emulated device if found * @return 0 if found, -ENODEV if not found */ -int sandbox_pci_get_emul(struct udevice *bus, pci_dev_t find_devfn, +int sandbox_pci_get_emul(const struct udevice *bus, pci_dev_t find_devfn, struct udevice **containerp, struct udevice **emulp); /** diff --git a/include/phy.h b/include/phy.h index 6ace9b3a0c4c7b21c4b6b6c8a9793f2be2ee1315..42cfc59ec0ab2ce472c8c2ee2eb23fd73a65f9d2 100644 --- a/include/phy.h +++ b/include/phy.h @@ -10,6 +10,7 @@ #define _PHY_H #include <dm.h> +#include <linux/errno.h> #include <linux/list.h> #include <linux/mii.h> #include <linux/ethtool.h> diff --git a/include/power-domain-uclass.h b/include/power-domain-uclass.h index bd9906b2e7bb8fddd9568a2103bf11b1c045e0b3..acf749b38edfca39f537264f684473fe276915bb 100644 --- a/include/power-domain-uclass.h +++ b/include/power-domain-uclass.h @@ -54,14 +54,14 @@ struct power_domain_ops { */ int (*request)(struct power_domain *power_domain); /** - * free - Free a previously requested power domain. + * rfree - Free a previously requested power domain. * * This is the implementation of the client power_domain_free() API. * * @power_domain: The power domain to free. * @return 0 if OK, or a negative error code. */ - int (*free)(struct power_domain *power_domain); + int (*rfree)(struct power_domain *power_domain); /** * on - Power on a power domain. * diff --git a/include/reset-uclass.h b/include/reset-uclass.h index 7b5cc3cb3b47bd11e2e377d1c70b330961c7f0ff..9a0696dd1e3b74f6ecfe747a261129ee0bc9a532 100644 --- a/include/reset-uclass.h +++ b/include/reset-uclass.h @@ -51,14 +51,14 @@ struct reset_ops { */ int (*request)(struct reset_ctl *reset_ctl); /** - * free - Free a previously requested reset control. + * rfree - Free a previously requested reset control. * * This is the implementation of the client reset_free() API. * * @reset_ctl: The reset control to free. * @return 0 if OK, or a negative error code. */ - int (*free)(struct reset_ctl *reset_ctl); + int (*rfree)(struct reset_ctl *reset_ctl); /** * rst_assert - Assert a reset signal. * diff --git a/include/sound.h b/include/sound.h index 47de9fa3ed3ac70245cbedac9f811d2410009c31..71bd850652e4421a27244978b60258345cc027cf 100644 --- a/include/sound.h +++ b/include/sound.h @@ -68,6 +68,18 @@ struct sound_ops { */ int (*play)(struct udevice *dev, void *data, uint data_size); + /** + * stop_play() - Indicate that there is no more data coming + * + * This is called once play() has finished sending all the data to the + * output device. This may be used to tell the hardware to turn off the + * codec, for example. + * + * @dev: Sound device + * @return 0 if OK, -ve on error + */ + int (*stop_play)(struct udevice *dev); + /** * start_beep() - Start beeping (optional) * diff --git a/include/test/test.h b/include/test/test.h index e5bef4759a6f88c28929e33e1fed7ea030d14829..2a75211008323a833af62bfc315e13a6ad099a1d 100644 --- a/include/test/test.h +++ b/include/test/test.h @@ -15,12 +15,16 @@ * @start: Store the starting mallinfo when doing leak test * @priv: A pointer to some other info some suites want to track * @of_root: Record of the livetree root node (used for setting up tests) + * @expect_str: Temporary string used to hold expected string value + * @actual_str: Temporary string used to hold actual string value */ struct unit_test_state { int fail_count; struct mallinfo start; void *priv; struct device_node *of_root; + char expect_str[256]; + char actual_str[256]; }; /** diff --git a/include/test/ut.h b/include/test/ut.h index f616c202f357a4f72d8ca75e4f5045174fb33bd0..04df8ba3af319d5c2dde28e1dd979825b7ecd7a3 100644 --- a/include/test/ut.h +++ b/include/test/ut.h @@ -38,6 +38,43 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line, const char *func, const char *cond, const char *fmt, ...) __attribute__ ((format (__printf__, 6, 7))); +/** + * ut_check_console_line() - Check the next console line against expectations + * + * This creates a string and then checks it against the next line of console + * output obtained with console_record_readline(). + * + * After the function returns, uts->expect_str holds the expected string and + * uts->actual_str holds the actual string read from the console. + * + * @uts: Test state + * @fmt: printf() format string for the error, followed by args + * @return 0 if OK, other value on error + */ +int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...) + __attribute__ ((format (__printf__, 2, 3))); + +/** + * ut_check_console_end() - Check there is no more console output + * + * After the function returns, uts->actual_str holds the actual string read + * from the console + * + * @uts: Test state + * @return 0 if OK (console has no output), other value on error + */ +int ut_check_console_end(struct unit_test_state *uts); + +/** + * ut_check_console_dump() - Check that next lines have a print_buffer() dump + * + * This only supports a byte dump. + * + * @total_bytes: Size of the expected dump in bytes` + * @return 0 if OK (looks like a dump and the length matches), other value on + * error + */ +int ut_check_console_dump(struct unit_test_state *uts, int total_bytes); /* Assert that a condition is non-zero */ #define ut_assert(cond) \ @@ -56,39 +93,39 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line, /* Assert that two int expressions are equal */ #define ut_asserteq(expr1, expr2) { \ - unsigned int val1 = (expr1), val2 = (expr2); \ + unsigned int _val1 = (expr1), _val2 = (expr2); \ \ - if (val1 != val2) { \ + if (_val1 != _val2) { \ ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr1 " == " #expr2, \ - "Expected %#x (%d), got %#x (%d)", val1, val1, \ - val2, val2); \ + "Expected %#x (%d), got %#x (%d)", \ + _val1, _val1, _val2, _val2); \ return CMD_RET_FAILURE; \ } \ } /* Assert that two string expressions are equal */ #define ut_asserteq_str(expr1, expr2) { \ - const char *val1 = (expr1), *val2 = (expr2); \ + const char *_val1 = (expr1), *_val2 = (expr2); \ \ - if (strcmp(val1, val2)) { \ + if (strcmp(_val1, _val2)) { \ ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr1 " = " #expr2, \ - "Expected \"%s\", got \"%s\"", val1, val2); \ + "Expected \"%s\", got \"%s\"", _val1, _val2); \ return CMD_RET_FAILURE; \ } \ } /* Assert that two memory areas are equal */ #define ut_asserteq_mem(expr1, expr2, len) { \ - const u8 *val1 = (u8 *)(expr1), *val2 = (u8 *)(expr2); \ + const u8 *_val1 = (u8 *)(expr1), *_val2 = (u8 *)(expr2); \ const uint __len = len; \ \ - if (memcmp(val1, val2, __len)) { \ + if (memcmp(_val1, _val2, __len)) { \ char __buf1[64 + 1] = "\0"; \ char __buf2[64 + 1] = "\0"; \ - bin2hex(__buf1, val1, min(__len, (uint)32)); \ - bin2hex(__buf2, val2, min(__len, (uint)32)); \ + bin2hex(__buf1, _val1, min(__len, (uint)32)); \ + bin2hex(__buf2, _val2, min(__len, (uint)32)); \ ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr1 " = " #expr2, \ "Expected \"%s\", got \"%s\"", \ @@ -99,33 +136,33 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line, /* Assert that two pointers are equal */ #define ut_asserteq_ptr(expr1, expr2) { \ - const void *val1 = (expr1), *val2 = (expr2); \ + const void *_val1 = (expr1), *_val2 = (expr2); \ \ - if (val1 != val2) { \ + if (_val1 != _val2) { \ ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr1 " = " #expr2, \ - "Expected %p, got %p", val1, val2); \ + "Expected %p, got %p", _val1, _val2); \ return CMD_RET_FAILURE; \ } \ } /* Assert that a pointer is NULL */ #define ut_assertnull(expr) { \ - const void *val = (expr); \ + const void *_val = (expr); \ \ - if (val != NULL) { \ + if (_val) { \ ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr " != NULL", \ - "Expected NULL, got %p", val); \ + "Expected NULL, got %p", _val); \ return CMD_RET_FAILURE; \ } \ } /* Assert that a pointer is not NULL */ #define ut_assertnonnull(expr) { \ - const void *val = (expr); \ + const void *_val = (expr); \ \ - if (val == NULL) { \ + if (!_val) { \ ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr " = NULL", \ "Expected non-null, got NULL"); \ @@ -135,13 +172,13 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line, /* Assert that a pointer is not an error pointer */ #define ut_assertok_ptr(expr) { \ - const void *val = (expr); \ + const void *_val = (expr); \ \ - if (IS_ERR(val)) { \ + if (IS_ERR(_val)) { \ ut_failf(uts, __FILE__, __LINE__, __func__, \ #expr " = NULL", \ "Expected pointer, got error %ld", \ - PTR_ERR(val)); \ + PTR_ERR(_val)); \ return CMD_RET_FAILURE; \ } \ } @@ -149,6 +186,34 @@ void ut_failf(struct unit_test_state *uts, const char *fname, int line, /* Assert that an operation succeeds (returns 0) */ #define ut_assertok(cond) ut_asserteq(0, cond) +/* Assert that the next console output line matches */ +#define ut_assert_nextline(fmt, args...) \ + if (ut_check_console_line(uts, fmt, ##args)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", "\nExpected '%s',\n got '%s'", \ + uts->expect_str, uts->actual_str); \ + return CMD_RET_FAILURE; \ + } \ + +/* Assert that there is no more console output */ +#define ut_assert_console_end() \ + if (ut_check_console_end(uts)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", "Expected no more output, got '%s'",\ + uts->actual_str); \ + return CMD_RET_FAILURE; \ + } \ + +/* Assert that the next lines are print_buffer() dump at an address */ +#define ut_assert_nextlines_are_dump(total_bytes) \ + if (ut_check_console_dump(uts, total_bytes)) { \ + ut_failf(uts, __FILE__, __LINE__, __func__, \ + "console", \ + "Expected dump of length %x bytes, got '%s'", \ + total_bytes, uts->actual_str); \ + return CMD_RET_FAILURE; \ + } \ + /** * ut_check_free() - Return the number of bytes free in the malloc() pool * diff --git a/include/tpm-common.h b/include/tpm-common.h index f9c2ca20539b96884bcfffa5950f6ce647024340..702cd6e93b8b5d2cd000b2edeb2c8f0bae6fa46a 100644 --- a/include/tpm-common.h +++ b/include/tpm-common.h @@ -293,4 +293,7 @@ static inline cmd_tbl_t *get_tpm2_commands(unsigned int *size) */ enum tpm_version tpm_get_version(struct udevice *dev); +/* Iterate on all TPM devices */ +#define for_each_tpm_device(dev) uclass_foreach_dev_probe(UCLASS_TPM, (dev)) + #endif /* __TPM_COMMON_H */ diff --git a/lib/bch.c b/lib/bch.c index c4fac77d611456b116b663b0553d4325c6861fda..8945d8d4cf2ac7ccdb5c46f4826eb92f1f4c29e7 100644 --- a/lib/bch.c +++ b/lib/bch.c @@ -55,7 +55,9 @@ #ifndef USE_HOSTCC #include <common.h> +#include <malloc.h> #include <ubi_uboot.h> +#include <dm/devres.h> #include <linux/bitops.h> #else diff --git a/lib/binman.c b/lib/binman.c index 1774bdf2e5c60c14f0e21ada30890eca877728f2..6cf6dcfdad60558c45ef8c985a0c2d9eb2b0a609 100644 --- a/lib/binman.c +++ b/lib/binman.c @@ -9,6 +9,7 @@ #include <common.h> #include <binman.h> #include <dm.h> +#include <malloc.h> struct binman_info { ofnode image; diff --git a/lib/bzip2/bzlib.c b/lib/bzip2/bzlib.c index 9262e4055ed70e23c3331ad11a34a4805befe69c..377b269b06db55737347d396d60e0dac8ee3433c 100644 --- a/lib/bzip2/bzlib.c +++ b/lib/bzip2/bzlib.c @@ -1,5 +1,6 @@ #include <config.h> #include <common.h> +#include <malloc.h> #include <watchdog.h> /* diff --git a/lib/crypto/asymmetric_type.c b/lib/crypto/asymmetric_type.c index e04666c0801df7996e11ff3adcd809e858200ac2..7aa55092ac7062565a879408846d69df8e52f676 100644 --- a/lib/crypto/asymmetric_type.c +++ b/lib/crypto/asymmetric_type.c @@ -7,6 +7,7 @@ * Written by David Howells (dhowells@redhat.com) */ #ifndef __UBOOT__ +#include <dm/devres.h> #include <keys/asymmetric-subtype.h> #include <keys/asymmetric-parser.h> #endif @@ -14,6 +15,7 @@ #ifdef __UBOOT__ #include <linux/compat.h> #include <linux/ctype.h> +#include <linux/err.h> #include <linux/string.h> #else #include <linux/seq_file.h> diff --git a/lib/crypto/pkcs7_parser.c b/lib/crypto/pkcs7_parser.c index bf9e7e888f6b5b0550a17a5dc386c455fd867416..f5dda1179f8aa957eceb53b1ca9b57be9a271565 100644 --- a/lib/crypto/pkcs7_parser.c +++ b/lib/crypto/pkcs7_parser.c @@ -7,6 +7,7 @@ #define pr_fmt(fmt) "PKCS7: "fmt #ifdef __UBOOT__ +#include <dm/devres.h> #include <linux/bitops.h> #include <linux/compat.h> #endif diff --git a/lib/crypto/public_key.c b/lib/crypto/public_key.c index 634377472f401b9352426ea0baa40e66e9dfd98f..8b4821767aaacdbfa8087c0f8a04e0a893ddc705 100644 --- a/lib/crypto/public_key.c +++ b/lib/crypto/public_key.c @@ -9,7 +9,9 @@ #define pr_fmt(fmt) "PKEY: "fmt #ifdef __UBOOT__ +#include <dm/devres.h> #include <linux/compat.h> +#include <linux/err.h> #else #include <linux/module.h> #include <linux/export.h> diff --git a/lib/crypto/rsa_helper.c b/lib/crypto/rsa_helper.c index aca627a4a61916c6d52c95e5e3bc225115ec5954..cc0c0d6637bd3c877985baac59debf3708a154f5 100644 --- a/lib/crypto/rsa_helper.c +++ b/lib/crypto/rsa_helper.c @@ -6,6 +6,7 @@ * Authors: Tadeusz Struk <tadeusz.struk@intel.com> */ #ifndef __UBOOT__ +#include <linux/compat.h> #include <linux/kernel.h> #include <linux/export.h> #endif diff --git a/lib/crypto/x509_cert_parser.c b/lib/crypto/x509_cert_parser.c index e6d2a426a0bcea89bfa10e27a776bafcbafc38cb..4e41cffd2301dc1d906556b447e297fd51393dce 100644 --- a/lib/crypto/x509_cert_parser.c +++ b/lib/crypto/x509_cert_parser.c @@ -6,6 +6,7 @@ */ #define pr_fmt(fmt) "X.509: "fmt +#include <dm/devres.h> #include <linux/kernel.h> #ifndef __UBOOT__ #include <linux/export.h> diff --git a/lib/crypto/x509_public_key.c b/lib/crypto/x509_public_key.c index 04bdb672b4962ac4cc75381c4f29d9674d6e7ff9..676c0df17410740957b022e837402950bed36ff8 100644 --- a/lib/crypto/x509_public_key.c +++ b/lib/crypto/x509_public_key.c @@ -8,7 +8,9 @@ #define pr_fmt(fmt) "X.509: "fmt #ifdef __UBOOT__ #include <common.h> +#include <dm/devres.h> #include <linux/compat.h> +#include <linux/err.h> #include <linux/errno.h> #else #include <linux/module.h> diff --git a/lib/efi/efi.c b/lib/efi/efi.c index 7cba57b131f626e168d230ee77a2ac46042f92f2..0c16a5fdd38a983e23c06c998aa782319c29e971 100644 --- a/lib/efi/efi.c +++ b/lib/efi/efi.c @@ -11,6 +11,7 @@ #include <common.h> #include <debug_uart.h> #include <errno.h> +#include <malloc.h> #include <linux/err.h> #include <linux/types.h> #include <efi.h> diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index af5a878fc39ad8680e9011a927a9db8d7cdc2521..7c64077d42e8b1188859d3fc6ce625795a34260a 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -13,6 +13,7 @@ #include <debug_uart.h> #include <dm.h> #include <errno.h> +#include <malloc.h> #include <linux/err.h> #include <linux/types.h> #include <efi.h> diff --git a/lib/efi/efi_stub.c b/lib/efi/efi_stub.c index 6dd93ff435a5a408151f34d868ef4daa6d962dc7..7d650d512e30b142b0869adb5c3fd0e81cab496f 100644 --- a/lib/efi/efi_stub.c +++ b/lib/efi/efi_stub.c @@ -14,6 +14,7 @@ #include <efi.h> #include <efi_api.h> #include <errno.h> +#include <malloc.h> #include <ns16550.h> #include <asm/cpu.h> #include <asm/io.h> diff --git a/lib/efi_driver/efi_block_device.c b/lib/efi_driver/efi_block_device.c index cf0234193138fd335876b68bcb3508119dbb4540..33e66fcad2e745ecd4ef862d865bf3d56ec4cd71 100644 --- a/lib/efi_driver/efi_block_device.c +++ b/lib/efi_driver/efi_block_device.c @@ -29,6 +29,7 @@ */ #include <efi_driver.h> +#include <malloc.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 25b27ece6dd4294e484b36a601b2bc059cca5dd4..f8badadf66047a7053bafad9b8a17533dce733f8 100644 --- a/lib/efi_driver/efi_uclass.c +++ b/lib/efi_driver/efi_uclass.c @@ -18,6 +18,7 @@ */ #include <efi_driver.h> +#include <malloc.h> /** * check_node_type() - check node type diff --git a/lib/efi_loader/efi_console.c b/lib/efi_loader/efi_console.c index 8494044799a797c7f3ac2f76f6d200818afa40df..ac0dec1146f63d5af338113365a00d529074840a 100644 --- a/lib/efi_loader/efi_console.c +++ b/lib/efi_loader/efi_console.c @@ -7,6 +7,7 @@ #include <common.h> #include <charset.h> +#include <malloc.h> #include <time.h> #include <dm/device.h> #include <efi_loader.h> diff --git a/lib/efi_loader/efi_runtime.c b/lib/efi_loader/efi_runtime.c index df0485cdad3f6f09bb3a1fc1e12235d8f7920e06..4b3c843b2ced089fc355c88b228451587a072511 100644 --- a/lib/efi_loader/efi_runtime.c +++ b/lib/efi_loader/efi_runtime.c @@ -11,6 +11,7 @@ #include <dm.h> #include <elf.h> #include <efi_loader.h> +#include <malloc.h> #include <rtc.h> #include <u-boot/crc.h> diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 17051d409c4998ad5b47382e378bd9a267eab4ce..eb11fc898e308efdadba2dc2b998e0b38158fdf6 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -9,6 +9,7 @@ #include <dm.h> #include <hang.h> #include <init.h> +#include <malloc.h> #include <dm/of_extra.h> #include <env.h> #include <errno.h> @@ -224,7 +225,7 @@ int fdtdec_get_pci_vendev(const void *blob, int node, u16 *vendor, u16 *device) return -ENOENT; } -int fdtdec_get_pci_bar32(struct udevice *dev, struct fdt_pci_addr *addr, +int fdtdec_get_pci_bar32(const struct udevice *dev, struct fdt_pci_addr *addr, u32 *bar) { int barnum; diff --git a/lib/libavb/avb_cmdline.c b/lib/libavb/avb_cmdline.c index 684c512bb915949ad9c9d684a6d51338e82ff6fd..dd859d3467ea74447ce7fb249f0d3a77138861fa 100644 --- a/lib/libavb/avb_cmdline.c +++ b/lib/libavb/avb_cmdline.c @@ -7,6 +7,7 @@ #include "avb_sha.h" #include "avb_util.h" #include "avb_version.h" +#include <malloc.h> #define NUM_GUIDS 3 diff --git a/lib/libavb/avb_descriptor.c b/lib/libavb/avb_descriptor.c index 9f03b9777ab96866124c1171f119dc5f17d0368d..86b8d1b99430e74841224674a95761016a8d863b 100644 --- a/lib/libavb/avb_descriptor.c +++ b/lib/libavb/avb_descriptor.c @@ -6,6 +6,7 @@ #include "avb_descriptor.h" #include "avb_util.h" #include "avb_vbmeta_image.h" +#include <malloc.h> bool avb_descriptor_validate_and_byteswap(const AvbDescriptor* src, AvbDescriptor* dest) { diff --git a/lib/libavb/avb_rsa.c b/lib/libavb/avb_rsa.c index bbf15626b85f2f41dafc90e0782fa03e12b709b7..d7bf8905be2876d754aa211ffc9323ecafca7862 100644 --- a/lib/libavb/avb_rsa.c +++ b/lib/libavb/avb_rsa.c @@ -12,6 +12,7 @@ #include "avb_sha.h" #include "avb_util.h" #include "avb_vbmeta_image.h" +#include <malloc.h> typedef struct IAvbKey { unsigned int len; /* Length of n[] in number of uint32_t */ diff --git a/lib/libavb/avb_slot_verify.c b/lib/libavb/avb_slot_verify.c index c0defdf9c98aa4eed3d576f65d7781471bbfeb1e..58baf522fcb04c99e20047dc03c42ff4696b54cf 100644 --- a/lib/libavb/avb_slot_verify.c +++ b/lib/libavb/avb_slot_verify.c @@ -14,6 +14,7 @@ #include "avb_util.h" #include "avb_vbmeta_image.h" #include "avb_version.h" +#include <malloc.h> /* Maximum number of partitions that can be loaded with avb_slot_verify(). */ #define MAX_NUMBER_OF_LOADED_PARTITIONS 32 diff --git a/lib/libavb/avb_sysdeps_posix.c b/lib/libavb/avb_sysdeps_posix.c index 0bb0cc1498e5a97ab2742d20408f3966f1524800..6ffdb0b7eb35ff47c5412373de6d3e97f7788be7 100644 --- a/lib/libavb/avb_sysdeps_posix.c +++ b/lib/libavb/avb_sysdeps_posix.c @@ -4,6 +4,7 @@ */ #include <hang.h> +#include <malloc.h> #include <stdarg.h> #include <stdlib.h> diff --git a/lib/libavb/avb_util.c b/lib/libavb/avb_util.c index 405d625351eb23cc03e06c75634c247a1430c046..94773b77e7e332f9c44c9424c5fab6958cbb5659 100644 --- a/lib/libavb/avb_util.c +++ b/lib/libavb/avb_util.c @@ -4,6 +4,7 @@ */ #include "avb_util.h" +#include <malloc.h> #include <stdarg.h> diff --git a/lib/linux_compat.c b/lib/linux_compat.c index 3f440deaa0d8a5d5a7d181772750786be29ba7e4..89a6fd6ec96d5e10ae4b890d2cb1200ca4332ab9 100644 --- a/lib/linux_compat.c +++ b/lib/linux_compat.c @@ -1,5 +1,6 @@ #include <common.h> +#include <malloc.h> #include <memalign.h> #include <linux/compat.h> diff --git a/lib/list_sort.c b/lib/list_sort.c index e841da53ee698a508fc419a8486a0144d88bf8b6..beb7273fd30d955c4d247bb59c30ee9e695a2318 100644 --- a/lib/list_sort.c +++ b/lib/list_sort.c @@ -1,4 +1,5 @@ #ifndef __UBOOT__ +#include <dm/devres.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/slab.h> diff --git a/lib/lmb.c b/lib/lmb.c index b3b84e4d37d962297e45f18f31a0c07e8c4c9a48..07b9308adf29ff4d5773b8a663ec6e0bdaedd6a9 100644 --- a/lib/lmb.c +++ b/lib/lmb.c @@ -8,6 +8,7 @@ #include <common.h> #include <lmb.h> +#include <malloc.h> #define LMB_ALLOC_ANYWHERE 0 diff --git a/lib/rsa/rsa-sign.c b/lib/rsa/rsa-sign.c index 5b5905aeb5ffcfd3b9cbbadbae737a97c5d5480e..6400ef63d6a92a05ca83780138231e0787506dc7 100644 --- a/lib/rsa/rsa-sign.c +++ b/lib/rsa/rsa-sign.c @@ -4,6 +4,7 @@ */ #include "mkimage.h" +#include <malloc.h> #include <stdio.h> #include <string.h> #include <image.h> diff --git a/lib/rsa/rsa-verify.c b/lib/rsa/rsa-verify.c index 82dc513260e2c9d44bb2e8767df50cb0fdae39c5..326a5e4ea97e5fc369c72520b627e5a040c071c9 100644 --- a/lib/rsa/rsa-verify.c +++ b/lib/rsa/rsa-verify.c @@ -6,6 +6,7 @@ #ifndef USE_HOSTCC #include <common.h> #include <fdtdec.h> +#include <malloc.h> #include <asm/types.h> #include <asm/byteorder.h> #include <linux/errno.h> diff --git a/lib/string.c b/lib/string.c index 9b779ddc3bbe42b6df36a70c3ece2213b40e5fa6..ae7835f600d973833d7dff62e687bd5128d7a321 100644 --- a/lib/string.c +++ b/lib/string.c @@ -324,7 +324,6 @@ char * strdup(const char *s) strcpy (new, s); return new; } -#endif char * strndup(const char *s, size_t n) { @@ -348,6 +347,7 @@ char * strndup(const char *s, size_t n) return new; } +#endif #ifndef __HAVE_ARCH_STRSPN /** diff --git a/lib/zstd/decompress.c b/lib/zstd/decompress.c index ac5ab528bb19449ac57920e7dd1e5ac86631809d..ae3be3f02a61ab2a6fc9b8857f9c89a297604b6a 100644 --- a/lib/zstd/decompress.c +++ b/lib/zstd/decompress.c @@ -23,6 +23,7 @@ #include "huf.h" #include "mem.h" /* low level memory routines */ #include "zstd_internal.h" +#include <malloc.h> #include <linux/kernel.h> #include <linux/compat.h> #include <linux/string.h> /* memcpy, memmove, memset */ diff --git a/lib/zstd/zstd_common.c b/lib/zstd/zstd_common.c index 9a217e15739c7a510dabdff07661559f8890fd6a..6b2c79eeb656ea9d99cea362472e4dacf3723905 100644 --- a/lib/zstd/zstd_common.c +++ b/lib/zstd/zstd_common.c @@ -9,6 +9,7 @@ ***************************************/ #include "error_private.h" #include "zstd_internal.h" /* declaration of ZSTD_isError, ZSTD_getErrorName, ZSTD_getErrorCode, ZSTD_getErrorString, ZSTD_versionNumber */ +#include <malloc.h> #include <linux/kernel.h> /*=************************************************************** diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c index f75e4df626bd70e99522527b3b5208b2f81623c5..8e7872155a1383fd4a02ab74e66988e2fa967180 100644 --- a/net/mdio-uclass.c +++ b/net/mdio-uclass.c @@ -6,9 +6,12 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <miiphy.h> #include <dm/device-internal.h> +#include <dm/device_compat.h> #include <dm/uclass-internal.h> +#include <linux/compat.h> /* DT node properties for MAC-PHY interface */ #define PHY_MODE_STR_CNT 2 diff --git a/post/post.c b/post/post.c index f27138ddaaf3bba4fa165e20c13de945cbbd85d4..696a60f70a7146a021ba95c59b724b9fe3746c6e 100644 --- a/post/post.c +++ b/post/post.c @@ -6,6 +6,7 @@ #include <common.h> #include <env.h> +#include <malloc.h> #include <stdio_dev.h> #include <time.h> #include <watchdog.h> diff --git a/scripts/dtc/checks.c b/scripts/dtc/checks.c index c07ba4da9e36119bfb5c8732f5b2178a46b09997..40879677c8c3af28bc646a98bd2c67c73ad55989 100644 --- a/scripts/dtc/checks.c +++ b/scripts/dtc/checks.c @@ -579,6 +579,8 @@ static void fixup_phandle_references(struct check *c, struct dt_info *dti, phandle = get_node_phandle(dt, refnode); *((fdt32_t *)(prop->val.val + m->offset)) = cpu_to_fdt32(phandle); + + reference_node(refnode); } } } @@ -609,11 +611,21 @@ static void fixup_path_references(struct check *c, struct dt_info *dti, path = refnode->fullpath; prop->val = data_insert_at_marker(prop->val, m, path, strlen(path) + 1); + + reference_node(refnode); } } } ERROR(path_references, fixup_path_references, NULL, &duplicate_node_names); +static void fixup_omit_unused_nodes(struct check *c, struct dt_info *dti, + struct node *node) +{ + if (node->omit_if_unused && !node->is_referenced) + delete_node(node); +} +ERROR(omit_unused_nodes, fixup_omit_unused_nodes, NULL, &phandle_references, &path_references); + /* * Semantic checks */ @@ -1367,6 +1379,7 @@ static struct check *check_table[] = { &explicit_phandles, &phandle_references, &path_references, + &omit_unused_nodes, &address_cells_is_cell, &size_cells_is_cell, &interrupt_cells_is_cell, &device_type_is_string, &model_is_string, &status_is_string, diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index 24af549977584c33b302a470fe90fd9b42e6539d..d3694d6cf202d40cee9c14b07d6bc17d25314a76 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l @@ -152,6 +152,13 @@ static void PRINTF(1, 2) lexical_error(const char *fmt, ...); return DT_DEL_NODE; } +<*>"/omit-if-no-ref/" { + DPRINT("Keyword: /omit-if-no-ref/\n"); + DPRINT("<PROPNODENAME>\n"); + BEGIN(PROPNODENAME); + return DT_OMIT_NO_REF; + } + <*>{LABEL}: { DPRINT("Label: %s\n", yytext); yylval.labelref = xstrdup(yytext); diff --git a/scripts/dtc/dtc-parser.y b/scripts/dtc/dtc-parser.y index 44af170abfeaca34a94217d0cf7519568e27b72a..66ff7f7d8eb73ca4c4a2d1275caf788741366ed3 100644 --- a/scripts/dtc/dtc-parser.y +++ b/scripts/dtc/dtc-parser.y @@ -63,6 +63,7 @@ extern bool treesource_error; %token DT_BITS %token DT_DEL_PROP %token DT_DEL_NODE +%token DT_OMIT_NO_REF %token <propnodename> DT_PROPNODENAME %token <integer> DT_LITERAL %token <integer> DT_CHAR_LITERAL @@ -217,6 +218,18 @@ devicetree: ERROR(&@3, "Label or path %s not found", $3); + $$ = $1; + } + | devicetree DT_OMIT_NO_REF DT_REF ';' + { + struct node *target = get_node_by_ref($1, $3); + + if (target) + omit_node_if_unused(target); + else + ERROR(&@3, "Label or path %s not found", $3); + + $$ = $1; } ; @@ -523,6 +536,10 @@ subnode: { $$ = name_node(build_node_delete(), $2); } + | DT_OMIT_NO_REF subnode + { + $$ = omit_node_if_unused($2); + } | DT_LABEL subnode { add_label(&$2->labels, $1); diff --git a/scripts/dtc/dtc.h b/scripts/dtc/dtc.h index 3b18a42b866e73323c0335997a79322f385312ed..6d667701ab6aa9027510b57eedc3f12ed5d9f8d5 100644 --- a/scripts/dtc/dtc.h +++ b/scripts/dtc/dtc.h @@ -168,6 +168,8 @@ struct node { struct label *labels; const struct bus_type *bus; + + bool omit_if_unused, is_referenced; }; #define for_each_label_withdel(l0, l) \ @@ -202,6 +204,8 @@ struct property *reverse_properties(struct property *first); struct node *build_node(struct property *proplist, struct node *children); struct node *build_node_delete(void); struct node *name_node(struct node *node, char *name); +struct node *omit_node_if_unused(struct node *node); +struct node *reference_node(struct node *node); struct node *chain_node(struct node *first, struct node *list); struct node *merge_nodes(struct node *old_node, struct node *new_node); struct node *add_orphan_node(struct node *old_node, struct node *new_node, char *ref); diff --git a/scripts/dtc/livetree.c b/scripts/dtc/livetree.c index 57b7db2ed1534873ea8f382c958d19038ba86916..81b6c484542d16eeee10d2c56d07f71be5b9022c 100644 --- a/scripts/dtc/livetree.c +++ b/scripts/dtc/livetree.c @@ -134,6 +134,20 @@ struct node *name_node(struct node *node, char *name) return node; } +struct node *omit_node_if_unused(struct node *node) +{ + node->omit_if_unused = 1; + + return node; +} + +struct node *reference_node(struct node *node) +{ + node->is_referenced = 1; + + return node; +} + struct node *merge_nodes(struct node *old_node, struct node *new_node) { struct property *new_prop, *old_prop; diff --git a/test/bloblist.c b/test/bloblist.c index d0f7296e0d89c40805f9dcb4d6220c1b038995c1..bdcca0291c7127a8c2e68542eca7d9960eaf74e4 100644 --- a/test/bloblist.c +++ b/test/bloblist.c @@ -24,6 +24,7 @@ enum { TEST_SIZE = 10, TEST_SIZE2 = 20, + TEST_SIZE_LARGE = 0xe0, TEST_ADDR = CONFIG_BLOBLIST_ADDR, TEST_BLOBLIST_SIZE = 0x100, @@ -33,13 +34,31 @@ static struct bloblist_hdr *clear_bloblist(void) { struct bloblist_hdr *hdr; - /* Clear out any existing bloblist so we have a clean slate */ + /* + * Clear out any existing bloblist so we have a clean slate. Zero the + * header so that existing records are removed, but set everything else + * to 0xff for testing purposes. + */ hdr = map_sysmem(CONFIG_BLOBLIST_ADDR, TEST_BLOBLIST_SIZE); - memset(hdr, '\0', TEST_BLOBLIST_SIZE); + memset(hdr, '\xff', TEST_BLOBLIST_SIZE); + memset(hdr, '\0', sizeof(*hdr)); return hdr; } +static int check_zero(void *data, int size) +{ + u8 *ptr; + int i; + + for (ptr = data, i = 0; i < size; i++, ptr++) { + if (*ptr) + return -EINVAL; + } + + return 0; +} + static int bloblist_test_init(struct unit_test_state *uts) { struct bloblist_hdr *hdr; @@ -83,10 +102,14 @@ static int bloblist_test_blob(struct unit_test_state *uts) data = bloblist_find(TEST_TAG, TEST_SIZE); ut_asserteq_ptr(rec + 1, data); + /* Check the data is zeroed */ + ut_assertok(check_zero(data, TEST_SIZE)); + /* Check the 'ensure' method */ ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE)); ut_assertnull(bloblist_ensure(TEST_TAG, TEST_SIZE2)); rec2 = (struct bloblist_rec *)(data + ALIGN(TEST_SIZE, BLOBLIST_ALIGN)); + ut_assertok(check_zero(data, TEST_SIZE)); /* Check for a non-existent record */ ut_asserteq_ptr(data, bloblist_ensure(TEST_TAG, TEST_SIZE)); @@ -97,6 +120,40 @@ static int bloblist_test_blob(struct unit_test_state *uts) } BLOBLIST_TEST(bloblist_test_blob, 0); +/* Check bloblist_ensure_size_ret() */ +static int bloblist_test_blob_ensure(struct unit_test_state *uts) +{ + void *data, *data2; + int size; + + /* At the start there should be no records */ + clear_bloblist(); + ut_assertok(bloblist_new(TEST_ADDR, TEST_BLOBLIST_SIZE, 0)); + + /* Test with an empty bloblist */ + size = TEST_SIZE; + ut_assertok(bloblist_ensure_size_ret(TEST_TAG, &size, &data)); + ut_asserteq(TEST_SIZE, size); + ut_assertok(check_zero(data, TEST_SIZE)); + + /* Check that we get the same thing again */ + ut_assertok(bloblist_ensure_size_ret(TEST_TAG, &size, &data2)); + ut_asserteq(TEST_SIZE, size); + ut_asserteq_ptr(data, data2); + + /* Check that the size remains the same */ + size = TEST_SIZE2; + ut_assertok(bloblist_ensure_size_ret(TEST_TAG, &size, &data)); + ut_asserteq(TEST_SIZE, size); + + /* Check running out of space */ + size = TEST_SIZE_LARGE; + ut_asserteq(-ENOSPC, bloblist_ensure_size_ret(TEST_TAG2, &size, &data)); + + return 0; +} +BLOBLIST_TEST(bloblist_test_blob_ensure, 0); + static int bloblist_test_bad_blob(struct unit_test_state *uts) { struct bloblist_hdr *hdr; diff --git a/test/dm/clk.c b/test/dm/clk.c index 31335a543f176ad49fd4eee78b58cbcb6917cbb9..003b78934f35d75fb64d01b40c4c0e221f88c20d 100644 --- a/test/dm/clk.c +++ b/test/dm/clk.c @@ -6,6 +6,7 @@ #include <common.h> #include <clk.h> #include <dm.h> +#include <malloc.h> #include <asm/clk.h> #include <dm/test.h> #include <dm/device-internal.h> diff --git a/test/dm/devres.c b/test/dm/devres.c index e7331897de8400d0fa9f6c22895a195caed37c1b..cbd0972c9b48781a8cc063a6e4a4872a3b27be03 100644 --- a/test/dm/devres.c +++ b/test/dm/devres.c @@ -10,6 +10,7 @@ #include <dm.h> #include <malloc.h> #include <dm/device-internal.h> +#include <dm/devres.h> #include <dm/test.h> #include <dm/uclass-internal.h> #include <test/ut.h> diff --git a/test/dm/dma.c b/test/dm/dma.c index b56d17731d5c1e7a4bb4aafbda74b186ba7b0eb3..12cba57a56f78bd838f7bf7cec4178a740a732ba 100644 --- a/test/dm/dma.c +++ b/test/dm/dma.c @@ -8,6 +8,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/test.h> #include <dma.h> #include <test/ut.h> diff --git a/test/dm/gpio.c b/test/dm/gpio.c index bb4b20cea938d57463627e697f8bd20cf09db4cd..349123a657c2f0599ebb2f2f07e0d6761284af4d 100644 --- a/test/dm/gpio.c +++ b/test/dm/gpio.c @@ -6,6 +6,7 @@ #include <common.h> #include <fdtdec.h> #include <dm.h> +#include <malloc.h> #include <dm/root.h> #include <dm/test.h> #include <dm/util.h> diff --git a/test/dm/mailbox.c b/test/dm/mailbox.c index 4562d2ac4f83e7fa8c88a9bb8c20addd694e1343..e6c521b8b5429b1eede509026dcd105cffdaa26e 100644 --- a/test/dm/mailbox.c +++ b/test/dm/mailbox.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/test.h> #include <asm/mbox.h> #include <test/ut.h> diff --git a/test/dm/ofnode.c b/test/dm/ofnode.c index 745de50c7bae19b91ee5b8563001170d72f827f7..1c49eaf38bff96f68e55e6ddccc55dd0bad1d725 100644 --- a/test/dm/ofnode.c +++ b/test/dm/ofnode.c @@ -58,3 +58,58 @@ static int dm_test_ofnode_fmap(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_ofnode_fmap, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_ofnode_read(struct unit_test_state *uts) +{ + const u32 *val; + ofnode node; + int size; + + node = ofnode_path("/a-test"); + ut_assert(ofnode_valid(node)); + + val = ofnode_read_prop(node, "int-value", &size); + ut_assertnonnull(val); + ut_asserteq(4, size); + ut_asserteq(1234, fdt32_to_cpu(val[0])); + + val = ofnode_read_prop(node, "missing", &size); + ut_assertnull(val); + ut_asserteq(-FDT_ERR_NOTFOUND, size); + + /* Check it works without a size parameter */ + val = ofnode_read_prop(node, "missing", NULL); + ut_assertnull(val); + + return 0; +} +DM_TEST(dm_test_ofnode_read, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +static int dm_test_ofnode_read_chosen(struct unit_test_state *uts) +{ + const char *str; + const u32 *val; + ofnode node; + int size; + + str = ofnode_read_chosen_string("setting"); + ut_assertnonnull(str); + ut_asserteq_str("sunrise ohoka", str); + ut_asserteq_ptr(NULL, ofnode_read_chosen_string("no-setting")); + + node = ofnode_get_chosen_node("other-node"); + ut_assert(ofnode_valid(node)); + ut_asserteq_str("c-test@5", ofnode_get_name(node)); + + node = ofnode_get_chosen_node("setting"); + ut_assert(!ofnode_valid(node)); + + val = ofnode_read_chosen_prop("int-values", &size); + ut_assertnonnull(val); + ut_asserteq(8, size); + ut_asserteq(0x1937, fdt32_to_cpu(val[0])); + ut_asserteq(72993, fdt32_to_cpu(val[1])); + + return 0; +} +DM_TEST(dm_test_ofnode_read_chosen, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); diff --git a/test/dm/power-domain.c b/test/dm/power-domain.c index 48318218a9e2227662c81fabeb60cb055ede4d59..8baf5d09d1d235c184642012b8c7c6b18fe0f88d 100644 --- a/test/dm/power-domain.c +++ b/test/dm/power-domain.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/test.h> #include <asm/power-domain.h> #include <test/ut.h> diff --git a/test/dm/regmap.c b/test/dm/regmap.c index 6fd1f20656bc4df3b6136aaeffbf5cb7b251e09a..b21f66732b9d14cb1f93ab1d5d1a166bd8a0bea7 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 <linux/err.h> #include <test/ut.h> /* Base test of register maps */ diff --git a/test/dm/reset.c b/test/dm/reset.c index c61daed49032b64ebbd0ebaf8a36400dc4ed9f44..8370820428c38a476cd11c938523693d5514eb1e 100644 --- a/test/dm/reset.c +++ b/test/dm/reset.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <reset.h> #include <dm/test.h> #include <asm/reset.h> diff --git a/test/dm/sound.c b/test/dm/sound.c index 3767abbd1c753064ebb3c1cf9e2cfd7b3df8da92..aa5368f05b9da0f699c2737bef9025faad5a4668 100644 --- a/test/dm/sound.c +++ b/test/dm/sound.c @@ -28,6 +28,7 @@ static int dm_test_sound(struct unit_test_state *uts) ut_asserteq(4560, sandbox_get_sound_sum(dev)); ut_assertok(sound_beep(dev, 1, 100)); ut_asserteq(9120, sandbox_get_sound_sum(dev)); + ut_asserteq(false, sandbox_get_sound_active(dev)); return 0; } diff --git a/test/dm/spmi.c b/test/dm/spmi.c index e6a910859e3a48a6f424b6f5c9031f296af8b4cb..668b7e133ff8ec46474ac2beea677b7fe52e03c2 100644 --- a/test/dm/spmi.c +++ b/test/dm/spmi.c @@ -6,6 +6,7 @@ #include <common.h> #include <fdtdec.h> #include <dm.h> +#include <malloc.h> #include <dm/device.h> #include <dm/root.h> #include <dm/test.h> diff --git a/test/dm/syscon.c b/test/dm/syscon.c index 0ff9da7ec630bbe70f633d6a9dddc3977c648433..f1021f374b61e492cfc821c82c948f4d76f8b61c 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 <linux/err.h> #include <test/ut.h> /* Base test of system controllers */ diff --git a/test/dm/tee.c b/test/dm/tee.c index 22f05a4219783c8a7826b1b0750e49509c177e26..d40f13d291559f9d4781b53cd42ceae3095d64e0 100644 --- a/test/dm/tee.c +++ b/test/dm/tee.c @@ -5,6 +5,7 @@ #include <common.h> #include <dm.h> +#include <malloc.h> #include <dm/test.h> #include <sandboxtee.h> #include <tee.h> diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c index 698ca0e7cf86cf47fcb474dcaa61daab5696bd6b..75ae08081cdc997355c522bdf55d4396d0d97c45 100644 --- a/test/dm/test-fdt.c +++ b/test/dm/test-fdt.c @@ -12,6 +12,7 @@ #include <dm/test.h> #include <dm/root.h> #include <dm/device-internal.h> +#include <dm/devres.h> #include <dm/uclass-internal.h> #include <dm/util.h> #include <dm/lists.h> @@ -914,3 +915,41 @@ static int dm_test_uclass_drvdata(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_uclass_drvdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test device_first_child_ofdata_err(), etc. */ +static int dm_test_child_ofdata(struct unit_test_state *uts) +{ + struct udevice *bus, *dev; + int count; + + ut_assertok(uclass_first_device_err(UCLASS_TEST_BUS, &bus)); + count = 0; + device_foreach_child_ofdata_to_platdata(dev, bus) { + ut_assert(dev->flags & DM_FLAG_PLATDATA_VALID); + ut_assert(!(dev->flags & DM_FLAG_ACTIVATED)); + count++; + } + ut_asserteq(3, count); + + return 0; +} +DM_TEST(dm_test_child_ofdata, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); + +/* Test device_first_child_err(), etc. */ +static int dm_test_first_child_probe(struct unit_test_state *uts) +{ + struct udevice *bus, *dev; + int count; + + ut_assertok(uclass_first_device_err(UCLASS_TEST_BUS, &bus)); + count = 0; + device_foreach_child_probe(dev, bus) { + ut_assert(dev->flags & DM_FLAG_PLATDATA_VALID); + ut_assert(dev->flags & DM_FLAG_ACTIVATED); + count++; + } + ut_asserteq(3, count); + + return 0; +} +DM_TEST(dm_test_first_child_probe, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT); diff --git a/test/dm/test-main.c b/test/dm/test-main.c index 72648162a917a4be80d8d76b547683ab5ed31e81..d7dc8d1f915b1fee314cba1066d74b6763099040 100644 --- a/test/dm/test-main.c +++ b/test/dm/test-main.c @@ -97,11 +97,11 @@ static int dm_do_test(struct unit_test_state *uts, struct unit_test *test, * Silence the console and rely on console recording to get * our output. */ - console_record_reset(); + console_record_reset_enable(); if (!state->show_test_output) gd->flags |= GD_FLG_SILENT; test->func(uts); - gd->flags &= ~GD_FLG_SILENT; + gd->flags &= ~(GD_FLG_SILENT | GD_FLG_RECORD); state_set_skip_delays(false); ut_assertok(dm_test_destroy(uts)); diff --git a/test/dm/video.c b/test/dm/video.c index 3151ebb73fc644c8778cab4248d1f494af28b0e9..f72979fac4ee895598acac4fc4917673ca85bc59 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -7,6 +7,7 @@ #include <common.h> #include <bzlib.h> #include <dm.h> +#include <malloc.h> #include <mapmem.h> #include <os.h> #include <video.h> diff --git a/test/lib/lmb.c b/test/lib/lmb.c index ec68227bb6ab5fba7cf0e17a3cf0f7313097f38a..1336b54b11f214565d3852061fb1e2c938111352 100644 --- a/test/lib/lmb.c +++ b/test/lib/lmb.c @@ -5,6 +5,7 @@ #include <common.h> #include <lmb.h> +#include <malloc.h> #include <dm/test.h> #include <test/ut.h> diff --git a/test/unicode_ut.c b/test/unicode_ut.c index 47532a64df62b8409ac2dd8e8e716ee84ee15b4c..4d99c20bc04779a5228956bc6a6d2cfdba903f4b 100644 --- a/test/unicode_ut.c +++ b/test/unicode_ut.c @@ -9,6 +9,7 @@ #include <charset.h> #include <command.h> #include <errno.h> +#include <malloc.h> #include <test/test.h> #include <test/suites.h> #include <test/ut.h> diff --git a/test/ut.c b/test/ut.c index 265da4a0d89a8d05fa50e39751c32e6b52ed1119..c64f0b554d5788be57eafcc88327e12d50c1bacd 100644 --- a/test/ut.c +++ b/test/ut.c @@ -6,6 +6,7 @@ */ #include <common.h> +#include <console.h> #include <malloc.h> #include <test/test.h> #include <test/ut.h> @@ -46,3 +47,48 @@ long ut_check_delta(ulong last) return ut_check_free() - last; } +int ut_check_console_line(struct unit_test_state *uts, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + vsnprintf(uts->expect_str, sizeof(uts->expect_str), fmt, args); + va_end(args); + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + + return strcmp(uts->expect_str, uts->actual_str); +} + +int ut_check_console_end(struct unit_test_state *uts) +{ + if (!console_record_avail()) + return 0; + + console_record_readline(uts->actual_str, sizeof(uts->actual_str)); + + return 1; +} + +int ut_check_console_dump(struct unit_test_state *uts, int total_bytes) +{ + char *str = uts->actual_str; + int upto; + + /* Handle empty dump */ + if (!total_bytes) + return 0; + + for (upto = 0; upto < total_bytes;) { + int len; + int bytes; + + len = console_record_readline(str, sizeof(uts->actual_str)); + if (str[8] != ':' || str[9] != ' ') + return 1; + + bytes = len - 8 - 2 - 3 * 16 - 4; + upto += bytes; + } + + return upto == total_bytes ? 0 : 1; +} diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 4f39bfd0ce5b81491f06781bc3169be7afe3385a..89c54d688a824650befc5970a0a3094baf0111a7 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -487,6 +487,8 @@ class Toolchains: URL containing this toolchain, if avaialble, else None """ arch = command.OutputOneLine('uname', '-m') + if arch == 'aarch64': + arch = 'arm64' base = 'https://www.kernel.org/pub/tools/crosstool/files/bin' versions = ['7.3.0', '6.4.0', '4.9.4'] links = []