On Fri, 14 Aug 2015, Felipe Balbi wrote:
> > That's not quite what I had in mind. I was thinking of something more
> > like this:
> >
> > Platform device ---- drvdata ----> struct usb_pointers
> > |
> > |
> > |-------|-------|
> > | | |
> > gadget hcd otg
> >
> > where struct usb_pointers (maybe you can think of a better name) looks
> > like this:
> >
> > struct usb_pointers {
> > struct usb_hcd *hcd;
> > struct usb_gadget *gadget;
> > struct usb_otg *otg;
> > };
> >
> > If you want, you can use your IP Core device in place of my platform
> > device. All that matters is that the parent device of the root hub
> > (for hosts) or gadget (for peripherals) should store the address of a
> > usb_pointers structure in its drvdata.
>
> that looks pretty clean to me, Alan. Wonder how that looks after
> actually implementing it.
Implementing it will take a fair amount of work, because all of the
existing UDC and HC drivers will have to be changed. Probably a bunch
of OTG drivers too, but I'm not familiar with them.
The concept is simple, though. A little new code to allocate and
deallocate these usb_pointer structures can be added to
common/common.c. (I'd _really_ like to find a better name!)
Or maybe we could use a simpler approach: Always allocate a usb_otg
structure (even if the hardware doesn't support OTG) and make the
platform driver's drvdata point to it. Since struct usb_otg already
contains pointers to a usb_bus (should that really be usb_hcd?) and a
usb_gadget, we'd be all set.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html