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

Marek Vasut marex at denx.de
Tue Jun 20 12:04:20 UTC 2017


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.

> 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,
Marek Vasut


More information about the U-Boot mailing list