sysreset: syscon: update regmap access to syscon
authorPatrick Delaunay <patrick.delaunay@st.com>
Mon, 9 Jul 2018 12:59:29 +0000 (14:59 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 20 Jul 2018 19:55:04 +0000 (15:55 -0400)
Use new API syscon_node_to_regmap in sysreset_syscon driver
for compatible "syscon-reboot"; that's avoid the need of explicit
syscon binding for "regmap" handle.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
drivers/sysreset/sysreset_syscon.c

index f19e80e6e4f65a02ac4739557ba2a52fdbc9f8ec..34506402ac3a1c59f9f94c2b0b210df7d83faa61 100644 (file)
@@ -35,18 +35,20 @@ static struct sysreset_ops syscon_reboot_ops = {
 
 int syscon_reboot_probe(struct udevice *dev)
 {
-       struct udevice *syscon;
        struct syscon_reboot_priv *priv = dev_get_priv(dev);
        int err;
+       u32 phandle;
+       ofnode node;
 
-       err = uclass_get_device_by_phandle(UCLASS_SYSCON, dev,
-                                          "regmap", &syscon);
-       if (err) {
-               pr_err("unable to find syscon device\n");
+       err = ofnode_read_u32(dev_ofnode(dev), "regmap", &phandle);
+       if (err)
                return err;
-       }
 
-       priv->regmap = syscon_get_regmap(syscon);
+       node = ofnode_get_by_phandle(phandle);
+       if (!ofnode_valid(node))
+               return -EINVAL;
+
+       priv->regmap = syscon_node_to_regmap(node);
        if (!priv->regmap) {
                pr_err("unable to find regmap\n");
                return -ENODEV;