public inbox for linux-usb@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
@ 2025-01-31 10:06 Huacai Chen
  2025-01-31 10:48 ` Greg Kroah-Hartman
  2025-01-31 15:18 ` Alan Stern
  0 siblings, 2 replies; 5+ messages in thread
From: Huacai Chen @ 2025-01-31 10:06 UTC (permalink / raw)
  To: Huacai Chen, Greg Kroah-Hartman
  Cc: Alan Stern, linux-usb, linux-kernel, Huacai Chen, stable,
	Baoqi Zhang

LS7A EHCI controller doesn't have extended capabilities, so the EECP
(EHCI Extended Capabilities Pointer) field of HCCPARAMS register should
be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be
fixed in future, now just clear the EECP field to avoid error messages
on boot:

......
[    0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff
[    0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff
[    0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff
[    0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff
......
[    0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff
[    0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff
[    0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff
[    0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
......

Cc: stable@vger.kernel.org
Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
---
 drivers/usb/host/pci-quirks.c | 4 ++++
 include/linux/pci_ids.h       | 1 +
 2 files changed, 5 insertions(+)

diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 1f9c1b1435d8..7e3151400a5e 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -958,6 +958,10 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev)
 	 * booting from USB disk or using a usb keyboard
 	 */
 	hcc_params = readl(base + EHCI_HCC_PARAMS);
+	if (pdev->vendor == PCI_VENDOR_ID_LOONGSON &&
+	    pdev->device == PCI_DEVICE_ID_LOONGSON_EHCI)
+		hcc_params &= ~(0xffL << 8);
+
 	offset = (hcc_params >> 8) & 0xff;
 	while (offset && --count) {
 		pci_read_config_dword(pdev, offset, &cap);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index de5deb1a0118..74a84834d9eb 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -162,6 +162,7 @@
 
 #define PCI_VENDOR_ID_LOONGSON		0x0014
 
+#define PCI_DEVICE_ID_LOONGSON_EHCI     0x7a14
 #define PCI_DEVICE_ID_LOONGSON_HDA      0x7a07
 #define PCI_DEVICE_ID_LOONGSON_HDMI     0x7a37
 
-- 
2.47.1


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

* Re: [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
  2025-01-31 10:06 [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI Huacai Chen
@ 2025-01-31 10:48 ` Greg Kroah-Hartman
  2025-01-31 14:28   ` Huacai Chen
  2025-01-31 15:18 ` Alan Stern
  1 sibling, 1 reply; 5+ messages in thread
From: Greg Kroah-Hartman @ 2025-01-31 10:48 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Huacai Chen, Alan Stern, linux-usb, linux-kernel, stable,
	Baoqi Zhang

On Fri, Jan 31, 2025 at 06:06:51PM +0800, Huacai Chen wrote:
> LS7A EHCI controller doesn't have extended capabilities, so the EECP
> (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should
> be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be
> fixed in future, now just clear the EECP field to avoid error messages
> on boot:
> 
> ......
> [    0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff
> [    0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff
> [    0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff
> [    0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff
> ......
> [    0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff
> [    0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff
> [    0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff
> [    0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
> ......
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  drivers/usb/host/pci-quirks.c | 4 ++++
>  include/linux/pci_ids.h       | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index 1f9c1b1435d8..7e3151400a5e 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -958,6 +958,10 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev)
>  	 * booting from USB disk or using a usb keyboard
>  	 */
>  	hcc_params = readl(base + EHCI_HCC_PARAMS);
> +	if (pdev->vendor == PCI_VENDOR_ID_LOONGSON &&
> +	    pdev->device == PCI_DEVICE_ID_LOONGSON_EHCI)
> +		hcc_params &= ~(0xffL << 8);
> +
>  	offset = (hcc_params >> 8) & 0xff;
>  	while (offset && --count) {
>  		pci_read_config_dword(pdev, offset, &cap);
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index de5deb1a0118..74a84834d9eb 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -162,6 +162,7 @@
>  
>  #define PCI_VENDOR_ID_LOONGSON		0x0014
>  
> +#define PCI_DEVICE_ID_LOONGSON_EHCI     0x7a14

If you read the top of this file, does this patch meet the requirement
to add this entry here to this file?

thanks,

greg k-h

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

* Re: [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
  2025-01-31 10:48 ` Greg Kroah-Hartman
@ 2025-01-31 14:28   ` Huacai Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Huacai Chen @ 2025-01-31 14:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Huacai Chen, Alan Stern, linux-usb, linux-kernel, stable,
	Baoqi Zhang

Hi, Greg,

On Fri, Jan 31, 2025 at 6:48 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> On Fri, Jan 31, 2025 at 06:06:51PM +0800, Huacai Chen wrote:
> > LS7A EHCI controller doesn't have extended capabilities, so the EECP
> > (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should
> > be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be
> > fixed in future, now just clear the EECP field to avoid error messages
> > on boot:
> >
> > ......
> > [    0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > [    0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > [    0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > [    0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > ......
> > [    0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > [    0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > [    0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > [    0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > ......
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> >  drivers/usb/host/pci-quirks.c | 4 ++++
> >  include/linux/pci_ids.h       | 1 +
> >  2 files changed, 5 insertions(+)
> >
> > diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> > index 1f9c1b1435d8..7e3151400a5e 100644
> > --- a/drivers/usb/host/pci-quirks.c
> > +++ b/drivers/usb/host/pci-quirks.c
> > @@ -958,6 +958,10 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev)
> >        * booting from USB disk or using a usb keyboard
> >        */
> >       hcc_params = readl(base + EHCI_HCC_PARAMS);
> > +     if (pdev->vendor == PCI_VENDOR_ID_LOONGSON &&
> > +         pdev->device == PCI_DEVICE_ID_LOONGSON_EHCI)
> > +             hcc_params &= ~(0xffL << 8);
> > +
> >       offset = (hcc_params >> 8) & 0xff;
> >       while (offset && --count) {
> >               pci_read_config_dword(pdev, offset, &cap);
> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> > index de5deb1a0118..74a84834d9eb 100644
> > --- a/include/linux/pci_ids.h
> > +++ b/include/linux/pci_ids.h
> > @@ -162,6 +162,7 @@
> >
> >  #define PCI_VENDOR_ID_LOONGSON               0x0014
> >
> > +#define PCI_DEVICE_ID_LOONGSON_EHCI     0x7a14
>
> If you read the top of this file, does this patch meet the requirement
> to add this entry here to this file?
Emmm, the device id is also used in
drivers/pci/controller/pci-loongson.c, but uses another code style so
it is not suitable to share the definition. Maybe the best solution is
use 0x7a14 directly.

Huacai
>
> thanks,
>
> greg k-h

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

* Re: [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
  2025-01-31 10:06 [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI Huacai Chen
  2025-01-31 10:48 ` Greg Kroah-Hartman
@ 2025-01-31 15:18 ` Alan Stern
  2025-02-01  6:18   ` Huacai Chen
  1 sibling, 1 reply; 5+ messages in thread
From: Alan Stern @ 2025-01-31 15:18 UTC (permalink / raw)
  To: Huacai Chen
  Cc: Huacai Chen, Greg Kroah-Hartman, linux-usb, linux-kernel, stable,
	Baoqi Zhang

On Fri, Jan 31, 2025 at 06:06:51PM +0800, Huacai Chen wrote:
> LS7A EHCI controller doesn't have extended capabilities, so the EECP
> (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should
> be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be
> fixed in future, now just clear the EECP field to avoid error messages
> on boot:
> 
> ......
> [    0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff
> [    0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff
> [    0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff
> [    0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff
> ......
> [    0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff
> [    0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff
> [    0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff
> [    0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
> ......
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> ---
>  drivers/usb/host/pci-quirks.c | 4 ++++
>  include/linux/pci_ids.h       | 1 +
>  2 files changed, 5 insertions(+)
> 
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index 1f9c1b1435d8..7e3151400a5e 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -958,6 +958,10 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev)
>  	 * booting from USB disk or using a usb keyboard
>  	 */
>  	hcc_params = readl(base + EHCI_HCC_PARAMS);
> +	if (pdev->vendor == PCI_VENDOR_ID_LOONGSON &&
> +	    pdev->device == PCI_DEVICE_ID_LOONGSON_EHCI)
> +		hcc_params &= ~(0xffL << 8);

Can you please add a comment before this "if" statement explaining why 
it is necessary?

Alan Stern

> +
>  	offset = (hcc_params >> 8) & 0xff;
>  	while (offset && --count) {
>  		pci_read_config_dword(pdev, offset, &cap);
> diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> index de5deb1a0118..74a84834d9eb 100644
> --- a/include/linux/pci_ids.h
> +++ b/include/linux/pci_ids.h
> @@ -162,6 +162,7 @@
>  
>  #define PCI_VENDOR_ID_LOONGSON		0x0014
>  
> +#define PCI_DEVICE_ID_LOONGSON_EHCI     0x7a14
>  #define PCI_DEVICE_ID_LOONGSON_HDA      0x7a07
>  #define PCI_DEVICE_ID_LOONGSON_HDMI     0x7a37
>  
> -- 
> 2.47.1
> 

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

* Re: [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI
  2025-01-31 15:18 ` Alan Stern
@ 2025-02-01  6:18   ` Huacai Chen
  0 siblings, 0 replies; 5+ messages in thread
From: Huacai Chen @ 2025-02-01  6:18 UTC (permalink / raw)
  To: Alan Stern
  Cc: Huacai Chen, Greg Kroah-Hartman, linux-usb, linux-kernel, stable,
	Baoqi Zhang

Hi, Alan,

On Fri, Jan 31, 2025 at 11:18 PM Alan Stern <stern@rowland.harvard.edu> wrote:
>
> On Fri, Jan 31, 2025 at 06:06:51PM +0800, Huacai Chen wrote:
> > LS7A EHCI controller doesn't have extended capabilities, so the EECP
> > (EHCI Extended Capabilities Pointer) field of HCCPARAMS register should
> > be 0x0, but it reads as 0xa0 now. This is a hardware flaw and will be
> > fixed in future, now just clear the EECP field to avoid error messages
> > on boot:
> >
> > ......
> > [    0.581675] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > [    0.581699] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > [    0.581716] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > [    0.581851] pci 0000:00:04.1: EHCI: unrecognized capability ff
> > ......
> > [    0.581916] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > [    0.581951] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > [    0.582704] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > [    0.582799] pci 0000:00:05.1: EHCI: unrecognized capability ff
> > ......
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
> > Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
> > ---
> >  drivers/usb/host/pci-quirks.c | 4 ++++
> >  include/linux/pci_ids.h       | 1 +
> >  2 files changed, 5 insertions(+)
> >
> > diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> > index 1f9c1b1435d8..7e3151400a5e 100644
> > --- a/drivers/usb/host/pci-quirks.c
> > +++ b/drivers/usb/host/pci-quirks.c
> > @@ -958,6 +958,10 @@ static void quirk_usb_disable_ehci(struct pci_dev *pdev)
> >        * booting from USB disk or using a usb keyboard
> >        */
> >       hcc_params = readl(base + EHCI_HCC_PARAMS);
> > +     if (pdev->vendor == PCI_VENDOR_ID_LOONGSON &&
> > +         pdev->device == PCI_DEVICE_ID_LOONGSON_EHCI)
> > +             hcc_params &= ~(0xffL << 8);
>
> Can you please add a comment before this "if" statement explaining why
> it is necessary?
OK, will do in next version.

Huacai
>
> Alan Stern
>
> > +
> >       offset = (hcc_params >> 8) & 0xff;
> >       while (offset && --count) {
> >               pci_read_config_dword(pdev, offset, &cap);
> > diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
> > index de5deb1a0118..74a84834d9eb 100644
> > --- a/include/linux/pci_ids.h
> > +++ b/include/linux/pci_ids.h
> > @@ -162,6 +162,7 @@
> >
> >  #define PCI_VENDOR_ID_LOONGSON               0x0014
> >
> > +#define PCI_DEVICE_ID_LOONGSON_EHCI     0x7a14
> >  #define PCI_DEVICE_ID_LOONGSON_HDA      0x7a07
> >  #define PCI_DEVICE_ID_LOONGSON_HDMI     0x7a37
> >
> > --
> > 2.47.1
> >

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

end of thread, other threads:[~2025-02-01  6:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-31 10:06 [PATCH] USB: pci-quirks: Fix HCCPARAMS register error for LS7A EHCI Huacai Chen
2025-01-31 10:48 ` Greg Kroah-Hartman
2025-01-31 14:28   ` Huacai Chen
2025-01-31 15:18 ` Alan Stern
2025-02-01  6:18   ` Huacai Chen

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