| 1 |
|
| 2 |
|
| 3 |
#include <boot/coreboot_tables.h> |
| 4 |
#include <bootmode.h> |
| 5 |
#include "board.h" |
| 6 |
#include <drivers/tpm/cr50.h> |
| 7 |
|
| 8 |
void setup_chromeos_gpios(void) |
| 9 |
{ |
| 10 |
gpio_input_pullup(GPIO_EC_IN_RW); |
| 11 |
gpio_input_pullup(GPIO_AP_EC_INT); |
| 12 |
gpio_input_pullup(GPIO_SD_CD_L); |
| 13 |
gpio_input_irq(GPIO_H1_AP_INT, IRQ_TYPE_RISING_EDGE, GPIO_PULL_UP); |
| 14 |
gpio_output(GPIO_AMP_ENABLE, 0); |
| 15 |
gpio_output(GPIO_BACKLIGHT_ENABLE, 0); |
| 16 |
|
| 17 |
if (CONFIG(TROGDOR_HAS_MIPI_PANEL)) { |
| 18 |
gpio_output(GPIO_MIPI_1V8_ENABLE, 0); |
| 19 |
gpio_output(GPIO_AVDD_LCD_ENABLE, 0); |
| 20 |
gpio_output(GPIO_VDD_RESET_1V8, 0); |
| 21 |
gpio_output(GPIO_AVEE_LCD_ENABLE, 0); |
| 22 |
} else { |
| 23 |
gpio_output(GPIO_EN_PP3300_DX_EDP, 0); |
| 24 |
gpio_output(GPIO_EDP_BRIDGE_ENABLE, 0); |
| 25 |
gpio_output(GPIO_PS8640_EDP_BRIDGE_3V3_ENABLE, 0); |
| 26 |
gpio_output(GPIO_PS8640_EDP_BRIDGE_RST_L, 0); |
| 27 |
} |
| 28 |
|
| 29 |
if (CONFIG(TROGDOR_HAS_FINGERPRINT)) { |
| 30 |
gpio_output(GPIO_FPMCU_BOOT0, 0); |
| 31 |
gpio_output(GPIO_FP_RST_L, 0); |
| 32 |
gpio_output(GPIO_EN_FP_RAILS, 0); |
| 33 |
} |
| 34 |
} |
| 35 |
|
| 36 |
void fill_lb_gpios(struct lb_gpios *gpios) |
| 37 |
{ |
| 38 |
struct lb_gpio chromeos_gpios[] = { |
| 39 |
{GPIO_EC_IN_RW.addr, ACTIVE_LOW, gpio_get(GPIO_EC_IN_RW), |
| 40 |
"EC in RW"}, |
| 41 |
{GPIO_AP_EC_INT.addr, ACTIVE_LOW, gpio_get(GPIO_AP_EC_INT), |
| 42 |
"EC interrupt"}, |
| 43 |
{GPIO_H1_AP_INT.addr, ACTIVE_HIGH, gpio_get(GPIO_H1_AP_INT), |
| 44 |
"TPM interrupt"}, |
| 45 |
{GPIO_SD_CD_L.addr, ACTIVE_LOW, gpio_get(GPIO_SD_CD_L), |
| 46 |
"SD card detect"}, |
| 47 |
{GPIO_AMP_ENABLE.addr, ACTIVE_HIGH, gpio_get(GPIO_AMP_ENABLE), |
| 48 |
"speaker enable"}, |
| 49 |
{GPIO_BACKLIGHT_ENABLE.addr, ACTIVE_HIGH, |
| 50 |
gpio_get(GPIO_BACKLIGHT_ENABLE), "backlight"}, |
| 51 |
}; |
| 52 |
|
| 53 |
lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 54 |
} |
| 55 |
|
| 56 |
int cr50_plat_irq_status(void) |
| 57 |
{ |
| 58 |
return gpio_irq_status(GPIO_H1_AP_INT); |
| 59 |
} |
| 60 |
|
| 61 |
int get_ec_is_trusted(void) |
| 62 |
{ |
| 63 |
|
| 64 |
return !!gpio_get(GPIO_EC_IN_RW); |
| 65 |
} |