From patchwork Tue Mar 15 15:24:25 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mian Yousaf Kaukab X-Patchwork-Id: 575 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:43:57 -0000 Delivered-To: patches@linaro.org Received: by 10.151.46.5 with SMTP id y5cs73594ybj; Tue, 15 Mar 2011 08:26:06 -0700 (PDT) Received: by 10.213.15.82 with SMTP id j18mr2268436eba.82.1300202765205; Tue, 15 Mar 2011 08:26:05 -0700 (PDT) Received: from eu1sys200aog114.obsmtp.com (eu1sys200aog114.obsmtp.com [207.126.144.137]) by mx.google.com with SMTP id w3si20278339eeh.10.2011.03.15.08.25.58 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Mar 2011 08:26:05 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of mian.yousaf.kaukab@stericsson.com) client-ip=207.126.144.137; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.137 is neither permitted nor denied by best guess record for domain of mian.yousaf.kaukab@stericsson.com) smtp.mail=mian.yousaf.kaukab@stericsson.com Received: from source ([138.198.100.35]) (using TLSv1) by eu1sys200aob114.postini.com ([207.126.147.11]) with SMTP ID DSNKTX+FBuIfmL2CmNFN9WW8aB5AkiDfbsE3@postini.com; Tue, 15 Mar 2011 15:26:04 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 4D895105; Tue, 15 Mar 2011 15:25:54 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id A5E977AA; Tue, 15 Mar 2011 15:25:54 +0000 (GMT) Received: from exdcvycastm004.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm004", Issuer "exdcvycastm004" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 199C4A80AF; Tue, 15 Mar 2011 16:25:48 +0100 (CET) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.2) with Microsoft SMTP Server (TLS) id 8.2.254.0; Tue, 15 Mar 2011 16:25:53 +0100 From: Mian Yousaf Kaukab To: Felipe Balbi , Cc: Lee Jones , Mian Yousaf Kaukab Subject: [PATCH 2/8] usb: musb: use length of out short packet to configure dma Date: Tue, 15 Mar 2011 16:24:25 +0100 Message-ID: <1300202671-12818-3-git-send-email-mian.yousaf.kaukab@stericsson.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1300202671-12818-1-git-send-email-mian.yousaf.kaukab@stericsson.com> References: <1300202671-12818-1-git-send-email-mian.yousaf.kaukab@stericsson.com> MIME-Version: 1.0 For Inventra dma, dma is configured for rx transfers after receiving first packet (MUSB_RXCSR_RXPKTRDY set in RXCSR). DMA is configured based on the requested length or the maximum length dma can handle. However, if the received packet is less than the maximum packet size, length of this packet should be used to configure the dma. As it will be the only packet to transfer for this request. Signed-off-by: Mian Yousaf Kaukab --- drivers/usb/musb/musb_gadget.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c index 419ca3e..ba5d5bd 100644 --- a/drivers/usb/musb/musb_gadget.c +++ b/drivers/usb/musb/musb_gadget.c @@ -731,7 +731,13 @@ static void rxstate(struct musb *musb, struct musb_request *req) if (request->actual < request->length) { int transfer_size = 0; #ifdef USE_MODE1 - transfer_size = min(request->length - request->actual, + /* In case first packet is short */ + if (len < musb_ep->packet_sz) + transfer_size = len; + else + transfer_size = + min(request->length - + request->actual, channel->max_len); #else transfer_size = min(request->length - request->actual,