linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: host: xhci: plat: check hcc_params after add hcd
@ 2017-01-13  3:18 William Wu
  2017-01-13 11:02 ` Roger Quadros
  0 siblings, 1 reply; 3+ messages in thread
From: William Wu @ 2017-01-13  3:18 UTC (permalink / raw)
  To: gregkh
  Cc: heiko, linux-kernel, linux-usb, linux-rockchip, frank.wang,
	huangtao, dianders, groeck, william.wu, rogerq, stern

From: William wu <william.wu@rock-chips.com>

The commit 4ac53087d6d4 ("usb: xhci: plat: Create both
HCDs before adding them") move add hcd to the end of
probe, this cause hcc_params uninitiated, because xHCI
driver sets hcc_params in xhci_gen_setup() called from
usb_add_hcd().

This patch checks the Maximum Primary Stream Array Size
in the hcc_params register after add hcd.

Signed-off-by: William wu <william.wu@rock-chips.com>
---
 drivers/usb/host/xhci-plat.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index ddfab30..52ce697 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -232,9 +232,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	if (device_property_read_bool(&pdev->dev, "usb3-lpm-capable"))
 		xhci->quirks |= XHCI_LPM_SUPPORT;
 
-	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
-		xhci->shared_hcd->can_do_streams = 1;
-
 	hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
 	if (IS_ERR(hcd->usb_phy)) {
 		ret = PTR_ERR(hcd->usb_phy);
@@ -255,6 +252,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
 	if (ret)
 		goto dealloc_usb2_hcd;
 
+	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
+		xhci->shared_hcd->can_do_streams = 1;
+
 	return 0;
 
 
-- 
2.7.4

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

* Re: [PATCH] usb: host: xhci: plat: check hcc_params after add hcd
  2017-01-13  3:18 [PATCH] usb: host: xhci: plat: check hcc_params after add hcd William Wu
@ 2017-01-13 11:02 ` Roger Quadros
  2017-01-16  6:43   ` wlf
  0 siblings, 1 reply; 3+ messages in thread
From: Roger Quadros @ 2017-01-13 11:02 UTC (permalink / raw)
  To: William Wu, gregkh
  Cc: heiko, linux-kernel, linux-usb, linux-rockchip, frank.wang,
	huangtao, dianders, groeck, stern

Hi,

On 13/01/17 05:18, William Wu wrote:
> From: William wu <william.wu@rock-chips.com>
> 
> The commit 4ac53087d6d4 ("usb: xhci: plat: Create both
> HCDs before adding them") move add hcd to the end of
> probe, this cause hcc_params uninitiated, because xHCI
> driver sets hcc_params in xhci_gen_setup() called from
> usb_add_hcd().
> 
> This patch checks the Maximum Primary Stream Array Size
> in the hcc_params register after add hcd.
> 
> Signed-off-by: William wu <william.wu@rock-chips.com>
> ---
>  drivers/usb/host/xhci-plat.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index ddfab30..52ce697 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -232,9 +232,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  	if (device_property_read_bool(&pdev->dev, "usb3-lpm-capable"))
>  		xhci->quirks |= XHCI_LPM_SUPPORT;
>  
> -	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
> -		xhci->shared_hcd->can_do_streams = 1;
> -
>  	hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
>  	if (IS_ERR(hcd->usb_phy)) {
>  		ret = PTR_ERR(hcd->usb_phy);
> @@ -255,6 +252,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto dealloc_usb2_hcd;
>  
> +	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
> +		xhci->shared_hcd->can_do_streams = 1;
> +

xhci->hcc_params is initialized after the first usb_add_hcd().
Should this bit come before the usb_add_hcd(xhci->shared_hcd,..)?

You will also need to copy to v4.2+ <stable@vger.kernel.org>. Thanks.

>  	return 0;
>  
>  
> 

cheers,
-roger

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

* Re: [PATCH] usb: host: xhci: plat: check hcc_params after add hcd
  2017-01-13 11:02 ` Roger Quadros
@ 2017-01-16  6:43   ` wlf
  0 siblings, 0 replies; 3+ messages in thread
From: wlf @ 2017-01-16  6:43 UTC (permalink / raw)
  To: Roger Quadros, William Wu, gregkh
  Cc: heiko, linux-kernel, linux-usb, linux-rockchip, frank.wang,
	huangtao, dianders, groeck, stern

Hi Roger,

在 2017年01月13日 19:02, Roger Quadros 写道:
> Hi,
>
> On 13/01/17 05:18, William Wu wrote:
>> From: William wu <william.wu@rock-chips.com>
>>
>> The commit 4ac53087d6d4 ("usb: xhci: plat: Create both
>> HCDs before adding them") move add hcd to the end of
>> probe, this cause hcc_params uninitiated, because xHCI
>> driver sets hcc_params in xhci_gen_setup() called from
>> usb_add_hcd().
>>
>> This patch checks the Maximum Primary Stream Array Size
>> in the hcc_params register after add hcd.
>>
>> Signed-off-by: William wu <william.wu@rock-chips.com>
>> ---
>>   drivers/usb/host/xhci-plat.c | 6 +++---
>>   1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> index ddfab30..52ce697 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -232,9 +232,6 @@ static int xhci_plat_probe(struct platform_device *pdev)
>>   	if (device_property_read_bool(&pdev->dev, "usb3-lpm-capable"))
>>   		xhci->quirks |= XHCI_LPM_SUPPORT;
>>   
>> -	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
>> -		xhci->shared_hcd->can_do_streams = 1;
>> -
>>   	hcd->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "usb-phy", 0);
>>   	if (IS_ERR(hcd->usb_phy)) {
>>   		ret = PTR_ERR(hcd->usb_phy);
>> @@ -255,6 +252,9 @@ static int xhci_plat_probe(struct platform_device *pdev)
>>   	if (ret)
>>   		goto dealloc_usb2_hcd;
>>   
>> +	if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
>> +		xhci->shared_hcd->can_do_streams = 1;
>> +
> xhci->hcc_params is initialized after the first usb_add_hcd().
> Should this bit come before the usb_add_hcd(xhci->shared_hcd,..)?
Yes, good idea!I will move it behind the first usb_add_hcd().
>
> You will also need to copy to v4.2+ <stable@vger.kernel.org>. Thanks.
OK, thank you for reminding me!
>
>>   	return 0;
>>   
>>   
>>
> cheers,
> -roger
>
>
>

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

end of thread, other threads:[~2017-01-16  6:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-13  3:18 [PATCH] usb: host: xhci: plat: check hcc_params after add hcd William Wu
2017-01-13 11:02 ` Roger Quadros
2017-01-16  6:43   ` wlf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).