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

Stuart Yoder stuart.yoder at nxp.com
Tue Mar 8 16:35:55 CET 2016


From: Stuart Yoder <stuart.yoder at nxp.com>

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

Signed-off-by: Stuart Yoder <stuart.yoder at nxp.com>
---
-v4: no changes

 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 8435446..4d24436 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++;
+}
 #endif
 
 int ls_pcie_init_ctrl(int busno, enum srds_prtcl dev, struct ls_pcie_info *info)
-- 
1.7.9.5



More information about the U-Boot mailing list