Jon Murphy | cbf0f98 | 2022-02-16 06:47:46 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | |
| 3 | #include <acpi/acpi.h> |
Jon Murphy | e3e1801 | 2022-02-17 15:44:26 -0700 | [diff] [blame] | 4 | #include <amdblocks/gpio.h> |
| 5 | #include <amdblocks/smi.h> |
Jon Murphy | cbf0f98 | 2022-02-16 06:47:46 -0700 | [diff] [blame] | 6 | #include <console/console.h> |
| 7 | #include <ec/google/chromeec/ec.h> |
Jon Murphy | e3e1801 | 2022-02-17 15:44:26 -0700 | [diff] [blame] | 8 | #include <soc/smi.h> |
Jon Murphy | cbf0f98 | 2022-02-16 06:47:46 -0700 | [diff] [blame] | 9 | #include <variant/ec.h> |
| 10 | |
Jon Murphy | e3e1801 | 2022-02-17 15:44:26 -0700 | [diff] [blame] | 11 | static const struct sci_source espi_sci_sources[] = { |
| 12 | { |
Jon Murphy | 3f62507 | 2022-04-18 13:19:23 -0600 | [diff] [blame] | 13 | .scimap = SMITYPE_ESPI_SCI_B, |
| 14 | .gpe = EC_SCI_GPI, |
Jon Murphy | e3e1801 | 2022-02-17 15:44:26 -0700 | [diff] [blame] | 15 | .direction = SMI_SCI_LVL_HIGH, /* enum smi_sci_lvl */ |
| 16 | .level = SMI_SCI_EDG, /* enum smi_sci_dir */ |
| 17 | } |
| 18 | }; |
| 19 | |
Jon Murphy | cbf0f98 | 2022-02-16 06:47:46 -0700 | [diff] [blame] | 20 | void mainboard_ec_init(void) |
| 21 | { |
| 22 | const struct google_chromeec_event_info info = { |
| 23 | .log_events = MAINBOARD_EC_LOG_EVENTS, |
| 24 | .sci_events = MAINBOARD_EC_SCI_EVENTS, |
| 25 | .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS, |
| 26 | .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS, |
| 27 | .s0ix_wake_events = MAINBOARD_EC_S0IX_WAKE_EVENTS, |
| 28 | }; |
| 29 | |
| 30 | google_chromeec_events_init(&info, acpi_is_wakeup_s3()); |
Jon Murphy | e3e1801 | 2022-02-17 15:44:26 -0700 | [diff] [blame] | 31 | |
| 32 | /* Configure eSPI SCI events */ |
| 33 | gpe_configure_sci(espi_sci_sources, ARRAY_SIZE(espi_sci_sources)); |
Jon Murphy | cbf0f98 | 2022-02-16 06:47:46 -0700 | [diff] [blame] | 34 | } |