blob: 6d8c66e9070376e9b50af9a493c85f08e25ebbf3 [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
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
Zheng Bao9db833b2009-12-28 09:59:44 +000016 */
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000017
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000018#include <device/device.h>
19#include <device/pnp.h>
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000020#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000021#include <stdlib.h>
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000022#include "pc87366.h"
23
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110024static void init(struct device *dev)
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000025{
Uwe Hermanna69d9782010-11-15 19:35:14 +000026 if (!dev->enabled)
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000027 return;
Uwe Hermanna69d9782010-11-15 19:35:14 +000028
Elyes HAOUAS0ce41f12018-11-13 10:03:31 +010029 switch (dev->path.pnp.device) {
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000030 case PC87366_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060031 pc_keyboard_init(NO_AUX_DEVICE);
Ronald G. Minnichb3da9702004-03-12 23:38:20 +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 Heldd5292bf2019-01-16 13:23:35 +010045 { NULL, PC87366_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
46 { NULL, PC87366_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
Felix Heldfaca0bc2017-12-27 22:51:29 +010047 { NULL, PC87366_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
48 0x07f8, },
49 { NULL, PC87366_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
50 { NULL, PC87366_SWC, PNP_IO0 | PNP_IRQ0, 0xfff0, },
51 { NULL, PC87366_KBCM, PNP_IRQ0, },
52 { NULL, PC87366_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, },
53 { NULL, PC87366_GPIO, PNP_IO0 | PNP_IRQ0, 0xfff8, },
54 { NULL, PC87366_ACB, PNP_IO0 | PNP_IRQ0, 0xfff8, },
55 { NULL, PC87366_FSCM, PNP_IO0 | PNP_IRQ0, 0xfff8, },
56 { NULL, PC87366_WDT, PNP_IO0 | PNP_IRQ0, 0xfffc, },
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000057};
58
Eric Biedermandbec2d42004-10-21 10:44:08 +000059static void enable_dev(struct device *dev)
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000060{
Felix Heldfaca0bc2017-12-27 22:51:29 +010061 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000062}
63
Uwe Hermannd86417b2006-10-24 23:00:42 +000064struct chip_operations superio_nsc_pc87366_ops = {
Uwe Hermanna7aa29b2006-11-05 18:50:49 +000065 CHIP_NAME("NSC PC87366 Super I/O")
Eric Biedermandbec2d42004-10-21 10:44:08 +000066 .enable_dev = enable_dev,
Ronald G. Minnichb3da9702004-03-12 23:38:20 +000067};