summaryrefslogtreecommitdiff
path: root/src/southbridge/via/vt8231/vt8231.c
blob: f943524665189cb7a03c55e821db4620bf8b82eb (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
62
63
64
65
66
67
68
69
70
71
72
#include <console/console.h>
#include <device/device.h>
#include <device/pci.h>
#include <device/pci_ops.h>
#include <device/pci_ids.h>

#include <pc80/mc146818rtc.h>
#include <pc80/keyboard.h>

#include "chip.h"

/* Base 8231 controller */
static device_t lpc_dev;

void hard_reset(void)
{
        printk(BIOS_ERR, "NO HARD RESET ON VT8231! FIX ME!\n");
}

static void keyboard_on(void)
{
	unsigned char regval;

	if (lpc_dev) {
		regval = pci_read_config8(lpc_dev, 0x51);
		regval |= 0x0f; 
		pci_write_config8(lpc_dev, 0x51, regval);
	}
	pc_keyboard_init(0);
}

static void com_port_on(void)
{
#if 0
	// enable com1 and com2. 
	enables = pci_read_config8(dev, 0x6e);
	
	/* 0x80 is enable com port b, 0x10 is to make it com2, 0x8
	 * is enable com port a as com1 kevinh/Ispiri - Old code
	 * thought 0x01 would make it com1, that was wrong enables =
	 * 0x80 | 0x10 | 0x8 ; pci_write_config8(dev, 0x6e,
	 * enables); // note: this is also a redo of some port of
	 * assembly, but we want everything up.
	 */

	/* set com1 to 115 kbaud not clear how to do this yet.
	 * forget it; done in assembly.
	 */
#endif
}

/* FixME: to be removed ? */
static void vt8231_enable(struct device *dev)
{
	struct southbridge_via_vt8231_config *conf = dev->chip_info;

	if (!lpc_dev) {
		/* the first time called, enable devices not on PCI bus
		 * FIXME: is that device struct there yet? */
		lpc_dev = dev_find_device(PCI_VENDOR_ID_VIA,
					  PCI_DEVICE_ID_VIA_8231, 0);
		if (conf->enable_keyboard)
			keyboard_on();
		if (conf->enable_com_ports)
			com_port_on();
	}
}

struct chip_operations southbridge_via_vt8231_ops = {
	CHIP_NAME("VIA VT8231 Southbridge")
	.enable_dev	= vt8231_enable,
};