aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2011-10-18 13:13:29 -0400
committerFelipe Balbi <balbi@ti.com>2011-12-12 04:48:21 -0500
commit8ee6270c7f0aeba07355eee82d687efcd8ca9d39 (patch)
tree8ec4379f26fbfe5c25ab80e4fbb1069419ccaf5b /drivers/usb/dwc3
parent0cc7a519c424c8f07d5ef5e3928b7a07446c5303 (diff)
usb: dwc3: remove special status request handling in ep0
The GetStatus (STD)-request is handled the driver and uses a tiny hack to send the two bytes long answer. This patch removes the custom hack uses the normal usb_ep_queue() for that. Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/core.h2
-rw-r--r--drivers/usb/dwc3/ep0.c31
2 files changed, 8 insertions, 25 deletions
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 6f1e8c98d78..bebb5e1530a 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -575,7 +575,6 @@ struct dwc3_hwparams {
575 * @mode: mode of operation 575 * @mode: mode of operation
576 * @is_selfpowered: true when we are selfpowered 576 * @is_selfpowered: true when we are selfpowered
577 * @three_stage_setup: set if we perform a three phase setup 577 * @three_stage_setup: set if we perform a three phase setup
578 * @ep0_status_pending: ep0 status response without a req is pending
579 * @ep0_bounced: true when we used bounce buffer 578 * @ep0_bounced: true when we used bounce buffer
580 * @ep0_expect_in: true when we expect a DATA IN transfer 579 * @ep0_expect_in: true when we expect a DATA IN transfer
581 * @start_config_issued: true when StartConfig command has been issued 580 * @start_config_issued: true when StartConfig command has been issued
@@ -630,7 +629,6 @@ struct dwc3 {
630 629
631 unsigned is_selfpowered:1; 630 unsigned is_selfpowered:1;
632 unsigned three_stage_setup:1; 631 unsigned three_stage_setup:1;
633 unsigned ep0_status_pending:1;
634 unsigned ep0_bounced:1; 632 unsigned ep0_bounced:1;
635 unsigned ep0_expect_in:1; 633 unsigned ep0_expect_in:1;
636 unsigned start_config_issued:1; 634 unsigned start_config_issued:1;
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 900627cf860..13c898b4cc1 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -191,8 +191,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct usb_request *request,
191 191
192 /* we share one TRB for ep0/1 */ 192 /* we share one TRB for ep0/1 */
193 if (!list_empty(&dwc->eps[0]->request_list) || 193 if (!list_empty(&dwc->eps[0]->request_list) ||
194 !list_empty(&dwc->eps[1]->request_list) || 194 !list_empty(&dwc->eps[1]->request_list)) {
195 dwc->ep0_status_pending) {
196 ret = -EBUSY; 195 ret = -EBUSY;
197 goto out; 196 goto out;
198 } 197 }
@@ -224,7 +223,6 @@ static void dwc3_ep0_stall_and_restart(struct dwc3 *dwc)
224 dwc3_gadget_giveback(dep, req, -ECONNRESET); 223 dwc3_gadget_giveback(dep, req, -ECONNRESET);
225 } 224 }
226 225
227 dwc->ep0_status_pending = 0;
228 dwc->ep0state = EP0_SETUP_PHASE; 226 dwc->ep0state = EP0_SETUP_PHASE;
229 dwc3_ep0_out_start(dwc); 227 dwc3_ep0_out_start(dwc);
230} 228}
@@ -255,13 +253,9 @@ static struct dwc3_ep *dwc3_wIndex_to_dep(struct dwc3 *dwc, __le16 wIndex_le)
255 return NULL; 253 return NULL;
256} 254}
257 255
258static void dwc3_ep0_send_status_response(struct dwc3 *dwc) 256static void dwc3_ep0_status_cmpl(struct usb_ep *ep, struct usb_request *req)
259{ 257{
260 dwc3_ep0_start_trans(dwc, 1, dwc->setup_buf_addr,
261 dwc->ep0_usb_req.length,
262 DWC3_TRBCTL_CONTROL_DATA);
263} 258}
264
265/* 259/*
266 * ch 9.4.5 260 * ch 9.4.5
267 */ 261 */
@@ -304,9 +298,10 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc, struct usb_ctrlrequest *ctrl
304 response_pkt = (__le16 *) dwc->setup_buf; 298 response_pkt = (__le16 *) dwc->setup_buf;
305 *response_pkt = cpu_to_le16(usb_status); 299 *response_pkt = cpu_to_le16(usb_status);
306 dwc->ep0_usb_req.length = sizeof(*response_pkt); 300 dwc->ep0_usb_req.length = sizeof(*response_pkt);
307 dwc->ep0_status_pending = 1; 301 dwc->ep0_usb_req.dma = dwc->setup_buf_addr;
308 302 dwc->ep0_usb_req.complete = dwc3_ep0_status_cmpl;
309 return 0; 303 return usb_ep_queue(&dwc->eps[1]->endpoint, &dwc->ep0_usb_req,
304 GFP_ATOMIC);
310} 305}
311 306
312static int dwc3_ep0_handle_feature(struct dwc3 *dwc, 307static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
@@ -567,13 +562,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
567 562
568 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS; 563 dwc->ep0_next_event = DWC3_EP0_NRDY_STATUS;
569 564
570 if (!dwc->ep0_status_pending) { 565 r = next_request(&dwc->eps[0]->request_list);
571 r = next_request(&dwc->eps[0]->request_list); 566 ur = &r->request;
572 ur = &r->request;
573 } else {
574 ur = &dwc->ep0_usb_req;
575 dwc->ep0_status_pending = 0;
576 }
577 567
578 dwc3_trb_to_nat(dwc->ep0_trb, &trb); 568 dwc3_trb_to_nat(dwc->ep0_trb, &trb);
579 569
@@ -665,11 +655,6 @@ static void dwc3_ep0_do_control_data(struct dwc3 *dwc,
665 dep = dwc->eps[0]; 655 dep = dwc->eps[0];
666 dwc->ep0state = EP0_DATA_PHASE; 656 dwc->ep0state = EP0_DATA_PHASE;
667 657
668 if (dwc->ep0_status_pending) {
669 dwc3_ep0_send_status_response(dwc);
670 return;
671 }
672
673 if (list_empty(&dep->request_list)) { 658 if (list_empty(&dep->request_list)) {
674 dev_vdbg(dwc->dev, "pending request for EP0 Data phase\n"); 659 dev_vdbg(dwc->dev, "pending request for EP0 Data phase\n");
675 dep->flags |= DWC3_EP_PENDING_REQUEST; 660 dep->flags |= DWC3_EP_PENDING_REQUEST;