mb/starlabs/starbook_mtl: Fix USB port assignments/descriptions
[coreboot2.git] / src / ec / roda / it8518 / ec.c
blob9f877f7d9068c3c5531b8962d5262ade47808a30
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <device/device.h>
5 #include <device/pnp.h>
6 #include <pc80/keyboard.h>
7 #include <ec/acpi/ec.h>
8 #include <delay.h>
10 #include "chip.h"
12 static void it8518_init(struct device *dev)
14 const struct ec_roda_it8518_config *const conf = dev->chip_info;
16 if (!dev->enabled)
17 return;
19 printk(BIOS_DEBUG, "Roda IT8518: Initializing keyboard.\n");
20 pc_keyboard_init(NO_AUX_DEVICE);
22 if (conf && conf->cpuhot_limit) {
23 /* The EC may take very long for the first command on a
24 cold boot (~180ms witnessed). Since we need an incre-
25 dibly long timeout, we do this EC RAM write manually. */
26 int timeout = 50000; /* 50,000 * 10us = 500ms */
27 send_ec_command(0x81);
28 while (ec_status() & EC_IBF && --timeout)
29 udelay(10);
30 send_ec_data(0xb2);
31 send_ec_data(conf->cpuhot_limit);
35 static struct device_operations ops = {
36 .init = it8518_init,
37 .read_resources = noop_read_resources,
38 .set_resources = noop_set_resources,
41 static struct pnp_info pnp_dev_info[] = {
42 { NULL, 0, 0, 0, }
45 static void enable_dev(struct device *dev)
47 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
50 struct chip_operations ec_roda_it8518_ops = {
51 .name = "Roda IT8518 EC",
52 .enable_dev = enable_dev