From patchwork Wed Apr 17 23:45:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcel Ziswiler X-Patchwork-Id: 1087304 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ziswiler.com Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 44kzQz0V1Dz9s00 for ; Thu, 18 Apr 2019 09:46:32 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 075A2C21DAF; Wed, 17 Apr 2019 23:46:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 08303C21C27; Wed, 17 Apr 2019 23:46:24 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7261EC21C27; Wed, 17 Apr 2019 23:46:22 +0000 (UTC) Received: from mout.perfora.net (mout.perfora.net [74.208.4.196]) by lists.denx.de (Postfix) with ESMTPS id 90D20C21BE5 for ; Wed, 17 Apr 2019 23:46:21 +0000 (UTC) Received: from marcel-nb-toradex-int.lan ([81.221.130.80]) by mrelay.perfora.net (mreueus001 [74.208.5.2]) with ESMTPSA (Nemesis) id 0MSKsP-1hR6aZ1CPr-00TTOC; Thu, 18 Apr 2019 01:46:08 +0200 From: Marcel Ziswiler To: u-boot@lists.denx.de Date: Thu, 18 Apr 2019 01:45:58 +0200 Message-Id: <20190417234558.11856-1-marcel@ziswiler.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-Provags-ID: V03:K1:ux5+F9d4+G8N7BLyIsuB7iboHO1AG68qUoX1i+nsYRn7OfFqsdh Fx7QmTQ7aARKmiQ5P9FaAqL9ybw1g0B73HsQp2dUfpfgCv4+lWn+N1zeljciXtMktpEfBy9 qXWk1c4l0JriIzf57AZSoc9oYoXDWiZLZmYAQG73dw3l86BlBKpNRfELCNmpTh3O9qiAzUp LzPhUmLA0rKSRJi/jjjJA== X-UI-Out-Filterresults: notjunk:1; V03:K0:0jRXg22UXW8=:Wk3azwsDWtGk0aFJBYrtzD awPE2BPGi+LxBxOepE5Difz8oW2dIP6rKElSb1FaWhYGfruC6eOCos/bJjVwKvw4jAQvDTZML IufVI/HcVwFNEHRM7+NRa61qsnge4Oq0KiVlJM3D3lA+d1aM3u+9W148efc7+Idnd6wcF192l LXcwZX9CIvJ/C/ZLZRvDQ5KPFhAbBhYRSMcvQM+FBPFozP6AH7zK0ypar+0y3mdM4wsx0mGF+ 8HgvpqyiRHtLZUlRFI5QNuHhCevZMlrKpD82xlPC7xm275rU+tRCIqCtAgT84ckZvZWInd0NZ 7HJpfkmeossN6G76iu1GJltNpsj0xDmoHemLwCajGMkniFzl4dMgpQY6O0ZDg6Rcfy6OwEaWt 0IvxDbphE+Nbi21yJsR6WmNz/dxjSySm+w5RujG8AJlwu5tM50r3eFJzeQ79m+Bwh3dJh0EEs jJcgqhMO/GSXzLXeUOHoB+AQodHYAwCrbB/be+ckiuU4U/IJtvhKjtI4dFnRVT7k2wFDE9fJi PURMr2s/QX1GKCFt5iP2puf2IGsIXbTRnP6gFl3qQ9cEpoPif8vKWQjZ56Fk2ewXOq/jbVA4T YqHKezmthL20oDK+pc1bq5uaYwjZ5sOlrR2r+IA7OY8hFNddfHRWqok2WDndnjHDoWvb0nIbH Uepmjs39MQ++FAC1pjYiG/U4A5bKO3O/4x5R2Euq0BKOOLpOGlUZ4kAlEJSuF2y3SBHX+SntI AWfy6YWA1kWaljF+izglec0EzUQnbuYdjJYvoQ== Cc: Marek Vasut , Marcel Ziswiler , Marcel Ziswiler , Sven Schwermer Subject: [U-Boot] [RFC PATCH v3] usb: limit USB_MAX_XFER_BLK to 256 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" From: Peng Fan For Some USB mass storage devices, such as: " - Kingston DataTraveler 2.0 001D7D06CF09B04199C7B3EA - Class: (from Interface) Mass Storage - PacketSize: 64 Configurations: 1 - Vendor: 0x0930 Product 0x6545 Version 1.16 " When `usb read 0x80000000 0 0x2000`, we met "EHCI timed out on TD - token=0x80008d80". The devices does not support scsi VPD page, we are not able to get the maximum transfer length for READ(10)/WRITE(10). So we limit this to 256 blocks as READ(6). Signed-off-by: Peng Fan Acked-by: Marcel Ziswiler (cherry picked from commit df0052575b2bc9d66ae73584768e1a457ed5d914) Signed-off-by: Marcel Ziswiler --- This comes from NXP's downstream and has proven to tremendously improve the situation with those odd USB mass storage aka memory sticks. This is why I post it here asking whether or not this may be something benefiting more people. Any feedback and suggestions are welcome. Changes in v3: - Drop the reference to the NXP internal MLK-xxx tracking number as suggested by Peng. Changes in v2: - Fixed spelling in comment as suggested by Igor. common/usb_storage.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/usb_storage.c b/common/usb_storage.c index 8c889bb1a6..4e284645f5 100644 --- a/common/usb_storage.c +++ b/common/usb_storage.c @@ -949,7 +949,11 @@ static void usb_stor_set_max_xfer_blk(struct usb_device *udev, * there is enough free heap space left, but the SCSI READ(10) and * WRITE(10) commands are limited to 65535 blocks. */ - blk = USHRT_MAX; + /* + * Some USB mass storage devices have issues, limiting this to 256 + * fixes this. + */ + blk = 256; #else blk = 20; #endif