diff options
author | Ben Dooks <ben-linux@fluff.org> | 2010-07-19 04:40:42 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 17:35:42 -0400 |
commit | e7a9ff54271bf0ddbf641e5a0bde3ebda35808be (patch) | |
tree | 92c9daeab81fdba8736c18ae1b2b27e652aa55b5 /drivers/usb/gadget/s3c-hsotg.c | |
parent | 679f9b7c7c7d3c746792138e9d7d76578ef52c41 (diff) |
USB: s3c-hsotg: Avoid overwriting contents of perodic in 'fifo'
In shared fifo mode (used on older SoCs) the periodic in fifo beahves
much more like a packet buffer, discarding old data when writing new
data. Avoid this by ensuring that we do not load new transactions in
when there is data sitting already in the FIFO.
Note, this may not be an observed bug, we are fixing the case that this
may happen.
Signed-off-by: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/s3c-hsotg.c')
-rw-r--r-- | drivers/usb/gadget/s3c-hsotg.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 4a251458c61d..354fd456f8cc 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
@@ -91,7 +91,9 @@ struct s3c_hsotg_req; | |||
91 | * For periodic IN endpoints, we have fifo_size and fifo_load to try | 91 | * For periodic IN endpoints, we have fifo_size and fifo_load to try |
92 | * and keep track of the amount of data in the periodic FIFO for each | 92 | * and keep track of the amount of data in the periodic FIFO for each |
93 | * of these as we don't have a status register that tells us how much | 93 | * of these as we don't have a status register that tells us how much |
94 | * is in each of them. | 94 | * is in each of them. (note, this may actually be useless information |
95 | * as in shared-fifo mode periodic in acts like a single-frame packet | ||
96 | * buffer than a fifo) | ||
95 | */ | 97 | */ |
96 | struct s3c_hsotg_ep { | 98 | struct s3c_hsotg_ep { |
97 | struct usb_ep ep; | 99 | struct usb_ep ep; |
@@ -474,6 +476,14 @@ static int s3c_hsotg_write_fifo(struct s3c_hsotg *hsotg, | |||
474 | 476 | ||
475 | size_left = S3C_DxEPTSIZ_XferSize_GET(epsize); | 477 | size_left = S3C_DxEPTSIZ_XferSize_GET(epsize); |
476 | 478 | ||
479 | /* if shared fifo, we cannot write anything until the | ||
480 | * previous data has been completely sent. | ||
481 | */ | ||
482 | if (hs_ep->fifo_load != 0) { | ||
483 | s3c_hsotg_en_gsint(hsotg, S3C_GINTSTS_PTxFEmp); | ||
484 | return -ENOSPC; | ||
485 | } | ||
486 | |||
477 | dev_dbg(hsotg->dev, "%s: left=%d, load=%d, fifo=%d, size %d\n", | 487 | dev_dbg(hsotg->dev, "%s: left=%d, load=%d, fifo=%d, size %d\n", |
478 | __func__, size_left, | 488 | __func__, size_left, |
479 | hs_ep->size_loaded, hs_ep->fifo_load, hs_ep->fifo_size); | 489 | hs_ep->size_loaded, hs_ep->fifo_load, hs_ep->fifo_size); |