mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-09 00:51:29 +00:00
i2c: Add variable to set slave address of the EC.
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
3bb7de950f
commit
4eee9fe426
@@ -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 */
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user