fsl_icid.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright 2018 NXP
  4. */
  5. #ifndef _FSL_ICID_H_
  6. #define _FSL_ICID_H_
  7. #include <asm/types.h>
  8. #include <fsl_qbman.h>
  9. #include <fsl_sec.h>
  10. struct icid_id_table {
  11. const char *compat;
  12. u32 id;
  13. u32 reg;
  14. phys_addr_t compat_addr;
  15. phys_addr_t reg_addr;
  16. };
  17. struct fman_icid_id_table {
  18. u32 port_id;
  19. u32 icid;
  20. };
  21. u32 get_ppid_icid(int ppid_tbl_idx, int ppid);
  22. int fdt_get_smmu_phandle(void *blob);
  23. int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32 *ids, int num_ids);
  24. void set_icids(void);
  25. void fdt_fixup_icid(void *blob);
  26. #define SET_ICID_ENTRY(name, idA, regA, addr, compataddr) \
  27. { .compat = name, \
  28. .id = idA, \
  29. .reg = regA, \
  30. .compat_addr = compataddr, \
  31. .reg_addr = addr, \
  32. }
  33. #define SET_SCFG_ICID(compat, streamid, name, compataddr) \
  34. SET_ICID_ENTRY(compat, streamid, (((streamid) << 24) | (1 << 23)), \
  35. offsetof(struct ccsr_scfg, name) + CONFIG_SYS_FSL_SCFG_ADDR, \
  36. compataddr)
  37. #define SET_USB_ICID(usb_num, compat, streamid) \
  38. SET_SCFG_ICID(compat, streamid, usb##usb_num##_icid,\
  39. CONFIG_SYS_XHCI_USB##usb_num##_ADDR)
  40. #define SET_SATA_ICID(compat, streamid) \
  41. SET_SCFG_ICID(compat, streamid, sata_icid,\
  42. AHCI_BASE_ADDR)
  43. #define SET_SDHC_ICID(streamid) \
  44. SET_SCFG_ICID("fsl,esdhc", streamid, sdhc_icid,\
  45. CONFIG_SYS_FSL_ESDHC_ADDR)
  46. #define SET_QDMA_ICID(compat, streamid) \
  47. SET_SCFG_ICID(compat, streamid, dma_icid,\
  48. QDMA_BASE_ADDR)
  49. #define SET_EDMA_ICID(streamid) \
  50. SET_SCFG_ICID("fsl,vf610-edma", streamid, edma_icid,\
  51. EDMA_BASE_ADDR)
  52. #define SET_ETR_ICID(streamid) \
  53. SET_SCFG_ICID(NULL, streamid, etr_icid, 0)
  54. #define SET_DEBUG_ICID(streamid) \
  55. SET_SCFG_ICID(NULL, streamid, debug_icid, 0)
  56. #define SET_QMAN_ICID(streamid) \
  57. SET_ICID_ENTRY("fsl,qman", streamid, streamid, \
  58. offsetof(struct ccsr_qman, liodnr) + \
  59. CONFIG_SYS_FSL_QMAN_ADDR, \
  60. CONFIG_SYS_FSL_QMAN_ADDR)
  61. #define SET_BMAN_ICID(streamid) \
  62. SET_ICID_ENTRY("fsl,bman", streamid, streamid, \
  63. offsetof(struct ccsr_bman, liodnr) + \
  64. CONFIG_SYS_FSL_BMAN_ADDR, \
  65. CONFIG_SYS_FSL_BMAN_ADDR)
  66. #define SET_FMAN_ICID_ENTRY(_port_id, streamid) \
  67. { .port_id = (_port_id), .icid = (streamid) }
  68. #define SET_SEC_QI_ICID(streamid) \
  69. SET_ICID_ENTRY("fsl,sec-v4.0", streamid, \
  70. (((streamid) << 16) | (streamid)), \
  71. offsetof(ccsr_sec_t, qilcr_ls) + \
  72. CONFIG_SYS_FSL_SEC_ADDR, \
  73. CONFIG_SYS_FSL_SEC_ADDR)
  74. #define SET_SEC_JR_ICID_ENTRY(jr_num, streamid) \
  75. SET_ICID_ENTRY("fsl,sec-v4.0-job-ring", streamid, \
  76. (((streamid) << 16) | (streamid)), \
  77. offsetof(ccsr_sec_t, jrliodnr[jr_num].ls) + \
  78. CONFIG_SYS_FSL_SEC_ADDR, \
  79. FSL_SEC_JR##jr_num##_BASE_ADDR)
  80. #define SET_SEC_DECO_ICID_ENTRY(deco_num, streamid) \
  81. SET_ICID_ENTRY(NULL, streamid, (((streamid) << 16) | (streamid)), \
  82. offsetof(ccsr_sec_t, decoliodnr[deco_num].ls) + \
  83. CONFIG_SYS_FSL_SEC_ADDR, 0)
  84. #define SET_SEC_RTIC_ICID_ENTRY(rtic_num, streamid) \
  85. SET_ICID_ENTRY(NULL, streamid, (((streamid) << 16) | (streamid)), \
  86. offsetof(ccsr_sec_t, rticliodnr[rtic_num].ls) + \
  87. CONFIG_SYS_FSL_SEC_ADDR, 0)
  88. extern struct icid_id_table icid_tbl[];
  89. extern struct fman_icid_id_table fman_icid_tbl[];
  90. extern int icid_tbl_sz;
  91. extern int fman_icid_tbl_sz;
  92. #endif