Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 1 | #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 | |
| 8 | static 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 Reinauer | fbce0ff | 2006-04-11 18:36:42 +0000 | [diff] [blame] | 26 | // dword |= (1<<27); /* Discard timer */ |
| 27 | dword &= ~(1<<27); /* Discard timer */ |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 28 | 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 Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 49 | static struct pci_operations lops_pci = { |
| 50 | .set_subsystem = 0, |
| 51 | }; |
| 52 | |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 53 | static 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 Schildt | ab327a3 | 2005-10-13 00:44:34 +0000 | [diff] [blame] | 59 | /* PCI Subordinate bus reset is not implemented */ |
Eric Biederman | dbec2d4 | 2004-10-21 10:44:08 +0000 | [diff] [blame] | 60 | .ops_pci = &lops_pci, |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 61 | }; |
| 62 | |
Stefan Reinauer | f1cf1f7 | 2007-10-24 09:08:58 +0000 | [diff] [blame] | 63 | static const struct pci_driver pci_driver __pci_driver = { |
Eric Biederman | 5cd8173 | 2004-03-11 15:01:31 +0000 | [diff] [blame] | 64 | .ops = &pci_ops, |
| 65 | .vendor = PCI_VENDOR_ID_AMD, |
| 66 | .device = PCI_DEVICE_ID_AMD_8111_PCI, |
| 67 | }; |