Mathew King | 44948a7 | 2021-02-10 16:05:38 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
Karthikeyan Ramasubramanian | 9eaaf0d | 2021-10-05 14:20:14 -0600 | [diff] [blame] | 3 | #include <amdblocks/spi.h> |
Mathew King | 5d47887 | 2021-02-16 14:05:15 -0700 | [diff] [blame] | 4 | #include <baseboard/gpio.h> |
Hsuan Ting Chen | 6260bf7 | 2021-08-12 15:47:06 +0800 | [diff] [blame] | 5 | #include <boardid.h> |
Kyösti Mälkki | be7692a | 2021-11-03 17:54:14 +0200 | [diff] [blame^] | 6 | #include <bootmode.h> |
Mathew King | 44948a7 | 2021-02-10 16:05:38 -0700 | [diff] [blame] | 7 | #include <boot/coreboot_tables.h> |
| 8 | #include <gpio.h> |
| 9 | #include <vendorcode/google/chromeos/chromeos.h> |
| 10 | |
| 11 | void 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 Ramasubramanian | 1b7dac1 | 2021-07-21 14:54:16 -0600 | [diff] [blame] | 16 | {GPIO_EC_IN_RW, ACTIVE_HIGH, gpio_get(GPIO_EC_IN_RW), "EC in RW"}, |
Mathew King | 44948a7 | 2021-02-10 16:05:38 -0700 | [diff] [blame] | 17 | }; |
| 18 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
| 19 | } |
Mathew King | 5d47887 | 2021-02-16 14:05:15 -0700 | [diff] [blame] | 20 | |
| 21 | static 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 | |
| 26 | void mainboard_chromeos_acpi_generate(void) |
| 27 | { |
| 28 | chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios)); |
| 29 | } |
Hsuan Ting Chen | 6260bf7 | 2021-08-12 15:47:06 +0800 | [diff] [blame] | 30 | |
Karthikeyan Ramasubramanian | 9eaaf0d | 2021-10-05 14:20:14 -0600 | [diff] [blame] | 31 | void 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 | } |