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

Stuart Yoder stuart.yoder at nxp.com
Wed Mar 9 17:03:26 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>
---
-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++;
+}
 #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