diff options
author | Caveh Jalali <caveh@chromium.org> | 2021-09-23 13:56:33 -0700 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-10-29 17:46:43 +0000 |
commit | cb2a32f3dcce97452162c5e41c44bea361ab208a (patch) | |
tree | f006bb7d7e6c1586df9f7837acf98d78ca760e90 | |
parent | 32a64aa55b6a42fe6642b292522f02d2b51e92ec (diff) | |
download | chrome-ec-cb2a32f3dcce97452162c5e41c44bea361ab208a.tar.gz |
brya: Run TCPC1/PPC1 I2C at 1 MHz on newer boards
This updates the TCPC1 and PPC1 (ps8815 daughterboard) I2C buses to
operate at 1 MHz instead of 400 kHz. Boards before board ID 2 were not
tuned for 1 MHz operation, so they will continue to operate at 400 kHz.
BRANCH=none
BUG=b:186189039,b:187764571,b:187764202
TEST=updated TCPC1 firmware using window scheme and FIFO scheme.
TEST=verified I2C bus 4, 7 speed is 1000 on board ID 2 and at 400 when
BOARD_ID_FAST_PLUS_CAPABLE is set to 9.
Change-Id: I182cb6bc0d1be24d512ef14d16e2cb4347b7eb02
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3181512
Reviewed-by: Boris Mittelberg <bmbm@google.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Keith Short <keithshort@chromium.org>
-rw-r--r-- | board/brya/i2c.c | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/board/brya/i2c.c b/board/brya/i2c.c index b3eb8352da..3db2e0c17b 100644 --- a/board/brya/i2c.c +++ b/board/brya/i2c.c @@ -5,9 +5,11 @@ #include "common.h" #include "compile_time_macros.h" - +#include "hooks.h" #include "i2c.h" +#define BOARD_ID_FAST_PLUS_CAPABLE 2 + /* I2C port map configuration */ const struct i2c_port_t i2c_ports[] = { { @@ -46,7 +48,7 @@ const struct i2c_port_t i2c_ports[] = { /* I2C4 C1 TCPC */ .name = "tcpc1", .port = I2C_PORT_USB_C1_TCPC, - .kbps = 400, + .kbps = 1000, .scl = GPIO_EC_I2C_USB_C1_TCPC_SCL, .sda = GPIO_EC_I2C_USB_C1_TCPC_SDA, .flags = I2C_PORT_FLAG_DYNAMIC_SPEED, @@ -63,9 +65,10 @@ const struct i2c_port_t i2c_ports[] = { /* I2C6 */ .name = "ppc1", .port = I2C_PORT_USB_C1_PPC, - .kbps = 400, + .kbps = 1000, .scl = GPIO_EC_I2C_USB_C1_MIX_SCL, .sda = GPIO_EC_I2C_USB_C1_MIX_SDA, + .flags = I2C_PORT_FLAG_DYNAMIC_SPEED, }, { /* I2C7 */ @@ -77,3 +80,19 @@ const struct i2c_port_t i2c_ports[] = { }, }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); + +/* + * I2C controllers are initialized in main.c. This sets the speed much + * later, but before I2C peripherals are initialized. + */ +static void set_board_legacy_i2c_speeds(void) +{ + if (get_board_id() >= BOARD_ID_FAST_PLUS_CAPABLE) + return; + + ccprints("setting USB DB I2C buses to 400 kHz\n"); + + i2c_set_freq(I2C_PORT_USB_C1_TCPC, I2C_FREQ_400KHZ); + i2c_set_freq(I2C_PORT_USB_C1_PPC, I2C_FREQ_400KHZ); +} +DECLARE_HOOK(HOOK_INIT, set_board_legacy_i2c_speeds, HOOK_PRIO_INIT_I2C - 1); |