summaryrefslogtreecommitdiff
path: root/common/cmd_i2c.c
Commit message (Collapse)AuthorAgeLines
* common: move extern char console_buffer[] to common.hIgor Grinberg2011-11-22-1/+0
| | | | | | | | | 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>
* common/cmd_i2c.c: Fix GCC 4.6 build warningWolfgang Denk2011-11-07-3/+1
| | | | | | | | | | 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>
* cosmetic: spell fixes etc.Michael Jones2011-07-28-2/+2
| | | | | Signed-off-by: Michael Jones <michael.jones@matrix-vision.de> Acked-by: Detlev Zundel <dzu@denx.de>
* i2c: add i2c deblock sequence before and after every mux configStefan Bigler2011-04-28-0/+12
| | | | | | | | | | | | | | | 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>
* Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOCWolfgang Denk2010-10-29-1/+1
| | | | | | | | | | | 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>
* ARM: add relocation supportHeiko Schocher2010-09-19-0/+6
| | | | | | | | | | | | | | | | | | | !! 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>
* i2c: fix command usage helpHeiko Schocher2010-09-19-0/+3
| | | | | | | Portions of this work were supported by funding from the CE Linux Forum. Signed-off-by: Heiko Schocher <hs@denx.de>
* CMD_I2C: make alen=0 workReinhard Meyer2010-08-26-10/+7
| | | | Signed-off-by: Reinhard Meyer <u-boot@emk-elektronik.de>
* cmd_usage(): simplify return code handlingWolfgang Denk2010-07-24-57/+30
| | | | | | | | | | | | | | | | 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>
* Make sure that argv[] argument pointers are not modified.Wolfgang Denk2010-07-04-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* i2c: made unused function i2c_mux_add_device staticFrans Meulenbroeks2010-03-29-1/+1
| | | | | | and removed it from the .h file Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* cmd_i2c: introduced get_alen helper functionFrans Meulenbroeks2010-03-29-72/+47
| | | | | | | 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>
* cmd_i2c: moved a define to before the functionsFrans Meulenbroeks2010-03-29-2/+2
| | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* cmd_i2c: moved mispositioned comment for i2c mdFrans Meulenbroeks2010-03-29-4/+4
| | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* cmd_i2c.c: declared local functions as staticFrans Meulenbroeks2010-03-29-14/+14
| | | | | | Declared all functions that were not called outside the file as static Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* cmd_i2c.c: added i2c read to memory functionFrans Meulenbroeks2010-03-21-1/+59
| | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* cmd_i2c.c: sorted commands alphabeticallyFrans Meulenbroeks2010-03-21-6/+5
| | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* cmd_i2c.c: reworked subcommand handlingFrans Meulenbroeks2010-03-21-32/+45
| | | | Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
* cmd_i2c.c: reduced subaddress length to 3 bytesFrans Meulenbroeks2010-03-21-5/+5
| | | | | | | | 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>
* i2c: fix dangling comment in do_i2c_mw()Heiko Schocher2009-12-07-4/+0
| | | | | | | | 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>
* Removes dead code in the file common/cmd_i2c.cPratap Chandu2009-12-02-8/+0
| | | | | | | | 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>
* cmd_i2c: bugfix: add missing braceAlessandro Rubini2009-07-18-3/+3
| | | | | | | | | | | 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>
* General help message cleanupWolfgang Denk2009-06-12-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* cmd_i2c: Fix i2c help command output when CONFIG_I2C_MUXPeter Tyser2009-06-12-2/+2
| | | | | | | | | | | | | | | | | | | 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>
* cmd_i2c: Clean up trivial helper functionsPeter Tyser2009-06-12-21/+4
| | | | Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* cmd_i2c: Clean up i2c command argument parsingPeter Tyser2009-06-12-24/+28
| | | | | | | 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>
* i2c: Update references to individual i2c commandsPeter Tyser2009-06-12-16/+11
| | | | | | | | 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>
* i2c: Remove deprecated individual i2c commandsPeter Tyser2009-06-12-58/+0
| | | | | | | | | | | | | 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>
* i2c: Create common default i2c_[set|get]_bus_speed() functionsPeter Tyser2009-06-12-0/+18
| | | | | | | | | | | | | 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>
* Command usage cleanupPeter Tyser2009-01-28-9/+9
| | | | | | | | 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>
* Standardize command usage messages with cmd_usage()Peter Tyser2009-01-28-12/+12
| | | | Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
* Coding Style cleanup, update CHANGELOGWolfgang Denk2008-11-02-6/+0
| | | | Signed-off-by: Wolfgang Denk <wd@denx.de>
* rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD2008-10-18-14/+14
| | | | Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* I2C: adding new "i2c bus" Command to the I2C Subsystem.Heiko Schocher2008-10-18-0/+267
| | | | | | | 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>
* I2C: add new command i2c reset.Heiko Schocher2008-10-18-0/+9
| | | | | | | | | | | 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>
* cmd_i2c: Fix help for CONFIG_I2C_CMD_TREE && !CONFIG_I2C_MULTI_BUSPeter Tyser2008-10-14-4/+4
| | | | | | | | | | 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>
* move cmd_get_data_size to command.cJean-Christophe PLAGNIOL-VILLARD2008-09-10-1/+0
| | | | | | add CMD_DATA_SIZE macro to enable it Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
* mod_i2c_mem() bugfixPeter Tyser2008-08-21-3/+3
| | | | | | | 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>
* Big white-space cleanup.Wolfgang Denk2008-05-21-8/+8
| | | | | | | | | | | 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>
* Refactor code for "i2c sdram" commandLarry Johnson2008-01-12-291/+220
| | | | Signed-off-by: Larry Johnson <lrj@acm.org>
* Fix "i2c sdram" command for DDR2 DIMMsLarry Johnson2008-01-12-119/+496
| | | | | | | | 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>
* [BUILD] conditionally compile common/cmd_*.c in common/MakefileGrant Likely2007-11-20-5/+0
| | | | | | | Modify common/Makefile to conditionally compile the cmd_*.c files based on the board config. Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* common/: Remove lingering references to CFG_CMD_* symbols.Jon Loeliger2007-07-10-4/+4
| | | | | | | | 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>
* common/cmd_[i-n]*: Remove obsolete references to CONFIG_COMMANDS.Jon Loeliger2007-07-08-5/+5
| | | | Signed-off-by: Jon Loeliger <jdl@freescale.com>
* common/cmd_[i-z]* : Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).Jon Loeliger2007-07-04-5/+5
| | | | | | | | | | | | | | 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>
* i2c: Enable "old" i2c commands even when CONFIG_I2C_CMD_TREE is definedStefan Roese2007-03-28-2/+1
| | | | | | | | 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>
* [PATCH] I2C: add some more SPD eeprom decoding for DDR2 modulesMatthias Fuchs2007-03-08-0/+2
| | | | Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
* [PATCH] I2C: disable flat i2c commands when CONFIG_I2C_CMD_TREE is definedMatthias Fuchs2007-03-08-20/+20
| | | | Signed-off-by: Matthias Fuchs <matthias.fuchs@esd-electronics.com>
* mpc83xx: Miscellaneous code style fixesTimur Tabi2006-11-28-130/+75
| | | | | | Implement various code style fixes and similar changes. Signed-off-by: Timur Tabi <timur@freescale.com>
* Add support for multiple I2C busesBen Warren2006-11-03-5/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hello, Attached is a patch providing support for multiple I2C buses at the command level. The second part of the patch includes an implementation for the MPC834x CPU and MPC8349EMDS board. /*** Note: This patch replaces ticket DNX#2006083042000018 ***/ Signed-off-by: Ben Warren <bwarren@qstreams.com> Overview: 1. Include new 'i2c' command (based on USB implementation) using CONFIG_I2C_CMD_TREE. 2. Allow multiple buses by defining CONFIG_I2C_MULTI_BUS. Note that the commands to change bus number and speed are only available under the new 'i2c' command mentioned in the first bullet. 3. The option CFG_I2C_NOPROBES has been expanded to work in multi-bus systems. When CONFIG_I2C_MULTI_BUS is used, this option takes the form of an array of bus-device pairs. Otherwise, it is an array of uchar. CHANGELOG: Added new 'i2c' master command for all I2C interaction. This is conditionally compiled with CONFIG_I2C_CMD_TREE. New commands added for setting I2C bus speed as well as changing the active bus if the board has more than one (conditionally compiled with CONFIG_I2C_MULTI_BUS). Updated NOPROBE logic to handle multiple buses. Updated README. regards, Ben