blob: 060119dc3c994d055cd131adf2a6184b952f7744 [file] [log] [blame]
Jon Murphycbf0f982022-02-16 06:47:46 -07001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#include <acpi/acpi.h>
Jon Murphye3e18012022-02-17 15:44:26 -07004#include <amdblocks/smi.h>
Jon Murphycbf0f982022-02-16 06:47:46 -07005#include <ec/google/chromeec/ec.h>
Felix Held8d1ef732022-12-06 21:29:49 +01006#include <gpio.h>
Jon Murphye3e18012022-02-17 15:44:26 -07007#include <soc/smi.h>
Jon Murphycbf0f982022-02-16 06:47:46 -07008#include <variant/ec.h>
9
Jon Murphye3e18012022-02-17 15:44:26 -070010static const struct sci_source espi_sci_sources[] = {
11 {
Jon Murphy3f625072022-04-18 13:19:23 -060012 .scimap = SMITYPE_ESPI_SCI_B,
13 .gpe = EC_SCI_GPI,
Jon Murphye3e18012022-02-17 15:44:26 -070014 .direction = SMI_SCI_LVL_HIGH, /* enum smi_sci_lvl */
15 .level = SMI_SCI_EDG, /* enum smi_sci_dir */
16 }
17};
18
Jon Murphycbf0f982022-02-16 06:47:46 -070019void mainboard_ec_init(void)
20{
21 const struct google_chromeec_event_info info = {
22 .log_events = MAINBOARD_EC_LOG_EVENTS,
23 .sci_events = MAINBOARD_EC_SCI_EVENTS,
24 .s3_wake_events = MAINBOARD_EC_S3_WAKE_EVENTS,
25 .s5_wake_events = MAINBOARD_EC_S5_WAKE_EVENTS,
26 .s0ix_wake_events = MAINBOARD_EC_S0IX_WAKE_EVENTS,
27 };
28
29 google_chromeec_events_init(&info, acpi_is_wakeup_s3());
Jon Murphye3e18012022-02-17 15:44:26 -070030
31 /* Configure eSPI SCI events */
32 gpe_configure_sci(espi_sci_sources, ARRAY_SIZE(espi_sci_sources));
Jon Murphycbf0f982022-02-16 06:47:46 -070033}