[U-Boot] [RESEND PATCH 5/7 v5] pci/layerscape: add stream ID allocator

Stuart Yoder
2016-03-09T16:03:26Z

add a function to return the next available stream ID
for PCI

Signed-off-by: Stuart Yoder <stuart.yoder@nxp.com>
---
-v5: no change

drivers/pci/pcie_layerscape.c | 11 +++++++++++
1 file changed, 11 insertions(+)

diff --git a/drivers/pci/pcie_layerscape.c b/drivers/pci/pcie_layerscape.c
index 5cc6855..f3bf689 100644
--- a/drivers/pci/pcie_layerscape.c
+++ b/drivers/pci/pcie_layerscape.c
@@ -509,6 +509,17 @@ static void ls_pcie_lut_set_mapping(struct ls_pcie *pcie, int index, u32 devid,
writel((devid << 16), lut + PCIE_LUT_UDR(index));
writel(streamid | PCIE_LUT_ENABLE, lut + PCIE_LUT_LDR(index));
}
+
+/* returns the next available streamid */
+static u32 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 0xffffffff;
+
+ return next_stream_id++;