blob: f882490e8b85da6e92231a0e7dd2efa76e08bfc6 [file] [log] [blame]
Eric Biederman5cd81732004-03-11 15:01:31 +00001#include <console/console.h>
2#include <device/device.h>
3#include <device/pci.h>
4#include <device/pci_ids.h>
5#include <device/pci_ops.h>
6#include "amd8111.h"
7
8static void pci_init(struct device *dev)
9{
10
11 /* Enable pci error detecting */
12 uint32_t dword;
13
14 /* System error enable */
15 dword = pci_read_config32(dev, 0x04);
16 dword |= (1<<8); /* System error enable */
17 dword |= (7<<28); /* Clear possible errors */
18 pci_write_config32(dev, 0x04, dword);
19
20 /* System,Parity,timer,and abort error enable */
21 dword = pci_read_config32(dev, 0x3c);
22 dword |= (1<<16); /* Parity */
23 dword |= (1<<17); /* System */
24 dword |= (1<<21); /* Master abort */
25// dword &= ~(1<<21); /* Master abort */
Stefan Reinauerfbce0ff2006-04-11 18:36:42 +000026// dword |= (1<<27); /* Discard timer */
27 dword &= ~(1<<27); /* Discard timer */
Eric Biederman5cd81732004-03-11 15:01:31 +000028 dword |= (1<<26); /* DTSTAT error clear */
29 pci_write_config32(dev, 0x3c, dword);
30
31 /* CRC flood enable */
32 dword = pci_read_config32(dev, 0xc4);
33 dword |= (1<<1); /* CRC Flood enable */
34 dword |= (1<<8); /* Clear any CRC errors */
35 dword |= (1<<4); /* Clear any LKFAIL errors */
36 pci_write_config32(dev, 0xc4, dword);
37
38 /* Clear possible errors */
39 dword = pci_read_config32(dev, 0x1c);
40 dword |= (1<<27); /* STA */
41 dword |= (1<<28); /* RTA */
42 dword |= (1<<29); /* RMA */
43 dword |= (1<<30); /* RSE */
44 dword |= (1<<31); /* DPE */
45 dword |= (1<<24); /* MDPE */
46 pci_write_config32(dev, 0x1c, dword);
47}
48
Eric Biedermandbec2d42004-10-21 10:44:08 +000049static struct pci_operations lops_pci = {
50 .set_subsystem = 0,
51};
52
Eric Biederman5cd81732004-03-11 15:01:31 +000053static struct device_operations pci_ops = {
54 .read_resources = pci_bus_read_resources,
55 .set_resources = pci_dev_set_resources,
56 .enable_resources = pci_bus_enable_resources,
57 .init = pci_init,
58 .scan_bus = pci_scan_bridge,
Jason Schildtab327a32005-10-13 00:44:34 +000059 /* PCI Subordinate bus reset is not implemented */
Eric Biedermandbec2d42004-10-21 10:44:08 +000060 .ops_pci = &lops_pci,
Eric Biederman5cd81732004-03-11 15:01:31 +000061};
62
Stefan Reinauerf1cf1f72007-10-24 09:08:58 +000063static const struct pci_driver pci_driver __pci_driver = {
Eric Biederman5cd81732004-03-11 15:01:31 +000064 .ops = &pci_ops,
65 .vendor = PCI_VENDOR_ID_AMD,
66 .device = PCI_DEVICE_ID_AMD_8111_PCI,
67};