Re: [PATCH 2/2] usb/core: consider link speed while looking at bMaxPower

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

 



On Mon, Dec 03, 2012 at 04:28:38PM -0500, Alan Stern wrote:
> On Mon, 3 Dec 2012, Sarah Sharp wrote:
> > This code in hcd.c:usb_add_hcd needs to change:
> > 
> >         /* starting here, usbcore will pay attention to this root hub */
> >         rhdev->bus_mA = min(500u, hcd->power_budget);
> 
> In fact, this line is wrong.  The 500u should be multiplied by the 
> number of ports -- and of course, it should be larger for SuperSpeed 
> root hubs.

But I don't know the number of ports here. I could set this here to 500/900
and multiple later in hub_configure() by the number of ports.
Anyway, do you think this is correct? Anything > 500 for non-SS will replaced
with 500 in hub_configure:

|      if (hdev == hdev->bus->root_hub) {
|                 if (hdev->bus_mA == 0 || hdev->bus_mA >= full_load)
|                         hub->mA_per_port = full_load;
|                 else {
|                         hub->mA_per_port = hdev->bus_mA;
|                         hub->limited_power = 1;
|                 }

going through the tree I saw most people set it to something around 200 (if at
all). There are a few omap/musb boards setting it to 500.
The interresting part is davinci of course. So there is comment that says
|"irlml6401 switches over 1A in under 8 msec"
and it calls davinci_setup_usb(1000, 8); which writes 255 in the power member
which musb in turn multiplies by 2. So we have 500mA again ;) I have no idea
how many ports they have.

> > The else statement after the above code also needs to change:
> > 
> >         } else if ((hubstatus & (1 << USB_DEVICE_SELF_POWERED)) == 0) {
> >                 dev_dbg(hub_dev, "hub controller current requirement: %dmA\n",
> >                         hub->descriptor->bHubContrCurrent);
> >                 hub->limited_power = 1;
> >                 if (hdev->maxchild > 0) {
> 
> Hmmm...  This test doesn't look very important.  Who cares about hubs 
> with no ports?
I made it go away.

> >                         int remaining = hdev->bus_mA -
> >                                         hub->descriptor->bHubContrCurrent;
> > 
> >                         if (remaining < hdev->maxchild * 100)
> >                                 dev_warn(hub_dev,
> >                                         "insufficient power available "
> >                                         "to use all downstream ports\n");
> >                         hub->mA_per_port = 100;         /* 7.2.1.1 */
> > 
> > I think this is trying to set the mA_per_port to the unconfigured device
> > power, which 7.2.1.1 says is one unit load.

> Not to the unconfigured device power but simply to one unit load.  
> 7.2.1 says:
> 
> 	External ports in a bus-powered hub can supply only one unit 
> 	load per port regardless of the current draw on the other ports
> 	of that hub.
> 
> The comment actually should refer to 7.2.1, not 7.2.1.1.
Fixed up.

and the others as well. Will post them in a jiffy or two.

Sebastian
--
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