diff options
author | Pablo Ceballos <pceballos@google.com> | 2022-03-17 18:28:24 -0400 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-04-01 18:01:53 +0000 |
commit | 543cc442c88196c2efd90c77bc89841766bbbb9a (patch) | |
tree | ef1b4d21a1dfa2eedbcdb0abfc4065dba0c82560 | |
parent | 34d717e035fddf51440cf84f9f423a9a59cca486 (diff) | |
download | chrome-ec-543cc442c88196c2efd90c77bc89841766bbbb9a.tar.gz |
moonbuggy: Update GPIOs
Implement the GPIOs that have been changed from genesis.
- Removed several USB A ports
- Added ADB I2C
- Removed USB_C0_TCPC and USB_C0_TCPPC I2C
- Added various misc pins: HDMI_DATA_EN_DB, EN_USB_C0_5V_OUT,
SBU_C0_FAULT_ODL
- Fixed typo in the name of EN_AC_JACK_CHARGER_EC_L
- Only support red and blue LED
BUG=None
TEST=moonbuggy boots
BRANCH=None
Change-Id: I98256236b83ffd21bd989b0aba4eaab6b38cee69
Signed-off-by: Pablo Ceballos <pceballos@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3561031
Tested-by: Pablo Ceballos <pceballos@chromium.org>
Auto-Submit: Pablo Ceballos <pceballos@chromium.org>
Reviewed-by: Joe Tessler <jrt@chromium.org>
Reviewed-by: Rehan Ghori <rehang@chromium.org>
Commit-Queue: Pablo Ceballos <pceballos@chromium.org>
Feels: Pablo Ceballos <pceballos@chromium.org>
-rw-r--r-- | board/moonbuggy/board.c | 32 | ||||
-rw-r--r-- | board/moonbuggy/board.h | 3 | ||||
-rw-r--r-- | board/moonbuggy/gpio.inc | 36 | ||||
-rw-r--r-- | board/moonbuggy/led.c | 12 | ||||
-rw-r--r-- | board/moonbuggy/pse.c | 7 |
5 files changed, 30 insertions, 60 deletions
diff --git a/board/moonbuggy/board.c b/board/moonbuggy/board.c index 9c1b9e213c..b1a5791fd7 100644 --- a/board/moonbuggy/board.c +++ b/board/moonbuggy/board.c @@ -69,14 +69,6 @@ static void update_5v_usage(void) * Recalculate the 5V load, assuming no throttling. */ base_5v_power = PWR_BASE_LOAD; - if (!gpio_get_level(GPIO_USB_A2_OC_ODL)) { - front_ports++; - base_5v_power += PWR_FRONT_LOW; - } - if (!gpio_get_level(GPIO_USB_A3_OC_ODL)) { - front_ports++; - base_5v_power += PWR_FRONT_LOW; - } /* * Only 1 front port can run higher power at a time. */ @@ -88,6 +80,8 @@ static void update_5v_usage(void) base_5v_power += PWR_HDMI; if (!gpio_get_level(GPIO_HDMI_CONN1_OC_ODL)) base_5v_power += PWR_HDMI; + if (!gpio_get_level(GPIO_HDMI_CONN2_OC_ODL)) + base_5v_power += PWR_HDMI; if (usbc_overcurrent) base_5v_power += PWR_C_HIGH; /* @@ -119,7 +113,7 @@ static void ads_5v_deferred(void) int ads_5v_enable = !gpio_get_level(GPIO_ADS_5VS_V2_ADP_PRESENT_L); if (ads_5v_enable) - gpio_set_level(GPIO_EC_AC_JACK_CHARGER_EC_L, 1); + gpio_set_level(GPIO_EN_AC_JACK_CHARGER_EC_L, 1); } DECLARE_DEFERRED(ads_5v_deferred); @@ -137,7 +131,7 @@ static void ads_12v_deferred(void) int ads_12v_enable = !gpio_get_level(GPIO_BJ_ADP_PRESENT_L); if (ads_12v_enable) - gpio_set_level(GPIO_EC_AC_JACK_CHARGER_EC_L, 0); + gpio_set_level(GPIO_EN_AC_JACK_CHARGER_EC_L, 0); } DECLARE_DEFERRED(ads_12v_deferred); @@ -184,13 +178,6 @@ const struct i2c_port_t i2c_ports[] = { .sda = GPIO_I2C0_SDA }, { - .name = "ppc0", - .port = I2C_PORT_PPC0, - .kbps = 400, - .scl = GPIO_I2C1_SCL, - .sda = GPIO_I2C1_SDA - }, - { .name = "tcpc0", .port = I2C_PORT_TCPC0, .kbps = 400, @@ -401,7 +388,6 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT); /******************************************************************************/ /* USB-A port control */ const int usb_port_enable[USB_PORT_COUNT] = { - GPIO_EN_PP5000_USB_VBUS, }; int64_t get_time_dsw_pwrok(void) @@ -534,10 +520,7 @@ static void power_monitor(void) * [2] If type A not already throttled, and power still * needed, limit type A. */ - if (!(new_state & THROT_TYPE_A) && headroom_5v < 0) { - headroom_5v += PWR_FRONT_HIGH - PWR_FRONT_LOW; - new_state |= THROT_TYPE_A; - } + /* No front USB A ports on moonbuggy. */ /* * [3] If still under-budget, limit type C. * No need to check if it is already throttled or not. @@ -555,10 +538,5 @@ static void power_monitor(void) gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot); } - if (diff & THROT_TYPE_A) { - int typea_bc = (new_state & THROT_TYPE_A) ? 1 : 0; - - gpio_set_level(GPIO_USB_A3_LOW_PWR_OD, typea_bc); - } hook_call_deferred(&power_monitor_data, delay); } diff --git a/board/moonbuggy/board.h b/board/moonbuggy/board.h index eaf1b61240..d48cc76f72 100644 --- a/board/moonbuggy/board.h +++ b/board/moonbuggy/board.h @@ -114,13 +114,12 @@ /* USB Type A Features */ #define CONFIG_USB_PORT_POWER_DUMB /* There are five ports, but power enable is ganged across all of them. */ -#define USB_PORT_COUNT 1 +#define USB_PORT_COUNT 0 /* I2C Bus Configuration */ #define CONFIG_I2C #define CONFIG_I2C_CONTROLLER #define I2C_PORT_INA NPCX_I2C_PORT0_0 -#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0 #define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0 #define I2C_PORT_PSE NPCX_I2C_PORT4_1 #define I2C_PORT_POWER NPCX_I2C_PORT5_0 diff --git a/board/moonbuggy/gpio.inc b/board/moonbuggy/gpio.inc index b7b14efd8b..b2d25440a6 100644 --- a/board/moonbuggy/gpio.inc +++ b/board/moonbuggy/gpio.inc @@ -51,9 +51,8 @@ ads_12v_interrupt) /* Port power control interrupts */ GPIO_INT(HDMI_CONN0_OC_ODL, PIN(0, 7), GPIO_INT_BOTH, port_ocp_interrupt) GPIO_INT(HDMI_CONN1_OC_ODL, PIN(0, 6), GPIO_INT_BOTH, port_ocp_interrupt) +GPIO_INT(HDMI_CONN2_OC_ODL, PIN(8, 3), GPIO_INT_BOTH, port_ocp_interrupt) GPIO_INT(USB_A1_OC_ODL, PIN(A, 2), GPIO_INT_BOTH, port_ocp_interrupt) -GPIO_INT(USB_A2_OC_ODL, PIN(F, 5), GPIO_INT_BOTH, port_ocp_interrupt) -GPIO_INT(USB_A3_OC_ODL, PIN(C, 2), GPIO_INT_BOTH, port_ocp_interrupt) /* PCH/CPU signals */ GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW) @@ -65,6 +64,9 @@ GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT) GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH) GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH) +/* ADB Scaler signals */ +GPIO(ADB_WAKEUP_EC, PIN(B, 1), GPIO_INPUT) + /* Power control outputs */ GPIO(EN_PP5000_A, PIN(A, 4), GPIO_OUT_LOW) GPIO(EN_PP3300_INA_H1_EC_ODL, PIN(5, 7), GPIO_ODR_HIGH) @@ -80,16 +82,12 @@ GPIO(EN_IMVP8_VR, PIN(F, 4), GPIO_OUT_LOW) GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 4), GPIO_OUT_LOW) /* USB type A */ -GPIO(EN_PP5000_USB_VBUS, PIN(8, 3), GPIO_OUT_LOW) GPIO(USB_A_LOW_PWR_OD, PIN(9, 4), GPIO_ODR_LOW) -GPIO(USB_A3_LOW_PWR_OD, PIN(5, 0), GPIO_ODR_LOW) -GPIO(USB_A1_STATUS_L, PIN(6, 1), GPIO_INPUT) -GPIO(USB_A2_STATUS_L, PIN(C, 7), GPIO_INPUT) -GPIO(USB_A3_STATUS_L, PIN(D, 2), GPIO_INPUT) /* USB type C */ -GPIO(USB_C0_TCPC_RST, PIN(9, 7), GPIO_OUT_LOW) GPIO(USB_C0_POL_L, PIN(0, 0), GPIO_INPUT | GPIO_SEL_1P8V) /* USB-C Polarity */ +UNUSED(PIN(7, 2)) /* EN_USB_C0_5V_OUT only works if set unused */ +GPIO(SBU_C0_FAULT_ODL, PIN(5, 6), GPIO_INPUT) /* TPU */ GPIO(PP3300_TPU_EN, PIN(E, 4), GPIO_OUT_HIGH) @@ -105,22 +103,20 @@ GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_ODR_HIGH) GPIO(PACKET_MODE_EN, PIN(7, 5), GPIO_OUT_LOW) GPIO_INT(ADS_5VS_V2_ADP_PRESENT_L, PIN(0, 3), GPIO_INT_FALLING | GPIO_PULL_UP, ads_5v_interrupt) -GPIO(EC_AC_JACK_CHARGER_EC_L, PIN(C, 0), GPIO_OUT_LOW) +GPIO(EN_AC_JACK_CHARGER_EC_L, PIN(C, 0), GPIO_OUT_LOW) GPIO(LAN_WAKE_ODL_EC, PIN(8, 0), GPIO_INPUT) /* LAN_WAKE */ /* HDMI/CEC */ -GPIO(HDMI_CONN0_CEC_OUT, PIN(B, 1), GPIO_ODR_HIGH) GPIO(HDMI_CONN0_CEC_IN, PIN(4, 0), GPIO_INPUT) GPIO(HDMI_CONN1_CEC_OUT, PIN(9, 5), GPIO_ODR_HIGH) GPIO(HDMI_CONN1_CEC_IN, PIN(D, 3), GPIO_INPUT) +GPIO(HDMI_DATA_EN_DB, PIN(6, 1), GPIO_OUT_HIGH) /* I2C pins - Alternate function below configures I2C module on these pins */ GPIO(I2C0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C_INA_SCL */ GPIO(I2C0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_I2C_INA_SDA */ -GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C_USB_C0_TCPPC_SCL */ -GPIO(I2C1_SDA, PIN(8, 7), GPIO_INPUT) /* EC_I2C_USB_C0_TCPPC_SDA */ -GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT) /* EC_I2C_USB_C0_TCPC_SCL */ -GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_I2C_USB_C0_TCPC_SDA */ +GPIO(I2C3_SCL, PIN(D, 1), GPIO_INPUT) /* EC_I2C_ADB_SCL */ +GPIO(I2C3_SDA, PIN(D, 0), GPIO_INPUT) /* EC_I2C_ADB_SDA */ GPIO(I2C4_SCL, PIN(F, 3), GPIO_INPUT) /* EC_I2C_LTC_SCL */ GPIO(I2C4_SDA, PIN(F, 2), GPIO_INPUT) /* EC_I2C_LTC_SDA */ GPIO(I2C5_SCL, PIN(3, 3), GPIO_INPUT) /* EC_I2C_IMVP8_SCL */ @@ -166,7 +162,15 @@ UNUSED(PIN(8, 5)) /* L7 NC */ UNUSED(PIN(3, 2)) /* E5 NC */ UNUSED(PIN(D, 6)) /* F6 NC */ UNUSED(PIN(3, 5)) /* F5 NC */ -UNUSED(PIN(5, 6)) /* M2 NC */ UNUSED(PIN(8, 6)) /* J8 NC */ UNUSED(PIN(9, 3)) /* M11 NC */ -UNUSED(PIN(7, 2)) /* H6 NC */ +UNUSED(PIN(C, 7)) /* B9 NC */ +UNUSED(PIN(D, 2)) /* C11 NC */ +UNUSED(PIN(F, 5)) /* E7 NC */ +UNUSED(PIN(5, 0)) /* G4 NC */ +UNUSED(PIN(9, 0)) /* J10 NC */ +UNUSED(PIN(8, 7)) /* M7 NC */ +UNUSED(PIN(6, 2)) /* J2 NC */ +UNUSED(PIN(9, 7)) /* J9 NC */ +UNUSED(PIN(0, 2)) /* D10 NC */ +UNUSED(PIN(C, 2)) /* A12 NC */ diff --git a/board/moonbuggy/led.c b/board/moonbuggy/led.c index fc485887f0..ecdb24b090 100644 --- a/board/moonbuggy/led.c +++ b/board/moonbuggy/led.c @@ -35,7 +35,6 @@ enum led_color { LED_OFF = 0, LED_RED, LED_BLUE, - LED_AMBER, /* Number of colors, not a color itself */ LED_COLOR_COUNT @@ -58,10 +57,6 @@ static int set_color_power(enum led_color color, int duty) case LED_RED: red = 1; break; - case LED_AMBER: - red = 1; - blue = 1; - break; default: return EC_ERROR_UNKNOWN; } @@ -239,8 +234,6 @@ static int command_led(int argc, char **argv) set_color(id, LED_RED, 100); } else if (!strcasecmp(argv[1], "blue")) { set_color(id, LED_BLUE, 100); - } else if (!strcasecmp(argv[1], "amber")) { - set_color(id, LED_AMBER, 100); } else if (!strcasecmp(argv[1], "alert")) { led_alert(1); } else if (!strcasecmp(argv[1], "crit")) { @@ -251,14 +244,13 @@ static int command_led(int argc, char **argv) return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(led, command_led, - "[debug|red|blue|amber|off|alert|crit]", + "[debug|red|blue|off|alert|crit]", "Turn on/off LED."); void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range) { brightness_range[EC_LED_COLOR_RED] = 100; brightness_range[EC_LED_COLOR_BLUE] = 100; - brightness_range[EC_LED_COLOR_AMBER] = 100; } int led_set_brightness(enum ec_led_id id, const uint8_t *brightness) @@ -267,8 +259,6 @@ int led_set_brightness(enum ec_led_id id, const uint8_t *brightness) return set_color(id, LED_RED, brightness[EC_LED_COLOR_RED]); else if (brightness[EC_LED_COLOR_BLUE]) return set_color(id, LED_BLUE, brightness[EC_LED_COLOR_BLUE]); - else if (brightness[EC_LED_COLOR_AMBER]) - return set_color(id, LED_AMBER, brightness[EC_LED_COLOR_AMBER]); else return set_color(id, LED_OFF, 0); } diff --git a/board/moonbuggy/pse.c b/board/moonbuggy/pse.c index 1c1b6bb41b..84d5048a86 100644 --- a/board/moonbuggy/pse.c +++ b/board/moonbuggy/pse.c @@ -82,11 +82,10 @@ static int pse_write_hpmd(int port, int val) } /* - * Port 1: 100W - * Port 2-4: 15W + * Port 1-4: 15W */ -static int pse_port_hpmd[4] = { - LTC4291_HPMD_MAX, +static int pse_port_hpmd[LTC4291_PORT_MAX] = { + LTC4291_HPMD_MIN, LTC4291_HPMD_MIN, LTC4291_HPMD_MIN, LTC4291_HPMD_MIN, |