From patchwork Fri Mar 1 14:30:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?=C5=81ukasz_Majewski?= X-Patchwork-Id: 224376 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 160FC2C17C4 for ; Sat, 2 Mar 2013 01:31:06 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 95B6E4A0F7; Fri, 1 Mar 2013 15:31:03 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2vy-CF3Stvlm; Fri, 1 Mar 2013 15:31:03 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 6CDB04A0F1; Fri, 1 Mar 2013 15:31:02 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 212584A0F1 for ; Fri, 1 Mar 2013 15:31:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Yl6vkgCZ7pV0 for ; Fri, 1 Mar 2013 15:30:58 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by theia.denx.de (Postfix) with ESMTP id 7CD144A0F0 for ; Fri, 1 Mar 2013 15:30:56 +0100 (CET) Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MIZ00IXXKBFN840@mailout4.samsung.com> for u-boot@lists.denx.de; Fri, 01 Mar 2013 23:30:51 +0900 (KST) X-AuditID: cbfee61a-b7f7d6d000000f4e-11-5130bb9b2e1c Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A4.DB.03918.B9BB0315; Fri, 01 Mar 2013 23:30:51 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MIZ008KVKAM3G20@mmp2.samsung.com>; Fri, 01 Mar 2013 23:30:51 +0900 (KST) From: Lukasz Majewski To: u-boot@lists.denx.de Date: Fri, 01 Mar 2013 15:30:18 +0100 Message-id: <1362148218-22392-1-git-send-email-l.majewski@samsung.com> X-Mailer: git-send-email 1.7.10 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPJMWRmVeSWpSXmKPExsVy+t9jQd3Zuw0CDS7/ULU42/SG3eLNI26L Nw83M1q8aWtktNh1ezKLxeTF85kt3u7tZHdg95j3cyKTx7xZJ1g8zt7ZweixbtpbZo++LasY PY7f2M4UwBbFZZOSmpNZllqkb5fAlXH8ST9TQZNwxYEJoQ2M2/m7GDk5JARMJKb/ncQOYYtJ XLi3ng3EFhKYzihx7y9nFyMXkN3FJLFw0ycmkASbgJ7E57tPwWwRAQmJX/1XGUGKmAU+MEqc 2/uFBSQhLJAp8ejuabAiFgFVicXn7gAVcXDwCrhJTF4eDLFMXuLp/T62CYzcCxgZVjGKphYk FxQnpeca6hUn5haX5qXrJefnbmIEB8szqR2MKxssDjEKcDAq8fCurNEPFGJNLCuuzD3EKMHB rCTCe3KbQaAQb0piZVVqUX58UWlOavEhRmkOFiVxXsZTTwKEBNITS1KzU1MLUotgskwcnFIN jPpWVSvd5h9Q2867bUVSg0M947srjKbXXi9+WFzxOtBuZlTUzUcBzz59Z3LJFBD9G87l+Gjv hAzdT0tnfFBxdi9UYjhq9PTffo5b0YfYjvIs7ovdzTHn1pN7x5PNJ/yWaLhq9XH95zVVN5bN 2ivZoRbJpSouO0dSQNb7d/z3XTs8vubqP4p6FKLEUpyRaKjFXFScCADnKU6NEgIAAA== Cc: Marek Vasut , Lukasz Majewski , Pantelis Antoniou , Kyungmin Park , Tom Rini Subject: [U-Boot] [PATCH] usb:composite:fix Provide function data when addressing device with only one interface X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This commit fixes problems with some non-standard requests send with device address instead of interface address (bmRequestType.Receipent field). This happens with dfu-util (debian version: 0.5), which address non standard requests (like w_value=0x21 and bRequest=GET_DESCRIPTOR) to device. Without this fix, the above request is STALLED, and hence causes dfu-util to assume some standard configuration (packet size = 1024B instead of 4096B) In turn it displays following errors: Error obtaining DFU functional descriptor Warning: Assuming DFU version 1.0 Warning: Transfer size can not be detected ... Warning: Trying default transfer size 1024 This fix allows passing non-standard request to function setup code, where it shall be handled. Tested at: Trats (exynos4210) Tested with:DFU and UMS gadgets Signed-off-by: Lukasz Majewski Signed-off-by: Kyungmin Park Tested-by: Tom Rini --- This patch fixes problem pointed by Pantelis Antoniou. It is supposed to replace following commit added to u-boot-usb repository: "dfu: Send correct DFU response from composite_setup" SHA1: fef31049fa06e516945114195eb14ac3549d0ad2 --- drivers/usb/gadget/composite.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c index ebb5131..2c5600e 100644 --- a/drivers/usb/gadget/composite.c +++ b/drivers/usb/gadget/composite.c @@ -859,6 +859,25 @@ unknown: if (&f->list == &cdev->config->functions) f = NULL; break; + /* + * dfu-util (version 0.5) sets bmRequestType.Receipent = Device + * for non-standard request (w_value = 0x21, + * bRequest = GET_DESCRIPTOR in this case). + * When only one interface is registered (as it is done now), + * then this request shall be handled as it was requested for + * interface. + * + * In the below code it is checked if only one interface is + * present and proper function for it is extracted. Due to that + * function's setup (f->setup) is called to handle this + * special non-standard request. + */ + case USB_RECIP_DEVICE: + debug("cdev->config->next_interface_id: %d intf: %d\n", + cdev->config->next_interface_id, intf); + if (cdev->config->next_interface_id == 1) + f = cdev->config->interface[intf]; + break; } if (f && f->setup)