Angel Pons | 60ec365 | 2020-04-03 01:22:13 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [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> |
robbie zhang | fada85e | 2015-08-25 16:13:53 -0700 | [diff] [blame] | 5 | #include <gpio.h> |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [diff] [blame] | 6 | #include <soc/gpio.h> |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [diff] [blame] | 7 | #include <vendorcode/google/chromeos/chromeos.h> |
Wenkai Du | 3b16925 | 2015-08-24 10:31:30 -0700 | [diff] [blame] | 8 | #include "gpio.h" |
Wenkai Du | 3b16925 | 2015-08-24 10:31:30 -0700 | [diff] [blame] | 9 | |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [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)); |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [diff] [blame] | 20 | } |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [diff] [blame] | 21 | |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [diff] [blame] | 22 | int get_write_protect_state(void) |
| 23 | { |
robbie zhang | fada85e | 2015-08-25 16:13:53 -0700 | [diff] [blame] | 24 | /* Read PCH_WP GPIO. */ |
| 25 | return gpio_get(GPIO_PCH_WP); |
Lee Leahy | c421041 | 2015-06-29 11:37:56 -0700 | [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 | } |