Re: [PATCH 1/2] usb: musb: ignore spurious SESSREQ interrupts

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

 



On Wed, Sep 22, 2010 at 04:47:21AM -0500, Heikki Krogerus wrote:
On Wed, Sep 22, 2010 at 10:15:16AM +0200, ext Felipe Balbi wrote:
On Wed, Sep 22, 2010 at 03:13:41AM -0500, Heikki Krogerus wrote:
On Wed, Sep 22, 2010 at 10:09:34AM +0200, ext Felipe Balbi wrote:
On Wed, Sep 22, 2010 at 02:52:49AM -0500, Krogerus Heikki (EXT-Teleca/Helsinki) wrote:
This will ignore any SESSREQ interrupt if musb is B-device.
Charger detection may cause spurious SESSREQ interrupts.

is this still true if we keep MUSB powered down ?

No, but what if we don't :).

ok, but the target is to keep it turned off until we need it. We still
don't have a "USB Charging" framework on the kernel, so let's write one
from scratch with good assumptions :-)

How can I power down musb in to a state where I can still access ULPI,
but avoid the spurious SESSREQ interrupts?

true, but then you need a different check since SESSREQ is only valid
for A device and when you're doing charger detection, you're still on B
state. And ID pin should never be grounded. Maybe what we need is
something like:

if (int_usb & MUSB_INTR_SESSREQ) {
	void __iomem	*mbase = musb->mregs;
	u8		devctl;

	devctl = musb_read(mbase, MUSB_DEVCTL);
	if (devctl & MUSB_DEVCTL_BDEVICE) {
		DBG(3, "SessReq while on B state\n");
		return;
	}

	DBG(1, "SESSION_REQUEST (%s)\n", otg_state_string(musb));

	/* IRQ arrives from ID pin sense or (later, if VBUS power
	 * is removed) SRP.  responses are time critical:
	 *  - turn on VBUS (with silicon-specific mechanism)
	 *  - go through A_WAIT_VRISE
	 *  - ... to A_WAIT_BCON.
	 * a_wait_vrise_tmout triggers VBUS_ERROR transitions
	 */
	musb_writeb(mbase, MUSB_DEVCTL, MUSB_DEVCTL_SESSION);
	musb->ep0_stage = MUSB_EP0_START;
	musb->xceiv->state = OTG_STATE_A_IDLE;
	MUSB_HST_MODE(musb);
	musb_set_vbus(musb, 1);

	handled = IRQ_HANDLED;
}

could you check if it works ??

--
balbi
--
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