diff options
author | Tom Rini | 2020-02-11 10:58:41 -0500 |
---|---|---|
committer | Tom Rini | 2020-02-11 10:58:41 -0500 |
commit | 9a8942b53d57149754e0dfc975e0d92d1afd4087 (patch) | |
tree | de55e5352f3a8a79c413c0b8cb533428e5476841 /drivers | |
parent | ae347120eed8204b1fdf018ddf79131964e57016 (diff) | |
parent | 21d651fb29cf268b1a5f64d080e3d352ee32c87f (diff) |
Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dm
sandbox conversion to SDL2
TPM TEE driver
Various minor sandbox video enhancements
New driver model core utility functions
Diffstat (limited to 'drivers')
474 files changed, 1300 insertions, 244 deletions
diff --git a/drivers/adc/rockchip-saradc.c b/drivers/adc/rockchip-saradc.c index ed773b9642b..850142cce37 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 04b6a8a2f5b..2ca0fb4f108 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 029338e4af6..ca1ac3e757e 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 d724f190798..a6f483ed251 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 ca8978f0e14..7c39aa5f2f5 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 d3b1aaaba36..cca2237136a 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 179869df45f..affeb31fc2e 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 b3a3f3d4dd9..f4a441ad684 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 70b277e26f7..a80f259a72c 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 8f02d73d8da..86bb71f6128 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 c880af8155f..c55e6214b22 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 24af183b550..c3cb2ba0146 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 5d1489ab0ec..f1f76b0a4da 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 a5626c33d1e..414185031e2 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 822e09b0844..d79ae367b80 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 711b0588bc3..2ceb6bb171c 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 70b87945545..6415c2f1b91 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 5acc0b8cbd0..b9d2ae6778f 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 ed1facbbcd7..82241d9f3f5 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 0df38bd06a4..71878474ebe 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 dcdb6ddf5cf..cf9c4ae367f 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 de6b2f7c82f..768fbb7c520 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 9fa27229e18..3543bea70d2 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 41954660ea1..873383856f9 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 7e97b0c4bf3..9d4d2149e32 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 c692a6d0b89..82e589e239f 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 b09c37db40f..4ca1cc0d52a 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 72fc39fa47a..e0eb897da89 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 95120d6559c..3e99c528de5 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 1b9db6e791f..b38890d5ba5 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 a755e265016..671054d9bef 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 4ae55f5a077..b8be3167c4c 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 2246beb21b2..1673eb26b2c 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 0cdb9df45d9..525442debf0 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 32cbf752aed..7035b59a137 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 1b2523bbf1f..686d94ebfe8 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 abb5337e782..e781e08d9d5 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 b1a35968e15..068e48ea040 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 aa7ccd690f7..233926e9b6a 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 36764c128b0..b88534145ef 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 6d5ae3d0031..6e085c41368 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 efda8c830b0..a6f7902941a 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 3ea9a81b324..2b82a40d281 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 6e8a164d622..ef33adbf294 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 cc1c1e81e95..81cdb8ee9c7 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 f212c5ffc2c..c0f1285e4c7 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 e700a1bc25c..8e867c58dfe 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 b51d529adea..2cce1b967d1 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 37fc142a7a8..865b80cc0fb 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 97fdd099ef3..da9c48b962a 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 ce0769f2d13..8847178001b 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 98be7602b3d..6083f14e751 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 1da63819e7d..9f240509925 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 9f39218423e..89ea820d487 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 237b42653c6..457e1309c54 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 4704049aee5..e73ebeabcc9 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 575798fae93..33811e62f7a 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 945b81448cc..acd745c1211 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 8f0eab2ca62..96a5dd20bd1 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 9602e52d1b1..1f999b1b316 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 b9ae82174ee..15f0e42a85b 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 61192d8a9ff..58b19a42109 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 3ea5a7c0c0d..314c7aea00e 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 e0d04ccca28..1f7ead0c674 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 9528a7b4eec..36cd4e945b2 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 96250eb5d2a..d99460f2fb2 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 5598bca21c5..9d5a7fc796c 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 8fcef1863e2..234a7d2134d 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 95f6b5a93a3..f274100f322 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 62b1dc20064..99b2e5dfed4 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 7e8bd7eae88..0917871d49b 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 dcb1c1b3699..64717a6780e 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 1012f2d8eb8..9d293b6994d 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 5ea3e77b2d1..3621cf24088 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 8e6f32de1f3..a3f5e7a2e0a 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 ac88f0ca8d8..0d0e9d22549 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 2eb1547b4f3..e3439eebb5b 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 594e0a470a9..9dc4cd60422 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 90fbed455b8..0a22441d38a 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 912a4cac59b..29791882a34 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 dcd78e7e88e..276a3b350dc 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 c899454ec41..c65ca817281 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 ea2f689d60e..12e7197daf7 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 77778e9ce57..405e9ac135b 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 5c2944067bc..d06b834a3bc 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 ab0c4c1b971..11274c78101 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 ad8da9ef284..6320a6280d5 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 525aa3b9ac5..4e4cd125457 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 302a4349477..f55f834e7d6 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 195f079707c..61d226bcbb5 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 a32bde4906d..74afb4aec22 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 35dc234160d..c84d75ac922 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 846b3d5320b..c817ed6bf95 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 c8c5d2c3310..e1d5aeb19db 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 62acd28e1bc..d8b4a683bce 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 07a7e03033d..f06523ab99b 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 c9d3faa9119..62e68046d6c 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 ee59bac1236..bcf45160d8d 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 413aaa6ba31..5029c71adc7 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 e8b124f4f5f..0575bd8937f 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 8b1149997a1..9a3dd7ec4a9 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 bb2935f8ec0..be90a7b24a8 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 6b7ce985b3a..a03c465c8f3 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 05d0dc60121..b877602aab6 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 21dfa5023bd..7d046c1a1e6 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 142463ef440..66a0148254c 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 5ce0f869c70..149bd327bdf 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 93f6b913c64..af6b8245c97 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 b07b56cf97b..a560209f035 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 5968c9b7eb6..291f5c218e5 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 ba1bb1cf957..faca8fcc441 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 bc917b3de49..25e23eb05b7 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 c3df9678a74..13e642ab703 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 9bee886561c..60f6a38321e 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 c181a7b8176..17b46545f5f 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 4fcb2d96f51..9dd6a18b2b5 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 b34191753b1..3ad21c1ea0a 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 c19c3c0646b..47e42738e04 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 1bc19edfcba..4cff160d887 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 a198700b5f5..9fe0aca3426 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 c3795c59c08..a6ee9a235e3 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 e7efcdeafa3..980b84453e1 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 11189d16c83..97e2afa6765 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 89e27dd526a..ce2b9251738 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 9f5baa52885..53d7e1d154a 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 41a90834ffc..aad9d8b85b4 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 ea8eb0d5091..d396afc14ce 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 1321ec37e1b..8929e603f33 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 7f70acaf399..8cebf99c589 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 112f1150158..ab40019ccbe 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 462ad2878a2..4900498e9b6 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 cb2a7c3eb5e..8d4f886cb49 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 c7a832ca900..0b90a976501 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 cae42ec4ace..da3ae2ec358 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 d4870818a80..bd1fb09d1c9 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 5d0cfb2ebdd..5334723a9f0 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 e01ac310e9f..c3b13136f80 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 dd3d5574dbc..b440996b269 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 4736263bf2a..e9108dabd1a 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 c8875ce8f81..29bbb4b3a6f 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 e38e8abfef4..2202158c88a 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 5a413f0ec78..c606ef011bf 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 568a3e77d37..786cdc700a5 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 0a7a2fe6248..6f3b2ad653a 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 22990fa98b7..f022e935525 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 5a8506dcb6b..092b740f564 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 8f89bda2331..4dbe71fa2e1 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 529eec9c45c..24fabeee953 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 5a560f1253b..846b0e832b7 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 8aeccb016dc..db20a6b0b24 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 592f58dcd36..5621c3fd266 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 dd04d676d56..f8d3f4d246c 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 fd8d8e5ea72..56acdbf65ba 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 f3d05e6757f..133670cb199 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 3abaef23c53..bc0accf8c66 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 31ad2cfa888..996d3dbb710 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 16b0d4440a7..ea7c65a1f6b 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 ece944485ce..3a136155dd9 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 3586baa4fa0..6aca011db25 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 07459292538..5232328e1e4 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 883948355ca..c58679834ed 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 be1b3627ad0..f51d3e25c76 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 759ad40e517..41b93e660a0 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 cbf689af63d..0c1bd7b4740 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 e2419e18a99..cf20238782c 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 975a91a37d2..a653dfa5edf 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 aba8ac019d3..49d5e261b56 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 ba785c5d535..a6e6e0ef6d7 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 afa04181681..11a22e021d0 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 c0545a4fb15..e6aa7903913 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 fc2235c1a0e..f3c8f7f2cb1 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 4d2712df4c7..03f210bdb0b 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 f3179cc21f5..1c212daa1dc 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 3ccb168d137..9b99be10e6e 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 74acdfb3081..ae699d1da51 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 3326c2b096b..52c8a94778c 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 cb8ffa3fa96..cd624ec6ae6 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 3681c5eed9a..0b228dcb5b1 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 662c561e501..67d092be2cf 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 83951c5d0f7..687306e33e6 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 6ba8bc5c7b8..6ede98c85d2 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 371e2ecaa70..693bb78b87c 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 f5c6515c9bf..fc2aa22d7f3 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 c6107522be0..5ebcca590a2 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 d7020c190ba..7b6ad495ace 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 c19d468d62c..ccc0ab07af5 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 19defd88318..f02a06fc35d 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 42c5270c7f7..7de65bc7c3e 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 f3d348da833..d2b7ca5e33f 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 0c8b998e7e1..8428278e215 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 646c778e87c..a3f5e3e1a93 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 608dede4925..8ba22d81422 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 bcea71b1b23..41680cdad13 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 685324d7d2c..3f7ee59c946 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 d0a6a1bd186..0f7951c8590 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 a2ff1b5769d..2114abbe7c3 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 9c46ef66956..123c2f344de 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 89ca90feb34..4038b7f04e0 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 7100e68bd20..fe3532930aa 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 110985ed1dc..1200049007e 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 19fc34f771c..baac277a84d 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 46321116352..0564bebf76c 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 b7bf5dbe69a..e93561dffa8 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 09460118445..9212920549d 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 aecd290d729..52b3c79794a 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 c51354cfa14..e161b4e077a 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 8ff43a91c76..07bbcc9b231 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 f0d15febcc8..bee73153d0e 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 ebb74339b27..40e6b3ba395 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 897741ab821..0c1dd6834a3 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 665517775e8..33dd002146c 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 dffe81d8735..9d24c005c12 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 0ba84ab78a0..fe48f371c31 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 1a21360a966..f05fa42ff3f 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 d20ec49d561..bf95a38354d 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 edfa5d1ce89..126b824b1a8 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 5fe85001995..d737400a20d 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 b234b41956a..fcd24868af4 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 e4507bf7fd3..b2823701a41 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 14a8c68276a..f70a2352177 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 c525674fb88..1b5d11ef323 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 e4563f192bf..13112d9c1a3 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 62309670fab..b990e7fbe22 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 a43793cd427..08935d9c15f 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 0ae0edd0e17..9d9f746e1db 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 3458440b6ff..e966be038a6 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 0086f25fc1f..fb1ba5a8c83 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 6d333e24eeb..5d66a63a8bf 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 6f10578c884..1ae776b4464 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 9a5f7fd3c7b..a9874e4220d 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 25904868102..2b77213001f 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 21b8bbda3d5..ca93edb70e3 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 57625623c26..04b01a81298 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 6e8f6520118..1fa520be0f2 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 c3fe8e3c563..288037e2a0f 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 2593eb174bf..ef4382da1a1 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 aa0b4bc8456..d678e0b599c 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 0f63e491a79..9486e1cb96e 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 d913d53f3c3..014d8704788 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 52ca13b70cb..30eff67dca2 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 5be2dfd0bf6..e2882e3b634 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 e58ab60ee04..8dff68dbd0e 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 f9b08f38a15..483a87db7dd 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 2af2b79c05d..fa4c4765978 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 53e1668c99f..2f48b967193 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 56c08585e6d..96d308f7bfd 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 e76a9c6e44f..8d036930e73 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 693591e3750..1f216e1c680 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 b37fc2de7fb..f62264cbba7 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 00644edd264..c875f3a5b7d 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 ab25aeee731..dc994b748ad 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 3621636cb28..f34a157902f 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 a5ea4888f34..6a9f29c5c80 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 2ab67d1fc95..8b313e92786 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 1fd8761bbcc..cec61fa7d65 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 a0dcb258b02..d8a32d53f63 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 92e281e7c2f..51b2171f9fa 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 44a5f1e1f4f..05787ae1448 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 f7309057b91..612c428cf56 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 de055a3585f..2de343de290 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 e7761e3b286..ed9f02b375c 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 189a1c11d38..f0fda0290e9 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 99da97aa0cd..53d1f45bb96 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 9c24692629b..244beef18dd 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 ad1a77fcfca..c23bc87d0f8 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 920675dc999..82655f26dd6 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 86e69c73ba2..c98d12b627d 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 5cbbd4d8f7b..c2a8593b39f 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 923f2c105d6..160a386801e 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 fd33062ae4e..bd089b7a435 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 ee70b81d882..e93130aee61 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 b6629356264..ce39cd8f9e2 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 6f1119036d7..6ba37213cb8 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 39490124eab..0b2b2410b27 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 0c59552bb86..7fc36319cba 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 48c0b6b3747..6c8a990f57b 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 f4cc55aa3b4..e280054f945 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 f664d76b54e..7fbe2810a29 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 bd3e6ea328c..90c54b45c3e 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 ee6a9d1fc80..e361916eb28 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 f197f4a1429..6e0bcae9912 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 69c41443655..474c38a0497 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 6f6ca84674a..8d61dfe8639 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 eecf0f5dc18..1098366b5f4 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 1dfc97dceae..380b0da2714 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 0b5a0433cd0..c8e61e2918d 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 3425ed11b16..aba88104747 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 3a235ae5a7c..9926235b52e 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 5ec560ec0f4..ab64f4f0c86 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 a5935e84de3..abeba965c49 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 15cc7acaf33..dfff335e54e 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 a90b2c83df8..a6426bee27f 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 d51dbaa6c07..6f01a60b346 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 aa768365b47..571146e19d2 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 40ece9ee3fa..5b6467cda70 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 21d4c9d4dd9..7082c80bfab 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 f44e33bacb2..12cdfcdd1f5 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 0bf8a16447b..3ff7ca1befa 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 80df5aff501..d9c623b56e7 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 148b6b1707d..2191a941469 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 74db2eba7e2..3a834a9f1ee 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 f3445582272..e87244197f8 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 4c4351d2d99..a5866703ae3 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 11304d2146a..a5f855ce2a3 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 80efc0265d9..86d7b89b1f0 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 2297af4157a..2c85410b1bf 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 88dc9f273ae..60255eeab02 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 cd05c9b6035..4030144dd36 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 645528e84e8..08a10f05b41 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 2c076c0db5b..ce54495490d 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 af7400be82a..ac15e94f008 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 7015d8cfe72..8cf74861a8a 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 a9b7d40890b..352483c4d74 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 8addee8cc30..2d82a176db7 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 f6cac8eb90b..2d03333b1b6 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 44e56c759fb..88430299c92 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 d2345924452..f2e033aa741 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 c25488f54d5..e9dce0d173a 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 3e35293514e..28c6ddb6919 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 c5dc6b25da8..09e050ffb2d 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 ae1e4b9e04f..ea56689552a 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 753c1108a96..c1f1e7f70bf 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 a9f052a0c56..a678b8f7456 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 213d6c87be1..f9a432a7a2c 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 f2ca5cf8015..a61855e9edf 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 e3614e6e2ae..6d17f52ac78 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 31aa4d41e8d..70f96355b37 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 59734565d77..677de0a6f91 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 3871fc00d07..100afc8103b 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 105ce94c71a..c0930a624b7 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 364dc52fb74..f21bf3b1ae0 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 c8a76dfb045..f5d82b56810 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 ee1a423ffbc..8ec8e462e62 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 39d684be4a1..348f3886d10 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 95ce2ca1171..ae79be0730d 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 40f2654d8e4..bdf53a3de9f 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 d8cc485ce6a..31b3e48e0e9 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 16d3dba7494..5dda522a4eb 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 25947822f1e..23c6facff27 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 9927c063c32..e85f42b3a34 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 09a106aa4e9..e3b3579c4aa 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 23670627770..87c4320d5f4 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 26747144425..3e12f57ce0b 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 c450a4e08a3..98d209072d1 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 31f6cfe421c..1fcbc350154 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 0f5f1fa4068..30f9b8c9394 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 9ad8c770d51..5b963ce45bc 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 ccb3ce6701a..d7907a228fe 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 c462394dbdc..0cc1aadce4a 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 18530a4fd15..e63f2306f03 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 a31d73766dd..4d4d9193586 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 84600b12014..bac506ed79d 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 c142ccdf3d5..5a02f0c8feb 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 00a8e7249b5..016082814f6 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 7e486a68ffc..e4e4c392858 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 9fa653ad28b..5557fd29ce6 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 17949d2d0a6..8cbfe2bf49c 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 363c687bafd..9034a8385a8 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 d49f29bcd5b..d9b3a38f18c 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 7d9a54011dd..a09bf884e83 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 529adfbc4e6..f88702df4dc 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 69f88c9e087..719f53d08e0 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 f8b69406d4b..83b114ffe74 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 66ff8eeccde..2dc16736a3e 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 99ad505f24e..1469771619e 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 d94aaf9fdbd..4d1317c3646 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 a2fab7ad0a2..0e6c7be785a 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 4447d449913..83dde4806e0 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 cc358bd4f7c..e900c997bd7 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 dbfeac77eec..c59fee10a89 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 958c394a1a0..6857a87dc5f 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 75b6006b454..ebf2b98fcd4 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 664b9cad79d..e3750b0b171 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 e47b969864b..153fbb2889a 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 4cca4180126..02b78df8437 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 6f1114699e5..ed93faffcb1 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 890a607c4b1..e7fcfcd4d1f 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 d0e586f66f6..f64701aab3c 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 7f870f2f735..9fb5e658f92 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 cf1ce77e6e1..0804fc963cf 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 c5726ecb91b..ae042b9a204 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 abb88c0fee5..1fb3c16a141 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 21ffdbf575a..3838601f54d 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 75263c5375e..ed48a145f2c 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 fad22be8c91..35271b20c89 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 f0e25093ca4..48a5055b05e 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 76315100e22..76d99a2b865 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 97a4c748518..b619200f00f 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 555a76bb1e3..9eebab5cfd9 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 4c866b37c50..8f075b9f45f 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 00000000000..4b79d4ada08 --- /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 00000000000..44f9598c28a --- /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 c80f4253e4f..41ee6a60c96 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 24ec3ebea17..4990fba6ebb 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 23306863d52..c9346c2edc8 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 2fa0104f1be..652cd5cb17a 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 8c8e02169e8..f947e6983c0 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 13eb4899d49..47874fec29e 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 f35a9248394..1957a3b91d5 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 0e02b779656..22e90a57179 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 425d9d053dd..b44e7df1131 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 77c555e7692..c5066529b7d 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 8b191401829..9596bf144c3 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 6e9c52189dd..88317b19ac0 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 0c8c11d743f..4af58941d82 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 4353dffb6b1..1502d67362a 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 e7ea12c163a..6b0166a1e06 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 2a6626b4431..13dec517f62 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 4a6f4271d5b..b2b279358e1 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 49f342eb211..496abf38e72 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 c1e6506659c..5250fc8b264 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 09c0a30b2ba..6e1e57f9fda 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 4bbd030aad7..f40779b13a2 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 8d1d90e3e39..a33ab5c95d4 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 b9c56f763b3..e4efaf1e593 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 6900848df1e..67eec0e0bb6 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 682a0703060..06436818461 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 ef20c3c982b..1cc02052f54 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 233df57b4da..692018243c8 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 916ea0b9555..04d5fdb2a86 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 a37696d83fa..8fc9d211db5 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 c4d8811343a..d86584b847d 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 bda099c63f4..6e5be90fe53 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 899b30db684..2ddcf33b5f0 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 ab5e3aa9d13..f678aa48265 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 0c794b310a3..eb590885bc5 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 b35d33ffedf..35d2123ddde 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 3ef8fe13732..79e8222e3b3 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 8e92ade4718..b98f0ed40ee 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 9eb593402ea..72f14b93438 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 05059ce3cbd..0d34dcfc5d1 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 3a19900e21c..c7867fef8ac 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 45eecfeee6c..98bf7369787 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 20ca2731b49..00759f3e832 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 897e6f19f78..9209942430a 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 734bc12c7bb..62acccedf37 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 30086600fb1..6d7661db89d 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> @@ -287,6 +288,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); return -ENOSYS; diff --git a/drivers/video/da8xx-fb.c b/drivers/video/da8xx-fb.c index 285633b14d6..5fb68865ef4 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 83d7c7b2c04..5dd75e7ec82 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 74a66e83d22..ad5ef93e01f 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 1629f558d0f..a57abd23f73 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 71151a87aac..87a75a9ca2a 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 cdc3ef58ab1..ecacea1dbeb 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 dc6254514ad..3ff5b28ae2f 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 c097682d00a..585af3d5714 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 89d9cfdbb33..650ed072393 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 ad20bf2441f..742579aba71 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 91555e26eda..853dbc52d61 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 3d25ce924c2..51eb41540bc 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 65891ce45c2..f4444b9c348 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 a5b7ba69a8b..74ebe770a95 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 4330725a251..8703df0ec08 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 b56c3f336c9..e91d4dfa7fb 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 dd84489add0..7e722326b3d 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 913651c565c..1196e6c6717 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 58564e8cfe3..60075a6cf32 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 4d40dca0c8e..83566bc6d66 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 12895a8f5d8..ded03b109c9 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 59ff692b0b4..be7e9bff01b 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 172bb14d6c8..8dc3df61aad 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 12057c8a5be..3d658e61d7c 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 436faa46eec..23f281cd6eb 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 a67b3541224..60ece133abe 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 202e5ab1d31..d9be2601bba 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 da76aea8d17..4673f4ab550 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 0eeb3501c20..45c48a927a5 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 2addb1ebc5e..61f6a960083 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 76ca460ed7f..19ee4b17ea5 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 9279ba32b85..08715c6a666 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 91cd8a6e6a2..5da8e56505f 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 d344d54aee8..fe2f6be5a74 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 6a608b6371f..775f06a6e1c 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 f1e781e4e6e..ca3ccbe76cb 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 929c8e60d37..5580764da7c 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 */ |