]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: Remove DM_FLAG_PRE_RELOC flag in various drivers
authorBin Meng <bmeng.cn@gmail.com>
Wed, 24 Oct 2018 13:36:33 +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/pinctrl/broadcom/pinctrl-bcm283x.c
drivers/pinctrl/exynos/pinctrl-exynos7420.c
drivers/pinctrl/nxp/pinctrl-imx5.c
drivers/pinctrl/nxp/pinctrl-imx6.c
drivers/pinctrl/nxp/pinctrl-imx7.c
drivers/pinctrl/nxp/pinctrl-imx7ulp.c
drivers/pinctrl/pinctrl-single.c
drivers/pinctrl/uniphier/pinctrl-uniphier-pro4.c
drivers/pinctrl/uniphier/pinctrl-uniphier-pro5.c

index 891b4c25fdaf4c12764c079bd9c04f6655d7953a..3be080d29e37410b808cd84f2cb3ddc006ea3863 100644 (file)
@@ -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
 };
index cb5975b252ee384f47e54d8a5ec81c262bfedc46..ff6d6c4143f571e439237c0371c71ae85b5e0c69 100644 (file)
@@ -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
 };
index 5d1738091980bff17e6586aa93fc1ab535237d18..4e831b6f39e79cbbf79bf7e50acdde323de5b5de 100644 (file)
@@ -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
 };
index e63ecbdee6b6427a974c1aab0ef2269e87de2159..d7c95bb7387b443195c6791e363fb50e65a3f8b9 100644 (file)
@@ -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
 };
index 769d428ddadcfea07e62c542f6f988235010555c..8776fd9650493f6eeb80f076b6b35226879cb99a 100644 (file)
@@ -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
 };
index 598bbfaf3505f8d3182c6d8467e5b758aa4be9f1..d778f82aac7be6a1101a34e318ddc9da38cc233e 100644 (file)
@@ -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
 };
index d80c6eda70e44ca198df25f72ff9716d2beb08a1..9dec88c1aa01e3bf1e844f7bc2e3eda5689ec770 100644 (file)
@@ -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,
 };
index a1da90baa447c7efc52d792688c8bb081b0f35ba..eb5978a1662c0cd1172cd2e88c2061f3f75109f5 100644 (file)
@@ -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
 };
index 0ba2052b293051cf580c9f8bd9666fbcf19093bb..685d8be80c47def1e80a00174e1e14b1af79922b 100644 (file)
@@ -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
 };