public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH 1/2] usb: ehci-mx5: Use regulator_set_enable_if_allowed
@ 2025-01-07 22:56 Marek Vasut
  2025-01-07 22:56 ` [PATCH 2/2] usb: ehci-mx6: " Marek Vasut
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Marek Vasut @ 2025-01-07 22:56 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Alice Guo, Fabio Estevam, Mathieu Othacehe,
	Mattijs Korpershoek, Peng Fan, Tom Rini

With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter") the return value of regulator_set_enable may be EALREADY or
EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to
continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Alice Guo <alice.guo@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Mathieu Othacehe <othacehe@gnu.org>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 drivers/usb/host/ehci-mx5.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c
index d8f521befe1..1392d29bc13 100644
--- a/drivers/usb/host/ehci-mx5.c
+++ b/drivers/usb/host/ehci-mx5.c
@@ -287,9 +287,9 @@ static int ehci_usb_probe(struct udevice *dev)
 		debug("%s: No vbus supply\n", dev->name);
 
 	if (!ret && priv->vbus_supply) {
-		ret = regulator_set_enable(priv->vbus_supply,
-					   (type == USB_INIT_DEVICE) ?
-					   false : true);
+		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
+						      (type == USB_INIT_DEVICE) ?
+						      false : true);
 		if (ret) {
 			puts("Error enabling VBUS supply\n");
 			return ret;
-- 
2.45.2


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

* [PATCH 2/2] usb: ehci-mx6: Use regulator_set_enable_if_allowed
  2025-01-07 22:56 [PATCH 1/2] usb: ehci-mx5: Use regulator_set_enable_if_allowed Marek Vasut
@ 2025-01-07 22:56 ` Marek Vasut
  2025-01-08  1:20   ` Fabio Estevam
  2025-01-08  8:20   ` Mattijs Korpershoek
  2025-01-08  1:19 ` [PATCH 1/2] usb: ehci-mx5: " Fabio Estevam
  2025-01-08  8:20 ` Mattijs Korpershoek
  2 siblings, 2 replies; 6+ messages in thread
From: Marek Vasut @ 2025-01-07 22:56 UTC (permalink / raw)
  To: u-boot
  Cc: Marek Vasut, Alice Guo, Fabio Estevam, Mathieu Othacehe,
	Mattijs Korpershoek, Peng Fan, Tom Rini

With the commit 4fcba5d556b4 ("regulator: implement basic reference
counter") the return value of regulator_set_enable may be EALREADY or
EBUSY for fixed/gpio regulators.

Change to use the more relaxed regulator_set_enable_if_allowed to
continue if regulator already was enabled or disabled.

Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Alice Guo <alice.guo@nxp.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Mathieu Othacehe <othacehe@gnu.org>
Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: u-boot@lists.denx.de
---
 drivers/usb/host/ehci-mx6.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index a93fa5d5455..a8748cef7ad 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -479,9 +479,9 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
 #if CONFIG_IS_ENABLED(DM_REGULATOR)
 	if (priv->vbus_supply) {
 		int ret;
-		ret = regulator_set_enable(priv->vbus_supply,
-					   (type == USB_INIT_DEVICE) ?
-					   false : true);
+		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
+						      (type == USB_INIT_DEVICE) ?
+						      false : true);
 		if (ret && ret != -ENOSYS) {
 			printf("Error enabling VBUS supply (ret=%i)\n", ret);
 			return ret;
-- 
2.45.2


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

* Re: [PATCH 1/2] usb: ehci-mx5: Use regulator_set_enable_if_allowed
  2025-01-07 22:56 [PATCH 1/2] usb: ehci-mx5: Use regulator_set_enable_if_allowed Marek Vasut
  2025-01-07 22:56 ` [PATCH 2/2] usb: ehci-mx6: " Marek Vasut
@ 2025-01-08  1:19 ` Fabio Estevam
  2025-01-08  8:20 ` Mattijs Korpershoek
  2 siblings, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2025-01-08  1:19 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Alice Guo, Mathieu Othacehe, Mattijs Korpershoek,
	Peng Fan, Tom Rini

On Tue, Jan 7, 2025 at 7:56 PM Marek Vasut <marex@denx.de> wrote:
>
> With the commit 4fcba5d556b4 ("regulator: implement basic reference
> counter") the return value of regulator_set_enable may be EALREADY or
> EBUSY for fixed/gpio regulators.
>
> Change to use the more relaxed regulator_set_enable_if_allowed to
> continue if regulator already was enabled or disabled.
>
> Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")
>
> Signed-off-by: Marek Vasut <marex@denx.de>

Reviewed-by: Fabio Estevam <festevam@gmail.com>

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

* Re: [PATCH 2/2] usb: ehci-mx6: Use regulator_set_enable_if_allowed
  2025-01-07 22:56 ` [PATCH 2/2] usb: ehci-mx6: " Marek Vasut
@ 2025-01-08  1:20   ` Fabio Estevam
  2025-01-08  8:20   ` Mattijs Korpershoek
  1 sibling, 0 replies; 6+ messages in thread
From: Fabio Estevam @ 2025-01-08  1:20 UTC (permalink / raw)
  To: Marek Vasut
  Cc: u-boot, Alice Guo, Mathieu Othacehe, Mattijs Korpershoek,
	Peng Fan, Tom Rini

On Tue, Jan 7, 2025 at 7:56 PM Marek Vasut <marex@denx.de> wrote:
>
> With the commit 4fcba5d556b4 ("regulator: implement basic reference
> counter") the return value of regulator_set_enable may be EALREADY or
> EBUSY for fixed/gpio regulators.
>
> Change to use the more relaxed regulator_set_enable_if_allowed to
> continue if regulator already was enabled or disabled.
>
> Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")
>
> Signed-off-by: Marek Vasut <marex@denx.de>

Reviewed-by: Fabio Estevam <festevam@gmail.com>

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

* Re: [PATCH 1/2] usb: ehci-mx5: Use regulator_set_enable_if_allowed
  2025-01-07 22:56 [PATCH 1/2] usb: ehci-mx5: Use regulator_set_enable_if_allowed Marek Vasut
  2025-01-07 22:56 ` [PATCH 2/2] usb: ehci-mx6: " Marek Vasut
  2025-01-08  1:19 ` [PATCH 1/2] usb: ehci-mx5: " Fabio Estevam
@ 2025-01-08  8:20 ` Mattijs Korpershoek
  2 siblings, 0 replies; 6+ messages in thread
From: Mattijs Korpershoek @ 2025-01-08  8:20 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Marek Vasut, Alice Guo, Fabio Estevam, Mathieu Othacehe, Peng Fan,
	Tom Rini

Hi Marek,

Thank you for the patch.

On mar., janv. 07, 2025 at 23:56, Marek Vasut <marex@denx.de> wrote:

> With the commit 4fcba5d556b4 ("regulator: implement basic reference
> counter") the return value of regulator_set_enable may be EALREADY or
> EBUSY for fixed/gpio regulators.
>
> Change to use the more relaxed regulator_set_enable_if_allowed to
> continue if regulator already was enabled or disabled.
>
> Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")
>
> Signed-off-by: Marek Vasut <marex@denx.de>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
> Cc: Alice Guo <alice.guo@nxp.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Mathieu Othacehe <othacehe@gnu.org>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
>  drivers/usb/host/ehci-mx5.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-mx5.c b/drivers/usb/host/ehci-mx5.c
> index d8f521befe1..1392d29bc13 100644
> --- a/drivers/usb/host/ehci-mx5.c
> +++ b/drivers/usb/host/ehci-mx5.c
> @@ -287,9 +287,9 @@ static int ehci_usb_probe(struct udevice *dev)
>  		debug("%s: No vbus supply\n", dev->name);
>  
>  	if (!ret && priv->vbus_supply) {
> -		ret = regulator_set_enable(priv->vbus_supply,
> -					   (type == USB_INIT_DEVICE) ?
> -					   false : true);
> +		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
> +						      (type == USB_INIT_DEVICE) ?
> +						      false : true);
>  		if (ret) {
>  			puts("Error enabling VBUS supply\n");
>  			return ret;
> -- 
> 2.45.2

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

* Re: [PATCH 2/2] usb: ehci-mx6: Use regulator_set_enable_if_allowed
  2025-01-07 22:56 ` [PATCH 2/2] usb: ehci-mx6: " Marek Vasut
  2025-01-08  1:20   ` Fabio Estevam
@ 2025-01-08  8:20   ` Mattijs Korpershoek
  1 sibling, 0 replies; 6+ messages in thread
From: Mattijs Korpershoek @ 2025-01-08  8:20 UTC (permalink / raw)
  To: Marek Vasut, u-boot
  Cc: Marek Vasut, Alice Guo, Fabio Estevam, Mathieu Othacehe, Peng Fan,
	Tom Rini

Hi Marek,

Thank you for the patch.

On mar., janv. 07, 2025 at 23:56, Marek Vasut <marex@denx.de> wrote:

> With the commit 4fcba5d556b4 ("regulator: implement basic reference
> counter") the return value of regulator_set_enable may be EALREADY or
> EBUSY for fixed/gpio regulators.
>
> Change to use the more relaxed regulator_set_enable_if_allowed to
> continue if regulator already was enabled or disabled.
>
> Based on 335799b7252a ("usb: dwc2: Use regulator_set_enable_if_allowed")
>
> Signed-off-by: Marek Vasut <marex@denx.de>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>

> ---
> Cc: Alice Guo <alice.guo@nxp.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Mathieu Othacehe <othacehe@gnu.org>
> Cc: Mattijs Korpershoek <mkorpershoek@baylibre.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Tom Rini <trini@konsulko.com>
> Cc: u-boot@lists.denx.de
> ---
>  drivers/usb/host/ehci-mx6.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> index a93fa5d5455..a8748cef7ad 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -479,9 +479,9 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
>  #if CONFIG_IS_ENABLED(DM_REGULATOR)
>  	if (priv->vbus_supply) {
>  		int ret;
> -		ret = regulator_set_enable(priv->vbus_supply,
> -					   (type == USB_INIT_DEVICE) ?
> -					   false : true);
> +		ret = regulator_set_enable_if_allowed(priv->vbus_supply,
> +						      (type == USB_INIT_DEVICE) ?
> +						      false : true);
>  		if (ret && ret != -ENOSYS) {
>  			printf("Error enabling VBUS supply (ret=%i)\n", ret);
>  			return ret;
> -- 
> 2.45.2

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

end of thread, other threads:[~2025-01-08  8:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-07 22:56 [PATCH 1/2] usb: ehci-mx5: Use regulator_set_enable_if_allowed Marek Vasut
2025-01-07 22:56 ` [PATCH 2/2] usb: ehci-mx6: " Marek Vasut
2025-01-08  1:20   ` Fabio Estevam
2025-01-08  8:20   ` Mattijs Korpershoek
2025-01-08  1:19 ` [PATCH 1/2] usb: ehci-mx5: " Fabio Estevam
2025-01-08  8:20 ` Mattijs Korpershoek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox