blob: 863ad2b9857372251018529feb6f69dd45763cd9 [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
12 if (!dev->enabled)
13 return;
14
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010015 switch (dev->path.pnp.device) {
Zheng Bao8a281882011-03-27 16:33:09 +000016 case WPCM450_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060017 pc_keyboard_init(NO_AUX_DEVICE);
Zheng Bao8a281882011-03-27 16:33:09 +000018 break;
19 }
20}
21
22static struct device_operations ops = {
23 .read_resources = pnp_read_resources,
24 .set_resources = pnp_set_resources,
25 .enable_resources = pnp_enable_resources,
26 .enable = pnp_enable,
27 .init = init,
28};
29
30static struct pnp_info pnp_dev_info[] = {
Felix Held9911d642018-07-06 20:55:53 +020031 { NULL, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
32 0x07f8, },
33 { NULL, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
Felix Heldb91b0cc2019-01-16 14:00:49 +010034 { NULL, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, },
Zheng Bao8a281882011-03-27 16:33:09 +000035};
36
37static void enable_dev(struct device *dev)
38{
39 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
40}
41
42struct chip_operations superio_nuvoton_wpcm450_ops = {
Nicholas Sudsgaardbfb11be2024-01-30 09:53:46 +090043 .name = "Nuvoton WPCM450 Super I/O",
Zheng Bao8a281882011-03-27 16:33:09 +000044 .enable_dev = enable_dev,
45};