From f326fb05b564b0975a9870b2831f9372539202db Mon Sep 17 00:00:00 2001 From: Chun-Ta Lin Date: Wed, 21 Jun 2017 15:14:37 +0800 Subject: hammer: enable large block reading on usb i2c passthru. Originally, i2c passthru is limited to use I2C_XFER_SINGLE flag where it can only read at most 255 bytes at a time. For application that requires larger i2c bus reading, we change the flag setting and the command protocol. TEST=old ./touchpad_updater still works (previous protocol) TEST=new ./touchpad_updater can get more than 500 bytes per transaction TEST=Debug message only print when -d assigned. ./touchpad_updater -d TEST=Manually change #define CONFIG_USB_I2C_MAX_READ_COUNT (1024 - 6) to #define CONFIG_USB_I2C_MAX_READ_COUNT (1024 - 4) and trigger POWER_OF_TWO assertion. BRANCH=none BUG=b:35587174, b:63993891 Change-Id: Id75b11ea49ba89bab8e18af24d47219030c778c5 Signed-off-by: Chun-Ta Lin Reviewed-on: https://chromium-review.googlesource.com/542716 Commit-Ready: Chun-ta Lin Tested-by: Chun-ta Lin Reviewed-by: Nicolas Boichat --- board/hammer/board.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'board/hammer') diff --git a/board/hammer/board.h b/board/hammer/board.h index 7b713d05f2..c150ac40bd 100644 --- a/board/hammer/board.h +++ b/board/hammer/board.h @@ -130,9 +130,17 @@ #define CONFIG_BOARD_PRE_INIT #define CONFIG_WATCHDOG_HELP -/* Enlarge the allowed write count */ +/* + * Enlarge the allowed write / read count for trackpad debug + * In the extended I2C reading over I2C ( >= 128 bytes ), the header size + * have to be 6 bytes instead of 4 bytes for receiving packets. Moreover, + * buffer size have to be power of two. + */ #undef CONFIG_USB_I2C_MAX_WRITE_COUNT -#define CONFIG_USB_I2C_MAX_WRITE_COUNT 124 +#define CONFIG_USB_I2C_MAX_WRITE_COUNT (128 - 4) /* 4 is maximum header size */ + +#undef CONFIG_USB_I2C_MAX_READ_COUNT +#define CONFIG_USB_I2C_MAX_READ_COUNT (1024 - 6) /* 6 is maximum header size */ /* No lid switch */ #undef CONFIG_LID_SWITCH -- cgit v1.2.1