sio-enable, because the init is not called. Without the init_keyboard,
[coreboot.git] / src / superio / winbond / w83627hf / 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 <device/chip.h>
11 #include <console/console.h>
12 #include <string.h>
13 #include <bitops.h>
14 #include <uart8250.h>
15 #include <pc80/keyboard.h>
16 #include "chip.h"
17 #include "w83627hf.h"
18
19 static void init(device_t dev)
20 {
21         struct superio_winbond_w83627hf_config *conf;
22         struct resource *res0, *res1;
23         /* Wishlist handle well known programming interfaces more
24          * generically.
25          */
26         if (!dev->enable) {
27                 return;
28         }
29         conf = dev->chip->chip_info;
30         switch(dev->path.u.pnp.device) {
31         case W83627HF_SP1: 
32                 res0 = get_resource(dev, PNP_IDX_IO0);
33                 init_uart8250(res0->base, &conf->com1);
34                 break;
35         case W83627HF_SP2:
36                 res0 = get_resource(dev, PNP_IDX_IO0);
37                 init_uart8250(res0->base, &conf->com2);
38                 break;
39         case W83627HF_KBC:
40                 res0 = get_resource(dev, PNP_IDX_IO0);
41                 res1 = get_resource(dev, PNP_IDX_IO1);
42                 init_pc_keyboard(res0->base, res1->base, &conf->keyboard);
43                 break;
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, W83627HF_FDC,  PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
57         { &ops, W83627HF_PP,   PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
58         { &ops, W83627HF_SP1,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
59         { &ops, W83627HF_SP2,  PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
60         // No 4 { 0,},
61         { &ops, W83627HF_KBC,  PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
62         { &ops, W83627HF_CIR, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
63         { &ops, W83627HF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
64         // { W83627HF_GPIO2,},
65         // { W83627HF_GPIO3,},
66         { &ops, W83627HF_ACPI, PNP_IRQ0,  },
67         { &ops, W83627HF_HWM,  PNP_IO0 | PNP_IRQ0, { 0xff8, 0 } },
68 };
69
70 static void enumerate(struct chip *chip)
71 {
72         pnp_enumerate(chip, sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), 
73                 &pnp_ops, pnp_dev_info);
74 }
75 static void sio_enable(struct chip *chip, enum chip_pass pass)
76 {
77
78         struct superio_winbond_w83627hf_config *conf = (struct superio_winbond_w83627hf_config *)chip->chip_info;
79
80         switch (pass) {
81         case CONF_PASS_PRE_CONSOLE:
82                 init_pc_keyboard(0x60, 0x64, &conf->keyboard);
83                 break;
84         default:
85                 /* nothing yet */
86                 break;
87         }
88 }
89
90
91 struct chip_control superio_winbond_w83627hf_control = {
92         .enable    = sio_enable,
93         .enumerate = enumerate,
94         .name      = "Winbond w83627hf"
95 };