[PATCH 14/30] clk: rockchip: rv1126: 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 CRU base address constants
based on the clock-controller addresses used in the SoC device tree.

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

diff --git a/arch/arm/include/asm/arch-rockchip/cru_rv1126.h b/arch/arm/include/asm/arch-rockchip/cru_rv1126.h
index ae273de31442..8f7bd1c544f9 100644
--- a/arch/arm/include/asm/arch-rockchip/cru_rv1126.h
+++ b/arch/arm/include/asm/arch-rockchip/cru_rv1126.h
@@ -150,8 +150,10 @@ struct cpu_rate_table {
 	unsigned int pclk_div;
 };
 
+#define RV1126_PMU_CRU_BASE		0xff480000
 #define RV1126_PMU_MODE			0x0
 #define RV1126_PMU_PLL_CON(x)		((x) * 0x4 + 0x10)
+#define RV1126_CRU_BASE			0xff490000
 #define RV1126_PLL_CON(x)		((x) * 0x4)
 #define RV1126_MODE_CON			0x90
 
diff --git a/drivers/clk/rockchip/clk_rv1126.c b/drivers/clk/rockchip/clk_rv1126.c
index 39920d34b75a..7c71d0b64ce4 100644
--- a/drivers/clk/rockchip/clk_rv1126.c
+++ b/drivers/clk/rockchip/clk_rv1126.c
@@ -1842,22 +1842,14 @@ static int rv1126_clk_of_to_plat(struct udevice *dev)
 static int rv1126_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, RV1126_CRU_BASE,
+				     offsetof(struct rv1126_cru, glb_rst_st),
+				     offsetof(struct rv1126_cru, glb_srst_fst),
+				     offsetof(struct rv1126_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 rv1126_cru,
-						    glb_srst_fst);
-		priv->glb_srst_snd_value = offsetof(struct rv1126_cru,
-						    glb_srst_snd);
-		dev_set_priv(sys_child, priv);
-	}
 
 #if CONFIG_IS_ENABLED(RESET_ROCKCHIP)
 	ret = offsetof(struct rv1126_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.