blob: e3edcea50682bc34bbd6f097cbe8cd677ea77161 [file] [log] [blame]
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +00001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2008 coresystems GmbH
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; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000014 */
15
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000016#include <device/device.h>
17#include <device/pnp.h>
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000018#include <pc80/keyboard.h>
Edward O'Callaghan49380b82014-06-16 16:48:44 +100019#include <stdlib.h>
20
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000021#include "fdc37n972.h"
22
Edward O'Callaghan2c9d2cf2014-10-27 23:29:29 +110023static void init(struct device *dev)
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000024{
Uwe Hermanna69d9782010-11-15 19:35:14 +000025 if (!dev->enabled)
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000026 return;
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000027
28 switch (dev->path.pnp.device) {
29 case FDC37N972_FDC: /* TODO. */
30 break;
31 case FDC37N972_PP: /* TODO. */
32 break;
33 case FDC37N972_KBDC:
Timothy Pearson448e3862015-11-24 14:12:01 -060034 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000035 break;
36 // [..] The rest: TODO
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, FDC37N972_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
50 { &ops, FDC37N972_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, 0x07f8, },
51 { &ops, FDC37N972_KBDC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, },
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000052};
53
54static void enable_dev(struct device *dev)
55{
56 pnp_enable_devices(dev, &pnp_ops,
57 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
58}
59
60struct chip_operations superio_smsc_fdc37n972_ops = {
61 CHIP_NAME("SMSC FDC37N972 Super I/O")
62 .enable_dev = enable_dev,
63};