* [PATCH v2 1/1] usb: xhci: do not create and register shared_hcd when USB3.0 is disabled
@ 2018-01-29 10:24 Thang Q. Nguyen
2018-03-05 10:22 ` Thang Q. Nguyen
0 siblings, 1 reply; 4+ messages in thread
From: Thang Q. Nguyen @ 2018-01-29 10:24 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel
Cc: Thang Nguyen, Phong Vo, Loc Ho, Tung Nguyen, patches
From: Tung Nguyen <tunguyen@apm.com>
Currently, hcd->shared_hcd always creates and registers to the usb-core.
If, for some reasons, USB3 downstream port is disabled, no roothub port for
USB3.0 is found. This causes kernel to display an error:
hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
This patch checks and registers shared_hcd if USB3.0 downstream
port is available.
Signed-off-by: Tung Nguyen <tunguyen@apm.com>
---
drivers/usb/host/xhci-plat.c | 9 ++++++---
drivers/usb/host/xhci.c | 13 +++++++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 6f03830..bdb3975 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -293,9 +293,12 @@ static int xhci_plat_probe(struct platform_device *pdev)
if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
xhci->shared_hcd->can_do_streams = 1;
- ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
- if (ret)
- goto dealloc_usb2_hcd;
+ /* Just add the shared_hcd when USB3.0 downstream port is available */
+ if (xhci->num_usb3_ports > 0) {
+ ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
+ if (ret)
+ goto dealloc_usb2_hcd;
+ }
device_enable_async_suspend(&pdev->dev);
pm_runtime_put_noidle(&pdev->dev);
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 1eeb339..9d3b1ab 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -611,6 +611,19 @@ int xhci_run(struct usb_hcd *hcd)
if (ret)
xhci_free_command(xhci, command);
}
+ /*
+ * In case that the USB3.0 downstream port is not available
+ * No one triggers to start the xHC which should be done
+ * before finishing xhci_run
+ */
+ if (xhci->num_usb3_ports == 0) {
+ if (xhci_start(xhci)) {
+ xhci_halt(xhci);
+ return -ENODEV;
+ }
+ xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
+ }
+
xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Finished xhci_run for USB2 roothub");
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] usb: xhci: do not create and register shared_hcd when USB3.0 is disabled
2018-01-29 10:24 [PATCH v2 1/1] usb: xhci: do not create and register shared_hcd when USB3.0 is disabled Thang Q. Nguyen
@ 2018-03-05 10:22 ` Thang Q. Nguyen
2018-03-28 9:53 ` Thang Q. Nguyen
0 siblings, 1 reply; 4+ messages in thread
From: Thang Q. Nguyen @ 2018-03-05 10:22 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel
Cc: Thang Nguyen, Phong Vo, Loc Ho, Tung Nguyen, patches
On Mon, Jan 29, 2018 at 5:24 PM, Thang Q. Nguyen <tqnguyen@apm.com> wrote:
> From: Tung Nguyen <tunguyen@apm.com>
>
> Currently, hcd->shared_hcd always creates and registers to the usb-core.
> If, for some reasons, USB3 downstream port is disabled, no roothub port for
> USB3.0 is found. This causes kernel to display an error:
> hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
> This patch checks and registers shared_hcd if USB3.0 downstream
> port is available.
>
> Signed-off-by: Tung Nguyen <tunguyen@apm.com>
> ---
> drivers/usb/host/xhci-plat.c | 9 ++++++---
> drivers/usb/host/xhci.c | 13 +++++++++++++
> 2 files changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> index 6f03830..bdb3975 100644
> --- a/drivers/usb/host/xhci-plat.c
> +++ b/drivers/usb/host/xhci-plat.c
> @@ -293,9 +293,12 @@ static int xhci_plat_probe(struct platform_device *pdev)
> if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
> xhci->shared_hcd->can_do_streams = 1;
>
> - ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> - if (ret)
> - goto dealloc_usb2_hcd;
> + /* Just add the shared_hcd when USB3.0 downstream port is available */
> + if (xhci->num_usb3_ports > 0) {
> + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> + if (ret)
> + goto dealloc_usb2_hcd;
> + }
>
> device_enable_async_suspend(&pdev->dev);
> pm_runtime_put_noidle(&pdev->dev);
> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> index 1eeb339..9d3b1ab 100644
> --- a/drivers/usb/host/xhci.c
> +++ b/drivers/usb/host/xhci.c
> @@ -611,6 +611,19 @@ int xhci_run(struct usb_hcd *hcd)
> if (ret)
> xhci_free_command(xhci, command);
> }
> + /*
> + * In case that the USB3.0 downstream port is not available
> + * No one triggers to start the xHC which should be done
> + * before finishing xhci_run
> + */
> + if (xhci->num_usb3_ports == 0) {
> + if (xhci_start(xhci)) {
> + xhci_halt(xhci);
> + return -ENODEV;
> + }
> + xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
> + }
> +
> xhci_dbg_trace(xhci, trace_xhci_dbg_init,
> "Finished xhci_run for USB2 roothub");
>
> --
> 1.8.3.1
>
Hi,
Do you have any comment on the patch?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] usb: xhci: do not create and register shared_hcd when USB3.0 is disabled
2018-03-05 10:22 ` Thang Q. Nguyen
@ 2018-03-28 9:53 ` Thang Q. Nguyen
2018-11-02 6:57 ` Nicolas Boichat
0 siblings, 1 reply; 4+ messages in thread
From: Thang Q. Nguyen @ 2018-03-28 9:53 UTC (permalink / raw)
To: Mathias Nyman, Greg Kroah-Hartman, linux-usb, linux-kernel
Cc: Thang Nguyen, Phong Vo, Loc Ho, Tung Nguyen, patches
On Mon, Mar 5, 2018 at 5:22 PM, Thang Q. Nguyen <tqnguyen@apm.com> wrote:
> On Mon, Jan 29, 2018 at 5:24 PM, Thang Q. Nguyen <tqnguyen@apm.com> wrote:
>> From: Tung Nguyen <tunguyen@apm.com>
>>
>> Currently, hcd->shared_hcd always creates and registers to the usb-core.
>> If, for some reasons, USB3 downstream port is disabled, no roothub port for
>> USB3.0 is found. This causes kernel to display an error:
>> hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
>> This patch checks and registers shared_hcd if USB3.0 downstream
>> port is available.
>>
>> Signed-off-by: Tung Nguyen <tunguyen@apm.com>
>> ---
>> drivers/usb/host/xhci-plat.c | 9 ++++++---
>> drivers/usb/host/xhci.c | 13 +++++++++++++
>> 2 files changed, 19 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>> index 6f03830..bdb3975 100644
>> --- a/drivers/usb/host/xhci-plat.c
>> +++ b/drivers/usb/host/xhci-plat.c
>> @@ -293,9 +293,12 @@ static int xhci_plat_probe(struct platform_device *pdev)
>> if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
>> xhci->shared_hcd->can_do_streams = 1;
>>
>> - ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
>> - if (ret)
>> - goto dealloc_usb2_hcd;
>> + /* Just add the shared_hcd when USB3.0 downstream port is available */
>> + if (xhci->num_usb3_ports > 0) {
>> + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
>> + if (ret)
>> + goto dealloc_usb2_hcd;
>> + }
>>
>> device_enable_async_suspend(&pdev->dev);
>> pm_runtime_put_noidle(&pdev->dev);
>> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
>> index 1eeb339..9d3b1ab 100644
>> --- a/drivers/usb/host/xhci.c
>> +++ b/drivers/usb/host/xhci.c
>> @@ -611,6 +611,19 @@ int xhci_run(struct usb_hcd *hcd)
>> if (ret)
>> xhci_free_command(xhci, command);
>> }
>> + /*
>> + * In case that the USB3.0 downstream port is not available
>> + * No one triggers to start the xHC which should be done
>> + * before finishing xhci_run
>> + */
>> + if (xhci->num_usb3_ports == 0) {
>> + if (xhci_start(xhci)) {
>> + xhci_halt(xhci);
>> + return -ENODEV;
>> + }
>> + xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
>> + }
>> +
>> xhci_dbg_trace(xhci, trace_xhci_dbg_init,
>> "Finished xhci_run for USB2 roothub");
>>
>> --
>> 1.8.3.1
>>
> Hi,
> Do you have any comment on the patch?
Hi,
Do you have any comment on the patch?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] usb: xhci: do not create and register shared_hcd when USB3.0 is disabled
2018-03-28 9:53 ` Thang Q. Nguyen
@ 2018-11-02 6:57 ` Nicolas Boichat
0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Boichat @ 2018-11-02 6:57 UTC (permalink / raw)
To: tqnguyen
Cc: mathias.nyman, Greg Kroah-Hartman, linux-usb, lkml, pvo, lho,
tunguyen, patches
On Wed, Mar 28, 2018 at 5:53 PM Thang Q. Nguyen <tqnguyen@apm.com> wrote:
>
> On Mon, Mar 5, 2018 at 5:22 PM, Thang Q. Nguyen <tqnguyen@apm.com> wrote:
> > On Mon, Jan 29, 2018 at 5:24 PM, Thang Q. Nguyen <tqnguyen@apm.com> wrote:
> >> From: Tung Nguyen <tunguyen@apm.com>
> >>
> >> Currently, hcd->shared_hcd always creates and registers to the usb-core.
> >> If, for some reasons, USB3 downstream port is disabled, no roothub port for
> >> USB3.0 is found. This causes kernel to display an error:
> >> hub 2-0:1.0: config failed, hub doesn't have any ports! (err -19)
> >> This patch checks and registers shared_hcd if USB3.0 downstream
> >> port is available.
I'm working on a board with similar warning on boot (XHCI controller
without 3.0 support), and there is no more error on boot with your
patch.
However, I still see the USB 3.0 root hub, so I'm wondering if that's
expected or if we should find a way to remove it?
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Apart from that:
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
> >> Signed-off-by: Tung Nguyen <tunguyen@apm.com>
> >> ---
> >> drivers/usb/host/xhci-plat.c | 9 ++++++---
> >> drivers/usb/host/xhci.c | 13 +++++++++++++
> >> 2 files changed, 19 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
> >> index 6f03830..bdb3975 100644
> >> --- a/drivers/usb/host/xhci-plat.c
> >> +++ b/drivers/usb/host/xhci-plat.c
> >> @@ -293,9 +293,12 @@ static int xhci_plat_probe(struct platform_device *pdev)
> >> if (HCC_MAX_PSA(xhci->hcc_params) >= 4)
> >> xhci->shared_hcd->can_do_streams = 1;
> >>
> >> - ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> >> - if (ret)
> >> - goto dealloc_usb2_hcd;
> >> + /* Just add the shared_hcd when USB3.0 downstream port is available */
> >> + if (xhci->num_usb3_ports > 0) {
> >> + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED);
> >> + if (ret)
> >> + goto dealloc_usb2_hcd;
> >> + }
> >>
> >> device_enable_async_suspend(&pdev->dev);
> >> pm_runtime_put_noidle(&pdev->dev);
> >> diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
> >> index 1eeb339..9d3b1ab 100644
> >> --- a/drivers/usb/host/xhci.c
> >> +++ b/drivers/usb/host/xhci.c
> >> @@ -611,6 +611,19 @@ int xhci_run(struct usb_hcd *hcd)
> >> if (ret)
> >> xhci_free_command(xhci, command);
> >> }
> >> + /*
> >> + * In case that the USB3.0 downstream port is not available
> >> + * No one triggers to start the xHC which should be done
> >> + * before finishing xhci_run
> >> + */
> >> + if (xhci->num_usb3_ports == 0) {
> >> + if (xhci_start(xhci)) {
> >> + xhci_halt(xhci);
> >> + return -ENODEV;
> >> + }
> >> + xhci->cmd_ring_state = CMD_RING_STATE_RUNNING;
> >> + }
> >> +
> >> xhci_dbg_trace(xhci, trace_xhci_dbg_init,
> >> "Finished xhci_run for USB2 roothub");
> >>
> >> --
> >> 1.8.3.1
> >>
> > Hi,
> > Do you have any comment on the patch?
> Hi,
> Do you have any comment on the patch?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-11-02 6:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-29 10:24 [PATCH v2 1/1] usb: xhci: do not create and register shared_hcd when USB3.0 is disabled Thang Q. Nguyen
2018-03-05 10:22 ` Thang Q. Nguyen
2018-03-28 9:53 ` Thang Q. Nguyen
2018-11-02 6:57 ` Nicolas Boichat
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).