blob: 0ee9850c2e873210bbce7d33ac629cb697753d13 [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>
Felix Helde75bac32018-07-06 23:47:58 +020018#include <superio/conf_mode.h>
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000019#include <pc80/keyboard.h>
Edward O'Callaghan49380b82014-06-16 16:48:44 +100020#include <stdlib.h>
21
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000022#include "fdc37n972.h"
23
Edward O'Callaghan2c9d2cf2014-10-27 23:29:29 +110024static void init(struct device *dev)
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000025{
Uwe Hermanna69d9782010-11-15 19:35:14 +000026 if (!dev->enabled)
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000027 return;
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000028
29 switch (dev->path.pnp.device) {
30 case FDC37N972_FDC: /* TODO. */
31 break;
32 case FDC37N972_PP: /* TODO. */
33 break;
34 case FDC37N972_KBDC:
Timothy Pearson448e3862015-11-24 14:12:01 -060035 pc_keyboard_init(NO_AUX_DEVICE);
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000036 break;
37 // [..] The rest: TODO
38 }
39}
40
41static struct device_operations ops = {
42 .read_resources = pnp_read_resources,
43 .set_resources = pnp_set_resources,
44 .enable_resources = pnp_enable_resources,
45 .enable = pnp_enable,
46 .init = init,
Felix Helde75bac32018-07-06 23:47:58 +020047 .ops_pnp_mode = &pnp_conf_mode_55_aa,
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000048};
49
50static struct pnp_info pnp_dev_info[] = {
Felix Heldb0d868e2018-07-06 23:39:00 +020051 { NULL, FDC37N972_SP1, PNP_IO0 | PNP_IRQ0, 0x07f8, },
52 { NULL, FDC37N972_SP2,
Felix Held01d2e462017-12-27 23:12:46 +010053 PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, 0x07f8, },
Felix Heldb0d868e2018-07-06 23:39:00 +020054 { NULL, FDC37N972_KBDC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, 0x07f8, 0x07f8, },
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000055};
56
57static void enable_dev(struct device *dev)
58{
Felix Heldb0d868e2018-07-06 23:39:00 +020059 pnp_enable_devices(dev, &ops, ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
Stefan Reinauer9e7a5d42010-05-16 14:08:32 +000060}
61
62struct chip_operations superio_smsc_fdc37n972_ops = {
63 CHIP_NAME("SMSC FDC37N972 Super I/O")
64 .enable_dev = enable_dev,
65};