diff options
author | Zhuohao Lee <zhuohao@chromium.org> | 2018-12-17 21:16:28 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-12-20 13:49:46 -0800 |
commit | 9b8b6743cd3984bc85688a61fa70f35fd6f244e8 (patch) | |
tree | d567f040d7edc802dc2576f7e16f32cb0da0f2b8 /board/rammus/board.c | |
parent | 5c0d4b1ea1882c52148106986a18c2761742742a (diff) | |
download | chrome-ec-9b8b6743cd3984bc85688a61fa70f35fd6f244e8.tar.gz |
rammus: reconfig the PS8751 i2c port according to the board version
On Shyvana, we found that if we put the Parade PS8751 and Analogix
ANX3447 on the same i2c bus, the ANX3447 would be broken because
of PS8751 i2c bus error. To avoid this kind of problem, we decided
to separate the TCPC i2c bus starting from board version >= 2.
The new assignment are ANX3447:i2c_0_0, PS8751:i2c_0_1.
This patch also adds a new config CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
for enabling runtime switching the TCPC setting.
BUG=b:118063849
BRANCH=firmware-rammus-11275
TEST=verified on DUT with board_version <= 1
verified on reworked DUT with board_version >= 2
Change-Id: I0bdc930c1a5e691239f5f5c256d380d0111eed91
Signed-off-by: Zhuohao Lee <zhuohao@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1381600
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/rammus/board.c')
-rw-r--r-- | board/rammus/board.c | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/board/rammus/board.c b/board/rammus/board.c index 340cca0028..46afccbb2f 100644 --- a/board/rammus/board.c +++ b/board/rammus/board.c @@ -17,6 +17,7 @@ #include "charger.h" #include "chipset.h" #include "console.h" +#include "cros_board_info.h" #include "driver/accelgyro_bmi160.h" #include "driver/accel_bma2x2.h" #include "driver/tcpm/ps8xxx.h" @@ -160,7 +161,7 @@ const struct i2c_port_t i2c_ports[] = { const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ -const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { +struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { [USB_PD_PORT_PS8751] = { .i2c_host_port = I2C_PORT_TCPC1, .i2c_slave_addr = PS8751_I2C_ADDR1, @@ -217,10 +218,32 @@ void board_reset_pd_mcu(void) msleep(2); } +/* + * Read CBI data from EEPROM via i2c and remap the ps8751 i2c port + */ +static void ps8751_i2c_remap(void) +{ + uint32_t board_version; + + if (cbi_get_board_version(&board_version) != EC_SUCCESS || + board_version > 1) + return; + /* + * Due to b/118063849, we separate the ps8751 and anx3447 to + * different i2c bus which start from board_version >= 2. + * For the board_version <= 1, the ps8751 and anx3447 TCPC + * use the same i2c bus. Thus, reconfig the ps8751 i2c port + * to i2c_0_0. + */ + tcpc_config[USB_PD_PORT_PS8751].i2c_host_port = I2C_PORT_TCPC0; +} + void board_tcpc_init(void) { int port; + ps8751_i2c_remap(); + /* Only reset TCPC if not sysjump */ if (!system_jumped_to_this_image()) { board_reset_pd_mcu(); |