ipu_intern.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /*
  2. * Copyright (C) 2008
  3. * Guennadi Liakhovetski, DENX Software Engineering, <lg@denx.de>
  4. *
  5. * Copyright (C) 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #ifndef _IPU_INTERN_H_
  12. #define _IPU_INTERN_H_
  13. #include <linux/dmaengine.h>
  14. #include <linux/platform_device.h>
  15. #include <linux/interrupt.h>
  16. /* IPU Common registers */
  17. #define IPU_CONF 0x00
  18. #define IPU_CHA_BUF0_RDY 0x04
  19. #define IPU_CHA_BUF1_RDY 0x08
  20. #define IPU_CHA_DB_MODE_SEL 0x0C
  21. #define IPU_CHA_CUR_BUF 0x10
  22. #define IPU_FS_PROC_FLOW 0x14
  23. #define IPU_FS_DISP_FLOW 0x18
  24. #define IPU_TASKS_STAT 0x1C
  25. #define IPU_IMA_ADDR 0x20
  26. #define IPU_IMA_DATA 0x24
  27. #define IPU_INT_CTRL_1 0x28
  28. #define IPU_INT_CTRL_2 0x2C
  29. #define IPU_INT_CTRL_3 0x30
  30. #define IPU_INT_CTRL_4 0x34
  31. #define IPU_INT_CTRL_5 0x38
  32. #define IPU_INT_STAT_1 0x3C
  33. #define IPU_INT_STAT_2 0x40
  34. #define IPU_INT_STAT_3 0x44
  35. #define IPU_INT_STAT_4 0x48
  36. #define IPU_INT_STAT_5 0x4C
  37. #define IPU_BRK_CTRL_1 0x50
  38. #define IPU_BRK_CTRL_2 0x54
  39. #define IPU_BRK_STAT 0x58
  40. #define IPU_DIAGB_CTRL 0x5C
  41. /* IPU_CONF Register bits */
  42. #define IPU_CONF_CSI_EN 0x00000001
  43. #define IPU_CONF_IC_EN 0x00000002
  44. #define IPU_CONF_ROT_EN 0x00000004
  45. #define IPU_CONF_PF_EN 0x00000008
  46. #define IPU_CONF_SDC_EN 0x00000010
  47. #define IPU_CONF_ADC_EN 0x00000020
  48. #define IPU_CONF_DI_EN 0x00000040
  49. #define IPU_CONF_DU_EN 0x00000080
  50. #define IPU_CONF_PXL_ENDIAN 0x00000100
  51. /* Image Converter Registers */
  52. #define IC_CONF 0x88
  53. #define IC_PRP_ENC_RSC 0x8C
  54. #define IC_PRP_VF_RSC 0x90
  55. #define IC_PP_RSC 0x94
  56. #define IC_CMBP_1 0x98
  57. #define IC_CMBP_2 0x9C
  58. #define PF_CONF 0xA0
  59. #define IDMAC_CONF 0xA4
  60. #define IDMAC_CHA_EN 0xA8
  61. #define IDMAC_CHA_PRI 0xAC
  62. #define IDMAC_CHA_BUSY 0xB0
  63. /* Image Converter Register bits */
  64. #define IC_CONF_PRPENC_EN 0x00000001
  65. #define IC_CONF_PRPENC_CSC1 0x00000002
  66. #define IC_CONF_PRPENC_ROT_EN 0x00000004
  67. #define IC_CONF_PRPVF_EN 0x00000100
  68. #define IC_CONF_PRPVF_CSC1 0x00000200
  69. #define IC_CONF_PRPVF_CSC2 0x00000400
  70. #define IC_CONF_PRPVF_CMB 0x00000800
  71. #define IC_CONF_PRPVF_ROT_EN 0x00001000
  72. #define IC_CONF_PP_EN 0x00010000
  73. #define IC_CONF_PP_CSC1 0x00020000
  74. #define IC_CONF_PP_CSC2 0x00040000
  75. #define IC_CONF_PP_CMB 0x00080000
  76. #define IC_CONF_PP_ROT_EN 0x00100000
  77. #define IC_CONF_IC_GLB_LOC_A 0x10000000
  78. #define IC_CONF_KEY_COLOR_EN 0x20000000
  79. #define IC_CONF_RWS_EN 0x40000000
  80. #define IC_CONF_CSI_MEM_WR_EN 0x80000000
  81. #define IDMA_CHAN_INVALID 0x000000FF
  82. #define IDMA_IC_0 0x00000001
  83. #define IDMA_IC_1 0x00000002
  84. #define IDMA_IC_2 0x00000004
  85. #define IDMA_IC_3 0x00000008
  86. #define IDMA_IC_4 0x00000010
  87. #define IDMA_IC_5 0x00000020
  88. #define IDMA_IC_6 0x00000040
  89. #define IDMA_IC_7 0x00000080
  90. #define IDMA_IC_8 0x00000100
  91. #define IDMA_IC_9 0x00000200
  92. #define IDMA_IC_10 0x00000400
  93. #define IDMA_IC_11 0x00000800
  94. #define IDMA_IC_12 0x00001000
  95. #define IDMA_IC_13 0x00002000
  96. #define IDMA_SDC_BG 0x00004000
  97. #define IDMA_SDC_FG 0x00008000
  98. #define IDMA_SDC_MASK 0x00010000
  99. #define IDMA_SDC_PARTIAL 0x00020000
  100. #define IDMA_ADC_SYS1_WR 0x00040000
  101. #define IDMA_ADC_SYS2_WR 0x00080000
  102. #define IDMA_ADC_SYS1_CMD 0x00100000
  103. #define IDMA_ADC_SYS2_CMD 0x00200000
  104. #define IDMA_ADC_SYS1_RD 0x00400000
  105. #define IDMA_ADC_SYS2_RD 0x00800000
  106. #define IDMA_PF_QP 0x01000000
  107. #define IDMA_PF_BSP 0x02000000
  108. #define IDMA_PF_Y_IN 0x04000000
  109. #define IDMA_PF_U_IN 0x08000000
  110. #define IDMA_PF_V_IN 0x10000000
  111. #define IDMA_PF_Y_OUT 0x20000000
  112. #define IDMA_PF_U_OUT 0x40000000
  113. #define IDMA_PF_V_OUT 0x80000000
  114. #define TSTAT_PF_H264_PAUSE 0x00000001
  115. #define TSTAT_CSI2MEM_MASK 0x0000000C
  116. #define TSTAT_CSI2MEM_OFFSET 2
  117. #define TSTAT_VF_MASK 0x00000600
  118. #define TSTAT_VF_OFFSET 9
  119. #define TSTAT_VF_ROT_MASK 0x000C0000
  120. #define TSTAT_VF_ROT_OFFSET 18
  121. #define TSTAT_ENC_MASK 0x00000180
  122. #define TSTAT_ENC_OFFSET 7
  123. #define TSTAT_ENC_ROT_MASK 0x00030000
  124. #define TSTAT_ENC_ROT_OFFSET 16
  125. #define TSTAT_PP_MASK 0x00001800
  126. #define TSTAT_PP_OFFSET 11
  127. #define TSTAT_PP_ROT_MASK 0x00300000
  128. #define TSTAT_PP_ROT_OFFSET 20
  129. #define TSTAT_PF_MASK 0x00C00000
  130. #define TSTAT_PF_OFFSET 22
  131. #define TSTAT_ADCSYS1_MASK 0x03000000
  132. #define TSTAT_ADCSYS1_OFFSET 24
  133. #define TSTAT_ADCSYS2_MASK 0x0C000000
  134. #define TSTAT_ADCSYS2_OFFSET 26
  135. #define TASK_STAT_IDLE 0
  136. #define TASK_STAT_ACTIVE 1
  137. #define TASK_STAT_WAIT4READY 2
  138. struct idmac {
  139. struct dma_device dma;
  140. };
  141. struct ipu {
  142. void __iomem *reg_ipu;
  143. void __iomem *reg_ic;
  144. unsigned int irq_fn; /* IPU Function IRQ to the CPU */
  145. unsigned int irq_err; /* IPU Error IRQ to the CPU */
  146. unsigned int irq_base; /* Beginning of the IPU IRQ range */
  147. unsigned long channel_init_mask;
  148. spinlock_t lock;
  149. struct clk *ipu_clk;
  150. struct device *dev;
  151. struct idmac idmac;
  152. struct idmac_channel channel[IPU_CHANNELS_NUM];
  153. struct tasklet_struct tasklet;
  154. };
  155. #define to_idmac(d) container_of(d, struct idmac, dma)
  156. extern int ipu_irq_attach_irq(struct ipu *ipu, struct platform_device *dev);
  157. extern void ipu_irq_detach_irq(struct ipu *ipu, struct platform_device *dev);
  158. extern bool ipu_irq_status(uint32_t irq);
  159. extern int ipu_irq_map(unsigned int source);
  160. extern int ipu_irq_unmap(unsigned int source);
  161. #endif