1 /* SPDX-License-Identifier: GPL-2.0-only */
4 #include <boot/coreboot_tables.h>
5 #include <drivers/tpm/cr50.h>
10 static const uint32_t wp_polarity
= CONFIG(GRU_BASEBOARD_SCARLET
) ?
11 ACTIVE_LOW
: ACTIVE_HIGH
;
13 int get_write_protect_state(void)
15 return gpio_get(GPIO_WP
) ^ !wp_polarity
;
18 void fill_lb_gpios(struct lb_gpios
*gpios
)
20 struct lb_gpio chromeos_gpios
[] = {
21 #if CONFIG(GRU_BASEBOARD_SCARLET)
22 {GPIO_BACKLIGHT
.raw
, ACTIVE_HIGH
, -1, "backlight"},
24 {GPIO_EC_IN_RW
.raw
, ACTIVE_HIGH
, -1, "EC in RW"},
25 {GPIO_EC_IRQ
.raw
, ACTIVE_LOW
, -1, "EC interrupt"},
26 {GPIO_RESET
.raw
, ACTIVE_HIGH
, -1, "reset"},
27 {GPIO_SPK_PA_EN
.raw
, ACTIVE_HIGH
, -1, "speaker enable"},
28 #if CONFIG(GRU_HAS_TPM2)
29 {GPIO_TPM_IRQ
.raw
, ACTIVE_HIGH
, -1, "TPM interrupt"},
33 lb_add_gpios(gpios
, chromeos_gpios
, ARRAY_SIZE(chromeos_gpios
));
36 void setup_chromeos_gpios(void)
38 if (CONFIG(GRU_BASEBOARD_SCARLET
))
41 gpio_input_pullup(GPIO_WP
);
42 gpio_input_pullup(GPIO_EC_IN_RW
);
43 gpio_input_pullup(GPIO_EC_IRQ
);
46 #if CONFIG(GRU_HAS_TPM2)
47 int cr50_plat_irq_status(void)
49 return gpio_irq_status(GPIO_TPM_IRQ
);
53 int get_ec_is_trusted(void)
55 /* EC is trusted if not in RW. */
56 return !gpio_get(GPIO_EC_IN_RW
);