02.10.2019 15:07, Peter Geis пишет: > On Wed, Oct 2, 2019 at 7:26 AM Thierry Reding <thierry.reding@xxxxxxxxx> wrote: >> >> On Tue, Oct 01, 2019 at 09:41:52PM -0400, Peter Geis wrote: >>> As Tegra requires special handlers for resets and dma alignment, add >>> those functions to a header. >>> >>> Signed-off-by: Peter Geis <pgwipeout@xxxxxxxxx> >>> --- >>> drivers/usb/chipidea/tegra.h | 159 +++++++++++++++++++++++++++++++++++ >>> 1 file changed, 159 insertions(+) >>> create mode 100644 drivers/usb/chipidea/tegra.h >> >> Can't you move these into the ci_hdrc_tegra.c file? It's kind of odd to >> have large functions like this implemented in a header. >> >> Thierry > > I put this into a header since the chipidea host driver uses it > exclusively and it doesn't export most of its functions. > The other ways involved significant changes to the host driver or > duplicating a lot of functionality in the tegra-udc driver. > Neither method seemed good to me, and I couldn't figure out a better > way to do it. > Looks like you could add hooks for [un]map_urb_for_dma() and port_reset() to the ci_hdrc_platform_data. Then it could be: ... ci_ehci_hc_driver.map_urb_for_dma = ci->platdata->map_urb_for_dma; ci_ehci_hc_driver.unmap_urb_for_dma = ci->platdata->unmap_urb_for_dma; ... if (ci->platdata->port_reset && typeReq == SetPortFeature && wValue == USB_PORT_FEAT_RESET) { spin_unlock_irqrestore(&ehci->lock, flags); return ci->platdata->port_reset(ehci, status_reg); } and in tegra_udc_probe(): /* setup and register ChipIdea HDRC device */ ... udc->data.map_urb_for_dma = tegra_map_urb_for_dma; udc->data.unmap_urb_for_dma = tegra_unmap_urb_for_dma; udc->data.port_reset = tegra_ehci_internal_port_reset;