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_rk3288.h |  2 ++
 drivers/clk/rockchip/clk_rk3288.c              | 18 +++++-------------
 2 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3288.h 
b/arch/arm/include/asm/arch-rockchip/cru_rk3288.h
index 412b73e55fa1..1dd8c47e1325 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3288.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3288.h
@@ -60,6 +60,8 @@ struct rockchip_cru {
 };
 check_member(rockchip_cru, cru_emmc_con[1], 0x021c);
 
+#define RK3288_CRU_BASE                        0xff760000
+
 /* CRU_CLKSEL11_CON */
 enum {
        HSICPHY_DIV_SHIFT       = 8,
diff --git a/drivers/clk/rockchip/clk_rk3288.c 
b/drivers/clk/rockchip/clk_rk3288.c
index a4ff1c41abb8..fa399f801f05 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -1004,22 +1004,14 @@ static int rk3288_clk_probe(struct udevice *dev)
 static int rk3288_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, RK3288_CRU_BASE,
+                       offsetof(struct rockchip_cru, glb_rst_st),
+                       offsetof(struct rockchip_cru, cru_glb_srst_fst_value),
+                       offsetof(struct rockchip_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 rockchip_cru,
-                                                   cru_glb_srst_fst_value);
-               priv->glb_srst_snd_value = offsetof(struct rockchip_cru,
-                                                   cru_glb_srst_snd_value);
-               dev_set_priv(sys_child, priv);
-       }
 
 #if CONFIG_IS_ENABLED(RESET_ROCKCHIP)
        ret = offsetof(struct rockchip_cru, cru_softrst_con[0]);
-- 
2.54.0

Reply via email to