aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci/pcie_layerscape_fixup_common.c
diff options
context:
space:
mode:
authorWasim Khan2020-01-06 12:05:59 +0000
committerPriyanka Jain2020-01-24 14:28:26 +0530
commitd20eb7a6db2e297cd16a85cdbef9c183abdade1c (patch)
tree45988ad3b5310d5f9ff182a11e6f550440d2ecaa /drivers/pci/pcie_layerscape_fixup_common.c
parent1185b229cca55a5ce3ee7bb35b203f788254f1a1 (diff)
pci: layerscape: Move streamId allocation to common device tree fixup
Move streamId allocation to layerscape common device tree fixup. Calculate streamId based on SoC variant. Signed-off-by: Wasim Khan <wasim.khan@nxp.com> Reviewed-by: Priyanka Jain <priyanka.jain@nxp.com>
Diffstat (limited to 'drivers/pci/pcie_layerscape_fixup_common.c')
-rw-r--r--drivers/pci/pcie_layerscape_fixup_common.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/pci/pcie_layerscape_fixup_common.c b/drivers/pci/pcie_layerscape_fixup_common.c
index b32236e5f85..828dfff03f4 100644
--- a/drivers/pci/pcie_layerscape_fixup_common.c
+++ b/drivers/pci/pcie_layerscape_fixup_common.c
@@ -25,3 +25,27 @@ void ft_pci_setup(void *blob, bd_t *bd)
#endif /* CONFIG_PCIE_LAYERSCAPE_GEN4 */
ft_pci_setup_ls(blob, bd);
}
+
+#if defined(CONFIG_FSL_LAYERSCAPE)
+#ifdef CONFIG_ARCH_LX2160A
+/* returns the next available streamid for pcie, -errno if failed */
+int pcie_next_streamid(int currentid, int idx)
+{
+ if (currentid > FSL_PEX_STREAM_ID_END)
+ return -EINVAL;
+
+ return currentid | ((idx + 1) << 11);
+}
+#else
+/* returns the next available streamid for pcie, -errno if failed */
+int pcie_next_streamid(int currentid, int idx)
+{
+ 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++;
+}
+#endif
+#endif /* CONFIG_FSL_LAYERSCAPE */