autoport: Add support for Haswell-Lynx Point platform
[coreboot.git] / src / superio / ite / it8718f / superio.c
blobfafe30d61d2d9821a4be36745bdf3e499f84a8e0
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <device/device.h>
4 #include <device/pnp.h>
5 #include <pc80/keyboard.h>
6 #include <superio/ite/common/env_ctrl.h>
7 #include <superio/conf_mode.h>
9 #include "it8718f.h"
10 #include "chip.h"
12 static void init(struct device *dev)
14 const struct superio_ite_it8718f_config *conf;
15 const struct resource *res;
17 if (!dev->enabled)
18 return;
20 switch (dev->path.pnp.device) {
21 case IT8718F_FDC: /* TODO. */
22 break;
23 case IT8718F_PP: /* TODO. */
24 break;
25 case IT8718F_EC:
26 conf = dev->chip_info;
27 res = probe_resource(dev, PNP_IDX_IO0);
28 if (!conf || !res)
29 break;
30 ite_ec_init(res->base, &conf->ec);
31 break;
32 case IT8718F_KBCK:
33 pc_keyboard_init(NO_AUX_DEVICE);
34 break;
35 case IT8718F_KBCM: /* TODO. */
36 break;
37 case IT8718F_IR: /* TODO. */
38 break;
42 static struct device_operations ops = {
43 .read_resources = pnp_read_resources,
44 .set_resources = pnp_set_resources,
45 .enable_resources = pnp_enable_resources,
46 .enable = pnp_enable,
47 .init = init,
48 .ops_pnp_mode = &pnp_conf_mode_870155_aa,
51 /* TODO: IR. */
52 static struct pnp_info pnp_dev_info[] = {
53 { NULL, IT8718F_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0
54 | PNP_MSC0 | PNP_MSC1, 0x0ff8, },
55 { NULL, IT8718F_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
56 { NULL, IT8718F_SP2, PNP_IO0 | PNP_IRQ0, 0x07f8, },
57 { NULL, IT8718F_EC, PNP_IO0 | PNP_IO1 | PNP_IRQ0
58 | PNP_MSC0 | PNP_MSC1 | PNP_MSC2 | PNP_MSC3
59 | PNP_MSC4 | PNP_MSC5 | PNP_MSC6,
60 0x0ff8, 0x0ff8, },
61 { NULL, IT8718F_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0
62 | PNP_MSC0, 0x07f8, 0x07f8, },
63 { NULL, IT8718F_KBCM, PNP_IRQ0 | PNP_MSC0, },
64 { NULL, IT8718F_PP, PNP_IO0 | PNP_IO1 | PNP_IRQ0
65 | PNP_DRQ0 | PNP_MSC0, 0x0ff8, 0x0ff8, },
68 static void enable_dev(struct device *dev)
70 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
73 struct chip_operations superio_ite_it8718f_ops = {
74 .name = "ITE IT8718F Super I/O",
75 .enable_dev = enable_dev,