diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2019-05-31 16:45:32 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2019-06-10 21:20:17 -0700 |
commit | 3a668749460466ff002b5dd2cbf00529f97e5974 (patch) | |
tree | 4f62d4856086362ebc646215c0d4ac31cdaf8b08 /common/peripheral.c | |
parent | c89e3557f808c504d8feece4d28a96450089b05f (diff) | |
download | chrome-ec-3a668749460466ff002b5dd2cbf00529f97e5974.tar.gz |
TCPC: Make tcpc_config handle other bus types
Currently, tcpc_config assumes TCPCs are on I2C bus. ITE's EC has an
embedded TCPC.
This patch adds bus_type field to struct tcpc_config_t so that a TCPC
location on other type of bus can be specified.
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
BUG=none
BRANCH=none
TEST=buildall
Change-Id: Ieac733011700b351e6323f46070dcf46d9e1154b
Reviewed-on: https://chromium-review.googlesource.com/1640305
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common/peripheral.c')
-rw-r--r-- | common/peripheral.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/common/peripheral.c b/common/peripheral.c index 103a32206e..4f16cd981d 100644 --- a/common/peripheral.c +++ b/common/peripheral.c @@ -33,10 +33,13 @@ static int hc_locate_chip(struct host_cmd_handler_args *args) #if defined(CONFIG_USB_PD_PORT_COUNT) && !defined(CONFIG_USB_PD_TCPC) if (params->index >= CONFIG_USB_PD_PORT_COUNT) return EC_RES_OVERFLOW; - resp->bus_type = EC_BUS_TYPE_I2C; - resp->i2c_info.port = tcpc_config[params->index].i2c_host_port; - resp->i2c_info.addr = - tcpc_config[params->index].i2c_slave_addr >> 1; + resp->bus_type = tcpc_config[params->index].bus_type; + if (resp->bus_type == EC_BUS_TYPE_I2C) { + resp->i2c_info.port = + tcpc_config[params->index].i2c_info.port; + resp->i2c_info.addr = + tcpc_config[params->index].i2c_info.addr >> 1; + } #else return EC_RES_UNAVAILABLE; #endif /* CONFIG_USB_PD_PORT_COUNT */ |