summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru M Stan <amstan@chromium.org>2014-08-07 14:08:17 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-08-08 03:11:42 +0000
commit866b1939d6af64dd604d0b404a55c1c19236ce84 (patch)
tree1865e9b22a2a7ffcce96bc12bffce0ffe15ac923
parent0af39b3cffe139e18267422e985bdf9aca19dcbe (diff)
downloadchrome-ec-866b1939d6af64dd604d0b404a55c1c19236ce84.tar.gz
i2c-stm32f0: Adjust scope of the I2C host code
HAS_TASK_HOSTCMD is not a good indicator that we intend to use I2C Host Commands On platforms such a veyron we use an STM32F0 with SPI HC for example however i2c-stm32f0.c was very eager to still provide host commands via I2C. If one wants to use I2C host commands they need to define CONFIG_HOSTCMD_I2C_SLAVE_ADDR anyway, so the presence of that is a better indicator. The boards that want I2C host commands are ryu and samus_pd. veyron/pinky needs SPI host commands, so this patch makes this case possible. The rest of the boards that use STM32F0 do not have HAS_TASK_HOSTCMD set. BUG=None TEST=make buildall -j BRANCH=None Change-Id: Ia5561afdc6e72019c24c5c4b775944b2b88cb950 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/211434 Reviewed-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--chip/stm32/i2c-stm32f0.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/chip/stm32/i2c-stm32f0.c b/chip/stm32/i2c-stm32f0.c
index e877c5f139..418e481cc4 100644
--- a/chip/stm32/i2c-stm32f0.c
+++ b/chip/stm32/i2c-stm32f0.c
@@ -32,7 +32,7 @@
*/
#define I2C_MAX_HOST_PACKET_SIZE 128
-#ifdef HAS_TASK_HOSTCMD
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR
#if (I2C_PORT_EC == STM32_I2C1_PORT)
#define IRQ_SLAVE STM32_IRQ_I2C1
#else
@@ -119,7 +119,7 @@ static void i2c_init_port(const struct i2c_port_t *p)
}
/*****************************************************************************/
-#ifdef HAS_TASK_HOSTCMD
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR
/* Host command slave */
/*
* Buffer for received host command packets (including prefix byte on request,
@@ -431,7 +431,7 @@ static void i2c_init(void)
for (i = 0; i < i2c_ports_used; i++, p++)
i2c_init_port(p);
-#ifdef HAS_TASK_HOSTCMD
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR
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_HOSTCMD_I2C_SLAVE_ADDR;
@@ -440,6 +440,7 @@ static void i2c_init(void)
}
DECLARE_HOOK(HOOK_INIT, i2c_init, HOOK_PRIO_DEFAULT);
+#ifdef CONFIG_HOSTCMD_I2C_SLAVE_ADDR
/**
* Get protocol information
*/
@@ -460,4 +461,5 @@ static int i2c_get_protocol_info(struct host_cmd_handler_args *args)
DECLARE_HOST_COMMAND(EC_CMD_GET_PROTOCOL_INFO,
i2c_get_protocol_info,
EC_VER_MASK(0));
+#endif