1 /* Copyright 2000 AG Electronics Ltd. */
2 /* This code is distributed without warranty under the GPL v2 (see COPYING) */
5 #include <console/console.h>
6 #include <device/device.h>
7 #include <device/pnp.h>
12 static void init(device_t dev)
14 struct superio_nsc_pc97307_config *conf;
15 struct resource *res0, *res1;
20 conf = dev->chip_info;
21 switch(dev->path.u.pnp.device) {
23 res0 = find_resource(dev, PNP_IDX_IO0);
24 init_uart8250(res0->base, &conf->com1);
28 res0 = find_resource(dev, PNP_IDX_IO0);
29 init_uart8250(res0->base, &conf->com2);
34 pnp_set_logical_device(dev);
35 pnp_set_enable(dev, 0); /* Disable keyboard */
36 pnp_write_config(dev, 0xf0, 0x40); /* Set KBC clock to 8 Mhz */
37 pnp_set_enable(dev, 1); /* Enable keyboard */
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);
47 /* Set up floppy in PS/2 mode */
48 outb(0x09, SIO_CONFIG_RA);
49 reg = inb(SIO_CONFIG_RD);
50 reg = (reg & 0x3F) | 0x40;
51 outb(reg, SIO_CONFIG_RD);
52 outb(reg, SIO_CONFIG_RD); /* Have to write twice to change! */
60 static struct device_operations ops = {
61 .read_resources = pnp_read_resources,
62 .set_resources = pnp_set_resources,
63 .enable_resources = pnp_enable_resources,
68 static struct pnp_info pnp_dev_info[] = {
69 { &ops, PC97307_KBCK, PNP_IO0 | PNP_IO1 | PNP_IRQ0, { 0xffb, 0 }, { 0xffb, 0x4}, },
70 { &ops, PC97307_KBCM, PNP_IRQ0 },
71 { &ops, PC97307_RTC, PNP_IO0 | PNP_IRQ0, { 0xfffe, 0}, },
72 { &ops, PC97307_FDC, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0xfffa, 0}, },
73 { &ops, PC97307_PP, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0, { 0x03fc, 0}, },
74 { &ops, PC97307_SP2, PNP_IO0 | PNP_IRQ0 | PNP_DRQ0 | PNP_DRQ1, { 0xfff8, 0 }, },
75 { &ops, PC97307_SP1, PNP_IO0 | PNP_IRQ0, { 0xfff8, 0 }, },
76 { &ops, PC97307_GPIO, PNP_IO0, { 0xfff8, 0 } },
77 { &ops, PC97307_PM, PNP_IO0, { 0xfffe, 0 } },
80 static void enable_dev(struct device *dev)
82 pnp_enable_devices(dev, &ops,
83 ARRAY_SIZE(pnp_dev_info), pnp_dev_info);
86 struct chip_operations superio_nsc_pc97307_ops = {
87 CHIP_NAME("NSC PC97307 Super I/O")
88 .enable_dev = enable_dev,