aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/s3c-hsotg.c
diff options
context:
space:
mode:
authorBen Dooks <ben-linux@fluff.org>2010-07-19 09:40:45 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-10 14:35:42 -0700
commit03e10e5ab5ba6511ddaf80085cf08c62e9336fa5 (patch)
treeef2bce4b63f9ba1811b8ef89bc8b08d85b01e838 /drivers/usb/gadget/s3c-hsotg.c
parent10aebc772a10c95e30dff0779cb0f879b8f1554f (diff)
downloadkernel_samsung_smdk4412-03e10e5ab5ba6511ddaf80085cf08c62e9336fa5.zip
kernel_samsung_smdk4412-03e10e5ab5ba6511ddaf80085cf08c62e9336fa5.tar.gz
kernel_samsung_smdk4412-03e10e5ab5ba6511ddaf80085cf08c62e9336fa5.tar.bz2
USB: s3c-hsotg: Only load packet per fifo write
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>
Diffstat (limited to 'drivers/usb/gadget/s3c-hsotg.c')
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index 4196e37..df6a39d 100644
--- 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 s3c_hsotg *hsotg,
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) {