blob: 6c1cdb86d3ef9a5250a567d703c816c73e4ba43d [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>
20#include <console/console.h>
21#include <string.h>
Zheng Bao8a281882011-03-27 16:33:09 +000022#include <pc80/keyboard.h>
23#include <stdlib.h>
Zheng Bao8a281882011-03-27 16:33:09 +000024#include "wpcm450.h"
25
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110026static void init(struct device *dev)
Zheng Bao8a281882011-03-27 16:33:09 +000027{
Zheng Bao8a281882011-03-27 16:33:09 +000028
29 if (!dev->enabled)
30 return;
31
32 switch(dev->path.pnp.device) {
Zheng Bao8a281882011-03-27 16:33:09 +000033 case WPCM450_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060034 pc_keyboard_init(NO_AUX_DEVICE);
Zheng Bao8a281882011-03-27 16:33:09 +000035 break;
36 }
37}
38
39static struct device_operations ops = {
40 .read_resources = pnp_read_resources,
41 .set_resources = pnp_set_resources,
42 .enable_resources = pnp_enable_resources,
43 .enable = pnp_enable,
44 .init = init,
45};
46
47static struct pnp_info pnp_dev_info[] = {
48 { &ops, WPCM450_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
49 { &ops, WPCM450_SP1, PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
50 { &ops, WPCM450_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
51};
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};