From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lukasz Majewski Date: Tue, 20 Jun 2017 15:44:42 +0200 Subject: [U-Boot] [PATCH v2 06/13] drivers: usb: dwc3: add ti dwc3 peripheral driver with driver model support In-Reply-To: References: <20170613121009.25860-1-vigneshr@ti.com> <20170613121009.25860-7-vigneshr@ti.com> <391181e2-ff73-9750-3262-d719d27a58f2@denx.de> <3a3739bf-4ad0-1474-2896-ccfbf3ac9ed5@denx.de> <7c6aa856-08b0-b9b4-a52a-d5f75660fd9f@ti.com> Message-ID: <20170620154442.343fb64d@jawa> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 "); > >>>>> 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