[PATCH 03/30] clk: rockchip: rk3576: 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 fix the glb_srst_snd register name.

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

diff --git a/arch/arm/include/asm/arch-rockchip/cru_rk3576.h b/arch/arm/include/asm/arch-rockchip/cru_rk3576.h
index 41e225245843..69033bae7b3f 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rk3576.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rk3576.h
@@ -73,7 +73,7 @@ struct rk3576_cru {
 	unsigned int glb_cnt_th;/* Address Offset: 0x0c00 */
 	unsigned int glb_rst_st;/* Address Offset: 0x0c04 */
 	unsigned int glb_srst_fst;/* Address Offset: 0x0c08 */
-	unsigned int glb_srsr_snd; /* Address Offset: 0x0c0c */
+	unsigned int glb_srst_snd; /* Address Offset: 0x0c0c */
 	unsigned int glb_rst_con;/* Address Offset: 0x0c10 */
 	unsigned int reserved5[43];/* Address Offset: 0x0c14 */
 	unsigned int smoth_divfree_con[3];/* Address Offset: 0x0cc0 */
diff --git a/drivers/clk/rockchip/clk_rk3576.c b/drivers/clk/rockchip/clk_rk3576.c
index 1988f0472dec..83918908a4e0 100644
--- a/drivers/clk/rockchip/clk_rk3576.c
+++ b/drivers/clk/rockchip/clk_rk3576.c
@@ -2523,26 +2523,18 @@ static int rk3576_clk_ofdata_to_platdata(struct udevice *dev)
 static int rk3576_clk_bind(struct udevice *dev)
 {
 	int ret;
-	struct udevice *sys_child;
-	struct sysreset_reg *priv;
 
 	/* Ensure clocks are initialized after bind in SPL build */
 	if (IS_ENABLED(CONFIG_SPL_BUILD))
 		dev_or_flags(dev, DM_FLAG_PROBE_AFTER_BIND);
 
 	/* 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, RK3576_CRU_BASE,
+				     offsetof(struct rk3576_cru, glb_rst_st),
+				     offsetof(struct rk3576_cru, glb_srst_fst),
+				     offsetof(struct rk3576_cru, glb_srst_snd));
+	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 rk3576_cru,
-						    glb_srst_fst);
-		priv->glb_srst_snd_value = offsetof(struct rk3576_cru,
-						    glb_srsr_snd);
-		dev_set_priv(sys_child, priv);
-	}
 
 #if CONFIG_IS_ENABLED(RESET_ROCKCHIP)
 	ret = offsetof(struct rk3576_cru, softrst_con[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.