dma.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * 440SPe's DMA engines support header file
  4. *
  5. * 2006-2009 (C) DENX Software Engineering.
  6. *
  7. * Author: Yuri Tikhonov <[email protected]>
  8. */
  9. #ifndef _PPC440SPE_DMA_H
  10. #define _PPC440SPE_DMA_H
  11. #include <linux/types.h>
  12. /* Number of elements in the array with statical CDBs */
  13. #define MAX_STAT_DMA_CDBS 16
  14. /* Number of DMA engines available on the contoller */
  15. #define DMA_ENGINES_NUM 2
  16. /* Maximum h/w supported number of destinations */
  17. #define DMA_DEST_MAX_NUM 2
  18. /* FIFO's params */
  19. #define DMA0_FIFO_SIZE 0x1000
  20. #define DMA1_FIFO_SIZE 0x1000
  21. #define DMA_FIFO_ENABLE (1<<12)
  22. /* DMA Configuration Register. Data Transfer Engine PLB Priority: */
  23. #define DMA_CFG_DXEPR_LP (0<<26)
  24. #define DMA_CFG_DXEPR_HP (3<<26)
  25. #define DMA_CFG_DXEPR_HHP (2<<26)
  26. #define DMA_CFG_DXEPR_HHHP (1<<26)
  27. /* DMA Configuration Register. DMA FIFO Manager PLB Priority: */
  28. #define DMA_CFG_DFMPP_LP (0<<23)
  29. #define DMA_CFG_DFMPP_HP (3<<23)
  30. #define DMA_CFG_DFMPP_HHP (2<<23)
  31. #define DMA_CFG_DFMPP_HHHP (1<<23)
  32. /* DMA Configuration Register. Force 64-byte Alignment */
  33. #define DMA_CFG_FALGN (1 << 19)
  34. /*UIC0:*/
  35. #define D0CPF_INT (1<<12)
  36. #define D0CSF_INT (1<<11)
  37. #define D1CPF_INT (1<<10)
  38. #define D1CSF_INT (1<<9)
  39. /*UIC1:*/
  40. #define DMAE_INT (1<<9)
  41. /* I2O IOP Interrupt Mask Register */
  42. #define I2O_IOPIM_P0SNE (1<<3)
  43. #define I2O_IOPIM_P0EM (1<<5)
  44. #define I2O_IOPIM_P1SNE (1<<6)
  45. #define I2O_IOPIM_P1EM (1<<8)
  46. /* DMA CDB fields */
  47. #define DMA_CDB_MSK (0xF)
  48. #define DMA_CDB_64B_ADDR (1<<2)
  49. #define DMA_CDB_NO_INT (1<<3)
  50. #define DMA_CDB_STATUS_MSK (0x3)
  51. #define DMA_CDB_ADDR_MSK (0xFFFFFFF0)
  52. /* DMA CDB OpCodes */
  53. #define DMA_CDB_OPC_NO_OP (0x00)
  54. #define DMA_CDB_OPC_MV_SG1_SG2 (0x01)
  55. #define DMA_CDB_OPC_MULTICAST (0x05)
  56. #define DMA_CDB_OPC_DFILL128 (0x24)
  57. #define DMA_CDB_OPC_DCHECK128 (0x23)
  58. #define DMA_CUED_XOR_BASE (0x10000000)
  59. #define DMA_CUED_XOR_HB (0x00000008)
  60. #ifdef CONFIG_440SP
  61. #define DMA_CUED_MULT1_OFF 0
  62. #define DMA_CUED_MULT2_OFF 8
  63. #define DMA_CUED_MULT3_OFF 16
  64. #define DMA_CUED_REGION_OFF 24
  65. #define DMA_CUED_XOR_WIN_MSK (0xFC000000)
  66. #else
  67. #define DMA_CUED_MULT1_OFF 2
  68. #define DMA_CUED_MULT2_OFF 10
  69. #define DMA_CUED_MULT3_OFF 18
  70. #define DMA_CUED_REGION_OFF 26
  71. #define DMA_CUED_XOR_WIN_MSK (0xF0000000)
  72. #endif
  73. #define DMA_CUED_REGION_MSK 0x3
  74. #define DMA_RXOR123 0x0
  75. #define DMA_RXOR124 0x1
  76. #define DMA_RXOR125 0x2
  77. #define DMA_RXOR12 0x3
  78. /* S/G addresses */
  79. #define DMA_CDB_SG_SRC 1
  80. #define DMA_CDB_SG_DST1 2
  81. #define DMA_CDB_SG_DST2 3
  82. /*
  83. * DMAx engines Command Descriptor Block Type
  84. */
  85. struct dma_cdb {
  86. /*
  87. * Basic CDB structure (Table 20-17, p.499, 440spe_um_1_22.pdf)
  88. */
  89. u8 pad0[2]; /* reserved */
  90. u8 attr; /* attributes */
  91. u8 opc; /* opcode */
  92. u32 sg1u; /* upper SG1 address */
  93. u32 sg1l; /* lower SG1 address */
  94. u32 cnt; /* SG count, 3B used */
  95. u32 sg2u; /* upper SG2 address */
  96. u32 sg2l; /* lower SG2 address */
  97. u32 sg3u; /* upper SG3 address */
  98. u32 sg3l; /* lower SG3 address */
  99. };
  100. /*
  101. * DMAx hardware registers (p.515 in 440SPe UM 1.22)
  102. */
  103. struct dma_regs {
  104. u32 cpfpl;
  105. u32 cpfph;
  106. u32 csfpl;
  107. u32 csfph;
  108. u32 dsts;
  109. u32 cfg;
  110. u8 pad0[0x8];
  111. u16 cpfhp;
  112. u16 cpftp;
  113. u16 csfhp;
  114. u16 csftp;
  115. u8 pad1[0x8];
  116. u32 acpl;
  117. u32 acph;
  118. u32 s1bpl;
  119. u32 s1bph;
  120. u32 s2bpl;
  121. u32 s2bph;
  122. u32 s3bpl;
  123. u32 s3bph;
  124. u8 pad2[0x10];
  125. u32 earl;
  126. u32 earh;
  127. u8 pad3[0x8];
  128. u32 seat;
  129. u32 sead;
  130. u32 op;
  131. u32 fsiz;
  132. };
  133. /*
  134. * I2O hardware registers (p.528 in 440SPe UM 1.22)
  135. */
  136. struct i2o_regs {
  137. u32 ists;
  138. u32 iseat;
  139. u32 isead;
  140. u8 pad0[0x14];
  141. u32 idbel;
  142. u8 pad1[0xc];
  143. u32 ihis;
  144. u32 ihim;
  145. u8 pad2[0x8];
  146. u32 ihiq;
  147. u32 ihoq;
  148. u8 pad3[0x8];
  149. u32 iopis;
  150. u32 iopim;
  151. u32 iopiq;
  152. u8 iopoq;
  153. u8 pad4[3];
  154. u16 iiflh;
  155. u16 iiflt;
  156. u16 iiplh;
  157. u16 iiplt;
  158. u16 ioflh;
  159. u16 ioflt;
  160. u16 ioplh;
  161. u16 ioplt;
  162. u32 iidc;
  163. u32 ictl;
  164. u32 ifcpp;
  165. u8 pad5[0x4];
  166. u16 mfac0;
  167. u16 mfac1;
  168. u16 mfac2;
  169. u16 mfac3;
  170. u16 mfac4;
  171. u16 mfac5;
  172. u16 mfac6;
  173. u16 mfac7;
  174. u16 ifcfh;
  175. u16 ifcht;
  176. u8 pad6[0x4];
  177. u32 iifmc;
  178. u32 iodb;
  179. u32 iodbc;
  180. u32 ifbal;
  181. u32 ifbah;
  182. u32 ifsiz;
  183. u32 ispd0;
  184. u32 ispd1;
  185. u32 ispd2;
  186. u32 ispd3;
  187. u32 ihipl;
  188. u32 ihiph;
  189. u32 ihopl;
  190. u32 ihoph;
  191. u32 iiipl;
  192. u32 iiiph;
  193. u32 iiopl;
  194. u32 iioph;
  195. u32 ifcpl;
  196. u32 ifcph;
  197. u8 pad7[0x8];
  198. u32 iopt;
  199. };
  200. #endif /* _PPC440SPE_DMA_H */