diff options
author | Nicolas Boichat <drinkcat@google.com> | 2016-05-17 18:23:36 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-05-24 19:23:28 -0700 |
commit | a22ba254837d7f858415b63bff5fd77a2c94acc4 (patch) | |
tree | 27672312b0e66b27e2666f0da9a1e99ad8c564e2 /board/elm | |
parent | f5bba241fdcefcc0c1d2f82b097caa2923b3ccc5 (diff) | |
download | chrome-ec-a22ba254837d7f858415b63bff5fd77a2c94acc4.tar.gz |
elm: Add support for I2C tunnel protection
When I2C tunnel connected to ANX7688 is protected, we only allow
access to I2C address 0x2c (TCPC).
BRANCH=none
BUG=chrome-os-partner:52431
TEST=Book elm-rev1
Change-Id: Ic68f1665cf7b01d3392fe0308bd199a85f43d493
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/345762
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Randall Spangler <rspangler@google.com>
Diffstat (limited to 'board/elm')
-rw-r--r-- | board/elm/board.c | 14 | ||||
-rw-r--r-- | board/elm/board.h | 1 |
2 files changed, 14 insertions, 1 deletions
diff --git a/board/elm/board.c b/board/elm/board.c index 3a51b0ba68..131645b24c 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -96,10 +96,22 @@ const struct adc_t adc_channels[] = { }; BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT); +int anx7688_passthru_allowed(const struct i2c_port_t *port, uint16_t address) +{ + /* Allow access to 0x2c (TCPC) */ + if (address == 0x2c) + return 1; + + CPRINTF("Passthru rejected on %x", address); + + return 0; +} + /* I2C ports */ const struct i2c_port_t i2c_ports[] = { {"battery", I2C_PORT_BATTERY, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA}, - {"pd", I2C_PORT_PD_MCU, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA} + {"pd", I2C_PORT_PD_MCU, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA, + anx7688_passthru_allowed} }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); diff --git a/board/elm/board.h b/board/elm/board.h index 0d50d10944..953b296a09 100644 --- a/board/elm/board.h +++ b/board/elm/board.h @@ -108,6 +108,7 @@ /* Optional features */ #define CONFIG_CMD_HOSTCMD +#define CONFIG_CMD_I2C_PROTECT /* Drivers */ #ifndef __ASSEMBLER__ |