clk: Remove DM_FLAG_PRE_RELOC flag in various drivers
authorBin Meng <bmeng.cn@gmail.com>
Wed, 24 Oct 2018 13:36:29 +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>
drivers/clk/altera/clk-arria10.c
drivers/clk/clk_pic32.c
drivers/clk/clk_zynq.c
drivers/clk/exynos/clk-exynos7420.c
drivers/clk/owl/clk_s900.c

index 78102c760d2fcba3ac872dd29cea7e5554ad4e49..612a1718dcb5c9667a598ff2332b2b5f479e7585 100644 (file)
@@ -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,
index fdf95a12da512fbf75233a3d1a244b0ed4d9172a..b3ac0d5a92aad1d63f402789711890cb7231f161 100644 (file)
@@ -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),
index d647e0a01e77e67ac63e4115eac65ddd5f882b66..482f0937cb5a94947e919dedcdca68a29638cac2 100644 (file)
@@ -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,
index 763567b17c339fed217129694f0646a4dbf8160c..aa86c7ca4457e498492520779c8e481a0d0adb64 100644 (file)
@@ -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,
 };
index 2b39bb99afe1039485357389055bdf7f9864e629..a7c15d2812e2f8f2bfa08f421de071f2204b2349 100644 (file)
@@ -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,
 };