blob: f265cbf2295e1c195cd1c70f81fc72bfa2b0d51f [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 <console/console.h>
6#include <ec/google/chromeec/ec.h>
Felix Held8d1ef732022-12-06 21:29:49 +01007#include <gpio.h>
Jon Murphye3e18012022-02-17 15:44:26 -07008#include <soc/smi.h>
Jon Murphycbf0f982022-02-16 06:47:46 -07009#include <variant/ec.h>
10
Jon Murphye3e18012022-02-17 15:44:26 -070011static const struct sci_source espi_sci_sources[] = {
12 {
Jon Murphy3f625072022-04-18 13:19:23 -060013 .scimap = SMITYPE_ESPI_SCI_B,
14 .gpe = EC_SCI_GPI,
Jon Murphye3e18012022-02-17 15:44:26 -070015 .direction = SMI_SCI_LVL_HIGH, /* enum smi_sci_lvl */
16 .level = SMI_SCI_EDG, /* enum smi_sci_dir */
17 }
18};
19
Jon Murphycbf0f982022-02-16 06:47:46 -070020void 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 Murphye3e18012022-02-17 15:44:26 -070031
32 /* Configure eSPI SCI events */
33 gpe_configure_sci(espi_sci_sources, ARRAY_SIZE(espi_sci_sources));
Jon Murphycbf0f982022-02-16 06:47:46 -070034}