diff options
author | Matthew Blecker <matthewb@chromium.org> | 2018-11-27 15:15:52 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2019-04-02 21:09:19 +0000 |
commit | a9a44975f3194e30016016020a220f6f246b6992 (patch) | |
tree | 076f5a7a1af3a4642e0bae369df45b44e1c0d2aa | |
parent | a77af579d5851ac87e42bc4cb6e29647c2cf459a (diff) | |
download | chrome-ec-a9a44975f3194e30016016020a220f6f246b6992.tar.gz |
servo_micro: Increase maximum I2C-over-USB write and read sizes.
BRANCH=none
BUG=b:79684405
TEST=This makes block_write_size up to 254B in iteflash work,
and makes 256B verification reads work.
Change-Id: I887f0eaacc87428a4646007520f27bdf5aaa231a
Signed-off-by: Matthew Blecker <matthewb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1351517
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit c1b0bf4bd57ec87a55ffbae4d08ae7422d1a6e44)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1539425
Commit-Queue: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Tested-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-by: Nick Sanders <nsanders@chromium.org>
-rw-r--r-- | board/servo_micro/board.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/board/servo_micro/board.h b/board/servo_micro/board.h index 86aff61772..a7a2116d89 100644 --- a/board/servo_micro/board.h +++ b/board/servo_micro/board.h @@ -80,9 +80,44 @@ #define CONFIG_USB_I2C #define CONFIG_I2C #define CONFIG_I2C_MASTER +/* + * iteflash requires 256 byte reads for verifying ITE EC firmware. Without this + * the limit is CONFIG_I2C_CHIP_MAX_READ_SIZE which is 255 for STM32F0 due to an + * 8 bit field, per src/platform/ec/include/config.h comment. + */ +#define CONFIG_I2C_XFER_LARGE_READ #define I2C_PORT_MASTER 0 /* + * As of 2018-11-27 the default for both is 60 bytes. These larger values allow + * for reflashing of ITE EC chips over I2C + * (https://issuetracker.google.com/79684405) in reasonably speedy fashion. If + * the EC firmware defaults are ever raised significantly, consider removing + * these overrides. + * + * As of 2018-11-27 the actual maximum write size supported by the I2C-over-USB + * protocol is (1<<12)-1, and the maximum read size supported is + * (1<<15)-1. However compile time assertions require that these values be + * powers of 2 after overheads are included. Thus, the write limit set here + * /should/ be (1<<12)-4 and the read limit should be (1<<15)-6, however those + * ideal limits are not actually possible because servo_micro lacks sufficient + * spare memory for them. With symmetrical limits, the maximum that currently + * fits is (1<<11)-4 write limit and (1<<11)-6 read limit, leaving 1404 bytes of + * RAM available. + * + * However even with a sufficiently large write value here, the maximum that + * actually works as of 2018-12-03 is 255 bytes. Additionally, ITE EC firmware + * image verification requires exactly 256 byte reads. Thus the only useful + * powers-of-2-minus-overhead limits to set here are (1<<9)-4 writes and + * (1<<9)-6 reads, leaving 6012 bytes of RAM available, down from 7356 bytes of + * RAM available with the default 60 byte limits. + */ +#undef CONFIG_USB_I2C_MAX_WRITE_COUNT +#undef CONFIG_USB_I2C_MAX_READ_COUNT +#define CONFIG_USB_I2C_MAX_WRITE_COUNT ((1<<9) - 4) +#define CONFIG_USB_I2C_MAX_READ_COUNT ((1<<9) - 6) + +/* * Allow dangerous commands all the time, since we don't have a write protect * switch. */ |