scc.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * (C) Copyright 2009 Stefan Roese <sr@denx.de>, DENX Software Engineering
  4. *
  5. * Copyright (C) 2006 Micronas GmbH
  6. */
  7. #ifndef _SCC_H
  8. #define _SCC_H
  9. #define DMA_READ 0 /* SCC read DMA */
  10. #define DMA_WRITE 1 /* SCC write DMA */
  11. #define DMA_LINEAR 0 /* DMA linear buffer access method */
  12. #define DMA_CYCLIC 1 /* DMA cyclic buffer access method */
  13. #define DMA_START 0 /* DMA command - start DMA */
  14. #define DMA_STOP 1 /* DMA command - stop DMA */
  15. #define DMA_START_FH_RESET 2 /* DMA command - start DMA reset FH */
  16. #define DMA_TAKEOVER 15 /* DMA command - commit the DMA conf */
  17. #define AGU_ACTIVE 0 /* enable AGU address calculation */
  18. #define AGU_BYPASS 1 /* set AGU to bypass mode */
  19. #define USE_NO_FH 0 /* order the DMA to not use FH */
  20. #define USE_FH 1 /* order the DMA to work with FH*/
  21. #define SCC_DBG_IDLE 0 /* DEBUG status (idle interfaces) */
  22. #define SCC_DBG_SYNC_RES 0x0001 /* synchronuous reset */
  23. #define SCC_TO_IMMEDIATE 1 /* takeover command issued immediately*/
  24. #define TO_DMA_CFG 2 /* takeover command for the DMA config*/
  25. #define DMA_CMD_RESET 0
  26. #define DMA_CMD_SETUP 1
  27. #define DMA_CMD_START 2
  28. #define DMA_CMD_STOP 3
  29. #define DMA_STATE_RESET 0
  30. #define DMA_STATE_SETUP 1
  31. #define DMA_STATE_START 2
  32. #define DMA_STATE_ERROR 3
  33. #define SRMD 0
  34. #define STRM_D 1
  35. #define STRM_P 2
  36. /*
  37. * Slowest Monterey domain is DVP 27 MHz (324/27 = 12; 12*16 = 192 CPU clocks)
  38. */
  39. #define RESET_TIME 2 /* cycle calc see in SCC_Reset */
  40. struct scc_descriptor {
  41. char *pu_name; /* PU identifier */
  42. char *scc_instance; /* SCC Name */
  43. u32 profile; /* SCC VCI_D profile */
  44. u32 base_address; /* base address of the SCC unit reg shell*/
  45. /* SCS Interconnect configuration */
  46. u32 p_scc_id; /* instance number of SCC unit */
  47. u32 p_mci_id; /* memory channel ID */
  48. /* DMA Registers configuration */
  49. u32 p_dma_channels_rd; /* Number of Read DMA channels */
  50. u32 p_dma_channels_wr; /* Number of Write DMA channels */
  51. u32 p_dma_packet_desc; /* Number of packet descriptors */
  52. u32 p_dma_mci_desc; /* Number of MCI_CFG Descriptors */
  53. int use_fh; /* the flag tells if SCC uses an FH */
  54. int p_si2ocp_id; /* instance number of SI2OCP unit */
  55. int hw_dma_cfg; /* HW or SW DMA config flag */
  56. int hw_dma_start; /* HW or SW DMA start/stop flag */
  57. u32 *buffer_tag_list; /* list of the buffer tags available */
  58. u32 *csize_list; /* list of the valid CSIZE values */
  59. };
  60. struct scc_dma_state {
  61. u32 scc_id:8; /* SCC id */
  62. u32 dma_id:8; /* DMA id, used for match with array idx*/
  63. u32 buffer_tag:8; /* mem buf tag, assigned to this DMA */
  64. u32 dma_status:2; /* state of DMA, of the DMA_STATE_ const*/
  65. u32 dma_drs:2; /* DMA dir, either DMA_READ or DMA_WRITE*/
  66. u32 dma_cmd:4; /* last executed command on this DMA */
  67. };
  68. union scc_cmd {
  69. u32 reg;
  70. struct {
  71. u32 res1:19; /* reserved */
  72. u32 drs:1; /* DMA Register Set */
  73. u32 rid:2; /* Register Identifier */
  74. u32 id:6; /* DMA Identifier */
  75. u32 action:4; /* DMA Command encoding */
  76. } bits;
  77. };
  78. union scc_dma_cfg {
  79. u32 reg;
  80. struct {
  81. u32 res1:17; /* reserved */
  82. u32 agu_mode:1; /* AGU Mode */
  83. u32 res2:1; /* reserved */
  84. u32 fh_mode:1; /* Fifo Handler */
  85. u32 buffer_type:1; /* Defines type of mem buffers */
  86. u32 mci_cfg_id:1; /* MCI_CFG register selector */
  87. u32 packet_cfg_id:1; /* PACKET_CFG register selector */
  88. u32 buffer_id:8; /* DMA Buffer Identifier */
  89. } bits;
  90. };
  91. union scc_debug {
  92. u32 reg;
  93. struct {
  94. u32 res1:20; /* reserved */
  95. u32 arg:8; /* SCC Debug Command Argument (#) */
  96. u32 cmd:4; /* SCC Debug Command Register */
  97. } bits;
  98. };
  99. union scc_softwareconfiguration {
  100. u32 reg;
  101. struct {
  102. u32 res1:28; /* reserved */
  103. u32 clock_status:1; /* clock on/off */
  104. u32 packet_select:1; /* active SCC packet id */
  105. u32 enable_status:1; /* enabled [1/0] */
  106. u32 active_status:1; /* 1=active 0=reset */
  107. } bits;
  108. };
  109. /*
  110. * System on Chip Channel ID
  111. */
  112. enum scc_id {
  113. SCC_NULL = -1, /* illegal SCC identifier */
  114. SCC_FE_3DCOMB_WR, /* SCC_FE_3DCOMB Write channel */
  115. SCC_FE_3DCOMB_RD, /* SCC_FE_3DCOMB Read channel */
  116. SCC_DI_TNR_WR, /* SCC_DI_TNR Write channel */
  117. SCC_DI_TNR_FIELD_RD, /* SCC_DI_TNR_FIELD Read channel */
  118. SCC_DI_TNR_FRAME_RD, /* SCC_DI_TNR_FRAME Read channel */
  119. SCC_DI_MVAL_WR, /* SCC_DI_MVAL Write channel */
  120. SCC_DI_MVAL_RD, /* SCC_DI_MVAL Read channel */
  121. SCC_RC_FRAME_WR, /* SCC_RC_FRAME Write channel */
  122. SCC_RC_FRAME0_RD, /* SCC_RC_FRAME0 Read channel */
  123. SCC_OPT_FIELD0_RD, /* SCC_OPT_FIELD0 Read channel */
  124. SCC_OPT_FIELD1_RD, /* SCC_OPT_FIELD1 Read channel */
  125. SCC_OPT_FIELD2_RD, /* SCC_OPT_FIELD2 Read channel */
  126. SCC_PIP_FRAME_WR, /* SCC_PIP_FRAME Write channel */
  127. SCC_PIP_FRAME_RD, /* SCC_PIP_FRAME Read channel */
  128. SCC_DP_AGPU_RD, /* SCC_DP_AGPU Read channel */
  129. SCC_EWARP_RW, /* SCC_EWARP Read/Write channel */
  130. SCC_DP_OSD_RD, /* SCC_DP_OSD Read channel */
  131. SCC_DP_GRAPHIC_RD, /* SCC_DP_GRAPHIC Read channel */
  132. SCC_DVP_OSD_RD, /* SCC_DVP_OSD Read channel */
  133. SCC_DVP_VBI_RD, /* SCC_DVP_VBI Read channel */
  134. SCC_TSIO_WR, /* SCC_TSIO Write channel */
  135. SCC_TSIO_RD, /* SCC_TSIO Read channel */
  136. SCC_TSD_WR, /* SCC_TSD Write channel */
  137. SCC_VD_UD_ST_RW, /* SCC_VD_UD_ST Read/Write channel */
  138. SCC_VD_FRR_RD, /* SCC_VD_FRR Read channel */
  139. SCC_VD_FRW_DISP_WR, /* SCC_VD_FRW_DISP Write channel */
  140. SCC_MR_VD_M_Y_RD, /* SCC_MR_VD_M_Y Read channel */
  141. SCC_MR_VD_M_C_RD, /* SCC_MR_VD_M_C Read channel */
  142. SCC_MR_VD_S_Y_RD, /* SCC_MR_VD_S_Y Read channel */
  143. SCC_MR_VD_S_C_RD, /* SCC_MR_VD_S_C Read channel */
  144. SCC_GA_WR, /* SCC_GA Write channel */
  145. SCC_GA_SRC1_RD, /* SCC_GA_SRC1 Read channel */
  146. SCC_GA_SRC2_RD, /* SCC_GA_SRC2 Read channel */
  147. SCC_AD_RD, /* SCC_AD Read channel */
  148. SCC_AD_WR, /* SCC_AD Write channel */
  149. SCC_ABP_RD, /* SCC_ABP Read channel */
  150. SCC_ABP_WR, /* SCC_ABP Write channel */
  151. SCC_EBI_RW, /* SCC_EBI Read/Write channel */
  152. SCC_USB_RW, /* SCC_USB Read/Write channel */
  153. SCC_CPU1_SPDMA_RW, /* SCC_CPU1_SPDMA Read/Write channel */
  154. SCC_CPU1_BRIDGE_RW, /* SCC_CPU1_BRIDGE Read/Write channel */
  155. SCC_MAX /* maximum limit on the SCC id */
  156. };
  157. int scc_set_usb_address_generation_mode(u32 agu_mode);
  158. int scc_dma_cmd(enum scc_id id, u32 cmd, u32 dma_id, u32 drs);
  159. int scc_setup_dma(enum scc_id id, u32 buffer_tag,
  160. u32 type, u32 fh_mode, u32 drs, u32 dma_id);
  161. int scc_enable(enum scc_id id, u32 value);
  162. int scc_reset(enum scc_id id, u32 value);
  163. #endif /* _SCC_H */