1 /* SPDX-License-Identifier: GPL-2.0+ */ 2 /* 3 * Copyright 2014 Freescale Semiconductor, Inc. 4 */ 5 6 #ifndef __FSL_LS102XA_STREAM_ID_H_ 7 #define __FSL_LS102XA_STREAM_ID_H_ 8 9 #include <fsl_sec.h> 10 11 #define SET_LIODN_ENTRY_1(name, idA, off, compatoff) \ 12 { .compat = name, \ 13 .id = { idA }, .num_ids = 1, \ 14 .reg_offset = off + CONFIG_SYS_IMMR, \ 15 .compat_offset = compatoff + CONFIG_SYS_CCSRBAR_PHYS, \ 16 } 17 18 #define SET_LIODN_ENTRY_2(name, idA, idB, off, compatoff) \ 19 { .compat = name, \ 20 .id = { idA, idB }, .num_ids = 2, \ 21 .reg_offset = off + CONFIG_SYS_IMMR, \ 22 .compat_offset = compatoff + CONFIG_SYS_CCSRBAR_PHYS, \ 23 } 24 25 /* 26 * handle both old and new versioned SEC properties: 27 * "fsl,secX.Y" became "fsl,sec-vX.Y" during development 28 */ 29 #define SET_SEC_JR_LIODN_ENTRY(jrnum, liodnA, liodnB) \ 30 SET_LIODN_ENTRY_2("fsl,sec4.0-job-ring", liodnA, liodnB, \ 31 offsetof(ccsr_sec_t, jrliodnr[jrnum].ls) + \ 32 CONFIG_SYS_FSL_SEC_OFFSET, \ 33 CONFIG_SYS_FSL_SEC_OFFSET + 0x1000 + 0x1000 * jrnum), \ 34 SET_LIODN_ENTRY_2("fsl,sec-v4.0-job-ring", liodnA, liodnB,\ 35 offsetof(ccsr_sec_t, jrliodnr[jrnum].ls) + \ 36 CONFIG_SYS_FSL_SEC_OFFSET, \ 37 CONFIG_SYS_FSL_SEC_OFFSET + 0x1000 + 0x1000 * jrnum) 38 39 /* This is a bit evil since we treat rtic param as both a string & hex value */ 40 #define SET_SEC_RTIC_LIODN_ENTRY(rtic, liodnA) \ 41 SET_LIODN_ENTRY_1("fsl,sec4.0-rtic-memory", \ 42 liodnA, \ 43 offsetof(ccsr_sec_t, rticliodnr[0x##rtic-0xa].ls) + \ 44 CONFIG_SYS_FSL_SEC_OFFSET, \ 45 CONFIG_SYS_FSL_SEC_OFFSET + 0x6100 + 0x20 * (0x##rtic-0xa)), \ 46 SET_LIODN_ENTRY_1("fsl,sec-v4.0-rtic-memory", \ 47 liodnA, \ 48 offsetof(ccsr_sec_t, rticliodnr[0x##rtic-0xa].ls) + \ 49 CONFIG_SYS_FSL_SEC_OFFSET, \ 50 CONFIG_SYS_FSL_SEC_OFFSET + 0x6100 + 0x20 * (0x##rtic-0xa)) 51 52 #define SET_SEC_DECO_LIODN_ENTRY(num, liodnA, liodnB) \ 53 SET_LIODN_ENTRY_2(NULL, liodnA, liodnB, \ 54 offsetof(ccsr_sec_t, decoliodnr[num].ls) + \ 55 CONFIG_SYS_FSL_SEC_OFFSET, 0) 56 57 struct liodn_id_table { 58 const char *compat; 59 u32 id[2]; 60 u8 num_ids; 61 phys_addr_t compat_offset; 62 unsigned long reg_offset; 63 }; 64 65 struct smmu_stream_id { 66 uint16_t offset; 67 uint16_t stream_id; 68 char dev_name[32]; 69 }; 70 71 void ls1021x_config_caam_stream_id(struct liodn_id_table *tbl, int size); 72 void ls102xa_config_smmu_stream_id(struct smmu_stream_id *id, uint32_t num); 73 #endif 74