From 4884c5d52d23ca02be326d41233dc16b829d6535 Mon Sep 17 00:00:00 2001 From: Douglas Anderson Date: Thu, 4 Aug 2016 09:27:40 -0700 Subject: google/gru: Fix rk3399-gru write protect The write protect GPIO is active high, not active low. After fixing I can see this after removing the write-protect screw: $ crossystem | grep wpsw_boot wpsw_boot = 0 Putting the screw in shows: $ crossystem | grep wpsw_boot wpsw_boot = 1 Caution: this CL contains explicit material. It explicitly sets the pullup on the WP GPIO even though that's the boot default. BRANCH=None BUG=chrome-os-partner:55933 TEST=See desc. Change-Id: I23e17e3bbbe7dcd83e81814de46117491e61baaa Signed-off-by: Martin Roth Original-Commit-Id: e6969f4be42c00c6e88bbb14929cf0454462ad21 Original-Change-Id: Ie65db9cf182b0a0a05ae412f86904df6b239e0f4 Original-Signed-off-by: Douglas Anderson Original-Reviewed-on: https://chromium-review.googlesource.com/366131 Original-Tested-by: Brian Norris Original-Reviewed-by: Julius Werner Reviewed-on: https://review.coreboot.org/16115 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh --- src/mainboard/google/gru/chromeos.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/mainboard/google/gru/chromeos.c b/src/mainboard/google/gru/chromeos.c index f8aa4fa4f9..cc2b3b6604 100644 --- a/src/mainboard/google/gru/chromeos.c +++ b/src/mainboard/google/gru/chromeos.c @@ -22,10 +22,16 @@ #include "board.h" +int get_write_protect_state(void) +{ + return gpio_get(GPIO_WP); +} + void fill_lb_gpios(struct lb_gpios *gpios) { struct lb_gpio chromeos_gpios[] = { - {GPIO_WP.raw, ACTIVE_LOW, gpio_get(GPIO_WP), "write protect"}, + {GPIO_WP.raw, ACTIVE_HIGH, get_write_protect_state(), + "write protect"}, {-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"}, {GPIO_BACKLIGHT.raw, ACTIVE_HIGH, -1, "backlight"}, {GPIO_EC_IN_RW.raw, ACTIVE_HIGH, -1, "EC in RW"}, @@ -50,14 +56,9 @@ int get_recovery_mode_switch(void) EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY)); } -int get_write_protect_state(void) -{ - return !gpio_get(GPIO_WP); -} - void setup_chromeos_gpios(void) { - gpio_input(GPIO_WP); + gpio_input_pullup(GPIO_WP); gpio_input_pullup(GPIO_EC_IN_RW); gpio_input_pullup(GPIO_EC_IRQ); } -- cgit v1.2.3