]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pinctrl: mediatek: add support for gpio-controller property in root node
authorChristian Marangi <ansuelsmth@gmail.com>
Mon, 24 Jun 2024 21:03:36 +0000 (23:03 +0200)
committerTom Rini <trini@konsulko.com>
Mon, 8 Jul 2024 17:45:50 +0000 (11:45 -0600)
Add support for gpio-controller property in root pinctrl node.
This is to follow upstream linux DTSI that doesn't define the
gpio-controller and cells in dedicated nodes.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
drivers/pinctrl/mediatek/pinctrl-mtk-common.c

index 37fc28bb779048c2b404f638ae514dbd3d96938d..ede3959c94f0ee4234433eb07b1d072ff1d3c58c 100644 (file)
@@ -761,6 +761,15 @@ static int mtk_gpiochip_register(struct udevice *parent)
        if (!drv)
                return -ENOENT;
 
+       /*
+        * Support upstream linux DTSI that define gpio-controller
+        * in the root node (instead of a dedicated subnode)
+        */
+       if (dev_read_bool(parent, "gpio-controller")) {
+               node = dev_ofnode(parent);
+               goto bind;
+       }
+
        ret = -ENOENT;
        dev_for_each_subnode(node, parent)
                if (ofnode_read_bool(node, "gpio-controller")) {
@@ -771,6 +780,7 @@ static int mtk_gpiochip_register(struct udevice *parent)
        if (ret)
                return ret;
 
+bind:
        ret = device_bind_with_driver_data(parent, &mtk_gpio_driver,
                                           "mediatek_gpio", 0, node,
                                           &dev);