Angel Pons | 62079a5 | 2020-04-05 13:21:34 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 2 | |
Kyösti Mälkki | be7692a | 2021-11-03 17:54:14 +0200 | [diff] [blame^] | 3 | #include <bootmode.h> |
Kyösti Mälkki | 17887d0 | 2019-07-23 19:08:01 +0300 | [diff] [blame] | 4 | #include <boot/coreboot_tables.h> |
Duncan Laurie | c328191 | 2015-08-13 12:54:27 -0700 | [diff] [blame] | 5 | #include <gpio.h> |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 6 | #include <soc/gpio.h> |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 7 | #include <vendorcode/google/chromeos/chromeos.h> |
Matt DeVillier | 0b9cfe6 | 2018-06-26 13:07:32 -0500 | [diff] [blame] | 8 | #include <variant/gpio.h> |
Duncan Laurie | c328191 | 2015-08-13 12:54:27 -0700 | [diff] [blame] | 9 | |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 10 | void fill_lb_gpios(struct lb_gpios *gpios) |
| 11 | { |
Julius Werner | c445b4f | 2016-03-31 17:27:05 -0700 | [diff] [blame] | 12 | struct lb_gpio chromeos_gpios[] = { |
Julius Werner | c445b4f | 2016-03-31 17:27:05 -0700 | [diff] [blame] | 13 | {-1, ACTIVE_HIGH, get_lid_switch(), "lid"}, |
| 14 | {-1, ACTIVE_HIGH, 0, "power"}, |
| 15 | {-1, ACTIVE_HIGH, gfx_get_init_done(), "oprom"}, |
| 16 | {GPIO_EC_IN_RW, ACTIVE_HIGH, |
| 17 | gpio_get(GPIO_EC_IN_RW), "EC in RW"}, |
| 18 | }; |
| 19 | lb_add_gpios(gpios, chromeos_gpios, ARRAY_SIZE(chromeos_gpios)); |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 20 | } |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 21 | |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 22 | int get_write_protect_state(void) |
| 23 | { |
Duncan Laurie | c328191 | 2015-08-13 12:54:27 -0700 | [diff] [blame] | 24 | /* Read PCH_WP GPIO. */ |
Duncan Laurie | 5626085 | 2015-08-17 09:53:22 -0700 | [diff] [blame] | 25 | return gpio_get(GPIO_PCH_WP); |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 26 | } |
Aaron Durbin | b0f8151 | 2016-07-25 21:31:41 -0500 | [diff] [blame] | 27 | |
| 28 | static const struct cros_gpio cros_gpios[] = { |
| 29 | CROS_GPIO_REC_AL(CROS_GPIO_VIRTUAL, CROS_GPIO_DEVICE_NAME), |
| 30 | CROS_GPIO_WP_AH(GPIO_PCH_WP, CROS_GPIO_DEVICE_NAME), |
| 31 | }; |
| 32 | |
| 33 | void mainboard_chromeos_acpi_generate(void) |
| 34 | { |
| 35 | chromeos_acpi_gpio_generate(cros_gpios, ARRAY_SIZE(cros_gpios)); |
| 36 | } |