Re: [PATCH v3 1/1] Intel xhci: refactor EHCI/xHCI port switching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 22 Jul 2013, Mathias Nyman wrote:

> Make the Linux xHCI driver automatically try to switchover the EHCI ports to
> xHCI when an Intel xHCI host is detected, and it also finds an Intel EHCI host.
> 
> This means we will no longer have to add Intel xHCI hosts to a quirks list when
> the PCI device IDs change.  Simply continuing to add new Intel xHCI PCI device
> IDs to the quirks list is not sustainable.
> 
> During suspend ports may be swicthed back to EHCI by BIOS and not properly
> restored to xHCI at resume. Previously both EHCI and xHCI resume functions
> switched ports back to XHCI, but it's enough to do it in xHCI only
> because the hub driver doesn't start running again until after both hosts are resumed.
> 
> Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
> Acked-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

It is noticeable that this code:

> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index b9848e4..90f927f 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c

> @@ -921,8 +895,16 @@ static void quirk_usb_handoff_xhci(struct pci_dev *pdev)
>  	writel(val, base + ext_cap_offset + XHCI_LEGACY_CONTROL_OFFSET);
>  
>  hc_init:
> -	if (usb_is_intel_switchable_xhci(pdev))
> -		usb_enable_xhci_ports(pdev);
> +	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
> +		struct pci_dev *companion = NULL;
> +		for_each_pci_dev(companion) {
> +			if (companion->class == PCI_CLASS_SERIAL_USB_EHCI &&
> +			    companion->vendor == PCI_VENDOR_ID_INTEL) {
> +				usb_enable_intel_xhci_ports(pdev);
> +				break;
> +			}
> +		}
> +	}

and this code:

> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index cc24e39..0e83863 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -250,13 +250,23 @@ static int xhci_pci_resume(struct usb_hcd *hcd, bool hibernated)
...
> -	if (usb_is_intel_switchable_xhci(pdev))
> -		usb_enable_xhci_ports(pdev);
> +
> +	if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
> +		struct pci_dev *companion = NULL;
> +		for_each_pci_dev(companion) {
> +			if (companion->class == PCI_CLASS_SERIAL_USB_EHCI &&
> +			    companion->vendor == PCI_VENDOR_ID_INTEL) {
> +				usb_enable_intel_xhci_ports(pdev);
> +				break;
> +			}
> +		}
> +	}

are identical.  Can you have xhci-pci.c call pci-quirks.c, to get rid 
of the duplication?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux