From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Jayat Date: Mon, 22 Feb 2016 18:51:57 +0100 Subject: [U-Boot] Issue with USB mass storage (thumb drives) In-Reply-To: <56CAB2C8.8040703@exceet.de> References: <56B08683.9000607@exceet.de> <56B309F3.9000503@exceet.de> <201602041228.53313.marex@denx.de> <56C5974E.10600@exceet.de> <56C5E3F5.4040906@denx.de> <56CAB2C8.8040703@exceet.de> Message-ID: <56CB4ABD.2090900@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Le 22/02/2016 08:03, Schrempf Frieder a ?crit : > On 18.02.2016 18:14, Fabio Estevam wrote: >> On Thu, Feb 18, 2016 at 1:32 PM, Marek Vasut wrote: >> >>>> Also one of our customers tested a few non-working sticks with this >>>> change and reported, that it fixed it for him. >>>> Here's a list of those devices, but I guess there are a lot more: >>>> >>>> 1. Silicon Motion, Inc. - Taiwan (formerly Feiya Technology Corp.) Flash >>>> Drive, VID: 0x090c, PID: 0x1000 >>>> 2. Freecom Technologies, VID: 0x07ab, PID: 0xfcf1 >>>> 3. Newron, VID: 0x8644, PID: 0x800e >>>> 4. GEMBIRD PhotoFrame PF-15-1, VID: 0x1908, PID: 0x1320 >>>> >>> Maybe we need a quirk table then ? >> It seems the list of affected devices is unknown. >> >> What would be the impact of changing USB_MAX_XFER_BLK from 65535 to 32767? >> >> Would this impact the USB transfer rate? Frieder, do you know? > I don't really know. While testing I had the feeling, that the transfer > is slightly slower, but I can't tell for sure. > Hello, I was hit by the same problem, where my USB SD card reader would timeout in U-boot when reading a large file (16 MB). Changing USB_MAX_XFER_BLK to 32767 fixed the problem but I investigated a little more. I was curious to see what the Linux kernel used, because it had no problem reading the file. In Linux, USB_MAX_XFER_BLK corresponds to max_sector in the scsiglue, which is set to 240 blocks per transfer by default, and is tunable via sysfs. There is also a list of unusual devices which needs no higher than 64 blocks per transfer. The linux USB FAQ has a very interesting entry about this which explains the rationale for this value: http://www.linux-usb.org/FAQ.html#i5 FWIW: my USB card reader is 0bda:0119 Realtek Semiconductor Corp. Storage Device (SD card reader) I've benchmarked in U-boot the time impact of this change. For reading my 16764395 bytes file: USB_MAX_XFER_BLK Read duration (as reported by U-boot): 64 3578 ms 128 2221 ms 240 1673 ms 32767 1020 ms 65535 974 ms So there is definitely a strong impact for lower values. -- Maxime Jayat