From 30193ff3b1c92aad3decb0546ee1b9444acdd17a Mon Sep 17 00:00:00 2001 From: Scott Collyer Date: Wed, 4 Jul 2018 09:15:22 -0700 Subject: DragonEgg: Add power sequencing support This CL enables power sequencing for DragonEgg. BRANCH=none CQ-DEPEND=Iab4423abc9102164d4f43296a279c24355445341 BUG=b:111121615 TEST=make buildall Change-Id: Id8c48a74b7b83153dc253222edc515c2488e7af5 Signed-off-by: Scott Collyer Reviewed-on: https://chromium-review.googlesource.com/1126407 Commit-Ready: Scott Collyer Tested-by: Scott Collyer Reviewed-by: Furquan Shaikh --- board/dragonegg/board.c | 8 +------- board/dragonegg/board.h | 19 +++++++++++++++++-- board/dragonegg/ec.tasklist | 2 ++ board/dragonegg/gpio.inc | 25 +++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 9 deletions(-) (limited to 'board/dragonegg') diff --git a/board/dragonegg/board.c b/board/dragonegg/board.c index 11bbb7b78e..32d8c5da61 100644 --- a/board/dragonegg/board.c +++ b/board/dragonegg/board.c @@ -10,6 +10,7 @@ #include "gpio.h" #include "intc.h" #include "lid_switch.h" +#include "power.h" #include "power_button.h" #include "spi.h" #include "switch.h" @@ -19,13 +20,6 @@ #include "gpio_list.h" /* Must come after other header files. */ -/******************************************************************************/ -/* Wake up pins */ -const enum gpio_signal hibernate_wake_pins[] = { - GPIO_LID_OPEN -}; -const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins); - /******************************************************************************/ /* SPI devices */ /* TODO(b/110880394): Fill out correctly (SPI FLASH) */ diff --git a/board/dragonegg/board.h b/board/dragonegg/board.h index d9b166e1ad..e5cc9b8ee0 100644 --- a/board/dragonegg/board.h +++ b/board/dragonegg/board.h @@ -8,20 +8,35 @@ #ifndef __CROS_EC_BOARD_H #define __CROS_EC_BOARD_H +/* Baseboard features */ +#include "baseboard.h" + /* Optional features */ #define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */ -#define CONFIG_POWER_BUTTON #define CONFIG_KEYBOARD_BOARD_CONFIG #define CONFIG_KEYBOARD_PROTOCOL_8042 #define CONFIG_LOW_POWER_IDLE #define CONFIG_HOSTCMD_ESPI -#define CONFIG_HOSTCMD_ESPI_VW_SLP_SIGNALS #undef CONFIG_UART_TX_BUF_SIZE #define CONFIG_UART_TX_BUF_SIZE 4096 +/* + * Macros for GPIO signals used in common code that don't match the + * schematic names. Signal names in gpio.inc match the schematic and are + * then redefined here to so it's more clear which signal is being used for + * which purpose. + */ +#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L +#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L +#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL +#define GPIO_AC_PRESENT GPIO_ACOK_OD +#define GPIO_RSMRST_L_PGOOD GPIO_PG_EC_RSMRST_ODL +#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L +#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L + #ifndef __ASSEMBLER__ #include "gpio_signal.h" diff --git a/board/dragonegg/ec.tasklist b/board/dragonegg/ec.tasklist index 2075316904..2ab483bd73 100644 --- a/board/dragonegg/ec.tasklist +++ b/board/dragonegg/ec.tasklist @@ -22,7 +22,9 @@ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \ + TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \ + TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \ diff --git a/board/dragonegg/gpio.inc b/board/dragonegg/gpio.inc index 67fdfd799e..28da3bd87e 100644 --- a/board/dragonegg/gpio.inc +++ b/board/dragonegg/gpio.inc @@ -12,11 +12,22 @@ GPIO_INT(LID_OPEN, PIN(F, 3), GPIO_INT_BOTH, lid_interrupt) GPIO_INT(WP_L, PIN(F, 1), GPIO_INT_BOTH, switch_interrupt) /* EC_WP_ODL */ GPIO_INT(POWER_BUTTON_L, PIN(E, 2), GPIO_INT_BOTH, power_button_interrupt) /* MECH_PWR_BTN_ODL */ +GPIO_INT(ACOK_OD, PIN(E, 3), GPIO_INT_BOTH, power_signal_interrupt) #ifdef CONFIG_LOW_POWER_IDLE /* Used to wake up the EC from Deep Doze mode when writing to console */ GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_BOTH, uart_deepsleep_interrupt) /* UART_SERVO_TX_EC_RX */ #endif +/* Power sequencing interrupts */ +GPIO_INT(SLP_S0_L, PIN(E, 4), GPIO_INT_BOTH, power_signal_interrupt) +#ifndef CONFIG_HOSTCMD_ESPI_VW_SIGNALS +GPIO_INT(SLP_S3_L, PIN(I, 4), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(SLP_S4_L, PIN(I, 5), GPIO_INT_BOTH, power_signal_interrupt) +#endif +GPIO_INT(SLP_SUS_L, PIN(G, 2), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(PG_EC_RSMRST_ODL,PIN(E, 1), GPIO_INT_BOTH, power_signal_interrupt) +GPIO_INT(PG_EC_DSW_PWROK, PIN(D, 6), GPIO_INT_BOTH, power_signal_interrupt) + /* Misc. interrupts */ /* TODO (b:110880394) Uncomment this when support for buttons is added */ /* GPIO_INT(VOL_DOWN_ODL, PIN(I, 6), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) */ @@ -33,6 +44,20 @@ GPIO(SYS_RESET_L, PIN(D, 1), GPIO_ODR_HIGH) /* SYS_RST_ODL */ GPIO(PCH_WAKE_L, PIN(D, 5), GPIO_ODR_HIGH) /* EC_PCH_WAKE_ODL */ GPIO(PCH_PWRBTN_L, PIN(B, 6), GPIO_ODR_HIGH) /* EC_PCH_PWR_BTN_ODL */ +/* Power Sequencing Signals */ +/* + * Both PP5000 and PP3300_TCPC should be powered up whenever the EC is not in + * hibernate mode. They are enabled by default here and disabled in the + * board_hibernate() callback when the EC goes into hibernate mode. + */ +GPIO(EN_PP5000, PIN(K, 5), GPIO_OUT_HIGH) +GPIO(EN_PP3300_TCPC, PIN(E, 6), GPIO_OUT_HIGH) +GPIO(EN_PP3300_A, PIN(C, 5), GPIO_OUT_LOW) +GPIO(EC_PCH_DSW_PWROK, PIN(L, 7), GPIO_OUT_LOW) +GPIO(EC_PCH_RSMRST_L, PIN(H, 0), GPIO_OUT_HIGH) +GPIO(EC_PROCHOT_ODL, PIN(D, 0), GPIO_ODR_HIGH) +GPIO(PP5000_PG_OD, PIN(F, 0), GPIO_INPUT) + /* I2C pins - Alternate function below configures I2C module on these pins */ GPIO(I2C0_SCL, PIN(B, 3), GPIO_INPUT) /* EC_PROG_SCL */ GPIO(I2C0_SDA, PIN(B, 4), GPIO_INPUT) /* EC_PROG_SDA */ -- cgit v1.2.1