diff options
author | Bin Meng | 2018-10-24 08:36:35 -0500 |
---|---|---|
committer | Simon Glass | 2018-11-14 11:16:28 -0600 |
commit | d7a184d4a7d2706f091a3b708060f48a325234ef (patch) | |
tree | 4bdffd2d8fd1cc2faefe48981b5afbe1fdee6066 | |
parent | 05e424818bd6181f4045ef5421e7cde9b3fed7a9 (diff) | |
download | u-boot-d7a184d4a7d2706f091a3b708060f48a325234ef.tar.gz u-boot-d7a184d4a7d2706f091a3b708060f48a325234ef.tar.xz u-boot-d7a184d4a7d2706f091a3b708060f48a325234ef.zip |
timer: Remove DM_FLAG_PRE_RELOC flag in various drivers
When a driver declares DM_FLAG_PRE_RELOC flag, it wishes to be
bound before relocation. However due to a bug in the DM core,
the flag only takes effect when devices are statically declared
via U_BOOT_DEVICE(). This bug has been fixed recently by commit
"dm: core: Respect drivers with the DM_FLAG_PRE_RELOC flag in
lists_bind_fdt()", but with the fix, it has a side effect that
all existing drivers that declared DM_FLAG_PRE_RELOC flag will
be bound before relocation now. This may expose potential boot
failure on some boards due to insufficient memory during the
pre-relocation stage.
To mitigate this potential impact, the following changes are
implemented:
- Remove DM_FLAG_PRE_RELOC flag in the driver, if the driver
only supports configuration from device tree (OF_CONTROL)
- Keep DM_FLAG_PRE_RELOC flag in the driver only if the device
is statically declared via U_BOOT_DEVICE()
- Surround DM_FLAG_PRE_RELOC flag with OF_CONTROL check, for
drivers that support both statically declared devices and
configuration from device tree
Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/timer/ag101p_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/altera_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/arc_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/ast_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/atcpit100_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/atmel_pit_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/cadence-ttc.c | 1 | ||||
-rw-r--r-- | drivers/timer/dw-apb-timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/mpc83xx_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/omap-timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/rockchip_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/sti-timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/stm32_timer.c | 1 | ||||
-rw-r--r-- | drivers/timer/tsc_timer.c | 1 |
14 files changed, 0 insertions, 14 deletions
diff --git a/drivers/timer/ag101p_timer.c b/drivers/timer/ag101p_timer.c index 6e1ae68b32..6e20b4fc33 100644 --- a/drivers/timer/ag101p_timer.c +++ b/drivers/timer/ag101p_timer.c | |||
@@ -115,5 +115,4 @@ U_BOOT_DRIVER(altera_timer) = { | |||
115 | .platdata_auto_alloc_size = sizeof(struct atftmr_timer_platdata), | 115 | .platdata_auto_alloc_size = sizeof(struct atftmr_timer_platdata), |
116 | .probe = atftmr_timer_probe, | 116 | .probe = atftmr_timer_probe, |
117 | .ops = &ag101p_timer_ops, | 117 | .ops = &ag101p_timer_ops, |
118 | .flags = DM_FLAG_PRE_RELOC, | ||
119 | }; | 118 | }; |
diff --git a/drivers/timer/altera_timer.c b/drivers/timer/altera_timer.c index bc76819674..6f504f7cc4 100644 --- a/drivers/timer/altera_timer.c +++ b/drivers/timer/altera_timer.c | |||
@@ -92,5 +92,4 @@ U_BOOT_DRIVER(altera_timer) = { | |||
92 | .platdata_auto_alloc_size = sizeof(struct altera_timer_platdata), | 92 | .platdata_auto_alloc_size = sizeof(struct altera_timer_platdata), |
93 | .probe = altera_timer_probe, | 93 | .probe = altera_timer_probe, |
94 | .ops = &altera_timer_ops, | 94 | .ops = &altera_timer_ops, |
95 | .flags = DM_FLAG_PRE_RELOC, | ||
96 | }; | 95 | }; |
diff --git a/drivers/timer/arc_timer.c b/drivers/timer/arc_timer.c index cf9671ebbe..8c574ec5af 100644 --- a/drivers/timer/arc_timer.c +++ b/drivers/timer/arc_timer.c | |||
@@ -107,6 +107,5 @@ U_BOOT_DRIVER(arc_timer) = { | |||
107 | .of_match = arc_timer_ids, | 107 | .of_match = arc_timer_ids, |
108 | .probe = arc_timer_probe, | 108 | .probe = arc_timer_probe, |
109 | .ops = &arc_timer_ops, | 109 | .ops = &arc_timer_ops, |
110 | .flags = DM_FLAG_PRE_RELOC, | ||
111 | .priv_auto_alloc_size = sizeof(struct arc_timer_priv), | 110 | .priv_auto_alloc_size = sizeof(struct arc_timer_priv), |
112 | }; | 111 | }; |
diff --git a/drivers/timer/ast_timer.c b/drivers/timer/ast_timer.c index 9973506f6b..21ffdbf575 100644 --- a/drivers/timer/ast_timer.c +++ b/drivers/timer/ast_timer.c | |||
@@ -90,5 +90,4 @@ U_BOOT_DRIVER(ast_timer) = { | |||
90 | .priv_auto_alloc_size = sizeof(struct ast_timer_priv), | 90 | .priv_auto_alloc_size = sizeof(struct ast_timer_priv), |
91 | .ofdata_to_platdata = ast_timer_ofdata_to_platdata, | 91 | .ofdata_to_platdata = ast_timer_ofdata_to_platdata, |
92 | .ops = &ast_timer_ops, | 92 | .ops = &ast_timer_ops, |
93 | .flags = DM_FLAG_PRE_RELOC, | ||
94 | }; | 93 | }; |
diff --git a/drivers/timer/atcpit100_timer.c b/drivers/timer/atcpit100_timer.c index f650c1bf66..c5d43b4a4a 100644 --- a/drivers/timer/atcpit100_timer.c +++ b/drivers/timer/atcpit100_timer.c | |||
@@ -110,5 +110,4 @@ U_BOOT_DRIVER(atcpit100_timer) = { | |||
110 | .platdata_auto_alloc_size = sizeof(struct atcpit_timer_platdata), | 110 | .platdata_auto_alloc_size = sizeof(struct atcpit_timer_platdata), |
111 | .probe = atcpit_timer_probe, | 111 | .probe = atcpit_timer_probe, |
112 | .ops = &atcpit_timer_ops, | 112 | .ops = &atcpit_timer_ops, |
113 | .flags = DM_FLAG_PRE_RELOC, | ||
114 | }; | 113 | }; |
diff --git a/drivers/timer/atmel_pit_timer.c b/drivers/timer/atmel_pit_timer.c index 603563d3de..009af2f929 100644 --- a/drivers/timer/atmel_pit_timer.c +++ b/drivers/timer/atmel_pit_timer.c | |||
@@ -85,5 +85,4 @@ U_BOOT_DRIVER(atmel_pit) = { | |||
85 | .platdata_auto_alloc_size = sizeof(struct atmel_pit_platdata), | 85 | .platdata_auto_alloc_size = sizeof(struct atmel_pit_platdata), |
86 | .probe = atmel_pit_probe, | 86 | .probe = atmel_pit_probe, |
87 | .ops = &atmel_pit_ops, | 87 | .ops = &atmel_pit_ops, |
88 | .flags = DM_FLAG_PRE_RELOC, | ||
89 | }; | 88 | }; |
diff --git a/drivers/timer/cadence-ttc.c b/drivers/timer/cadence-ttc.c index 4125a078b3..75263c5375 100644 --- a/drivers/timer/cadence-ttc.c +++ b/drivers/timer/cadence-ttc.c | |||
@@ -111,5 +111,4 @@ U_BOOT_DRIVER(cadence_ttc) = { | |||
111 | .priv_auto_alloc_size = sizeof(struct cadence_ttc_priv), | 111 | .priv_auto_alloc_size = sizeof(struct cadence_ttc_priv), |
112 | .probe = cadence_ttc_probe, | 112 | .probe = cadence_ttc_probe, |
113 | .ops = &cadence_ttc_ops, | 113 | .ops = &cadence_ttc_ops, |
114 | .flags = DM_FLAG_PRE_RELOC, | ||
115 | }; | 114 | }; |
diff --git a/drivers/timer/dw-apb-timer.c b/drivers/timer/dw-apb-timer.c index 031f429acb..085bfb02c5 100644 --- a/drivers/timer/dw-apb-timer.c +++ b/drivers/timer/dw-apb-timer.c | |||
@@ -83,7 +83,6 @@ U_BOOT_DRIVER(dw_apb_timer) = { | |||
83 | .id = UCLASS_TIMER, | 83 | .id = UCLASS_TIMER, |
84 | .ops = &dw_apb_timer_ops, | 84 | .ops = &dw_apb_timer_ops, |
85 | .probe = dw_apb_timer_probe, | 85 | .probe = dw_apb_timer_probe, |
86 | .flags = DM_FLAG_PRE_RELOC, | ||
87 | .of_match = dw_apb_timer_ids, | 86 | .of_match = dw_apb_timer_ids, |
88 | .ofdata_to_platdata = dw_apb_timer_ofdata_to_platdata, | 87 | .ofdata_to_platdata = dw_apb_timer_ofdata_to_platdata, |
89 | .priv_auto_alloc_size = sizeof(struct dw_apb_timer_priv), | 88 | .priv_auto_alloc_size = sizeof(struct dw_apb_timer_priv), |
diff --git a/drivers/timer/mpc83xx_timer.c b/drivers/timer/mpc83xx_timer.c index 84a9ab072a..8e541109d4 100644 --- a/drivers/timer/mpc83xx_timer.c +++ b/drivers/timer/mpc83xx_timer.c | |||
@@ -244,6 +244,5 @@ U_BOOT_DRIVER(mpc83xx_timer) = { | |||
244 | .of_match = mpc83xx_timer_ids, | 244 | .of_match = mpc83xx_timer_ids, |
245 | .probe = mpc83xx_timer_probe, | 245 | .probe = mpc83xx_timer_probe, |
246 | .ops = &mpc83xx_timer_ops, | 246 | .ops = &mpc83xx_timer_ops, |
247 | .flags = DM_FLAG_PRE_RELOC, | ||
248 | .priv_auto_alloc_size = sizeof(struct mpc83xx_timer_priv), | 247 | .priv_auto_alloc_size = sizeof(struct mpc83xx_timer_priv), |
249 | }; | 248 | }; |
diff --git a/drivers/timer/omap-timer.c b/drivers/timer/omap-timer.c index f10df69092..a13fb71165 100644 --- a/drivers/timer/omap-timer.c +++ b/drivers/timer/omap-timer.c | |||
@@ -104,5 +104,4 @@ U_BOOT_DRIVER(omap_timer) = { | |||
104 | .priv_auto_alloc_size = sizeof(struct omap_timer_priv), | 104 | .priv_auto_alloc_size = sizeof(struct omap_timer_priv), |
105 | .probe = omap_timer_probe, | 105 | .probe = omap_timer_probe, |
106 | .ops = &omap_timer_ops, | 106 | .ops = &omap_timer_ops, |
107 | .flags = DM_FLAG_PRE_RELOC, | ||
108 | }; | 107 | }; |
diff --git a/drivers/timer/rockchip_timer.c b/drivers/timer/rockchip_timer.c index 17bf6a44c3..69019740b0 100644 --- a/drivers/timer/rockchip_timer.c +++ b/drivers/timer/rockchip_timer.c | |||
@@ -163,7 +163,6 @@ U_BOOT_DRIVER(rockchip_rk3368_timer) = { | |||
163 | .of_match = rockchip_timer_ids, | 163 | .of_match = rockchip_timer_ids, |
164 | .probe = rockchip_timer_probe, | 164 | .probe = rockchip_timer_probe, |
165 | .ops = &rockchip_timer_ops, | 165 | .ops = &rockchip_timer_ops, |
166 | .flags = DM_FLAG_PRE_RELOC, | ||
167 | .priv_auto_alloc_size = sizeof(struct rockchip_timer_priv), | 166 | .priv_auto_alloc_size = sizeof(struct rockchip_timer_priv), |
168 | #if CONFIG_IS_ENABLED(OF_PLATDATA) | 167 | #if CONFIG_IS_ENABLED(OF_PLATDATA) |
169 | .platdata_auto_alloc_size = sizeof(struct rockchip_timer_plat), | 168 | .platdata_auto_alloc_size = sizeof(struct rockchip_timer_plat), |
diff --git a/drivers/timer/sti-timer.c b/drivers/timer/sti-timer.c index f7f0e72fe1..9def7e02f4 100644 --- a/drivers/timer/sti-timer.c +++ b/drivers/timer/sti-timer.c | |||
@@ -74,5 +74,4 @@ U_BOOT_DRIVER(sti_timer) = { | |||
74 | .priv_auto_alloc_size = sizeof(struct sti_timer_priv), | 74 | .priv_auto_alloc_size = sizeof(struct sti_timer_priv), |
75 | .probe = sti_timer_probe, | 75 | .probe = sti_timer_probe, |
76 | .ops = &sti_timer_ops, | 76 | .ops = &sti_timer_ops, |
77 | .flags = DM_FLAG_PRE_RELOC, | ||
78 | }; | 77 | }; |
diff --git a/drivers/timer/stm32_timer.c b/drivers/timer/stm32_timer.c index 9a856b1b5a..76315100e2 100644 --- a/drivers/timer/stm32_timer.c +++ b/drivers/timer/stm32_timer.c | |||
@@ -132,6 +132,5 @@ U_BOOT_DRIVER(stm32_timer) = { | |||
132 | .priv_auto_alloc_size = sizeof(struct stm32_timer_priv), | 132 | .priv_auto_alloc_size = sizeof(struct stm32_timer_priv), |
133 | .probe = stm32_timer_probe, | 133 | .probe = stm32_timer_probe, |
134 | .ops = &stm32_timer_ops, | 134 | .ops = &stm32_timer_ops, |
135 | .flags = DM_FLAG_PRE_RELOC, | ||
136 | }; | 135 | }; |
137 | 136 | ||
diff --git a/drivers/timer/tsc_timer.c b/drivers/timer/tsc_timer.c index da7c812908..ba940ebf1c 100644 --- a/drivers/timer/tsc_timer.c +++ b/drivers/timer/tsc_timer.c | |||
@@ -424,5 +424,4 @@ U_BOOT_DRIVER(tsc_timer) = { | |||
424 | .of_match = tsc_timer_ids, | 424 | .of_match = tsc_timer_ids, |
425 | .probe = tsc_timer_probe, | 425 | .probe = tsc_timer_probe, |
426 | .ops = &tsc_timer_ops, | 426 | .ops = &tsc_timer_ops, |
427 | .flags = DM_FLAG_PRE_RELOC, | ||
428 | }; | 427 | }; |