Martin Roth has uploaded this change for review. ( https://review.coreboot.org/28905
Change subject: mb/google/kahlee: Update I2c values for older careena boards ......................................................................
mb/google/kahlee: Update I2c values for older careena boards
The I2C values are typically set in devicetree.cb, but there's an issue where the values need to change between board versions. This allows the mainboard to update the settings at runtime.
BUG=B:110984023 TEST=I2C is set correctly on each version.
Change-Id: I1d17c502244c43e9a8f89471f7b04b3467a6e486 Signed-off-by: Martin Roth martinroth@chromium.org --- M src/mainboard/google/kahlee/variants/careena/Makefile.inc A src/mainboard/google/kahlee/variants/careena/i2c.c 2 files changed, 52 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/28905/1
diff --git a/src/mainboard/google/kahlee/variants/careena/Makefile.inc b/src/mainboard/google/kahlee/variants/careena/Makefile.inc index 0579e18..559b70d 100644 --- a/src/mainboard/google/kahlee/variants/careena/Makefile.inc +++ b/src/mainboard/google/kahlee/variants/careena/Makefile.inc @@ -15,6 +15,9 @@
subdirs-y += ../baseboard/spd
+bootblock-y += i2c.c + romstage-y += ../baseboard/romstage.c
ramstage-y += ../baseboard/mainboard.c +ramstage-y += i2c.c diff --git a/src/mainboard/google/kahlee/variants/careena/i2c.c b/src/mainboard/google/kahlee/variants/careena/i2c.c new file mode 100644 index 0000000..2c06fc1 --- /dev/null +++ b/src/mainboard/google/kahlee/variants/careena/i2c.c @@ -0,0 +1,49 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2018 Google LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <boardid.h> +#include <ec/google/chromeec/ec.h> +#include <soc/southbridge.h> + +/* I2C0 for audio, USB3 hub at 400kHz */ +struct dw_i2c_bus_config careena4_i2c_0 = { + .speed = I2C_SPEED_FAST, + .rise_time_ns = 95, + .fall_time_ns = 3, +}; + +/* I2C2 for trackpad */ +struct dw_i2c_bus_config careena4_i2c_2 = { + .speed = I2C_SPEED_FAST, + .rise_time_ns = 67, + .fall_time_ns = 55, +}; + +/* Change timings for older revisions of the board */ +void mb_update_i2c(unsigned int bus, const struct dw_i2c_bus_config **i2c_vals) +{ + uint32_t board_id = board_id(); + + if (board_id > 2 && board_id < 5) { + switch (bus) { + case 0: + *i2c_vals = &careena4_i2c_0; + break; + case 2: + *i2c_vals = &careena4_i2c_2; + break; + } + } +}