[U-Boot] [PATCH v2 2/2] rockchip: clock: update sysreset driver bingding

Kever Yang kever.yang at rock-chips.com
Thu Oct 26 07:48:58 UTC 2017


Using driver_data for new sysreset driver binding.

Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
---

Changes in v2:
- use udev priv member instead of driver_data

 drivers/clk/rockchip/clk_rk3036.c | 10 ++++++++--
 drivers/clk/rockchip/clk_rk3188.c | 10 ++++++++--
 drivers/clk/rockchip/clk_rk322x.c | 10 ++++++++--
 drivers/clk/rockchip/clk_rk3288.c | 10 ++++++++--
 drivers/clk/rockchip/clk_rk3328.c | 11 +++++++++--
 drivers/clk/rockchip/clk_rk3368.c | 12 +++++++++---
 drivers/clk/rockchip/clk_rk3399.c | 10 ++++++++--
 drivers/clk/rockchip/clk_rv1108.c | 10 ++++++++--
 8 files changed, 66 insertions(+), 17 deletions(-)

diff --git a/drivers/clk/rockchip/clk_rk3036.c b/drivers/clk/rockchip/clk_rk3036.c
index 83f4ae6..7d56024 100644
--- a/drivers/clk/rockchip/clk_rk3036.c
+++ b/drivers/clk/rockchip/clk_rk3036.c
@@ -330,11 +330,17 @@ static int rk3036_clk_probe(struct udevice *dev)
 static int rk3036_clk_bind(struct udevice *dev)
 {
 	int ret;
+	struct udevice *sys_child;
+	struct sysreset_reg *priv = malloc(sizeof(struct sysreset_reg));
 
 	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rk3036_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		debug("Warning: No RK3036 reset driver: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rk3036_cru, cru_glb_srst_fst_value);
+	priv->glb_srst_snd_value = offsetof(struct rk3036_cru, cru_glb_srst_snd_value);
+	sys_child->priv = priv;
 
 	return 0;
 }
diff --git a/drivers/clk/rockchip/clk_rk3188.c b/drivers/clk/rockchip/clk_rk3188.c
index 7bf308d..e1650a4 100644
--- a/drivers/clk/rockchip/clk_rk3188.c
+++ b/drivers/clk/rockchip/clk_rk3188.c
@@ -603,11 +603,17 @@ static int rk3188_clk_probe(struct udevice *dev)
 static int rk3188_clk_bind(struct udevice *dev)
 {
 	int ret;
+	struct udevice *sys_child;
+	struct sysreset_reg *priv = malloc(sizeof(struct sysreset_reg));
 
 	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rk3188_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		debug("Warning: No rk3188 reset driver: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rk3188_cru, cru_glb_srst_fst_value);
+	priv->glb_srst_snd_value = offsetof(struct rk3188_cru, cru_glb_srst_snd_value);
+	sys_child->priv = priv;
 
 	return 0;
 }
diff --git a/drivers/clk/rockchip/clk_rk322x.c b/drivers/clk/rockchip/clk_rk322x.c
index 354883a..c00b156 100644
--- a/drivers/clk/rockchip/clk_rk322x.c
+++ b/drivers/clk/rockchip/clk_rk322x.c
@@ -413,11 +413,17 @@ static int rk322x_clk_probe(struct udevice *dev)
 static int rk322x_clk_bind(struct udevice *dev)
 {
 	int ret;
+	struct udevice *sys_child;
+	struct sysreset_reg *priv = malloc(sizeof(struct sysreset_reg));
 
 	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rk322x_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		debug("Warning: No RK322x reset driver: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rk322x_cru, cru_glb_srst_fst_value);
+	priv->glb_srst_snd_value = offsetof(struct rk322x_cru, cru_glb_srst_snd_value);
+	sys_child->priv = priv;
 
 	return 0;
 }
diff --git a/drivers/clk/rockchip/clk_rk3288.c b/drivers/clk/rockchip/clk_rk3288.c
index 204a547..0eb8403 100644
--- a/drivers/clk/rockchip/clk_rk3288.c
+++ b/drivers/clk/rockchip/clk_rk3288.c
@@ -983,11 +983,17 @@ 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 = malloc(sizeof(struct sysreset_reg));
 
 	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rk3288_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		debug("Warning: No RK3288 reset driver: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rk3288_cru, cru_glb_srst_fst_value);
+	priv->glb_srst_snd_value = offsetof(struct rk3288_cru, cru_glb_srst_snd_value);
+	sys_child->priv = priv;
 
 	return 0;
 }
diff --git a/drivers/clk/rockchip/clk_rk3328.c b/drivers/clk/rockchip/clk_rk3328.c
index 540d910..2b58621 100644
--- a/drivers/clk/rockchip/clk_rk3328.c
+++ b/drivers/clk/rockchip/clk_rk3328.c
@@ -14,6 +14,7 @@
 #include <asm/arch/cru_rk3328.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
+#include <dm/device-internal.h>
 #include <dm/lists.h>
 #include <dt-bindings/clock/rk3328-cru.h>
 
@@ -597,11 +598,17 @@ static int rk3328_clk_ofdata_to_platdata(struct udevice *dev)
 static int rk3328_clk_bind(struct udevice *dev)
 {
 	int ret;
+	struct udevice *sys_child;
+	struct sysreset_reg *priv = malloc(sizeof(struct sysreset_reg));
 
 	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rk3328_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		printf("Warning: No RK3328 reset driver: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rk3328_cru, glb_srst_fst_value);
+	priv->glb_srst_snd_value = offsetof(struct rk3328_cru, glb_srst_snd_value);
+	sys_child->priv = priv;
 
 	return ret;
 }
diff --git a/drivers/clk/rockchip/clk_rk3368.c b/drivers/clk/rockchip/clk_rk3368.c
index cd3ab24..89619a4 100644
--- a/drivers/clk/rockchip/clk_rk3368.c
+++ b/drivers/clk/rockchip/clk_rk3368.c
@@ -526,11 +526,17 @@ static int rk3368_clk_ofdata_to_platdata(struct udevice *dev)
 static int rk3368_clk_bind(struct udevice *dev)
 {
 	int ret;
+	struct udevice *sys_child;
+	struct sysreset_reg *priv = malloc(sizeof(struct sysreset_reg));
 
-	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rk3368_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		error("bind RK3368 reset driver failed: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rk3368_cru, glb_srst_fst_val);
+	priv->glb_srst_snd_value = offsetof(struct rk3368_cru, glb_srst_snd_val);
+	/* The reset driver does not have a device node, so bind it here */
+	sys_child->priv = priv;
 
 	return ret;
 }
diff --git a/drivers/clk/rockchip/clk_rk3399.c b/drivers/clk/rockchip/clk_rk3399.c
index b31446e..33918d2 100644
--- a/drivers/clk/rockchip/clk_rk3399.c
+++ b/drivers/clk/rockchip/clk_rk3399.c
@@ -1018,11 +1018,17 @@ static int rk3399_clk_ofdata_to_platdata(struct udevice *dev)
 static int rk3399_clk_bind(struct udevice *dev)
 {
 	int ret;
+	struct udevice *sys_child;
+	struct sysreset_reg *priv = malloc(sizeof(struct sysreset_reg));
 
 	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rk3399_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		printf("Warning: No RK3399 reset driver: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rk3399_cru, glb_srst_fst_value);
+	priv->glb_srst_snd_value = offsetof(struct rk3399_cru, glb_srst_snd_value);
+	sys_child->priv = priv;
 
 	return 0;
 }
diff --git a/drivers/clk/rockchip/clk_rv1108.c b/drivers/clk/rockchip/clk_rv1108.c
index 86e73e4..a0caf3f 100644
--- a/drivers/clk/rockchip/clk_rv1108.c
+++ b/drivers/clk/rockchip/clk_rv1108.c
@@ -223,11 +223,17 @@ static int rv1108_clk_probe(struct udevice *dev)
 static int rv1108_clk_bind(struct udevice *dev)
 {
 	int ret;
+	struct udevice *sys_child;
+	struct sysreset_reg *priv = malloc(sizeof(struct sysreset_reg));
 
 	/* The reset driver does not have a device node, so bind it here */
-	ret = device_bind_driver(gd->dm_root, "rv1108_sysreset", "reset", &dev);
+	ret = device_bind_driver(dev, "rockchip_sysreset", "sysreset", &sys_child);
 	if (ret)
-		error("No Rv1108 reset driver: ret=%d\n", ret);
+		debug("Warning: No sysreset driver: ret=%d\n", ret);
+
+	priv->glb_srst_fst_value = offsetof(struct rv1108_cru, glb_srst_fst_val);
+	priv->glb_srst_snd_value = offsetof(struct rv1108_cru, glb_srst_snd_val);
+	sys_child->priv = priv;
 
 	return 0;
 }
-- 
1.9.1



More information about the U-Boot mailing list