diff options
author | Andrew McRae <amcrae@google.com> | 2019-11-05 21:23:54 +1100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2019-11-07 02:52:48 +0000 |
commit | 8b17cc42def4f3af7bf1fb799b0f68c287246d82 (patch) | |
tree | 45e3dcbc3192a5637d4fba2401355e54141a154d | |
parent | 85609a92c8fb6de177ff5a15f64f1f8b46e9f8cc (diff) | |
download | chrome-ec-8b17cc42def4f3af7bf1fb799b0f68c287246d82.tar.gz |
puff: Complete GPIO list for EC.
Fill out the GPIO entries for puff.
Some dependencies on the hatch power sequencing still exist, and
will need to be modified for the puff power handling.
BRANCH=none
BUG=b:143189339
TEST=Build image, buildall, tests
Change-Id: I60074298be3d75e447c32ee3448f67149ec1bf81
Signed-off-by: Andrew McRae <amcrae@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1898261
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Andrew McRae <amcrae@chromium.org>
Commit-Queue: Andrew McRae <amcrae@chromium.org>
-rw-r--r-- | board/puff/board.c | 20 | ||||
-rw-r--r-- | board/puff/board.h | 42 | ||||
-rw-r--r-- | board/puff/gpio.inc | 130 |
3 files changed, 148 insertions, 44 deletions
diff --git a/board/puff/board.c b/board/puff/board.c index de0b0e73f2..77a1e74b79 100644 --- a/board/puff/board.c +++ b/board/puff/board.c @@ -10,6 +10,7 @@ #include "button.h" #include "common.h" #include "cros_board_info.h" +#include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx7447.h" #include "driver/tcpm/ps8xxx.h" #include "driver/tcpm/tcpci.h" @@ -41,6 +42,18 @@ #define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args) #define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args) +static void ppc_interrupt(enum gpio_signal signal) +{ + if (signal == GPIO_USB_C0_TCPPC_INT_ODL) + sn5s330_interrupt(0); +} + +static void tcpc_alert_event(enum gpio_signal signal) +{ + if (signal == GPIO_USB_C0_TCPC_INT_ODL) + schedule_deferred_pd_interrupt(0); +} + #include "gpio_list.h" /* Must come after other header files. */ /******************************************************************************/ @@ -240,3 +253,10 @@ void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma, int charge_mv) { } + +void board_overcurrent_event(int port, int is_overcurrented) +{ + /* Sanity check the port. */ + if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT)) + return; +} diff --git a/board/puff/board.h b/board/puff/board.h index 43292f905b..f038650dfb 100644 --- a/board/puff/board.h +++ b/board/puff/board.h @@ -42,7 +42,6 @@ #define CONFIG_HOSTCMD_ESPI #define CONFIG_LED_COMMON #undef CONFIG_LID_SWITCH -#define CONFIG_LTO #define CONFIG_PWM #define CONFIG_SHA256 #define CONFIG_SHA256_UNROLLED @@ -50,7 +49,6 @@ #define CONFIG_VSTORE #define CONFIG_VSTORE_SLOT_COUNT 1 -/* check this (copied from fizz) */ #define CONFIG_SUPPRESSED_HOST_COMMANDS \ EC_CMD_CONSOLE_SNAPSHOT, EC_CMD_CONSOLE_READ, EC_CMD_PD_GET_LOG_ENTRY @@ -80,12 +78,9 @@ /* Charger */ #define CONFIG_CHARGE_MANAGER -/* TODO: (b/143188569) Confirm this value */ #undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON -#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 50000 +#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 30000 -#define CONFIG_EXTPOWER_GPIO -/* check: #define CONFIG_EXTPOWER_DEBOUNCE_MS */ #define CONFIG_POWER_BUTTON #define CONFIG_POWER_BUTTON_IGNORE_LID #define CONFIG_POWER_BUTTON_X86 @@ -93,6 +88,8 @@ #define CONFIG_POWER_BUTTON_INIT_IDLE #define CONFIG_POWER_COMMON /* from fizz - Check */ +/* check: #define CONFIG_EXTPOWER_DEBOUNCE_MS */ +#define CONFIG_EXTPOWER_GPIO #define CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD 30 #define CONFIG_DELAY_DSW_PWROK_TO_PWRBTN #define CONFIG_POWER_PP5000_CONTROL @@ -106,9 +103,9 @@ #define PD_VCONN_SWAP_DELAY 5000 /* us */ /* TODO: (b/143501304) Use correct PD power values */ -#define PD_OPERATING_POWER_MW 15000 -#define PD_MAX_POWER_MW 60000 -#define PD_MAX_CURRENT_MA 3000 +#define PD_OPERATING_POWER_MW 30000 +#define PD_MAX_POWER_MW 100000 +#define PD_MAX_CURRENT_MA 5000 #define PD_MAX_VOLTAGE_MV 20000 /* Fan and temp. */ @@ -126,13 +123,13 @@ #define CONFIG_USB_POWER_DELIVERY #define CONFIG_USB_PD_ALT_MODE #define CONFIG_USB_PD_ALT_MODE_DFP -#define CONFIG_USB_PD_DISCHARGE_TCPC +#define CONFIG_USB_PD_DISCHARGE_PPC #define CONFIG_USB_PD_DUAL_ROLE #define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE #define CONFIG_USB_PD_LOGGING #define CONFIG_USB_PD_PORT_MAX_COUNT 1 -#define CONFIG_USB_PD_VBUS_DETECT_GPIO #define CONFIG_USB_PD_VBUS_DETECT_PPC +#define CONFIG_USBC_PPC_SN5S330 #define CONFIG_USB_PD_TCPC_LOW_POWER #define CONFIG_USB_PD_TCPM_MUX #define CONFIG_USB_PD_TCPM_TCPCI @@ -214,4 +211,27 @@ void led_critical(void); #endif /* !__ASSEMBLER__ */ +/* Pin renaming */ +#define GPIO_WP_L GPIO_EC_WP_ODL +#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD +#define GPIO_EN_PP5000 GPIO_EN_PP5000_A +#define GPIO_RECOVERY_L GPIO_H1_EC_RECOVERY_BTN_ODL +#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL +#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL +#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL +#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW +#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL +#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L +#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL +#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST +#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK +#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L +#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L +#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L +/* No equivalent signals for these pins, need to refactor the power handling */ +#define GPIO_RSMRST_L_PGOOD GPIO_PG_VPRIM_CORE_A_OD +#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_PG_VPRIM_CORE_A_OD +#define GPIO_EN_A_RAILS GPIO_EN_ROA_RAILS +#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L + #endif /* __CROS_EC_BOARD_H */ diff --git a/board/puff/gpio.inc b/board/puff/gpio.inc index 86eca8abe6..db8051fa54 100644 --- a/board/puff/gpio.inc +++ b/board/puff/gpio.inc @@ -6,35 +6,82 @@ */ /* Declare symbolic names for all the GPIOs that we care about. + * Pin names follow the schematic, and are aliased to other names if necessary. * Note: Those with interrupt handlers must be declared first. */ -/* TODO: pmarheine - use the real values. */ - /* Wake Source interrupts */ -GPIO_INT(WP_L, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) /* EC_WP_ODL */ -GPIO_INT(AC_PRESENT, PIN(C, 2), GPIO_INT_BOTH, extpower_interrupt) -GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* MECH_PWR_BTN_ODL */ - -GPIO_INT(RSMRST_L_PGOOD, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt) -GPIO_INT(PCH_SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PCH_SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PCH_SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PG_EC_ALL_SYS_PWRGD, PIN(F, 4), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(PP5000_A_PG_OD, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt) -GPIO_INT(RECOVERY_L, PIN(2, 4), GPIO_INT_BOTH, button_interrupt) /* H1_EC_RECOVERY_BTN_ODL */ - -GPIO(SYS_RESET_L, PIN(0, 2), GPIO_ODR_HIGH) /* SYS_RST_ODL */ -GPIO(PCH_WAKE_L, PIN(7, 4), GPIO_ODR_HIGH) /* EC_PCH_WAKE_ODL */ -GPIO(PCH_PWRBTN_L, PIN(C, 1), GPIO_ODR_HIGH) /* EC_PCH_PWR_BTN_ODL */ -GPIO(PCH_RSMRST_L, PIN(A, 6), GPIO_OUT_LOW) -GPIO(PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH) /* EC_PCH_RTCRST */ -GPIO(ENTERING_RW, PIN(E, 3), GPIO_OUT_LOW) /* EC_ENTERING_RW */ -GPIO(CPU_PROCHOT, PIN(6, 3), GPIO_ODR_HIGH) -GPIO(EN_PP5000, PIN(6, 4), GPIO_ODR_HIGH) -GPIO(EN_PP5000_A, PIN(6, 5), GPIO_ODR_HIGH) -GPIO(PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW) -GPIO(EN_A_RAILS, PIN(A, 3), GPIO_OUT_LOW) -GPIO(FAN_PWM_1, PIN(B, 6), GPIO_OUT_LOW) +GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) +GPIO_INT(H1_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt) + +/* Power sequencing interrupts */ +GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt) +#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3 +GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt) +#endif +#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4 +GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt) +#endif + +/* Other interrupts */ +GPIO_INT(USB_C0_TCPPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt) +GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, tcpc_alert_event) +GPIO_INT(H1_EC_RECOVERY_BTN_ODL, PIN(2, 4), GPIO_INT_BOTH, button_interrupt) + +/* PCH/CPU signals */ +GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW) +GPIO(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUT_LOW) +GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH) +GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH) +GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH) +GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT) +GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH) +GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT) +GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH) + +/* Power inputs - these may need to be interrupts */ +GPIO(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INPUT) +GPIO(IMVP8_VRRDY_OD, PIN(1, 6), GPIO_INPUT) +GPIO(PG_PP5000_A_OD, PIN(D, 7), GPIO_INPUT) +GPIO(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INPUT) +GPIO(PG_PP1800_A_OD, PIN(3, 1), GPIO_INPUT) +GPIO(PG_PP1200_U_OD, PIN(2, 1), GPIO_INPUT) +GPIO(PG_PP1050_A_OD, PIN(2, 2), GPIO_INPUT) +GPIO(PG_PP950_VCCIO_OD, PIN(1, 7), 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) +GPIO(EN_PP1800_A, PIN(1, 5), GPIO_OUT_LOW) +GPIO(VCCST_PG_OD, PIN(1, 4), GPIO_ODR_HIGH) +GPIO(EN_S0_RAILS, PIN(1, 1), GPIO_OUT_LOW) +GPIO(EN_ROA_RAILS, PIN(A, 3), GPIO_OUT_LOW) +GPIO(EN_PP950_VCCIO, PIN(1, 0), GPIO_OUT_LOW) + +GPIO(EC_IMVP8_PE, PIN(A, 7), GPIO_OUT_LOW) +GPIO(EN_IMVP8_VR, PIN(F, 4), GPIO_OUT_LOW) + +/* Barreljack */ +GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 4), GPIO_OUT_LOW) +GPIO(BJ_ADP_PRESENT_L, PIN(8, 2), GPIO_INPUT) + +/* 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_HIGH) +GPIO(USB_A0_OC_ODL, PIN(E, 4), GPIO_ODR_HIGH) +GPIO(USB_A1_OC_ODL, PIN(A, 2), GPIO_ODR_HIGH) +GPIO(USB_A2_OC_ODL, PIN(F, 5), GPIO_ODR_HIGH) +GPIO(USB_A3_OC_ODL, PIN(0, 3), GPIO_ODR_HIGH) + +/* USB type C */ +GPIO(USB_C0_TCPC_RST, PIN(9, 7), GPIO_OUT_LOW) + +/* Misc. */ +GPIO(M2_SSD_PLN, PIN(A, 0), GPIO_INPUT) +GPIO(EC_ENTERING_RW, PIN(E, 3), GPIO_OUT_LOW) +GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_ODR_HIGH) +GPIO(HDMI_CONN0_OC_ODL, PIN(0, 7), GPIO_ODR_HIGH) +GPIO(HDMI_CONN1_OC_ODL, PIN(0, 6), GPIO_ODR_HIGH) +GPIO(EN_PP_MST_OD, PIN(9, 6), GPIO_ODR_LOW) /* I2C pins - Alternate function below configures I2C module on these pins */ GPIO(I2C0_SCL, PIN(B, 5), GPIO_INPUT) /* EC_I2C_INA_SCL */ @@ -43,18 +90,35 @@ GPIO(I2C1_SCL, PIN(9, 0), GPIO_INPUT) /* EC_I2C_USB_C0 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(I2C4_SCL, PIN(F, 3), GPIO_INPUT) /* EC_I2C_RFU_SCL */ +GPIO(I2C4_SDA, PIN(F, 2), GPIO_INPUT) /* EC_I2C_RFU_SDA */ GPIO(I2C5_SCL, PIN(3, 3), GPIO_INPUT) /* EC_I2C_IMVP8_SCL */ GPIO(I2C5_SDA, PIN(3, 6), GPIO_INPUT) /* EC_I2C_IMVP8_SDA */ GPIO(I2C7_SCL, PIN(B, 3), GPIO_INPUT) /* EC_I2C_EEPROM_SCL */ GPIO(I2C7_SDA, PIN(B, 2), GPIO_INPUT) /* EC_I2C_EEPROM_SDA */ /* Alternate functions GPIO definitions */ -ALTERNATE(PIN_MASK(B, 0x30), 0, MODULE_I2C, 0) /* I2C0 */ -ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* I2C1 SCL / I2C2 */ -ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* I2C1 SDA */ -ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* I2C3 */ -ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* I2C5 */ -ALTERNATE(PIN_MASK(B, 0x0C), 0, MODULE_I2C, 0) /* I2C7 */ +ALTERNATE(PIN_MASK(B, 0x30), 0, MODULE_I2C, 0) /* I2C0 */ +ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* I2C1 SCL / I2C2 */ +ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* I2C1 SDA */ +ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* I2C3 */ +ALTERNATE(PIN_MASK(F, 0x0C), 0, MODULE_I2C, 0) /* I2C4 */ +ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* I2C5 */ +ALTERNATE(PIN_MASK(B, 0x0C), 0, MODULE_I2C, 0) /* I2C7 */ /* PWM */ -ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* PWM5 - Fan 1 */ +ALTERNATE(PIN_MASK(C, 0x08), 0, MODULE_PWM, 0) /* PWM0 - Red Led */ +ALTERNATE(PIN_MASK(C, 0x10), 0, MODULE_PWM, 0) /* PWM2 - Green Led */ +ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* PWM3 - Blue Led - NC */ +ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* PWM5 - Fan 1 */ +ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* TA1 - Fan Tachometer */ +ALTERNATE(PIN_MASK(C, 0x01), 0, MODULE_PWM, 0) /* PWM6 - Fan 2 - NC */ +ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* TA2 - Fan Tachometer - NC */ + +/* ADC */ +ALTERNATE(PIN_MASK(4, 0x3E), 0, MODULE_ADC, 0) /* ADC0-4 */ +ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* ADC7 */ +ALTERNATE(PIN_MASK(F, 0x01), 0, MODULE_ADC, 0) /* ADC9 */ + +/* UART */ +ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UART from EC to Servo */ |