[U-Boot] [PATCH] cmd_i2c.c: added i2c read to memory function
Heiko Schocher
hs at denx.de
Thu Feb 25 09:03:25 CET 2010
Hello Frans,
Frans Meulenbroeks wrote:
> Signed-off-by: Frans Meulenbroeks <fransmeulenbroeks at gmail.com>
> ---
> common/cmd_i2c.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 60 insertions(+), 0 deletions(-)
>
> diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
> index 1dd4df3..552b4e5 100644
> --- a/common/cmd_i2c.c
> +++ b/common/cmd_i2c.c
> @@ -154,6 +154,64 @@ int i2c_set_bus_speed(unsigned int)
[...]
> + /*
> + * memaddr is the address where to store things in memory
> + */
> + memaddr = (u_char *)simple_strtoul(argv[4], NULL, 16);
> +
> + if (i2c_read(chip, devaddr, alen, memaddr, length) != 0)
> + {
as Wolfgang suggested to your first post, incorrect brace style,
please fix.
> + puts ("Error reading the chip.\n");
> + return 1;
> + }
> + return 0;
> +}
> +
> int do_i2c_md ( cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
> {
> u_char chip;
> @@ -1272,6 +1330,7 @@ static cmd_tbl_t cmd_i2c_sub[] = {
> U_BOOT_CMD_MKENT(mw, 3, 1, do_i2c_mw, "", ""),
> U_BOOT_CMD_MKENT(nm, 2, 1, do_i2c_nm, "", ""),
> U_BOOT_CMD_MKENT(probe, 0, 1, do_i2c_probe, "", ""),
> + U_BOOT_CMD_MKENT(read, 5, 1, do_i2c_read, "", ""),
> U_BOOT_CMD_MKENT(reset, 0, 1, do_i2c_reset, "", ""),
> #if defined(CONFIG_CMD_SDRAM)
> U_BOOT_CMD_MKENT(sdram, 1, 1, do_i2c_sdram, "", ""),
> @@ -1316,6 +1375,7 @@ U_BOOT_CMD(
> "i2c nm chip address[.0, .1, .2] - write to I2C device (constant address)\n"
> "i2c crc32 chip address[.0, .1, .2] count - compute CRC32 checksum\n"
> "i2c probe - show devices on the I2C bus\n"
> + "i2c read chip address[.0, .1, .2] length memaddress - read to memory \n"
> "i2c reset - re-init the I2C Controller\n"
> #if defined(CONFIG_CMD_SDRAM)
> "i2c sdram chip - print SDRAM configuration information\n"
Rest looks good, thanks!
bye
Heiko
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list