aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangwook Lee <sangwook.lee@linaro.org>2012-03-07 16:46:26 +0000
committerTushar Behera <tushar.behera@linaro.org>2012-03-08 15:14:12 +0530
commit682745726ab59e4d1be50844edef552b6b2e339f (patch)
tree28542ddeaab5d68056e552d73fe4a068005fc037
parent9394826b996640a65f892a4305c32e63b206020e (diff)
usb:hsotg:samsung: add missing patch upsamsung-lt-v3.3-rc5-2
Need to sync the base-line file with the latest patch set for gadget Copy missing code for s3c-hsotg.c from - git://git.infradead.org/users/kmpark/linux-samsung usb-s3c-hsotg Signed-off-by: Sangwook Lee <sangwook.lee@linaro.org>
-rw-r--r--drivers/usb/gadget/s3c-hsotg.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
index c85194942427..4262df8f2021 100644
--- a/drivers/usb/gadget/s3c-hsotg.c
+++ b/drivers/usb/gadget/s3c-hsotg.c
@@ -1839,15 +1839,21 @@ static void s3c_hsotg_complete_in(struct s3c_hsotg *hsotg,
__func__, hs_req->req.actual, size_done);
hs_req->req.actual = size_done;
- dev_dbg(hsotg->dev, "req->length:%d req->actual:%d\n",
- hs_req->req.length, hs_req->req.actual);
-
- /* Check if dealing with Maximum Packet Size(MPS) IN transfer (EP0)
- * When req.lenght == ep.maxpacket then send IN ZLP packet to
- * inform host that no more data is available.
+ dev_dbg(hsotg->dev, "req->length:%d req->actual:%d req->zero:%d\n",
+ hs_req->req.length, hs_req->req.actual, hs_req->req.zero);
+
+ /* Check if dealing with Maximum Packet Size(MPS) IN transfer at EP0
+ * When sent data is a multiple MPS size (e.g. 64B ,128B ,192B
+ * ,256B ... ), after last MPS sized packet send IN ZLP packet to
+ * inform the host that no more data is available.
+ * The state of req.zero member is checked to be sure that the value to
+ * send is smaller than wValue expected from host.
+ * Check req.length to NOT send another ZLP when the current one is
+ * under completion (the one for which this completion has been called).
*/
- if (hs_req->req.length == hs_req->req.actual && hs_ep->index == 0
- && hs_req->req.length == hs_ep->ep.maxpacket) {
+ if (hs_req->req.length && hs_ep->index == 0 && hs_req->req.zero
+ && hs_req->req.length == hs_req->req.actual
+ && !(hs_req->req.length % hs_ep->ep.maxpacket)) {
dev_dbg(hsotg->dev, "ep0 zlp IN packet sent\n");
s3c_hsotg_send_zlp(hsotg, hs_req);