[U-Boot] [PATCH 16/17] eeprom: Add support for selecting i2c bus
Heiko Schocher
hs at denx.de
Mon Nov 16 12:32:34 CET 2015
Hello Marek,
Am 10.11.2015 um 20:53 schrieb Marek Vasut:
> Add additional parameter into the eeprom command to select
> the I2C bus on which the eeprom resides.
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: Heiko Schocher <hs at denx.de>
> ---
> common/cmd_eeprom.c | 15 +++++++++++----
> 1 file changed, 11 insertions(+), 4 deletions(-)
Reviewed-by: Heiko Schocher <hs at denx.de>
bye,
Heiko
>
> diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
> index 9247036..13c946e 100644
> --- a/common/cmd_eeprom.c
> +++ b/common/cmd_eeprom.c
> @@ -207,14 +207,21 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> char * const *args = &argv[2];
> int rcode;
> ulong dev_addr, addr, off, cnt;
> + int bus_addr;
>
> switch (argc) {
> #ifdef CONFIG_SYS_DEF_EEPROM_ADDR
> case 5:
> + bus_addr = -1;
> dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
> break;
> #endif
> case 6:
> + bus_addr = -1;
> + dev_addr = simple_strtoul(*args++, NULL, 16);
> + break;
> + case 7:
> + bus_addr = simple_strtoul(*args++, NULL, 16);
> dev_addr = simple_strtoul(*args++, NULL, 16);
> break;
> default:
> @@ -225,7 +232,7 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> off = simple_strtoul(*args++, NULL, 16);
> cnt = simple_strtoul(*args++, NULL, 16);
>
> - eeprom_init(-1);
> + eeprom_init(bus_addr);
>
> if (strcmp (argv[1], "read") == 0) {
> printf(fmt, dev_addr, argv[1], addr, off, cnt);
> @@ -247,9 +254,9 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
> }
>
> U_BOOT_CMD(
> - eeprom, 6, 1, do_eeprom,
> + eeprom, 7, 1, do_eeprom,
> "EEPROM sub-system",
> - "read devaddr addr off cnt\n"
> - "eeprom write devaddr addr off cnt\n"
> + "read <bus> <devaddr> addr off cnt\n"
> + "eeprom write <bus> <devaddr> addr off cnt\n"
> " - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'"
> )
>
--
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
More information about the U-Boot
mailing list