Hi, On Tue, Feb 14, 2012 at 11:28:33AM -0800, Ido Shayevitz wrote: > >> I really wouldn't like seeing this kind of code added to the core xHCI > >> driver and I think Sarah wouldn't like it either. > > > > Felipe's right. The xHCI driver should really be a general purpose > > driver, with embedded hosts that need to add functionality just calling > > the generic xHCI functions. I don't want platform-specific code added > > to the xHCI host driver. Otherwise we'll end up in the ifdeferry mess > > that EHCI grew over the years. > > No problem, this is why I advice you, before I do this. > However , this is not a platform specific code, it is done also in ehci. and that's only called from platform-specific glue: $ git grep -e set_host drivers/usb/host/ehci* drivers/usb/host/ehci-fsl.c: retval = otg_set_host(ehci->transceiver->otg, drivers/usb/host/ehci-fsl.c: otg_set_host(ehci->transceiver->otg, NULL); drivers/usb/host/ehci-msm.c: ret = otg_set_host(phy->otg, &hcd->self); drivers/usb/host/ehci-msm.c: otg_set_host(phy->otg, NULL); drivers/usb/host/ehci-mv.c: retval = otg_set_host(ehci_mv->otg->otg, &hcd->self); drivers/usb/host/ehci-mv.c: otg_set_host(ehci_mv->otg->otg, NULL); drivers/usb/host/ehci-tegra.c: otg_set_host(tegra->transceiver->otg, &hcd->self); drivers/usb/host/ehci-tegra.c: otg_set_host(tegra->transceiver->otg, NULL); drivers/usb/host/ehci-tegra.c: otg_set_host(tegra->transceiver->otg, NULL); This is what Sarah means by "platform-specific". It's not something that ALL xHCI hosts will need to do, only a few of them which were combined with a gadget-side stack will need such handling ;-) BTW, you should write your patch on top of the two patches I sent adding support for xhci on dwc3. It's on the archives of the mailing and this is the second time I suggest you do that. > I mean, the "set_host" API is a generic one defined in otg.h as part of > the general otg framework, no pltaform specific. > Actually it will serve any otg driver, on any core that supports xHCI > interface, not just for the dwc3 core. > How do you suggest to do this otherwise? like I said on the other mail. ->set_host() needs to be called way before that. When you get ID pin grounded, if your controller doesn't go into host mode automagically, you call ->set_host(). You should have some sort of ID ground event to handle that. -- balbi
Attachment:
signature.asc
Description: Digital signature