Skip to contentSkip to conversation

dm: DM_FLAG_PRE_RELOC flag clean up

PATCH New Bin Meng 8 participants 50 messages Oct 24, 2018 – Dec 12, 2018

Subsystems (25)
lore
Share & tools
lore

Bin Meng

author
#0 lore raw

cover 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(-)
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH 1/13 arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag

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

---

 arch/arm/mach-stm32mp/bsec.c | 1 -
 1 file changed, 1 deletion(-)
arch/arm/mach-stm32mp/bsec.c +0 -1
index 0e152ef..d087a31 100644
@@ -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 */
Signature · 1 line
2.7.4
#2 lore raw

PATCH 1/13 arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 arch/arm/mach-stm32mp/bsec.c | 1 -
 1 file changed, 1 deletion(-)
#3 lore raw

PATCH 1/13 arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag

In reply to Bin Meng
Quoted 45 lines

From: U-Boot <[email protected]> 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

---

 arch/arm/mach-stm32mp/bsec.c | 1 -
 1 file changed, 1 deletion(-)
arch/arm/mach-stm32mp/bsec.c +0 -2
index 0e152ef..d087a31 100644
@@ -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

Quoted 4 lines

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#4 lore raw

PATCH 1/13 arm: stm32mp: Remove DM_FLAG_PRE_RELOC flag

Quoted 24 lines

From: U-Boot <[email protected]> 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

Quoted 6 lines

---

 arch/arm/mach-stm32mp/bsec.c | 1 -
 1 file changed, 1 deletion(-)

Applied to u-boot-dm/master, thanks!

author
#5 lore raw

PATCH 2/13 clk: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

---

 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(-)
drivers/clk/altera/clk-arria10.c +0 -1
index 78102c7..612a171 100644
@@ -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,
drivers/clk/clk_pic32.c +0 -1
index fdf95a1..b3ac0d5 100644
@@ -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),
drivers/clk/clk_zynq.c +0 -1
index d647e0a..482f093 100644
@@ -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,
drivers/clk/exynos/clk-exynos7420.c +0 -3
index 763567b..aa86c7c 100644
@@ -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,
 };
drivers/clk/owl/clk_s900.c +0 -1
index 2b39bb9..a7c15d2 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#6 lore raw

PATCH 2/13 clk: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 23 lines · Bin Meng

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

Quoted 8 lines

---

 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(-)
#7 lore raw

PATCH 2/13 clk: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 23 lines · Bin Meng

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

Quoted 8 lines

---

 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(-)

Applied to u-boot-dm/master, thanks!

author
#8 lore raw

PATCH 3/13 gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

---

 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(-)
drivers/gpio/omap_gpio.c +2 -0
index 555eba2..0031415 100644
@@ -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 */
drivers/gpio/stm32f7_gpio.c +1 -1
index 4c0786f..b903dc4 100644
@@ -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),
 };
drivers/gpio/tegra186_gpio.c +0 -1
index 1f0e8d5..6626b54 100644
@@ -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,
 };
drivers/gpio/tegra_gpio.c +0 -1
index 302efdd..a730f5c 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#9 lore raw

PATCH 3/13 gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 22 lines · Bin Meng

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

Quoted 8 lines

---

 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(-)
#10 lore raw

PATCH 3/13 gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng
Quoted 83 lines

From: U-Boot <[email protected]> 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

---

 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(-)
drivers/gpio/omap_gpio.c index renamed from drivers/gpio/omap_gpio.c +0 -0

555eba2..0031415 100644

drivers/gpio/omap_gpio.c +2 -0
@@ -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 */
drivers/gpio/stm32f7_gpio.c index renamed from drivers/gpio/stm32f7_gpio.c +0 -0

4c0786f..b903dc4 100644

drivers/gpio/stm32f7_gpio.c +1 -1
@@ -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),
 };
drivers/gpio/tegra186_gpio.c index renamed from drivers/gpio/tegra186_gpio.c +0 -0

1f0e8d5..6626b54 100644

drivers/gpio/tegra186_gpio.c +0 -1
@@ -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,
 };
drivers/gpio/tegra_gpio.c index renamed from drivers/gpio/tegra_gpio.c +0 -0

302efdd..a730f5c 100644

drivers/gpio/tegra_gpio.c +0 -2
@@ -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,
 };
--
Quoted 2 lines

2.7.4

#11 lore raw

PATCH 3/13 gpio: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 27 lines

From: U-Boot <[email protected]> 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

Quoted 9 lines

---

 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!

author
#12 lore raw

PATCH 4/13 i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

In reply to Bin Meng

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

---

 drivers/i2c/omap24xx_i2c.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/i2c/omap24xx_i2c.c +2 -0
index 54bf35e..51f9237 100644
@@ -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 */
Signature · 1 line
2.7.4
#13 lore raw

PATCH 4/13 i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

Quoted 22 lines · Bin Meng

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

Quoted 6 lines

---

 drivers/i2c/omap24xx_i2c.c | 2 ++
 1 file changed, 2 insertions(+)
#14 lore raw

PATCH 4/13 i2c: omap24xx: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

Quoted 22 lines · Bin Meng

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

Quoted 6 lines

---

 drivers/i2c/omap24xx_i2c.c | 2 ++
 1 file changed, 2 insertions(+)

Applied to u-boot-dm/master, thanks!

author
#15 lore raw

PATCH 5/13 mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

In reply to Bin Meng

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

---

 drivers/mmc/omap_hsmmc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/mmc/omap_hsmmc.c +2 -0
index ec853d0..5cb97eb 100644
@@ -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
Signature · 1 line
2.7.4
#16 lore raw

PATCH 5/13 mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/mmc/omap_hsmmc.c | 2 ++
 1 file changed, 2 insertions(+)
#17 lore raw

PATCH 5/13 mmc: omap: Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/mmc/omap_hsmmc.c | 2 ++
 1 file changed, 2 insertions(+)

Applied to u-boot-dm/master, thanks!

author
#18 lore raw

PATCH 6/13 pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

---

 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(-)
drivers/pinctrl/broadcom/pinctrl-bcm283x.c +2 -0
index 891b4c2..3be080d 100644
@@ -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
 };
drivers/pinctrl/exynos/pinctrl-exynos7420.c +0 -1
index cb5975b..ff6d6c4 100644
@@ -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
 };
drivers/pinctrl/nxp/pinctrl-imx5.c +2 -0
index 5d17380..4e831b6 100644
@@ -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
 };
drivers/pinctrl/nxp/pinctrl-imx6.c +2 -0
index e63ecbd..d7c95bb 100644
@@ -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
 };
drivers/pinctrl/nxp/pinctrl-imx7.c +2 -0
index 769d428..8776fd9 100644
@@ -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
 };
drivers/pinctrl/nxp/pinctrl-imx7ulp.c +2 -0
index 598bbfa..d778f82 100644
@@ -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
 };
drivers/pinctrl/pinctrl-single.c +0 -1
index d80c6ed..9dec88c 100644
@@ -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,
 };
drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c +2 -0
index a1da90b..eb5978a 100644
@@ -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
 };
drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c +2 -0
index 0ba2052..685d8be 100644
@@ -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
 };
Signature · 1 line
2.7.4
#19 lore raw

PATCH 6/13 pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 25 lines · Bin Meng

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

---

Quoted 10 lines
 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(-)
#20 lore raw

PATCH 6/13 pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 25 lines · Bin Meng

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

---

Quoted 10 lines
 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(-)

Applied to u-boot-dm/master, thanks!

author
#21 lore raw

PATCH 7/13 ram: bmips: Remove DM_FLAG_PRE_RELOC flag

In reply to Bin Meng

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

---

 drivers/ram/bmips_ram.c | 1 -
 1 file changed, 1 deletion(-)
drivers/ram/bmips_ram.c +0 -1
index b5f19c9..3e1dd9e 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#22 lore raw

PATCH 7/13 ram: bmips: Remove DM_FLAG_PRE_RELOC flag

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/ram/bmips_ram.c | 1 -
 1 file changed, 1 deletion(-)
#23 lore raw

PATCH 7/13 ram: bmips: Remove DM_FLAG_PRE_RELOC flag

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/ram/bmips_ram.c | 1 -
 1 file changed, 1 deletion(-)

Applied to u-boot-dm/master, thanks!

author
#24 lore raw

PATCH 8/13 timer: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

---

 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(-)
drivers/timer/ag101p_timer.c +0 -1
index 6e1ae68..6e20b4f 100644
@@ -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,
 };
drivers/timer/altera_timer.c +0 -1
index bc76819..6f504f7 100644
@@ -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,
 };
drivers/timer/arc_timer.c +0 -1
index cf9671e..8c574ec 100644
@@ -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),
 };
drivers/timer/ast_timer.c +0 -1
index 9973506..21ffdbf 100644
@@ -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,
 };
drivers/timer/atcpit100_timer.c +0 -1
index f650c1b..c5d43b4 100644
@@ -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,
 };
drivers/timer/atmel_pit_timer.c +0 -1
index 603563d..009af2f 100644
@@ -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,
 };
drivers/timer/cadence-ttc.c +0 -1
index 4125a07..75263c5 100644
@@ -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,
 };
drivers/timer/dw-apb-timer.c +0 -1
index 031f429..085bfb0 100644
@@ -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),
drivers/timer/mpc83xx_timer.c +0 -1
index 84a9ab0..8e54110 100644
@@ -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),
 };
drivers/timer/omap-timer.c +0 -1
index f10df69..a13fb71 100644
@@ -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,
 };
drivers/timer/rockchip_timer.c +0 -1
index 17bf6a4..6901974 100644
@@ -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),
drivers/timer/sti-timer.c +0 -1
index f7f0e72..9def7e0 100644
@@ -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,
 };
drivers/timer/stm32_timer.c +0 -1
index 9a856b1..7631510 100644
@@ -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,
 };
 
drivers/timer/tsc_timer.c +0 -1
index da7c812..ba940eb 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#25 lore raw

PATCH 8/13 timer: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 25 lines · Bin Meng

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

---

Quoted 16 lines
 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(-)
#26 lore raw

PATCH 8/13 timer: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 25 lines · Bin Meng

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

---

Quoted 16 lines
 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(-)

Applied to u-boot-dm/master, thanks!

author
#27 lore raw

PATCH 9/13 serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

---

 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(-)
drivers/serial/altera_jtag_uart.c +0 -1
index 61052a9..86c3de4 100644
@@ -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
drivers/serial/altera_uart.c +0 -1
index b7b0a13..67d4719 100644
@@ -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
drivers/serial/arm_dcc.c +0 -1
index 43e8691..dfcb6fd 100644
@@ -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
drivers/serial/atmel_usart.c +2 -0
index 9414f5f..aa8cdff 100644
@@ -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
drivers/serial/ns16550.c +2 -0
index f9041aa..3c8bc2b 100644
@@ -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 */
drivers/serial/serial_ar933x.c +0 -1
index e91a5f7..5249c55 100644
@@ -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
drivers/serial/serial_arc.c +0 -1
index 925f0c2..980b38d 100644
@@ -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
drivers/serial/serial_bcm283x_mu.c +2 -0
index 1f87f0c..bd1d89e 100644
@@ -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),
 };
drivers/serial/serial_bcm283x_pl011.c +2 -0
index 54fc9b5..2527bb8 100644
@@ -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),
 };
drivers/serial/serial_bcm6345.c +0 -1
index ee5d561..a0e709a 100644
@@ -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
drivers/serial/serial_efi.c +0 -1
index 1b54d18..dd3e511 100644
@@ -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,
 };
drivers/serial/serial_intel_mid.c +0 -1
index bdb5adb..39bd40e 100644
@@ -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,
 };
drivers/serial/serial_lpuart.c +0 -1
index 1212b72..816cedd 100644
@@ -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,
 };
drivers/serial/serial_meson.c +0 -1
index dbb8537..b3dad77 100644
@@ -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),
 };
drivers/serial/serial_mvebu_a3700.c +0 -1
index ce26d2b..7e4cd6c 100644
@@ -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
drivers/serial/serial_mxc.c +2 -0
index 4f1f822..2cc63da 100644
@@ -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
 
drivers/serial/serial_omap.c +2 -0
index af3c755..ee6ad9c 100644
@@ -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 */
drivers/serial/serial_owl.c +0 -1
index 6fd97e2..7ead73e 100644
@@ -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,
 };
drivers/serial/serial_pic32.c +0 -1
index ba73978..84600b1 100644
@@ -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),
 };
 
drivers/serial/serial_pl01x.c +2 -0
index 2a5f256..12512f6 100644
@@ -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),
 };
 
drivers/serial/serial_s5p.c +0 -1
index faea6d4..e3160cf 100644
@@ -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
 
drivers/serial/serial_sh.c +2 -0
index b153498..c934d5f 100644
@@ -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),
 };
 
drivers/serial/serial_sti_asc.c +0 -1
index 5dfc617..c972f1e 100644
@@ -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,
 };
 
drivers/serial/serial_stm32.c +2 -0
index 66e02d5..31b43ee 100644
@@ -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
drivers/serial/serial_xuartlite.c +0 -1
index cead3c6..1be777b 100644
@@ -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
drivers/serial/serial_zynq.c +0 -1
index f689015..7e486a6 100644
@@ -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
Signature · 1 line
2.7.4
#28 lore raw

PATCH 9/13 serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 44 lines · Bin Meng

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

---

 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 -
Quoted 9 lines
 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(-)
#29 lore raw

PATCH 9/13 serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 44 lines · Bin Meng

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

---

 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 -
Quoted 9 lines
 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(-)

Applied to u-boot-dm/master, thanks!

#30 lore raw

PATCH 9/13 serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

Quoted 380 lines · Bin Meng

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

---

 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(-)
drivers/serial/altera_jtag_uart.c +0 -1
index 61052a9..86c3de4 100644
@@ -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
drivers/serial/altera_uart.c +0 -1
index b7b0a13..67d4719 100644
@@ -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
drivers/serial/arm_dcc.c +0 -1
index 43e8691..dfcb6fd 100644
@@ -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
drivers/serial/atmel_usart.c +2 -0
index 9414f5f..aa8cdff 100644
@@ -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
drivers/serial/ns16550.c +2 -0
index f9041aa..3c8bc2b 100644
@@ -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 */
drivers/serial/serial_ar933x.c +0 -1
index e91a5f7..5249c55 100644
@@ -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
drivers/serial/serial_arc.c +0 -1
index 925f0c2..980b38d 100644
@@ -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
drivers/serial/serial_bcm283x_mu.c +2 -0
index 1f87f0c..bd1d89e 100644
@@ -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),
 };
drivers/serial/serial_bcm283x_pl011.c +2 -0
index 54fc9b5..2527bb8 100644
@@ -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),
 };
drivers/serial/serial_bcm6345.c +0 -1
index ee5d561..a0e709a 100644
@@ -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
drivers/serial/serial_efi.c +0 -1
index 1b54d18..dd3e511 100644
@@ -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,
 };
drivers/serial/serial_intel_mid.c +0 -1
index bdb5adb..39bd40e 100644
@@ -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,
 };
drivers/serial/serial_lpuart.c +0 -1
index 1212b72..816cedd 100644
@@ -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,
 };
drivers/serial/serial_meson.c +0 -1
index dbb8537..b3dad77 100644
@@ -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),
 };
drivers/serial/serial_mvebu_a3700.c +0 -1
index ce26d2b..7e4cd6c 100644
@@ -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
drivers/serial/serial_mxc.c +2 -0
index 4f1f822..2cc63da 100644
@@ -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
 
drivers/serial/serial_omap.c +2 -0
index af3c755..ee6ad9c 100644
@@ -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 */
drivers/serial/serial_owl.c +0 -1
index 6fd97e2..7ead73e 100644
@@ -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,
 };
drivers/serial/serial_pic32.c +0 -1
index ba73978..84600b1 100644
@@ -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),
 };
 
drivers/serial/serial_pl01x.c +2 -0
index 2a5f256..12512f6 100644
@@ -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),
 };
 
drivers/serial/serial_s5p.c +0 -1
index faea6d4..e3160cf 100644
@@ -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
 
drivers/serial/serial_sh.c +2 -0
index b153498..c934d5f 100644
@@ -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),
 };
 
drivers/serial/serial_sti_asc.c +0 -1
index 5dfc617..c972f1e 100644
@@ -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,
 };
 
drivers/serial/serial_stm32.c +2 -0
index 66e02d5..31b43ee 100644
@@ -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
drivers/serial/serial_xuartlite.c +0 -1
index cead3c6..1be777b 100644
@@ -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
drivers/serial/serial_zynq.c +0 -2
index f689015..7e486a6 100644
@@ -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 at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Signature · 2 lines
Regards,
Igor Opaniuk
#31 lore raw

PATCH 9/13 serial: Remove DM_FLAG_PRE_RELOC flag in various drivers

Hi Igor,

Quoted 7 lines · Igor Opaniuk

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

author
#32 lore raw

PATCH 10/13 sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

---

 arch/x86/cpu/tangier/sysreset.c | 1 -
 drivers/sysreset/sysreset_x86.c | 1 -
 lib/efi/efi_app.c               | 1 -
 3 files changed, 3 deletions(-)
arch/x86/cpu/tangier/sysreset.c +0 -1
index e762ee1..b03bc28 100644
@@ -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,
 };
drivers/sysreset/sysreset_x86.c +0 -1
index 5943a63..20b958c 100644
@@ -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,
 };
lib/efi/efi_app.c +0 -1
index 5879d40..0047998 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#33 lore raw

PATCH 10/13 sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 22 lines · Bin Meng

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

Quoted 7 lines

---

 arch/x86/cpu/tangier/sysreset.c | 1 -
 drivers/sysreset/sysreset_x86.c | 1 -
 lib/efi/efi_app.c               | 1 -
 3 files changed, 3 deletions(-)
#34 lore raw

PATCH 10/13 sysreset: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 22 lines · Bin Meng

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

Quoted 7 lines

---

 arch/x86/cpu/tangier/sysreset.c | 1 -
 drivers/sysreset/sysreset_x86.c | 1 -
 lib/efi/efi_app.c               | 1 -
 3 files changed, 3 deletions(-)

Applied to u-boot-dm/master, thanks!

author
#35 lore raw

PATCH 11/13 video: simplefb: Remove DM_FLAG_PRE_RELOC flag

In reply to Bin Meng

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

---

 drivers/video/simplefb.c | 1 -
 1 file changed, 1 deletion(-)
drivers/video/simplefb.c +0 -1
index 3b8da80..1679d20 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#36 lore raw

PATCH 11/13 video: simplefb: Remove DM_FLAG_PRE_RELOC flag

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/video/simplefb.c | 1 -
 1 file changed, 1 deletion(-)
#37 lore raw

PATCH 11/13 video: simplefb: Remove DM_FLAG_PRE_RELOC flag

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/video/simplefb.c | 1 -
 1 file changed, 1 deletion(-)

Applied to u-boot-dm/master, thanks!

author
#38 lore raw

PATCH 12/13 watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers

In reply to Bin Meng

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

---

 drivers/watchdog/ast_wdt.c | 1 -
 1 file changed, 1 deletion(-)
drivers/watchdog/ast_wdt.c +0 -1
index 59afa21..523484b 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#39 lore raw

PATCH 12/13 watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/watchdog/ast_wdt.c | 1 -
 1 file changed, 1 deletion(-)
#40 lore raw

PATCH 12/13 watchdog: Remove DM_FLAG_PRE_RELOC flag in various drivers

Quoted 22 lines · Bin Meng

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

Quoted 5 lines

---

 drivers/watchdog/ast_wdt.c | 1 -
 1 file changed, 1 deletion(-)

Applied to u-boot-dm/master, thanks!

author
#41 lore raw

PATCH 13/13 dm: doc: Update description of pre-relocation support

In reply to Bin Meng

Add some description about pre-relocation driver binding, including usage of DM_FLAG_PRE_RELOC flag and caveats.

---

 doc/driver-model/README.txt | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
doc/driver-model/README.txt +12 -4
index 3654163..07b120d 100644
@@ -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
Signature · 1 line
2.7.4
#42 lore raw

PATCH 13/13 dm: doc: Update description of pre-relocation support

Quoted 9 lines · Bin Meng

Add some description about pre-relocation driver binding, including usage of DM_FLAG_PRE_RELOC flag and caveats.

---

 doc/driver-model/README.txt | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
#43 lore raw

PATCH 13/13 dm: doc: Update description of pre-relocation support

Quoted 9 lines · Bin Meng

Add some description about pre-relocation driver binding, including usage of DM_FLAG_PRE_RELOC flag and caveats.

---

 doc/driver-model/README.txt | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

Applied to u-boot-dm/master, thanks!

#44 lore raw

cover dm: DM_FLAG_PRE_RELOC flag clean up

In reply to Bin Meng
Quoted 22 lines · Bin Meng

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

Quoted 2 lines

This series should be applied on top of u-boot-dm/master, for v2018.11 release.

(I tested this on top of both u-boot/master and u-boot-dm/master just to be sure).

#45 lore raw

cover dm: DM_FLAG_PRE_RELOC flag clean up

In reply to Bin Meng
Quoted 27 lines · Bin Meng

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.

Quoted 15 lines

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

Quoted 77 lines
 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 at lists.denx.de
https://lists.denx.de/listinfo/u-boot

author
#46 lore raw

cover dm: DM_FLAG_PRE_RELOC flag clean up

Quoted 45 lines · Adam Ford
Quoted 27 lines · Bin Meng

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.

Quoted 15 lines

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

Quoted 4 lines

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

#47 lore raw

cover dm: DM_FLAG_PRE_RELOC flag clean up

Hi Bin,

Quoted 53 lines · Bin Meng
Quoted 45 lines · Adam Ford
Quoted 27 lines · Bin Meng

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.

Quoted 15 lines

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

Quoted 4 lines

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.

Quoted 7 lines

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

author
#48 lore raw

cover dm: DM_FLAG_PRE_RELOC flag clean up

Hi Simon,

Quoted 62 lines · Simon Glass

Hi Bin,

Quoted 58 lines · Bin Meng
Quoted 45 lines · Adam Ford
Quoted 27 lines · Bin Meng

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.

Quoted 15 lines

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

Quoted 4 lines

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?

Quoted 6 lines
Quoted 2 lines

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=*&q=&archive=both
[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

#49 lore raw

cover dm: DM_FLAG_PRE_RELOC flag clean up

Hi Bin,

Quoted 109 lines · Bin Meng

Hi Simon,

Quoted 62 lines · Simon Glass

Hi Bin,

Quoted 58 lines · Bin Meng
Quoted 45 lines · Adam Ford
Quoted 27 lines · Bin Meng

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.

Quoted 15 lines

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

Quoted 4 lines

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?

Quoted 6 lines
Quoted 2 lines

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=*&q=&archive=both
[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.

Quoted 1 line

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