blob: 4f8f967d6101300caeb4f683245d287290ce1a94 [file] [log] [blame]
Uwe Hermann3a662632007-03-31 19:45:24 +00001/*
Stefan Reinauer7e61e452008-01-18 10:35:56 +00002 * This file is part of the coreboot project.
Uwe Hermann3a662632007-03-31 19:45:24 +00003 *
4 * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de>
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.
Uwe Hermann3a662632007-03-31 19:45:24 +000015 */
16
Uwe Hermann3a662632007-03-31 19:45:24 +000017#include <device/device.h>
18#include <device/pnp.h>
Uwe Hermann3a662632007-03-31 19:45:24 +000019#include <pc80/keyboard.h>
Carl-Daniel Hailfinger2ee67792008-10-01 12:52:52 +000020#include <stdlib.h>
Uwe Hermann3a662632007-03-31 19:45:24 +000021#include "pc87309.h"
22
Edward O'Callaghanf21bdc32014-10-21 07:43:41 +110023static void init(struct device *dev)
Uwe Hermann3a662632007-03-31 19:45:24 +000024{
Uwe Hermann3a662632007-03-31 19:45:24 +000025
Uwe Hermanna69d9782010-11-15 19:35:14 +000026 if (!dev->enabled)
Uwe Hermann3a662632007-03-31 19:45:24 +000027 return;
Uwe Hermanna69d9782010-11-15 19:35:14 +000028
Stefan Reinauer2b34db82009-02-28 20:10:20 +000029 switch (dev->path.pnp.device) {
Uwe Hermann3a662632007-03-31 19:45:24 +000030 case PC87309_KBCK:
Timothy Pearson448e3862015-11-24 14:12:01 -060031 pc_keyboard_init(NO_AUX_DEVICE);
Uwe Hermann3a662632007-03-31 19:45:24 +000032 break;
33 }
34}
35
36static struct device_operations ops = {
Uwe Hermanna69d9782010-11-15 19:35:14 +000037 .read_resources = pnp_read_resources,
38 .set_resources = pnp_set_resources,
Uwe Hermann3a662632007-03-31 19:45:24 +000039 .enable_resources = pnp_enable_resources,
Uwe Hermanna69d9782010-11-15 19:35:14 +000040 .enable = pnp_enable,
41 .init = init,
Uwe Hermann3a662632007-03-31 19:45:24 +000042};
43
44static struct pnp_info pnp_dev_info[] = {
Felix Heldd5292bf2019-01-16 13:23:35 +010045 { NULL, PC87309_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
46 { NULL, PC87309_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, 0x07f8, },
Felix Heldfaca0bc2017-12-27 22:51:29 +010047 { NULL, PC87309_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1,
48 0x07f8, },
49 { NULL, PC87309_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
Zheng Bao9db833b2009-12-28 09:59:44 +000050 /* TODO: PM. */
Felix Heldfaca0bc2017-12-27 22:51:29 +010051 { NULL, PC87309_KBCM, PNP_IRQ0, },
52 { NULL, PC87309_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x7f8, },
Uwe Hermann3a662632007-03-31 19:45:24 +000053};
54
55static void enable_dev(struct device *dev)
56{
Felix Heldfaca0bc2017-12-27 22:51:29 +010057 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Uwe Hermann3a662632007-03-31 19:45:24 +000058}
59
60struct chip_operations superio_nsc_pc87309_ops = {
61 CHIP_NAME("NSC PC87309 Super I/O")
62 .enable_dev = enable_dev,
63};