diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2014-07-18 15:06:22 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-07-20 07:46:37 +0000 |
commit | 4eee9fe42688e77c6c845a3904adb531a75f569a (patch) | |
tree | 91c763be46e70bb1ebe34ea982d88247146cd2bf | |
parent | 3bb7de950f007ec554d73f0d2b480c68e562e5bc (diff) | |
download | chrome-ec-4eee9fe42688e77c6c845a3904adb531a75f569a.tar.gz |
i2c: Add variable to set slave address of the EC.stabilize-6082.B
Only one EC was an i2c slave, samus_pd.
Now we have 2 more, ryu and ryu_sh (sensor hub).
Define a new variable: CONFIG_HOSTCMD_I2C_SLAVE_ADDR
TEST=Compiled
BRANCH=None
BUG=chrome-os-partner:30740
Change-Id: I484aaf5ca72f14a91ce261b91fbe600dca3474dc
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/208978
Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r-- | board/ryu/board.h | 5 | ||||
-rw-r--r-- | board/samus_pd/board.h | 5 | ||||
-rw-r--r-- | chip/stm32/i2c-stm32f0.c | 2 | ||||
-rw-r--r-- | include/config.h | 6 |
4 files changed, 17 insertions, 1 deletions
diff --git a/board/ryu/board.h b/board/ryu/board.h index 0e7087a98b..6c38c4863b 100644 --- a/board/ryu/board.h +++ b/board/ryu/board.h @@ -51,6 +51,11 @@ #define I2C_PORT_CHARGER I2C_PORT_MASTER #define I2C_PORT_BATTERY I2C_PORT_MASTER +/* slave address for host commands */ +#ifdef HAS_TASK_HOSTCMD +#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR 0x3c +#endif + #ifndef __ASSEMBLER__ /* Timer selection */ diff --git a/board/samus_pd/board.h b/board/samus_pd/board.h index b84771a352..fc3eaff898 100644 --- a/board/samus_pd/board.h +++ b/board/samus_pd/board.h @@ -34,6 +34,11 @@ #define I2C_PORT_SLAVE 0 #define I2C_PORT_EC I2C_PORT_SLAVE +/* slave address for host commands */ +#ifdef HAS_TASK_HOSTCMD +#define CONFIG_HOSTCMD_I2C_SLAVE_ADDR CONFIG_USB_PD_I2C_SLAVE_ADDR +#endif + /* * Allow dangerous commands all the time, since we don't have a write protect * switch. diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c index 02e0e0bb67..fb669a52c7 100644 --- a/chip/stm32/i2c-stm32f0.c +++ b/chip/stm32/i2c-stm32f0.c @@ -423,7 +423,7 @@ static void i2c_init(void) #ifdef HAS_TASK_HOSTCMD STM32_I2C_CR1(I2C_PORT_EC) |= STM32_I2C_CR1_RXIE | STM32_I2C_CR1_ERRIE | STM32_I2C_CR1_ADDRIE | STM32_I2C_CR1_STOPIE; - STM32_I2C_OAR1(I2C_PORT_EC) = 0x8000 | CONFIG_USB_PD_I2C_SLAVE_ADDR; + STM32_I2C_OAR1(I2C_PORT_EC) = 0x8000 | CONFIG_HOSTCMD_I2C_SLAVE_ADDR; task_enable_irq(STM32_IRQ_I2C1); #endif } diff --git a/include/config.h b/include/config.h index 08f937f669..0d1e1977df 100644 --- a/include/config.h +++ b/include/config.h @@ -525,6 +525,12 @@ */ #undef CONFIG_HOST_COMMAND_STATUS +/* + * For ECs where the host command interface is I2C, slave + * address which the EC will respond to. + */ +#undef CONFIG_HOSTCMD_I2C_SLAVE_ADDR + /*****************************************************************************/ /* Enable debugging and profiling statistics for hook functions */ |