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 <device/pciexp.h>
11 typedef struct northbridge_intel_e7520_config config_t;
13 static void pcie_init(struct device *dev)
17 /* Get the chip configuration */
18 config = dev->chip_info;
20 if(config->intrline) {
21 pci_write_config32(dev, 0x3c, config->intrline);
26 static unsigned int pcie_scan_bridge(struct device *dev, unsigned int max)
32 val = pci_read_config16(dev, 0x76);
33 printk(BIOS_DEBUG, "pcie porta 0x76: %02x\n", val);
34 if((val & (1<<10) )&&(!flag)) { /* training error */
35 ctl = pci_read_config16(dev, 0x74);
36 pci_write_config16(dev, 0x74, (ctl | (1<<5)));
37 val = pci_read_config16(dev, 0x76);
38 printk(BIOS_DEBUG, "pcie porta reset 0x76: %02x\n", val);
42 } while ( val & (3<<10) );
43 return pciexp_scan_bridge(dev, max);
46 static struct device_operations pcie_ops = {
47 .read_resources = pci_bus_read_resources,
48 .set_resources = pci_dev_set_resources,
49 .enable_resources = pci_bus_enable_resources,
51 .scan_bus = pcie_scan_bridge,
52 .reset_bus = pci_bus_reset,
56 static const struct pci_driver pci_driver __pci_driver = {
58 .vendor = PCI_VENDOR_ID_INTEL,
59 .device = PCI_DEVICE_ID_INTEL_PCIE_PA,