cbfs: Remove remnants of ext-win-*
[coreboot2.git] / src / superio / nuvoton / nct5539d / superio.c
blobcef40a546eed9aad75b72e10759feaaaae1f1b0a
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/conf_mode.h>
7 #include "nct5539d.h"
9 #if CONFIG(HAVE_ACPI_TABLES)
10 #include <superio/common/ssdt.h>
11 #include <acpi/acpi.h>
12 #endif
14 static void nct5539d_init(struct device *dev)
16 if (!dev->enabled)
17 return;
19 switch (dev->path.pnp.device) {
20 case NCT5539D_KBC:
21 pc_keyboard_init(NO_AUX_DEVICE);
22 break;
26 #if CONFIG(HAVE_ACPI_TABLES)
27 /* Provide ACPI HIDs for generic Super I/O SSDT */
28 static const char *nct5539d_acpi_hid(const struct device *dev)
30 if ((dev->path.type != DEVICE_PATH_PNP) ||
31 (dev->path.pnp.port == 0) ||
32 ((dev->path.pnp.device & 0xff) > NCT5539D_DS))
33 return NULL;
35 switch (dev->path.pnp.device & 0xff) {
36 case NCT5539D_SP1:
37 return ACPI_HID_COM;
38 case NCT5539D_KBC:
39 return ACPI_HID_KEYBOARD;
40 default:
41 return ACPI_HID_PNP;
44 #endif
46 static struct device_operations ops = {
47 .read_resources = pnp_read_resources,
48 .set_resources = pnp_set_resources,
49 .enable_resources = pnp_enable_resources,
50 .enable = pnp_alt_enable,
51 .init = nct5539d_init,
52 .ops_pnp_mode = &pnp_conf_mode_8787_aa,
53 #if CONFIG(HAVE_ACPI_TABLES)
54 .acpi_fill_ssdt = superio_common_fill_ssdt_generator,
55 .acpi_name = superio_common_ldn_acpi_name,
56 .acpi_hid = nct5539d_acpi_hid,
57 #endif
60 static struct pnp_info pnp_dev_info[] = {
61 { NULL, NCT5539D_SP1, PNP_IO0 | PNP_IRQ0,
62 0x0ff8, },
63 { NULL, NCT5539D_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1,
64 0x0fff, 0x0fff, },
65 { NULL, NCT5539D_CIR, PNP_IO0 | PNP_IRQ0,
66 0x0ff8, },
67 { NULL, NCT5539D_ACPI},
68 { NULL, NCT5539D_HWM_FPLED, PNP_IO0 | PNP_IRQ0,
69 0x0ffe, 0x0ffe, },
70 { NULL, NCT5539D_WDT2},
71 { NULL, NCT5539D_CIRWUP, PNP_IO0 | PNP_IRQ0,
72 0x0ff8, },
73 { NULL, NCT5539D_GPIO_PP_OD},
74 { NULL, NCT5539D_WDT1},
75 { NULL, NCT5539D_WDT3},
76 { NULL, NCT5539D_GPIOBASE, PNP_IO0,
77 0x0ff8, },
78 { NULL, NCT5539D_GPIO0},
79 { NULL, NCT5539D_GPIO2},
80 { NULL, NCT5539D_GPIO3},
81 { NULL, NCT5539D_GPIO4},
82 { NULL, NCT5539D_GPIO5},
83 { NULL, NCT5539D_GPIO7},
84 { NULL, NCT5539D_GPIO8},
85 { NULL, NCT5539D_GPIO_PSO},
86 { NULL, NCT5539D_SWEC},
87 { NULL, NCT5539D_FLED},
88 { NULL, NCT5539D_DS5},
89 { NULL, NCT5539D_DS3},
92 static void enable_dev(struct device *dev)
94 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
97 struct chip_operations superio_nuvoton_nct5539d_ops = {
98 .name = "NUVOTON NCT5539D Super I/O",
99 .enable_dev = enable_dev,