blob: 6f9dfe8009de4b79f64b7fda822aa909eddab3ea [file] [log] [blame]
Zheng Bao9db833b2009-12-28 09:59:44 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2000 AG Electronics Ltd.
5 * Copyright (C) 2003-2004 Linux Networx
Uwe Hermanna69d9782010-11-15 19:35:14 +00006 * Copyright (C) 2004 Tyan
Zheng Bao9db833b2009-12-28 09:59:44 +00007 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Zheng Bao9db833b2009-12-28 09:59:44 +000017 */
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000018
19#include <arch/io.h>
20#include <device/device.h>
21#include <device/pnp.h>
22#include <console/console.h>
23#include <string.h>
Yinghai Luafd34e62006-02-16 17:22:19 +000024#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000025#include <stdlib.h>
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000026#include "pc87417.h"
27
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110028static void init(struct device *dev)
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000029{
Uwe Hermanna69d9782010-11-15 19:35:14 +000030 if (!dev->enabled)
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000031 return;
Uwe Hermanna69d9782010-11-15 19:35:14 +000032
Stefan Reinauer2b34db82009-02-28 20:10:20 +000033 switch(dev->path.pnp.device) {
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000034 case PC87417_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060035 pc_keyboard_init(NO_AUX_DEVICE);
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000036 break;
37 }
38}
39
40static struct device_operations ops = {
41 .read_resources = pnp_read_resources,
42 .set_resources = pnp_set_resources,
43 .enable_resources = pnp_enable_resources,
44 .enable = pnp_enable,
45 .init = init,
46};
47
48static struct pnp_info pnp_dev_info[] = {
Samuel Holland7daac912017-06-06 22:55:01 -050049 { &ops, PC87417_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07fa, },
50 { &ops, PC87417_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x04f8, },
51 { &ops, PC87417_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, 0x07f8, },
52 { &ops, PC87417_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
53 { &ops, PC87417_SWC, PNP_IO0 | PNP_IRQ0, 0xfff0, },
Uwe Hermanna69d9782010-11-15 19:35:14 +000054 { &ops, PC87417_KBCM, PNP_IRQ0, },
Samuel Holland7daac912017-06-06 22:55:01 -050055 { &ops, PC87417_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, },
56 { &ops, PC87417_GPIO, PNP_IO0 | PNP_IRQ0, 0xfff8, },
57 { &ops, PC87417_XBUS, PNP_IO0 | PNP_IRQ0, 0xffe0, },
58 { &ops, PC87417_RTC, PNP_IO0 | PNP_IO1, 0xfffe, 0xfffe, },
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000059};
60
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000061static void enable_dev(struct device *dev)
62{
Yinghai Luafd34e62006-02-16 17:22:19 +000063 pnp_enable_devices(dev, &pnp_ops,
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000064 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000065}
66
Uwe Hermannd86417b2006-10-24 23:00:42 +000067struct chip_operations superio_nsc_pc87417_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000068 CHIP_NAME("NSC PC87417 Super I/O")
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000069 .enable_dev = enable_dev,
70};