ls102xa_stream_id.h 2.2 KB

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