blob: f867ff3e62f404e8f92bc34e714494ef9f1577a0 [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
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000019#include <device/device.h>
20#include <device/pnp.h>
Yinghai Luafd34e62006-02-16 17:22:19 +000021#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000022#include <stdlib.h>
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000023#include "pc87417.h"
24
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110025static void init(struct device *dev)
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000026{
Uwe Hermanna69d9782010-11-15 19:35:14 +000027 if (!dev->enabled)
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000028 return;
Uwe Hermanna69d9782010-11-15 19:35:14 +000029
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010030 switch (dev->path.pnp.device) {
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000031 case PC87417_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060032 pc_keyboard_init(NO_AUX_DEVICE);
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000033 break;
34 }
35}
36
37static struct device_operations ops = {
38 .read_resources = pnp_read_resources,
39 .set_resources = pnp_set_resources,
40 .enable_resources = pnp_enable_resources,
41 .enable = pnp_enable,
42 .init = init,
43};
44
45static struct pnp_info pnp_dev_info[] = {
Felix Heldd5292bf2019-01-16 13:23:35 +010046 { NULL, PC87417_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
47 { NULL, PC87417_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
Felix Heldfaca0bc2017-12-27 22:51:29 +010048 { NULL, PC87417_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
49 0x07f8, },
50 { NULL, PC87417_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
51 { NULL, PC87417_SWC, PNP_IO0 | PNP_IRQ0, 0xfff0, },
52 { NULL, PC87417_KBCM, PNP_IRQ0, },
53 { NULL, PC87417_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, },
54 { NULL, PC87417_GPIO, PNP_IO0 | PNP_IRQ0, 0xfff8, },
55 { NULL, PC87417_XBUS, PNP_IO0 | PNP_IRQ0, 0xffe0, },
56 { NULL, PC87417_RTC, PNP_IO0 | PNP_IO1, 0xfffe, 0xfffe, },
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000057};
58
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000059static void enable_dev(struct device *dev)
60{
Felix Heldfaca0bc2017-12-27 22:51:29 +010061 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000062}
63
Uwe Hermannd86417b2006-10-24 23:00:42 +000064struct chip_operations superio_nsc_pc87417_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000065 CHIP_NAME("NSC PC87417 Super I/O")
Ronald G. Minnich1cf26a82005-10-19 17:35:18 +000066 .enable_dev = enable_dev,
67};