aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/renesas_usbhs/fifo.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2011-10-11 01:05:51 -0400
committerFelipe Balbi <balbi@ti.com>2011-10-13 13:41:46 -0400
commit6ff5d09bd2fd5943f5b16cb1e3453446a1f575e2 (patch)
tree8adfa67adf3e32329be391720da2184272b64e3a /drivers/usb/renesas_usbhs/fifo.c
parent6e6db82ba9bf2d5912897f77ccf6902cb8543372 (diff)
usb: gadget: renesas_usbhs: disable pipe on top of interrupt
When data read interrupt happened, the pipe is BUF which means "enable". then, next un-necessary interrupt/token might be issued again when all data were popped from fifo. It will cause un-understandable bug. This patch decides pipe disable on top of read interrupt. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/renesas_usbhs/fifo.c')
-rw-r--r--drivers/usb/renesas_usbhs/fifo.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/usb/renesas_usbhs/fifo.c b/drivers/usb/renesas_usbhs/fifo.c
index 87f56b604809..1a345c20105f 100644
--- a/drivers/usb/renesas_usbhs/fifo.c
+++ b/drivers/usb/renesas_usbhs/fifo.c
@@ -476,6 +476,20 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
476 total_len = len; 476 total_len = len;
477 477
478 /* 478 /*
479 * update actual length first here to decide disable pipe.
480 * if this pipe keeps BUF status and all data were popped,
481 * then, next interrupt/token will be issued again
482 */
483 pkt->actual += total_len;
484
485 if ((pkt->actual == pkt->length) || /* receive all data */
486 (total_len < maxp)) { /* short packet */
487 *is_done = 1;
488 usbhsf_rx_irq_ctrl(pipe, 0);
489 usbhs_pipe_disable(pipe); /* disable pipe first */
490 }
491
492 /*
479 * Buffer clear if Zero-Length packet 493 * Buffer clear if Zero-Length packet
480 * 494 *
481 * see 495 * see
@@ -505,16 +519,7 @@ static int usbhsf_pio_try_pop(struct usbhs_pkt *pkt, int *is_done)
505 buf[i] = (data >> ((i & 0x03) * 8)) & 0xff; 519 buf[i] = (data >> ((i & 0x03) * 8)) & 0xff;
506 } 520 }
507 521
508 pkt->actual += total_len;
509
510usbhs_fifo_read_end: 522usbhs_fifo_read_end:
511 if ((pkt->actual == pkt->length) || /* receive all data */
512 (total_len < maxp)) { /* short packet */
513 *is_done = 1;
514 usbhsf_rx_irq_ctrl(pipe, 0);
515 usbhs_pipe_disable(pipe);
516 }
517
518 dev_dbg(dev, " recv %d (%d/ %d/ %d/ %d)\n", 523 dev_dbg(dev, " recv %d (%d/ %d/ %d/ %d)\n",
519 usbhs_pipe_number(pipe), 524 usbhs_pipe_number(pipe),
520 pkt->length, pkt->actual, *is_done, pkt->zero); 525 pkt->length, pkt->actual, *is_done, pkt->zero);