usb: gadget: aspeed: Cleanup EP0 state on port reset
Otherwise, we can have a stale state after a disconnect and reconnect causing errors on the first SETUP packet to the device. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
9fbbeb4eff
commit
d042c35eb8
|
@ -55,6 +55,9 @@ static void ast_vhub_dev_enable(struct ast_vhub_dev *d)
|
|||
if (d->enabled)
|
||||
return;
|
||||
|
||||
/* Cleanup EP0 state */
|
||||
ast_vhub_reset_ep0(d);
|
||||
|
||||
/* Enable device and its EP0 interrupts */
|
||||
reg = VHUB_DEV_EN_ENABLE_PORT |
|
||||
VHUB_DEV_EN_EP0_IN_ACK_IRQEN |
|
||||
|
|
|
@ -459,6 +459,15 @@ static const struct usb_ep_ops ast_vhub_ep0_ops = {
|
|||
.free_request = ast_vhub_free_request,
|
||||
};
|
||||
|
||||
void ast_vhub_reset_ep0(struct ast_vhub_dev *dev)
|
||||
{
|
||||
struct ast_vhub_ep *ep = &dev->ep0;
|
||||
|
||||
ast_vhub_nuke(ep, -EIO);
|
||||
ep->ep0.state = ep0_state_token;
|
||||
}
|
||||
|
||||
|
||||
void ast_vhub_init_ep0(struct ast_vhub *vhub, struct ast_vhub_ep *ep,
|
||||
struct ast_vhub_dev *dev)
|
||||
{
|
||||
|
|
|
@ -507,6 +507,7 @@ void ast_vhub_init_hw(struct ast_vhub *vhub);
|
|||
/* ep0.c */
|
||||
void ast_vhub_ep0_handle_ack(struct ast_vhub_ep *ep, bool in_ack);
|
||||
void ast_vhub_ep0_handle_setup(struct ast_vhub_ep *ep);
|
||||
void ast_vhub_reset_ep0(struct ast_vhub_dev *dev);
|
||||
void ast_vhub_init_ep0(struct ast_vhub *vhub, struct ast_vhub_ep *ep,
|
||||
struct ast_vhub_dev *dev);
|
||||
int ast_vhub_reply(struct ast_vhub_ep *ep, char *ptr, int len);
|
||||
|
|
Loading…
Reference in New Issue