scc.h 7.0 KB

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