diff mbox series

[v2] usb: dwc2: Use generic PHY width in params setup

Message ID 20190509091528.28397-1-jmaselbas@kalray.eu (mailing list archive)
State Mainlined
Commit 42de8afc40c97002fceb500e2331f6a722be3c14
Headers show
Series [v2] usb: dwc2: Use generic PHY width in params setup | expand

Commit Message

Jules Maselbas May 9, 2019, 9:15 a.m. UTC
Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless since
it's value will be overwritten by dwc2_init_params().

This change make sure to take in account the generic PHY width information
during paraminitialisation, done in dwc2_set_param_phy_utmi_width().

By doing so, the phy_utmi_width params can still be overrided by
devicetree specific params and will also be checked against hardware
capabilities.

Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
---
v2: Fix typo in commit message. Add Fixes and Tested-by tags.
---
 drivers/usb/dwc2/params.c   | 9 +++++++++
 drivers/usb/dwc2/platform.c | 9 ---------
 2 files changed, 9 insertions(+), 9 deletions(-)

Comments

Jules Maselbas May 31, 2019, 12:22 p.m. UTC | #1
Hi Minas,

This is a reminder in case you missed this patch.

Kind regards,
Jules

On Thu, May 09, 2019 at 11:15:28AM +0200, Jules Maselbas wrote:
> Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless since
> it's value will be overwritten by dwc2_init_params().
> 
> This change make sure to take in account the generic PHY width information
> during paraminitialisation, done in dwc2_set_param_phy_utmi_width().
> 
> By doing so, the phy_utmi_width params can still be overrided by
> devicetree specific params and will also be checked against hardware
> capabilities.
> 
> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
> ---
> v2: Fix typo in commit message. Add Fixes and Tested-by tags.
> ---
>  drivers/usb/dwc2/params.c   | 9 +++++++++
>  drivers/usb/dwc2/platform.c | 9 ---------
>  2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index 6900eea57526..5949262ff669 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -253,6 +253,15 @@ static void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg)
>  	val = (hsotg->hw_params.utmi_phy_data_width ==
>  	       GHWCFG4_UTMI_PHY_DATA_WIDTH_8) ? 8 : 16;
>  
> +	if (hsotg->phy) {
> +		/*
> +		 * If using the generic PHY framework, check if the PHY bus
> +		 * width is 8-bit and set the phyif appropriately.
> +		 */
> +		if (phy_get_bus_width(hsotg->phy) == 8)
> +			val = 8;
> +	}
> +
>  	hsotg->params.phy_utmi_width = val;
>  }
>  
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index d10a7f8daec3..e98d7812da2d 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -271,15 +271,6 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
>  
>  	hsotg->plat = dev_get_platdata(hsotg->dev);
>  
> -	if (hsotg->phy) {
> -		/*
> -		 * If using the generic PHY framework, check if the PHY bus
> -		 * width is 8-bit and set the phyif appropriately.
> -		 */
> -		if (phy_get_bus_width(hsotg->phy) == 8)
> -			hsotg->params.phy_utmi_width = 8;
> -	}
> -
>  	/* Clock */
>  	hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
>  	if (IS_ERR(hsotg->clk)) {
> -- 
> 2.21.0.196.g041f5ea
>
Minas Harutyunyan May 31, 2019, 12:44 p.m. UTC | #2
On 5/9/2019 1:16 PM, Jules Maselbas wrote:
> Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless since
> it's value will be overwritten by dwc2_init_params().
> 
> This change make sure to take in account the generic PHY width information
> during paraminitialisation, done in dwc2_set_param_phy_utmi_width().
> 
> By doing so, the phy_utmi_width params can still be overrided by
> devicetree specific params and will also be checked against hardware
> capabilities.
> 
> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with phy_utmi_width")
> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>

Acked-by: Minas Harutyunyan <hminas@synopsys.com>

> ---
> v2: Fix typo in commit message. Add Fixes and Tested-by tags.
> ---
>   drivers/usb/dwc2/params.c   | 9 +++++++++
>   drivers/usb/dwc2/platform.c | 9 ---------
>   2 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
> index 6900eea57526..5949262ff669 100644
> --- a/drivers/usb/dwc2/params.c
> +++ b/drivers/usb/dwc2/params.c
> @@ -253,6 +253,15 @@ static void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg)
>   	val = (hsotg->hw_params.utmi_phy_data_width ==
>   	       GHWCFG4_UTMI_PHY_DATA_WIDTH_8) ? 8 : 16;
>   
> +	if (hsotg->phy) {
> +		/*
> +		 * If using the generic PHY framework, check if the PHY bus
> +		 * width is 8-bit and set the phyif appropriately.
> +		 */
> +		if (phy_get_bus_width(hsotg->phy) == 8)
> +			val = 8;
> +	}
> +
>   	hsotg->params.phy_utmi_width = val;
>   }
>   
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index d10a7f8daec3..e98d7812da2d 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -271,15 +271,6 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
>   
>   	hsotg->plat = dev_get_platdata(hsotg->dev);
>   
> -	if (hsotg->phy) {
> -		/*
> -		 * If using the generic PHY framework, check if the PHY bus
> -		 * width is 8-bit and set the phyif appropriately.
> -		 */
> -		if (phy_get_bus_width(hsotg->phy) == 8)
> -			hsotg->params.phy_utmi_width = 8;
> -	}
> -
>   	/* Clock */
>   	hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
>   	if (IS_ERR(hsotg->clk)) {
>
Marek Szyprowski June 6, 2019, 10:13 a.m. UTC | #3
Hi All,

On 2019-05-31 14:44, Minas Harutyunyan wrote:
> On 5/9/2019 1:16 PM, Jules Maselbas wrote:
>> Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless 
>> since
>> it's value will be overwritten by dwc2_init_params().
>>
>> This change make sure to take in account the generic PHY width 
>> information
>> during paraminitialisation, done in dwc2_set_param_phy_utmi_width().
>>
>> By doing so, the phy_utmi_width params can still be overrided by
>> devicetree specific params and will also be checked against hardware
>> capabilities.
>>
>> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with 
>> phy_utmi_width")
>> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
>
> Acked-by: Minas Harutyunyan <hminas@synopsys.com>

Gentle reminder, Felipe, could you take this to the fixes for v5.2?

>> ---
>> v2: Fix typo in commit message. Add Fixes and Tested-by tags.
>> ---
>>   drivers/usb/dwc2/params.c   | 9 +++++++++
>>   drivers/usb/dwc2/platform.c | 9 ---------
>>   2 files changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
>> index 6900eea57526..5949262ff669 100644
>> --- a/drivers/usb/dwc2/params.c
>> +++ b/drivers/usb/dwc2/params.c
>> @@ -253,6 +253,15 @@ static void dwc2_set_param_phy_utmi_width(struct 
>> dwc2_hsotg *hsotg)
>>       val = (hsotg->hw_params.utmi_phy_data_width ==
>>              GHWCFG4_UTMI_PHY_DATA_WIDTH_8) ? 8 : 16;
>>   +    if (hsotg->phy) {
>> +        /*
>> +         * If using the generic PHY framework, check if the PHY bus
>> +         * width is 8-bit and set the phyif appropriately.
>> +         */
>> +        if (phy_get_bus_width(hsotg->phy) == 8)
>> +            val = 8;
>> +    }
>> +
>>       hsotg->params.phy_utmi_width = val;
>>   }
>>   diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
>> index d10a7f8daec3..e98d7812da2d 100644
>> --- a/drivers/usb/dwc2/platform.c
>> +++ b/drivers/usb/dwc2/platform.c
>> @@ -271,15 +271,6 @@ static int dwc2_lowlevel_hw_init(struct 
>> dwc2_hsotg *hsotg)
>>         hsotg->plat = dev_get_platdata(hsotg->dev);
>>   -    if (hsotg->phy) {
>> -        /*
>> -         * If using the generic PHY framework, check if the PHY bus
>> -         * width is 8-bit and set the phyif appropriately.
>> -         */
>> -        if (phy_get_bus_width(hsotg->phy) == 8)
>> -            hsotg->params.phy_utmi_width = 8;
>> -    }
>> -
>>       /* Clock */
>>       hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
>>       if (IS_ERR(hsotg->clk)) {
>>
>
>
>
Best regards
Felipe Balbi June 18, 2019, 7:26 a.m. UTC | #4
Hi,

Marek Szyprowski <m.szyprowski@samsung.com> writes:
> Hi All,
>
> On 2019-05-31 14:44, Minas Harutyunyan wrote:
>> On 5/9/2019 1:16 PM, Jules Maselbas wrote:
>>> Setting params.phy_utmi_width in dwc2_lowlevel_hw_init() is pointless 
>>> since
>>> it's value will be overwritten by dwc2_init_params().
>>>
>>> This change make sure to take in account the generic PHY width 
>>> information
>>> during paraminitialisation, done in dwc2_set_param_phy_utmi_width().
>>>
>>> By doing so, the phy_utmi_width params can still be overrided by
>>> devicetree specific params and will also be checked against hardware
>>> capabilities.
>>>
>>> Fixes: 707d80f0a3c5 ("usb: dwc2: gadget: Replace phyif with 
>>> phy_utmi_width")
>>> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
>>> Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
>>
>> Acked-by: Minas Harutyunyan <hminas@synopsys.com>
>
> Gentle reminder, Felipe, could you take this to the fixes for v5.2?

darn it, I applied for 'next'. I'll remove from that branch and place it
in fixes. Pull request, hopefully, tomorrow.
diff mbox series

Patch

diff --git a/drivers/usb/dwc2/params.c b/drivers/usb/dwc2/params.c
index 6900eea57526..5949262ff669 100644
--- a/drivers/usb/dwc2/params.c
+++ b/drivers/usb/dwc2/params.c
@@ -253,6 +253,15 @@  static void dwc2_set_param_phy_utmi_width(struct dwc2_hsotg *hsotg)
 	val = (hsotg->hw_params.utmi_phy_data_width ==
 	       GHWCFG4_UTMI_PHY_DATA_WIDTH_8) ? 8 : 16;
 
+	if (hsotg->phy) {
+		/*
+		 * If using the generic PHY framework, check if the PHY bus
+		 * width is 8-bit and set the phyif appropriately.
+		 */
+		if (phy_get_bus_width(hsotg->phy) == 8)
+			val = 8;
+	}
+
 	hsotg->params.phy_utmi_width = val;
 }
 
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index d10a7f8daec3..e98d7812da2d 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -271,15 +271,6 @@  static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
 
 	hsotg->plat = dev_get_platdata(hsotg->dev);
 
-	if (hsotg->phy) {
-		/*
-		 * If using the generic PHY framework, check if the PHY bus
-		 * width is 8-bit and set the phyif appropriately.
-		 */
-		if (phy_get_bus_width(hsotg->phy) == 8)
-			hsotg->params.phy_utmi_width = 8;
-	}
-
 	/* Clock */
 	hsotg->clk = devm_clk_get_optional(hsotg->dev, "otg");
 	if (IS_ERR(hsotg->clk)) {