pci: Add defines for normal and subtractive PCI bridges
[platform/kernel/u-boot.git] / drivers / pci / pcie_fsl.c
index 3c2a2a4..f5ba349 100644 (file)
@@ -58,8 +58,9 @@ static int fsl_pcie_read_config(const struct udevice *bus, pci_dev_t bdf,
                return 0;
        }
 
-       bdf = bdf - PCI_BDF(dev_seq(bus), 0, 0);
-       val = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000;
+       val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus),
+                                   PCI_DEV(bdf), PCI_FUNC(bdf),
+                                   offset);
        out_be32(&regs->cfg_addr, val);
 
        sync();
@@ -94,8 +95,9 @@ static int fsl_pcie_write_config(struct udevice *bus, pci_dev_t bdf,
        if (fsl_pcie_addr_valid(pcie, bdf))
                return 0;
 
-       bdf = bdf - PCI_BDF(dev_seq(bus), 0, 0);
-       val = bdf | (offset & 0xfc) | ((offset & 0xf00) << 16) | 0x80000000;
+       val = PCI_CONF1_EXT_ADDRESS(PCI_BUS(bdf) - dev_seq(bus),
+                                   PCI_DEV(bdf), PCI_FUNC(bdf),
+                                   offset);
        out_be32(&regs->cfg_addr, val);
 
        sync();
@@ -530,7 +532,7 @@ static int fsl_pcie_fixup_classcode(struct fsl_pcie *pcie)
 
        fsl_pcie_hose_read_config_dword(pcie, classcode_reg, &val);
        val &= 0xff;
-       val |= PCI_CLASS_BRIDGE_PCI << 16;
+       val |= PCI_CLASS_BRIDGE_PCI_NORMAL << 8;
        fsl_pcie_hose_write_config_dword(pcie, classcode_reg, val);
 
        if (pcie->block_rev >= PEX_IP_BLK_REV_3_0)