diff options
author | Rong Chang <rongchang@chromium.org> | 2012-06-16 20:22:20 +0800 |
---|---|---|
committer | Gerrit <chrome-bot@google.com> | 2012-06-18 12:13:34 -0700 |
commit | fe38bab96168effcce38090259f265d82e784aa1 (patch) | |
tree | 64aa28694ab2a3dcd7313ac5c520b16420aeec9a /chip | |
parent | 4aa13dbef989e29518a18a9881858da0dd34d13c (diff) | |
download | chrome-ec-fe38bab96168effcce38090259f265d82e784aa1.tar.gz |
Set daisy and snow PB6 PB7 GPIO pinmux to I2C
This change enables I2C1 host function.
Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:10608,10607,9724
TEST=manual
Change I2C_PORT_HOST to 0. Rebuild ec.bin.
Swap I2C resistors on the daisy board, connect battery
and charger to EC_I2C_HOST.
Check I2C functions using uart console commands:
i2c r 0x90 4 // read pmu control reg0
i2c r16 0x16 0x14 // read smart battery desired current
Connect a battery and check console command 'battery'.
Change-Id: Iaa5271e856f410f2d0d2250caf0de6bc5101c1d4
Reviewed-on: https://gerrit.chromium.org/gerrit/25498
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Commit-Ready: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/stm32/i2c.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/chip/stm32/i2c.c b/chip/stm32/i2c.c index 2b06f6055d..c3fe00af2b 100644 --- a/chip/stm32/i2c.c +++ b/chip/stm32/i2c.c @@ -612,6 +612,8 @@ int i2c_read_string(int port, int slave_addr, int offset, uint8_t *data, /*****************************************************************************/ /* Console commands */ +#ifdef I2C_PORT_HOST + static int command_i2c(int argc, char **argv) { int rw = 0; @@ -665,16 +667,16 @@ static int command_i2c(int argc, char **argv) switch (rw) { case 0: - rv = i2c_read8(I2C2, slave_addr, offset, &value); + rv = i2c_read8(I2C_PORT_HOST, slave_addr, offset, &value); break; case 1: - rv = i2c_read16(I2C2, slave_addr, offset, &value); + rv = i2c_read16(I2C_PORT_HOST, slave_addr, offset, &value); break; case 2: - rv = i2c_write8(I2C2, slave_addr, offset, value); + rv = i2c_write8(I2C_PORT_HOST, slave_addr, offset, value); break; case 3: - rv = i2c_write16(I2C2, slave_addr, offset, value); + rv = i2c_write16(I2C_PORT_HOST, slave_addr, offset, value); break; } @@ -698,3 +700,5 @@ DECLARE_CONSOLE_COMMAND(i2c, command_i2c, "Read write i2c", NULL); +#endif /* I2C_PORT_HOST */ + |