timer: Remove DM_FLAG_PRE_RELOC flag in various drivers
authorBin Meng <bmeng.cn@gmail.com>
Wed, 24 Oct 2018 13:36:35 +0000 (06:36 -0700)
committerSimon Glass <sjg@chromium.org>
Wed, 14 Nov 2018 17:16:28 +0000 (09:16 -0800)
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.

To mitigate this potential impact, the following changes are
implemented:

- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
  only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
  is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
  drivers that support both statically declared devices and
  configuration from device tree

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
14 files changed:
drivers/timer/ag101p_timer.c
drivers/timer/altera_timer.c
drivers/timer/arc_timer.c
drivers/timer/ast_timer.c
drivers/timer/atcpit100_timer.c
drivers/timer/atmel_pit_timer.c
drivers/timer/cadence-ttc.c
drivers/timer/dw-apb-timer.c
drivers/timer/mpc83xx_timer.c
drivers/timer/omap-timer.c
drivers/timer/rockchip_timer.c
drivers/timer/sti-timer.c
drivers/timer/stm32_timer.c
drivers/timer/tsc_timer.c

index 6e1ae68b32ecb969a0b5036a077b3d84f76a1e44..6e20b4fc337bacbd58d46ce665c19490ff1f0cef 100644 (file)
@@ -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,
 };
index bc76819674be7a2a1a6c7d08d13a21333c904260..6f504f7cc4d28d6c2429364f85d8047ca315f2e0 100644 (file)
@@ -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,
 };
index cf9671ebbe55726366f83477448f0d97323d609e..8c574ec5af1d8a46e02b50978b2f43f1f54b4b8b 100644 (file)
@@ -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),
 };
index 9973506f6b13d4daa297709867b2bd01cfe4cb91..21ffdbf575a18f08b708ff77f36b5d7bad1a58a8 100644 (file)
@@ -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,
 };
index f650c1bf663510475ae15e07b807f9a80edd6c81..c5d43b4a4ae5e683d89cc9e14dc64fec9e1be98c 100644 (file)
@@ -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,
 };
index 603563d3defe4063da5cdb694b0a84a77b43a919..009af2f9298c7c2172c17e68e11c4bf5fc58968e 100644 (file)
@@ -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,
 };
index 4125a078b385d8d5c2b3f0ee55c4e79ae6804149..75263c5375e065dabd218c38620aec6910dd1b51 100644 (file)
@@ -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,
 };
index 031f429acb884f3fbcc17bb4ba1d3e514ce3ff51..085bfb02c531ede8c9f6c8e364a3ae4bf80c1b65 100644 (file)
@@ -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),
index 84a9ab072a95641699cbf2145840b7fe177c3ae6..8e541109d4eaf69f4624fd93085eed4e1f1d0a70 100644 (file)
@@ -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),
 };
index f10df69092a4500f1951705df5960e9dbfd65f2b..a13fb7116569a0f2addf0a588288cd379eea8ffe 100644 (file)
@@ -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,
 };
index 17bf6a44c38f83dfcbf93acd948b214be63d2348..69019740b0d1154c21e8c9cfa2b25b2b3f15cfea 100644 (file)
@@ -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),
index f7f0e72fe16deae56062172b54001df8b6ecadd3..9def7e02f4bd88b61a2b064221825828a82c9501 100644 (file)
@@ -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,
 };
index 9a856b1b5afb498a9665f27fdbf1ff781ed155cf..76315100e22f2e3b2e77a57e1c4e2b63e2e21fdc 100644 (file)
@@ -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,
 };
 
index da7c812908bd02ce0a47d9646a1f5d476a513a35..ba940ebf1cf6391bba892209761ac680139b9215 100644 (file)
@@ -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,
 };