blob: a6ee87da9f550bac9caa0374ca6aff00f73e9853 [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
6#include <common.h>
7#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{
Vincent Silesea2acc02016-04-22 09:52:06 +020012 void *scfg = (void *)CONFIG_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}