Merge tag 'efi-2020-07-rc6' of https://gitlab.denx.de/u-boot/custodians/u-boot-efi
[oweals/u-boot.git] / board / freescale / common / ls102xa_stream_id.c
index 6154c9c45886cb1e2cef93f31c539b7a6d4dfcfb..a6ee87da9f550bac9caa0374ca6aff00f73e9853 100644 (file)
@@ -1,7 +1,6 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright 2014 Freescale Semiconductor
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -10,9 +9,27 @@
 
 void ls102xa_config_smmu_stream_id(struct smmu_stream_id *id, uint32_t num)
 {
-       uint32_t *scfg = (uint32_t *)CONFIG_SYS_FSL_SCFG_ADDR;
+       void *scfg = (void *)CONFIG_SYS_FSL_SCFG_ADDR;
        int i;
+       u32 icid;
 
-       for (i = 0; i < num; i++)
-               out_be32(scfg + id[i].offset, id[i].stream_id);
+       for (i = 0; i < num; i++) {
+               icid = (id[i].stream_id & 0xff) << 24;
+               out_be32((u32 *)(scfg + id[i].offset), icid);
+       }
+}
+
+void ls1021x_config_caam_stream_id(struct liodn_id_table *tbl, int size)
+{
+       int i;
+       u32 liodn;
+
+       for (i = 0; i < size; i++) {
+               if (tbl[i].num_ids == 2)
+                       liodn = (tbl[i].id[0] << 16) | tbl[i].id[1];
+               else
+                       liodn = tbl[i].id[0];
+
+               out_le32((u32 *)(tbl[i].reg_offset), liodn);
+       }
 }