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 | |
Matt DeVillier | 0b9cfe6 | 2018-06-26 13:07:32 -0500 | [diff] [blame] | 3 | #include <baseboard/variant.h> |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 4 | #include <cpu/x86/smm.h> |
Aaron Durbin | 3969df8 | 2016-07-14 01:09:34 -0500 | [diff] [blame] | 5 | #include <ec/google/chromeec/smm.h> |
Aaron Durbin | ce6c356 | 2015-11-11 16:46:27 -0600 | [diff] [blame] | 6 | #include <gpio.h> |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 7 | #include <soc/iomap.h> |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 8 | #include <soc/pm.h> |
Kyösti Mälkki | 89d7fd8 | 2019-08-13 07:57:34 +0300 | [diff] [blame] | 9 | #include <intelblocks/smihandler.h> |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 10 | #include "ec.h" |
Matt DeVillier | 0b9cfe6 | 2018-06-26 13:07:32 -0500 | [diff] [blame] | 11 | #include <variant/gpio.h> |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 12 | |
Aaron Durbin | 50ed38f | 2015-08-08 01:25:21 -0500 | [diff] [blame] | 13 | void mainboard_smi_gpi_handler(const struct gpi_status *sts) |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 14 | { |
Aaron Durbin | 3969df8 | 2016-07-14 01:09:34 -0500 | [diff] [blame] | 15 | if (gpi_status_get(sts, EC_SMI_GPI)) |
16 | chromeec_smi_process_events(); | ||||
Aaron Durbin | ce6c356 | 2015-11-11 16:46:27 -0600 | [diff] [blame] | 17 | } |
18 | |||||
Matt DeVillier | 0b9cfe6 | 2018-06-26 13:07:32 -0500 | [diff] [blame] | 19 | __weak void mainboard_gpio_smi_sleep(void) |
Aaron Durbin | ce6c356 | 2015-11-11 16:46:27 -0600 | [diff] [blame] | 20 | { |
Aaron Durbin | ce6c356 | 2015-11-11 16:46:27 -0600 | [diff] [blame] | 21 | } |
22 | |||||
23 | void mainboard_smi_sleep(u8 slp_typ) | ||||
24 | { | ||||
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 25 | if (CONFIG(EC_GOOGLE_CHROMEEC)) |
Aaron Durbin | 3969df8 | 2016-07-14 01:09:34 -0500 | [diff] [blame] | 26 | chromeec_smi_sleep(slp_typ, MAINBOARD_EC_S3_WAKE_EVENTS, |
27 | MAINBOARD_EC_S5_WAKE_EVENTS); | ||||
Aaron Durbin | ce6c356 | 2015-11-11 16:46:27 -0600 | [diff] [blame] | 28 | |
Matt DeVillier | 0b9cfe6 | 2018-06-26 13:07:32 -0500 | [diff] [blame] | 29 | mainboard_gpio_smi_sleep(); |
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 30 | } |
31 | |||||
32 | int mainboard_smi_apmc(u8 apmc) | ||||
33 | { | ||||
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 34 | if (CONFIG(EC_GOOGLE_CHROMEEC)) |
Aaron Durbin | 3969df8 | 2016-07-14 01:09:34 -0500 | [diff] [blame] | 35 | chromeec_smi_apmc(apmc, MAINBOARD_EC_SCI_EVENTS, |
36 | MAINBOARD_EC_SMI_EVENTS); | ||||
Patrick Georgi | 406313d | 2015-07-20 22:01:32 +0200 | [diff] [blame] | 37 | return 0; |
38 | } |