usb: chipidea: udc: refine ep operation at isr_tr_complete_handler
- delete the warning message at interrupt handler, and adds judgement at ep_enable, if non-ep0 requests ctrl transfer, it will indicate an error. - delete hw_test_and_clear_setup_status which is a broken code - Tested with g_mass_storage, g_ncm, g_ether Cc: matthieu.castet@parrot.com Reported-by: Michael Grzeschik <mgr@pengutronix.de> Acked-by: Michael Grzeschik <mgr@pengutronix.de> Tested-by: Michael Grzeschik <mgr@pengutronix.de> Signed-off-by: Peter Chen <peter.chen@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
c859aa65a7
commit
64fc06c40e
@@ -177,19 +177,6 @@ static int hw_ep_get_halt(struct ci_hdrc *ci, int num, int dir)
|
|||||||
return hw_read(ci, OP_ENDPTCTRL + num, mask) ? 1 : 0;
|
return hw_read(ci, OP_ENDPTCTRL + num, mask) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* hw_test_and_clear_setup_status: test & clear setup status (execute without
|
|
||||||
* interruption)
|
|
||||||
* @n: endpoint number
|
|
||||||
*
|
|
||||||
* This function returns setup status
|
|
||||||
*/
|
|
||||||
static int hw_test_and_clear_setup_status(struct ci_hdrc *ci, int n)
|
|
||||||
{
|
|
||||||
n = ep_to_bit(ci, n);
|
|
||||||
return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hw_ep_prime: primes endpoint (execute without interruption)
|
* hw_ep_prime: primes endpoint (execute without interruption)
|
||||||
* @num: endpoint number
|
* @num: endpoint number
|
||||||
@@ -997,15 +984,11 @@ __acquires(ci->lock)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hwep->type != USB_ENDPOINT_XFER_CONTROL ||
|
/* Only handle setup packet below */
|
||||||
!hw_test_and_clear_setup_status(ci, i))
|
if (i != 0 ||
|
||||||
|
!hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(0)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (i != 0) {
|
|
||||||
dev_warn(ci->dev, "ctrl traffic at endpoint %d\n", i);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flush data and handshake transactions of previous
|
* Flush data and handshake transactions of previous
|
||||||
* setup packet.
|
* setup packet.
|
||||||
@@ -1193,6 +1176,11 @@ static int ep_enable(struct usb_ep *ep,
|
|||||||
|
|
||||||
hwep->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE); /* needed? */
|
hwep->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE); /* needed? */
|
||||||
|
|
||||||
|
if (hwep->num != 0 && hwep->type == USB_ENDPOINT_XFER_CONTROL) {
|
||||||
|
dev_err(hwep->ci->dev, "Set control xfer at non-ep0\n");
|
||||||
|
retval = -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Enable endpoints in the HW other than ep0 as ep0
|
* Enable endpoints in the HW other than ep0 as ep0
|
||||||
* is always enabled
|
* is always enabled
|
||||||
|
|||||||
Reference in New Issue
Block a user