Remove superfluous Super I/O res0/res1 lines.
[coreboot.git] / src / superio / nsc / pc87351 / superio.c
1 /*
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.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
20  */
21
22 /*
23  * Richard A Smith
24  * I derived this code from the pc87360 device and removed the stuff the 87351
25  * dosen't do.
26  */
27
28 #include <arch/io.h>
29 #include <device/device.h>
30 #include <device/pnp.h>
31 #include <console/console.h>
32 #include <string.h>
33 #include <bitops.h>
34 #include <uart8250.h>
35 #include <pc80/keyboard.h>
36 #include <stdlib.h>
37 #include "chip.h"
38 #include "pc87351.h"
39
40 static void init(device_t dev)
41 {
42         struct superio_nsc_pc87351_config *conf;
43         struct resource *res0;
44         /* Wishlist handle well known programming interfaces more
45          * generically.
46          */
47         if (!dev->enabled) {
48                 return;
49         }
50         conf = dev->chip_info;
51         switch(dev->path.pnp.device) {
52         case PC87351_SP1:
53                 res0 = find_resource(dev, PNP_IDX_IO0);
54                 init_uart8250(res0->base, &conf->com1);
55                 break;
56         case PC87351_SP2:
57                 res0 = find_resource(dev, PNP_IDX_IO0);
58                 init_uart8250(res0->base, &conf->com2);
59                 break;
60         case PC87351_KBCK:
61                 pc_keyboard_init(&conf->keyboard);
62                 break;
63         }
64 }
65
66 static struct device_operations ops = {
67         .read_resources   = pnp_read_resources,
68         .set_resources    = pnp_set_resources,
69         .enable_resources = pnp_enable_resources,
70         .enable           = pnp_enable,
71         .init             = init,
72 };
73
74 static struct pnp_info pnp_dev_info[] = {
75         { &ops, PC87351_FDC,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07fa, 0}, },
76         { &ops, PC87351_PP,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x04f8, 0}, },
77         { &ops, PC87351_SP2,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0x7f8, 0 }, },
78         { &ops, PC87351_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
79         { &ops, PC87351_SWC,  PNP_IO0 | PNP_IRQ0, { 0xfff0, 0 }, },
80         { &ops, PC87351_KBCM, PNP_IRQ0 },
81         { &ops, PC87351_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7f8, 0 }, { 0x7f8, 0x4}, },
82         { &ops, PC87351_GPIO, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
83         { &ops, PC87351_FSD,  PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 } },
84 };
85
86 static void enable_dev(struct device *dev)
87 {
88         pnp_enable_devices(dev, &pnp_ops,
89                 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
90 }
91
92 struct chip_operations superio_nsc_pc87351_ops = {
93         CHIP_NAME("NSC PC87351 Super I/O")
94         .enable_dev = enable_dev,
95 };