2 * This file is part of the coreboot project.
4 * Copyright (C) 2008 VIA Technologies, Inc.
5 * (Written by Aaron Lwe <aaron.lwe@gmail.com> for VIA)
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 #include <device/pci_def.h>
24 #include <device/pci_ids.h>
26 #include <device/pnp_def.h>
27 #include <arch/romcc_io.h>
29 #include <console/console.h>
31 #include "northbridge/via/cn700/raminit.h"
32 #include "cpu/x86/bist.h"
33 #include "pc80/udelay_io.c"
34 #include "lib/delay.c"
35 #include "southbridge/via/vt8237r/early_smbus.c"
36 #include "southbridge/via/vt8235/early_serial.c"
39 static inline int spd_read_byte(unsigned device, unsigned address)
41 return smbus_read_byte(device, address);
44 #include "northbridge/via/cn700/raminit.c"
46 static void enable_mainboard_devices(void)
50 dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
51 PCI_DEVICE_ID_VIA_VT8237R_LPC), 0);
52 if (dev == PCI_DEV_INVALID)
53 die("Southbridge not found!!!\n");
55 /* bit=0 means enable function (per CX700 datasheet)
58 * 3 15.0 SATA and PATA
62 pci_write_config8(dev, 0x50, 0x80);
64 /* bit=1 means enable internal function (per CX700 datasheet)
66 * 2 Internal PS2 Mouse
67 * 1 Internal KBC Configuration
68 * 0 Internal Keyboard Controller
70 pci_write_config8(dev, 0x51, 0x1d);
73 static const struct mem_controller ctrl = {
80 .channel0 = { DIMM0 },
83 void main(unsigned long bist)
85 /* Enable multifunction for northbridge. */
86 pci_write_config8(ctrl.d0f0, 0x4f, 0x01);
88 enable_vt8235_serial();
92 report_bist_failure(bist);
93 enable_mainboard_devices();