Re: supporting basic otg feature

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 18 Jun 2009, Pavan Kondeti wrote:

> Hi All,
> 
> We have an USB high speed core which can support both Host mode and
> Peripheral mode. We are looking at implementing basic OTG
> functionality. We don?t want to implement SRP and HNP. We want to
> configure the mode based ID pin status. We have written a small module
> to detect id pin status. This module starts /stops host mode driver
> whenever mini-A cable is plugged in/out. How can we make sure that
> Host mode stack software (EHCI and USB HCD) doesn?t interfere when we
> configure the controller in peripheral mode?

What do you think the host stack software might do?  Do host-mode 
interrupts and device-mode interrupts use the same IRQ?  If they do, 
you'll have to force the host stack to unregister its IRQ handler.

Otherwise there shouldn't be any interference, except possibly from 
root-hub suspend and resume transitions.

> Say mini-a cable is connected at boot up time. We configured
> controller in host mode. Everything works fine. Say if we remove
> mini-A cable now and connect a mini-B. How can we stop host stack. I
> can think of two approaches here.
> 
> 1.    Enable CONFIG_AUTO_SUSPEND feature. When mini-a cable is
> removed, no activity on root hub. So root hub will be suspended. We
> receive bus_suspend call back (struct hc_driver) in host driver.
> Inform otg module (module motoring id pin) that host mode is no longer
> active. We are completely relying on auto suspend here. User can set
> the idle timeout from sysfs and we are compromised.
> 2.    When mini-a cable is removed generate an external suspend on USB
> subsystem using suspend method in usb_device_pm_ops.

The user could still cause an external resume.

> Please give your valuable feedback. Is there a way we can support this
> feature in a generic way so that all other Host controller drivers can
> reuse this code?

A third possibility is to make the host stack unregister its hcd when 
the mini-A cable is removed.  But unregistering the IRQ handler is 
simpler.

Whatever you decide to do, make sure it works okay (i.e., it doesn't 
crash) if the user rmmods the host driver while a mini-B cable is 
plugged in.

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux