diff options
| author | Peter Chen <peter.chen@freescale.com> | 2014-02-19 00:41:41 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-24 20:07:52 -0500 |
| commit | 64fc06c40e01aa8129f5bc4c51567b5e205126b0 (patch) | |
| tree | 063b28ae9f0b3baa4103fff11e8eee72d8843023 | |
| parent | c859aa65a7ec40c02f435f14fa71de2a87c64513 (diff) | |
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>
| -rw-r--r-- | drivers/usb/chipidea/udc.c | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 0a61c6688bc1..0dc56aebb807 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c | |||
| @@ -178,19 +178,6 @@ static int hw_ep_get_halt(struct ci_hdrc *ci, int num, int dir) | |||
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | /** | 180 | /** |
| 181 | * hw_test_and_clear_setup_status: test & clear setup status (execute without | ||
| 182 | * interruption) | ||
| 183 | * @n: endpoint number | ||
| 184 | * | ||
| 185 | * This function returns setup status | ||
| 186 | */ | ||
| 187 | static int hw_test_and_clear_setup_status(struct ci_hdrc *ci, int n) | ||
| 188 | { | ||
| 189 | n = ep_to_bit(ci, n); | ||
| 190 | return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n)); | ||
| 191 | } | ||
| 192 | |||
| 193 | /** | ||
| 194 | * hw_ep_prime: primes endpoint (execute without interruption) | 181 | * hw_ep_prime: primes endpoint (execute without interruption) |
| 195 | * @num: endpoint number | 182 | * @num: endpoint number |
| 196 | * @dir: endpoint direction | 183 | * @dir: endpoint direction |
| @@ -997,14 +984,10 @@ __acquires(ci->lock) | |||
| 997 | } | 984 | } |
| 998 | } | 985 | } |
| 999 | 986 | ||
| 1000 | if (hwep->type != USB_ENDPOINT_XFER_CONTROL || | 987 | /* Only handle setup packet below */ |
| 1001 | !hw_test_and_clear_setup_status(ci, i)) | 988 | if (i != 0 || |
| 1002 | continue; | 989 | !hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(0))) |
| 1003 | |||
| 1004 | if (i != 0) { | ||
| 1005 | dev_warn(ci->dev, "ctrl traffic at endpoint %d\n", i); | ||
| 1006 | continue; | 990 | continue; |
| 1007 | } | ||
| 1008 | 991 | ||
| 1009 | /* | 992 | /* |
| 1010 | * Flush data and handshake transactions of previous | 993 | * Flush data and handshake transactions of previous |
| @@ -1193,6 +1176,11 @@ static int ep_enable(struct usb_ep *ep, | |||
| 1193 | 1176 | ||
| 1194 | hwep->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE); /* needed? */ | 1177 | hwep->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE); /* needed? */ |
| 1195 | 1178 | ||
| 1179 | if (hwep->num != 0 && hwep->type == USB_ENDPOINT_XFER_CONTROL) { | ||
| 1180 | dev_err(hwep->ci->dev, "Set control xfer at non-ep0\n"); | ||
| 1181 | retval = -EINVAL; | ||
| 1182 | } | ||
| 1183 | |||
| 1196 | /* | 1184 | /* |
| 1197 | * Enable endpoints in the HW other than ep0 as ep0 | 1185 | * Enable endpoints in the HW other than ep0 as ep0 |
| 1198 | * is always enabled | 1186 | * is always enabled |
