diff options
-rw-r--r-- | board/cr50/board.c | 29 | ||||
-rw-r--r-- | board/cr50/board.h | 3 | ||||
-rw-r--r-- | board/cr50/gpio.inc | 11 |
3 files changed, 14 insertions, 29 deletions
diff --git a/board/cr50/board.c b/board/cr50/board.c index 8efee242ab..d19d021787 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -934,40 +934,23 @@ void tpm_rst_deasserted(enum gpio_signal signal) void assert_sys_rst(void) { - /* - * We don't have a good (any?) way to easily look up the pinmux/gpio - * assignments in gpio.inc, so they're hard-coded in this routine. This - * assertion is just to ensure it hasn't changed. - */ - ASSERT(GREAD(PINMUX, GPIO0_GPIO4_SEL) == GC_PINMUX_DIOM0_SEL); - - /* Set SYS_RST_L_OUT as an output, connected to the pad */ - GWRITE(PINMUX, DIOM0_SEL, GC_PINMUX_GPIO0_GPIO4_SEL); - gpio_set_flags(GPIO_SYS_RST_L_OUT, GPIO_OUT_HIGH); - /* Assert it */ gpio_set_level(GPIO_SYS_RST_L_OUT, 0); } void deassert_sys_rst(void) { - ASSERT(GREAD(PINMUX, GPIO0_GPIO4_SEL) == GC_PINMUX_DIOM0_SEL); - - /* Deassert SYS_RST_L */ + /* Deassert it */ gpio_set_level(GPIO_SYS_RST_L_OUT, 1); - - /* Set SYS_RST_L_OUT as an input, disconnected from the pad */ - gpio_set_flags(GPIO_SYS_RST_L_OUT, GPIO_INPUT); - GWRITE(PINMUX, DIOM0_SEL, 0); } int is_sys_rst_asserted(void) { - return (GREAD(PINMUX, DIOM0_SEL) == GC_PINMUX_GPIO0_GPIO4_SEL) -#ifdef CONFIG_CMD_GPIO_EXTENDED - && (gpio_get_flags(GPIO_SYS_RST_L_OUT) & GPIO_OUTPUT) -#endif - && (gpio_get_level(GPIO_SYS_RST_L_OUT) == 0); + /* + * SYS_RST_L is pseudo open drain. It is only an output when it's + * asserted. + */ + return gpio_get_flags(GPIO_SYS_RST_L_OUT) & GPIO_OUTPUT; } /** diff --git a/board/cr50/board.h b/board/cr50/board.h index 78f6d5915a..272ec813ff 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -38,6 +38,9 @@ #undef CONFIG_FLASH #endif +/* Enable getting gpio flags to tell if open drain pins are asserted */ +#define CONFIG_GPIO_GET_EXTENDED + /* Flash configuration */ #undef CONFIG_FLASH_PSTATE #define CONFIG_WP_ALWAYS diff --git a/board/cr50/gpio.inc b/board/cr50/gpio.inc index 7a8fc11787..03015ba8b9 100644 --- a/board/cr50/gpio.inc +++ b/board/cr50/gpio.inc @@ -94,8 +94,11 @@ GPIO(INT_AP_L, PIN(0, 0), GPIO_OUT_HIGH) GPIO(EC_FLASH_SELECT, PIN(0, 1), GPIO_OUT_LOW) GPIO(AP_FLASH_SELECT, PIN(0, 2), GPIO_OUT_LOW) -/* Pull this low to reset the AP. (We reset the EC with the RBOX.) */ -GPIO(SYS_RST_L_OUT, PIN(0, 4), GPIO_INPUT) +/* + * Pull this low to reset the AP. (We reset the EC with the RBOX.) + * This is pseudo open drain. + */ +GPIO(SYS_RST_L_OUT, PIN(0, 4), GPIO_ODR_HIGH) /* * Indicate to EC when CCD is enabled. EC can pull this down too, to tell us if @@ -171,10 +174,6 @@ PINMUX(GPIO(AP_FLASH_SELECT), B3, DIO_INPUT) * removed. */ PINMUX(GPIO(EN_PP3300_INA_L), B7, DIO_INPUT) -/* - * To allow the EC to drive the signal we set sys_rst_l_out as an input here and - * only change it to an output when we want to assert the signal. - */ PINMUX(GPIO(SYS_RST_L_OUT), M0, DIO_INPUT) PINMUX(GPIO(CCD_MODE_L), M1, DIO_INPUT) PINMUX(GPIO(BATT_PRES_L), M2, 0) |