Convert to use the rockchip_sysreset_bind() helper to bind the
rockchip_sysreset driver. Also add and use a CRU base address constant
based on the clock-controller address used in the SoC device tree.

Signed-off-by: Jonas Karlman <[email protected]>
---
 .../arm/include/asm/arch-rockchip/cru_rk3128.h |  2 ++
 drivers/clk/rockchip/clk_rk3128.c              | 18 +++++-------------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3128.h 
b/arch/arm/include/asm/arch-rockchip/cru_rk3128.h
index cca812d29e40..02347d09117f 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3128.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3128.h
@@ -70,6 +70,8 @@ struct pll_div {
        u32 frac;
 };
 
+#define RK3128_CRU_BASE                        0x20000000
+
 enum {
        /* PLLCON0*/
        PLL_POSTDIV1_SHIFT      = 12,
diff --git a/drivers/clk/rockchip/clk_rk3128.c 
b/drivers/clk/rockchip/clk_rk3128.c
index a07285593b55..7ec7e331f11f 100644
--- a/drivers/clk/rockchip/clk_rk3128.c
+++ b/drivers/clk/rockchip/clk_rk3128.c
@@ -566,22 +566,14 @@ static int rk3128_clk_probe(struct udevice *dev)
 static int rk3128_clk_bind(struct udevice *dev)
 {
        int ret;
-       struct udevice *sys_child;
-       struct sysreset_reg *priv;
 
        /* The reset driver does not have a device node, so bind it here */
-       ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset",
-                                &sys_child);
-       if (ret) {
+       ret = rockchip_sysreset_bind(dev, RK3128_CRU_BASE,
+                       offsetof(struct rk3128_cru, cru_glb_rst_st),
+                       offsetof(struct rk3128_cru, cru_glb_srst_fst_value),
+                       offsetof(struct rk3128_cru, cru_glb_srst_snd_value));
+       if (ret)
                debug("Warning: No sysreset driver: ret=%d\n", ret);
-       } else {
-               priv = malloc(sizeof(struct sysreset_reg));
-               priv->glb_srst_fst_value = offsetof(struct rk3128_cru,
-                                                   cru_glb_srst_fst_value);
-               priv->glb_srst_snd_value = offsetof(struct rk3128_cru,
-                                                   cru_glb_srst_snd_value);
-               dev_set_priv(sys_child, priv);
-       }
 
        return 0;
 }
-- 
2.54.0

Reply via email to