blob: 7bb8eb9375bcb72249a85a922af04110a8e09e48 [file] [log] [blame]
Felix Held3f3eca92020-01-23 17:12:32 +01001/* SPDX-License-Identifier: GPL-2.0-or-later */
2/* This file is part of the coreboot project. */
Zheng Bao8a281882011-03-27 16:33:09 +00003
Zheng Bao8a281882011-03-27 16:33:09 +00004#include <device/device.h>
5#include <device/pnp.h>
Zheng Bao8a281882011-03-27 16:33:09 +00006#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +02007
Zheng Bao8a281882011-03-27 16:33:09 +00008#include "wpcm450.h"
9
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110010static void init(struct device *dev)
Zheng Bao8a281882011-03-27 16:33:09 +000011{
Zheng Bao8a281882011-03-27 16:33:09 +000012
13 if (!dev->enabled)
14 return;
15
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010016 switch (dev->path.pnp.device) {
Zheng Bao8a281882011-03-27 16:33:09 +000017 case WPCM450_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060018 pc_keyboard_init(NO_AUX_DEVICE);
Zheng Bao8a281882011-03-27 16:33:09 +000019 break;
20 }
21}
22
23static struct device_operations ops = {
24 .read_resources = pnp_read_resources,
25 .set_resources = pnp_set_resources,
26 .enable_resources = pnp_enable_resources,
27 .enable = pnp_enable,
28 .init = init,
29};
30
31static struct pnp_info pnp_dev_info[] = {
Felix Held9911d642018-07-06 20:55:53 +020032 { NULL, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
33 0x07f8, },
34 { NULL, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
Felix Heldb91b0cc2019-01-16 14:00:49 +010035 { NULL, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, },
Zheng Bao8a281882011-03-27 16:33:09 +000036};
37
38static void enable_dev(struct device *dev)
39{
40 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
41}
42
43struct chip_operations superio_nuvoton_wpcm450_ops = {
Paul Menzel87eacac2014-06-05 07:52:49 +020044 CHIP_NAME("Nuvoton WPCM450 Super I/O")
Zheng Bao8a281882011-03-27 16:33:09 +000045 .enable_dev = enable_dev,
46};