2 * This file is part of the coreboot project.
4 * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
5 * Copyright (C) 2011 Alexandru Gagniuc <mr.nuke.me@gmail.com>
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 <device/device.h>
21 #include <device/pci.h>
22 #include <device/pci_ids.h>
23 #include <console/console.h>
26 static void bridge_enable(struct device *dev)
29 print_debug("B188 device dump\n");
31 /* VIA recommends this, sorry no known info. */
33 writeback(dev, 0x40, 0x91);
34 writeback(dev, 0x41, 0x40);
35 writeback(dev, 0x43, 0x44);
36 #if CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8T800_OLD
37 writeback(dev, 0x42, 0x80);
38 writeback(dev, 0x44, 0x35);
40 writeback(dev, 0x44, 0x31); /* K8M890 should have 0x35 datasheet
44 writeback(dev, 0x45, 0x3a);
45 writeback(dev, 0x46, 0x88); /* PCI ID lo */
46 writeback(dev, 0x47, 0xb1); /* PCI ID hi */
48 /* Bridge control, K8M890 bit 3 should be set to enable VGA on AGP
49 * (Forward VGA compatible memory and I/O cycles )
52 #if CONFIG_SOUTHBRIDGE_VIA_SUBTYPE_K8T800_OLD
53 writeback(dev, 0x3e, 0x0a);
55 writeback(dev, 0x3e, 0x16);
59 /* disable I/O and memory decode, or it freezes PCI bus during BAR sizing */
60 tmp = pci_read_config8(dev, PCI_COMMAND);
62 pci_write_config8(dev, PCI_COMMAND, tmp);
66 static const struct device_operations bridge_ops = {
67 .read_resources = pci_bus_read_resources,
68 .set_resources = pci_dev_set_resources,
69 .enable_resources = pci_bus_enable_resources,
70 .enable = bridge_enable,
71 .scan_bus = pci_scan_bridge,
72 .reset_bus = pci_bus_reset,
77 * K8T890 and K8T800 both use device B188 as the bridge, so no need to
78 * add a separate driver
80 static const struct pci_driver northbridge_driver_890 __pci_driver = {
82 .vendor = PCI_VENDOR_ID_VIA,
83 .device = PCI_DEVICE_ID_VIA_K8T890CE_BR,