blob: 7d79a3faf31d731c725f35ad9bdcd80c539f80e7 [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
Zheng Bao8a281882011-03-27 16:33:09 +00002
Zheng Bao8a281882011-03-27 16:33:09 +00003#include <device/device.h>
4#include <device/pnp.h>
Zheng Bao8a281882011-03-27 16:33:09 +00005#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +02006
Zheng Bao8a281882011-03-27 16:33:09 +00007#include "wpcm450.h"
8
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +11009static void init(struct device *dev)
Zheng Bao8a281882011-03-27 16:33:09 +000010{
Zheng Bao8a281882011-03-27 16:33:09 +000011 if (!dev->enabled)
12 return;
13
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010014 switch (dev->path.pnp.device) {
Zheng Bao8a281882011-03-27 16:33:09 +000015 case WPCM450_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060016 pc_keyboard_init(NO_AUX_DEVICE);
Zheng Bao8a281882011-03-27 16:33:09 +000017 break;
18 }
19}
20
21static struct device_operations ops = {
22 .read_resources = pnp_read_resources,
23 .set_resources = pnp_set_resources,
24 .enable_resources = pnp_enable_resources,
25 .enable = pnp_enable,
26 .init = init,
27};
28
29static struct pnp_info pnp_dev_info[] = {
Felix Held9911d642018-07-06 20:55:53 +020030 { NULL, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
31 0x07f8, },
32 { NULL, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
Felix Heldb91b0cc2019-01-16 14:00:49 +010033 { NULL, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, },
Zheng Bao8a281882011-03-27 16:33:09 +000034};
35
36static void enable_dev(struct device *dev)
37{
38 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
39}
40
41struct chip_operations superio_nuvoton_wpcm450_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090042 .name = "Nuvoton WPCM450 Super I/O",
Zheng Bao8a281882011-03-27 16:33:09 +000043 .enable_dev = enable_dev,
44};