All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: fix wrong order of phy_power_on and phy_init
@ 2022-08-20 17:45 Heiner Kallweit
  2022-08-22  9:39 ` Minas Harutyunyan
  0 siblings, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2022-08-20 17:45 UTC (permalink / raw)
  To: Minas Harutyunyan, Greg Kroah-Hartman; +Cc: Linux USB Mailing List

Since 1599069a62c6 ("phy: core: Warn when phy_power_on is called before
phy_init") the driver complains. In my case (Amlogic SoC) the warning
is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init
So change the order of the two calls.

Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/usb/dwc2/platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index c8ba87df7..4db7a18a5 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
 	} else if (hsotg->plat && hsotg->plat->phy_init) {
 		ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
 	} else {
-		ret = phy_power_on(hsotg->phy);
+		ret = phy_init(hsotg->phy);
 		if (ret == 0)
-			ret = phy_init(hsotg->phy);
+			ret = phy_power_on(hsotg->phy);
 	}
 
 	return ret;
-- 
2.37.2


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

* Re: [PATCH] usb: dwc2: fix wrong order of phy_power_on and phy_init
  2022-08-20 17:45 [PATCH] usb: dwc2: fix wrong order of phy_power_on and phy_init Heiner Kallweit
@ 2022-08-22  9:39 ` Minas Harutyunyan
  2022-08-22 14:55   ` Heiner Kallweit
  0 siblings, 1 reply; 4+ messages in thread
From: Minas Harutyunyan @ 2022-08-22  9:39 UTC (permalink / raw)
  To: Heiner Kallweit, Greg Kroah-Hartman
  Cc: Linux USB Mailing List, Marek Szyprowski

Hi Heiner,

On 8/20/2022 9:45 PM, Heiner Kallweit wrote:
> Since 1599069a62c6 ("phy: core: Warn when phy_power_on is called before
> phy_init") the driver complains. In my case (Amlogic SoC) the warning
> is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init
> So change the order of the two calls.
> 
> Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c")

Added CC: Marek Szyprowski <m.szyprowski@samsung.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
>   drivers/usb/dwc2/platform.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index c8ba87df7..4db7a18a5 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
>   	} else if (hsotg->plat && hsotg->plat->phy_init) {
>   		ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
>   	} else {
> -		ret = phy_power_on(hsotg->phy);
> +		ret = phy_init(hsotg->phy);
>   		if (ret == 0)
> -			ret = phy_init(hsotg->phy);
> +			ret = phy_power_on(hsotg->phy);
>   	}
>   
>   	return ret;

Shouldn't be updated function __dwc2_lowlevel_hw_disable() similarly, 
according: phy_power_off must be called before phy_exit()?

Thanks,
Minas


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

* Re: [PATCH] usb: dwc2: fix wrong order of phy_power_on and phy_init
  2022-08-22  9:39 ` Minas Harutyunyan
@ 2022-08-22 14:55   ` Heiner Kallweit
  2022-08-22 15:16     ` Minas Harutyunyan
  0 siblings, 1 reply; 4+ messages in thread
From: Heiner Kallweit @ 2022-08-22 14:55 UTC (permalink / raw)
  To: Minas Harutyunyan, Greg Kroah-Hartman
  Cc: Linux USB Mailing List, Marek Szyprowski

On 22.08.2022 11:39, Minas Harutyunyan wrote:
> Hi Heiner,
> 
> On 8/20/2022 9:45 PM, Heiner Kallweit wrote:
>> Since 1599069a62c6 ("phy: core: Warn when phy_power_on is called before
>> phy_init") the driver complains. In my case (Amlogic SoC) the warning
>> is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init
>> So change the order of the two calls.
>>
>> Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c")
> 
> Added CC: Marek Szyprowski <m.szyprowski@samsung.com>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>> ---
>>   drivers/usb/dwc2/platform.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
>> index c8ba87df7..4db7a18a5 100644
>> --- a/drivers/usb/dwc2/platform.c
>> +++ b/drivers/usb/dwc2/platform.c
>> @@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
>>   	} else if (hsotg->plat && hsotg->plat->phy_init) {
>>   		ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
>>   	} else {
>> -		ret = phy_power_on(hsotg->phy);
>> +		ret = phy_init(hsotg->phy);
>>   		if (ret == 0)
>> -			ret = phy_init(hsotg->phy);
>> +			ret = phy_power_on(hsotg->phy);
>>   	}
>>   
>>   	return ret;
> 
> Shouldn't be updated function __dwc2_lowlevel_hw_disable() similarly, 
> according: phy_power_off must be called before phy_exit()?
> 
Indeed, this should be changed accordingly.
See kernel doc:

 * phy_exit - Phy internal un-initialization
 * @phy: the phy returned by phy_get()
 *
 * Must be called after phy_power_off().

> Thanks,
> Minas
> 


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

* Re: [PATCH] usb: dwc2: fix wrong order of phy_power_on and phy_init
  2022-08-22 14:55   ` Heiner Kallweit
@ 2022-08-22 15:16     ` Minas Harutyunyan
  0 siblings, 0 replies; 4+ messages in thread
From: Minas Harutyunyan @ 2022-08-22 15:16 UTC (permalink / raw)
  To: Heiner Kallweit, Minas Harutyunyan, Greg Kroah-Hartman
  Cc: Linux USB Mailing List, Marek Szyprowski

On 8/22/2022 6:55 PM, Heiner Kallweit wrote:
> On 22.08.2022 11:39, Minas Harutyunyan wrote:
>> Hi Heiner,
>>
>> On 8/20/2022 9:45 PM, Heiner Kallweit wrote:
>>> Since 1599069a62c6 ("phy: core: Warn when phy_power_on is called before
>>> phy_init") the driver complains. In my case (Amlogic SoC) the warning
>>> is: phy phy-fe03e000.phy.2: phy_power_on was called before phy_init
>>> So change the order of the two calls.
>>>
>>> Fixes: 09a75e857790 ("usb: dwc2: refactor common low-level hw code to platform.c")
>>
>> Added CC: Marek Szyprowski <m.szyprowski@samsung.com>
>>> Cc: stable@vger.kernel.org
>>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
>>> ---
>>>    drivers/usb/dwc2/platform.c | 4 ++--
>>>    1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
>>> index c8ba87df7..4db7a18a5 100644
>>> --- a/drivers/usb/dwc2/platform.c
>>> +++ b/drivers/usb/dwc2/platform.c
>>> @@ -154,9 +154,9 @@ static int __dwc2_lowlevel_hw_enable(struct dwc2_hsotg *hsotg)
>>>    	} else if (hsotg->plat && hsotg->plat->phy_init) {
>>>    		ret = hsotg->plat->phy_init(pdev, hsotg->plat->phy_type);
>>>    	} else {
>>> -		ret = phy_power_on(hsotg->phy);
>>> +		ret = phy_init(hsotg->phy);
>>>    		if (ret == 0)
>>> -			ret = phy_init(hsotg->phy);
>>> +			ret = phy_power_on(hsotg->phy);
>>>    	}
>>>    
>>>    	return ret;
>>
>> Shouldn't be updated function __dwc2_lowlevel_hw_disable() similarly,
>> according: phy_power_off must be called before phy_exit()?
>>
> Indeed, this should be changed accordingly.

Could you please add to your patch fixes for 
__dwc2_lowlevel_hw_disable() too and re-submit.

Thanks,
Minas


> See kernel doc:
> 
>   * phy_exit - Phy internal un-initialization
>   * @phy: the phy returned by phy_get()
>   *
>   * Must be called after phy_power_off().
> 
>> Thanks,
>> Minas
>>
> 


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

end of thread, other threads:[~2022-08-22 15:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-20 17:45 [PATCH] usb: dwc2: fix wrong order of phy_power_on and phy_init Heiner Kallweit
2022-08-22  9:39 ` Minas Harutyunyan
2022-08-22 14:55   ` Heiner Kallweit
2022-08-22 15:16     ` Minas Harutyunyan

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.