summaryrefslogtreecommitdiff
path: root/src/superio/NSC/pc97307/superio.c
blob: 2fb62e1c937beb9bd67e5cd01b0019884885ab8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/* Copyright 2000  AG Electronics Ltd. */
/* This code is distributed without warranty under the GPL v2 (see COPYING) */

#include <arch/io.h>
#include <console/console.h>
#include "chip.h"

void pnp_output(char address, char data)
{
	outb(address, PNP_CFGADDR);
	outb(data, PNP_CFGDATA);
}

void sio_enable(struct chip *chip, enum chip_pass pass)
{

	unsigned char reg;

	switch (pass) {
	case CONF_PASS_PRE_PCI:
		printk_info("Configuring PC97307...\n");

		/* Enable keyboard */
		pnp_output(0x07, 0x00);
		pnp_output(0x30, 0x00); /* Disable keyboard */
		pnp_output(0xf0, 0x40); /* Set KBC clock to 8 Mhz */
		pnp_output(0x30, 0x01); /* Enable keyboard */

		/* Enable mouse */
		pnp_output(0x07, 0x01);
		pnp_output(0x30, 0x01);

		/* Enable rtc */
		pnp_output(0x07, 0x02);
		pnp_output(0x30, 0x01);

		/* Enable fdc */
		pnp_output(0x07, 0x03);
		pnp_output(0x30, 0x01);

		/* Enable parallel port */
		pnp_output(0x07, 0x04);
		pnp_output(0x30, 0x01);

		/* Set up floppy in PS/2 mode */
		outb(0x09, SIO_CONFIG_RA);
		reg = inb(SIO_CONFIG_RD);
		reg = (reg & 0x3F) | 0x40;
		outb(reg, SIO_CONFIG_RD);
		outb(reg, SIO_CONFIG_RD);       /* Have to write twice to change! */
		break;
	default:
		/* nothing yet */
		break;
	}
}

struct chip_control superio_NSC_pc97307_control = {
	enable: sio_enable,
	name:   "NSC 97307"
};