1 /* Copyright 2000 AG Electronics Ltd. */
2 /* Copyright 2003-2004 Linux Networx */
4 By LYH change from PC87360 */
5 /* This code is distributed without warranty under the GPL v2 (see COPYING) */
8 * Adapted for the w83977 by rsmith <smithbone@gmail.com>
9 * This is mostly just a search and replace on the part type
10 * TODO: Actually see if all the sub functionis exist and are
15 #include <device/device.h>
16 #include <device/pnp.h>
17 #include <console/console.h>
21 #include <pc80/keyboard.h>
26 static void w83977tf_enter_ext_func_mode(device_t dev)
28 outb(0x87, dev->path.pnp.port);
29 outb(0x87, dev->path.pnp.port);
31 static void w83977tf_exit_ext_func_mode(device_t dev)
33 outb(0xaa, dev->path.pnp.port);
36 static void w83977tf_init(device_t dev)
38 struct superio_winbond_w83977tf_config *conf;
39 struct resource *res0, *res1;
40 /* Wishlist handle well known programming interfaces more
46 conf = dev->chip_info;
47 switch(dev->path.pnp.device) {
49 res0 = find_resource(dev, PNP_IDX_IO0);
50 init_uart8250(res0->base, &conf->com1);
53 res0 = find_resource(dev, PNP_IDX_IO0);
54 init_uart8250(res0->base, &conf->com2);
57 res0 = find_resource(dev, PNP_IDX_IO0);
58 res1 = find_resource(dev, PNP_IDX_IO1);
59 init_pc_keyboard(res0->base, res1->base, &conf->keyboard);
64 static void w83977tf_set_resources(device_t dev)
66 w83977tf_enter_ext_func_mode(dev);
67 pnp_set_resources(dev);
68 w83977tf_exit_ext_func_mode(dev);
71 static void w83977tf_enable_resources(device_t dev)
73 w83977tf_enter_ext_func_mode(dev);
74 pnp_enable_resources(dev);
75 w83977tf_exit_ext_func_mode(dev);
78 static void w83977tf_enable(device_t dev)
80 w83977tf_enter_ext_func_mode(dev);
82 w83977tf_exit_ext_func_mode(dev);
86 static struct device_operations ops = {
87 .read_resources = pnp_read_resources,
88 .set_resources = w83977tf_set_resources,
89 .enable_resources = w83977tf_enable_resources,
90 .enable = w83977tf_enable,
91 .init = w83977tf_init,
94 static struct pnp_info pnp_dev_info[] = {
95 { &ops, W83977TF_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
96 { &ops, W83977TF_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
97 { &ops, W83977TF_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
98 { &ops, W83977TF_SP2, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
100 { &ops, W83977TF_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
101 { &ops, W83977TF_CIR, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
102 { &ops, W83977TF_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
103 { &ops, W83977TF_ACPI, PNP_IRQ0, },
106 static void enable_dev(device_t dev)
108 pnp_enable_devices(dev, &ops,
109 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
112 struct chip_operations superio_winbond_w83977tf_ops = {
113 CHIP_NAME("Winbond W83977TF Super I/O")
114 .enable_dev = enable_dev,