[PATCH 06/30] clk: rockchip: rk3506: Use rockchip_sysreset_bind() helper

Jonas Karlman <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <[email protected]>
Convert to use the rockchip_sysreset_bind() helper to bind the
rockchip_sysreset driver. Also add and use a state register constant.

Signed-off-by: Jonas Karlman <[email protected]>
---
 arch/arm/include/asm/arch-rockchip/cru_rk3506.h |  1 +
 drivers/clk/rockchip/clk_rk3506.c               | 14 +++-----------
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3506.h b/arch/arm/include/asm/arch-rockchip/cru_rk3506.h
index 2f79e5eaf09d..a32a342083b8 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3506.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3506.h
@@ -46,6 +46,7 @@ struct pll_rate_table {
 #define RK3506_MODE_CON			0x0280
 #define RK3506_CLKSEL_CON(x)		(RK3506_CRU_BASE + 0x0300 + (x) * 0x4)
 #define RK3506_SOFTRST_CON0		0x0a00
+#define RK3506_GLB_RST_ST		0x0c04
 #define RK3506_GLB_SRST_FST		0x0c08
 #define RK3506_GLB_SRST_SND		0x0c0c
 #define RK3506_PLL_CON(x)		(0x10000 + (x) * 0x4)
diff --git a/drivers/clk/rockchip/clk_rk3506.c b/drivers/clk/rockchip/clk_rk3506.c
index 7ccab313e6ec..fea29f5e8981 100644
--- a/drivers/clk/rockchip/clk_rk3506.c
+++ b/drivers/clk/rockchip/clk_rk3506.c
@@ -1105,24 +1105,16 @@ static int rk3506_clk_probe(struct udevice *dev)
 
 static int rk3506_clk_bind(struct udevice *dev)
 {
-	struct udevice *sys_child;
-	struct sysreset_reg *priv;
 	int ret;
 
 	if (IS_ENABLED(CONFIG_XPL_BUILD))
 		rk3506_clk_init_xpl();
 
 	/* 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, RK3506_CRU_BASE, RK3506_GLB_RST_ST,
+				     RK3506_GLB_SRST_FST, RK3506_GLB_SRST_SND);
+	if (ret)
 		log_debug("Warning: No sysreset driver: ret=%d\n", ret);
-	} else {
-		priv = malloc(sizeof(struct sysreset_reg));
-		priv->glb_srst_fst_value = RK3506_GLB_SRST_FST;
-		priv->glb_srst_snd_value = RK3506_GLB_SRST_SND;
-		dev_set_priv(sys_child, priv);
-	}
 
 	if (!CONFIG_IS_ENABLED(RESET_ROCKCHIP))
 		return 0;
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.