eeprom: Zap CONFIG_SYS_I2C_MULTI_EEPROMS
authorMarek Vasut <marex@denx.de>
Tue, 10 Nov 2015 19:53:19 +0000 (20:53 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 22 Nov 2015 02:50:21 +0000 (21:50 -0500)
This option only complicates the code unnecessarily, just use
CONFIG_SYS_DEF_EEPROM_ADDR as the default address if there are
only five arguments to eeprom {read/write} if this is defined.
If CONFIG_SYS_DEF_EEPROM_ADDR is not defined, we mandate all
six arguments.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
Cc: Heiko Schocher <hs@denx.de>
Reviewed-by: Heiko Schocher <hs@denx.de>
30 files changed:
common/cmd_eeprom.c
include/configs/BSC9131RDB.h
include/configs/BSC9132QDS.h
include/configs/C29XPCIE.h
include/configs/P1010RDB.h
include/configs/PMC440.h
include/configs/TQM834x.h
include/configs/acadia.h
include/configs/am335x_evm.h
include/configs/am43xx_evm.h
include/configs/axs101.h
include/configs/bamboo.h
include/configs/canyonlands.h
include/configs/icon.h
include/configs/intip.h
include/configs/katmai.h
include/configs/km/km-powerpc.h
include/configs/km/km_arm.h
include/configs/luan.h
include/configs/m28evk.h
include/configs/motionpro.h
include/configs/p1_p2_rdb_pc.h
include/configs/p1_twr.h
include/configs/pcm051.h
include/configs/pengwyn.h
include/configs/sequoia.h
include/configs/t3corp.h
include/configs/tricorder.h
include/configs/walnut.h
include/configs/yosemite.h

index 4335079d5651bdd1d7e3b5a4ab0b28b31a7c9754..0b59bea01dd99b2ef660686b8ec8cc9f175e13a3 100644 (file)
@@ -338,50 +338,50 @@ static int do_eeprom(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 {
        const char *const fmt =
                "\nEEPROM @0x%lX %s: addr %08lx  off %04lx  count %ld ... ";
+       char * const *args = &argv[2];
+       int rcode;
+       ulong dev_addr, addr, off, cnt;
+
+       switch (argc) {
+#ifdef CONFIG_SYS_DEF_EEPROM_ADDR
+       case 5:
+               dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
+               break;
+#endif
+       case 6:
+               dev_addr = simple_strtoul(*args++, NULL, 16);
+               break;
+       default:
+               return CMD_RET_USAGE;
+       }
 
-#if defined(CONFIG_SYS_I2C_MULTI_EEPROMS)
-       if (argc == 6) {
-               ulong dev_addr = simple_strtoul (argv[2], NULL, 16);
-               ulong addr = simple_strtoul (argv[3], NULL, 16);
-               ulong off  = simple_strtoul (argv[4], NULL, 16);
-               ulong cnt  = simple_strtoul (argv[5], NULL, 16);
-#else
-       if (argc == 5) {
-               ulong dev_addr = CONFIG_SYS_DEF_EEPROM_ADDR;
-               ulong addr = simple_strtoul (argv[2], NULL, 16);
-               ulong off  = simple_strtoul (argv[3], NULL, 16);
-               ulong cnt  = simple_strtoul (argv[4], NULL, 16);
-#endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */
+       addr = simple_strtoul(*args++, NULL, 16);
+       off = simple_strtoul(*args++, NULL, 16);
+       cnt = simple_strtoul(*args++, NULL, 16);
 
 # if !defined(CONFIG_SPI) || defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
-               eeprom_init ();
+       eeprom_init ();
 # endif /* !CONFIG_SPI */
 
-               if (strcmp (argv[1], "read") == 0) {
-                       int rcode;
-
-                       printf (fmt, dev_addr, argv[1], addr, off, cnt);
-
-                       rcode = eeprom_read (dev_addr, off, (uchar *) addr, cnt);
+       if (strcmp (argv[1], "read") == 0) {
+               printf(fmt, dev_addr, argv[1], addr, off, cnt);
 
-                       puts ("done\n");
-                       return rcode;
-               } else if (strcmp (argv[1], "write") == 0) {
-                       int rcode;
+               rcode = eeprom_read(dev_addr, off, (uchar *) addr, cnt);
 
-                       printf (fmt, dev_addr, argv[1], addr, off, cnt);
+               puts ("done\n");
+               return rcode;
+       } else if (strcmp (argv[1], "write") == 0) {
+               printf(fmt, dev_addr, argv[1], addr, off, cnt);
 
-                       rcode = eeprom_write (dev_addr, off, (uchar *) addr, cnt);
+               rcode = eeprom_write(dev_addr, off, (uchar *) addr, cnt);
 
-                       puts ("done\n");
-                       return rcode;
-               }
+               puts ("done\n");
+               return rcode;
        }
 
        return CMD_RET_USAGE;
 }
 
-#ifdef CONFIG_SYS_I2C_MULTI_EEPROMS
 U_BOOT_CMD(
        eeprom, 6,      1,      do_eeprom,
        "EEPROM sub-system",
@@ -389,12 +389,3 @@ U_BOOT_CMD(
        "eeprom write devaddr addr off cnt\n"
        "       - read/write `cnt' bytes from `devaddr` EEPROM at offset `off'"
 )
-#else /* One EEPROM */
-U_BOOT_CMD(
-       eeprom, 5,      1,      do_eeprom,
-       "EEPROM sub-system",
-       "read  addr off cnt\n"
-       "eeprom write addr off cnt\n"
-       "       - read/write `cnt' bytes at EEPROM offset `off'"
-)
-#endif /* CONFIG_SYS_I2C_MULTI_EEPROMS */
index 7b344705f6358eb83ca5abdc291fde7f35fbb103..665cad7e1fb669dbc12ff3b9095d9a3886d5131e 100644 (file)
@@ -266,7 +266,6 @@ extern unsigned long get_sdram_size(void);
 
 /* I2C EEPROM */
 #define CONFIG_CMD_EEPROM
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
index a3a853d5c656abed2e1aa0e180dde6adbb5edf53..79d8e3f056ab7fe26b757aad7311f52a4328ce29 100644 (file)
@@ -462,7 +462,6 @@ combinations. this should be removed later
 
 /* enable read and write access to EEPROM */
 #define CONFIG_CMD_EEPROM
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
index 9f86f1edf4b29a118f14564f29d16d09dc594392..e70506e4d4b1fb486ef0b57ba9efc4b5ba1c59cf 100644 (file)
 /* I2C EEPROM */
 /* enable read and write access to EEPROM */
 #define CONFIG_CMD_EEPROM
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
index 49105dc4a0bb02a953e8bf169bc3031dad4d7ad3..e96d6dbc57c5ec481ac42258a5645914164fb528 100644 (file)
@@ -659,7 +659,6 @@ extern unsigned long get_sdram_size(void);
 #endif
 /* enable read and write access to EEPROM */
 #define CONFIG_CMD_EEPROM
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
index 5488c681fc4654216c64e9c6dc25bf1e324ab6a1..05ad3150381cb9798b091207b983c11a1758aa78 100644 (file)
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_1          400000
 #define CONFIG_SYS_I2C_PPC4XX_SLAVE_1          0x7F
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 
 #define CONFIG_SYS_I2C_EEPROM_ADDR             0x54
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         2
index 5221fbba051c86405490cf1f0d6d4accfada1640..58a17f5a03e111b8669fe1f22bb5694dc9d853b5 100644 (file)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         2       /* 16 bit */
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      5       /* 32 bytes/write */
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  12      /* 10ms +/- 20% */
-#define CONFIG_SYS_I2C_MULTI_EEPROMS           /* more than one eeprom */
 
 /* I2C RTC */
 #define CONFIG_RTC_DS1337                      /* use ds1337 rtc via i2c */
index 4dd5720d2f5b2dd19461a628a7ec55343fa2e350..2f53d736cb48b757911fe3d6ef26fce0b5f8078d 100644 (file)
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
index ed3fd344881ed53c55ac35a104459d673a91b0f2..d501f04218ff201d0da323f6e1f4ceb7cda7058d 100644 (file)
 #define CONFIG_ENV_EEPROM_IS_ON_I2C
 #define CONFIG_SYS_I2C_EEPROM_ADDR     0x50    /* Main EEPROM */
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 
 /* PMIC support */
 #define CONFIG_POWER_TPS65217
index fa01d1ec45e773c03db124c30b7eb5ec89df7657..42e142580ec968c2cbf6194356d64ad11b66bf05 100644 (file)
@@ -33,7 +33,6 @@
 #define CONFIG_ENV_EEPROM_IS_ON_I2C
 #define CONFIG_SYS_I2C_EEPROM_ADDR     0x50    /* Main EEPROM */
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 
 /* Power */
 #define CONFIG_POWER
index 9e90b69728ef07d5bcbbf1890ebe3f495d231666..650d97d17f23e9d8c8f18a5b2c0f68fbf23bf0a9 100644 (file)
@@ -78,7 +78,6 @@
 /*
  * EEPROM configuration
  */
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR             (0xA8 >> 1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         1
 #define CONFIG_SYS_I2C_EEPROM_ADDR_OVERFLOW    1
index 6ba4aaf8cb78c584cb1f3187bf52417ebdd8276f..5b8b22f0e643f3dcf306636c0c7cea923050ba0e 100644 (file)
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
index ed790ccaf3a83594273d36ae86f25a5700b8584f..e136824f0cd5a2a37d4f746d2c74dbb56c3773d5 100644 (file)
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR             (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      3
index bbe9b59b5337f29dd9141e57439264b3b6f250da..d9a3671b26894f8fb49ae072c3554c3411a3f6c1 100644 (file)
 
 #define CONFIG_SYS_SPD_BUS_NUM 0       /* The I2C bus for SPD          */
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     0x50
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
index a676a20ebb49b5c85a7ff868c3e194e8ca5ee44d..60c9e2c212af6f93bd4b5cb41f31922e45dc454f 100644 (file)
  */
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR             (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      3
index fa72eb02f3de2f54bd4279a29c44094cdd63837b..664896b614c1439f7c0e56a09c53aafbb7aae0fd 100644 (file)
 #define IIC0_BOOTPROM_ADDR     0x50
 #define IIC0_ALT_BOOTPROM_ADDR 0x54
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     (0x50)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
index 3f045f2e4afb2f56f23e9004dfcaed59d342d898..eba74797711db17962de3c5a21070e93e565bedc 100644 (file)
@@ -25,7 +25,6 @@
 #define CONFIG_KM_COMMON_ETH_INIT
 
 /* EEprom support 24C08, 24C16, 24C64 */
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      3  /* 8 Byte write page */
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10
index 098839b7e107c11cd6a084612cca7ffb4b625895..750b7e931055d850e15d7f5331f84ca310dedca7 100644 (file)
@@ -220,7 +220,6 @@ int get_scl(void);
 #define        CONFIG_SYS_I2C_SOFT_SPEED       100000
 
 /* EEprom support 24C128, 24C256 valid for environment eeprom */
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_ENABLE
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      6 /* 64 Byte write page */
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  10
index 15e4a7e5c849b60b1ecef9997626ad357222329d..e22d0e8b0d08b9c4b771979ecda6e8a483094cc2 100644 (file)
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
index 24b5489237b01ab4dc7de5a7a84c013c40eb9ade..405a871c1a6f78a99f4db220cae4b39090cc6467 100644 (file)
@@ -91,7 +91,6 @@
 
 /* EEPROM */
 #ifdef CONFIG_CMD_EEPROM
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
 #endif
 
index 97c614b5d6f17d088c2e6aada227b6e86d765ebd..a8cf2019138818fae1292104c8d6c1daf27fabee 100644 (file)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      1       /* 2 bytes per write cycle */
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  5       /* 2ms/cycle + 3ms extra */
-#define CONFIG_SYS_I2C_MULTI_EEPROMS           1       /* 2 EEPROMs (addr:50,52) */
 
 /*
  * RTC configuration
index 381b1764554b5ce4bc28627076486f9c44579cea..57e1c5fcba1400e0c58ff3ccb7d05f9ed71c732f 100644 (file)
 
 /* enable read and write access to EEPROM */
 #define CONFIG_CMD_EEPROM
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
index d2af2a015858b353361f253ce208776664598c96..c7608c5a6b3f86d5b653c84112116be42a62011b 100644 (file)
@@ -261,7 +261,6 @@ extern unsigned long get_board_sys_clk(unsigned long dummy);
 
 /* enable read and write access to EEPROM */
 #define CONFIG_CMD_EEPROM
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 5
index 275e952fb26c39235a11dd4994369802eeaf3c9a..64cfd81611adb44b7dbf98afe01ae600a0734fe0 100644 (file)
 #define CONFIG_ENV_EEPROM_IS_ON_I2C
 #define CONFIG_SYS_I2C_EEPROM_ADDR     0x50    /* Main EEPROM */
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 
 #define CONFIG_SYS_BAUDRATE_TABLE      { 110, 300, 600, 1200, 2400, \
 4800, 9600, 14400, 19200, 28800, 38400, 56000, 57600, 115200 }
index d68cdede866090bf0ae0c417ce9be4eb7f933af4..bfc1c1e5707c0b6c831ce7c654d229a53b7e57c5 100644 (file)
 #define CONFIG_ENV_EEPROM_IS_ON_I2C
 #define CONFIG_SYS_I2C_EEPROM_ADDR     0x50
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 
 /* SPL */
 #define CONFIG_SPL_POWER_SUPPORT
index 1f1beeaf2ed26d1c3bd7b0b50c775aaa3c5883aa..f32459b7afb93c01fc488e3e2cf155fbc2ea6b7b 100644 (file)
  */
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
index 502e79597647f6f306889a2b9a7c9f9a0835c4bc..7942865f114fb3f4bad2253797acf659d4a3a138 100644 (file)
  */
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0                  400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR             (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN         1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      3
index ca28e47839ce4fb2af339bb47886de802a5707c3..f5f53249e28a63b698de838fbd1648274b4b13d4 100644 (file)
  
 
 /* EEPROM */
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_CMD_EEPROM
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 2
 #define CONFIG_SYS_EEPROM_BUS_NUM      1
index 8b803a2ee016115e554c24370185ad657af3a122..dd6b5196a024ca09f9ec60db712859a0c2163c11 100644 (file)
@@ -80,7 +80,6 @@
  */
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
index 8508a8029e1d645f3746287c52f07858c1596d31..0cffab8c0f03c26467b92848e5484dbe68c61e15 100644 (file)
  *----------------------------------------------------------------------*/
 #define CONFIG_SYS_I2C_PPC4XX_SPEED_0          400000
 
-#define CONFIG_SYS_I2C_MULTI_EEPROMS
 #define CONFIG_SYS_I2C_EEPROM_ADDR     (0xa8>>1)
 #define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3