| 1 |
|
| 2 |
|
| 3 |
#include <bootmode.h> |
| 4 |
#include <boot/coreboot_tables.h> |
| 5 |
#include <gpio.h> |
| 6 |
|
| 7 |
#include "board.h" |
| 8 |
|
| 9 |
#define GPIO_WP GPIO(7, A, 6) |
| 10 |
#define GPIO_POWER GPIO(0, A, 5) |
| 11 |
#define GPIO_RECOVERY_SERVO GPIO(0, B, 1) |
| 12 |
#define GPIO_RECOVERY_PUSHKEY GPIO(7, B, 1) |
| 13 |
|
| 14 |
void setup_chromeos_gpios(void) |
| 15 |
{ |
| 16 |
gpio_input(GPIO_WP); |
| 17 |
gpio_input(GPIO_POWER); |
| 18 |
gpio_input_pullup(GPIO_RECOVERY_SERVO); |
| 19 |
gpio_input_pullup(GPIO_RECOVERY_PUSHKEY); |
| 20 |
} |
| 21 |
|
| 22 |
void fill_lb_gpios(struct lb_gpios *gpios) |
| 23 |
{ |
| 24 |
struct lb_gpio chromeos_gpios[] = { |
| 25 |
|
| 26 |
|
| 27 |
{GPIO_RECOVERY_PUSHKEY.raw, ACTIVE_LOW, |
| 28 |
!get_recovery_mode_switch(), "presence"}, |
| 29 |
{GPIO_POWER.raw, ACTIVE_LOW, -1, "power"}, |
| 30 |
{GPIO_RESET.raw, ACTIVE_HIGH, -1, "reset"}, |
| 31 |
}; |
| 32 |
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 33 |
} |
| 34 |
|
| 35 |
int get_recovery_mode_switch(void) |
| 36 |
{ |
| 37 |
|
| 38 |
return !(gpio_get(GPIO_RECOVERY_SERVO) && |
| 39 |
gpio_get(GPIO_RECOVERY_PUSHKEY)); |
| 40 |
} |
| 41 |
|
| 42 |
int get_write_protect_state(void) |
| 43 |
{ |
| 44 |
return !gpio_get(GPIO_WP); |
| 45 |
} |
| 46 |
|
| 47 |
int get_ec_is_trusted(void) |
| 48 |
{ |
| 49 |
|
| 50 |
|
| 51 |
return 1; |
| 52 |
} |