At present a few of the clk and pinctrl drivers use libfdt routines (via
dev_read_..()) when of-platdata is enabled. This is not permitted.

Correct this by returning errors instead. The drivers may need to be
modified to add full support.

Signed-off-by: Simon Glass <s...@chromium.org>
---

Changes in v4:
- Add new patch for rockchip build errors

Changes in v3: None

 drivers/clk/rockchip/clk_rk3328.c                | 14 ++++++++++++--
 drivers/pinctrl/rockchip/pinctrl-rockchip-core.c |  6 ++++--
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/rockchip/clk_rk3328.c 
b/drivers/clk/rockchip/clk_rk3328.c
index a89e2ecc4a..e86c17e6d6 100644
--- a/drivers/clk/rockchip/clk_rk3328.c
+++ b/drivers/clk/rockchip/clk_rk3328.c
@@ -669,6 +669,10 @@ static int rk3328_gmac2io_set_parent(struct clk *clk, 
struct clk *parent)
                return 0;
        }
 
+       /* FIXME: Device tree should be read in ofdata_to_platdata() */
+       if (CONFIG_IS_ENABLED(OF_PLATDATA))
+               return -EDEADLK;
+
        /*
         * Otherwise, we need to check the clock-output-names of the
         * requested parent to see if the requested id is "gmac_clkin".
@@ -706,6 +710,10 @@ static int rk3328_gmac2io_ext_set_parent(struct clk *clk, 
struct clk *parent)
                return 0;
        }
 
+       /* FIXME: Device tree should be read in ofdata_to_platdata() */
+       if (CONFIG_IS_ENABLED(OF_PLATDATA))
+               return -EDEADLK;
+
        /*
         * Otherwise, we need to check the clock-output-names of the
         * requested parent to see if the requested id is "gmac_clkin".
@@ -762,9 +770,11 @@ static int rk3328_clk_probe(struct udevice *dev)
 
 static int rk3328_clk_ofdata_to_platdata(struct udevice *dev)
 {
-       struct rk3328_clk_priv *priv = dev_get_priv(dev);
+       if (!CONFIG_IS_ENABLED(OF_PLATDATA)) {
+               struct rk3328_clk_priv *priv = dev_get_priv(dev);
 
-       priv->cru = dev_read_addr_ptr(dev);
+               priv->cru = dev_read_addr_ptr(dev);
+       }
 
        return 0;
 }
diff --git a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c 
b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
index 80dc431d20..dccc54e95f 100644
--- a/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
+++ b/drivers/pinctrl/rockchip/pinctrl-rockchip-core.c
@@ -383,8 +383,8 @@ static int rockchip_pinconf_prop_name_to_param(const char 
*property,
        return -EPERM;
 }
 
-static int rockchip_pinctrl_set_state(struct udevice *dev,
-                                     struct udevice *config)
+static int __maybe_unused rockchip_pinctrl_set_state(struct udevice *dev,
+                                                    struct udevice *config)
 {
        struct rockchip_pinctrl_priv *priv = dev_get_priv(dev);
        struct rockchip_pin_ctrl *ctrl = priv->ctrl;
@@ -474,7 +474,9 @@ static int rockchip_pinctrl_set_state(struct udevice *dev,
 }
 
 const struct pinctrl_ops rockchip_pinctrl_ops = {
+#if !CONFIG_IS_ENABLED(PLATDATA)
        .set_state                      = rockchip_pinctrl_set_state,
+#endif
        .get_gpio_mux                   = rockchip_pinctrl_get_gpio_mux,
 };
 
-- 
2.24.0.rc1.363.gb1bccd3e3d-goog

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

Reply via email to