aboutsummaryrefslogtreecommitdiffstats
path: root/usb/usb-s3c-hsotg-avoid-overwriting-contents-of-perodic-in-fifo.patch
diff options
Diffstat (limited to 'usb/usb-s3c-hsotg-avoid-overwriting-contents-of-perodic-in-fifo.patch')
-rw-r--r--usb/usb-s3c-hsotg-avoid-overwriting-contents-of-perodic-in-fifo.patch51
1 files changed, 51 insertions, 0 deletions
diff --git a/usb/usb-s3c-hsotg-avoid-overwriting-contents-of-perodic-in-fifo.patch b/usb/usb-s3c-hsotg-avoid-overwriting-contents-of-perodic-in-fifo.patch
new file mode 100644
index 00000000000000..699fd2f9f8df31
--- /dev/null
+++ b/usb/usb-s3c-hsotg-avoid-overwriting-contents-of-perodic-in-fifo.patch
@@ -0,0 +1,51 @@
+From ben@ben-laptop.fluff.org Thu Jul 22 16:49:05 2010
+From: Ben Dooks <ben-linux@fluff.org>
+To: linux-samsung-soc@vger.kernel.org, linux-usb@vger.kernel.org
+Cc: gregkh@suse.de, Ben Dooks <ben-linux@fluff.org>
+Subject: USB: s3c-hsotg: Avoid overwriting contents of perodic in 'fifo'
+Date: Mon, 19 Jul 2010 09:40:42 +0100
+Message-Id: <1279528850-28245-4-git-send-email-ben-linux@fluff.org>
+
+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>
+
+---
+ drivers/usb/gadget/s3c-hsotg.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+--- a/drivers/usb/gadget/s3c-hsotg.c
++++ b/drivers/usb/gadget/s3c-hsotg.c
+@@ -91,7 +91,9 @@ struct s3c_hsotg_req;
+ * For periodic IN endpoints, we have fifo_size and fifo_load to try
+ * and keep track of the amount of data in the periodic FIFO for each
+ * of these as we don't have a status register that tells us how much
+- * is in each of them.
++ * is in each of them. (note, this may actually be useless information
++ * as in shared-fifo mode periodic in acts like a single-frame packet
++ * buffer than a fifo)
+ */
+ struct s3c_hsotg_ep {
+ struct usb_ep ep;
+@@ -474,6 +476,14 @@ static int s3c_hsotg_write_fifo(struct s
+
+ size_left = S3C_DxEPTSIZ_XferSize_GET(epsize);
+
++ /* if shared fifo, we cannot write anything until the
++ * previous data has been completely sent.
++ */
++ if (hs_ep->fifo_load != 0) {
++ s3c_hsotg_en_gsint(hsotg, S3C_GINTSTS_PTxFEmp);
++ return -ENOSPC;
++ }
++
+ dev_dbg(hsotg->dev, "%s: left=%d, load=%d, fifo=%d, size %d\n",
+ __func__, size_left,
+ hs_ep->size_loaded, hs_ep->fifo_load, hs_ep->fifo_size);