]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
pci: layerscape: Modify the EP and RC mode judge method
authorXiaowei Bao <xiaowei.bao@nxp.com>
Fri, 26 Oct 2018 01:56:24 +0000 (09:56 +0800)
committerYork Sun <york.sun@nxp.com>
Thu, 17 Jan 2019 21:17:28 +0000 (13:17 -0800)
Modify the RC and EP mode judge method, save the mode as a variable,
the variable will be used by other function.

Signed-off-by: Xiaowei Bao <xiaowei.bao@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
drivers/pci/pcie_layerscape.c
drivers/pci/pcie_layerscape.h

index 3b7377a6ebfe9afcdcbc419e75d3e1d381f46f85..17cba46ebeb77d069018a8cdb6b16e58b2f8b111 100644 (file)
@@ -438,9 +438,7 @@ static int ls_pcie_probe(struct udevice *dev)
        struct ls_pcie *pcie = dev_get_priv(dev);
        const void *fdt = gd->fdt_blob;
        int node = dev_of_offset(dev);
-       u8 header_type;
        u16 link_sta;
-       bool ep_mode;
        uint svr;
        int ret;
        fdt_size_t cfg_size;
@@ -524,15 +522,15 @@ static int ls_pcie_probe(struct udevice *dev)
              (unsigned long)pcie->ctrl, (unsigned long)pcie->cfg0,
              pcie->big_endian);
 
-       header_type = readb(pcie->dbi + PCI_HEADER_TYPE);
-       ep_mode = (header_type & 0x7f) == PCI_HEADER_TYPE_NORMAL;
-       printf("PCIe%u: %s %s", pcie->idx, dev->name,
-              ep_mode ? "Endpoint" : "Root Complex");
+       pcie->mode = readb(pcie->dbi + PCI_HEADER_TYPE) & 0x7f;
 
-       if (ep_mode)
-               ls_pcie_setup_ep(pcie);
-       else
-               ls_pcie_setup_ctrl(pcie);
+       if (pcie->mode == PCI_HEADER_TYPE_NORMAL) {
+               printf("PCIe%u: %s %s", pcie->idx, dev->name, "Endpoint");
+                       ls_pcie_setup_ep(pcie);
+       } else {
+               printf("PCIe%u: %s %s", pcie->idx, dev->name, "Root Complex");
+                       ls_pcie_setup_ctrl(pcie);
+       }
 
        if (!ls_pcie_link_up(pcie)) {
                /* Let the user know there's no PCIe link */
index 8770b44a1f0096c2247f884d6bd1eae6b64f2fe6..ddfbba6538420c2b0ce9eead908f9dd6b798734d 100644 (file)
@@ -144,6 +144,7 @@ struct ls_pcie {
        bool big_endian;
        bool enabled;
        int next_lut_index;
+       int mode;
 };
 
 extern struct list_head ls_pcie_list;