diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-03-19 22:10:03 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-04-13 18:45:37 -0700 |
commit | 36ce967fce6d53c12b86a278d545cc41c1145ee4 (patch) | |
tree | 05ac74da4650a30f044cd19e362e488c0d718520 /board | |
parent | 7824f5656d88f5d227cd1f4e06056ef40c606708 (diff) | |
download | chrome-ec-36ce967fce6d53c12b86a278d545cc41c1145ee4.tar.gz |
Nami: Enable Analogix USB-C port
Auto-toggling is currently disabled due to b/77544959.
BUG=b:73793947
CQ-DEPEND=CL:988414
BRANCH=none
TEST=Boot Nami. Verify PD power is negotiated and bettery is charged
with a Zinger through the Analogix port.
Change-Id: Ie817883027eb8623a8115aa8194fe4df50c3ce72
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/969989
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/nami/board.c | 30 | ||||
-rw-r--r-- | board/nami/board.h | 8 | ||||
-rw-r--r-- | board/nami/ec.tasklist | 3 | ||||
-rw-r--r-- | board/nami/gpio.inc | 2 | ||||
-rw-r--r-- | board/nami/usb_pd_policy.c | 5 |
5 files changed, 25 insertions, 23 deletions
diff --git a/board/nami/board.c b/board/nami/board.c index 120473e24b..e48b68dc79 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -7,6 +7,7 @@ #include "adc.h" #include "adc_chip.h" +#include "anx7447.h" #include "board_config.h" #include "button.h" #include "charge_manager.h" @@ -61,6 +62,9 @@ #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) #define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +#define USB_PD_PORT_PS8751 0 +#define USB_PD_PORT_ANX7447 1 + static void tcpc_alert_event(enum gpio_signal signal) { if ((signal == GPIO_USB_C0_PD_INT_ODL) && @@ -80,7 +84,7 @@ static void tcpc_alert_event(enum gpio_signal signal) static void vbus_discharge_handler(void) { pd_set_vbus_discharge(0, gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L)); - //pd_set_vbus_discharge(1, gpio_get_level(GPIO_USB_C1_VBUS_WAKE_L)); + pd_set_vbus_discharge(1, gpio_get_level(GPIO_USB_C1_VBUS_WAKE_L)); } DECLARE_DEFERRED(vbus_discharge_handler); @@ -92,7 +96,6 @@ void vbus0_evt(enum gpio_signal signal) hook_call_deferred(&vbus_discharge_handler_data, 0); } -#if 0 void vbus1_evt(enum gpio_signal signal) { /* VBUS present GPIO is inverted */ @@ -100,7 +103,6 @@ void vbus1_evt(enum gpio_signal signal) task_wake(TASK_ID_PD_C1); hook_call_deferred(&vbus_discharge_handler_data, 0); } -#endif void usb0_evt(enum gpio_signal signal) { @@ -183,35 +185,31 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* TCPC mux configuration */ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_COUNT] = { - { + [USB_PD_PORT_PS8751] = { .i2c_host_port = NPCX_I2C_PORT0_0, .i2c_slave_addr = PS8751_I2C_ADDR1, .drv = &ps8xxx_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, - /* - { + [USB_PD_PORT_ANX7447] = { .i2c_host_port = NPCX_I2C_PORT0_1, - .i2c_slave_addr = PS8751_I2C_ADDR1, - .drv = &ps8xxx_tcpm_drv, + .i2c_slave_addr = AN7447_TCPC3_I2C_ADDR, /* Verified on v1.1 */ + .drv = &anx7447_tcpm_drv, .pol = TCPC_ALERT_ACTIVE_LOW, }, - */ }; struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_COUNT] = { { - .port_addr = 0, + .port_addr = USB_PD_PORT_PS8751, .driver = &tcpci_tcpm_usb_mux_driver, .hpd_update = &ps8xxx_tcpc_update_hpd_status, }, - /* { - .port_addr = 1, - .driver = &tcpci_tcpm_usb_mux_driver, - .hpd_update = &ps8xxx_tcpc_update_hpd_status, + .port_addr = USB_PD_PORT_ANX7447, + .driver = &anx7447_usb_mux_driver, + .hpd_update = &anx7447_tcpc_update_hpd_status, } - */ }; struct pi3usb9281_config pi3usb9281_chips[] = { @@ -715,7 +713,7 @@ static void board_init(void) /* Enable VBUS interrupt */ gpio_enable_interrupt(GPIO_USB_C0_VBUS_WAKE_L); - //gpio_enable_interrupt(GPIO_USB_C1_VBUS_WAKE_L); + gpio_enable_interrupt(GPIO_USB_C1_VBUS_WAKE_L); /* Enable pericom BC1.2 interrupts */ gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L); diff --git a/board/nami/board.h b/board/nami/board.h index 7be262d8ae..ced81cb1d3 100644 --- a/board/nami/board.h +++ b/board/nami/board.h @@ -146,14 +146,16 @@ #define CONFIG_USB_PD_ALT_MODE_DFP #define CONFIG_USB_PD_DISCHARGE_TCPC #define CONFIG_USB_PD_DUAL_ROLE -#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE +#undef CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_MAX_SINGLE_SOURCE_CURRENT TYPEC_RP_3A0 -#define CONFIG_USB_PD_PORT_COUNT 1 +#define CONFIG_USB_PD_PORT_COUNT 2 #define CONFIG_USB_PD_VBUS_DETECT_GPIO -#define CONFIG_USB_PD_TCPC_LOW_POWER +#undef CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX #define CONFIG_USB_PD_TCPM_TCPCI +#define CONFIG_USB_PD_TCPM_ANX7447 +#define CONFIG_USB_PD_TCPM_ANX7447_OCM_ERASE #define CONFIG_USB_PD_TCPM_PS8751 #define CONFIG_USB_PD_TRY_SRC #define CONFIG_USB_POWER_DELIVERY diff --git a/board/nami/ec.tasklist b/board/nami/ec.tasklist index 6c466babbf..0ef0783898 100644 --- a/board/nami/ec.tasklist +++ b/board/nami/ec.tasklist @@ -33,4 +33,5 @@ TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) + TASK_ALWAYS(PD_C0, pd_task, NULL, LARGER_TASK_STACK_SIZE) \ + TASK_ALWAYS(PD_C1, pd_task, NULL, LARGER_TASK_STACK_SIZE) diff --git a/board/nami/gpio.inc b/board/nami/gpio.inc index 1a46e7b645..2f4c812070 100644 --- a/board/nami/gpio.inc +++ b/board/nami/gpio.inc @@ -30,7 +30,7 @@ GPIO_INT(VOLUME_UP_L, PIN(8, 6), GPIO_INT_BOTH | GPIO_PULL_UP,button_interrupt) GPIO_INT(WP_L, PIN(9, 3), GPIO_INT_BOTH, switch_interrupt) GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt) GPIO_INT(USB_C0_VBUS_WAKE_L, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP,vbus0_evt) -/* GPIO_INT(USB_C1_VBUS_WAKE_L, PIN(C, 5), GPIO_INT_BOTH | GPIO_PULL_UP,vbus1_evt) */ +GPIO_INT(USB_C1_VBUS_WAKE_L, PIN(C, 5), GPIO_INT_BOTH | GPIO_PULL_UP,vbus1_evt) GPIO_INT(USB_C0_BC12_INT_L, PIN(D, 2), GPIO_INT_FALLING, usb0_evt) GPIO_INT(USB_C1_BC12_INT_L, PIN(D, 3), GPIO_INT_FALLING, usb1_evt) GPIO_INT(ACCELGYRO3_INT_L, PIN(3, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt) diff --git a/board/nami/usb_pd_policy.c b/board/nami/usb_pd_policy.c index e46a520d17..acf63f0e97 100644 --- a/board/nami/usb_pd_policy.c +++ b/board/nami/usb_pd_policy.c @@ -55,7 +55,7 @@ void pd_transition_voltage(int idx) } static uint8_t vbus_en[CONFIG_USB_PD_PORT_COUNT]; -static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, /*TYPEC_RP_1A5*/}; +static uint8_t vbus_rp[CONFIG_USB_PD_PORT_COUNT] = {TYPEC_RP_1A5, TYPEC_RP_1A5}; int board_vbus_source_enabled(int port) { @@ -122,7 +122,8 @@ void pd_power_supply_reset(int port) int pd_snk_is_vbus_provided(int port) { - return !gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L); + return !gpio_get_level(port ? GPIO_USB_C1_VBUS_WAKE_L : + GPIO_USB_C0_VBUS_WAKE_L); } int pd_board_checks(void) |