2023-04-23 03:11:13

by Weitao Wang

[permalink] [raw]
Subject: [PATCH v3] UHCI:adjust zhaoxin UHCI controllers OverCurrent bit value

OverCurrent condition is not standardized in the UHCI spec.
Zhaoxin UHCI controllers report OverCurrent bit active off.
In order to handle OverCurrent condition correctly, the uhci-hcd
driver needs to be told to expect the active-off behavior.

Suggested-by: Alan Stern <[email protected]>
Cc: [email protected]
Signed-off-by: Weitao Wang <[email protected]>
---
v2->v3
- Change patch code style.

drivers/usb/host/uhci-pci.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/uhci-pci.c b/drivers/usb/host/uhci-pci.c
index 3592f757fe05..7bd2fddde770 100644
--- a/drivers/usb/host/uhci-pci.c
+++ b/drivers/usb/host/uhci-pci.c
@@ -119,11 +119,13 @@ static int uhci_pci_init(struct usb_hcd *hcd)

uhci->rh_numports = uhci_count_ports(hcd);

- /* Intel controllers report the OverCurrent bit active on.
- * VIA controllers report it active off, so we'll adjust the
- * bit value. (It's not standardized in the UHCI spec.)
+ /*
+ * Intel controllers report the OverCurrent bit active on. VIA
+ * and ZHAOXIN controllers report it active off, so we'll adjust
+ * the bit value. (It's not standardized in the UHCI spec.)
*/
- if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_VIA)
+ if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_VIA ||
+ to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_ZHAOXIN)
uhci->oc_low = 1;

/* HP's server management chip requires a longer port reset delay. */
--
2.32.0


2023-04-23 19:32:44

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH v3] UHCI:adjust zhaoxin UHCI controllers OverCurrent bit value

On Sun, Apr 23, 2023 at 06:59:52PM +0800, Weitao Wang wrote:
> OverCurrent condition is not standardized in the UHCI spec.
> Zhaoxin UHCI controllers report OverCurrent bit active off.
> In order to handle OverCurrent condition correctly, the uhci-hcd
> driver needs to be told to expect the active-off behavior.
>
> Suggested-by: Alan Stern <[email protected]>
> Cc: [email protected]
> Signed-off-by: Weitao Wang <[email protected]>
> ---
> v2->v3
> - Change patch code style.
>
> drivers/usb/host/uhci-pci.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/host/uhci-pci.c b/drivers/usb/host/uhci-pci.c
> index 3592f757fe05..7bd2fddde770 100644
> --- a/drivers/usb/host/uhci-pci.c
> +++ b/drivers/usb/host/uhci-pci.c
> @@ -119,11 +119,13 @@ static int uhci_pci_init(struct usb_hcd *hcd)
>
> uhci->rh_numports = uhci_count_ports(hcd);
>
> - /* Intel controllers report the OverCurrent bit active on.
> - * VIA controllers report it active off, so we'll adjust the
> - * bit value. (It's not standardized in the UHCI spec.)
> + /*
> + * Intel controllers report the OverCurrent bit active on. VIA
> + * and ZHAOXIN controllers report it active off, so we'll adjust
> + * the bit value. (It's not standardized in the UHCI spec.)
> */
> - if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_VIA)
> + if (to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_VIA ||
> + to_pci_dev(uhci_dev(uhci))->vendor == PCI_VENDOR_ID_ZHAOXIN)
> uhci->oc_low = 1;
>
> /* HP's server management chip requires a longer port reset delay. */

Acked-by: Alan Stern <[email protected]>