Re: [RFC v3 16/23] xhci: Register second xHCI roothub.

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

 



On Tue, 8 Mar 2011, Sarah Sharp wrote:

> > > diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
> > > index 2707971..20612ca 100644
> > > --- a/drivers/usb/core/hcd-pci.c
> > > +++ b/drivers/usb/core/hcd-pci.c
> > > @@ -200,6 +200,18 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
> > >  		retval = -ENOMEM;
> > >  		goto disable_pci;
> > >  	}
> > > +	if ((driver->flags & HCD_MASK) == HCD_USB3) {
> > > +		/* Mark the first roothub as being USB 2.0.
> > > +		 * The xHCI driver will register the USB 3.0 roothub.
> > > +		 */
> > > +		hcd->speed = HCD_USB2;
> > > +		/*
> > > +		 * USB 2.0 roothub under xHCI has an integrated TT,
> > > +		 * (rate matching hub) as opposed to having an OHCI/UHCI
> > > +		 * companion controller.
> > > +		 */
> > > +		hcd->has_tt = 1;
> > > +	}
> > 
> > The hcd->has_tt part can be moved into xhci-hcd.
> 
> Ok, so I can safely set the has_tt flag after the roothub has been
> allocated with a call to usb_add_hcd()?  There's nothing in the roothub
> allocation that relies on it?

No, root-hub allocation is the same as allocation of any other USB 
device structure.  The fact that we're dealing with a root hub doesn't 
make any difference.

> > It would be nice to move the hcd->speed part as well (this strong
> > coupling between hcd-pci and xhci-hcd is undesirable), but that would
> > cause the root hub to be registered while it is still marked with the
> > wrong speed.
> 
> Yes, I wish I could move the hcd->speed into the xHCI driver.  I had
> thought about lying and setting the xHCI driver speed flags to HCD_USB2.
> Then xhci-pci.c could set the hcd->speed for the USB3 roothub after
> usb_create_shared_hcd() is called.  However, I need to evaluate the
> other side effects of setting the xHCI driver HCD_MASK bits to HCD_USB2.

usbcore uses hcd->has_tt to set the bDeviceProtocol value in the root
hub's device descriptor, and it uses hcd->speed to select other values
in that descriptor.  (Hmmm... looking at the code in rh_call_control,
it appears that we really want to test hcd->has_tt only in the HCD_USB2
case.)

Since the device descriptor gets used when the root hub is registered,
this means that both hcd->has_tt and hcd->speed need to be set after
usb_create_hcd returns (obviously) and before usb_add_hcd calls 
register_root_hub.

You're setting them in usb_hcd_pci_probe, but it could just as well be
done in the xhci-hcd's reset or start method -- provided you don't mind
changing hcd->self.root_hub->speed as well.

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