mainboard/intel/avenuecity_crb: Update full IIO configuration
[coreboot2.git] / src / mainboard / google / gru / chromeos.c
blob3e57242fa3ca8d7aa60ddc2210d769b6f43e73d5
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <bootmode.h>
4 #include <boot/coreboot_tables.h>
5 #include <drivers/tpm/cr50.h>
6 #include <gpio.h>
8 #include "board.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"},
23 #endif
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"},
30 #endif
33 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
36 void setup_chromeos_gpios(void)
38 if (CONFIG(GRU_BASEBOARD_SCARLET))
39 gpio_input(GPIO_WP);
40 else
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);
51 #endif
53 int get_ec_is_trusted(void)
55 /* EC is trusted if not in RW. */
56 return !gpio_get(GPIO_EC_IN_RW);