| 1 |
|
| 2 |
|
| 3 |
#include <bootmode.h> |
| 4 |
#include <boot/coreboot_tables.h> |
| 5 |
#include <drivers/tpm/cr50.h> |
| 6 |
#include <gpio.h> |
| 7 |
|
| 8 |
#include "gpio.h" |
| 9 |
|
| 10 |
void setup_chromeos_gpios(void) |
| 11 |
{ |
| 12 |
gpio_input(GPIO_WP); |
| 13 |
gpio_input_pullup(EC_IN_RW); |
| 14 |
gpio_input_pullup(EC_IRQ); |
| 15 |
gpio_input_pullup(CR50_IRQ); |
| 16 |
gpio_output(GPIO_RESET, 0); |
| 17 |
gpio_output(GPIO_EN_SPK_AMP, 0); |
| 18 |
} |
| 19 |
|
| 20 |
void fill_lb_gpios(struct lb_gpios *gpios) |
| 21 |
{ |
| 22 |
struct lb_gpio chromeos_gpios[] = { |
| 23 |
{EC_IN_RW.id, ACTIVE_HIGH, -1, "EC in RW"}, |
| 24 |
{EC_IRQ.id, ACTIVE_LOW, -1, "EC interrupt"}, |
| 25 |
{CR50_IRQ.id, ACTIVE_HIGH, -1, "TPM interrupt"}, |
| 26 |
{GPIO_EN_SPK_AMP.id, ACTIVE_HIGH, -1, CONFIG_SPEAKER_GPIO_NAME}, |
| 27 |
}; |
| 28 |
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 29 |
} |
| 30 |
|
| 31 |
int get_write_protect_state(void) |
| 32 |
{ |
| 33 |
return !gpio_get(GPIO_WP); |
| 34 |
} |
| 35 |
|
| 36 |
int cr50_plat_irq_status(void) |
| 37 |
{ |
| 38 |
return gpio_eint_poll(CR50_IRQ); |
| 39 |
} |
| 40 |
|
| 41 |
int get_ec_is_trusted(void) |
| 42 |
{ |
| 43 |
|
| 44 |
return !gpio_get(EC_IN_RW); |
| 45 |
} |