blob: bf76274c43ca4a5399aff6ececb3071a32235089 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Xiubo Li03d40aa2014-11-21 17:40:59 +08002/*
3 * Copyright 2014 Freescale Semiconductor
Xiubo Li03d40aa2014-11-21 17:40:59 +08004 */
5
Tom Rinidec7ea02024-05-20 13:35:03 -06006#include <config.h>
Xiubo Li03d40aa2014-11-21 17:40:59 +08007#include <asm/io.h>
8#include <asm/arch/ls102xa_stream_id.h>
9
10void ls102xa_config_smmu_stream_id(struct smmu_stream_id *id, uint32_t num)
11{
Tom Rini376b88a2022-10-28 20:27:13 -040012 void *scfg = (void *)CFG_SYS_FSL_SCFG_ADDR;
Xiubo Li03d40aa2014-11-21 17:40:59 +080013 int i;
Vincent Silesd097bd92016-05-18 14:41:14 +020014 u32 icid;
Xiubo Li03d40aa2014-11-21 17:40:59 +080015
Vincent Silesd097bd92016-05-18 14:41:14 +020016 for (i = 0; i < num; i++) {
17 icid = (id[i].stream_id & 0xff) << 24;
18 out_be32((u32 *)(scfg + id[i].offset), icid);
19 }
Xiubo Li03d40aa2014-11-21 17:40:59 +080020}
Alison Wanga825bb32015-01-16 17:21:34 +080021
22void ls1021x_config_caam_stream_id(struct liodn_id_table *tbl, int size)
23{
24 int i;
25 u32 liodn;
26
27 for (i = 0; i < size; i++) {
28 if (tbl[i].num_ids == 2)
29 liodn = (tbl[i].id[0] << 16) | tbl[i].id[1];
30 else
31 liodn = tbl[i].id[0];
32
Vincent Siles699b9f12016-04-22 09:52:07 +020033 out_le32((u32 *)(tbl[i].reg_offset), liodn);
Alison Wanga825bb32015-01-16 17:21:34 +080034 }
35}