- Bump the LinuxBIOS major version
[coreboot.git] / src / superio / winbond / w83627thf / superio.c
1 /* Copyright 2000  AG Electronics Ltd. */
2 /* Copyright 2003-2004 Linux Networx */
3 /* Copyright 2004 Tyan 
4    By LYH change from PC87360 */
5 /* This code is distributed without warranty under the GPL v2 (see COPYING) */
6
7 #include <arch/io.h>
8 #include <device/device.h>
9 #include <device/pnp.h>
10 #include <console/console.h>
11 #include <string.h>
12 #include <bitops.h>
13 #include <uart8250.h>
14 #include <pc80/keyboard.h>
15 #include "chip.h"
16 #include "w83627thf.h"
17
18 static void init(device_t dev)
19 {
20         struct superio_winbond_w83627thf_config *conf;
21         struct resource *res0, *res1;
22         /* Wishlist handle well known programming interfaces more
23          * generically.
24          */
25         if (!dev->enable) {
26                 return;
27         }
28         conf = dev->chip_info;
29         switch(dev->path.u.pnp.device) {
30         case W83627HF_SP1: 
31                 res0 = find_resource(dev, PNP_IDX_IO0);
32                 init_uart8250(res0->base, &conf->com1);
33                 break;
34         case W83627HF_SP2:
35                 res0 = find_resource(dev, PNP_IDX_IO0);
36                 init_uart8250(res0->base, &conf->com2);
37                 break;
38         case W83627HF_KBC:
39                 res0 = find_resource(dev, PNP_IDX_IO0);
40                 res1 = find_resource(dev, PNP_IDX_IO1);
41                 init_pc_keyboard(res0->base, res1->base, &conf->keyboard);
42                 break;
43         }
44 }
45
46 static struct device_operations ops = {
47         .read_resources   = pnp_read_resources,
48         .set_resources    = pnp_set_resources,
49         .enable_resources = pnp_enable_resources,
50         .enable           = pnp_enable,
51         .init             = init,
52 };
53
54 static struct pnp_info pnp_dev_info[] = {
55         { &ops, W83627HF_FDC,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
56         { &ops, W83627HF_PP,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
57         { &ops, W83627HF_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
58         { &ops, W83627HF_SP2,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
59         // No 4 { 0,},
60         { &ops, W83627HF_KBC,  PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
61         { &ops, W83627HF_CIR, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
62         { &ops, W83627HF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
63         // { W83627HF_GPIO2,},
64         // { W83627HF_GPIO3,},
65         { &ops, W83627HF_ACPI, PNP_IRQ0,  },
66         { &ops, W83627HF_HWM,  PNP_IO0 | PNP_IRQ0, { 0xff8, 0 } },
67 };
68
69 static void enable_dev(device_t dev)
70 {
71         pnp_enable_device(dev, &pnp_ops,
72                 sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info);
73 }
74
75 struct chip_operations superio_winbond_w83627thf_control = {
76         .enable_dev = enable_dev,
77         .name       = "Winbond w83627thf"
78 };