coreboot-kgpe-d16/src/mainboard/google/veyron_rialto/chromeos.c
Matt Delco 2cb399625e mainboard: remove "recovery" gpio, selectively add "presence" gpio.
The gpio table is only used by depthcharge, and depthcharge rarely
has a need for the "recovery" gpio.  On a few boards it does use the
gpio as a signal for confirming physical presence, so on that boards
we'll advertise the board as "presence".

All these strings probably should have been #defines to help avoid
typos (e.g., the "ec_in_rw" in stout seems questionable since everybody
else uses "EC in RW").

Cq-Depend: chromium:1580454
BUG=b:129471321
BRANCH=None
TEST=Local compile and flash (with corresponding changes to depthcharge)
to 2 systems, one with a "presence" gpio and another without.  Confirmed
that both systems could enter dev mode.

Change-Id: Id6d62d9e48d3e6646cbc1277ea53f0ca95dd849e
Signed-off-by: Matt Delco <delco@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32718
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Reviewed-by: Julius Werner <jwerner@chromium.org>
2019-05-13 09:21:51 +00:00

61 lines
1.7 KiB
C

/*
* This file is part of the coreboot project.
*
* Copyright 2014 Rockchip Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <boot/coreboot_tables.h>
#include <gpio.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "board.h"
#define GPIO_WP GPIO(7, A, 6)
#define GPIO_POWER GPIO(0, A, 5)
#define GPIO_RECOVERY_SERVO GPIO(0, B, 1)
#define GPIO_RECOVERY_PUSHKEY GPIO(7, B, 1)
void setup_chromeos_gpios(void)
{
gpio_input(GPIO_WP);
gpio_input(GPIO_POWER);
gpio_input_pullup(GPIO_RECOVERY_SERVO);
gpio_input_pullup(GPIO_RECOVERY_PUSHKEY);
}
void fill_lb_gpios(struct lb_gpios *gpios)
{
struct lb_gpio chromeos_gpios[] = {
{GPIO_WP.raw, ACTIVE_LOW,
!get_write_protect_state(), "write protect"},
/* Note for early development, we want to support both servo
* and pushkey recovery buttons in firmware boot stages. */
{GPIO_RECOVERY_PUSHKEY.raw, ACTIVE_LOW,
!get_recovery_mode_switch(), "presence"},
{GPIO_POWER.raw, ACTIVE_LOW, -1, "power"},
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"},
};
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
}
int get_recovery_mode_switch(void)
{
// Both RECOVERY_SERVO and RECOVERY_PUSHKEY are low active.
return !(gpio_get(GPIO_RECOVERY_SERVO) &&
gpio_get(GPIO_RECOVERY_PUSHKEY));
}
int get_write_protect_state(void)
{
return !gpio_get(GPIO_WP);
}