diff options
author | elmo_lan <elmo_lan@compal.corp-partner.google.com> | 2020-03-27 11:32:14 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-04-15 23:16:10 +0000 |
commit | 521242192bbed298121df2ece95bc8bfb21a3ab4 (patch) | |
tree | 747e0eb76e3ad67fc8b3d630cf13bc7c083cf552 /common/cbi.c | |
parent | 2f6626d427eb6f3b9c2dc7406b152a85aa55b7b3 (diff) | |
download | chrome-ec-521242192bbed298121df2ece95bc8bfb21a3ab4.tar.gz |
CBI: Use 8-byte page write size for EEPROM
We want to allow both 8-byte and 16-byte page size EEPROMS.
BUG=b:152372438
BRANCH=none
TEST=make all
Signed-off-by: elmo_lan <elmo_lan@compal.corp-partner.google.com>
Change-Id: Ie2e962b21179ee7894ca844394946f8e1c475aaf
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2123614
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Marco Chen <marcochen@chromium.org>
Diffstat (limited to 'common/cbi.c')
-rw-r--r-- | common/cbi.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/cbi.c b/common/cbi.c index 109911c0be..5263407441 100644 --- a/common/cbi.c +++ b/common/cbi.c @@ -78,7 +78,13 @@ struct cbi_data *cbi_find_tag(const void *cbi, enum cbi_data_tag tag) #define CPRINTS(format, args...) cprints(CC_SYSTEM, "CBI " format, ## args) -#define EEPROM_PAGE_WRITE_SIZE 16 +/* + * We allow EEPROMs with page size of 8 or 16. Use 8 to be the most compatible. + * This causes a little more overhead for writes, but we are not writing to the + * EEPROM outside of the factory process. + */ +#define EEPROM_PAGE_WRITE_SIZE 8 + #define EEPROM_PAGE_WRITE_MS 5 #define EC_ERROR_CBI_CACHE_INVALID EC_ERROR_INTERNAL_FIRST @@ -234,9 +240,6 @@ static int eeprom_is_write_protected(void) static int write_board_info(void) { - /* The code is only tested for ST M24C02, whose page size for a single - * write is 16 byte. To support different EEPROMs, you may need to - * craft the i2c packets accordingly. */ const uint8_t *p = cbi; int rest = head->total_size; |