Commit 6717e3c84fc3934241eb02a3b437b06dede12594
Committed by
Tom Rini
1 parent
8eee40a602
Exists in
v2017.01-smarct4x
and in
30 other branches
eeprom: Pull out CONFIG_SYS_EEPROM_PAGE_WRITE_BITS
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>
Showing 1 changed file with 8 additions and 8 deletions Side-by-side Diff
common/cmd_eeprom.c
... | ... | @@ -33,6 +33,13 @@ |
33 | 33 | #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS 0 |
34 | 34 | #endif |
35 | 35 | |
36 | +#ifndef CONFIG_SYS_EEPROM_PAGE_WRITE_BITS | |
37 | +#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 8 | |
38 | +#endif | |
39 | + | |
40 | +#define EEPROM_PAGE_SIZE (1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS) | |
41 | +#define EEPROM_PAGE_OFFSET(x) ((x) & (EEPROM_PAGE_SIZE - 1)) | |
42 | + | |
36 | 43 | /* |
37 | 44 | * for CONFIG_SYS_I2C_EEPROM_ADDR_LEN == 2 (16-bit EEPROM address) offset is |
38 | 45 | * 0x000nxxxx for EEPROM address selectors at n, offset xxxx in EEPROM. |
39 | 46 | |
... | ... | @@ -194,15 +201,8 @@ |
194 | 201 | */ |
195 | 202 | #if !defined(CONFIG_SYS_I2C_FRAM) |
196 | 203 | |
197 | -#if defined(CONFIG_SYS_EEPROM_PAGE_WRITE_BITS) | |
198 | - | |
199 | -#define EEPROM_PAGE_SIZE (1 << CONFIG_SYS_EEPROM_PAGE_WRITE_BITS) | |
200 | -#define EEPROM_PAGE_OFFSET(x) ((x) & (EEPROM_PAGE_SIZE - 1)) | |
201 | - | |
202 | 204 | maxlen = EEPROM_PAGE_SIZE - EEPROM_PAGE_OFFSET(blk_off); |
203 | -#else | |
204 | - maxlen = 0x100 - blk_off; | |
205 | -#endif | |
205 | + | |
206 | 206 | if (maxlen > I2C_RXTX_LEN) |
207 | 207 | maxlen = I2C_RXTX_LEN; |
208 | 208 |