]> git.sur5r.net Git - u-boot/blobdiff - drivers/clk/rockchip/clk_rv1108.c
Merge git://git.denx.de/u-boot-sh
[u-boot] / drivers / clk / rockchip / clk_rv1108.c
index 55741c3a1e23ccde8770fa1c31d07b4d2e12fc51..42341a856605841900e2c38f66661565d936eadb 100644 (file)
@@ -209,11 +209,18 @@ static void rkclk_init(struct rv1108_cru *cru)
        printf("APLL: %d DPLL:%d GPLL:%d\n", apll, dpll, gpll);
 }
 
-static int rv1108_clk_probe(struct udevice *dev)
+static int rv1108_clk_ofdata_to_platdata(struct udevice *dev)
 {
        struct rv1108_clk_priv *priv = dev_get_priv(dev);
 
-       priv->cru = (struct rv1108_cru *)devfdt_get_addr(dev);
+       priv->cru = dev_read_addr_ptr(dev);
+
+       return 0;
+}
+
+static int rv1108_clk_probe(struct udevice *dev)
+{
+       struct rv1108_clk_priv *priv = dev_get_priv(dev);
 
        rkclk_init(priv->cru);
 
@@ -223,11 +230,29 @@ 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;
 
        /* 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) {
+               debug("Warning: No sysreset driver: ret=%d\n", ret);
+       } else {
+               priv = malloc(sizeof(struct sysreset_reg));
+               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;
+       }
+
+#if CONFIG_IS_ENABLED(CONFIG_RESET_ROCKCHIP)
+       ret = offsetof(struct rk3368_cru, softrst_con[0]);
+       ret = rockchip_reset_bind(dev, ret, 13);
        if (ret)
-               pr_err("No Rv1108 reset driver: ret=%d\n", ret);
+               debug("Warning: software reset driver bind faile\n");
+#endif
 
        return 0;
 }
@@ -242,6 +267,7 @@ U_BOOT_DRIVER(clk_rv1108) = {
        .id             = UCLASS_CLK,
        .of_match       = rv1108_clk_ids,
        .priv_auto_alloc_size = sizeof(struct rv1108_clk_priv),
+       .ofdata_to_platdata = rv1108_clk_ofdata_to_platdata,
        .ops            = &rv1108_clk_ops,
        .bind           = rv1108_clk_bind,
        .probe          = rv1108_clk_probe,