C and other Super I/O cosmetic fixes.
[coreboot.git] / src / superio / smsc / fdc37n972 / fdc37n972.c
1 /*
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.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
18  */
19
20 #include <stdlib.h>
21 #include <device/device.h>
22 #include <device/pnp.h>
23 #include <uart8250.h>
24 #include <pc80/keyboard.h>
25 #include "chip.h"
26 #include "fdc37n972.h"
27
28 static void init(device_t dev)
29 {
30         struct superio_smsc_fdc37n972_config *conf = dev->chip_info;
31
32         if (!dev->enabled)
33                 return;
34
35         switch (dev->path.pnp.device) {
36         case FDC37N972_FDC: /* TODO. */
37                 break;
38         case FDC37N972_PP: /* TODO. */
39                 break;
40         case FDC37N972_KBDC:
41                 pc_keyboard_init(&conf->keyboard);
42                 break;
43         // [..] The rest: TODO
44         }
45 }
46
47 static struct device_operations ops = {
48         .read_resources   = pnp_read_resources,
49         .set_resources    = pnp_set_resources,
50         .enable_resources = pnp_enable_resources,
51         .enable           = pnp_enable,
52         .init             = init,
53 };
54
55 static struct pnp_info pnp_dev_info[] = {
56         { &ops, FDC37N972_SP1,  PNP_IO0 | PNP_IRQ0, {0x07f8, 0}, },
57         { &ops, FDC37N972_SP2,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, {0x07f8, 0}, },
58         { &ops, FDC37N972_KBDC, PNP_IO0 | PNP_IO1 | PNP_IRQ0, {0x07f8, 0}, {0x07f8, 4}, },
59 };
60
61 static void enable_dev(struct device *dev)
62 {
63         pnp_enable_devices(dev, &pnp_ops,
64                 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
65 }
66
67 struct chip_operations superio_smsc_fdc37n972_ops = {
68         CHIP_NAME("SMSC FDC37N972 Super I/O")
69         .enable_dev = enable_dev,
70 };
71