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

Stuart Yoder stuart.yoder at nxp.com
Fri Feb 26 00:06:21 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>
---
-v2
  -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 6886488..f96a08c 100644
--- a/drivers/pci/pcie_layerscape.c
+++ b/drivers/pci/pcie_layerscape.c
@@ -517,6 +517,17 @@ static void ls_pcie_lut_set_mapping(struct ls_pcie *pcie, int index, u32 devid,
 	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 -1;
+
+	return next_stream_id++;
+}
+
 int ls_pcie_init_ctrl(int busno, enum srds_prtcl dev, struct ls_pcie_info *info)
 {
 	struct ls_pcie *pcie;
-- 
1.7.9.5



More information about the U-Boot mailing list