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 <martinroth@chromium.org>
Original-Commit-Id: e6969f4be42c00c6e88bbb14929cf0454462ad21
Original-Change-Id: Ie65db9cf182b0a0a05ae412f86904df6b239e0f4
Original-Signed-off-by: Douglas Anderson <dianders@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/366131
Original-Tested-by: Brian Norris <briannorris@chromium.org>
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/16115
Tested-by: build bot (Jenkins)
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Douglas Anderson 2016-08-04 09:27:40 -07:00 committed by Martin Roth
parent 9d130a9e10
commit 4884c5d52d
1 changed files with 8 additions and 7 deletions

View File

@ -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);
}