Commit 9603b729937c8a4882377dc46f4310bc7ad441bb

Authored by Hou Zhiqiang
Committed by Priyanka Jain
1 parent f8c9375955

pci: layerscape: Fixup PCIe EP mode DT nodes for LX2160A rev2

LX2160A rev2 uses different PCIe controller, so EP mode DT
nodes also need to be fixed up.

Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>

Showing 1 changed file with 26 additions and 0 deletions Side-by-side Diff

drivers/pci/pcie_layerscape_fixup_common.c
... ... @@ -40,6 +40,8 @@
40 40 { "config_axi_slave", "config" }
41 41 };
42 42 int off = -1, i;
  43 + const fdt32_t *prop;
  44 + u32 ob_wins, ib_wins;
43 45  
44 46 off = fdt_node_offset_by_compatible(fdt, -1, "fsl,lx2160a-pcie");
45 47 while (off != -FDT_ERR_NOTFOUND) {
... ... @@ -85,6 +87,30 @@
85 87 off = fdt_node_offset_by_compatible(fdt, off,
86 88 "fsl,lx2160a-pcie");
87 89 }
  90 +
  91 + /* Fixup PCIe EP nodes */
  92 + off = -1;
  93 + off = fdt_node_offset_by_compatible(fdt, off, "fsl,lx2160a-pcie-ep");
  94 + while (off != -FDT_ERR_NOTFOUND) {
  95 + fdt_setprop_string(fdt, off, "compatible",
  96 + "fsl,lx2160ar2-pcie-ep");
  97 + prop = fdt_getprop(fdt, off, "apio-wins", NULL);
  98 + if (!prop) {
  99 + printf("%s: Failed to fixup PCIe EP node @0x%x\n",
  100 + __func__, off);
  101 + continue;
  102 + }
  103 +
  104 + ob_wins = fdt32_to_cpu(*prop);
  105 + ib_wins = (ob_wins == 256) ? 24 : 8;
  106 + fdt_setprop_u32(fdt, off, "num-ib-windows", ib_wins);
  107 + fdt_setprop_u32(fdt, off, "num-ob-windows", ob_wins);
  108 + fdt_delprop(fdt, off, "apio-wins");
  109 +
  110 + off = fdt_node_offset_by_compatible(fdt, off,
  111 + "fsl,lx2160a-pcie-ep");
  112 + }
  113 +
88 114 return 0;
89 115 }
90 116