blob: b39f7c077a9fa56a34e3ecfbdc4934cbab10d287 [file] [log] [blame]
Mathew King44948a72021-02-10 16:05:38 -07001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
Mathew King5d478872021-02-16 14:05:15 -07003#include <baseboard/gpio.h>
Hsuan-ting Chen642508a2021-10-27 10:59:41 +00004#include <boardid.h>
Kyösti Mälkkibe7692a2021-11-03 17:54:14 +02005#include <bootmode.h>
Mathew King44948a72021-02-10 16:05:38 -07006#include <boot/coreboot_tables.h>
7#include <gpio.h>
Kyösti Mälkki9a3bde02021-11-06 16:13:15 +02008#include <types.h>
Mathew King44948a72021-02-10 16:05:38 -07009#include <vendorcode/google/chromeos/chromeos.h>
10
11void fill_lb_gpios(struct lb_gpios *gpios)
12{
13 struct lb_gpio chromeos_gpios[] = {
Karthikeyan Ramasubramanian1b7dac12021-07-21 14:54:16 -060014 {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW), "EC in RW"},
Mathew King44948a72021-02-10 16:05:38 -070015 };
16 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
17}
Mathew King5d478872021-02-16 14:05:15 -070018
19static const struct cros_gpio cros_gpios[] = {
20 CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, GPIO_DEVICE_NAME),
21 CROS_GPIO_WP_AL(CROS_WP_GPIO, GPIO_DEVICE_NAME),
22};
Kyösti Mälkki4ff218a2021-11-02 13:03:06 +020023DECLARE_CROS_GPIOS(cros_gpios);
Hsuan-ting Chen642508a2021-10-27 10:59:41 +000024
25int get_ec_is_trusted(void)
26{
27 /* Board versions 1 & 2 support H1 DB, but the EC_IN_RW signal is not
28 routed. So emulate EC is trusted. */
29 if (CONFIG(BOARD_GOOGLE_GUYBRUSH) &&
30 (board_id() == UNDEFINED_STRAPPING_ID || board_id() < 3))
31 return 1;
32 /* EC is trusted if not in RW. */
33 return !gpio_get(GPIO_EC_IN_RW);
34}