summaryrefslogtreecommitdiff
path: root/board/kodama
diff options
context:
space:
mode:
authorTing Shen <phoenixshen@google.com>2019-12-16 17:44:57 +0800
committerCommit Bot <commit-bot@chromium.org>2020-01-17 12:31:42 +0000
commit45427c38df049e4506bf42e17d1ccfd303e1380c (patch)
treed0ceab265367bcfb1e9ebc2d47222749710fe127 /board/kodama
parent166c22d05730de961b894d954116439d6ff219e7 (diff)
downloadchrome-ec-45427c38df049e4506bf42e17d1ccfd303e1380c.tar.gz
i2c: Support changing I2C bus speed at runtime
Add a i2c_set_freq function and let chip drivers add their underlying implementation. Also implemented on stm32f0. BUG=b:143677811,b:78189419 TEST=1) make 2) On kodama, call i2c_set_freq(1, 100) during init. verify the bus is configured to 100kbps in kodama rev 1 BRANCH=kukui Change-Id: Iebb5baacf098b3e5649a4bd8ca14acf097d39693 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1969245 Reviewed-by: Matthew Blecker <matthewb@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
Diffstat (limited to 'board/kodama')
-rw-r--r--board/kodama/board.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/board/kodama/board.c b/board/kodama/board.c
index 388e91d932..8839c77a54 100644
--- a/board/kodama/board.c
+++ b/board/kodama/board.c
@@ -23,7 +23,6 @@
#include "gpio.h"
#include "hooks.h"
#include "host_command.h"
-#include "i2c-stm32f0.h"
#include "i2c.h"
#include "lid_switch.h"
#include "power.h"
@@ -64,7 +63,8 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
{"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
+ {"other", 1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -271,12 +271,8 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
*/
static void board_i2c_init(void)
{
- if (board_get_version() < 2) {
- const struct i2c_port_t i2c_port = {
- "other", 1, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA,
- };
- stm32f0_i2c_init_port(&i2c_port);
- }
+ if (board_get_version() < 2)
+ i2c_set_freq(1, I2C_FREQ_100KHZ);
}
DECLARE_HOOK(HOOK_INIT, board_i2c_init, HOOK_PRIO_INIT_I2C);