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 #include <device/device.h>
9 #include <device/pnp.h>
10 #include <console/console.h>
14 #include <pc80/keyboard.h>
16 #include "w83627thg.h"
18 static void w83627thg_enter_ext_func_mode(device_t dev)
20 outb(0x87, dev->path.pnp.port);
21 outb(0x87, dev->path.pnp.port);
23 static void w83627thg_exit_ext_func_mode(device_t dev)
25 outb(0xaa, dev->path.pnp.port);
28 static void w83627thg_init(device_t dev)
30 struct superio_winbond_w83627thg_config *conf;
31 struct resource *res0, *res1;
32 /* Wishlist handle well known programming interfaces more
38 conf = dev->chip_info;
39 switch(dev->path.pnp.device) {
41 res0 = find_resource(dev, PNP_IDX_IO0);
42 init_uart8250(res0->base, &conf->com1);
45 res0 = find_resource(dev, PNP_IDX_IO0);
46 init_uart8250(res0->base, &conf->com2);
49 res0 = find_resource(dev, PNP_IDX_IO0);
50 res1 = find_resource(dev, PNP_IDX_IO1);
51 init_pc_keyboard(res0->base, res1->base, &conf->keyboard);
56 static void w83627thg_set_resources(device_t dev)
58 w83627thg_enter_ext_func_mode(dev);
59 pnp_set_resources(dev);
60 w83627thg_exit_ext_func_mode(dev);
63 static void w83627thg_enable_resources(device_t dev)
65 w83627thg_enter_ext_func_mode(dev);
66 pnp_enable_resources(dev);
67 w83627thg_exit_ext_func_mode(dev);
70 static void w83627thg_enable(device_t dev)
72 w83627thg_enter_ext_func_mode(dev);
74 w83627thg_exit_ext_func_mode(dev);
78 static struct device_operations ops = {
79 .read_resources = pnp_read_resources,
80 .set_resources = w83627thg_set_resources,
81 .enable_resources = w83627thg_enable_resources,
82 .enable = w83627thg_enable,
83 .init = w83627thg_init,
86 static struct pnp_info pnp_dev_info[] = {
87 { &ops, W83627THG_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
88 { &ops, W83627THG_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x07f8, 0}, },
89 { &ops, W83627THG_SP1, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
90 { &ops, W83627THG_SP2, PNP_IO0 | PNP_IRQ0, { 0x7f8, 0 }, },
92 { &ops, W83627THG_KBC, PNP_IO0 | PNP_IO1 | PNP_IRQ0 | PNP_IRQ1, { 0x7ff, 0 }, { 0x7ff, 0x4}, },
93 { &ops, W83627THG_GAME_MIDI_GPIO1, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0x7ff, 0 }, {0x7fe, 4} },
94 { &ops, W83627THG_GPIO2,},
95 { &ops, W83627THG_GPIO3,},
96 { &ops, W83627THG_ACPI, PNP_IRQ0, },
97 { &ops, W83627THG_HWM, PNP_IO0 | PNP_IRQ0, { 0xff8, 0 } },
100 static void enable_dev(device_t dev)
102 pnp_enable_devices(dev, &ops,
103 sizeof(pnp_dev_info)/sizeof(pnp_dev_info[0]), pnp_dev_info);
106 struct chip_operations superio_winbond_w83627thg_ops = {
107 CHIP_NAME("Winbond W83627THG Super I/O")
108 .enable_dev = enable_dev,