- First stab at running linuxbios without the old static device tree.
[coreboot.git] / src / superio / NSC / pc97307 / superio.c
1 /* Copyright 2000  AG Electronics Ltd. */
2 /* This code is distributed without warranty under the GPL v2 (see COPYING) */
3
4 #include <arch/io.h>
5 #include <console/console.h>
6 #include "chip.h"
7
8 void pnp_output(char address, char data)
9 {
10         outb(address, PNP_CFGADDR);
11         outb(data, PNP_CFGDATA);
12 }
13
14 void sio_enable(struct chip *chip, enum chip_pass pass)
15 {
16
17         unsigned char reg;
18
19         switch (pass) {
20         case CONF_PASS_PRE_PCI:
21                 printk_info("Configuring PC97307...\n");
22
23                 /* Enable keyboard */
24                 pnp_output(0x07, 0x00);
25                 pnp_output(0x30, 0x00); /* Disable keyboard */
26                 pnp_output(0xf0, 0x40); /* Set KBC clock to 8 Mhz */
27                 pnp_output(0x30, 0x01); /* Enable keyboard */
28
29                 /* Enable mouse */
30                 pnp_output(0x07, 0x01);
31                 pnp_output(0x30, 0x01);
32
33                 /* Enable rtc */
34                 pnp_output(0x07, 0x02);
35                 pnp_output(0x30, 0x01);
36
37                 /* Enable fdc */
38                 pnp_output(0x07, 0x03);
39                 pnp_output(0x30, 0x01);
40
41                 /* Enable parallel port */
42                 pnp_output(0x07, 0x04);
43                 pnp_output(0x30, 0x01);
44
45                 /* Set up floppy in PS/2 mode */
46                 outb(0x09, SIO_CONFIG_RA);
47                 reg = inb(SIO_CONFIG_RD);
48                 reg = (reg & 0x3F) | 0x40;
49                 outb(reg, SIO_CONFIG_RD);
50                 outb(reg, SIO_CONFIG_RD);       /* Have to write twice to change! */
51                 break;
52         default:
53                 /* nothing yet */
54                 break;
55         }
56 }
57
58 struct chip_control superio_NSC_pc97307_control = {
59         enable: sio_enable,
60         name:   "NSC 97307"
61 };