Attached patch fixes at least one issue ;) During the PCI BAR sizing must be the
[coreboot.git] / src / southbridge / via / k8t890 / k8t890_bridge.c
1 /*
2  * This file is part of the coreboot project.
3  *
4  * Copyright (C) 2007 Rudolf Marek <r.marek@assembler.cz>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License v2 as published by
8  * the Free Software Foundation.
9  *
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.
14  *
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
18  */
19
20 #include <device/device.h>
21 #include <device/pci.h>
22 #include <device/pci_ids.h>
23 #include <console/console.h>
24
25 static void bridge_enable(struct device *dev)
26 {
27         u8 tmp;
28         print_debug("B188 device dump\n");
29         /* VIA recommends this, sorry no known info. */
30
31         writeback(dev, 0x40, 0x91);
32         writeback(dev, 0x41, 0x40);
33         writeback(dev, 0x43, 0x44);
34         writeback(dev, 0x44, 0x31);     /* K8M890 should have 0x35 datasheet 
35                                          * says it is reserved 
36                                          */
37         writeback(dev, 0x45, 0x3a);
38         writeback(dev, 0x46, 0x88);     /* PCI ID lo */
39         writeback(dev, 0x47, 0xb1);     /* PCI ID hi */
40
41         /* Bridge control, K8M890 bit 3 should be set to enable VGA on AGP 
42          * (Forward VGA compatible memory and I/O cycles )
43          */
44
45         writeback(dev, 0x3e, 0x16);
46         dump_south(dev);
47
48         /* disable I/O and memory decode, or it freezes PCI bus during BAR sizing */
49         tmp = pci_read_config8(dev, PCI_COMMAND);
50         tmp &= ~0x3;
51         pci_write_config8(dev, PCI_COMMAND, tmp);
52
53 }
54
55 static const struct device_operations bridge_ops = {
56         .read_resources         = pci_bus_read_resources,
57         .set_resources          = pci_dev_set_resources,
58         .enable_resources       = pci_bus_enable_resources,
59         .enable                 = bridge_enable,
60         .scan_bus               = pci_scan_bridge,
61         .reset_bus              = pci_bus_reset,
62         .ops_pci                = 0,
63 };
64
65 static const struct pci_driver northbridge_driver __pci_driver = {
66         .ops    = &bridge_ops,
67         .vendor = PCI_VENDOR_ID_VIA,
68         .device = PCI_DEVICE_ID_VIA_K8T890CE_BR,
69 };