1 /* SPDX-License-Identifier: GPL-2.0-only */
5 #include <console/console.h>
7 #include <ec/google/chromeec/ec.h>
8 #include <intelblocks/lpc_lib.h>
9 #include <variant/ec.h>
11 static void ramstage_ec_init(void)
13 const struct google_chromeec_event_info info
= {
14 .log_events
= MAINBOARD_EC_LOG_EVENTS
,
15 .sci_events
= MAINBOARD_EC_SCI_EVENTS
,
16 .s3_wake_events
= MAINBOARD_EC_S3_WAKE_EVENTS
,
17 .s5_wake_events
= MAINBOARD_EC_S5_WAKE_EVENTS
,
18 .s0ix_wake_events
= MAINBOARD_EC_S0IX_WAKE_EVENTS
,
21 printk(BIOS_INFO
, "mainboard: EC init\n");
23 google_chromeec_events_init(&info
, acpi_is_wakeup_s3());
26 static void bootblock_ec_init(void)
28 uint16_t ec_ioport_base
;
29 size_t ec_ioport_size
;
32 * Set up LPC decoding for the ChromeEC I/O port ranges:
33 * - Ports 62/66, 60/64, and 200->208
34 * - ChromeEC specific communication I/O ports.
36 lpc_enable_fixed_io_ranges(LPC_IOE_EC_62_66
| LPC_IOE_KBC_60_64
38 google_chromeec_ioport_range(&ec_ioport_base
, &ec_ioport_size
);
39 lpc_open_pmio_window(ec_ioport_base
, ec_ioport_size
);
42 void mainboard_ec_init(void)
44 if (CONFIG(EC_GOOGLE_CHROMEEC
)) {
47 else if (ENV_BOOTBLOCK
)
49 } else if (ENV_BOOTBLOCK
) {
51 * Set up LPC decoding for the ChromeEC I/O port ranges:
52 * - Ports 62/66, 60/64, and 200->208
53 * - ChromeEC specific communication I/O ports.
55 lpc_enable_fixed_io_ranges(LPC_IOE_EC_62_66
| LPC_IOE_KBC_60_64
59 if (CONFIG(GLK_INTEL_EC
)) {
60 printk(BIOS_ERR
, "S3 Hack Enable ACPI mode: outb(0xaa,0x66)\n");
62 printk(BIOS_INFO
, "Hack to turn on the CPU fan\n");
66 /* Need delay here, hence second outb */