Convert CONFIG_PCI_SCAN_SHOW to Kconfig
[platform/kernel/u-boot.git] / drivers / pci / pcie_intel_fpga.c
index a5ea488..60195cf 100644 (file)
@@ -9,7 +9,11 @@
 #include <common.h>
 #include <dm.h>
 #include <pci.h>
+#include <asm/global_data.h>
 #include <asm/io.h>
+#include <dm/device_compat.h>
+#include <linux/bitops.h>
+#include <linux/delay.h>
 
 #define RP_TX_REG0                     0x2000
 #define RP_TX_CNTRL                    0x2004
@@ -64,9 +68,6 @@
 #define IS_ROOT_PORT(pcie, bdf)                                \
                ((PCI_BUS(bdf) == pcie->first_busno) ? true : false)
 
-#define PCI_EXP_LNKSTA         18      /* Link Status */
-#define PCI_EXP_LNKSTA_DLLLA   0x2000  /* Data Link Layer Link Active */
-
 /**
  * struct intel_fpga_pcie - Intel FPGA PCIe controller state
  * @bus: Pointer to the PCI bus
@@ -226,7 +227,7 @@ static int tlp_cfg_dword_write(struct intel_fpga_pcie *pcie, pci_dev_t bdf,
        return tlp_read_packet(pcie, NULL);
 }
 
-int intel_fpga_rp_conf_addr(struct udevice *bus, pci_dev_t bdf,
+int intel_fpga_rp_conf_addr(const struct udevice *bus, pci_dev_t bdf,
                            uint offset, void **paddress)
 {
        struct intel_fpga_pcie *pcie = dev_get_priv(bus);
@@ -326,7 +327,7 @@ static int _pcie_intel_fpga_write_config(struct intel_fpga_pcie *pcie,
                                   byte_en, data);
 }
 
-static int pcie_intel_fpga_read_config(struct udevice *bus, pci_dev_t bdf,
+static int pcie_intel_fpga_read_config(const struct udevice *bus, pci_dev_t bdf,
                                       uint offset, ulong *valuep,
                                       enum pci_size_t size)
 {
@@ -369,7 +370,7 @@ static int pcie_intel_fpga_probe(struct udevice *dev)
        struct intel_fpga_pcie *pcie = dev_get_priv(dev);
 
        pcie->bus = pci_get_controller(dev);
-       pcie->first_busno = dev->seq;
+       pcie->first_busno = dev_seq(dev);
 
        /* clear all interrupts */
        cra_writel(pcie, P2A_INT_STS_ALL, P2A_INT_STATUS);
@@ -379,7 +380,7 @@ static int pcie_intel_fpga_probe(struct udevice *dev)
        return 0;
 }
 
-static int pcie_intel_fpga_ofdata_to_platdata(struct udevice *dev)
+static int pcie_intel_fpga_of_to_plat(struct udevice *dev)
 {
        struct intel_fpga_pcie *pcie = dev_get_priv(dev);
        struct fdt_resource reg_res;
@@ -428,7 +429,7 @@ U_BOOT_DRIVER(pcie_intel_fpga) = {
        .id                     = UCLASS_PCI,
        .of_match               = pcie_intel_fpga_ids,
        .ops                    = &pcie_intel_fpga_ops,
-       .ofdata_to_platdata     = pcie_intel_fpga_ofdata_to_platdata,
+       .of_to_plat     = pcie_intel_fpga_of_to_plat,
        .probe                  = pcie_intel_fpga_probe,
-       .priv_auto_alloc_size   = sizeof(struct intel_fpga_pcie),
+       .priv_auto      = sizeof(struct intel_fpga_pcie),
 };