Commit 17be5c5f authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Greg Kroah-Hartman

USB: musb: gadget_ep0: avoid SetupEnd interrupt

Gadget stalling a zero-length SETUP request results in this error message:

SetupEnd came in a wrong ep0stage idle

In order to avoid it, always set the CSR0.DataEnd bit after detecting a zero-
length request.  Add the missing '\n' to the error message itself as well...
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Acked-by: default avatarAnand Gadiyar <gadiyar@ti.com>
Cc: stable <stable@kernel.org>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 93aa3dab
...@@ -664,7 +664,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb) ...@@ -664,7 +664,7 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
musb->ep0_state = MUSB_EP0_STAGE_STATUSIN; musb->ep0_state = MUSB_EP0_STAGE_STATUSIN;
break; break;
default: default:
ERR("SetupEnd came in a wrong ep0stage %s", ERR("SetupEnd came in a wrong ep0stage %s\n",
decode_ep0stage(musb->ep0_state)); decode_ep0stage(musb->ep0_state));
} }
csr = musb_readw(regs, MUSB_CSR0); csr = musb_readw(regs, MUSB_CSR0);
...@@ -787,12 +787,18 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb) ...@@ -787,12 +787,18 @@ irqreturn_t musb_g_ep0_irq(struct musb *musb)
handled = service_zero_data_request( handled = service_zero_data_request(
musb, &setup); musb, &setup);
/* status stage might be immediate */ /*
if (handled > 0) { * We're expecting no data in any case, so
* always set the DATAEND bit -- doing this
* here helps avoid SetupEnd interrupt coming
* in the idle stage when we're stalling...
*/
musb->ackpend |= MUSB_CSR0_P_DATAEND; musb->ackpend |= MUSB_CSR0_P_DATAEND;
/* status stage might be immediate */
if (handled > 0)
musb->ep0_state = musb->ep0_state =
MUSB_EP0_STAGE_STATUSIN; MUSB_EP0_STAGE_STATUSIN;
}
break; break;
/* sequence #1 (IN to host), includes GET_STATUS /* sequence #1 (IN to host), includes GET_STATUS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment