summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2018-02-14 18:01:27 -0800
committerJulius Werner <jwerner@chromium.org>2018-02-16 00:08:00 +0000
commit9ec6928b8c7bfdd3bed4eb233672e74f6914ebb6 (patch)
treec5882b25f841623ed7f642a89524605fa13ef344
parent3f0c7242c9933fba9c6c7d91a96fb75a88aaef15 (diff)
google/gru: Fix GPIO_WP pull and polarity for Scarlet
Turns out the write-protect GPIO polarity for Scarlet is different than for Kevin/Gru, and nobody ever told us. Also, it must not be configured with an internal pull-up or we'll not read the correct value. This patch fixes both issues. BRANCH=scarlet BUG=b:73356326 TEST=Booted Scarlet, confirmed that crossystem wpsw_boot returns the right value in all cases. Change-Id: Idd348ecdf9da8fff7201b83e869ba097b8570f32 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/23767 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r--src/mainboard/google/gru/chromeos.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mainboard/google/gru/chromeos.c b/src/mainboard/google/gru/chromeos.c
index ff5368a65c..7fb47d0da8 100644
--- a/src/mainboard/google/gru/chromeos.c
+++ b/src/mainboard/google/gru/chromeos.c
@@ -21,15 +21,19 @@
#include "board.h"
+static const uint32_t wp_polarity = IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET) ?
+ ACTIVE_LOW : ACTIVE_HIGH;
+
int get_write_protect_state(void)
{
- return gpio_get(GPIO_WP);
+ int raw = gpio_get(GPIO_WP);
+ return wp_polarity == ACTIVE_HIGH ? raw : !raw;
}
void fill_lb_gpios(struct lb_gpios *gpios)
{
struct lb_gpio chromeos_gpios[] = {
- {GPIO_WP.raw, ACTIVE_HIGH, get_write_protect_state(),
+ {GPIO_WP.raw, wp_polarity, gpio_get(GPIO_WP),
"write protect"},
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
#if IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)
@@ -49,7 +53,10 @@ void fill_lb_gpios(struct lb_gpios *gpios)
void setup_chromeos_gpios(void)
{
- gpio_input_pullup(GPIO_WP);
+ if (IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET))
+ gpio_input(GPIO_WP);
+ else
+ gpio_input_pullup(GPIO_WP);
gpio_input_pullup(GPIO_EC_IN_RW);
gpio_input_pullup(GPIO_EC_IRQ);
}