From 9b0b66a699ff0a6af1d0c8b10b3551fc37b9c588 Mon Sep 17 00:00:00 2001 From: Ben Chen Date: Fri, 7 Aug 2020 16:31:50 +0800 Subject: magolor: support USB-A config USB-A pin define, and enable USB SMART function BUG=b:155944657 BRANCH=none TEST=make buildall pass, Change-Id: Icefa622bb575236ad24e33fe00ce4fb26dd4d2e7 Signed-off-by: Ben Chen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2342944 Reviewed-by: Diana Z --- board/magolor/board.c | 7 +++++++ board/magolor/board.h | 11 +++++++++++ board/magolor/gpio.inc | 8 ++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) (limited to 'board') diff --git a/board/magolor/board.c b/board/magolor/board.c index 56daee0d46..300e3bf427 100644 --- a/board/magolor/board.c +++ b/board/magolor/board.c @@ -43,6 +43,13 @@ #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) #define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +/******************************************************************************/ +/* USB-A Configuration */ +const int usb_port_enable[USB_PORT_COUNT] = { + GPIO_EN_USB_A0_VBUS, + GPIO_EN_USB_A1_VBUS, +}; + static void tcpc_alert_event(enum gpio_signal s) { int port = (s == GPIO_USB_C0_INT_ODL) ? 0 : 1; diff --git a/board/magolor/board.h b/board/magolor/board.h index 1cc008efe9..138489239d 100644 --- a/board/magolor/board.h +++ b/board/magolor/board.h @@ -49,6 +49,17 @@ #define CONFIG_BC12_DETECT_PI3USB9201 #define CONFIG_USBC_RETIMER_NB7V904M +/* Common USB-A defines */ +#define USB_PORT_COUNT 2 +#define CONFIG_USB_PORT_POWER_SMART +#define CONFIG_USB_PORT_POWER_SMART_CDP_SDP_ONLY +#define CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE USB_CHARGE_MODE_CDP +#define CONFIG_USB_PORT_POWER_SMART_INVERTED +#define GPIO_USB1_ILIM_SEL GPIO_USB_A0_CHARGE_EN_L +#define GPIO_USB2_ILIM_SEL GPIO_USB_A1_CHARGE_EN_L + +/*******************************************************************************/ + /* USB PD */ #define CONFIG_USB_PD_PORT_MAX_COUNT 2 #define CONFIG_USB_PD_TCPM_RAA489000 diff --git a/board/magolor/gpio.inc b/board/magolor/gpio.inc index 2358addc21..452d40789d 100644 --- a/board/magolor/gpio.inc +++ b/board/magolor/gpio.inc @@ -53,7 +53,7 @@ GPIO(EC_I2C_SUB_USB_C1_SCL, PIN(9, 2), GPIO_INPUT) GPIO(EC_I2C_SUB_USB_C1_SDA, PIN(9, 1), GPIO_INPUT) /* Extra Sub-board I/O pins */ -GPIO(EC_SUB_IO_1, PIN(3, 7), GPIO_OUT_LOW) + GPIO(EC_SUB_IO_2, PIN(3, 4), GPIO_OUT_LOW) /* Misc Enables */ @@ -86,12 +86,16 @@ GPIO(ALL_SYS_PWRGD, PIN(A, 0), GPIO_OUT_LOW) GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH) GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT) +/* USB pins */ GPIO(USB_C0_RST_ODL, PIN(9, 7), GPIO_OUT_HIGH) /* currently unused */ GPIO(EC_AP_USB_C1_HDMI_HPD, PIN(9, 6), GPIO_OUT_LOW) GPIO(EC_AP_USB_C0_HPD, PIN(9, 3), GPIO_OUT_LOW) GPIO(HDMI_SEL_L, PIN(7, 2), GPIO_OUT_HIGH) GPIO(EC_BATTERY_PRES_ODL, PIN(E, 1), GPIO_INPUT) - +GPIO(USB_A0_CHARGE_EN_L, PIN(3, 7), GPIO_OUT_HIGH) /* Enable A0 1.5A Charging */ +GPIO(USB_A1_CHARGE_EN_L, PIN(F, 3), GPIO_OUT_HIGH) /* Enable A1 1.5A Charging */ +GPIO(EN_USB_A0_VBUS, PIN(4, 1), GPIO_OUT_LOW) /* Enable A1 5V Charging */ +GPIO(EN_USB_A1_VBUS, PIN(F, 2), GPIO_OUT_LOW) /* Enable A1 5V Charging */ /* * Waddledoo doesn't have these physical pins coming to the EC but uses other * logic. -- cgit v1.2.1