From 31fa74cf7d6d40f55bcc54b237e4e47d39024740 Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Tue, 6 Sep 2016 10:05:01 -0700 Subject: [PATCH] cr50: remove the pullup on sys_rst on kevin There is leakage on SYS_RST_ODL from the internal pullup cr50 has on DIOM0. This change removes the internal pullup on reef. On Kevin there is a bug preventing the EC from being able to pull sys_rst_l up high enoug for cr50 to detect that it is pulled high. This change adds an internal pullup back when cr50 detects that it is on a kevin or gru. BUG=chrome-os-partner:56945 BUG=chrome-os-partner:53544 BRANCH=none TEST=On gru and kevin remove servo verify when apreset is run on the EC it resets cr50 and the AP. Run pinmux and check that there is a pullup on diom0 on kevin but not on gru. Change-Id: Ica4f557745967b93e0bd9c8462916b1f735756ac Signed-off-by: Mary Ruthven Reviewed-on: https://chromium-review.googlesource.com/381322 Reviewed-by: Vadim Bendebury --- board/cr50/board.c | 18 ++++++++++++++++-- board/cr50/gpio.inc | 5 +---- include/system.h | 2 ++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/board/cr50/board.c b/board/cr50/board.c index 83d8957e5b..fc0b87dc69 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -193,9 +193,17 @@ static void init_runlevel(const enum permission_level desired_level) } } +static void configure_board_specific_gpios(void) +{ + /* Add a pullup to sys_rst_l */ + if (system_get_board_properties() & BOARD_NEEDS_SYS_RST_PULL_UP) + GWRITE_FIELD(PINMUX, DIOM0_CTL, PU, 1); +} + /* Initialize board. */ static void board_init(void) { + configure_board_specific_gpios(); init_pmu(); init_interrupts(); init_trng(); @@ -551,10 +559,16 @@ void system_init_board_properties(void) properties = 0; /* Read DIOA1 strap pin */ - if (gpio_get_level(GPIO_STRAP0)) + if (gpio_get_level(GPIO_STRAP0)) { /* Strap is pulled high -> Kevin SPI TPM option */ properties |= BOARD_SLAVE_CONFIG_SPI; - else { + /* Add an internal pull up on sys_rst_l */ + /* + * TODO(crosbug.com/p/54059): Remove once SYS_RST_L can + * be pulled up externally. + */ + properties |= BOARD_NEEDS_SYS_RST_PULL_UP; + } else { /* Strap is low -> Reef I2C TPM option */ properties |= BOARD_SLAVE_CONFIG_I2C; /* One PHY is connected to the AP */ diff --git a/board/cr50/gpio.inc b/board/cr50/gpio.inc index e68124d561..454fe729bc 100644 --- a/board/cr50/gpio.inc +++ b/board/cr50/gpio.inc @@ -11,11 +11,8 @@ * We can assert SYS_RST_L but so can the EC, so we need react if it's pulled * low. The ARM core can't trigger an interrupt if it's driving it as an output * so we attach two internal GPIOs to the same pad. - * TODO: Remove this internal pullup at some point. It's only here so that - * boards that don't have an external pullup don't trigger due to noise. */ -GPIO_INT(SYS_RST_L_IN, PIN(1, 0), GPIO_INT_FALLING | GPIO_PULL_UP, - sys_rst_asserted) +GPIO_INT(SYS_RST_L_IN, PIN(1, 0), GPIO_INT_FALLING, sys_rst_asserted) GPIO_INT(AP_ON, PIN(1, 1), GPIO_INT_RISING, device_state_on) GPIO_INT(EC_ON, PIN(1, 2), GPIO_INT_RISING, device_state_on) GPIO_INT(SERVO_UART1_ON, PIN(1, 3), GPIO_INT_RISING | GPIO_PULL_DOWN, diff --git a/include/system.h b/include/system.h index 5bca2c6321..12f771df8d 100644 --- a/include/system.h +++ b/include/system.h @@ -478,6 +478,8 @@ void system_clear_retry_counter(void); #define BOARD_DISABLE_UART0_RX (1 << 3) /* Disable UART0 RX */ #define BOARD_MARK_UPDATE_ON_USB_REQ (1 << 4) /* update is good once the */ /* controller gets a request */ +/* TODO(crosbug.com/p/54059): Remove when sys_rst_l has an external pullup */ +#define BOARD_NEEDS_SYS_RST_PULL_UP (1 << 5) /* Add a pullup to sys_rst_l */ /** * Get board properites