scc.h 6.3 KB

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