bfin_ppi.h 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /*
  2. * bfin_ppi.h - interface to Blackfin PPIs
  3. *
  4. * Copyright 2005-2010 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __ASM_BFIN_PPI_H__
  9. #define __ASM_BFIN_PPI_H__
  10. #include <linux/types.h>
  11. #include <asm/blackfin.h>
  12. /*
  13. * All Blackfin system MMRs are padded to 32bits even if the register
  14. * itself is only 16bits. So use a helper macro to streamline this.
  15. */
  16. #define __BFP(m) u16 m; u16 __pad_##m
  17. /*
  18. * bfin ppi registers layout
  19. */
  20. struct bfin_ppi_regs {
  21. __BFP(control);
  22. __BFP(status);
  23. __BFP(count);
  24. __BFP(delay);
  25. __BFP(frame);
  26. };
  27. /*
  28. * bfin eppi registers layout
  29. */
  30. struct bfin_eppi_regs {
  31. __BFP(status);
  32. __BFP(hcount);
  33. __BFP(hdelay);
  34. __BFP(vcount);
  35. __BFP(vdelay);
  36. __BFP(frame);
  37. __BFP(line);
  38. __BFP(clkdiv);
  39. u32 control;
  40. u32 fs1w_hbl;
  41. u32 fs1p_avpl;
  42. u32 fs2w_lvb;
  43. u32 fs2p_lavf;
  44. u32 clip;
  45. };
  46. /*
  47. * bfin eppi3 registers layout
  48. */
  49. struct bfin_eppi3_regs {
  50. u32 stat;
  51. u32 hcnt;
  52. u32 hdly;
  53. u32 vcnt;
  54. u32 vdly;
  55. u32 frame;
  56. u32 line;
  57. u32 clkdiv;
  58. u32 ctl;
  59. u32 fs1_wlhb;
  60. u32 fs1_paspl;
  61. u32 fs2_wlvb;
  62. u32 fs2_palpf;
  63. u32 imsk;
  64. u32 oddclip;
  65. u32 evenclip;
  66. u32 fs1_dly;
  67. u32 fs2_dly;
  68. u32 ctl2;
  69. };
  70. #undef __BFP
  71. #ifdef EPPI0_CTL2
  72. #define EPPI_STAT_CFIFOERR 0x00000001 /* Chroma FIFO Error */
  73. #define EPPI_STAT_YFIFOERR 0x00000002 /* Luma FIFO Error */
  74. #define EPPI_STAT_LTERROVR 0x00000004 /* Line Track Overflow */
  75. #define EPPI_STAT_LTERRUNDR 0x00000008 /* Line Track Underflow */
  76. #define EPPI_STAT_FTERROVR 0x00000010 /* Frame Track Overflow */
  77. #define EPPI_STAT_FTERRUNDR 0x00000020 /* Frame Track Underflow */
  78. #define EPPI_STAT_ERRNCOR 0x00000040 /* Preamble Error Not Corrected */
  79. #define EPPI_STAT_PXPERR 0x00000080 /* PxP Ready Error */
  80. #define EPPI_STAT_ERRDET 0x00004000 /* Preamble Error Detected */
  81. #define EPPI_STAT_FLD 0x00008000 /* Current Field Received by EPPI */
  82. #define EPPI_HCNT_VALUE 0x0000FFFF /* Holds the number of samples to read in or write out per line, after PPIx_HDLY number of cycles have expired since the last assertion of PPIx_FS1 */
  83. #define EPPI_HDLY_VALUE 0x0000FFFF /* Number of PPIx_CLK cycles to delay after assertion of PPIx_FS1 before starting to read or write data */
  84. #define EPPI_VCNT_VALUE 0x0000FFFF /* Holds the number of lines to read in or write out, after PPIx_VDLY number of lines from the start of frame */
  85. #define EPPI_VDLY_VALUE 0x0000FFFF /* Number of lines to wait after the start of a new frame before starting to read/transmit data */
  86. #define EPPI_FRAME_VALUE 0x0000FFFF /* Holds the number of lines expected per frame of data */
  87. #define EPPI_LINE_VALUE 0x0000FFFF /* Holds the number of samples expected per line */
  88. #define EPPI_CLKDIV_VALUE 0x0000FFFF /* Internal clock divider */
  89. #define EPPI_CTL_EN 0x00000001 /* PPI Enable */
  90. #define EPPI_CTL_DIR 0x00000002 /* PPI Direction */
  91. #define EPPI_CTL_XFRTYPE 0x0000000C /* PPI Operating Mode */
  92. #define EPPI_CTL_ACTIVE656 0x00000000 /* XFRTYPE: ITU656 Active Video Only Mode */
  93. #define EPPI_CTL_ENTIRE656 0x00000004 /* XFRTYPE: ITU656 Entire Field Mode */
  94. #define EPPI_CTL_VERT656 0x00000008 /* XFRTYPE: ITU656 Vertical Blanking Only Mode */
  95. #define EPPI_CTL_NON656 0x0000000C /* XFRTYPE: Non-ITU656 Mode (GP Mode) */
  96. #define EPPI_CTL_FSCFG 0x00000030 /* Frame Sync Configuration */
  97. #define EPPI_CTL_SYNC0 0x00000000 /* FSCFG: Sync Mode 0 */
  98. #define EPPI_CTL_SYNC1 0x00000010 /* FSCFG: Sync Mode 1 */
  99. #define EPPI_CTL_SYNC2 0x00000020 /* FSCFG: Sync Mode 2 */
  100. #define EPPI_CTL_SYNC3 0x00000030 /* FSCFG: Sync Mode 3 */
  101. #define EPPI_CTL_FLDSEL 0x00000040 /* Field Select/Trigger */
  102. #define EPPI_CTL_ITUTYPE 0x00000080 /* ITU Interlace or Progressive */
  103. #define EPPI_CTL_BLANKGEN 0x00000100 /* ITU Output Mode with Internal Blanking Generation */
  104. #define EPPI_CTL_ICLKGEN 0x00000200 /* Internal Clock Generation */
  105. #define EPPI_CTL_IFSGEN 0x00000400 /* Internal Frame Sync Generation */
  106. #define EPPI_CTL_SIGNEXT 0x00000800 /* Sign Extension */
  107. #define EPPI_CTL_POLC 0x00003000 /* Frame Sync and Data Driving and Sampling Edges */
  108. #define EPPI_CTL_POLC0 0x00000000 /* POLC: Clock/Sync polarity mode 0 */
  109. #define EPPI_CTL_POLC1 0x00001000 /* POLC: Clock/Sync polarity mode 1 */
  110. #define EPPI_CTL_POLC2 0x00002000 /* POLC: Clock/Sync polarity mode 2 */
  111. #define EPPI_CTL_POLC3 0x00003000 /* POLC: Clock/Sync polarity mode 3 */
  112. #define EPPI_CTL_POLS 0x0000C000 /* Frame Sync Polarity */
  113. #define EPPI_CTL_FS1HI_FS2HI 0x00000000 /* POLS: FS1 and FS2 are active high */
  114. #define EPPI_CTL_FS1LO_FS2HI 0x00004000 /* POLS: FS1 is active low. FS2 is active high */
  115. #define EPPI_CTL_FS1HI_FS2LO 0x00008000 /* POLS: FS1 is active high. FS2 is active low */
  116. #define EPPI_CTL_FS1LO_FS2LO 0x0000C000 /* POLS: FS1 and FS2 are active low */
  117. #define EPPI_CTL_DLEN 0x00070000 /* Data Length */
  118. #define EPPI_CTL_DLEN08 0x00000000 /* DLEN: 8 bits */
  119. #define EPPI_CTL_DLEN10 0x00010000 /* DLEN: 10 bits */
  120. #define EPPI_CTL_DLEN12 0x00020000 /* DLEN: 12 bits */
  121. #define EPPI_CTL_DLEN14 0x00030000 /* DLEN: 14 bits */
  122. #define EPPI_CTL_DLEN16 0x00040000 /* DLEN: 16 bits */
  123. #define EPPI_CTL_DLEN18 0x00050000 /* DLEN: 18 bits */
  124. #define EPPI_CTL_DLEN20 0x00060000 /* DLEN: 20 bits */
  125. #define EPPI_CTL_DLEN24 0x00070000 /* DLEN: 24 bits */
  126. #define EPPI_CTL_DMIRR 0x00080000 /* Data Mirroring */
  127. #define EPPI_CTL_SKIPEN 0x00100000 /* Skip Enable */
  128. #define EPPI_CTL_SKIPEO 0x00200000 /* Skip Even or Odd */
  129. #define EPPI_CTL_PACKEN 0x00400000 /* Pack/Unpack Enable */
  130. #define EPPI_CTL_SWAPEN 0x00800000 /* Swap Enable */
  131. #define EPPI_CTL_SPLTEO 0x01000000 /* Split Even and Odd Data Samples */
  132. #define EPPI_CTL_SUBSPLTODD 0x02000000 /* Sub-Split Odd Samples */
  133. #define EPPI_CTL_SPLTWRD 0x04000000 /* Split Word */
  134. #define EPPI_CTL_RGBFMTEN 0x08000000 /* RGB Formatting Enable */
  135. #define EPPI_CTL_DMACFG 0x10000000 /* One or Two DMA Channels Mode */
  136. #define EPPI_CTL_DMAFINEN 0x20000000 /* DMA Finish Enable */
  137. #define EPPI_CTL_MUXSEL 0x40000000 /* MUX Select */
  138. #define EPPI_CTL_CLKGATEN 0x80000000 /* Clock Gating Enable */
  139. #define EPPI_FS2_WLVB_F2VBAD 0xFF000000 /* In GP transmit mode with BLANKGEN = 1, contains number of lines of vertical blanking after field 2 */
  140. #define EPPI_FS2_WLVB_F2VBBD 0x00FF0000 /* In GP transmit mode with BLANKGEN = 1, contains number of lines of vertical blanking before field 2 */
  141. #define EPPI_FS2_WLVB_F1VBAD 0x0000FF00 /* In GP transmit mode with, BLANKGEN = 1, contains number of lines of vertical blanking after field 1 */
  142. #define EPPI_FS2_WLVB_F1VBBD 0x000000FF /* In GP 2, or 3 FS modes used to generate PPIx_FS2 width (32-bit). In GP Transmit mode, with BLANKGEN=1, contains the number of lines of Vertical blanking before field 1. */
  143. #define EPPI_FS2_PALPF_F2ACT 0xFFFF0000 /* Number of lines of Active Data in Field 2 */
  144. #define EPPI_FS2_PALPF_F1ACT 0x0000FFFF /* Number of lines of Active Data in Field 1 */
  145. #define EPPI_IMSK_CFIFOERR 0x00000001 /* Mask CFIFO Underflow or Overflow Error Interrupt */
  146. #define EPPI_IMSK_YFIFOERR 0x00000002 /* Mask YFIFO Underflow or Overflow Error Interrupt */
  147. #define EPPI_IMSK_LTERROVR 0x00000004 /* Mask Line Track Overflow Error Interrupt */
  148. #define EPPI_IMSK_LTERRUNDR 0x00000008 /* Mask Line Track Underflow Error Interrupt */
  149. #define EPPI_IMSK_FTERROVR 0x00000010 /* Mask Frame Track Overflow Error Interrupt */
  150. #define EPPI_IMSK_FTERRUNDR 0x00000020 /* Mask Frame Track Underflow Error Interrupt */
  151. #define EPPI_IMSK_ERRNCOR 0x00000040 /* Mask ITU Preamble Error Not Corrected Interrupt */
  152. #define EPPI_IMSK_PXPERR 0x00000080 /* Mask PxP Ready Error Interrupt */
  153. #define EPPI_ODDCLIP_HIGHODD 0xFFFF0000
  154. #define EPPI_ODDCLIP_LOWODD 0x0000FFFF
  155. #define EPPI_EVENCLIP_HIGHEVEN 0xFFFF0000
  156. #define EPPI_EVENCLIP_LOWEVEN 0x0000FFFF
  157. #define EPPI_CTL2_FS1FINEN 0x00000002 /* HSYNC Finish Enable */
  158. #endif
  159. #endif