2 * Enable the serial evices on the VIA
6 /* The base address is 0x15c, 0x2e, depending on config bytes */
9 #define SIO_DATA SIO_BASE+1
11 static void vt8231_writesuper(uint8_t reg, uint8_t val)
17 static void vt8231_writesiobyte(uint16_t reg, uint8_t val)
22 static void vt8231_writesioword(uint16_t reg, uint16_t val)
28 /* regs we use: 85, and the southbridge devfn is defined by the
32 static void enable_vt8231_serial(void)
37 dev = pci_locate_device(PCI_ID(0x1106,0x8231), 0);
39 if (dev == PCI_DEV_INVALID) {
41 die("Serial controller not found\n");
44 /* first, you have to enable the superio and superio config.
47 c = pci_read_config8(dev, 0x50);
49 pci_write_config8(dev, 0x50, c);
51 // now go ahead and set up com1.
53 vt8231_writesuper(0xf4, 0xfe);
55 vt8231_writesuper(0xf2, 7);
56 // That's it for the sio stuff.
57 // movl $SUPERIOCONFIG, %eax
59 // PCI_WRITE_CONFIG_BYTE
60 // set up reg to set baud rate.
61 vt8231_writesiobyte(0x3fb, 0x80);
63 vt8231_writesioword(0x3f8, 1);
65 // WRITESIOWORD(0x3f8, 12)
66 // now set no parity, one stop, 8 bits
67 vt8231_writesiobyte(0x3fb, 3);
68 // now turn on RTS, DRT
69 vt8231_writesiobyte(0x3fc, 3);
71 vt8231_writesiobyte(0x3f9, 0xf);
72 // should be done. Dump a char for fun.
73 vt8231_writesiobyte(0x3f8, 48);