summaryrefslogtreecommitdiff
path: root/common/usb_storage.c
AgeCommit message (Collapse)Author
2012-09-01usb: Optimize USB storage read/writeJim Shimer
Trim down the IO times by removing uneeded test unit reeady calls. Signed-off-by: Jim Shimer <mgi2475@motorola.com>
2012-09-01usb_stor_BBB_transport: Do not delay when not requiredBenoît Thébaudeau
There is a 5-ms delay in usb_stor_BBB_transport, which occurs every 10 kiB of data for fragmented fatload usb, i.e. roughly 500 ms of delay per MiB. This adds up to quite a bit of delay if you're loading a large ramdisk. The purpose of this delay should be to debounce the 5-V/100-mA USB power up. This patch skips the delay if the device has already been queried as ready. Signed-off-by: Jim Shimer <mgi2475@motorola.com> Rework following the review: - Rebase against the latest u-boot-usb master. - Replace typedef with #define. - Use the existing flags struct field instead of adding a new field. - Remove the setter function. - Remove the typecasts. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Marek Vasut <marex@denx.de> Cc: Ilya Yanok <ilya.yanok@cogentembedded.com> Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net> Cc: Jim Shimer <mgi2475@motorola.com>
2012-09-01usb_storage: Remove EHCI constraintsBenoît Thébaudeau
Now that the EHCI driver allocates its qTDs from the heap, the MSC driver is only limited by the SCSI commands it uses. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Marek Vasut <marex@denx.de> Cc: Ilya Yanok <ilya.yanok@cogentembedded.com> Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
2012-09-01usb_storage: Restore non-EHCI supportBenoît Thébaudeau
The commit 5dd95cf made the MSC driver EHCI-specific. This patch restores a basic support of non-EHCI HCDs, like before that commit. The fallback transfer size is certainly not optimal, but at least it should work like before. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Marek Vasut <marex@denx.de> Cc: Ilya Yanok <ilya.yanok@cogentembedded.com> Cc: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
2012-07-18usb_storage: fix ehci driver max transfer sizeStefan Herbrechtsmeier
The commit 5dd95cf93dfffa1d19a1928990852aac9f55b9d9 'usb_storage: Fix EHCI "out of buffer pointers" with CD-ROM' introduce a bug in usb_storage as it wrongly assumes that every transfer can use 4096 bytes per qt_buffer. This is wrong if the start address of the data is not page aligned to 4096 bytes and leads to 'EHCI timed out on TD' messages because of 'out of buffer pointers' in ehci_td_buffer function. The bug appears during load of a fragmented file and read from or write to an unaligned memory address. Cc: Marek Vasut <marex@denx.de> Signed-off-by: Stefan Herbrechtsmeier <stefan@herbrechtsmeier.net>
2012-05-20USB: Align buffers at cachelinePuneet Saxena
This avoids cache-alignment warnings shown in console when a usb command is entered. Whenever X bytes of unaligned buffer is invalidated, arm core invalidates X + Y bytes as per the cache line size and throws these warnings. Signed-off-by: Puneet Saxena <puneets@nvidia.com> Signed-off-by: Marek Vasut <marex@denx.de>
2012-03-19usb: replace wait_ms() with mdelay()Mike Frysinger
Common code has a mdelay() func, so use that instead of the usb-specific wait_ms() func. This also fixes the build errors: ohci-hcd.c: In function 'submit_common_msg': /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1519:9: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1816:10: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1827:10: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1844:10: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1563:11: sorry, unimplemented: called from here /usr/local/src/u-boot/blackfin/include/usb.h:202:44: sorry, unimplemented: inlining failed in call to 'wait_ms': function body not available ohci-hcd.c:1583:9: sorry, unimplemented: called from here make[1]: *** [ohci-hcd.o] Error 1 Signed-off-by: Mike Frysinger <vapier@gentoo.org> Acked-by: Marek Vasut <marex@denx.de>
2012-01-05usb_storage: Fix EHCI "out of buffer pointers" with CD-ROMKyle Moffett
When performing large bulk reads from a CD or DVD using the U-Boot usb_storage driver, it generates requests of up to 20 blocks at a time. With a standard 512-byte block size, that is 10240 bytes and within the limit of U-Boot's EHCI driver (maximum 5 pages at 4k per page). Unfortunately CD-ROM media has a 2048-byte blocksize, resulting in a maximum transfer size of 40960 bytes, which does not fit. Since the EHCI specification is impossibly obtuse and far beyond my comprehension, I chose to dynamically compute the limit based on the blocksize. Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
2011-10-27GCC4.6: Squash subsequent warnings in usb_storage.cMarek Vasut
usb_storage.c: In function ‘us_one_transfer’: usb_storage.c:377:7: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Wformat] usb_storage.c:389:6: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] usb_storage.c:394:6: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] usb_storage.c: In function ‘usb_stor_BBB_reset’: usb_storage.c:442:2: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c:448:2: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c:454:2: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c: In function ‘usb_stor_CB_reset’: usb_storage.c:482:2: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c: In function ‘usb_stor_CB_comdat’: usb_storage.c:572:3: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c:584:4: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c: In function ‘usb_stor_BBB_transport’: usb_storage.c:782:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c: In function ‘usb_stor_CB_transport’: usb_storage.c:807:2: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat] usb_storage.c:830:3: warning: format ‘%X’ expects argument of type ‘unsigned int’, but argument 2 has type ‘long unsigned int’ [-Wformat] usb_storage.c:857:3: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat] Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Remy Bohmer <linux@bohmer.net>
2011-10-27GCC4.6: Squash warning in usb_storage.cMarek Vasut
usb_storage.c: In function ‘usb_stor_CB_reset’: usb_storage.c:466:6: warning: variable ‘result’ set but not used [-Wunused-but-set-variable] Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Wolfgang Denk <wd@denx.de> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org>
2011-10-04Revert "GCC4.6: Convert various empty macros to inline functions"Wolfgang Denk
This reverts commit 60ce53cf9f408d9ad721f8e7a87d6a564e6d5bac. The commit causes build breakage for a number of boards. This results from the fact that now the arguments of debug() actually get referenced (even if there is hope that the compiler will optimize away the debug() call). The obvious fix to that probem (change the code to always declare the referenced variables and data structures) increases the code size, and was this rejected. So it was decided to revert this commit until a better solution is found.
2011-10-01GCC4.6: Convert various empty macros to inline functionsMarek Vasut
Fix the following gcc4.6 problems: cmd_date.c: In function ‘do_date’: cmd_date.c:50:6: warning: variable ‘old_bus’ set but not used [-Wunused-but-set-variable] asix.c: In function ‘asix_init’: asix.c:317:6: warning: variable ‘rx_ctl’ set but not used [-Wunused-but-set-variable] usb.c: In function ‘usb_parse_config’: usb.c:331:17: warning: variable ‘ch’ set but not used [-Wunused-but-set-variable] usb.c: In function ‘usb_hub_port_connect_change’: usb.c:1123:29: warning: variable ‘portchange’ set but not used [-Wunused-but-set-variable] usb.c: In function ‘usb_hub_configure’: usb.c:1183:25: warning: variable ‘hubsts’ set but not used [-Wunused-but-set-variable] usb_storage.c: In function ‘usb_stor_CB_reset’: usb_storage.c:466:6: warning: variable ‘result’ set but not used [-Wunused-but-set-variable] Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
2011-07-26disk/part.c: Make features optionalMatthew McClintock
If we don't want to build support for any partition types we can now add #undef CONFIG_PARTITIONS in a board config file to keep this from being compiled in. Otherwise boards assume this is compiled in by default Signed-off-by: Matthew McClintock <msm@freescale.com>
2011-04-12Fix misc spelling errors found by lintianLoïc Minier
Signed-off-by: Loïc Minier <loic.minier@linaro.org>
2011-04-02Remove unnecessary reset in usb_stor_get_infoErik Hansen
The reset request in usb_stor_get_info is causing issues with some usb sticks. Some of these sticks vendor_id/product_id have been hardcoded to not reset but better is to remove the reset altogether. It is not needed. Signed-off-by: Erik Hansen <erik@makarta.com>
2010-10-22usb_storage: constify us_direction lookup tableMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-10-13usb: Add support for multiple-LUN mass storage devicesLudovic Courtès
This patch changes `usb_stor_scan' to scan all the LUNs of each mass storage device. It also fixes the various commands to correctly set the LUN field. Notably, it allows each LUN of GuruPlug's microSD card reader to be accessed. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Acked-by: Prafulla Wadaskar <prafulla@marvell.com>
2010-07-24usb_storage.c: change progress output in debug() messageWolfgang Denk
The dots printed by common/usb_storage.c as progress meter corrupt the output for example of "fatls usb" commands like this: => fatls usb 0 . <<==== here 29 file.001 29 file.002 29 file.003 29 file.004 29 file.005 29 file.006 29 file.007 29 file.008 29 file.009 29 file.010 29 file.011 29 file.012 29 file.013 29 file.014 29 file.015 29 file.016 . <<==== here 29 file.017 29 file.018 29 file.019 ... Turn the progress output into a debug message. Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Remy Bohmer <linux@bohmer.net>
2010-07-24usb_storage.c: initialize device typeWolfgang Denk
The device type was left uninitialized which caused later tests against DEV_TYPE_UNKNOWN to fail. In the result, "usb part" would attempt to print information about non-existent devices like this: => usb part print_part of 0 Partition Map for USB device 0 -- Partition Type: DOS Partition Start Sector Num Sectors Type 1 0 2031616 f8 print_part of 1 ## Unknown partition table print_part of 2 ## Unknown partition table print_part of 3 ## Unknown partition table print_part of 4 ## Unknown partition table => By initializing the type as DEV_TYPE_UNKNOWN we avoid all the "Unknown partition table" messages. [Note: the "print_part of ?" messages is left over debug code that will be removed in another patch.] Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Remy Bohmer <linux@bohmer.net>
2010-04-08USB storage probeKim B. Heino
While debugging one ill behaving USB device I found two bugs in USB storage probe. usb_stor_get_info() returns -1 (error), 0 (skip) or 1 (ok). First part of this patch fixes error case. Second part fixes usb_inquiry()'s retry counter handling. Original code had retry = -1 on error case, not retry = 0 as checked in the next line. Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
2010-04-08USB storage countKim B. Heino
Here's another USB storage patch. Currently U-Boot handles storage devices #0 - #4 as valid devices, even if there is none connected. This patch fixes usb_stor_get_dev() to check detected device count instead of MAX-define. This is very important for ill behaving devices. usb_dev_desc[] can be partially initialized if device probe fails. After fixing get_dev() it was easy to fix "usb part" etc commands. Previously it outputed "Unknown partition table" five times, now it's "no USB devices available". Signed-off-by: Kim B. Heino <Kim.Heino@bluegiga.com>
2009-12-20usb: write command for RAW partition.Mahavir Jain
This patch implements write support to usb device with raw partition. It will be useful for filesystem write support to usb device from u-boot in future. Tested with writing kernel image to raw usb disk & booting with usb read command into ram. [Note: run usb part to get info about start sector & number of sectors on a partition for usb write operation.] Signed-off-by: Mahavir Jain <mjain@marvell.com>
2009-12-20USB Consolidate descriptor definitionsTom Rix
The header files usb.h and usbdescriptors.h have the same nameed structure definitions for usb_config_descriptor usb_interface_descriptor usb_endpoint_descriptor usb_device_descriptor usb_string_descriptor These are out right duplicates in usb.h usb_device_descriptor usb_string_descriptor This one has extra unused elements usb_endpoint_descriptor unsigned char bRefresh unsigned char bSynchAddress; These in usb.h have extra elements at the end of the usb 2.0 specified descriptor and are used. usb_config_descriptor usb_interface_descriptor The change is to consolidate the definition of the descriptors to usbdescriptors.h. The dublicates in usb.h are removed. The extra element structure will have their name shorted by removing the '_descriptor' suffix. So usb_config_descriptor -> usb_config usb_interface_descriptor -> usb_interface For these, the common descriptor elements are accessed now by an element 'desc'. As an example - if (iface->bInterfaceClass != USB_CLASS_HUB) + if (iface->desc.bInterfaceClass != USB_CLASS_HUB) This has been compile tested on MAKEALL arm, ppc and mips. Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
2009-05-15Fix e-mail address of Gary Jennejohn.Detlev Zundel
Signed-off-by: Detlev Zundel <dzu@denx.de>
2009-02-15USB: Remove LUN number from CDBAbraham, Thomas
The LUN number is not part of the Command Descriptor Block (CDB) for scsi inquiry, request sense, test unit ready, read capacity and read10 commands. This patch removes the LUN number information from the CDB. Signed-off-by: Thomas Abraham <t-abraham@ti.com> Signed-off-by: Remy Bohmer <linux@bohmer.net>
2009-01-28usb.h: use standard __LITTLE_ENDIAN from Linux headersMike Frysinger
Rather than forcing people to define a custom "LITTLEENDIAN", just use the __LITTLE_ENDIAN one from the Linux byteorder headers that every arch is already setting up. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Remy Bohmer <linux@bohmer.net>
2009-01-28usb_storage: do not reset SanDisk Corporation U3 Cruzer Micro USB thumb driveBryan Wu
The SanDisk Corporation U3 Cruzer Micro 1/4GB Flash Drive 000016244373FFB4 does not like to be reset, so check for it. Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Remy Bohmer <linux@bohmer.net>
2009-01-28USB storage cleanup patchMichael Trimarchi
Cleanup usb storage Signed-off-by: Michael Trimarchi <trimarchimichael@yahoo.it> Signed-off-by: Remy Bohmer <linux@bohmer.net>
2008-08-13common: Move conditional compilation to MakefileJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-07-14Code cleanup: fix old style assignment ambiguities like "=-" etc.Wolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-05-22USB: replace old swap_ with proper endianess conversion macrosChristian Eggers
Signed-off-by: Christian Eggers <ceggers@gmx.de> Signed-off-by: Markus Klotzbuecher <mk@denx.de>
2008-04-13Coding Style cleanup; update CHANGELOGWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-03-26USB, Storage: fix a bug introduced in commitMarkus Klotzbuecher
f6b44e0e4d18fe507833a0f76d24a9aa72c123f1 that will cause usb_stor_info to only print only information on one storage device, but not for multiple. Signed-off-by: Markus Klotzbuecher <mk@denx.de>
2008-03-26USB Storage, add meaningful return valueAras Vaichas
This patch changes the "usb storage" command to return success if it finds a USB storage device, otherwise it returns error. Signed-off-by: Markus Klotzbuecher <mk@denx.de>
2007-11-18Fix compiler warnings for PPC systems. Update CHANGELOG.Wolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
2007-07-10common/: Remove lingering references to CFG_CMD_* symbols.Jon Loeliger
Fixed some broken instances of "#ifdef CMD_CFG_IDE" too. Those always evaluated TRUE, and thus were always compiled even when IDE really wasn't defined/wanted. Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-08common/* non-cmd*: Remove obsolete references to CONFIG_COMMANDSJon Loeliger
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-04common/ non-cmd: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).Jon Loeliger
This is a compatibility step that allows both the older form and the new form to co-exist for a while until the older can be removed entirely. All transformations are of the form: Before: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) After: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT) Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-02-20[PATCH 9_9] Use "void *" not "unsigned long *" for block dev read_write ↵Grant Likely
buffer pointers Block device read/write is anonymous data; there is no need to use a typed pointer. void * is fine. Also add a hook for block_read functions Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2007-02-20[PATCH 1_4] Merge common get_dev() routines for block devicesGrant Likely
Each of the filesystem drivers duplicate the get_dev routine. This change merges them into a single function in part.c Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2006-10-20Coding style cleanupWolfgang Denk
2006-08-22Add a fix for a buggy USB device on the FO300 board.Bartlomiej Sieka
2006-07-13Fix problems with SanDisk Corporation Cruzer Micro USB memory stick.Bartlomiej Sieka
2005-10-13Cleanup for GCC-4.xWolfgang Denk
2005-08-04(re)enabled scsi commands do_scsi() and do_scsiboot()Wolfgang Denk
Patch by Denis Peter, 06 Dec 2004
2005-08-02Coding style cleanupWolfgang Denk
2005-07-21Fix low-level OHCI transfers for ARM920t and MPC5xxxWolfgang Denk
A new, Windows compatible init sequence was also backported from Linux 2.6, but disabled with #undef NEW_INIT_SEQ as it wouldn't change the behaviour of the memopry sticks we tested. Maybe it's not relevant for mass storage devices. For recerence, see file common/usb.c, function usb_new_device(), section #ifdef NEW_INIT_SEQ.
2004-05-03* Fix minor NAND JFFS2 related issuewdenk
* Fixes for SL811 USB controller: - implement workaround for broken memory stick - improve error handling * Increase packet send timeout to 10 ms in cpu/mpc8xx/scc.c to better cope with congested networks.
2004-03-02* Fix SDRAM timings for LITE5200 / IceCube boardwdenk
* Handle Auti-MDIX / connection status for INCA-IP * Fix USB problems when attempting to read 0 bytes
2004-02-26* Patch by Markus Pietrek, 24 Feb 2004:wdenk
NS9750 DevBoard added * Patch by Pierre AUBERT, 24 Feb 2004 add USB support for MPC5200 * Patch by Steven Scholz, 24 Feb 2004: - fix MII commands to use values from last command * Patch by Torsten Demke, 24 Feb 2004: Add support for the eXalion platform (SPSW-8240, F-30, F-300)