diff options
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/renesas_usbhs/fifo.c | 23 |
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 | |||
510 | usbhs_fifo_read_end: | 522 | usbhs_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); |