mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] phy: usb-nop-xceiv: Make the clock always optional
@ 2020-12-09 13:14 Jules Maselbas
  2020-12-10  9:04 ` Sascha Hauer
  0 siblings, 1 reply; 3+ messages in thread
From: Jules Maselbas @ 2020-12-09 13:14 UTC (permalink / raw)
  To: barebox; +Cc: Jules Maselbas

The clock seems to be optional at probe time, if not found it's set
to NULL. However this was not the case in the function nop_usbphy_init
which exits with error if the clock cannot be enabled.

Make the clock optional also during the nop_usbphy_init by trying to
do the clock init only if the clock has been found during probe.

Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
 drivers/phy/usb-nop-xceiv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/phy/usb-nop-xceiv.c b/drivers/phy/usb-nop-xceiv.c
index 7ea7d28a2..b549b564b 100644
--- a/drivers/phy/usb-nop-xceiv.c
+++ b/drivers/phy/usb-nop-xceiv.c
@@ -46,9 +46,11 @@ static int nop_usbphy_init(struct phy *phy)
 	int ret;
 	struct nop_usbphy *nopphy = phy_get_drvdata(phy);
 
-	ret = clk_enable(nopphy->clk);
-	if (ret < 0)
-		return ret;
+	if (nopphy->clk) {
+		ret = clk_enable(nopphy->clk);
+		if (ret < 0)
+			return ret;
+	}
 
 	if (gpio_is_valid(nopphy->reset)) {
 		/*
-- 
2.17.1



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] phy: usb-nop-xceiv: Make the clock always optional
  2020-12-09 13:14 [PATCH] phy: usb-nop-xceiv: Make the clock always optional Jules Maselbas
@ 2020-12-10  9:04 ` Sascha Hauer
  2020-12-10  9:40   ` Jules Maselbas
  0 siblings, 1 reply; 3+ messages in thread
From: Sascha Hauer @ 2020-12-10  9:04 UTC (permalink / raw)
  To: Jules Maselbas; +Cc: barebox

Hi Jules,

On Wed, Dec 09, 2020 at 02:14:54PM +0100, Jules Maselbas wrote:
> The clock seems to be optional at probe time, if not found it's set
> to NULL. However this was not the case in the function nop_usbphy_init
> which exits with error if the clock cannot be enabled.
> 
> Make the clock optional also during the nop_usbphy_init by trying to
> do the clock init only if the clock has been found during probe.
> 
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
>  drivers/phy/usb-nop-xceiv.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/phy/usb-nop-xceiv.c b/drivers/phy/usb-nop-xceiv.c
> index 7ea7d28a2..b549b564b 100644
> --- a/drivers/phy/usb-nop-xceiv.c
> +++ b/drivers/phy/usb-nop-xceiv.c
> @@ -46,9 +46,11 @@ static int nop_usbphy_init(struct phy *phy)
>  	int ret;
>  	struct nop_usbphy *nopphy = phy_get_drvdata(phy);
>  
> -	ret = clk_enable(nopphy->clk);
> -	if (ret < 0)
> -		return ret;
> +	if (nopphy->clk) {
> +		ret = clk_enable(nopphy->clk);
> +		if (ret < 0)
> +			return ret;
> +	}

clk_enable(NULL) returns 0 on purpose, because NULL is handled as a
dummy clock. This change shouldn't be needed.

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: [PATCH] phy: usb-nop-xceiv: Make the clock always optional
  2020-12-10  9:04 ` Sascha Hauer
@ 2020-12-10  9:40   ` Jules Maselbas
  0 siblings, 0 replies; 3+ messages in thread
From: Jules Maselbas @ 2020-12-10  9:40 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

Hi Sascha,

On Thu, Dec 10, 2020 at 10:04:51AM +0100, Sascha Hauer wrote:
> Hi Jules,
> 
> clk_enable(NULL) returns 0 on purpose, because NULL is handled as a
> dummy clock. This change shouldn't be needed.
Indeed, I don't know why I thought this was not the case.
You can drop this patch.

Thanks


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2020-12-10  9:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 13:14 [PATCH] phy: usb-nop-xceiv: Make the clock always optional Jules Maselbas
2020-12-10  9:04 ` Sascha Hauer
2020-12-10  9:40   ` Jules Maselbas

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