aboutsummaryrefslogtreecommitdiff
path: root/common/cmd_usb.c
AgeCommit message (Collapse)Author
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-18bootstage: Plumb in bootstage calls for basic operationsSimon Glass
This inserts bootstage calls into tftp, usb start and bootm. We could go further, but this is a reasonable start to illustrate the concept. Signed-off-by: Simon Glass <sjg@chromium.org>
2012-03-06Convert cmd_usage() calls in common to use a return valueSimon Glass
Change all files in common/ to use CMD_RET_USAGE instead of calling cmd_usage() directly. I'm not completely sure about this patch since the code since impact is small (100 byte or so on ARM) and it might need splitting into smaller patches. But for now here it is. Signed-off-by: Simon Glass <sjg@chromium.org>
2011-12-16USB: Use (get|put)_unaligned for accessing wMaxPacketSizeTom Rini
In 9792987721c7980453fe6447c3fa6593b44f8458 Stefan describes a usecase where the previous behavior of leaving wMaxPacketSize be unaligned caused fatal problems. The initial fix for this problem was incomplete however as it showed another cases of non-aligned access that previously worked implicitly. This switches to making sure that all access of wMaxPacketSize are done via (get|put)_unaligned. In order to maintain a level of readability to the code in some cases we now use a variable for the value of wMaxPacketSize and in others, a macro. Cc: Minkyu Kang <mk7.kang@samsung.com> Cc: Remy Bohmer <linux@bohmer.net> OpenRISC: Tested-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> Beagleboard xM, Pandaboard run-tested, s5p_goni build-tested. Signed-off-by: Tom Rini <trini@ti.com>
2011-12-11usb: add help for missing start subcommandVeli-Pekka Peltola
Signed-off-by: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Cc: Remy Bohmer <linux@bohmer.net>
2011-12-11cosmetic: remove excess whitespace from usb command helpVeli-Pekka Peltola
Signed-off-by: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com> Cc: Remy Bohmer <linux@bohmer.net>
2011-10-09common/cmd_usb.c: fix warning: variable ... set but not usedWolfgang Denk
Fix: cmd_usb.c: In function 'usb_show_tree_graph': cmd_usb.c:284:29: warning: variable 'port' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Remy Bohmer <linux@bohmer.net> Acked-by: Remy Bohmer <linux@bohmer.net>
2011-07-25autostart: unify duplicated logic into the bootm codeMike Frysinger
Rather than having a bunch of random commands handle autostart behavior, unify the logic in a single place. This also fixes building of these different commands when bootm is disabled. Acked-by: Matthew McClintock <msm@freescale.com> Acked-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-04-12Fix misc spelling errors found by lintianLoïc Minier
Signed-off-by: Loïc Minier <loic.minier@linaro.org>
2011-02-19Add USB host ethernet adapter supportSimon Glass
This adds support for using USB Ethernet dongles in host mode. This is just the framework - drivers will come later. A new config option called CONFIG_USB_HOST_ETHER can be defined in board config files to switch this on. The was originally written by NVIDIA and was cleaned up for release by the Chromium authors. Signed-off-by: Simon Glass <sjg@chromium.org>
2011-01-11Revert "boot cmds: convert to getenv_yesno() with autostart"Wolfgang Denk
This reverts commit 5a442c0addc69d0c4b58e98e5aec1cf07576debb. This commit changed the behaviour of getenv_yesno() (both the default behaviour and the documented behaviour for abbreviated arguments) which resulted in problems in several areas. Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-11-28boot cmds: convert to getenv_yesno() with autostartMike Frysinger
Use the new helper func to clean up duplicate logic handling of the autostart env var. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28do_bootm: unify duplicate prototypesMike Frysinger
The duplication of the do_bootm prototype has gotten out of hand, and they're pretty much all outdated (wrt constness). Unify them all in command.h. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-08-12Fixed clobbered output of the "help usb" commandSergei Poselenov
The "usb help" doesn't format the output correctly: => help usb usb - USB sub-system Usage: usb reset - reset (rescan) USB controller usb stop [f] - stop USB [f]=force stop usb tree - show USB device tree usb info [dev] - show available USB devices usb storage - show details of USB storage devices usb dev [dev] - show or set current USB storage device usb part [dev] - print partition table of one or all USB storage devices usb read addr blk# cnt - read `cnt' blocks starting at block `blk#' to memory address `addr'usb write addr blk# cnt - write `cnt' blocks starting at block `blk#' from memory address `addr' => With fix below applied, the output is correct: => help usb usb - USB sub-system Usage: usb reset - reset (rescan) USB controller usb stop [f] - stop USB [f]=force stop usb tree - show USB device tree usb info [dev] - show available USB devices usb storage - show details of USB storage devices usb dev [dev] - show or set current USB storage device usb part [dev] - print partition table of one or all USB storage devices usb read addr blk# cnt - read `cnt' blocks starting at block `blk#' to memory address `addr' usb write addr blk# cnt - write `cnt' blocks starting at block `blk#' from memory address `addr' => Signed-off-by: Sergei Poselenov <sposelenov@emcraft.com>
2010-07-24cmd_usage(): simplify return code handlingWolfgang Denk
Lots of code use this construct: cmd_usage(cmdtp); return 1; Change cmd_usage() let it return 1 - then we can replace all these ocurrances by return cmd_usage(cmdtp); This fixes a few places with incorrect return code handling, too. Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-04Make sure that argv[] argument pointers are not modified.Wolfgang Denk
The hush shell dynamically allocates (and re-allocates) memory for the argument strings in the "char *argv[]" argument vector passed to commands. Any code that modifies these pointers will cause serious corruption of the malloc data structures and crash U-Boot, so make sure the compiler can check that no such modifications are being done by changing the code into "char * const argv[]". This modification is the result of debugging a strange crash caused after adding a new command, which used the following argument processing code which has been working perfectly fine in all Unix systems since version 6 - but not so in U-Boot: int main (int argc, char **argv) { while (--argc > 0 && **++argv == '-') { /* ====> */ while (*++*argv) { switch (**argv) { case 'd': debug++; break; ... default: usage (); } } } ... } The line marked "====>" will corrupt the malloc data structures and usually cause U-Boot to crash when the next command gets executed by the shell. With the modification, the compiler will prevent this with an error: increment of read-only location '*argv' N.B.: The code above can be trivially rewritten like this: while (--argc > 0 && **++argv == '-') { char *arg = *argv; while (*++arg) { switch (*arg) { ... Signed-off-by: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org>
2010-05-06cmd_usb.c: show cmd usage if no args givenSerge Ziryukin
Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.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>
2010-03-28cmd_usb.c: print debug messages only when DEBUG is definedWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
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-06-12General help message cleanupWolfgang Denk
Many of the help messages were not really helpful; for example, many commands that take no arguments would not print a correct synopsis line, but "No additional help available." which is not exactly wrong, but not helpful either. Commit ``Make "usage" messages more helpful.'' changed this partially. But it also became clear that lots of "Usage" and "Help" messages (fields "usage" and "help" in struct cmd_tbl_s respective) were actually redundant. This patch cleans this up - for example: Before: => help dtt dtt - Digital Thermometer and Thermostat Usage: dtt - Read temperature from digital thermometer and thermostat. After: => help dtt dtt - Read temperature from Digital Thermometer and Thermostat Usage: dtt Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-01-28USB: Add high-speed (480Mb/s) to all USB related outputsStefan Roese
With this patch the USB related connection speed output ("usb tree" command and debug output) is now high-speed enabled. This patch also fixes a compilation warning when debugging is enabled. Signed-off-by: Stefan Roese <sr@denx.de> Signed-off-by: Remy Bohmer <linux@bohmer.net>
2009-01-28Prepare USB layer for ehciMichael Trimarchi
Prepare USB layer for ehci support Signed-off-by: Michael Trimarchi <trimarchi@gandalf.sssup.it> Signed-off-by: Remy Böhmer <linux@bohmer.net>
2009-01-28Command usage cleanupPeter Tyser
Remove command name from all command "usage" fields and update common/command.c to display "name - usage" instead of just "usage". Also remove newlines from command usage fields. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-01-28Standardize command usage messages with cmd_usage()Peter Tyser
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2008-11-28Remove obsolete command (apply afte USB style patch, 80 chars strict)Michael Trimarchi
Remove USB obsolete commmand Signed-off-by: Michael Trimarchi <trimarchi@gandalf.sssup.it> Signed-off-by: Remy Böhmer <linux@bohmer.net>
2008-11-28USB style patch, 80 chars strictMichael Trimarchi
USB Code style patch Signed-off-by: Michael Trimarchi <trimarchi@gandalf.sssup.it> Signed-off-by: Remy Böhmer <linux@bohmer.net>
2008-10-18rename CFG_ macros to CONFIG_SYSJean-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-07-10Fix "usb part" commandChristian Eggers
Only print partition for selected device if user supplied the <dev> arg with the "usb part [dev]" command. Signed-off-by: Christian Eggers <ceggers@gmx.de> Acked-by: Markus Klotzbuecher <mk@denx.de>
2008-06-30Delay FIT format check on sector based devicesMarian Balakowicz
Global FIT image operations like format check cannot be performed on a first sector data, defer them to the point when whole FIT image was uploaded to a system RAM. Signed-off-by: Marian Balakowicz <m8@semihalf.com> Partial ('cmd_nand' case) Acked-by: Grant Erickson <gerickson@nuovations.com> NAND and DOC bits Acked-by: Scott Wood <scottwood@freescale.com>
2008-05-21Big white-space cleanup.Wolfgang Denk
This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-03-26Merge branch 'master_merge_new-image' of /home/tur/git/u-bootWolfgang Denk
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>
2008-03-12[new uImage] Add new uImage format handling to other bootm related commandsMarian Balakowicz
Updated commands: docboot - cmd_doc.c fdcboot - cmd_fdc.c diskboot - cmd_ide.c nboot - cmd_nand.c scsiboot - cmd_scsi.c usbboot - cmd_usb.c Signed-off-by: Marian Balakowicz <m8@semihalf.com>
2008-02-29[new uImage] Update naming convention for bootm/uImage related codeMarian Balakowicz
This patch introduces the following prefix convention for the image format handling and bootm related code: genimg_ - dual format shared code image_ - legacy uImage format specific code fit_ - new uImage format specific code boot_ - booting process related code Related routines are renamed and a few pieces of code are moved around and re-grouped. Signed-off-by: Marian Balakowicz <m8@semihalf.com>
2008-02-25[new uImage] Add dual format uImage support frameworkMarian Balakowicz
This patch adds framework for dual format images. Format detection is added and the bootm controll flow is updated to include cases for new FIT format uImages. When the legacy (image_header based) format is detected appropriate legacy specific handling is invoked. For the new (FIT based) format uImages dual boot framework has a minial support, that will only print out a corresponding debug messages. Implementation of the FIT specific handling will be added in following patches. Signed-off-by: Marian Balakowicz <m8@semihalf.com>
2008-02-21[new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmdsMarian Balakowicz
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
2008-02-21[new uImage] Rename and move print_image_hdr() routineMarian Balakowicz
Signed-off-by: Marian Balakowicz <m8@semihalf.com>
2008-02-07[new uImage] Define a API for image handling operationsMarian Balakowicz
- Add inline helper macros for basic header processing - Move common non inline code common/image.c - Replace direct header access with the API routines - Rename IH_CPU_* to IH_ARCH_* Signed-off-by: Marian Balakowicz <m8@semihalf.com>
2007-11-20[BUILD] conditionally compile common/cmd_*.c in common/MakefileGrant Likely
Modify common/Makefile to conditionally compile the cmd_*.c files based on the board config. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2007-07-08common/cmd_[p-x]*: Remove obsolete references to CONFIG_COMMANDS.Jon Loeliger
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-04common/cmd_[i-z]* : 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 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-08-03Prevent USB commands from working when USB is stopped.Bartlomiej Sieka
2006-08-02Add rudimentary handling of alternate settings of USB interfaces - to fixBartlomiej Sieka
problems with some USB storage devices. Some code readability improvements.
2005-10-13Cleanup for GCC-4.xWolfgang Denk
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.