2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
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
20 #include <console/console.h>
21 #include <device/device.h>
22 #include <device/pci.h>
23 #include <device/pci_ids.h>
28 * Datasheet: http://www.via.com.tw/en/downloads/datasheets/chipsets/
29 * VT8237R_SouthBridge_Revision2.06_Lead-Free.zip
32 #if CONFIG_DEFAULT_CONSOLE_LOGLEVEL > 7
33 void writeback(struct device *dev, u16 where, u8 what)
37 pci_write_config8(dev, where, what);
38 regval = pci_read_config8(dev, where);
41 print_debug("Writeback to ");
42 print_debug_hex8(where);
43 print_debug(" failed ");
44 print_debug_hex8(regval);
49 void writeback(struct device *dev, u16 where, u8 what)
51 pci_write_config8(dev, where, what);
55 void dump_south(device_t dev)
59 for (i = 0; i < 256; i += 16) {
60 printk(BIOS_DEBUG, "%02x: ", i);
61 for (j = 0; j < 16; j++)
62 printk(BIOS_DEBUG, "%02x ", pci_read_config8(dev, i + j));
63 printk(BIOS_DEBUG, "\n");
67 static void vt8237r_enable(struct device *dev)
70 struct southbridge_via_vt8237r_config *sb =
71 (struct southbridge_via_vt8237r_config *)dev->chip_info;
73 if (dev->path.type == DEVICE_PATH_PCI) {
74 vid = pci_read_config16(dev, PCI_VENDOR_ID);
75 did = pci_read_config16(dev, PCI_DEVICE_ID);
76 if (vid == PCI_VENDOR_ID_VIA &&
77 (did == PCI_DEVICE_ID_VIA_VT8237R_LPC ||
78 did == PCI_DEVICE_ID_VIA_VT8237A_LPC ||
79 did == PCI_DEVICE_ID_VIA_VT8237S_LPC)) {
80 pci_write_config8(dev, 0x50, sb->fn_ctrl_lo);
81 pci_write_config8(dev, 0x51, sb->fn_ctrl_hi);
85 /* TODO: If SATA is disabled, move IDE to fn0 to conform PCI specs. */
88 struct chip_operations southbridge_via_vt8237r_ops = {
89 CHIP_NAME("VIA VT8237R Southbridge")
90 .enable_dev = vt8237r_enable,