aboutsummaryrefslogtreecommitdiff
path: root/common/cmd_i2c.c
AgeCommit message (Collapse)Author
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-11-22common: move extern char console_buffer[] to common.hIgor Grinberg
Extract all extern declarations for console_buffer[] out of c files into the common.h header. Signed-off-by: Igor Grinberg <grinberg@compulab.co.il> Cc: Frank Gottschling <fgottschling@eltec.de> Cc: Murray Jensen <Murray.Jensen@csiro.au>
2011-11-07common/cmd_i2c.c: Fix GCC 4.6 build warningWolfgang Denk
Fix: cmd_i2c.c: In function 'do_i2c_add_bus': cmd_i2c.c:1212:19: warning: variable 'dev' set but not used [-Wunused-but-set-variable] Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Heiko Schocher <hs@denx.de>
2011-07-28cosmetic: spell fixes etc.Michael Jones
Signed-off-by: Michael Jones <michael.jones@matrix-vision.de> Acked-by: Detlev Zundel <dzu@denx.de>
2011-04-28i2c: add i2c deblock sequence before and after every mux configStefan Bigler
To make sure that the mux can be configured a deblocking sequence is done before the mux configuration. After the mux switch the new leaf of, the i2c tree must be again deblocked. Signed-off-by: Stefan Bigler <stefan.bigler@keymile.com> Acked-by: Heiko Schocher <hs@denx.de> cc: Wolfgang Denk <wd@denx.de> cc: Detlev Zundel <dzu@denx.de> cc: Prafulla Wadaskar <prafulla@marvell.com> cc: Valentin Longchamp <valentin.longchamp@keymile.com> cc: Holger Brunck <holger.brunck@keymile.com> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
2010-10-29Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOCWolfgang Denk
By now, the majority of architectures have working relocation support, so the few remaining architectures have become exceptions. To make this more obvious, we make working relocation now the default case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC. Signed-off-by: Wolfgang Denk <wd@denx.de> Tested-by: Heiko Schocher <hs@denx.de> Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-09-19ARM: add relocation supportHeiko Schocher
!! This breaks support for all arm boards !! To compile in old style, you must define CONFIG_SYS_ARM_WITHOUT_RELOC or you can compile with "CONFIG_SYS_ARM_WITHOUT_RELOC=1 ./MAKEALL board" !! This define will be removed soon, so convert your board to use relocation support Portions of this work were supported by funding from the CE Linux Forum. Signed-off-by: Heiko Schocher <hs@denx.de> Fix boot from NAND for non-ARM systems Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-09-19i2c: fix command usage helpHeiko Schocher
Portions of this work were supported by funding from the CE Linux Forum. Signed-off-by: Heiko Schocher <hs@denx.de>
2010-08-26CMD_I2C: make alen=0 workReinhard Meyer
Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
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-03-29i2c: made unused function i2c_mux_add_device staticFrans Meulenbroeks
and removed it from the .h file Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29cmd_i2c: introduced get_alen helper functionFrans Meulenbroeks
The code to parse alen appeared 6 times in the function. Factored this out in a small helper function Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29cmd_i2c: moved a define to before the functionsFrans Meulenbroeks
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29cmd_i2c: moved mispositioned comment for i2c mdFrans Meulenbroeks
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-29cmd_i2c.c: declared local functions as staticFrans Meulenbroeks
Declared all functions that were not called outside the file as static Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21cmd_i2c.c: added i2c read to memory functionFrans Meulenbroeks
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21cmd_i2c.c: sorted commands alphabeticallyFrans Meulenbroeks
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21cmd_i2c.c: reworked subcommand handlingFrans Meulenbroeks
Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2010-03-21cmd_i2c.c: reduced subaddress length to 3 bytesFrans Meulenbroeks
according to some of the comments the subaddress length is 1 or 2, but we are being prepared for the case it becomes 3. However the code also accepted 4. This repairs this by changing the constand 4 to 3. Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
2009-12-07i2c: fix dangling comment in do_i2c_mw()Heiko Schocher
commit bd3784df94bfeca43fbf34094df9cb1bd3ecca3b deleted some unused code in do_i2c_mw(), but missed to also remove the respective commment. This patch fixes this. Signed-off-by: Heiko Schocher <hs@denx.de>
2009-12-02Removes dead code in the file common/cmd_i2c.cPratap Chandu
There is some dead code enclosed by #if 0 .... #endif in the file common/cmd_i2c.c This patch removes the dead code. Signed-off-by: Pratap Chandu <pratap.rrke@gmail.com>
2009-07-18cmd_i2c: bugfix: add missing braceAlessandro Rubini
The sub-command parser missed a brace, so "return 0;" is always taken and no error message is diplayed if you say "i2c scan" instead of "i2c probe", for example. Proper brace is added. Also, a misleading and unneeded else is removed. Signed-off-by: Alessandro Rubini <rubini@gnudd.com.it>
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-06-12cmd_i2c: Fix i2c help command output when CONFIG_I2C_MUXPeter Tyser
When CONFIG_I2C_MUX was defined the output of 'help i2c' was not correct, eg: => help i2c i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes. speed [speed] - show or set I2C bus speed i2c dev [dev] - show or set current I2C bus ... It has been changed to: i2c speed [speed] - show or set I2C bus speed i2c bus [muxtype:muxaddr:muxchannel] - add a new bus reached over muxes i2c dev [dev] - show or set current I2C bus ... Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-06-12cmd_i2c: Clean up trivial helper functionsPeter Tyser
Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-06-12cmd_i2c: Clean up i2c command argument parsingPeter Tyser
argc and argv should only be modified once instead of once for every i2c sub-command Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-06-12i2c: Update references to individual i2c commandsPeter Tyser
The individual i2c commands imd, imm, inm, imw, icrc32, iprobe, iloop, and isdram are no longer available so all references to them have been updated to the new form of "i2c <cmd>". Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-06-12i2c: Remove deprecated individual i2c commandsPeter Tyser
The following individual I2C commands have been removed: imd, imm, inm, imw, icrc32, iprobe, iloop, isdram. The functionality of the individual commands is still available via the 'i2c' command. This change only has an impact on those boards which did not have CONFIG_I2C_CMD_TREE defined. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-06-12i2c: Create common default i2c_[set|get]_bus_speed() functionsPeter Tyser
New default, weak i2c_get_bus_speed() and i2c_set_bus_speed() functions replace a number of architecture-specific implementations. Also, providing default functions will allow all boards to enable CONFIG_I2C_CMD_TREE. This was previously not possible since the tree-form of the i2c command provides the ability to display and modify the i2c bus speed which requires i2c_[set|get]_bus_speed() to be present. Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
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-02Coding Style cleanup, update CHANGELOGWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-10-18rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-10-18I2C: adding new "i2c bus" Command to the I2C Subsystem.Heiko Schocher
With this Command it is possible to add new I2C Busses, which are behind 1 .. n I2C Muxes. Details see README. Signed-off-by: Heiko Schocher <hs@denx.de>
2008-10-18I2C: add new command i2c reset.Heiko Schocher
If I2C Bus is blocked (see doc/I2C_Edge_Conditions), it is not possible to get out of this, until the complete Hardware gets a reset. This new commando calls again i2c_init (and that calls i2c_init_board if defined), which will deblock the I2C Bus. Signed-off-by: Heiko Schocher <hs@denx.de> Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-10-14cmd_i2c: Fix help for CONFIG_I2C_CMD_TREE && !CONFIG_I2C_MULTI_BUSPeter Tyser
Original code displayed: => help i2c i2c i2c speed [speed] - show or set I2C bus speed i2c md chip address[.0, .1, .2] [# of objects] - read from I2C device ... Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2008-09-10move cmd_get_data_size to command.cJean-Christophe PLAGNIOL-VILLARD
add CMD_DATA_SIZE macro to enable it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-08-21mod_i2c_mem() bugfixPeter Tyser
The last used chip, address, and address length were not being stored for the imm and imn commands. Signed-off-by: Peter Tyser <ptyser@xes-inc.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-01-12Refactor code for "i2c sdram" commandLarry Johnson
Signed-off-by: Larry Johnson <lrj@acm.org>
2008-01-12Fix "i2c sdram" command for DDR2 DIMMsLarry Johnson
Many of the SPD bytes for DDR2 SDRAM are not interpreted correctly by the "i2c sdram" command. This patch provides correct alternative interpretations when DDR2 memory is detected. Signed-off-by: Larry Johnson <lrj@acm.org>
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-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/cmd_[i-n]*: 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-03-28i2c: Enable "old" i2c commands even when CONFIG_I2C_CMD_TREE is definedStefan Roese
The "old" i2c commands (iprobe, imd...) are now compiled in again, even when the i2c command tree is enabled via the CONFIG_I2C_CMD_TREE config option. Signed-off-by: Stefan Roese <sr@denx.de>
2007-03-08[PATCH] I2C: add some more SPD eeprom decoding for DDR2 modulesMatthias Fuchs
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
2007-03-08[PATCH] I2C: disable flat i2c commands when CONFIG_I2C_CMD_TREE is definedMatthias Fuchs
Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
2006-11-28mpc83xx: Miscellaneous code style fixesTimur Tabi
Implement various code style fixes and similar changes. Signed-off-by: Timur Tabi <timur@freescale.com>