diff options
author | Simon Glass <sjg@chromium.org> | 2016-07-04 17:58:28 (GMT) |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2016-07-15 02:40:24 (GMT) |
commit | 08fd82cf3e55c0ab7b1038d82a7c744d3193c269 (patch) | |
tree | c1d1642adb8949ea0e91ff002faad6c14afc532a | |
parent | bfeb443e3d583a5e7bbd98a67175f3a082a5e3d2 (diff) | |
download | u-boot-08fd82cf3e55c0ab7b1038d82a7c744d3193c269.tar.xz |
rockchip: clk: Move all DT decoding to ofdata_to_platdata()
It is more correct to avoid touching the device tree in the probe() method.
Update the driver to work this way. Also add an error check on grf since if
that fails then we should not use it.
Signed-off-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | drivers/clk/clk_rk3288.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/clk/clk_rk3288.c b/drivers/clk/clk_rk3288.c index 2285453..1c2bf64 100644 --- a/drivers/clk/clk_rk3288.c +++ b/drivers/clk/clk_rk3288.c @@ -783,12 +783,22 @@ static struct clk_ops rk3288_clk_ops = { .set_rate = rk3288_clk_set_rate, }; -static int rk3288_clk_probe(struct udevice *dev) +static int rk3288_clk_ofdata_to_platdata(struct udevice *dev) { struct rk3288_clk_priv *priv = dev_get_priv(dev); priv->cru = (struct rk3288_cru *)dev_get_addr(dev); + + return 0; +} + +static int rk3288_clk_probe(struct udevice *dev) +{ + struct rk3288_clk_priv *priv = dev_get_priv(dev); + priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF); + if (IS_ERR(priv->grf)) + return PTR_ERR(priv->grf); #ifdef CONFIG_SPL_BUILD rkclk_init(priv->cru, priv->grf); #endif @@ -820,5 +830,6 @@ U_BOOT_DRIVER(clk_rk3288) = { .priv_auto_alloc_size = sizeof(struct rk3288_clk_priv), .ops = &rk3288_clk_ops, .bind = rk3288_clk_bind, + .ofdata_to_platdata = rk3288_clk_ofdata_to_platdata, .probe = rk3288_clk_probe, }; |