From 56662a29b010870338c4338c32a3f6afd9912cb7 Mon Sep 17 00:00:00 2001 From: Alexandru M Stan Date: Tue, 27 Aug 2019 17:15:56 -0700 Subject: main: Initialize I2C pretty early Some devices (like the keyboard, CBI) need I2C access pretty early. Until now I2C would get initialized pretty late in a hook, which was far too late for some stuff. As a result from this change, CONFIG_I2C_MASTER now implies the i2c_init() function will be called at board boot. Some chips (cr50, host tests) needed a stub i2c_init in order to compile cleanly. BUG=b/138384267 TEST=EFS doesn't happen significantly later than it used to TEST=Recovery keys now work with I2C keyboard on jacuzzi TEST=make buildall TEST=Sanity check i2c behavior (booting, "i2scan", "battery") on a variety of ECs: * ampton (ite EC, x86 AP) * bobba (npcx EC, x86 AP) * jacuzzi (stm32f0 EC, ARM AP) * cheza (npcx EC, ARM AP) BRANCH=master Change-Id: Ifa830e8e509ff16b36b4dcc86617869b1cb86ac3 Signed-off-by: Alexandru M Stan Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1772490 Reviewed-by: Jett Rink Reviewed-by: Vadim Bendebury --- chip/max32660/i2c_chip.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'chip/max32660') diff --git a/chip/max32660/i2c_chip.c b/chip/max32660/i2c_chip.c index 2069cf7921..4ee6117656 100644 --- a/chip/max32660/i2c_chip.c +++ b/chip/max32660/i2c_chip.c @@ -260,7 +260,7 @@ void i2c_set_timeout(int port, uint32_t timeout) /** * i2c_init() - Initialize the I2C ports used on device. */ -static void i2c_init(void) +void i2c_init(void) { int i; int port; @@ -281,7 +281,6 @@ static void i2c_init(void) init_i2cs(I2C_PORT_EC); #endif } -DECLARE_HOOK(HOOK_INIT, i2c_init, HOOK_PRIO_INIT_I2C); /** * I2C Slave Implentation -- cgit v1.2.1