fsl_icid.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. struct icid_id_table {
  10. const char *compat;
  11. u32 id;
  12. u32 reg;
  13. phys_addr_t compat_addr;
  14. phys_addr_t reg_addr;
  15. };
  16. struct fman_icid_id_table {
  17. u32 port_id;
  18. u32 icid;
  19. };
  20. u32 get_ppid_icid(int ppid_tbl_idx, int ppid);
  21. int fdt_get_smmu_phandle(void *blob);
  22. int fdt_set_iommu_prop(void *blob, int off, int smmu_ph, u32 *ids, int num_ids);
  23. void set_icids(void);
  24. void fdt_fixup_icid(void *blob);
  25. #define SET_ICID_ENTRY(name, idA, regA, addr, compataddr) \
  26. { .compat = name, \
  27. .id = idA, \
  28. .reg = regA, \
  29. .compat_addr = compataddr, \
  30. .reg_addr = addr, \
  31. }
  32. #define SET_SCFG_ICID(compat, streamid, name, compataddr) \
  33. SET_ICID_ENTRY(compat, streamid, (((streamid) << 24) | (1 << 23)), \
  34. offsetof(struct ccsr_scfg, name) + CONFIG_SYS_FSL_SCFG_ADDR, \
  35. compataddr)
  36. #define SET_USB_ICID(usb_num, compat, streamid) \
  37. SET_SCFG_ICID(compat, streamid, usb##usb_num##_icid,\
  38. CONFIG_SYS_XHCI_USB##usb_num##_ADDR)
  39. #define SET_SATA_ICID(compat, streamid) \
  40. SET_SCFG_ICID(compat, streamid, sata_icid,\
  41. AHCI_BASE_ADDR)
  42. #define SET_SDHC_ICID(streamid) \
  43. SET_SCFG_ICID("fsl,esdhc", streamid, sdhc_icid,\
  44. CONFIG_SYS_FSL_ESDHC_ADDR)
  45. #define SET_QDMA_ICID(compat, streamid) \
  46. SET_SCFG_ICID(compat, streamid, dma_icid,\
  47. QDMA_BASE_ADDR)
  48. #define SET_EDMA_ICID(streamid) \
  49. SET_SCFG_ICID("fsl,vf610-edma", streamid, edma_icid,\
  50. EDMA_BASE_ADDR)
  51. #define SET_ETR_ICID(streamid) \
  52. SET_SCFG_ICID(NULL, streamid, etr_icid, 0)
  53. #define SET_DEBUG_ICID(streamid) \
  54. SET_SCFG_ICID(NULL, streamid, debug_icid, 0)
  55. #define SET_QMAN_ICID(streamid) \
  56. SET_ICID_ENTRY("fsl,qman", streamid, streamid, \
  57. offsetof(struct ccsr_qman, liodnr) + \
  58. CONFIG_SYS_FSL_QMAN_ADDR, \
  59. CONFIG_SYS_FSL_QMAN_ADDR)
  60. #define SET_BMAN_ICID(streamid) \
  61. SET_ICID_ENTRY("fsl,bman", streamid, streamid, \
  62. offsetof(struct ccsr_bman, liodnr) + \
  63. CONFIG_SYS_FSL_BMAN_ADDR, \
  64. CONFIG_SYS_FSL_BMAN_ADDR)
  65. #define SET_FMAN_ICID_ENTRY(_port_id, streamid) \
  66. { .port_id = (_port_id), .icid = (streamid) }
  67. extern struct icid_id_table icid_tbl[];
  68. extern struct fman_icid_id_table fman_icid_tbl[];
  69. extern int icid_tbl_sz;
  70. extern int fman_icid_tbl_sz;
  71. #endif