diff options
author | Ting Shen <phoenixshen@google.com> | 2019-12-10 16:23:52 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-12-10 19:16:03 +0000 |
commit | 160f5d39b0ca31124b1e0d0218442fa65dbd77ea (patch) | |
tree | 085adcf5ad5fd7fcc33c8aba67a29a951ae1ea48 /chip/stm32 | |
parent | fda4c7a2c7f943cdab22e9626d09a34b22af48cc (diff) | |
download | chrome-ec-160f5d39b0ca31124b1e0d0218442fa65dbd77ea.tar.gz |
stm32f0: expose i2c_init_port
Kodama needs to reconfigure i2c bus frequency at runtime.
Expose i2c_init_port so we can re-init i2c bus at board_rev_init().
BUG=b:143677811
TEST=verify sensor/battery works on kodama EVT and DVT
BRANCH=kukui
Change-Id: I4050179d24f05db1ef20270ebbb567eba429546c
Signed-off-by: Ting Shen <phoenixshen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1959669
Reviewed-by: Eric Yilun Lin <yllin@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'chip/stm32')
-rw-r--r-- | chip/stm32/i2c-stm32f0.c | 5 | ||||
-rw-r--r-- | chip/stm32/i2c-stm32f0.h | 15 |
2 files changed, 18 insertions, 2 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index a4db7ee456..21cfe3e684 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -12,6 +12,7 @@ #include "host_command.h" #include "hwtimer.h" #include "i2c.h" +#include "i2c-stm32f0.h" #include "registers.h" #include "system.h" #include "task.h" @@ -135,7 +136,7 @@ static void i2c_set_freq_port(const struct i2c_port_t *p, * * @param p the I2c port */ -static void i2c_init_port(const struct i2c_port_t *p) +void stm32f0_i2c_init_port(const struct i2c_port_t *p) { int port = p->port; enum stm32_i2c_clk_src src = I2C_CLK_SRC_48MHZ; @@ -603,7 +604,7 @@ void i2c_init(void) int i; for (i = 0; i < i2c_ports_used; i++, p++) - i2c_init_port(p); + stm32f0_i2c_init_port(p); #ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR_FLAGS STM32_I2C_CR1(I2C_PORT_EC) |= STM32_I2C_CR1_RXIE | STM32_I2C_CR1_ERRIE diff --git a/chip/stm32/i2c-stm32f0.h b/chip/stm32/i2c-stm32f0.h new file mode 100644 index 0000000000..8e694759e9 --- /dev/null +++ b/chip/stm32/i2c-stm32f0.h @@ -0,0 +1,15 @@ +/* Copyright 2019 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#ifndef __CROS_EC_I2C_STM32F0_H +#define __CROS_EC_I2C_STM32F0_H + +/** + * Initialize on the specified I2C port. + * + * @param p the I2c port + */ +void stm32f0_i2c_init_port(const struct i2c_port_t *p); + +#endif |