2feeded66d61acfbedf431c098d2c122c96b1f2e
[coreboot.git] / src / southbridge / amd / amd8151 / amd8151_agp3.c
1 /*
2  *  Copyright 2003 Tyan
3  *
4  *      Author: Yinghai Lu
5  */
6 #include <console/console.h>
7 #include <device/device.h>
8 #include <device/pci.h>
9 #include <device/pci_ids.h>
10 #include <device/pci_ops.h>
11
12 static void agp3bridge_init(device_t dev)
13 {
14         uint32_t dword;
15         
16         dword = pci_read_config8(dev, 0x04);
17         dword |= 0x07;
18         pci_write_config8(dev, 0x04, dword);
19         
20         return;
21 }
22
23 static struct device_operations agp3bridge_ops  = {
24         .read_resources   = pci_bus_read_resources,
25         .set_resources    = pci_dev_set_resources,
26         .enable_resources = pci_bus_enable_resources,
27         .init             = agp3bridge_init,
28         .scan_bus         = pci_scan_bridge,
29 };
30
31 static struct pci_driver agp3bridge_driver __pci_driver = {
32         .ops    = &agp3bridge_ops,
33         .vendor = PCI_VENDOR_ID_AMD,
34         .device = 0x7455,
35 };
36
37
38 static void agp3dev_enable(device_t dev)
39 {
40         uint32_t value;
41         
42         //  AGP enable
43         value = pci_read_config32(dev, 0xa8);
44         value |= (1<<8);
45         pci_write_config32(dev, 0xa8, value);
46
47         //  linkA 8bit-->16bit
48         value = pci_read_config32(dev, 0xc4);
49         value |= (11<<24);
50         pci_write_config32(dev, 0xc4, value);
51
52         //  linkA 200-->600
53         value = pci_read_config32(dev, 0xcc);
54         value |= (4<<8);
55         pci_write_config32(dev, 0xcc, value);
56   
57
58         value = pci_read_config32(dev, 0x4);
59         value |= 6;
60         pci_write_config32(dev, 0x4, value);
61 }
62
63 static struct device_operations agp3dev_ops = {
64         .read_resources   = pci_dev_read_resources,
65         .set_resources    = pci_dev_set_resources,
66         .enable_resources = pci_dev_enable_resources,
67         .init     = 0,
68         .scan_bus = 0,
69         .enable   = agp3dev_enable,
70 };
71
72 static struct pci_driver agp3dev_driver __pci_driver = {
73         .ops    = &agp3dev_ops,
74         .vendor = PCI_VENDOR_ID_AMD,
75         .device = 0x7454,
76         
77 };