linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: xhci: Enable LPM for VIA LABS VL805
@ 2020-01-20 14:24 Nicolas Saenz Julienne
  2020-02-10 18:59 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Saenz Julienne @ 2020-01-20 14:24 UTC (permalink / raw)
  To: Mathias Nyman
  Cc: linux-rpi-kernel, Nicolas Saenz Julienne, Greg Kroah-Hartman,
	linux-usb, linux-kernel

This PCIe controller chip is used on the Raspberry Pi 4 and multiple
adapter cards. There is no publicly available documentation for the
chip, yet both the downstream RPi4 kernel and the controller cards
support/advertise LPM support.

Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
---
 drivers/usb/host/xhci-pci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
index 4917c5b033fa..c1976e98992b 100644
--- a/drivers/usb/host/xhci-pci.c
+++ b/drivers/usb/host/xhci-pci.c
@@ -241,6 +241,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
 			pdev->device == 0x3432)
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
 
+	if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483)
+		xhci->quirks |= XHCI_LPM_SUPPORT;
+
 	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
 			pdev->device == 0x1042)
 		xhci->quirks |= XHCI_BROKEN_STREAMS;
-- 
2.24.1


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

* Re: [PATCH] usb: xhci: Enable LPM for VIA LABS VL805
  2020-01-20 14:24 [PATCH] usb: xhci: Enable LPM for VIA LABS VL805 Nicolas Saenz Julienne
@ 2020-02-10 18:59 ` Greg Kroah-Hartman
  2020-02-11  9:34   ` Mathias Nyman
  0 siblings, 1 reply; 6+ messages in thread
From: Greg Kroah-Hartman @ 2020-02-10 18:59 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Mathias Nyman
  Cc: linux-rpi-kernel, linux-usb, linux-kernel

On Mon, Jan 20, 2020 at 03:24:22PM +0100, Nicolas Saenz Julienne wrote:
> This PCIe controller chip is used on the Raspberry Pi 4 and multiple
> adapter cards. There is no publicly available documentation for the
> chip, yet both the downstream RPi4 kernel and the controller cards
> support/advertise LPM support.
> 
> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> ---
>  drivers/usb/host/xhci-pci.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index 4917c5b033fa..c1976e98992b 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -241,6 +241,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>  			pdev->device == 0x3432)
>  		xhci->quirks |= XHCI_BROKEN_STREAMS;
>  
> +	if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483)
> +		xhci->quirks |= XHCI_LPM_SUPPORT;
> +
>  	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
>  			pdev->device == 0x1042)
>  		xhci->quirks |= XHCI_BROKEN_STREAMS;

Mathias, is this in your review queue?

thanks,

greg k-h

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

* Re: [PATCH] usb: xhci: Enable LPM for VIA LABS VL805
  2020-02-10 18:59 ` Greg Kroah-Hartman
@ 2020-02-11  9:34   ` Mathias Nyman
  2020-02-11  9:49     ` Stefan Wahren
  0 siblings, 1 reply; 6+ messages in thread
From: Mathias Nyman @ 2020-02-11  9:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Nicolas Saenz Julienne, Mathias Nyman
  Cc: linux-rpi-kernel, linux-usb, linux-kernel

On 10.2.2020 20.59, Greg Kroah-Hartman wrote:
> On Mon, Jan 20, 2020 at 03:24:22PM +0100, Nicolas Saenz Julienne wrote:
>> This PCIe controller chip is used on the Raspberry Pi 4 and multiple
>> adapter cards. There is no publicly available documentation for the
>> chip, yet both the downstream RPi4 kernel and the controller cards
>> support/advertise LPM support.
>>
>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
>> ---
>>  drivers/usb/host/xhci-pci.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>> index 4917c5b033fa..c1976e98992b 100644
>> --- a/drivers/usb/host/xhci-pci.c
>> +++ b/drivers/usb/host/xhci-pci.c
>> @@ -241,6 +241,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>>  			pdev->device == 0x3432)
>>  		xhci->quirks |= XHCI_BROKEN_STREAMS;
>>  
>> +	if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483)
>> +		xhci->quirks |= XHCI_LPM_SUPPORT;
>> +
>>  	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
>>  			pdev->device == 0x1042)
>>  		xhci->quirks |= XHCI_BROKEN_STREAMS;
> 
> Mathias, is this in your review queue?
> 

Ah yes, before adding link power management support for this controller we
should check that it has sane (or any) exit latency values set in its
HCSPARAMS3 capability register.

Nicolas, if you have this controller could you show the capability registers:

cat /sys/kernel/debug/usb/xhci/*/reg-cap

-Mathias

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

* Re: [PATCH] usb: xhci: Enable LPM for VIA LABS VL805
  2020-02-11  9:34   ` Mathias Nyman
@ 2020-02-11  9:49     ` Stefan Wahren
  2020-02-11 10:02       ` Nicolas Saenz Julienne
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Wahren @ 2020-02-11  9:49 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman, Nicolas Saenz Julienne, Mathias Nyman
  Cc: linux-usb, linux-rpi-kernel, linux-kernel

Hi Mathias,

On 11.02.20 10:34, Mathias Nyman wrote:
> On 10.2.2020 20.59, Greg Kroah-Hartman wrote:
>> On Mon, Jan 20, 2020 at 03:24:22PM +0100, Nicolas Saenz Julienne wrote:
>>> This PCIe controller chip is used on the Raspberry Pi 4 and multiple
>>> adapter cards. There is no publicly available documentation for the
>>> chip, yet both the downstream RPi4 kernel and the controller cards
>>> support/advertise LPM support.
>>>
>>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
>>> ---
>>>  drivers/usb/host/xhci-pci.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>>> index 4917c5b033fa..c1976e98992b 100644
>>> --- a/drivers/usb/host/xhci-pci.c
>>> +++ b/drivers/usb/host/xhci-pci.c
>>> @@ -241,6 +241,9 @@ static void xhci_pci_quirks(struct device *dev, struct xhci_hcd *xhci)
>>>  			pdev->device == 0x3432)
>>>  		xhci->quirks |= XHCI_BROKEN_STREAMS;
>>>  
>>> +	if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483)
>>> +		xhci->quirks |= XHCI_LPM_SUPPORT;
>>> +
>>>  	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
>>>  			pdev->device == 0x1042)
>>>  		xhci->quirks |= XHCI_BROKEN_STREAMS;
>> Mathias, is this in your review queue?
>>
> Ah yes, before adding link power management support for this controller we
> should check that it has sane (or any) exit latency values set in its
> HCSPARAMS3 capability register.
>
> Nicolas, if you have this controller could you show the capability registers:
>
> cat /sys/kernel/debug/usb/xhci/*/reg-cap
sorry for the naive question, but do you need the dump with or without
this patch applied?
>
> -Mathias
>
> _______________________________________________
> linux-rpi-kernel mailing list
> linux-rpi-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-rpi-kernel

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

* Re: [PATCH] usb: xhci: Enable LPM for VIA LABS VL805
  2020-02-11  9:49     ` Stefan Wahren
@ 2020-02-11 10:02       ` Nicolas Saenz Julienne
  2020-02-11 12:13         ` Mathias Nyman
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Saenz Julienne @ 2020-02-11 10:02 UTC (permalink / raw)
  To: Stefan Wahren, Mathias Nyman, Greg Kroah-Hartman, Mathias Nyman
  Cc: linux-usb, linux-rpi-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2625 bytes --]

Hi Stefan, Mathias.

On Tue, 2020-02-11 at 10:49 +0100, Stefan Wahren wrote:
> Hi Mathias,
> 
> On 11.02.20 10:34, Mathias Nyman wrote:
> > On 10.2.2020 20.59, Greg Kroah-Hartman wrote:
> > > On Mon, Jan 20, 2020 at 03:24:22PM +0100, Nicolas Saenz Julienne wrote:
> > > > This PCIe controller chip is used on the Raspberry Pi 4 and multiple
> > > > adapter cards. There is no publicly available documentation for the
> > > > chip, yet both the downstream RPi4 kernel and the controller cards
> > > > support/advertise LPM support.
> > > > 
> > > > Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
> > > > ---
> > > >  drivers/usb/host/xhci-pci.c | 3 +++
> > > >  1 file changed, 3 insertions(+)
> > > > 
> > > > diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> > > > index 4917c5b033fa..c1976e98992b 100644
> > > > --- a/drivers/usb/host/xhci-pci.c
> > > > +++ b/drivers/usb/host/xhci-pci.c
> > > > @@ -241,6 +241,9 @@ static void xhci_pci_quirks(struct device *dev,
> > > > struct xhci_hcd *xhci)
> > > >  			pdev->device == 0x3432)
> > > >  		xhci->quirks |= XHCI_BROKEN_STREAMS;
> > > >  
> > > > +	if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483)
> > > > +		xhci->quirks |= XHCI_LPM_SUPPORT;
> > > > +
> > > >  	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
> > > >  			pdev->device == 0x1042)
> > > >  		xhci->quirks |= XHCI_BROKEN_STREAMS;
> > > Mathias, is this in your review queue?
> > > 
> > Ah yes, before adding link power management support for this controller we
> > should check that it has sane (or any) exit latency values set in its
> > HCSPARAMS3 capability register.

I did some checks myself before sending the patch, and tested with some devices
I own. The latencies seemd reasonable. For example I just hooked up an USB3 HD,
the root HUB exposes:

	bU1DevExitLat           4 micro seconds
	bU2DevExitLat         231 micro seconds

And xhci configured the device with:

	bU1DevExitLat          10 micro seconds
	bU2DevExitLat        2047 micro seconds

> > Nicolas, if you have this controller could you show the capability
> > registers:
> > 
> > cat /sys/kernel/debug/usb/xhci/*/reg-cap

CAPLENGTH = 0x01000020
HCSPARAMS1 = 0x05000420
HCSPARAMS2 = 0xfc000031
HCSPARAMS3 = 0x00e70004
HCCPARAMS1 = 0x002841eb
DOORBELLOFF = 0x00000100
RUNTIMEOFF = 0x00000200
HCCPARAMS2 = 0x00000000

> sorry for the naive question, but do you need the dump with or without
> this patch applied?

IIRC these are dumps from xhci's extended registers. Shouldn't matter at all. 

Regards,
Nicolas


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] usb: xhci: Enable LPM for VIA LABS VL805
  2020-02-11 10:02       ` Nicolas Saenz Julienne
@ 2020-02-11 12:13         ` Mathias Nyman
  0 siblings, 0 replies; 6+ messages in thread
From: Mathias Nyman @ 2020-02-11 12:13 UTC (permalink / raw)
  To: Nicolas Saenz Julienne, Stefan Wahren, Greg Kroah-Hartman, Mathias Nyman
  Cc: linux-usb, linux-rpi-kernel, linux-kernel

On 11.2.2020 12.02, Nicolas Saenz Julienne wrote:
> Hi Stefan, Mathias.
> 
> On Tue, 2020-02-11 at 10:49 +0100, Stefan Wahren wrote:
>> Hi Mathias,
>>
>> On 11.02.20 10:34, Mathias Nyman wrote:
>>> On 10.2.2020 20.59, Greg Kroah-Hartman wrote:
>>>> On Mon, Jan 20, 2020 at 03:24:22PM +0100, Nicolas Saenz Julienne wrote:
>>>>> This PCIe controller chip is used on the Raspberry Pi 4 and multiple
>>>>> adapter cards. There is no publicly available documentation for the
>>>>> chip, yet both the downstream RPi4 kernel and the controller cards
>>>>> support/advertise LPM support.
>>>>>
>>>>> Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
>>>>> ---
>>>>>  drivers/usb/host/xhci-pci.c | 3 +++
>>>>>  1 file changed, 3 insertions(+)
>>>>>
>>>>> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
>>>>> index 4917c5b033fa..c1976e98992b 100644
>>>>> --- a/drivers/usb/host/xhci-pci.c
>>>>> +++ b/drivers/usb/host/xhci-pci.c
>>>>> @@ -241,6 +241,9 @@ static void xhci_pci_quirks(struct device *dev,
>>>>> struct xhci_hcd *xhci)
>>>>>  			pdev->device == 0x3432)
>>>>>  		xhci->quirks |= XHCI_BROKEN_STREAMS;
>>>>>  
>>>>> +	if (pdev->vendor == PCI_VENDOR_ID_VIA && pdev->device == 0x3483)
>>>>> +		xhci->quirks |= XHCI_LPM_SUPPORT;
>>>>> +
>>>>>  	if (pdev->vendor == PCI_VENDOR_ID_ASMEDIA &&
>>>>>  			pdev->device == 0x1042)
>>>>>  		xhci->quirks |= XHCI_BROKEN_STREAMS;
>>>> Mathias, is this in your review queue?
>>>>
>>> Ah yes, before adding link power management support for this controller we
>>> should check that it has sane (or any) exit latency values set in its
>>> HCSPARAMS3 capability register.
> 
> I did some checks myself before sending the patch, and tested with some devices
> I own. The latencies seemd reasonable. For example I just hooked up an USB3 HD,
> the root HUB exposes:
> 
> 	bU1DevExitLat           4 micro seconds
> 	bU2DevExitLat         231 micro seconds
> 
> And xhci configured the device with:
> 
> 	bU1DevExitLat          10 micro seconds
> 	bU2DevExitLat        2047 micro seconds
> 
>>> Nicolas, if you have this controller could you show the capability
>>> registers:
>>>
>>> cat /sys/kernel/debug/usb/xhci/*/reg-cap
> 
> CAPLENGTH = 0x01000020
> HCSPARAMS1 = 0x05000420
> HCSPARAMS2 = 0xfc000031
> HCSPARAMS3 = 0x00e70004

Thanks, looks sane, U1 Device exit latency is 4us, and U2 is 231us, and as
showed above these were set correctly to the roothub.

Greg, if you want you can pick this patch as is, otherwise I'll send it later
with other usb-next patches.

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>

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

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

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 14:24 [PATCH] usb: xhci: Enable LPM for VIA LABS VL805 Nicolas Saenz Julienne
2020-02-10 18:59 ` Greg Kroah-Hartman
2020-02-11  9:34   ` Mathias Nyman
2020-02-11  9:49     ` Stefan Wahren
2020-02-11 10:02       ` Nicolas Saenz Julienne
2020-02-11 12:13         ` Mathias Nyman

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).