blob: fa7a8a0f839aab8a6341db2dea8f00832e40b70c [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
17#include <arch/io.h>
18#include <device/device.h>
19#include <device/pnp.h>
Zheng Bao8a281882011-03-27 16:33:09 +000020#include <string.h>
Zheng Bao8a281882011-03-27 16:33:09 +000021#include <pc80/keyboard.h>
22#include <stdlib.h>
Zheng Bao8a281882011-03-27 16:33:09 +000023#include "wpcm450.h"
24
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110025static void init(struct device *dev)
Zheng Bao8a281882011-03-27 16:33:09 +000026{
Zheng Bao8a281882011-03-27 16:33:09 +000027
28 if (!dev->enabled)
29 return;
30
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010031 switch (dev->path.pnp.device) {
Zheng Bao8a281882011-03-27 16:33:09 +000032 case WPCM450_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060033 pc_keyboard_init(NO_AUX_DEVICE);
Zheng Bao8a281882011-03-27 16:33:09 +000034 break;
35 }
36}
37
38static struct device_operations ops = {
39 .read_resources = pnp_read_resources,
40 .set_resources = pnp_set_resources,
41 .enable_resources = pnp_enable_resources,
42 .enable = pnp_enable,
43 .init = init,
44};
45
46static struct pnp_info pnp_dev_info[] = {
Felix Held9911d642018-07-06 20:55:53 +020047 { NULL, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
48 0x07f8, },
49 { NULL, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
50 { NULL, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, },
Zheng Bao8a281882011-03-27 16:33:09 +000051};
52
53static void enable_dev(struct device *dev)
54{
55 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
56}
57
58struct chip_operations superio_nuvoton_wpcm450_ops = {
Paul Menzel87eacac2014-06-05 07:52:49 +020059 CHIP_NAME("Nuvoton WPCM450 Super I/O")
Zheng Bao8a281882011-03-27 16:33:09 +000060 .enable_dev = enable_dev,
61};