hammer: Enable I2C passthrough

This interface will be used to update the trackpad firmware.

BRANCH=none
BUG=b:35587174
TEST=make BOARD=hammer -j; flash hammer; lsusb -v -v shows I2C interface

Change-Id: Ia4533c758f80eb786bd6dbb9f35feb66eb631793
Reviewed-on: https://chromium-review.googlesource.com/474667
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Chun-ta Lin <itspeter@chromium.org>
This commit is contained in:
Nicolas Boichat
2016-11-07 08:25:45 +08:00
committed by chrome-bot
parent 0e5497db69
commit 26c325d15e
2 changed files with 14 additions and 4 deletions

View File

@@ -20,6 +20,7 @@
#include "usart_tx_dma.h"
#include "usart_rx_dma.h"
#include "usb_descriptor.h"
#include "usb_i2c.h"
#include "util.h"
#include "gpio_list.h"
@@ -33,13 +34,15 @@ const void *const usb_strings[] = {
[USB_STR_PRODUCT] = USB_STRING_DESC("Hammer"),
[USB_STR_SERIALNO] = 0,
[USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
[USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
[USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
/******************************************************************************
* Support I2C master port for trackpad.
* Support I2C bridging over USB, this requires usb_i2c_board_enable and
* usb_i2c_board_disable to be defined to enable and disable the I2C bridge.
*/
/* I2C ports */
@@ -55,6 +58,9 @@ const struct pwm_t pwm_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
int usb_i2c_board_enable(void) { return EC_SUCCESS; }
void usb_i2c_board_disable(void) {}
/******************************************************************************
* Support firmware upgrade over USB. We can update whichever section is not
* the current section.

View File

@@ -101,14 +101,16 @@
#define USB_IFACE_UPDATE 0
#define USB_IFACE_HID_KEYBOARD 1
#define USB_IFACE_HID_TOUCHPAD 2
#define USB_IFACE_COUNT 3
#define USB_IFACE_I2C 3
#define USB_IFACE_COUNT 4
/* USB endpoint indexes (use define rather than enum to expand them) */
#define USB_EP_CONTROL 0
#define USB_EP_UPDATE 1
#define USB_EP_HID_KEYBOARD 2
#define USB_EP_HID_TOUCHPAD 3
#define USB_EP_COUNT 4
#define USB_EP_I2C 4
#define USB_EP_COUNT 5
/* Optional features */
#define CONFIG_BOARD_PRE_INIT
@@ -121,7 +123,8 @@
#define CONFIG_KEYBOARD_DEBUG
#define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C, GPIO_F
/* Enable I2C */
/* Enable control of I2C over USB */
#define CONFIG_USB_I2C
#define CONFIG_I2C
#define CONFIG_I2C_MASTER
#define I2C_PORT_MASTER 0
@@ -164,6 +167,7 @@ enum usb_strings {
USB_STR_PRODUCT,
USB_STR_SERIALNO,
USB_STR_VERSION,
USB_STR_I2C_NAME,
USB_STR_UPDATE_NAME,
USB_STR_COUNT
};