]> git.ipfire.org Git - people/ms/u-boot.git/commitdiff
eeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_BITS
authorMarek Vasut <marex@denx.de>
Tue, 10 Nov 2015 19:53:28 +0000 (20:53 +0100)
committerTom Rini <trini@konsulko.com>
Sun, 22 Nov 2015 02:50:24 +0000 (21:50 -0500)
Implement default value of 8 for this macro and pull out all of
this macro out of the code. The default value of 8 actually does
implement exactly the same behavior as the previous code which
was in the #else clause of the ifdef.

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>
common/cmd_eeprom.c

index c38c5349685ce149c78c0627f655058527e21f15..162a05c648bc95af122707d46ba4e9a0c0d0677d 100644 (file)
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS  0
 #endif
 
+#ifndef CONFIG_SYS_EEPROM_PAGE_WRITE_BITS
+#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS      8
+#endif
+
+#define        EEPROM_PAGE_SIZE        (1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
+#define        EEPROM_PAGE_OFFSET(x)   ((x) & (EEPROM_PAGE_SIZE - 1))
+
 /*
  * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is
  *   0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM.
@@ -194,15 +201,8 @@ int eeprom_write (unsigned dev_addr, unsigned offset, uchar *buffer, unsigned cn
                 */
 #if !defined(CONFIG_SYS_I2C_FRAM)
 
-#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
-
-#define        EEPROM_PAGE_SIZE        (1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS)
-#define        EEPROM_PAGE_OFFSET(x)   ((x) & (EEPROM_PAGE_SIZE - 1))
-
                maxlen = EEPROM_PAGE_SIZE - EEPROM_PAGE_OFFSET(blk_off);
-#else
-               maxlen = 0x100 - blk_off;
-#endif
+
                if (maxlen > I2C_RXTX_LEN)
                        maxlen = I2C_RXTX_LEN;