All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 0/3] Restore original GPIO uclass logic
@ 2024-12-09 16:14 Svyatoslav Ryhel
  2024-12-09 16:14 ` [PATCH v1 1/3] Revert "drivers: gpio-uclass: support PMIC GPIO children" Svyatoslav Ryhel
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Svyatoslav Ryhel @ 2024-12-09 16:14 UTC (permalink / raw)
  To: Tom Rini, Jaehoon Chung, Svyatoslav Ryhel, Simon Glass,
	Peter Robinson, Heiko Schocher, Jonas Karlman
  Cc: u-boot

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(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v1 1/3] Revert "drivers: gpio-uclass: support PMIC GPIO children"
  2024-12-09 16:14 [PATCH v1 0/3] Restore original GPIO uclass logic Svyatoslav Ryhel
@ 2024-12-09 16:14 ` Svyatoslav Ryhel
  2024-12-10 22:35   ` Jaehoon Chung
  2024-12-09 16:14 ` [PATCH v1 2/3] pmic: max77663: bind children to parent node Svyatoslav Ryhel
  2024-12-09 16:14 ` [PATCH v1 3/3] pmic: palmas: bind sysreset " Svyatoslav Ryhel
  2 siblings, 1 reply; 7+ messages in thread
From: Svyatoslav Ryhel @ 2024-12-09 16:14 UTC (permalink / raw)
  To: Tom Rini, Jaehoon Chung, Svyatoslav Ryhel, Simon Glass,
	Peter Robinson, Heiko Schocher, Jonas Karlman
  Cc: u-boot

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);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 2/3] pmic: max77663: bind children to parent node
  2024-12-09 16:14 [PATCH v1 0/3] Restore original GPIO uclass logic Svyatoslav Ryhel
  2024-12-09 16:14 ` [PATCH v1 1/3] Revert "drivers: gpio-uclass: support PMIC GPIO children" Svyatoslav Ryhel
@ 2024-12-09 16:14 ` Svyatoslav Ryhel
  2024-12-10 22:35   ` Jaehoon Chung
  2024-12-09 16:14 ` [PATCH v1 3/3] pmic: palmas: bind sysreset " Svyatoslav Ryhel
  2 siblings, 1 reply; 7+ messages in thread
From: Svyatoslav Ryhel @ 2024-12-09 16:14 UTC (permalink / raw)
  To: Tom Rini, Jaehoon Chung, Svyatoslav Ryhel, Simon Glass,
	Peter Robinson, Heiko Schocher, Jonas Karlman
  Cc: u-boot

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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1 3/3] pmic: palmas: bind sysreset to parent node
  2024-12-09 16:14 [PATCH v1 0/3] Restore original GPIO uclass logic Svyatoslav Ryhel
  2024-12-09 16:14 ` [PATCH v1 1/3] Revert "drivers: gpio-uclass: support PMIC GPIO children" Svyatoslav Ryhel
  2024-12-09 16:14 ` [PATCH v1 2/3] pmic: max77663: bind children to parent node Svyatoslav Ryhel
@ 2024-12-09 16:14 ` Svyatoslav Ryhel
  2024-12-10 22:36   ` Jaehoon Chung
  2 siblings, 1 reply; 7+ messages in thread
From: Svyatoslav Ryhel @ 2024-12-09 16:14 UTC (permalink / raw)
  To: Tom Rini, Jaehoon Chung, Svyatoslav Ryhel, Simon Glass,
	Peter Robinson, Heiko Schocher, Jonas Karlman
  Cc: u-boot

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;
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* RE: [PATCH v1 1/3] Revert "drivers: gpio-uclass: support PMIC GPIO children"
  2024-12-09 16:14 ` [PATCH v1 1/3] Revert "drivers: gpio-uclass: support PMIC GPIO children" Svyatoslav Ryhel
@ 2024-12-10 22:35   ` Jaehoon Chung
  0 siblings, 0 replies; 7+ messages in thread
From: Jaehoon Chung @ 2024-12-10 22:35 UTC (permalink / raw)
  To: 'Svyatoslav Ryhel', 'Tom Rini',
	'Simon Glass', 'Peter	Robinson',
	'Heiko Schocher', 'Jonas Karlman'
  Cc: u-boot



> -----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




^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v1 2/3] pmic: max77663: bind children to parent node
  2024-12-09 16:14 ` [PATCH v1 2/3] pmic: max77663: bind children to parent node Svyatoslav Ryhel
@ 2024-12-10 22:35   ` Jaehoon Chung
  0 siblings, 0 replies; 7+ messages in thread
From: Jaehoon Chung @ 2024-12-10 22:35 UTC (permalink / raw)
  To: 'Svyatoslav Ryhel', 'Tom Rini',
	'Simon Glass', 'Peter	Robinson',
	'Heiko Schocher', 'Jonas Karlman'
  Cc: u-boot



> -----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),
> +						 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;
> --
> 2.43.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: [PATCH v1 3/3] pmic: palmas: bind sysreset to parent node
  2024-12-09 16:14 ` [PATCH v1 3/3] pmic: palmas: bind sysreset " Svyatoslav Ryhel
@ 2024-12-10 22:36   ` Jaehoon Chung
  0 siblings, 0 replies; 7+ messages in thread
From: Jaehoon Chung @ 2024-12-10 22:36 UTC (permalink / raw)
  To: 'Svyatoslav Ryhel', 'Tom Rini',
	'Simon Glass', 'Peter	Robinson',
	'Heiko Schocher', 'Jonas Karlman'
  Cc: u-boot



> -----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),
> +						 NULL);
>  		if (ret) {
>  			log_err("cannot bind SYSRESET (ret = %d)\n", ret);
>  			return ret;
> --
> 2.43.0




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-12-10 22:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-09 16:14 [PATCH v1 0/3] Restore original GPIO uclass logic Svyatoslav Ryhel
2024-12-09 16:14 ` [PATCH v1 1/3] Revert "drivers: gpio-uclass: support PMIC GPIO children" Svyatoslav Ryhel
2024-12-10 22:35   ` Jaehoon Chung
2024-12-09 16:14 ` [PATCH v1 2/3] pmic: max77663: bind children to parent node Svyatoslav Ryhel
2024-12-10 22:35   ` Jaehoon Chung
2024-12-09 16:14 ` [PATCH v1 3/3] pmic: palmas: bind sysreset " Svyatoslav Ryhel
2024-12-10 22:36   ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.