blob: aeb394accad2b20f4db26a58f90cfa29d9695c6d [file] [log] [blame]
Zheng Bao8a281882011-03-27 16:33:09 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Zheng Bao8a281882011-03-27 16:33:09 +000015 */
16
Zheng Bao8a281882011-03-27 16:33:09 +000017#include <device/device.h>
18#include <device/pnp.h>
Zheng Bao8a281882011-03-27 16:33:09 +000019#include <pc80/keyboard.h>
Elyes HAOUAS2329a252019-05-15 22:11:18 +020020
Zheng Bao8a281882011-03-27 16:33:09 +000021#include "wpcm450.h"
22
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110023static void init(struct device *dev)
Zheng Bao8a281882011-03-27 16:33:09 +000024{
Zheng Bao8a281882011-03-27 16:33:09 +000025
26 if (!dev->enabled)
27 return;
28
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010029 switch (dev->path.pnp.device) {
Zheng Bao8a281882011-03-27 16:33:09 +000030 case WPCM450_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060031 pc_keyboard_init(NO_AUX_DEVICE);
Zheng Bao8a281882011-03-27 16:33:09 +000032 break;
33 }
34}
35
36static struct device_operations ops = {
37 .read_resources = pnp_read_resources,
38 .set_resources = pnp_set_resources,
39 .enable_resources = pnp_enable_resources,
40 .enable = pnp_enable,
41 .init = init,
42};
43
44static struct pnp_info pnp_dev_info[] = {
Felix Held9911d642018-07-06 20:55:53 +020045 { NULL, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
46 0x07f8, },
47 { NULL, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
Felix Heldb91b0cc2019-01-16 14:00:49 +010048 { NULL, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07ff, 0x07ff, },
Zheng Bao8a281882011-03-27 16:33:09 +000049};
50
51static void enable_dev(struct device *dev)
52{
53 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
54}
55
56struct chip_operations superio_nuvoton_wpcm450_ops = {
Paul Menzel87eacac2014-06-05 07:52:49 +020057 CHIP_NAME("Nuvoton WPCM450 Super I/O")
Zheng Bao8a281882011-03-27 16:33:09 +000058 .enable_dev = enable_dev,
59};