2 * This file is part of the coreboot project.
4 * Copyright (C) 2007-2009 coresystems GmbH
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * Enable the serial devices on the VIA CX700
24 #include <arch/romcc_io.h>
26 static void cx700_writepnpaddr(u8 val)
32 static void cx700_writepnpdata(u8 val)
38 static void cx700_writesiobyte(u16 reg, u8 val)
43 static void cx700_writesioword(u16 reg, u16 val)
48 static void enable_cx700_serial(void)
55 // Set UART1 I/O Base Address
56 pci_write_config8(PCI_DEV(0, 17, 0), 0xb4, 0x7e);
59 pci_write_config8(PCI_DEV(0, 17, 0), 0xb0, 0x10);
62 cx700_writepnpaddr(0x87);
63 cx700_writepnpaddr(0x87);
64 // now go ahead and set up com1.
66 cx700_writepnpaddr(0x7);
67 cx700_writepnpdata(0x2);
69 cx700_writepnpaddr(0x30);
70 cx700_writepnpdata(0x1);
71 // serial port 1 base address (FEh)
72 cx700_writepnpaddr(0x60);
73 cx700_writepnpdata(0xfe);
74 // serial port 1 IRQ (04h)
75 cx700_writepnpaddr(0x70);
76 cx700_writepnpdata(0x4);
77 // serial port 1 control
78 cx700_writepnpaddr(0xf0);
79 cx700_writepnpdata(0x2);
81 cx700_writepnpaddr(0xaa);
83 // XXX This part should be fully taken care of by
84 // src/lib/uart8250.c:uart_init
86 // set up reg to set baud rate.
87 cx700_writesiobyte(0x3fb, 0x80);
89 cx700_writesioword(0x3f8, 1);
91 // cx700_writesioword(0x3f8, 12)
92 // now set no parity, one stop, 8 bits
93 cx700_writesiobyte(0x3fb, 3);
94 // now turn on RTS, DRT
95 cx700_writesiobyte(0x3fc, 3);
97 cx700_writesiobyte(0x3f9, 0xf);
98 // should be done. Dump a char for fun.
99 cx700_writesiobyte(0x3f8, 48);