Re: [PATCH] xhci: Report max device limit when Enable Slot command fails.

2014-04-08 Thread Sarah Sharp
On Tue, Apr 08, 2014 at 07:53:39AM +, Amund Hov wrote:
> 
> > I completely understand your frustration, and it actually is relevant to
> > kernel development. :)  Perhaps the attached patch would have at least
> > saved you some time and frustration in debugging the driver and host
> > issue?
> 
> Thanks Sarah. An error like that would allow me to know what the error is
> and where to look for host capabilities. Is this the only case in which
> slot_id would not be properly set?

I believe so.  There's at least one other function that allocates a new
slot ID, but it calls the function I added debugging to.  A device may
also not get enumerated if it fails to respond to a Set Address control
transfer, but that code path already has some nicer printks already.

Sarah Sharp

p.s. You might want to try to remove your footer when communicating with
open source mailing lists.  Some kernel devs will refuse to answer you
back because it really doesn't make any sense to try to impose the
legalise on a public mailing list that sends email copies to everyone.
I know some people just use their personal addresses if their company
slaps the footer on all outgoing messages.

> This message (including any attachments) is intended only for the use of the 
> individual or entity to which it is addressed and may contain information 
> that is non-public, proprietary, privileged, confidential, and exempt from 
> disclosure under applicable law or may constitute as attorney work product. 
> If you are not the intended recipient, you are hereby notified that any use, 
> dissemination, distribution, or copying of this communication is strictly 
> prohibited. If you have received this communication in error, notify us 
> immediately by telephone and destroy this message if a facsimile or (ii) 
> delete this message immediately if this is an electronic communication. Thank 
> you.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] xhci: Report max device limit when Enable Slot command fails.

2014-04-08 Thread Amund Hov

> I completely understand your frustration, and it actually is relevant to
> kernel development. :)  Perhaps the attached patch would have at least
> saved you some time and frustration in debugging the driver and host
> issue?

Thanks Sarah. An error like that would allow me to know what the error is
and where to look for host capabilities. Is this the only case in which
slot_id would not be properly set?

—
Amund Hov
+47 412 96 298
amund@silabs.com

This message (including any attachments) is intended only for the use of the 
individual or entity to which it is addressed and may contain information that 
is non-public, proprietary, privileged, confidential, and exempt from 
disclosure under applicable law or may constitute as attorney work product. If 
you are not the intended recipient, you are hereby notified that any use, 
dissemination, distribution, or copying of this communication is strictly 
prohibited. If you have received this communication in error, notify us 
immediately by telephone and destroy this message if a facsimile or (ii) delete 
this message immediately if this is an electronic communication. Thank you.
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] xhci: Report max device limit when Enable Slot command fails.

2014-04-07 Thread Sarah Sharp
On Mon, Apr 07, 2014 at 09:04:41AM +, Amund Hov wrote:
> 
> >>> The USB bus specification says that 255 devices can be connected to the
> >>> host, but that doesn't mean the xHCI host controller has all the
> >>> internal resources to support that.
> >
> > To me that sounds like such xHCI HCs can not be considered USB compliant. :\
> 
> I would tend to agree Peter. It sounds weird that the number of connected 
> devices would
>  not be part of the  USB standard. On the other hand it makes sense as a host 
> controller
> on a small tablet wouldn’t need to handle more than a few devices. Still, 
> would be nice to
> have this in more clear print in resources online which frequently quote the 
> 127 number
> with reservations made on bandwidth, not hardware registers.
> 
> I realise this might not be relevant to kernel development at this point,
> so I’ll take my ranting elsewhere.

I completely understand your frustration, and it actually is relevant to
kernel development. :)  Perhaps the attached patch would have at least
saved you some time and frustration in debugging the driver and host
issue?

Sarah Sharp

>8---8<

xHCI host controllers may only support a limited number of device slot
IDs, which is usually far less than the theoretical maximum number of
devices (255) that the USB specifications advertise.  This is
frustrating to consumers that expect to be able to plug in a large
number of devices.

Add a print statement when the Enable Slot command fails to show how
many devices the host supports.  We can't change hardware manufacturer's
design decisions, but hopefully we can save customers a little bit of
time trying to debug why their host mysteriously fails when too many
devices are plugged in.

Signed-off-by: Sarah Sharp 
Reported-by: Amund Hov 
---
 drivers/usb/host/xhci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 26dffd4e6d73..421a3a2c4509 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3668,6 +3668,9 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device 
*udev)
 
if (!xhci->slot_id) {
xhci_err(xhci, "Error while assigning device slot ID\n");
+   xhci_err(xhci, "Max number of devices this xHCI host supports 
is %u.\n",
+   HCS_MAX_SLOTS(
+   readl(&xhci->cap_regs->hcs_params1)));
return 0;
}
 
-- 
1.8.3.2

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


[PATCH] xhci: Report max device limit when Enable Slot command fails.

2014-04-07 Thread Sarah Sharp
On Mon, Apr 07, 2014 at 09:04:41AM +, Amund Hov wrote:
> 
> >>> The USB bus specification says that 255 devices can be connected to the
> >>> host, but that doesn't mean the xHCI host controller has all the
> >>> internal resources to support that.
> >
> > To me that sounds like such xHCI HCs can not be considered USB compliant. :\
> 
> I would tend to agree Peter. It sounds weird that the number of connected 
> devices would
>  not be part of the  USB standard. On the other hand it makes sense as a host 
> controller
> on a small tablet wouldn’t need to handle more than a few devices. Still, 
> would be nice to
> have this in more clear print in resources online which frequently quote the 
> 127 number
> with reservations made on bandwidth, not hardware registers.
> 
> I realise this might not be relevant to kernel development at this point,
> so I’ll take my ranting elsewhere.

I completely understand your frustration, and it actually is relevant to
kernel development. :)  Perhaps the attached patch would have at least
saved you some time and frustration in debugging the driver and host
issue?

Sarah Sharp

>8---8<

xHCI host controllers may only support a limited number of device slot
IDs, which is usually far less than the theoretical maximum number of
devices (255) that the USB specifications advertise.  This is
frustrating to consumers that expect to be able to plug in a large
number of devices.

Add a print statement when the Enable Slot command fails to show how
many devices the host supports.  We can't change hardware manufacturer's
design decisions, but hopefully we can save customers a little bit of
time trying to debug why their host mysteriously fails when too many
devices are plugged in.

Signed-off-by: Sarah Sharp 
Reported-by: Amund Hov 
---
 drivers/usb/host/xhci.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 26dffd4e6d73..421a3a2c4509 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3668,6 +3668,9 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device 
*udev)
 
if (!xhci->slot_id) {
xhci_err(xhci, "Error while assigning device slot ID\n");
+   xhci_err(xhci, "Max number of devices this xHCI host supports 
is %u.\n",
+   HCS_MAX_SLOTS(
+   readl(&xhci->cap_regs->hcs_params1)));
return 0;
}
 
-- 
1.8.3.2

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