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

Vignesh R vigneshr at ti.com
Tue Jun 20 12:00:10 UTC 2017


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.

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.


Let me know your preference. Any suggestion appreciated. Thanks!

-- 
Regards
Vignesh


More information about the U-Boot mailing list