[U-Boot] [PATCH v2 06/13] drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support

Lukasz Majewski lukma at denx.de
Tue Jun 20 13:44:42 UTC 2017


Hi Marek, Vignesh,

> On 06/20/2017 02:00 PM, Vignesh R wrote:
> > Hi Marek,
> > 
> > On Thursday 15 June 2017 10:27 PM, Marek Vasut wrote:
> >> On 06/14/2017 02:25 PM, Vignesh R wrote:
> >> [...]
> >>>>>  /**
> >>>>>   * dwc3_omap_uboot_init - dwc3 omap uboot initialization code
> >>>>>   * @dev: struct dwc3_omap_device containing initialization data
> >>>>> @@ -462,3 +487,145 @@ MODULE_ALIAS("platform:omap-dwc3");
> >>>>>  MODULE_AUTHOR("Felipe Balbi <balbi at ti.com>");
> >>>>>  MODULE_LICENSE("GPL v2");
> >>>>>  MODULE_DESCRIPTION("DesignWare USB3 OMAP Glue Layer");
> >>>>> +
> >>>>> +#else
> >>>>> +
> >>>>> +int usb_gadget_handle_interrupts(int index)
> >>>>
> >>>> Can this be made somehow more generic , so that the core code
> >>>> would contain the basic interrupt handling and probe routines
> >>>> and the various SoC-specific drivers would add their specific
> >>>> bits to it ?
> >>>>
> >>>
> >>> How about moving this to drivers/usb/dwc3/gadget.c and then
> >>> provide a callback to each of SoC specific drivers?
> >>>
> >> That could work.
> > 
> > Sorry, looking at this further I dont see a easy way of doing this.
> > 
> > All gadget drivers like ether.c or f_mass_storage.c call
> > usb_gadget_handle_interrupts() just passing the index of the USB
> > instance. This does not help at all in dm case. What we would need
> > is usb_gadget_handle_interrupts() to provide at least the usb_gadget
> > instance as parameter from which we could derive controller specific
> > structure using container_of(). And then, we could call the SoC
> > specific isr callback.
> > This would require modifying all gadget driver like ether.c to call
> > a different function instead of usb_gadget_handle_interrupts() when
> > DM_USB is used.
> 
> This is something to consult with Lukasz then.

And it seems that we are heading to adding "gadget" infrastructure to
DM.....

I will do my best to provide some ideas for this task.....

> 
> > I see MUSB driver uses a global pointer to musb struct (see
> > drivers/usb/musb-new/musb_uboot.c::usb_gadget_handle_interrupts()),
> > but I dont think thats a good option.
> 
> Nope, that's not a good option, just like any global stuff in drivers.
> 
> > Let me know your preference. Any suggestion appreciated. Thanks!
> > 
> 
> 




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de


More information about the U-Boot mailing list