diff options
-rw-r--r-- | board/servo_micro/board.c | 4 | ||||
-rw-r--r-- | board/servo_micro/board.h | 1 | ||||
-rw-r--r-- | board/servo_v4/board.c | 5 | ||||
-rw-r--r-- | board/servo_v4/board.h | 1 | ||||
-rw-r--r-- | chip/g/build.mk | 1 | ||||
-rw-r--r-- | chip/stm32/build.mk | 1 | ||||
-rw-r--r-- | common/build.mk | 3 | ||||
-rw-r--r-- | common/usb_i2c.c (renamed from chip/g/usb_i2c.c) | 3 | ||||
-rw-r--r-- | include/usb_i2c.h (renamed from chip/g/usb_i2c.h) | 1 |
9 files changed, 13 insertions, 7 deletions
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c index 0b74826352..853de87746 100644 --- a/board/servo_micro/board.c +++ b/board/servo_micro/board.c @@ -130,6 +130,7 @@ const void *const usb_strings[] = { [USB_STR_PRODUCT] = USB_STRING_DESC("Servo Micro"), [USB_STR_SERIALNO] = 0, [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32), + [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"), [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("Servo UART3"), [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Servo EC Shell"), [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("Servo UART2"), @@ -198,7 +199,8 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -USB_I2C_CONFIG(usb_i2c, USB_IFACE_I2C, USB_EP_I2C); +int usb_i2c_board_enable(void) {return EC_SUCCESS; } +void usb_i2c_board_disable(int debounce) {} /****************************************************************************** diff --git a/board/servo_micro/board.h b/board/servo_micro/board.h index b2543c3ac3..2a11e7707c 100644 --- a/board/servo_micro/board.h +++ b/board/servo_micro/board.h @@ -100,6 +100,7 @@ enum usb_strings { USB_STR_PRODUCT, USB_STR_SERIALNO, USB_STR_VERSION, + USB_STR_I2C_NAME, USB_STR_USART4_STREAM_NAME, USB_STR_CONSOLE_NAME, USB_STR_USART3_STREAM_NAME, diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c index 6b742d3ebd..eb884b4822 100644 --- a/board/servo_v4/board.c +++ b/board/servo_v4/board.c @@ -180,6 +180,7 @@ const void *const usb_strings[] = { [USB_STR_PRODUCT] = USB_STRING_DESC("Servo V4"), [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"), [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32), + [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"), [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Servo EC Shell"), [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("DUT UART"), [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("Atmega UART"), @@ -202,8 +203,8 @@ const struct i2c_port_t i2c_ports[] = { }; const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); -USB_I2C_CONFIG(usb_i2c, USB_IFACE_I2C, USB_EP_I2C); - +int usb_i2c_board_enable(void) {return EC_SUCCESS; } +void usb_i2c_board_disable(int debounce) {} /****************************************************************************** diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h index eaad6385b2..24cff51544 100644 --- a/board/servo_v4/board.h +++ b/board/servo_v4/board.h @@ -93,6 +93,7 @@ enum usb_strings { USB_STR_PRODUCT, USB_STR_SERIALNO, USB_STR_VERSION, + USB_STR_I2C_NAME, USB_STR_CONSOLE_NAME, USB_STR_USART3_STREAM_NAME, USB_STR_USART4_STREAM_NAME, diff --git a/chip/g/build.mk b/chip/g/build.mk index c6325f4884..df028da65b 100644 --- a/chip/g/build.mk +++ b/chip/g/build.mk @@ -56,7 +56,6 @@ chip-$(CONFIG_WATCHDOG)+=watchdog.o chip-$(CONFIG_USB)+=usb.o usb_endpoints.o chip-$(CONFIG_USB_CONSOLE)+=usb_console.o chip-$(CONFIG_USB_HID)+=usb_hid.o -chip-$(CONFIG_USB_I2C)+=usb_i2c.o chip-$(CONFIG_USB_BLOB)+=blob.o chip-$(CONFIG_USB_SPI)+=usb_spi.o chip-$(CONFIG_RDD)+=rdd.o diff --git a/chip/stm32/build.mk b/chip/stm32/build.mk index 52749e1d16..8575463c7a 100644 --- a/chip/stm32/build.mk +++ b/chip/stm32/build.mk @@ -70,5 +70,4 @@ chip-$(CONFIG_USB_GPIO)+=usb_gpio.o chip-$(CONFIG_USB_HID)+=usb_hid.o chip-$(CONFIG_USB_PD_TCPC)+=usb_pd_phy.o chip-$(CONFIG_USB_SPI)+=usb_spi.o -chip-$(CONFIG_USB_I2C)+=usb_i2c.o endif diff --git a/common/build.mk b/common/build.mk index 44e3e1c33d..a97e789ddd 100644 --- a/common/build.mk +++ b/common/build.mk @@ -87,13 +87,14 @@ common-$(CONFIG_SW_CRC)+=crc.o common-$(CONFIG_TEMP_SENSOR)+=temp_sensor.o common-$(CONFIG_THROTTLE_AP)+=thermal.o throttle_ap.o common-$(CONFIG_TPM_I2CS)+=i2cs_tpm.o +common-$(CONFIG_USB_I2C)+=usb_i2c.o common-$(CONFIG_USB_CHARGER)+=usb_charger.o common-$(CONFIG_USB_PORT_POWER_DUMB)+=usb_port_power_dumb.o common-$(CONFIG_USB_PORT_POWER_SMART)+=usb_port_power_smart.o common-$(CONFIG_USB_POWER_DELIVERY)+=usb_pd_protocol.o usb_pd_policy.o common-$(CONFIG_USB_PD_LOGGING)+=pd_log.o common-$(CONFIG_USB_PD_TCPC)+=usb_pd_tcpc.o -common-$(CONFIG_USB_UPDATE)+= usb_update.o update_fw.o +common-$(CONFIG_USB_UPDATE)+=usb_update.o update_fw.o common-$(CONFIG_VBOOT_HASH)+=sha256.o vboot_hash.o common-$(CONFIG_VSTORE)+=vstore.o common-$(CONFIG_WIRELESS)+=wireless.o diff --git a/chip/g/usb_i2c.c b/common/usb_i2c.c index b3094d716b..1795a26498 100644 --- a/chip/g/usb_i2c.c +++ b/common/usb_i2c.c @@ -58,7 +58,8 @@ void usb_i2c_deferred(struct usb_i2c_config const *config) */ uint8_t count = usb_i2c_read_packet(config); int portindex = (config->buffer[0] >> 0) & 0xff; - uint8_t slave_addr = (config->buffer[0] >> 8) & 0xff; + /* Convert 7-bit slave address to chromium EC 8-bit address. */ + uint8_t slave_addr = (config->buffer[0] >> 7) & 0xfe; int write_count = (config->buffer[1] >> 0) & 0xff; int read_count = (config->buffer[1] >> 8) & 0xff; int port; diff --git a/chip/g/usb_i2c.h b/include/usb_i2c.h index 401b20a0c5..163cdfb98a 100644 --- a/chip/g/usb_i2c.h +++ b/include/usb_i2c.h @@ -8,6 +8,7 @@ #include "registers.h" #include "task.h" #include "usb_descriptor.h" +#include "util.h" #ifndef __CROS_USB_I2C_H #define __CROS_USB_I2C_H |