blob: 6cd48ea440a78cb5317d9ce94f6be0aa2ee2f54c [file] [log] [blame]
Mathew King44948a72021-02-10 16:05:38 -07001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
Karthikeyan Ramasubramanian9eaaf0d2021-10-05 14:20:14 -06003#include <amdblocks/spi.h>
Mathew King5d478872021-02-16 14:05:15 -07004#include <baseboard/gpio.h>
Hsuan Ting Chen6260bf72021-08-12 15:47:06 +08005#include <boardid.h>
Kyösti Mälkkibe7692a2021-11-03 17:54:14 +02006#include <bootmode.h>
Mathew King44948a72021-02-10 16:05:38 -07007#include <boot/coreboot_tables.h>
8#include <gpio.h>
9#include <vendorcode/google/chromeos/chromeos.h>
10
11void fill_lb_gpios(struct lb_gpios *gpios)
12{
13 struct lb_gpio chromeos_gpios[] = {
14 {-1, ACTIVE_HIGH, get_lid_switch(), "lid"},
15 {-1, ACTIVE_HIGH, 0, "power"},
Karthikeyan Ramasubramanian1b7dac12021-07-21 14:54:16 -060016 {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW), "EC in RW"},
Mathew King44948a72021-02-10 16:05:38 -070017 };
18 lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios));
19}
Mathew King5d478872021-02-16 14:05:15 -070020
21static const struct cros_gpio cros_gpios[] = {
22 CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, GPIO_DEVICE_NAME),
23 CROS_GPIO_WP_AL(CROS_WP_GPIO, GPIO_DEVICE_NAME),
24};
25
26void mainboard_chromeos_acpi_generate(void)
27{
28 chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios));
29}
Hsuan Ting Chen6260bf72021-08-12 15:47:06 +080030
Karthikeyan Ramasubramanian9eaaf0d2021-10-05 14:20:14 -060031void mainboard_spi_fast_speed_override(uint8_t *fast_speed)
32{
33 uint32_t board_ver = board_id();
34
35 if (board_ver >= CONFIG_OVERRIDE_EFS_SPI_SPEED_MIN_BOARD)
36 *fast_speed = CONFIG_OVERRIDE_EFS_SPI_SPEED;
37}