imx: imx8qm/qxp: check whether m4 partition booted
[oweals/u-boot.git] / drivers / pci / pcie_layerscape_fixup.c
index e77404cd016314d082c3d6a1c89c4dbc9fb1da0b..ec6acbb138d960d0b3ace2018607a429d78659c8 100644 (file)
@@ -31,17 +31,6 @@ static int ls_pcie_next_lut_index(struct ls_pcie *pcie)
                return -ENOSPC;  /* LUT is full */
 }
 
-/* returns the next available streamid for pcie, -errno if failed */
-static int ls_pcie_next_streamid(void)
-{
-       static int next_stream_id = FSL_PEX_STREAM_ID_START;
-
-       if (next_stream_id > FSL_PEX_STREAM_ID_END)
-               return -EINVAL;
-
-       return next_stream_id++;
-}
-
 static void lut_writel(struct ls_pcie *pcie, unsigned int value,
                       unsigned int offset)
 {
@@ -192,10 +181,12 @@ static void fdt_fixup_pcie_ls(void *blob)
                        bus = bus->parent;
                pcie = dev_get_priv(bus);
 
-               streamid = ls_pcie_next_streamid();
+               streamid = pcie_next_streamid(pcie->stream_id_cur, pcie->idx);
                if (streamid < 0) {
                        debug("ERROR: no stream ids free\n");
                        continue;
+               } else {
+                       pcie->stream_id_cur++;
                }
 
                index = ls_pcie_next_lut_index(pcie);
@@ -216,6 +207,7 @@ static void fdt_fixup_pcie_ls(void *blob)
                fdt_pcie_set_iommu_map_entry_ls(blob, pcie, bdf >> 8,
                                                streamid);
        }
+       pcie_board_fix_fdt(blob);
 }
 #endif