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>
This commit is contained in:
parent
3f0c7242c9
commit
9ec6928b8c
|
@ -21,15 +21,19 @@
|
||||||
|
|
||||||
#include "board.h"
|
#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)
|
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)
|
void fill_lb_gpios(struct lb_gpios *gpios)
|
||||||
{
|
{
|
||||||
struct lb_gpio chromeos_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"},
|
"write protect"},
|
||||||
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
{-1, ACTIVE_HIGH, get_recovery_mode_switch(), "recovery"},
|
||||||
#if IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)
|
#if IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)
|
||||||
|
@ -49,7 +53,10 @@ void fill_lb_gpios(struct lb_gpios *gpios)
|
||||||
|
|
||||||
void setup_chromeos_gpios(void)
|
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_IN_RW);
|
||||||
gpio_input_pullup(GPIO_EC_IRQ);
|
gpio_input_pullup(GPIO_EC_IRQ);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue