[PATCH v1 0/3] Restore original GPIO uclass logic

Move PMIC GPIO child handling into PMIC's driver by bounding GPIO driver to parent node. Remove gpio-uclass workaround.
Svyatoslav Ryhel (3): Revert "drivers: gpio-uclass: support PMIC GPIO children" pmic: max77663: bind children to parent node pmic: palmas: bind sysreset to parent node
drivers/gpio/gpio-uclass.c | 20 -------------------- drivers/power/pmic/max77663.c | 9 +++++---- drivers/power/pmic/palmas.c | 5 +++-- 3 files changed, 8 insertions(+), 26 deletions(-)

Requesting of PMIC's GPIO child should be done by binding GPIO driver to PMIC's node is GPIO driver does not have its own node.
This reverts commit c03cd98d1a163666b4addcdd9a34fc0c77dfd0a5.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- drivers/gpio/gpio-uclass.c | 20 -------------------- 1 file changed, 20 deletions(-)
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 0213271e3a6..67fc776cada 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -1142,29 +1142,9 @@ static int gpio_request_tail(int ret, const char *nodename, ret = uclass_get_device_by_ofnode(UCLASS_GPIO, args->node, &desc->dev); if (ret) { -#if CONFIG_IS_ENABLED(MAX77663_GPIO) || CONFIG_IS_ENABLED(PALMAS_GPIO) - struct udevice *pmic; - ret = uclass_get_device_by_ofnode(UCLASS_PMIC, args->node, - &pmic); - if (ret) { - log_debug("%s: PMIC device get failed, err %d\n", - __func__, ret); - goto err; - } - - device_foreach_child(desc->dev, pmic) { - if (device_get_uclass_id(desc->dev) == UCLASS_GPIO) - break; - } - - /* if loop exits without GPIO device return error */ - if (device_get_uclass_id(desc->dev) != UCLASS_GPIO) - goto err; -#else debug("%s: uclass_get_device_by_ofnode failed\n", __func__); goto err; -#endif } } ret = gpio_find_and_xlate(desc, args);

-----Original Message----- From: Svyatoslav Ryhel clamor95@gmail.com Sent: Tuesday, December 10, 2024 1:15 AM
Requesting of PMIC's GPIO child should be done by binding GPIO driver to PMIC's node is GPIO driver does not have its own node.
This reverts commit c03cd98d1a163666b4addcdd9a34fc0c77dfd0a5.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com
Reviewed-by: Jaehoon Chung jh80.chung@samsung.com
Best Regards,
drivers/gpio/gpio-uclass.c | 20 -------------------- 1 file changed, 20 deletions(-)
diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 0213271e3a6..67fc776cada 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -1142,29 +1142,9 @@ static int gpio_request_tail(int ret, const char *nodename, ret = uclass_get_device_by_ofnode(UCLASS_GPIO, args->node, &desc->dev); if (ret) { -#if CONFIG_IS_ENABLED(MAX77663_GPIO) || CONFIG_IS_ENABLED(PALMAS_GPIO)
struct udevice *pmic;
ret = uclass_get_device_by_ofnode(UCLASS_PMIC, args->node,
&pmic);
if (ret) {
log_debug("%s: PMIC device get failed, err %d\n",
__func__, ret);
goto err;
}
device_foreach_child(desc->dev, pmic) {
if (device_get_uclass_id(desc->dev) == UCLASS_GPIO)
break;
}
/* if loop exits without GPIO device return error */
if (device_get_uclass_id(desc->dev) != UCLASS_GPIO)
goto err;
-#else debug("%s: uclass_get_device_by_ofnode failed\n", __func__); goto err; -#endif } } ret = gpio_find_and_xlate(desc, args); -- 2.43.0

Bind GPIO and SYSRESET children to parent node since they do not have their own nodes in the device tree.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- drivers/power/pmic/max77663.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/power/pmic/max77663.c b/drivers/power/pmic/max77663.c index cf08b6a7e1d..c2a7cbf7e40 100644 --- a/drivers/power/pmic/max77663.c +++ b/drivers/power/pmic/max77663.c @@ -47,8 +47,9 @@ static int max77663_bind(struct udevice *dev) int children, ret;
if (IS_ENABLED(CONFIG_SYSRESET_MAX77663)) { - ret = device_bind_driver(dev, MAX77663_RST_DRIVER, - "sysreset", NULL); + ret = device_bind_driver_to_node(dev, MAX77663_RST_DRIVER, + "sysreset", dev_ofnode(dev), + NULL); if (ret) { log_err("cannot bind SYSRESET (ret = %d)\n", ret); return ret; @@ -56,8 +57,8 @@ static int max77663_bind(struct udevice *dev) }
if (IS_ENABLED(CONFIG_MAX77663_GPIO)) { - ret = device_bind_driver(dev, MAX77663_GPIO_DRIVER, - "gpio", NULL); + ret = device_bind_driver_to_node(dev, MAX77663_GPIO_DRIVER, + "gpio", dev_ofnode(dev), NULL); if (ret) { log_err("cannot bind GPIOs (ret = %d)\n", ret); return ret;

-----Original Message----- From: Svyatoslav Ryhel clamor95@gmail.com Sent: Tuesday, December 10, 2024 1:15 AM
Bind GPIO and SYSRESET children to parent node since they do not have their own nodes in the device tree.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com
Reviewed-by: Jaehoon Chung jh80.chung@samsung.com
Best Regards,
drivers/power/pmic/max77663.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/power/pmic/max77663.c b/drivers/power/pmic/max77663.c index cf08b6a7e1d..c2a7cbf7e40 100644 --- a/drivers/power/pmic/max77663.c +++ b/drivers/power/pmic/max77663.c @@ -47,8 +47,9 @@ static int max77663_bind(struct udevice *dev) int children, ret;
if (IS_ENABLED(CONFIG_SYSRESET_MAX77663)) {
ret = device_bind_driver(dev, MAX77663_RST_DRIVER,
"sysreset", NULL);
ret = device_bind_driver_to_node(dev, MAX77663_RST_DRIVER,
"sysreset", dev_ofnode(dev),
if (ret) { log_err("cannot bind SYSRESET (ret = %d)\n", ret); return ret;NULL);
@@ -56,8 +57,8 @@ static int max77663_bind(struct udevice *dev) }
if (IS_ENABLED(CONFIG_MAX77663_GPIO)) {
ret = device_bind_driver(dev, MAX77663_GPIO_DRIVER,
"gpio", NULL);
ret = device_bind_driver_to_node(dev, MAX77663_GPIO_DRIVER,
if (ret) { log_err("cannot bind GPIOs (ret = %d)\n", ret); return ret;"gpio", dev_ofnode(dev), NULL);
-- 2.43.0

Bind SYSRESET child to parent node since it does not have its own node in the device tree.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com --- drivers/power/pmic/palmas.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c index f676bf64169..37d4190fabe 100644 --- a/drivers/power/pmic/palmas.c +++ b/drivers/power/pmic/palmas.c @@ -49,8 +49,9 @@ static int palmas_bind(struct udevice *dev) int children, ret;
if (IS_ENABLED(CONFIG_SYSRESET_PALMAS)) { - ret = device_bind_driver(dev, PALMAS_RST_DRIVER, - "sysreset", NULL); + ret = device_bind_driver_to_node(dev, PALMAS_RST_DRIVER, + "sysreset", dev_ofnode(dev), + NULL); if (ret) { log_err("cannot bind SYSRESET (ret = %d)\n", ret); return ret;

-----Original Message----- From: Svyatoslav Ryhel clamor95@gmail.com Sent: Tuesday, December 10, 2024 1:15 AM Bind SYSRESET child to parent node since it does not have its own node in the device tree.
Signed-off-by: Svyatoslav Ryhel clamor95@gmail.com
Reviewed-by: Jaehoon Chung jh80.chung@samsung.com
Best Regards,
drivers/power/pmic/palmas.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/power/pmic/palmas.c b/drivers/power/pmic/palmas.c index f676bf64169..37d4190fabe 100644 --- a/drivers/power/pmic/palmas.c +++ b/drivers/power/pmic/palmas.c @@ -49,8 +49,9 @@ static int palmas_bind(struct udevice *dev) int children, ret;
if (IS_ENABLED(CONFIG_SYSRESET_PALMAS)) {
ret = device_bind_driver(dev, PALMAS_RST_DRIVER,
"sysreset", NULL);
ret = device_bind_driver_to_node(dev, PALMAS_RST_DRIVER,
"sysreset", dev_ofnode(dev),
if (ret) { log_err("cannot bind SYSRESET (ret = %d)\n", ret); return ret;NULL);
-- 2.43.0
participants (2)
-
Jaehoon Chung
-
Svyatoslav Ryhel