[U-Boot] [PATCH 00/13] dm: DM_FLAG_PRE_RELOC flag clean up

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
This series should be applied on top of u-boot-dm/master, for v2018.11 release.
Bin Meng (13): arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag clk: Remove DM_FLAG_PRE_RELOC flag in various drivers gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers ram: bmips: Remove DM_FLAG_PRE_RELOC flag timer: Remove DM_FLAG_PRE_RELOC flag in various drivers serial: Remove DM_FLAG_PRE_RELOC flag in various drivers sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers video: simplefb: Remove DM_FLAG_PRE_RELOC flag watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers dm: doc: Update description of pre-relocation support
arch/arm/mach-stm32mp/bsec.c | 1 - arch/x86/cpu/tangier/sysreset.c | 1 - doc/driver-model/README.txt | 16 ++++++++++++---- drivers/clk/altera/clk-arria10.c | 1 - drivers/clk/clk_pic32.c | 1 - drivers/clk/clk_zynq.c | 1 - drivers/clk/exynos/clk-exynos7420.c | 3 --- drivers/clk/owl/clk_s900.c | 1 - drivers/gpio/omap_gpio.c | 2 ++ drivers/gpio/stm32f7_gpio.c | 2 +- drivers/gpio/tegra186_gpio.c | 1 - drivers/gpio/tegra_gpio.c | 1 - drivers/i2c/omap24xx_i2c.c | 2 ++ drivers/mmc/omap_hsmmc.c | 2 ++ drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 ++ drivers/pinctrl/exynos/pinctrl-exynos7420.c | 1 - drivers/pinctrl/nxp/pinctrl-imx5.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx6.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 2 ++ drivers/pinctrl/pinctrl-single.c | 1 - drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c | 2 ++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c | 2 ++ drivers/ram/bmips_ram.c | 1 - drivers/serial/altera_jtag_uart.c | 1 - drivers/serial/altera_uart.c | 1 - drivers/serial/arm_dcc.c | 1 - drivers/serial/atmel_usart.c | 2 ++ drivers/serial/ns16550.c | 2 ++ drivers/serial/serial_ar933x.c | 1 - drivers/serial/serial_arc.c | 1 - drivers/serial/serial_bcm283x_mu.c | 2 ++ drivers/serial/serial_bcm283x_pl011.c | 2 ++ drivers/serial/serial_bcm6345.c | 1 - drivers/serial/serial_efi.c | 1 - drivers/serial/serial_intel_mid.c | 1 - drivers/serial/serial_lpuart.c | 1 - drivers/serial/serial_meson.c | 1 - drivers/serial/serial_mvebu_a3700.c | 1 - drivers/serial/serial_mxc.c | 2 ++ drivers/serial/serial_omap.c | 2 ++ drivers/serial/serial_owl.c | 1 - drivers/serial/serial_pic32.c | 1 - drivers/serial/serial_pl01x.c | 2 ++ drivers/serial/serial_s5p.c | 1 - drivers/serial/serial_sh.c | 2 ++ drivers/serial/serial_sti_asc.c | 1 - drivers/serial/serial_stm32.c | 2 ++ drivers/serial/serial_xuartlite.c | 1 - drivers/serial/serial_zynq.c | 1 - drivers/sysreset/sysreset_x86.c | 1 - drivers/timer/ag101p_timer.c | 1 - drivers/timer/altera_timer.c | 1 - drivers/timer/arc_timer.c | 1 - drivers/timer/ast_timer.c | 1 - drivers/timer/atcpit100_timer.c | 1 - drivers/timer/atmel_pit_timer.c | 1 - drivers/timer/cadence-ttc.c | 1 - drivers/timer/dw-apb-timer.c | 1 - drivers/timer/mpc83xx_timer.c | 1 - drivers/timer/omap-timer.c | 1 - drivers/timer/rockchip_timer.c | 1 - drivers/timer/sti-timer.c | 1 - drivers/timer/stm32_timer.c | 1 - drivers/timer/tsc_timer.c | 1 - drivers/video/simplefb.c | 1 - drivers/watchdog/ast_wdt.c | 1 - lib/efi/efi_app.c | 1 - 68 files changed, 51 insertions(+), 54 deletions(-)

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
arch/arm/mach-stm32mp/bsec.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 0e152ef..d087a31 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -417,7 +417,6 @@ U_BOOT_DRIVER(stm32mp_bsec) = { .ofdata_to_platdata = stm32mp_bsec_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct stm32mp_bsec_platdata), .ops = &stm32mp_bsec_ops, - .flags = DM_FLAG_PRE_RELOC, };
/* bsec IP is not present in device tee, manage IP address by platdata */

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/arm/mach-stm32mp/bsec.c | 1 - 1 file changed, 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Bin Meng Sent: mercredi 24 octobre 2018 15:36
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/arm/mach-stm32mp/bsec.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/mach-stm32mp/bsec.c b/arch/arm/mach-stm32mp/bsec.c index 0e152ef..d087a31 100644 --- a/arch/arm/mach-stm32mp/bsec.c +++ b/arch/arm/mach-stm32mp/bsec.c @@ -417,7 +417,6 @@ U_BOOT_DRIVER(stm32mp_bsec) = { .ofdata_to_platdata = stm32mp_bsec_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct stm32mp_bsec_platdata), .ops = &stm32mp_bsec_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
/* bsec IP is not present in device tee, manage IP address by platdata */
2.7.4
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Reviewed-by: Patrick Delaunay patrick.delaunay@st.com

From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Bin Meng Sent: mercredi 24 octobre 2018 15:36
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/arm/mach-stm32mp/bsec.c | 1 - 1 file changed, 1 deletion(-)
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/clk/altera/clk-arria10.c | 1 - drivers/clk/clk_pic32.c | 1 - drivers/clk/clk_zynq.c | 1 - drivers/clk/exynos/clk-exynos7420.c | 3 --- drivers/clk/owl/clk_s900.c | 1 - 5 files changed, 7 deletions(-)
diff --git a/drivers/clk/altera/clk-arria10.c b/drivers/clk/altera/clk-arria10.c index 78102c7..612a171 100644 --- a/drivers/clk/altera/clk-arria10.c +++ b/drivers/clk/altera/clk-arria10.c @@ -352,7 +352,6 @@ static const struct udevice_id socfpga_a10_clk_match[] = { U_BOOT_DRIVER(socfpga_a10_clk) = { .name = "clk-a10", .id = UCLASS_CLK, - .flags = DM_FLAG_PRE_RELOC, .of_match = socfpga_a10_clk_match, .ops = &socfpga_a10_clk_ops, .bind = socfpga_a10_clk_bind, diff --git a/drivers/clk/clk_pic32.c b/drivers/clk/clk_pic32.c index fdf95a1..b3ac0d5 100644 --- a/drivers/clk/clk_pic32.c +++ b/drivers/clk/clk_pic32.c @@ -418,7 +418,6 @@ U_BOOT_DRIVER(pic32_clk) = { .name = "pic32_clk", .id = UCLASS_CLK, .of_match = pic32_clk_ids, - .flags = DM_FLAG_PRE_RELOC, .ops = &pic32_pic32_clk_ops, .probe = pic32_clk_probe, .priv_auto_alloc_size = sizeof(struct pic32_clk_priv), diff --git a/drivers/clk/clk_zynq.c b/drivers/clk/clk_zynq.c index d647e0a..482f093 100644 --- a/drivers/clk/clk_zynq.c +++ b/drivers/clk/clk_zynq.c @@ -480,7 +480,6 @@ U_BOOT_DRIVER(zynq_clk) = { .name = "zynq_clk", .id = UCLASS_CLK, .of_match = zynq_clk_ids, - .flags = DM_FLAG_PRE_RELOC, .ops = &zynq_clk_ops, .priv_auto_alloc_size = sizeof(struct zynq_clk_priv), .probe = zynq_clk_probe, diff --git a/drivers/clk/exynos/clk-exynos7420.c b/drivers/clk/exynos/clk-exynos7420.c index 763567b..aa86c7c 100644 --- a/drivers/clk/exynos/clk-exynos7420.c +++ b/drivers/clk/exynos/clk-exynos7420.c @@ -201,7 +201,6 @@ U_BOOT_DRIVER(exynos7420_clk_topc) = { .probe = exynos7420_clk_topc_probe, .priv_auto_alloc_size = sizeof(struct exynos7420_clk_topc_priv), .ops = &exynos7420_clk_topc_ops, - .flags = DM_FLAG_PRE_RELOC, };
static const struct udevice_id exynos7420_clk_top0_compat[] = { @@ -216,7 +215,6 @@ U_BOOT_DRIVER(exynos7420_clk_top0) = { .probe = exynos7420_clk_top0_probe, .priv_auto_alloc_size = sizeof(struct exynos7420_clk_top0_priv), .ops = &exynos7420_clk_top0_ops, - .flags = DM_FLAG_PRE_RELOC, };
static const struct udevice_id exynos7420_clk_peric1_compat[] = { @@ -229,5 +227,4 @@ U_BOOT_DRIVER(exynos7420_clk_peric1) = { .id = UCLASS_CLK, .of_match = exynos7420_clk_peric1_compat, .ops = &exynos7420_clk_peric1_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/clk/owl/clk_s900.c b/drivers/clk/owl/clk_s900.c index 2b39bb9..a7c15d2 100644 --- a/drivers/clk/owl/clk_s900.c +++ b/drivers/clk/owl/clk_s900.c @@ -134,5 +134,4 @@ U_BOOT_DRIVER(clk_owl) = { .ops = &owl_clk_ops, .priv_auto_alloc_size = sizeof(struct owl_clk_priv), .probe = owl_clk_probe, - .flags = DM_FLAG_PRE_RELOC, };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/clk/altera/clk-arria10.c | 1 - drivers/clk/clk_pic32.c | 1 - drivers/clk/clk_zynq.c | 1 - drivers/clk/exynos/clk-exynos7420.c | 3 --- drivers/clk/owl/clk_s900.c | 1 - 5 files changed, 7 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/clk/altera/clk-arria10.c | 1 - drivers/clk/clk_pic32.c | 1 - drivers/clk/clk_zynq.c | 1 - drivers/clk/exynos/clk-exynos7420.c | 3 --- drivers/clk/owl/clk_s900.c | 1 - 5 files changed, 7 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/gpio/omap_gpio.c | 2 ++ drivers/gpio/stm32f7_gpio.c | 2 +- drivers/gpio/tegra186_gpio.c | 1 - drivers/gpio/tegra_gpio.c | 1 - 4 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index 555eba2..0031415 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -372,7 +372,9 @@ U_BOOT_DRIVER(gpio_omap) = { .ops = &gpio_omap_ops, .probe = omap_gpio_probe, .priv_auto_alloc_size = sizeof(struct gpio_bank), +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif };
#endif /* CONFIG_DM_GPIO */ diff --git a/drivers/gpio/stm32f7_gpio.c b/drivers/gpio/stm32f7_gpio.c index 4c0786f..b903dc4 100644 --- a/drivers/gpio/stm32f7_gpio.c +++ b/drivers/gpio/stm32f7_gpio.c @@ -123,6 +123,6 @@ U_BOOT_DRIVER(gpio_stm32) = { .of_match = stm32_gpio_ids, .probe = gpio_stm32_probe, .ops = &gpio_stm32_ops, - .flags = DM_FLAG_PRE_RELOC | DM_UC_FLAG_SEQ_ALIAS, + .flags = DM_UC_FLAG_SEQ_ALIAS, .priv_auto_alloc_size = sizeof(struct stm32_gpio_priv), }; diff --git a/drivers/gpio/tegra186_gpio.c b/drivers/gpio/tegra186_gpio.c index 1f0e8d5..6626b54 100644 --- a/drivers/gpio/tegra186_gpio.c +++ b/drivers/gpio/tegra186_gpio.c @@ -281,5 +281,4 @@ U_BOOT_DRIVER(tegra186_gpio) = { .bind = tegra186_gpio_bind, .probe = tegra186_gpio_probe, .ops = &tegra186_gpio_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c index 302efdd..a730f5c 100644 --- a/drivers/gpio/tegra_gpio.c +++ b/drivers/gpio/tegra_gpio.c @@ -378,5 +378,4 @@ U_BOOT_DRIVER(gpio_tegra) = { .probe = gpio_tegra_probe, .priv_auto_alloc_size = sizeof(struct tegra_port_info), .ops = &gpio_tegra_ops, - .flags = DM_FLAG_PRE_RELOC, };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/gpio/omap_gpio.c | 2 ++ drivers/gpio/stm32f7_gpio.c | 2 +- drivers/gpio/tegra186_gpio.c | 1 - drivers/gpio/tegra_gpio.c | 1 - 4 files changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Bin Meng Sent: mercredi 24 octobre 2018 15:37
Subject: [U-Boot] [PATCH 03/13] gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/gpio/omap_gpio.c | 2 ++ drivers/gpio/stm32f7_gpio.c | 2 +- drivers/gpio/tegra186_gpio.c | 1 - drivers/gpio/tegra_gpio.c | 1 - 4 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c index 555eba2..0031415 100644 --- a/drivers/gpio/omap_gpio.c +++ b/drivers/gpio/omap_gpio.c @@ -372,7 +372,9 @@ U_BOOT_DRIVER(gpio_omap) = { .ops = &gpio_omap_ops, .probe = omap_gpio_probe, .priv_auto_alloc_size = sizeof(struct gpio_bank), +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif };
#endif /* CONFIG_DM_GPIO */ diff --git a/drivers/gpio/stm32f7_gpio.c b/drivers/gpio/stm32f7_gpio.c index 4c0786f..b903dc4 100644 --- a/drivers/gpio/stm32f7_gpio.c +++ b/drivers/gpio/stm32f7_gpio.c @@ -123,6 +123,6 @@ U_BOOT_DRIVER(gpio_stm32) = { .of_match = stm32_gpio_ids, .probe = gpio_stm32_probe, .ops = &gpio_stm32_ops,
- .flags = DM_FLAG_PRE_RELOC | DM_UC_FLAG_SEQ_ALIAS,
- .flags = DM_UC_FLAG_SEQ_ALIAS, .priv_auto_alloc_size = sizeof(struct stm32_gpio_priv),
}; diff --git a/drivers/gpio/tegra186_gpio.c b/drivers/gpio/tegra186_gpio.c index 1f0e8d5..6626b54 100644 --- a/drivers/gpio/tegra186_gpio.c +++ b/drivers/gpio/tegra186_gpio.c @@ -281,5 +281,4 @@ U_BOOT_DRIVER(tegra186_gpio) = { .bind = tegra186_gpio_bind, .probe = tegra186_gpio_probe, .ops = &tegra186_gpio_ops,
- .flags = DM_FLAG_PRE_RELOC,
}; diff --git a/drivers/gpio/tegra_gpio.c b/drivers/gpio/tegra_gpio.c index 302efdd..a730f5c 100644 --- a/drivers/gpio/tegra_gpio.c +++ b/drivers/gpio/tegra_gpio.c @@ -378,5 +378,4 @@ U_BOOT_DRIVER(gpio_tegra) = { .probe = gpio_tegra_probe, .priv_auto_alloc_size = sizeof(struct tegra_port_info), .ops = &gpio_tegra_ops,
- .flags = DM_FLAG_PRE_RELOC,
};
2.7.4
Reviewed-by: Patrick Delaunay patrick.delaunay@st.com

From: U-Boot u-boot-bounces@lists.denx.de On Behalf Of Bin Meng Sent: mercredi 24 octobre 2018 15:37
Subject: [U-Boot] [PATCH 03/13] gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/gpio/omap_gpio.c | 2 ++ drivers/gpio/stm32f7_gpio.c | 2 +- drivers/gpio/tegra186_gpio.c | 1 - drivers/gpio/tegra_gpio.c | 1 - 4 files changed, 3 insertions(+), 3 deletions(-)
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/i2c/omap24xx_i2c.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c index 54bf35e..51f9237 100644 --- a/drivers/i2c/omap24xx_i2c.c +++ b/drivers/i2c/omap24xx_i2c.c @@ -925,7 +925,9 @@ U_BOOT_DRIVER(i2c_omap) = { .probe = omap_i2c_probe, .priv_auto_alloc_size = sizeof(struct omap_i2c), .ops = &omap_i2c_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif };
#endif /* CONFIG_DM_I2C */

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/i2c/omap24xx_i2c.c | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/i2c/omap24xx_i2c.c | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/mmc/omap_hsmmc.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/drivers/mmc/omap_hsmmc.c b/drivers/mmc/omap_hsmmc.c index ec853d0..5cb97eb 100644 --- a/drivers/mmc/omap_hsmmc.c +++ b/drivers/mmc/omap_hsmmc.c @@ -1953,6 +1953,8 @@ U_BOOT_DRIVER(omap_hsmmc) = { .ops = &omap_hsmmc_ops, .probe = omap_hsmmc_probe, .priv_auto_alloc_size = sizeof(struct omap_hsmmc_data), +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/mmc/omap_hsmmc.c | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/mmc/omap_hsmmc.c | 2 ++ 1 file changed, 2 insertions(+)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 ++ drivers/pinctrl/exynos/pinctrl-exynos7420.c | 1 - drivers/pinctrl/nxp/pinctrl-imx5.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx6.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 2 ++ drivers/pinctrl/pinctrl-single.c | 1 - drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c | 2 ++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c | 2 ++ 9 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c index 891b4c2..3be080d 100644 --- a/drivers/pinctrl/broadcom/pinctrl-bcm283x.c +++ b/drivers/pinctrl/broadcom/pinctrl-bcm283x.c @@ -148,5 +148,7 @@ U_BOOT_DRIVER(pinctrl_bcm283x) = { .priv_auto_alloc_size = sizeof(struct bcm283x_pinctrl_priv), .ops = &bcm283x_pinctrl_ops, .probe = bcm283x_pinctl_probe, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; diff --git a/drivers/pinctrl/exynos/pinctrl-exynos7420.c b/drivers/pinctrl/exynos/pinctrl-exynos7420.c index cb5975b..ff6d6c4 100644 --- a/drivers/pinctrl/exynos/pinctrl-exynos7420.c +++ b/drivers/pinctrl/exynos/pinctrl-exynos7420.c @@ -113,5 +113,4 @@ U_BOOT_DRIVER(pinctrl_exynos7420) = { .priv_auto_alloc_size = sizeof(struct exynos_pinctrl_priv), .ops = &exynos7420_pinctrl_ops, .probe = exynos_pinctrl_probe, - .flags = DM_FLAG_PRE_RELOC }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx5.c b/drivers/pinctrl/nxp/pinctrl-imx5.c index 5d17380..4e831b6 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx5.c +++ b/drivers/pinctrl/nxp/pinctrl-imx5.c @@ -40,5 +40,7 @@ U_BOOT_DRIVER(imx5_pinctrl) = { .remove = imx_pinctrl_remove, .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx6.c b/drivers/pinctrl/nxp/pinctrl-imx6.c index e63ecbd..d7c95bb 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx6.c +++ b/drivers/pinctrl/nxp/pinctrl-imx6.c @@ -49,5 +49,7 @@ U_BOOT_DRIVER(imx6_pinctrl) = { .remove = imx_pinctrl_remove, .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx7.c b/drivers/pinctrl/nxp/pinctrl-imx7.c index 769d428..8776fd9 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx7.c +++ b/drivers/pinctrl/nxp/pinctrl-imx7.c @@ -37,5 +37,7 @@ U_BOOT_DRIVER(imx7_pinctrl) = { .remove = imx_pinctrl_remove, .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; diff --git a/drivers/pinctrl/nxp/pinctrl-imx7ulp.c b/drivers/pinctrl/nxp/pinctrl-imx7ulp.c index 598bbfa..d778f82 100644 --- a/drivers/pinctrl/nxp/pinctrl-imx7ulp.c +++ b/drivers/pinctrl/nxp/pinctrl-imx7ulp.c @@ -41,5 +41,7 @@ U_BOOT_DRIVER(imx7ulp_pinctrl) = { .remove = imx_pinctrl_remove, .priv_auto_alloc_size = sizeof(struct imx_pinctrl_priv), .ops = &imx_pinctrl_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index d80c6ed..9dec88c 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c @@ -136,7 +136,6 @@ U_BOOT_DRIVER(single_pinctrl) = { .id = UCLASS_PINCTRL, .of_match = single_pinctrl_match, .ops = &single_pinctrl_ops, - .flags = DM_FLAG_PRE_RELOC, .platdata_auto_alloc_size = sizeof(struct single_pdata), .ofdata_to_platdata = single_ofdata_to_platdata, }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c index a1da90b..eb5978a 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c @@ -171,5 +171,7 @@ U_BOOT_DRIVER(uniphier_pro4_pinctrl) = { .probe = uniphier_pro4_pinctrl_probe, .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c index 0ba2052..685d8be 100644 --- a/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c +++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c @@ -153,5 +153,7 @@ U_BOOT_DRIVER(uniphier_pro5_pinctrl) = { .probe = uniphier_pro5_pinctrl_probe, .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), .ops = &uniphier_pinctrl_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 ++ drivers/pinctrl/exynos/pinctrl-exynos7420.c | 1 - drivers/pinctrl/nxp/pinctrl-imx5.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx6.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 2 ++ drivers/pinctrl/pinctrl-single.c | 1 - drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c | 2 ++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c | 2 ++ 9 files changed, 14 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 ++ drivers/pinctrl/exynos/pinctrl-exynos7420.c | 1 - drivers/pinctrl/nxp/pinctrl-imx5.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx6.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 2 ++ drivers/pinctrl/pinctrl-single.c | 1 - drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c | 2 ++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c | 2 ++ 9 files changed, 14 insertions(+), 2 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/ram/bmips_ram.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/ram/bmips_ram.c b/drivers/ram/bmips_ram.c index b5f19c9..3e1dd9e 100644 --- a/drivers/ram/bmips_ram.c +++ b/drivers/ram/bmips_ram.c @@ -173,5 +173,4 @@ U_BOOT_DRIVER(bmips_ram) = { .probe = bmips_ram_probe, .priv_auto_alloc_size = sizeof(struct bmips_ram_priv), .ops = &bmips_ram_ops, - .flags = DM_FLAG_PRE_RELOC, };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/ram/bmips_ram.c | 1 - 1 file changed, 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/ram/bmips_ram.c | 1 - 1 file changed, 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/timer/ag101p_timer.c | 1 - drivers/timer/altera_timer.c | 1 - drivers/timer/arc_timer.c | 1 - drivers/timer/ast_timer.c | 1 - drivers/timer/atcpit100_timer.c | 1 - drivers/timer/atmel_pit_timer.c | 1 - drivers/timer/cadence-ttc.c | 1 - drivers/timer/dw-apb-timer.c | 1 - drivers/timer/mpc83xx_timer.c | 1 - drivers/timer/omap-timer.c | 1 - drivers/timer/rockchip_timer.c | 1 - drivers/timer/sti-timer.c | 1 - drivers/timer/stm32_timer.c | 1 - drivers/timer/tsc_timer.c | 1 - 14 files changed, 14 deletions(-)
diff --git a/drivers/timer/ag101p_timer.c b/drivers/timer/ag101p_timer.c index 6e1ae68..6e20b4f 100644 --- a/drivers/timer/ag101p_timer.c +++ b/drivers/timer/ag101p_timer.c @@ -115,5 +115,4 @@ U_BOOT_DRIVER(altera_timer) = { .platdata_auto_alloc_size = sizeof(struct atftmr_timer_platdata), .probe = atftmr_timer_probe, .ops = &ag101p_timer_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c index bc76819..6f504f7 100644 --- a/drivers/timer/altera_timer.c +++ b/drivers/timer/altera_timer.c @@ -92,5 +92,4 @@ U_BOOT_DRIVER(altera_timer) = { .platdata_auto_alloc_size = sizeof(struct altera_timer_platdata), .probe = altera_timer_probe, .ops = &altera_timer_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/arc_timer.c b/drivers/timer/arc_timer.c index cf9671e..8c574ec 100644 --- a/drivers/timer/arc_timer.c +++ b/drivers/timer/arc_timer.c @@ -107,6 +107,5 @@ U_BOOT_DRIVER(arc_timer) = { .of_match = arc_timer_ids, .probe = arc_timer_probe, .ops = &arc_timer_ops, - .flags = DM_FLAG_PRE_RELOC, .priv_auto_alloc_size = sizeof(struct arc_timer_priv), }; diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 9973506..21ffdbf 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c @@ -90,5 +90,4 @@ U_BOOT_DRIVER(ast_timer) = { .priv_auto_alloc_size = sizeof(struct ast_timer_priv), .ofdata_to_platdata = ast_timer_ofdata_to_platdata, .ops = &ast_timer_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/atcpit100_timer.c b/drivers/timer/atcpit100_timer.c index f650c1b..c5d43b4 100644 --- a/drivers/timer/atcpit100_timer.c +++ b/drivers/timer/atcpit100_timer.c @@ -110,5 +110,4 @@ U_BOOT_DRIVER(atcpit100_timer) = { .platdata_auto_alloc_size = sizeof(struct atcpit_timer_platdata), .probe = atcpit_timer_probe, .ops = &atcpit_timer_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c index 603563d..009af2f 100644 --- a/drivers/timer/atmel_pit_timer.c +++ b/drivers/timer/atmel_pit_timer.c @@ -85,5 +85,4 @@ U_BOOT_DRIVER(atmel_pit) = { .platdata_auto_alloc_size = sizeof(struct atmel_pit_platdata), .probe = atmel_pit_probe, .ops = &atmel_pit_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c index 4125a07..75263c5 100644 --- a/drivers/timer/cadence-ttc.c +++ b/drivers/timer/cadence-ttc.c @@ -111,5 +111,4 @@ U_BOOT_DRIVER(cadence_ttc) = { .priv_auto_alloc_size = sizeof(struct cadence_ttc_priv), .probe = cadence_ttc_probe, .ops = &cadence_ttc_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c index 031f429..085bfb0 100644 --- a/drivers/timer/dw-apb-timer.c +++ b/drivers/timer/dw-apb-timer.c @@ -83,7 +83,6 @@ U_BOOT_DRIVER(dw_apb_timer) = { .id = UCLASS_TIMER, .ops = &dw_apb_timer_ops, .probe = dw_apb_timer_probe, - .flags = DM_FLAG_PRE_RELOC, .of_match = dw_apb_timer_ids, .ofdata_to_platdata = dw_apb_timer_ofdata_to_platdata, .priv_auto_alloc_size = sizeof(struct dw_apb_timer_priv), diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c index 84a9ab0..8e54110 100644 --- a/drivers/timer/mpc83xx_timer.c +++ b/drivers/timer/mpc83xx_timer.c @@ -244,6 +244,5 @@ U_BOOT_DRIVER(mpc83xx_timer) = { .of_match = mpc83xx_timer_ids, .probe = mpc83xx_timer_probe, .ops = &mpc83xx_timer_ops, - .flags = DM_FLAG_PRE_RELOC, .priv_auto_alloc_size = sizeof(struct mpc83xx_timer_priv), }; diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c index f10df69..a13fb71 100644 --- a/drivers/timer/omap-timer.c +++ b/drivers/timer/omap-timer.c @@ -104,5 +104,4 @@ U_BOOT_DRIVER(omap_timer) = { .priv_auto_alloc_size = sizeof(struct omap_timer_priv), .probe = omap_timer_probe, .ops = &omap_timer_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 17bf6a4..6901974 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c @@ -163,7 +163,6 @@ U_BOOT_DRIVER(rockchip_rk3368_timer) = { .of_match = rockchip_timer_ids, .probe = rockchip_timer_probe, .ops = &rockchip_timer_ops, - .flags = DM_FLAG_PRE_RELOC, .priv_auto_alloc_size = sizeof(struct rockchip_timer_priv), #if CONFIG_IS_ENABLED(OF_PLATDATA) .platdata_auto_alloc_size = sizeof(struct rockchip_timer_plat), diff --git a/drivers/timer/sti-timer.c b/drivers/timer/sti-timer.c index f7f0e72..9def7e0 100644 --- a/drivers/timer/sti-timer.c +++ b/drivers/timer/sti-timer.c @@ -74,5 +74,4 @@ U_BOOT_DRIVER(sti_timer) = { .priv_auto_alloc_size = sizeof(struct sti_timer_priv), .probe = sti_timer_probe, .ops = &sti_timer_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/timer/stm32_timer.c b/drivers/timer/stm32_timer.c index 9a856b1..7631510 100644 --- a/drivers/timer/stm32_timer.c +++ b/drivers/timer/stm32_timer.c @@ -132,6 +132,5 @@ U_BOOT_DRIVER(stm32_timer) = { .priv_auto_alloc_size = sizeof(struct stm32_timer_priv), .probe = stm32_timer_probe, .ops = &stm32_timer_ops, - .flags = DM_FLAG_PRE_RELOC, };
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index da7c812..ba940eb 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c @@ -424,5 +424,4 @@ U_BOOT_DRIVER(tsc_timer) = { .of_match = tsc_timer_ids, .probe = tsc_timer_probe, .ops = &tsc_timer_ops, - .flags = DM_FLAG_PRE_RELOC, };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/timer/ag101p_timer.c | 1 - drivers/timer/altera_timer.c | 1 - drivers/timer/arc_timer.c | 1 - drivers/timer/ast_timer.c | 1 - drivers/timer/atcpit100_timer.c | 1 - drivers/timer/atmel_pit_timer.c | 1 - drivers/timer/cadence-ttc.c | 1 - drivers/timer/dw-apb-timer.c | 1 - drivers/timer/mpc83xx_timer.c | 1 - drivers/timer/omap-timer.c | 1 - drivers/timer/rockchip_timer.c | 1 - drivers/timer/sti-timer.c | 1 - drivers/timer/stm32_timer.c | 1 - drivers/timer/tsc_timer.c | 1 - 14 files changed, 14 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/timer/ag101p_timer.c | 1 - drivers/timer/altera_timer.c | 1 - drivers/timer/arc_timer.c | 1 - drivers/timer/ast_timer.c | 1 - drivers/timer/atcpit100_timer.c | 1 - drivers/timer/atmel_pit_timer.c | 1 - drivers/timer/cadence-ttc.c | 1 - drivers/timer/dw-apb-timer.c | 1 - drivers/timer/mpc83xx_timer.c | 1 - drivers/timer/omap-timer.c | 1 - drivers/timer/rockchip_timer.c | 1 - drivers/timer/sti-timer.c | 1 - drivers/timer/stm32_timer.c | 1 - drivers/timer/tsc_timer.c | 1 - 14 files changed, 14 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/serial/altera_jtag_uart.c | 1 - drivers/serial/altera_uart.c | 1 - drivers/serial/arm_dcc.c | 1 - drivers/serial/atmel_usart.c | 2 ++ drivers/serial/ns16550.c | 2 ++ drivers/serial/serial_ar933x.c | 1 - drivers/serial/serial_arc.c | 1 - drivers/serial/serial_bcm283x_mu.c | 2 ++ drivers/serial/serial_bcm283x_pl011.c | 2 ++ drivers/serial/serial_bcm6345.c | 1 - drivers/serial/serial_efi.c | 1 - drivers/serial/serial_intel_mid.c | 1 - drivers/serial/serial_lpuart.c | 1 - drivers/serial/serial_meson.c | 1 - drivers/serial/serial_mvebu_a3700.c | 1 - drivers/serial/serial_mxc.c | 2 ++ drivers/serial/serial_omap.c | 2 ++ drivers/serial/serial_owl.c | 1 - drivers/serial/serial_pic32.c | 1 - drivers/serial/serial_pl01x.c | 2 ++ drivers/serial/serial_s5p.c | 1 - drivers/serial/serial_sh.c | 2 ++ drivers/serial/serial_sti_asc.c | 1 - drivers/serial/serial_stm32.c | 2 ++ drivers/serial/serial_xuartlite.c | 1 - drivers/serial/serial_zynq.c | 1 - 26 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c index 61052a9..86c3de4 100644 --- a/drivers/serial/altera_jtag_uart.c +++ b/drivers/serial/altera_jtag_uart.c @@ -121,7 +121,6 @@ U_BOOT_DRIVER(altera_jtaguart) = { .platdata_auto_alloc_size = sizeof(struct altera_jtaguart_platdata), .probe = altera_jtaguart_probe, .ops = &altera_jtaguart_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_ALTERA_JTAGUART diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c index b7b0a13..67d4719 100644 --- a/drivers/serial/altera_uart.c +++ b/drivers/serial/altera_uart.c @@ -117,7 +117,6 @@ U_BOOT_DRIVER(altera_uart) = { .platdata_auto_alloc_size = sizeof(struct altera_uart_platdata), .probe = altera_uart_probe, .ops = &altera_uart_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_ALTERA_UART diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c index 43e8691..dfcb6fd 100644 --- a/drivers/serial/arm_dcc.c +++ b/drivers/serial/arm_dcc.c @@ -155,7 +155,6 @@ U_BOOT_DRIVER(serial_dcc) = { .id = UCLASS_SERIAL, .of_match = arm_dcc_ids, .ops = &arm_dcc_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_ARM_DCC diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index 9414f5f..aa8cdff 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -294,7 +294,9 @@ U_BOOT_DRIVER(serial_atmel) = { #endif .probe = atmel_serial_probe, .ops = &atmel_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct atmel_serial_priv), }; #endif diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index f9041aa..3c8bc2b 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -473,7 +473,9 @@ U_BOOT_DRIVER(ns16550_serial) = { .priv_auto_alloc_size = sizeof(struct NS16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif #endif /* SERIAL_PRESENT */ diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c index e91a5f7..5249c55 100644 --- a/drivers/serial/serial_ar933x.c +++ b/drivers/serial/serial_ar933x.c @@ -189,7 +189,6 @@ U_BOOT_DRIVER(serial_ar933x) = { .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv), .probe = ar933x_serial_probe, .ops = &ar933x_serial_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_AR933X diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c index 925f0c2..980b38d 100644 --- a/drivers/serial/serial_arc.c +++ b/drivers/serial/serial_arc.c @@ -128,7 +128,6 @@ U_BOOT_DRIVER(serial_arc) = { .ofdata_to_platdata = arc_serial_ofdata_to_platdata, .probe = arc_serial_probe, .ops = &arc_serial_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_ARC_SERIAL diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c index 1f87f0c..bd1d89e 100644 --- a/drivers/serial/serial_bcm283x_mu.c +++ b/drivers/serial/serial_bcm283x_mu.c @@ -199,6 +199,8 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = { .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata), .probe = bcm283x_mu_serial_probe, .ops = &bcm283x_mu_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv), }; diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c index 54fc9b5..2527bb8 100644 --- a/drivers/serial/serial_bcm283x_pl011.c +++ b/drivers/serial/serial_bcm283x_pl011.c @@ -90,6 +90,8 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = { .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), .probe = pl01x_serial_probe, .ops = &bcm283x_pl011_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct pl01x_priv), }; diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c index ee5d561..a0e709a 100644 --- a/drivers/serial/serial_bcm6345.c +++ b/drivers/serial/serial_bcm6345.c @@ -264,7 +264,6 @@ U_BOOT_DRIVER(bcm6345_serial) = { .probe = bcm6345_serial_probe, .priv_auto_alloc_size = sizeof(struct bcm6345_serial_priv), .ops = &bcm6345_serial_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_BCM6345 diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c index 1b54d18..dd3e511 100644 --- a/drivers/serial/serial_efi.c +++ b/drivers/serial/serial_efi.c @@ -152,5 +152,4 @@ U_BOOT_DRIVER(serial_efi) = { .priv_auto_alloc_size = sizeof(struct serial_efi_priv), .probe = serial_efi_probe, .ops = &serial_efi_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/serial/serial_intel_mid.c b/drivers/serial/serial_intel_mid.c index bdb5adb..39bd40e 100644 --- a/drivers/serial/serial_intel_mid.c +++ b/drivers/serial/serial_intel_mid.c @@ -64,5 +64,4 @@ U_BOOT_DRIVER(serial_intel_mid) = { .priv_auto_alloc_size = sizeof(struct NS16550), .probe = mid_serial_probe, .ops = &ns16550_serial_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c index 1212b72..816cedd 100644 --- a/drivers/serial/serial_lpuart.c +++ b/drivers/serial/serial_lpuart.c @@ -455,5 +455,4 @@ U_BOOT_DRIVER(serial_lpuart) = { .platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata), .probe = lpuart_serial_probe, .ops = &lpuart_serial_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c index dbb8537..b3dad77 100644 --- a/drivers/serial/serial_meson.c +++ b/drivers/serial/serial_meson.c @@ -132,7 +132,6 @@ U_BOOT_DRIVER(serial_meson) = { .of_match = meson_serial_ids, .probe = meson_serial_probe, .ops = &meson_serial_ops, - .flags = DM_FLAG_PRE_RELOC, .ofdata_to_platdata = meson_serial_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct meson_serial_platdata), }; diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c index ce26d2b..7e4cd6c 100644 --- a/drivers/serial/serial_mvebu_a3700.c +++ b/drivers/serial/serial_mvebu_a3700.c @@ -129,7 +129,6 @@ U_BOOT_DRIVER(serial_mvebu) = { .platdata_auto_alloc_size = sizeof(struct mvebu_platdata), .probe = mvebu_serial_probe, .ops = &mvebu_serial_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_MVEBU_A3700_UART diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index 4f1f822..2cc63da 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -353,7 +353,9 @@ U_BOOT_DRIVER(serial_mxc) = { #endif .probe = mxc_serial_probe, .ops = &mxc_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif
diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c index af3c755..ee6ad9c 100644 --- a/drivers/serial/serial_omap.c +++ b/drivers/serial/serial_omap.c @@ -121,7 +121,9 @@ U_BOOT_DRIVER(omap_serial) = { .priv_auto_alloc_size = sizeof(struct NS16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif #endif /* DM_SERIAL */ diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c index 6fd97e2..7ead73e 100644 --- a/drivers/serial/serial_owl.c +++ b/drivers/serial/serial_owl.c @@ -132,5 +132,4 @@ U_BOOT_DRIVER(serial_owl) = { .priv_auto_alloc_size = sizeof(struct owl_serial_priv), .probe = owl_serial_probe, .ops = &owl_serial_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/serial/serial_pic32.c b/drivers/serial/serial_pic32.c index ba73978..84600b1 100644 --- a/drivers/serial/serial_pic32.c +++ b/drivers/serial/serial_pic32.c @@ -176,7 +176,6 @@ U_BOOT_DRIVER(pic32_serial) = { .of_match = pic32_uart_ids, .probe = pic32_uart_probe, .ops = &pic32_uart_ops, - .flags = DM_FLAG_PRE_RELOC, .priv_auto_alloc_size = sizeof(struct pic32_uart_priv), };
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index 2a5f256..12512f6 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -363,7 +363,9 @@ U_BOOT_DRIVER(serial_pl01x) = { .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), .probe = pl01x_serial_probe, .ops = &pl01x_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct pl01x_priv), };
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index faea6d4..e3160cf 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -211,7 +211,6 @@ U_BOOT_DRIVER(serial_s5p) = { .platdata_auto_alloc_size = sizeof(struct s5p_serial_platdata), .probe = s5p_serial_probe, .ops = &s5p_serial_ops, - .flags = DM_FLAG_PRE_RELOC, }; #endif
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index b153498..c934d5f 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -247,7 +247,9 @@ U_BOOT_DRIVER(serial_sh) = { .platdata_auto_alloc_size = sizeof(struct sh_serial_platdata), .probe = sh_serial_probe, .ops = &sh_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct uart_port), };
diff --git a/drivers/serial/serial_sti_asc.c b/drivers/serial/serial_sti_asc.c index 5dfc617..c972f1e 100644 --- a/drivers/serial/serial_sti_asc.c +++ b/drivers/serial/serial_sti_asc.c @@ -205,6 +205,5 @@ U_BOOT_DRIVER(serial_sti_asc) = { .ops = &sti_asc_serial_ops, .probe = sti_asc_serial_probe, .priv_auto_alloc_size = sizeof(struct sti_asc_serial), - .flags = DM_FLAG_PRE_RELOC, };
diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c index 66e02d5..31b43ee 100644 --- a/drivers/serial/serial_stm32.c +++ b/drivers/serial/serial_stm32.c @@ -230,7 +230,9 @@ U_BOOT_DRIVER(serial_stm32) = { .platdata_auto_alloc_size = sizeof(struct stm32x7_serial_platdata), .ops = &stm32_serial_ops, .probe = stm32_serial_probe, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif };
#ifdef CONFIG_DEBUG_UART_STM32 diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c index cead3c6..1be777b 100644 --- a/drivers/serial/serial_xuartlite.c +++ b/drivers/serial/serial_xuartlite.c @@ -109,7 +109,6 @@ U_BOOT_DRIVER(serial_uartlite) = { .platdata_auto_alloc_size = sizeof(struct uartlite_platdata), .probe = uartlite_serial_probe, .ops = &uartlite_serial_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_UARTLITE diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index f689015..7e486a6 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -210,7 +210,6 @@ U_BOOT_DRIVER(serial_zynq) = { .platdata_auto_alloc_size = sizeof(struct zynq_uart_platdata), .probe = zynq_serial_probe, .ops = &zynq_serial_ops, - .flags = DM_FLAG_PRE_RELOC, };
#ifdef CONFIG_DEBUG_UART_ZYNQ

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/serial/altera_jtag_uart.c | 1 - drivers/serial/altera_uart.c | 1 - drivers/serial/arm_dcc.c | 1 - drivers/serial/atmel_usart.c | 2 ++ drivers/serial/ns16550.c | 2 ++ drivers/serial/serial_ar933x.c | 1 - drivers/serial/serial_arc.c | 1 - drivers/serial/serial_bcm283x_mu.c | 2 ++ drivers/serial/serial_bcm283x_pl011.c | 2 ++ drivers/serial/serial_bcm6345.c | 1 - drivers/serial/serial_efi.c | 1 - drivers/serial/serial_intel_mid.c | 1 - drivers/serial/serial_lpuart.c | 1 - drivers/serial/serial_meson.c | 1 - drivers/serial/serial_mvebu_a3700.c | 1 - drivers/serial/serial_mxc.c | 2 ++ drivers/serial/serial_omap.c | 2 ++ drivers/serial/serial_owl.c | 1 - drivers/serial/serial_pic32.c | 1 - drivers/serial/serial_pl01x.c | 2 ++ drivers/serial/serial_s5p.c | 1 - drivers/serial/serial_sh.c | 2 ++ drivers/serial/serial_sti_asc.c | 1 - drivers/serial/serial_stm32.c | 2 ++ drivers/serial/serial_xuartlite.c | 1 - drivers/serial/serial_zynq.c | 1 - 26 files changed, 18 insertions(+), 17 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/serial/altera_jtag_uart.c | 1 - drivers/serial/altera_uart.c | 1 - drivers/serial/arm_dcc.c | 1 - drivers/serial/atmel_usart.c | 2 ++ drivers/serial/ns16550.c | 2 ++ drivers/serial/serial_ar933x.c | 1 - drivers/serial/serial_arc.c | 1 - drivers/serial/serial_bcm283x_mu.c | 2 ++ drivers/serial/serial_bcm283x_pl011.c | 2 ++ drivers/serial/serial_bcm6345.c | 1 - drivers/serial/serial_efi.c | 1 - drivers/serial/serial_intel_mid.c | 1 - drivers/serial/serial_lpuart.c | 1 - drivers/serial/serial_meson.c | 1 - drivers/serial/serial_mvebu_a3700.c | 1 - drivers/serial/serial_mxc.c | 2 ++ drivers/serial/serial_omap.c | 2 ++ drivers/serial/serial_owl.c | 1 - drivers/serial/serial_pic32.c | 1 - drivers/serial/serial_pl01x.c | 2 ++ drivers/serial/serial_s5p.c | 1 - drivers/serial/serial_sh.c | 2 ++ drivers/serial/serial_sti_asc.c | 1 - drivers/serial/serial_stm32.c | 2 ++ drivers/serial/serial_xuartlite.c | 1 - drivers/serial/serial_zynq.c | 1 - 26 files changed, 18 insertions(+), 17 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

Hi Bin,
This particular commit leads to a constant Poplar board restart (git bisect pointed to it). U-boot is built with the default poplar_config from the latest master (btw, is uses r), and U-boot is used as default BL33 image (setup: vanilla ATF + vanilla OP-TEE(BL32, S-EL1 payload) + U-boot).
When BL32 (OP-TEE) tries to make a switch to non-secure bootloader, it leads to restart (I'll compile ATF with verbose output and send you more details if there are any): ===================================== I/TC: OP-TEE version: 3.3.0-110-g7309438-dev #1 понеділок, 10 грудня 2018 12:53:15 +0000 aarch64 D/TC:0 0 check_ta_store:529 TA store: "early TA" D/TC:0 0 check_ta_store:529 TA store: "Secure Storage TA" D/TC:0 0 check_ta_store:529 TA store: "REE" D/TC:0 0 early_ta_init:225 Early TA 023f8f1a-292a-432b-8fc4-de8471358067 size 21735 (compressed, uncompressed 99680) D/TC:0 0 mobj_mapped_shm_init:709 Shared memory address range: 4000000, 6000000 I/TC: Initialized D/TC:0 0 init_primary_helper:1033 Primary CPU switching to normal world boot
Bootrom start Boot Media: eMMC Entry usb bootstrap USB: Recv CC:4 Usb disk(1): ====================================
btw, for Poplar board serial_pl01x driver is used.
Could you please provide (I just started digging into your patch series) your ideas why it can happen?
Thanks
On Wed, 24 Oct 2018 at 16:38, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/serial/altera_jtag_uart.c | 1 - drivers/serial/altera_uart.c | 1 - drivers/serial/arm_dcc.c | 1 - drivers/serial/atmel_usart.c | 2 ++ drivers/serial/ns16550.c | 2 ++ drivers/serial/serial_ar933x.c | 1 - drivers/serial/serial_arc.c | 1 - drivers/serial/serial_bcm283x_mu.c | 2 ++ drivers/serial/serial_bcm283x_pl011.c | 2 ++ drivers/serial/serial_bcm6345.c | 1 - drivers/serial/serial_efi.c | 1 - drivers/serial/serial_intel_mid.c | 1 - drivers/serial/serial_lpuart.c | 1 - drivers/serial/serial_meson.c | 1 - drivers/serial/serial_mvebu_a3700.c | 1 - drivers/serial/serial_mxc.c | 2 ++ drivers/serial/serial_omap.c | 2 ++ drivers/serial/serial_owl.c | 1 - drivers/serial/serial_pic32.c | 1 - drivers/serial/serial_pl01x.c | 2 ++ drivers/serial/serial_s5p.c | 1 - drivers/serial/serial_sh.c | 2 ++ drivers/serial/serial_sti_asc.c | 1 - drivers/serial/serial_stm32.c | 2 ++ drivers/serial/serial_xuartlite.c | 1 - drivers/serial/serial_zynq.c | 1 - 26 files changed, 18 insertions(+), 17 deletions(-)
diff --git a/drivers/serial/altera_jtag_uart.c b/drivers/serial/altera_jtag_uart.c index 61052a9..86c3de4 100644 --- a/drivers/serial/altera_jtag_uart.c +++ b/drivers/serial/altera_jtag_uart.c @@ -121,7 +121,6 @@ U_BOOT_DRIVER(altera_jtaguart) = { .platdata_auto_alloc_size = sizeof(struct altera_jtaguart_platdata), .probe = altera_jtaguart_probe, .ops = &altera_jtaguart_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_ALTERA_JTAGUART diff --git a/drivers/serial/altera_uart.c b/drivers/serial/altera_uart.c index b7b0a13..67d4719 100644 --- a/drivers/serial/altera_uart.c +++ b/drivers/serial/altera_uart.c @@ -117,7 +117,6 @@ U_BOOT_DRIVER(altera_uart) = { .platdata_auto_alloc_size = sizeof(struct altera_uart_platdata), .probe = altera_uart_probe, .ops = &altera_uart_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_ALTERA_UART diff --git a/drivers/serial/arm_dcc.c b/drivers/serial/arm_dcc.c index 43e8691..dfcb6fd 100644 --- a/drivers/serial/arm_dcc.c +++ b/drivers/serial/arm_dcc.c @@ -155,7 +155,6 @@ U_BOOT_DRIVER(serial_dcc) = { .id = UCLASS_SERIAL, .of_match = arm_dcc_ids, .ops = &arm_dcc_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_ARM_DCC diff --git a/drivers/serial/atmel_usart.c b/drivers/serial/atmel_usart.c index 9414f5f..aa8cdff 100644 --- a/drivers/serial/atmel_usart.c +++ b/drivers/serial/atmel_usart.c @@ -294,7 +294,9 @@ U_BOOT_DRIVER(serial_atmel) = { #endif .probe = atmel_serial_probe, .ops = &atmel_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct atmel_serial_priv), }; #endif diff --git a/drivers/serial/ns16550.c b/drivers/serial/ns16550.c index f9041aa..3c8bc2b 100644 --- a/drivers/serial/ns16550.c +++ b/drivers/serial/ns16550.c @@ -473,7 +473,9 @@ U_BOOT_DRIVER(ns16550_serial) = { .priv_auto_alloc_size = sizeof(struct NS16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif #endif /* SERIAL_PRESENT */ diff --git a/drivers/serial/serial_ar933x.c b/drivers/serial/serial_ar933x.c index e91a5f7..5249c55 100644 --- a/drivers/serial/serial_ar933x.c +++ b/drivers/serial/serial_ar933x.c @@ -189,7 +189,6 @@ U_BOOT_DRIVER(serial_ar933x) = { .priv_auto_alloc_size = sizeof(struct ar933x_serial_priv), .probe = ar933x_serial_probe, .ops = &ar933x_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_AR933X diff --git a/drivers/serial/serial_arc.c b/drivers/serial/serial_arc.c index 925f0c2..980b38d 100644 --- a/drivers/serial/serial_arc.c +++ b/drivers/serial/serial_arc.c @@ -128,7 +128,6 @@ U_BOOT_DRIVER(serial_arc) = { .ofdata_to_platdata = arc_serial_ofdata_to_platdata, .probe = arc_serial_probe, .ops = &arc_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_ARC_SERIAL diff --git a/drivers/serial/serial_bcm283x_mu.c b/drivers/serial/serial_bcm283x_mu.c index 1f87f0c..bd1d89e 100644 --- a/drivers/serial/serial_bcm283x_mu.c +++ b/drivers/serial/serial_bcm283x_mu.c @@ -199,6 +199,8 @@ U_BOOT_DRIVER(serial_bcm283x_mu) = { .platdata_auto_alloc_size = sizeof(struct bcm283x_mu_serial_platdata), .probe = bcm283x_mu_serial_probe, .ops = &bcm283x_mu_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct bcm283x_mu_priv), }; diff --git a/drivers/serial/serial_bcm283x_pl011.c b/drivers/serial/serial_bcm283x_pl011.c index 54fc9b5..2527bb8 100644 --- a/drivers/serial/serial_bcm283x_pl011.c +++ b/drivers/serial/serial_bcm283x_pl011.c @@ -90,6 +90,8 @@ U_BOOT_DRIVER(bcm283x_pl011_uart) = { .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), .probe = pl01x_serial_probe, .ops = &bcm283x_pl011_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct pl01x_priv), }; diff --git a/drivers/serial/serial_bcm6345.c b/drivers/serial/serial_bcm6345.c index ee5d561..a0e709a 100644 --- a/drivers/serial/serial_bcm6345.c +++ b/drivers/serial/serial_bcm6345.c @@ -264,7 +264,6 @@ U_BOOT_DRIVER(bcm6345_serial) = { .probe = bcm6345_serial_probe, .priv_auto_alloc_size = sizeof(struct bcm6345_serial_priv), .ops = &bcm6345_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_BCM6345 diff --git a/drivers/serial/serial_efi.c b/drivers/serial/serial_efi.c index 1b54d18..dd3e511 100644 --- a/drivers/serial/serial_efi.c +++ b/drivers/serial/serial_efi.c @@ -152,5 +152,4 @@ U_BOOT_DRIVER(serial_efi) = { .priv_auto_alloc_size = sizeof(struct serial_efi_priv), .probe = serial_efi_probe, .ops = &serial_efi_ops,
.flags = DM_FLAG_PRE_RELOC,
}; diff --git a/drivers/serial/serial_intel_mid.c b/drivers/serial/serial_intel_mid.c index bdb5adb..39bd40e 100644 --- a/drivers/serial/serial_intel_mid.c +++ b/drivers/serial/serial_intel_mid.c @@ -64,5 +64,4 @@ U_BOOT_DRIVER(serial_intel_mid) = { .priv_auto_alloc_size = sizeof(struct NS16550), .probe = mid_serial_probe, .ops = &ns16550_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
}; diff --git a/drivers/serial/serial_lpuart.c b/drivers/serial/serial_lpuart.c index 1212b72..816cedd 100644 --- a/drivers/serial/serial_lpuart.c +++ b/drivers/serial/serial_lpuart.c @@ -455,5 +455,4 @@ U_BOOT_DRIVER(serial_lpuart) = { .platdata_auto_alloc_size = sizeof(struct lpuart_serial_platdata), .probe = lpuart_serial_probe, .ops = &lpuart_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
}; diff --git a/drivers/serial/serial_meson.c b/drivers/serial/serial_meson.c index dbb8537..b3dad77 100644 --- a/drivers/serial/serial_meson.c +++ b/drivers/serial/serial_meson.c @@ -132,7 +132,6 @@ U_BOOT_DRIVER(serial_meson) = { .of_match = meson_serial_ids, .probe = meson_serial_probe, .ops = &meson_serial_ops,
.flags = DM_FLAG_PRE_RELOC, .ofdata_to_platdata = meson_serial_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct meson_serial_platdata),
}; diff --git a/drivers/serial/serial_mvebu_a3700.c b/drivers/serial/serial_mvebu_a3700.c index ce26d2b..7e4cd6c 100644 --- a/drivers/serial/serial_mvebu_a3700.c +++ b/drivers/serial/serial_mvebu_a3700.c @@ -129,7 +129,6 @@ U_BOOT_DRIVER(serial_mvebu) = { .platdata_auto_alloc_size = sizeof(struct mvebu_platdata), .probe = mvebu_serial_probe, .ops = &mvebu_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_MVEBU_A3700_UART diff --git a/drivers/serial/serial_mxc.c b/drivers/serial/serial_mxc.c index 4f1f822..2cc63da 100644 --- a/drivers/serial/serial_mxc.c +++ b/drivers/serial/serial_mxc.c @@ -353,7 +353,9 @@ U_BOOT_DRIVER(serial_mxc) = { #endif .probe = mxc_serial_probe, .ops = &mxc_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif
diff --git a/drivers/serial/serial_omap.c b/drivers/serial/serial_omap.c index af3c755..ee6ad9c 100644 --- a/drivers/serial/serial_omap.c +++ b/drivers/serial/serial_omap.c @@ -121,7 +121,9 @@ U_BOOT_DRIVER(omap_serial) = { .priv_auto_alloc_size = sizeof(struct NS16550), .probe = ns16550_serial_probe, .ops = &ns16550_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif }; #endif #endif /* DM_SERIAL */ diff --git a/drivers/serial/serial_owl.c b/drivers/serial/serial_owl.c index 6fd97e2..7ead73e 100644 --- a/drivers/serial/serial_owl.c +++ b/drivers/serial/serial_owl.c @@ -132,5 +132,4 @@ U_BOOT_DRIVER(serial_owl) = { .priv_auto_alloc_size = sizeof(struct owl_serial_priv), .probe = owl_serial_probe, .ops = &owl_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
}; diff --git a/drivers/serial/serial_pic32.c b/drivers/serial/serial_pic32.c index ba73978..84600b1 100644 --- a/drivers/serial/serial_pic32.c +++ b/drivers/serial/serial_pic32.c @@ -176,7 +176,6 @@ U_BOOT_DRIVER(pic32_serial) = { .of_match = pic32_uart_ids, .probe = pic32_uart_probe, .ops = &pic32_uart_ops,
.flags = DM_FLAG_PRE_RELOC, .priv_auto_alloc_size = sizeof(struct pic32_uart_priv),
};
diff --git a/drivers/serial/serial_pl01x.c b/drivers/serial/serial_pl01x.c index 2a5f256..12512f6 100644 --- a/drivers/serial/serial_pl01x.c +++ b/drivers/serial/serial_pl01x.c @@ -363,7 +363,9 @@ U_BOOT_DRIVER(serial_pl01x) = { .platdata_auto_alloc_size = sizeof(struct pl01x_serial_platdata), .probe = pl01x_serial_probe, .ops = &pl01x_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct pl01x_priv), };
diff --git a/drivers/serial/serial_s5p.c b/drivers/serial/serial_s5p.c index faea6d4..e3160cf 100644 --- a/drivers/serial/serial_s5p.c +++ b/drivers/serial/serial_s5p.c @@ -211,7 +211,6 @@ U_BOOT_DRIVER(serial_s5p) = { .platdata_auto_alloc_size = sizeof(struct s5p_serial_platdata), .probe = s5p_serial_probe, .ops = &s5p_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
}; #endif
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c index b153498..c934d5f 100644 --- a/drivers/serial/serial_sh.c +++ b/drivers/serial/serial_sh.c @@ -247,7 +247,9 @@ U_BOOT_DRIVER(serial_sh) = { .platdata_auto_alloc_size = sizeof(struct sh_serial_platdata), .probe = sh_serial_probe, .ops = &sh_serial_ops, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif .priv_auto_alloc_size = sizeof(struct uart_port), };
diff --git a/drivers/serial/serial_sti_asc.c b/drivers/serial/serial_sti_asc.c index 5dfc617..c972f1e 100644 --- a/drivers/serial/serial_sti_asc.c +++ b/drivers/serial/serial_sti_asc.c @@ -205,6 +205,5 @@ U_BOOT_DRIVER(serial_sti_asc) = { .ops = &sti_asc_serial_ops, .probe = sti_asc_serial_probe, .priv_auto_alloc_size = sizeof(struct sti_asc_serial),
.flags = DM_FLAG_PRE_RELOC,
};
diff --git a/drivers/serial/serial_stm32.c b/drivers/serial/serial_stm32.c index 66e02d5..31b43ee 100644 --- a/drivers/serial/serial_stm32.c +++ b/drivers/serial/serial_stm32.c @@ -230,7 +230,9 @@ U_BOOT_DRIVER(serial_stm32) = { .platdata_auto_alloc_size = sizeof(struct stm32x7_serial_platdata), .ops = &stm32_serial_ops, .probe = stm32_serial_probe, +#if !CONFIG_IS_ENABLED(OF_CONTROL) .flags = DM_FLAG_PRE_RELOC, +#endif };
#ifdef CONFIG_DEBUG_UART_STM32 diff --git a/drivers/serial/serial_xuartlite.c b/drivers/serial/serial_xuartlite.c index cead3c6..1be777b 100644 --- a/drivers/serial/serial_xuartlite.c +++ b/drivers/serial/serial_xuartlite.c @@ -109,7 +109,6 @@ U_BOOT_DRIVER(serial_uartlite) = { .platdata_auto_alloc_size = sizeof(struct uartlite_platdata), .probe = uartlite_serial_probe, .ops = &uartlite_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_UARTLITE diff --git a/drivers/serial/serial_zynq.c b/drivers/serial/serial_zynq.c index f689015..7e486a6 100644 --- a/drivers/serial/serial_zynq.c +++ b/drivers/serial/serial_zynq.c @@ -210,7 +210,6 @@ U_BOOT_DRIVER(serial_zynq) = { .platdata_auto_alloc_size = sizeof(struct zynq_uart_platdata), .probe = zynq_serial_probe, .ops = &zynq_serial_ops,
.flags = DM_FLAG_PRE_RELOC,
};
#ifdef CONFIG_DEBUG_UART_ZYNQ
2.7.4
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

Hi Igor,
On Mon, Dec 10, 2018 at 07:26:23PM +0200, Igor Opaniuk wrote:
Hi Bin,
This particular commit leads to a constant Poplar board restart (git bisect pointed to it). U-boot is built with the default poplar_config from the latest master (btw, is uses r), and U-boot is used as default BL33 image (setup: vanilla ATF + vanilla OP-TEE(BL32, S-EL1 payload) + U-boot).
Thanks for reporting the issue. I looked into it and came up with a fix for review [1]. Would you give it a try to see if it fixes the problem?
Shawn
[1] https://lists.denx.de/pipermail/u-boot/2018-December/351741.html

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
arch/x86/cpu/tangier/sysreset.c | 1 - drivers/sysreset/sysreset_x86.c | 1 - lib/efi/efi_app.c | 1 - 3 files changed, 3 deletions(-)
diff --git a/arch/x86/cpu/tangier/sysreset.c b/arch/x86/cpu/tangier/sysreset.c index e762ee1..b03bc28 100644 --- a/arch/x86/cpu/tangier/sysreset.c +++ b/arch/x86/cpu/tangier/sysreset.c @@ -44,5 +44,4 @@ U_BOOT_DRIVER(tangier_sysreset) = { .id = UCLASS_SYSRESET, .of_match = tangier_sysreset_ids, .ops = &tangier_sysreset_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/drivers/sysreset/sysreset_x86.c b/drivers/sysreset/sysreset_x86.c index 5943a63..20b958c 100644 --- a/drivers/sysreset/sysreset_x86.c +++ b/drivers/sysreset/sysreset_x86.c @@ -45,5 +45,4 @@ U_BOOT_DRIVER(x86_sysreset) = { .id = UCLASS_SYSRESET, .of_match = x86_sysreset_ids, .ops = &x86_sysreset_ops, - .flags = DM_FLAG_PRE_RELOC, }; diff --git a/lib/efi/efi_app.c b/lib/efi/efi_app.c index 5879d40..0047998 100644 --- a/lib/efi/efi_app.c +++ b/lib/efi/efi_app.c @@ -161,5 +161,4 @@ U_BOOT_DRIVER(efi_sysreset) = { .id = UCLASS_SYSRESET, .of_match = efi_sysreset_ids, .ops = &efi_sysreset_ops, - .flags = DM_FLAG_PRE_RELOC, };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/x86/cpu/tangier/sysreset.c | 1 - drivers/sysreset/sysreset_x86.c | 1 - lib/efi/efi_app.c | 1 - 3 files changed, 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
arch/x86/cpu/tangier/sysreset.c | 1 - drivers/sysreset/sysreset_x86.c | 1 - lib/efi/efi_app.c | 1 - 3 files changed, 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/video/simplefb.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c index 3b8da80..1679d20 100644 --- a/drivers/video/simplefb.c +++ b/drivers/video/simplefb.c @@ -68,5 +68,4 @@ U_BOOT_DRIVER(simple_video) = { .id = UCLASS_VIDEO, .of_match = simple_video_ids, .probe = simple_video_probe, - .flags = DM_FLAG_PRE_RELOC, };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/simplefb.c | 1 - 1 file changed, 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/video/simplefb.c | 1 - 1 file changed, 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL) - Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE() - Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com ---
drivers/watchdog/ast_wdt.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/drivers/watchdog/ast_wdt.c b/drivers/watchdog/ast_wdt.c index 59afa21..523484b 100644 --- a/drivers/watchdog/ast_wdt.c +++ b/drivers/watchdog/ast_wdt.c @@ -119,5 +119,4 @@ U_BOOT_DRIVER(ast_wdt) = { .priv_auto_alloc_size = sizeof(struct ast_wdt_priv), .ofdata_to_platdata = ast_wdt_ofdata_to_platdata, .ops = &ast_wdt_ops, - .flags = DM_FLAG_PRE_RELOC, };

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/watchdog/ast_wdt.c | 1 - 1 file changed, 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
Signed-off-by: Bin Meng bmeng.cn@gmail.com
drivers/watchdog/ast_wdt.c | 1 - 1 file changed, 1 deletion(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

Add some description about pre-relocation driver binding, including usage of DM_FLAG_PRE_RELOC flag and caveats.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
---
doc/driver-model/README.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt index 3654163..07b120d 100644 --- a/doc/driver-model/README.txt +++ b/doc/driver-model/README.txt @@ -830,10 +830,18 @@ Pre-Relocation Support ----------------------
For pre-relocation we simply call the driver model init function. Only -drivers marked with DM_FLAG_PRE_RELOC or the device tree -'u-boot,dm-pre-reloc' flag are initialised prior to relocation. This helps -to reduce the driver model overhead. This flag applies to SPL and TPL as -well, if device tree is enabled there. +drivers marked with DM_FLAG_PRE_RELOC or the device tree 'u-boot,dm-pre-reloc' +property are initialised prior to relocation. This helps to reduce the driver +model overhead. This flag applies to SPL and TPL as well, if device tree is +enabled (CONFIG_OF_CONTROL) there. + +Note when device tree is enabled, the device tree 'u-boot,dm-pre-reloc' +property can provide better control granularity on which device is bound +before relocation. While with DM_FLAG_PRE_RELOC flag of the driver all +devices with the same driver are bound, which requires allocation a large +amount of memory. When device tree is not used, DM_FLAG_PRE_RELOC is the +only way for statically declared devices via U_BOOT_DEVICE() to be bound +prior to relocation.
It is possible to limit this to specific relocation steps, by using the more specialized 'u-boot,dm-spl' and 'u-boot,dm-tpl' flags

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
Add some description about pre-relocation driver binding, including usage of DM_FLAG_PRE_RELOC flag and caveats.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
doc/driver-model/README.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org

On 24 October 2018 at 07:36, Bin Meng bmeng.cn@gmail.com wrote:
Add some description about pre-relocation driver binding, including usage of DM_FLAG_PRE_RELOC flag and caveats.
Signed-off-by: Bin Meng bmeng.cn@gmail.com
doc/driver-model/README.txt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
Applied to u-boot-dm/master, thanks!

On 10/24/18 7:36 AM, Bin Meng wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
This series should be applied on top of u-boot-dm/master, for v2018.11 release.
Tested-by: Stephen Warren swarren@nvidia.com
(I tested this on top of both u-boot/master and u-boot-dm/master just to be sure).

On Wed, Oct 24, 2018 at 8:32 AM Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
This series should be applied on top of u-boot-dm/master, for v2018.11 release.
Bin Meng (13): arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag clk: Remove DM_FLAG_PRE_RELOC flag in various drivers gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers ram: bmips: Remove DM_FLAG_PRE_RELOC flag timer: Remove DM_FLAG_PRE_RELOC flag in various drivers serial: Remove DM_FLAG_PRE_RELOC flag in various drivers sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers video: simplefb: Remove DM_FLAG_PRE_RELOC flag watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers dm: doc: Update description of pre-relocation support
This works just fine for me on the am3517_evm and the omap3_logic boards.
Tested-by Adam Ford aford173@gmailcom
adam
arch/arm/mach-stm32mp/bsec.c | 1 - arch/x86/cpu/tangier/sysreset.c | 1 - doc/driver-model/README.txt | 16 ++++++++++++---- drivers/clk/altera/clk-arria10.c | 1 - drivers/clk/clk_pic32.c | 1 - drivers/clk/clk_zynq.c | 1 - drivers/clk/exynos/clk-exynos7420.c | 3 --- drivers/clk/owl/clk_s900.c | 1 - drivers/gpio/omap_gpio.c | 2 ++ drivers/gpio/stm32f7_gpio.c | 2 +- drivers/gpio/tegra186_gpio.c | 1 - drivers/gpio/tegra_gpio.c | 1 - drivers/i2c/omap24xx_i2c.c | 2 ++ drivers/mmc/omap_hsmmc.c | 2 ++ drivers/pinctrl/broadcom/pinctrl-bcm283x.c | 2 ++ drivers/pinctrl/exynos/pinctrl-exynos7420.c | 1 - drivers/pinctrl/nxp/pinctrl-imx5.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx6.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7.c | 2 ++ drivers/pinctrl/nxp/pinctrl-imx7ulp.c | 2 ++ drivers/pinctrl/pinctrl-single.c | 1 - drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c | 2 ++ drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c | 2 ++ drivers/ram/bmips_ram.c | 1 - drivers/serial/altera_jtag_uart.c | 1 - drivers/serial/altera_uart.c | 1 - drivers/serial/arm_dcc.c | 1 - drivers/serial/atmel_usart.c | 2 ++ drivers/serial/ns16550.c | 2 ++ drivers/serial/serial_ar933x.c | 1 - drivers/serial/serial_arc.c | 1 - drivers/serial/serial_bcm283x_mu.c | 2 ++ drivers/serial/serial_bcm283x_pl011.c | 2 ++ drivers/serial/serial_bcm6345.c | 1 - drivers/serial/serial_efi.c | 1 - drivers/serial/serial_intel_mid.c | 1 - drivers/serial/serial_lpuart.c | 1 - drivers/serial/serial_meson.c | 1 - drivers/serial/serial_mvebu_a3700.c | 1 - drivers/serial/serial_mxc.c | 2 ++ drivers/serial/serial_omap.c | 2 ++ drivers/serial/serial_owl.c | 1 - drivers/serial/serial_pic32.c | 1 - drivers/serial/serial_pl01x.c | 2 ++ drivers/serial/serial_s5p.c | 1 - drivers/serial/serial_sh.c | 2 ++ drivers/serial/serial_sti_asc.c | 1 - drivers/serial/serial_stm32.c | 2 ++ drivers/serial/serial_xuartlite.c | 1 - drivers/serial/serial_zynq.c | 1 - drivers/sysreset/sysreset_x86.c | 1 - drivers/timer/ag101p_timer.c | 1 - drivers/timer/altera_timer.c | 1 - drivers/timer/arc_timer.c | 1 - drivers/timer/ast_timer.c | 1 - drivers/timer/atcpit100_timer.c | 1 - drivers/timer/atmel_pit_timer.c | 1 - drivers/timer/cadence-ttc.c | 1 - drivers/timer/dw-apb-timer.c | 1 - drivers/timer/mpc83xx_timer.c | 1 - drivers/timer/omap-timer.c | 1 - drivers/timer/rockchip_timer.c | 1 - drivers/timer/sti-timer.c | 1 - drivers/timer/stm32_timer.c | 1 - drivers/timer/tsc_timer.c | 1 - drivers/video/simplefb.c | 1 - drivers/watchdog/ast_wdt.c | 1 - lib/efi/efi_app.c | 1 - 68 files changed, 51 insertions(+), 54 deletions(-)
-- 2.7.4
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot

On Sun, Oct 28, 2018 at 9:31 PM Adam Ford aford173@gmail.com wrote:
On Wed, Oct 24, 2018 at 8:32 AM Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
This series should be applied on top of u-boot-dm/master, for v2018.11 release.
Bin Meng (13): arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag clk: Remove DM_FLAG_PRE_RELOC flag in various drivers gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers ram: bmips: Remove DM_FLAG_PRE_RELOC flag timer: Remove DM_FLAG_PRE_RELOC flag in various drivers serial: Remove DM_FLAG_PRE_RELOC flag in various drivers sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers video: simplefb: Remove DM_FLAG_PRE_RELOC flag watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers dm: doc: Update description of pre-relocation support
This works just fine for me on the am3517_evm and the omap3_logic boards.
Tested-by Adam Ford aford173@gmailcom
Thanks Adam and Stephen's testing.
Simon,
Looks we don't have too much time before release, would you please test and send the PR?
Another series (http://patchwork.ozlabs.org/project/uboot/list/?series=70686) needs to be pulled in to unblock x86 too.
Regards, Bin

Hi Bin,
On 1 November 2018 at 20:25, Bin Meng bmeng.cn@gmail.com wrote:
On Sun, Oct 28, 2018 at 9:31 PM Adam Ford aford173@gmail.com wrote:
On Wed, Oct 24, 2018 at 8:32 AM Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
This series should be applied on top of u-boot-dm/master, for v2018.11 release.
Bin Meng (13): arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag clk: Remove DM_FLAG_PRE_RELOC flag in various drivers gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers ram: bmips: Remove DM_FLAG_PRE_RELOC flag timer: Remove DM_FLAG_PRE_RELOC flag in various drivers serial: Remove DM_FLAG_PRE_RELOC flag in various drivers sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers video: simplefb: Remove DM_FLAG_PRE_RELOC flag watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers dm: doc: Update description of pre-relocation support
This works just fine for me on the am3517_evm and the omap3_logic boards.
Tested-by Adam Ford aford173@gmailcom
Thanks Adam and Stephen's testing.
Simon,
Looks we don't have too much time before release, would you please test and send the PR?
Another series (http://patchwork.ozlabs.org/project/uboot/list/?series=70686) needs to be pulled in to unblock x86 too.
I had assumed we could wait to the next release.
Could you please explain what you are wanting me to do here?
Regards, Simon

Hi Simon,
On Sat, Nov 3, 2018 at 2:08 PM Simon Glass sjg@chromium.org wrote:
Hi Bin,
On 1 November 2018 at 20:25, Bin Meng bmeng.cn@gmail.com wrote:
On Sun, Oct 28, 2018 at 9:31 PM Adam Ford aford173@gmail.com wrote:
On Wed, Oct 24, 2018 at 8:32 AM Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
This series should be applied on top of u-boot-dm/master, for v2018.11 release.
Bin Meng (13): arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag clk: Remove DM_FLAG_PRE_RELOC flag in various drivers gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers ram: bmips: Remove DM_FLAG_PRE_RELOC flag timer: Remove DM_FLAG_PRE_RELOC flag in various drivers serial: Remove DM_FLAG_PRE_RELOC flag in various drivers sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers video: simplefb: Remove DM_FLAG_PRE_RELOC flag watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers dm: doc: Update description of pre-relocation support
This works just fine for me on the am3517_evm and the omap3_logic boards.
Tested-by Adam Ford aford173@gmailcom
Thanks Adam and Stephen's testing.
Simon,
Looks we don't have too much time before release, would you please test and send the PR?
Another series (http://patchwork.ozlabs.org/project/uboot/list/?series=70686) needs to be pulled in to unblock x86 too.
I had assumed we could wait to the next release.
Could you please explain what you are wanting me to do here?
Short version: As I mentioned in this series' cover letter, "This series should be applied on top of u-boot-dm/master, for v2018.11 release.". The other x86 series should be applied for this release too.
The long story:
In [1] I said: "It looks that I have to send out a fix to correct Tegra in this release now, and leave other clean ups in next release.", was because I think the clean up changes are massive and only Stephen reported the Tegra was broken by previous series [2] which was applied in *u-boot-dm/master* so initially I only wanted to send out the Tegra fixes. However later Stefan reported in [3] that some x86 boards just don't boot with *u-boot/mater*. Then I had a look and suggested adding DM_FLAG_PRE_RELOC flag to x86 CPU drivers, which was the x86 fixes series [4] I mentioned above. However the issue is that without my fix in series [2], the x86 fix just doesn't work. Then I mentioned that in [5] I said "I spent some time to clean up all driver usage about DM_FLAG_PRE_RELOC flag" and it should fix Tegra (reported) as well as other potential (un-reported) broken.
[1] https://lists.denx.de/pipermail/u-boot/2018-October/345085.html [2] http://patchwork.ozlabs.org/project/uboot/list/?series=70150&state=*&... [3] https://lists.denx.de/pipermail/u-boot/2018-October/344266.html [4] http://patchwork.ozlabs.org/project/uboot/list/?series=70686 [5] https://lists.denx.de/pipermail/u-boot/2018-October/345479.html
Note both my previous series [2] and x86 fix series [4] are attempting to fix the side effect brought up by c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active") which was part of the MPC83xx CPU uclass driver support. So the root cause is the MPC83xx changes. But I am not sure if we can revert that patch easily now, as I suspect many later commits are dependent on that one, and we may break some more stuff if we revert that. Up to now, I see some 'Tested-by' tags were provided for this series, I think we are good to go.
Does this make sense?
Regards, Bin

Hi Bin,
On 3 November 2018 at 03:48, Bin Meng bmeng.cn@gmail.com wrote:
Hi Simon,
On Sat, Nov 3, 2018 at 2:08 PM Simon Glass sjg@chromium.org wrote:
Hi Bin,
On 1 November 2018 at 20:25, Bin Meng bmeng.cn@gmail.com wrote:
On Sun, Oct 28, 2018 at 9:31 PM Adam Ford aford173@gmail.com wrote:
On Wed, Oct 24, 2018 at 8:32 AM Bin Meng bmeng.cn@gmail.com wrote:
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be bound before relocation. However due to a bug in the DM core, the flag only takes effect when devices are statically declared via U_BOOT_DEVICE(). This bug has been fixed recently by commit "dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in lists_bind_fdt()", but with the fix, it has a side effect that all existing drivers that declared DM_FLAG_PRE_RELOC flag will be bound before relocation now. This may expose potential boot failure on some boards due to insufficient memory during the pre-relocation stage.
To mitigate this potential impact, the following changes are implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for drivers that support both statically declared devices and configuration from device tree
This series should be applied on top of u-boot-dm/master, for v2018.11 release.
Bin Meng (13): arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag clk: Remove DM_FLAG_PRE_RELOC flag in various drivers gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers ram: bmips: Remove DM_FLAG_PRE_RELOC flag timer: Remove DM_FLAG_PRE_RELOC flag in various drivers serial: Remove DM_FLAG_PRE_RELOC flag in various drivers sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers video: simplefb: Remove DM_FLAG_PRE_RELOC flag watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers dm: doc: Update description of pre-relocation support
This works just fine for me on the am3517_evm and the omap3_logic boards.
Tested-by Adam Ford aford173@gmailcom
Thanks Adam and Stephen's testing.
Simon,
Looks we don't have too much time before release, would you please test and send the PR?
Another series (http://patchwork.ozlabs.org/project/uboot/list/?series=70686) needs to be pulled in to unblock x86 too.
I had assumed we could wait to the next release.
Could you please explain what you are wanting me to do here?
Short version: As I mentioned in this series' cover letter, "This series should be applied on top of u-boot-dm/master, for v2018.11 release.". The other x86 series should be applied for this release too.
The long story:
In [1] I said: "It looks that I have to send out a fix to correct Tegra in this release now, and leave other clean ups in next release.", was because I think the clean up changes are massive and only Stephen reported the Tegra was broken by previous series [2] which was applied in *u-boot-dm/master* so initially I only wanted to send out the Tegra fixes. However later Stefan reported in [3] that some x86 boards just don't boot with *u-boot/mater*. Then I had a look and suggested adding DM_FLAG_PRE_RELOC flag to x86 CPU drivers, which was the x86 fixes series [4] I mentioned above. However the issue is that without my fix in series [2], the x86 fix just doesn't work. Then I mentioned that in [5] I said "I spent some time to clean up all driver usage about DM_FLAG_PRE_RELOC flag" and it should fix Tegra (reported) as well as other potential (un-reported) broken.
[1] https://lists.denx.de/pipermail/u-boot/2018-October/345085.html [2] http://patchwork.ozlabs.org/project/uboot/list/?series=70150&state=*&... [3] https://lists.denx.de/pipermail/u-boot/2018-October/344266.html [4] http://patchwork.ozlabs.org/project/uboot/list/?series=70686 [5] https://lists.denx.de/pipermail/u-boot/2018-October/345479.html
Note both my previous series [2] and x86 fix series [4] are attempting to fix the side effect brought up by c0434407b595 ("board_f: Use static print_cpuinfo if CONFIG_CPU is active") which was part of the MPC83xx CPU uclass driver support. So the root cause is the MPC83xx changes. But I am not sure if we can revert that patch easily now, as I suspect many later commits are dependent on that one, and we may break some more stuff if we revert that. Up to now, I see some 'Tested-by' tags were provided for this series, I think we are good to go.
Does this make sense?
OK yes I get it. I've pulled these into dm/testing and will do a pull request tomorrow for Tom.
Regards, Simon
participants (8)
-
Adam Ford
-
Bin Meng
-
Igor Opaniuk
-
Patrick DELAUNAY
-
Shawn Guo
-
Simon Glass
-
sjg@google.com
-
Stephen Warren