mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: Longfang Liu <liulongfang@huawei.com>,
	gregkh@linuxfoundation.org, mathias.nyman@intel.com
Cc: linux-usb@vger.kernel.org, yisen.zhuang@huawei.com,
	linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] USB:XHCI:Modify XHCI driver for USB2.0 controller
Date: Fri, 26 Feb 2021 11:22:17 +0200	[thread overview]
Message-ID: <127e3e5c-f485-64dd-235c-1971d6cd9a4a@linux.intel.com> (raw)
In-Reply-To: <1614327697-1021-1-git-send-email-liulongfang@huawei.com>

On 26.2.2021 10.21, Longfang Liu wrote:
> Our current XHCI hardware controller has been customized to only
> support USB 2.0 ports. When using the current xhci driver, an xhci
> controller device and an ehci controller device will be created
> automatically. We want the driver to create only one ehci controller.
> After modifying the driver as follows, an error will occur.
> Is there any other modification method?

The xhci driver relies on the existence of both a main and a shared hcd.
One hcd for handing USB 2 (and slower) and the other for USB 3 devices.

As one example xhci_run(hcd) needs to be called for both hcds, first call
sets up things, second one calls xhci_start() that makes the controller run.

It's probably possible to modify the driver to support xHCI hosts with only
USB 2 ports, but requires a lot more work.

> 
> Signed-off-by: Longfang Liu <liulongfang@huawei.com>
> ---
>  drivers/usb/host/xhci-pci.c | 15 ++-------------
>  1 file changed, 2 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-pci.c b/drivers/usb/host/xhci-pci.c
> index ef513c2..7296aad 100644
> --- a/drivers/usb/host/xhci-pci.c
> +++ b/drivers/usb/host/xhci-pci.c
> @@ -364,26 +364,15 @@ static int xhci_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
>  	/* USB 2.0 roothub is stored in the PCI device now. */
>  	hcd = dev_get_drvdata(&dev->dev);
>  	xhci = hcd_to_xhci(hcd);
> -	xhci->shared_hcd = usb_create_shared_hcd(&xhci_pci_hc_driver, &dev->dev,
> -						 pci_name(dev), hcd);
> -	if (!xhci->shared_hcd) {
> -		retval = -ENOMEM;
> -		goto dealloc_usb2_hcd;
> -	}
> -
> +	xhci->shared_hcd = NULL;
>  	retval = xhci_ext_cap_init(xhci);
>  	if (retval)
>  		goto put_usb3_hcd;
>  
> -	retval = usb_add_hcd(xhci->shared_hcd, dev->irq,
> +	retval = usb_add_hcd(xhci->main_hcd, dev->irq,
>  			IRQF_SHARED);
>  	if (retval)
>  		goto put_usb3_hcd;
> -	/* Roothub already marked as USB 3.0 speed */
> -
> -	if (!(xhci->quirks & XHCI_BROKEN_STREAMS) &&
> -			HCC_MAX_PSA(xhci->hcc_params) >= 4)
> -		xhci->shared_hcd->can_do_streams = 1;
>  
>  	/* USB-2 and USB-3 roothubs initialized, allow runtime pm suspend */
>  	pm_runtime_put_noidle(&dev->dev);
> 

Something like the above could of course not be accepted upstream. We can't break existing
functionality to support one modified xHCI.

Thanks
Mathias

  parent reply	other threads:[~2021-02-26  9:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26  8:21 Longfang Liu
2021-02-26  8:38 ` Greg KH
2021-02-27  3:31   ` liulongfang
2021-03-04  1:35     ` Peter Chen
2021-03-04  4:08       ` liulongfang
2021-02-26  9:22 ` Mathias Nyman [this message]
2021-02-27  3:34   ` liulongfang
2021-02-26 16:30 ` Alan Stern
2021-02-27  3:38   ` liulongfang
2021-02-27  3:48     ` liulongfang
2021-02-27 16:27     ` Alan Stern
2021-03-01  1:58       ` liulongfang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=127e3e5c-f485-64dd-235c-1971d6cd9a4a@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=liulongfang@huawei.com \
    --cc=mathias.nyman@intel.com \
    --cc=yisen.zhuang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®