aboutsummaryrefslogtreecommitdiffstats
path: root/usb/usb-s3c-hsotg-only-load-packet-per-fifo-write.patch
diff options
Diffstat (limited to 'usb/usb-s3c-hsotg-only-load-packet-per-fifo-write.patch')
-rw-r--r--usb/usb-s3c-hsotg-only-load-packet-per-fifo-write.patch39
1 files changed, 39 insertions, 0 deletions
diff --git a/usb/usb-s3c-hsotg-only-load-packet-per-fifo-write.patch b/usb/usb-s3c-hsotg-only-load-packet-per-fifo-write.patch
new file mode 100644
index 00000000000000..f60c81a3ea074f
--- /dev/null
+++ b/usb/usb-s3c-hsotg-only-load-packet-per-fifo-write.patch
@@ -0,0 +1,39 @@
+From ben@ben-laptop.fluff.org Thu Jul 22 16:49:36 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: Only load packet per fifo write
+Date: Mon, 19 Jul 2010 09:40:45 +0100
+Message-Id: <1279528850-28245-7-git-send-email-ben-linux@fluff.org>
+
+Limit the IN FIFO write to a single packet per attempt at writing,
+as per the specifications and ensure that we don't return fifo-full
+so that we can continue writing packets if we have the space.
+
+Signed-off-by: Ben Dooks <ben-linux@fluff.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/gadget/s3c-hsotg.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/drivers/usb/gadget/s3c-hsotg.c
++++ b/drivers/usb/gadget/s3c-hsotg.c
+@@ -538,6 +538,17 @@ static int s3c_hsotg_write_fifo(struct s
+ if (can_write > 512)
+ can_write = 512;
+
++ /* limit the write to one max-packet size worth of data, but allow
++ * the transfer to return that it did not run out of fifo space
++ * doing it. */
++ if (to_write > hs_ep->ep.maxpacket) {
++ to_write = hs_ep->ep.maxpacket;
++
++ s3c_hsotg_en_gsint(hsotg,
++ periodic ? S3C_GINTSTS_PTxFEmp :
++ S3C_GINTSTS_NPTxFEmp);
++ }
++
+ /* see if we can write data */
+
+ if (to_write > can_write) {