dum.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212
  1. /*
  2. * linux/drivers/video/pnx4008/dum.h
  3. *
  4. * Internal header for SDUM
  5. *
  6. * 2005 (c) Koninklijke Philips N.V. This file is licensed under
  7. * the terms of the GNU General Public License version 2. This program
  8. * is licensed "as is" without any warranty of any kind, whether express
  9. * or implied.
  10. */
  11. #ifndef __PNX008_DUM_H__
  12. #define __PNX008_DUM_H__
  13. #include <mach/platform.h>
  14. #define PNX4008_DUMCONF_VA_BASE IO_ADDRESS(PNX4008_DUMCONF_BASE)
  15. #define PNX4008_DUM_MAIN_VA_BASE IO_ADDRESS(PNX4008_DUM_MAINCFG_BASE)
  16. /* DUM CFG ADDRESSES */
  17. #define DUM_CH_BASE_ADR (PNX4008_DUMCONF_VA_BASE + 0x00)
  18. #define DUM_CH_MIN_ADR (PNX4008_DUMCONF_VA_BASE + 0x00)
  19. #define DUM_CH_MAX_ADR (PNX4008_DUMCONF_VA_BASE + 0x04)
  20. #define DUM_CH_CONF_ADR (PNX4008_DUMCONF_VA_BASE + 0x08)
  21. #define DUM_CH_STAT_ADR (PNX4008_DUMCONF_VA_BASE + 0x0C)
  22. #define DUM_CH_CTRL_ADR (PNX4008_DUMCONF_VA_BASE + 0x10)
  23. #define CH_MARG (0x100 / sizeof(u32))
  24. #define DUM_CH_MIN(i) (*((volatile u32 *)DUM_CH_MIN_ADR + (i) * CH_MARG))
  25. #define DUM_CH_MAX(i) (*((volatile u32 *)DUM_CH_MAX_ADR + (i) * CH_MARG))
  26. #define DUM_CH_CONF(i) (*((volatile u32 *)DUM_CH_CONF_ADR + (i) * CH_MARG))
  27. #define DUM_CH_STAT(i) (*((volatile u32 *)DUM_CH_STAT_ADR + (i) * CH_MARG))
  28. #define DUM_CH_CTRL(i) (*((volatile u32 *)DUM_CH_CTRL_ADR + (i) * CH_MARG))
  29. #define DUM_CONF_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x00)
  30. #define DUM_CTRL_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x04)
  31. #define DUM_STAT_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x08)
  32. #define DUM_DECODE_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x0C)
  33. #define DUM_COM_BASE_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x10)
  34. #define DUM_SYNC_C_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x14)
  35. #define DUM_CLK_DIV_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x18)
  36. #define DUM_DIRTY_LOW_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x20)
  37. #define DUM_DIRTY_HIGH_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x24)
  38. #define DUM_FORMAT_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x28)
  39. #define DUM_WTCFG1_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x30)
  40. #define DUM_RTCFG1_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x34)
  41. #define DUM_WTCFG2_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x38)
  42. #define DUM_RTCFG2_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x3C)
  43. #define DUM_TCFG_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x40)
  44. #define DUM_OUTP_FORMAT1_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x44)
  45. #define DUM_OUTP_FORMAT2_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x48)
  46. #define DUM_SYNC_MODE_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x4C)
  47. #define DUM_SYNC_OUT_C_ADR (PNX4008_DUM_MAIN_VA_BASE + 0x50)
  48. #define DUM_CONF (*(volatile u32 *)(DUM_CONF_ADR))
  49. #define DUM_CTRL (*(volatile u32 *)(DUM_CTRL_ADR))
  50. #define DUM_STAT (*(volatile u32 *)(DUM_STAT_ADR))
  51. #define DUM_DECODE (*(volatile u32 *)(DUM_DECODE_ADR))
  52. #define DUM_COM_BASE (*(volatile u32 *)(DUM_COM_BASE_ADR))
  53. #define DUM_SYNC_C (*(volatile u32 *)(DUM_SYNC_C_ADR))
  54. #define DUM_CLK_DIV (*(volatile u32 *)(DUM_CLK_DIV_ADR))
  55. #define DUM_DIRTY_LOW (*(volatile u32 *)(DUM_DIRTY_LOW_ADR))
  56. #define DUM_DIRTY_HIGH (*(volatile u32 *)(DUM_DIRTY_HIGH_ADR))
  57. #define DUM_FORMAT (*(volatile u32 *)(DUM_FORMAT_ADR))
  58. #define DUM_WTCFG1 (*(volatile u32 *)(DUM_WTCFG1_ADR))
  59. #define DUM_RTCFG1 (*(volatile u32 *)(DUM_RTCFG1_ADR))
  60. #define DUM_WTCFG2 (*(volatile u32 *)(DUM_WTCFG2_ADR))
  61. #define DUM_RTCFG2 (*(volatile u32 *)(DUM_RTCFG2_ADR))
  62. #define DUM_TCFG (*(volatile u32 *)(DUM_TCFG_ADR))
  63. #define DUM_OUTP_FORMAT1 (*(volatile u32 *)(DUM_OUTP_FORMAT1_ADR))
  64. #define DUM_OUTP_FORMAT2 (*(volatile u32 *)(DUM_OUTP_FORMAT2_ADR))
  65. #define DUM_SYNC_MODE (*(volatile u32 *)(DUM_SYNC_MODE_ADR))
  66. #define DUM_SYNC_OUT_C (*(volatile u32 *)(DUM_SYNC_OUT_C_ADR))
  67. /* DUM SLAVE ADDRESSES */
  68. #define DUM_SLAVE_WRITE_ADR (PNX4008_DUM_MAINCFG_BASE + 0x0000000)
  69. #define DUM_SLAVE_READ1_I_ADR (PNX4008_DUM_MAINCFG_BASE + 0x1000000)
  70. #define DUM_SLAVE_READ1_R_ADR (PNX4008_DUM_MAINCFG_BASE + 0x1000004)
  71. #define DUM_SLAVE_READ2_I_ADR (PNX4008_DUM_MAINCFG_BASE + 0x1000008)
  72. #define DUM_SLAVE_READ2_R_ADR (PNX4008_DUM_MAINCFG_BASE + 0x100000C)
  73. #define DUM_SLAVE_WRITE_W ((volatile u32 *)(DUM_SLAVE_WRITE_ADR))
  74. #define DUM_SLAVE_WRITE_HW ((volatile u16 *)(DUM_SLAVE_WRITE_ADR))
  75. #define DUM_SLAVE_READ1_I ((volatile u8 *)(DUM_SLAVE_READ1_I_ADR))
  76. #define DUM_SLAVE_READ1_R ((volatile u16 *)(DUM_SLAVE_READ1_R_ADR))
  77. #define DUM_SLAVE_READ2_I ((volatile u8 *)(DUM_SLAVE_READ2_I_ADR))
  78. #define DUM_SLAVE_READ2_R ((volatile u16 *)(DUM_SLAVE_READ2_R_ADR))
  79. /* Sony display register addresses */
  80. #define DISP_0_REG (0x00)
  81. #define DISP_1_REG (0x01)
  82. #define DISP_CAL_REG (0x20)
  83. #define DISP_ID_REG (0x2A)
  84. #define DISP_XMIN_L_REG (0x30)
  85. #define DISP_XMIN_H_REG (0x31)
  86. #define DISP_YMIN_REG (0x32)
  87. #define DISP_XMAX_L_REG (0x34)
  88. #define DISP_XMAX_H_REG (0x35)
  89. #define DISP_YMAX_REG (0x36)
  90. #define DISP_SYNC_EN_REG (0x38)
  91. #define DISP_SYNC_RISE_L_REG (0x3C)
  92. #define DISP_SYNC_RISE_H_REG (0x3D)
  93. #define DISP_SYNC_FALL_L_REG (0x3E)
  94. #define DISP_SYNC_FALL_H_REG (0x3F)
  95. #define DISP_PIXEL_REG (0x0B)
  96. #define DISP_DUMMY1_REG (0x28)
  97. #define DISP_DUMMY2_REG (0x29)
  98. #define DISP_TIMING_REG (0x98)
  99. #define DISP_DUMP_REG (0x99)
  100. /* Sony display constants */
  101. #define SONY_ID1 (0x22)
  102. #define SONY_ID2 (0x23)
  103. /* Philips display register addresses */
  104. #define PH_DISP_ORIENT_REG (0x003)
  105. #define PH_DISP_YPOINT_REG (0x200)
  106. #define PH_DISP_XPOINT_REG (0x201)
  107. #define PH_DISP_PIXEL_REG (0x202)
  108. #define PH_DISP_YMIN_REG (0x406)
  109. #define PH_DISP_YMAX_REG (0x407)
  110. #define PH_DISP_XMIN_REG (0x408)
  111. #define PH_DISP_XMAX_REG (0x409)
  112. /* Misc constants */
  113. #define NO_VALID_DISPLAY_FOUND (0)
  114. #define DISPLAY2_IS_NOT_CONNECTED (0)
  115. /* register values */
  116. #define V_BAC_ENABLE (BIT(0))
  117. #define V_BAC_DISABLE_IDLE (BIT(1))
  118. #define V_BAC_DISABLE_TRIG (BIT(2))
  119. #define V_DUM_RESET (BIT(3))
  120. #define V_MUX_RESET (BIT(4))
  121. #define BAC_ENABLED (BIT(0))
  122. #define BAC_DISABLED 0
  123. /* Sony LCD commands */
  124. #define V_LCD_STANDBY_OFF ((BIT(25)) | (0 << 16) | DISP_0_REG)
  125. #define V_LCD_USE_9BIT_BUS ((BIT(25)) | (2 << 16) | DISP_1_REG)
  126. #define V_LCD_SYNC_RISE_L ((BIT(25)) | (0 << 16) | DISP_SYNC_RISE_L_REG)
  127. #define V_LCD_SYNC_RISE_H ((BIT(25)) | (0 << 16) | DISP_SYNC_RISE_H_REG)
  128. #define V_LCD_SYNC_FALL_L ((BIT(25)) | (160 << 16) | DISP_SYNC_FALL_L_REG)
  129. #define V_LCD_SYNC_FALL_H ((BIT(25)) | (0 << 16) | DISP_SYNC_FALL_H_REG)
  130. #define V_LCD_SYNC_ENABLE ((BIT(25)) | (128 << 16) | DISP_SYNC_EN_REG)
  131. #define V_LCD_DISPLAY_ON ((BIT(25)) | (64 << 16) | DISP_0_REG)
  132. enum {
  133. PAD_NONE,
  134. PAD_512,
  135. PAD_1024
  136. };
  137. enum {
  138. RGB888,
  139. RGB666,
  140. RGB565,
  141. BGR565,
  142. ARGB1555,
  143. ABGR1555,
  144. ARGB4444,
  145. ABGR4444
  146. };
  147. struct dum_setup {
  148. int sync_neg_edge;
  149. int round_robin;
  150. int mux_int;
  151. int synced_dirty_flag_int;
  152. int dirty_flag_int;
  153. int error_int;
  154. int pf_empty_int;
  155. int sf_empty_int;
  156. int bac_dis_int;
  157. u32 dirty_base_adr;
  158. u32 command_base_adr;
  159. u32 sync_clk_div;
  160. int sync_output;
  161. u32 sync_restart_val;
  162. u32 set_sync_high;
  163. u32 set_sync_low;
  164. };
  165. struct dum_ch_setup {
  166. int disp_no;
  167. u32 xmin;
  168. u32 ymin;
  169. u32 xmax;
  170. u32 ymax;
  171. int xmirror;
  172. int ymirror;
  173. int rotate;
  174. u32 minadr;
  175. u32 maxadr;
  176. u32 dirtybuffer;
  177. int pad;
  178. int format;
  179. int hwdirty;
  180. int slave_trans;
  181. };
  182. struct disp_window {
  183. u32 xmin_l;
  184. u32 xmin_h;
  185. u32 ymin;
  186. u32 xmax_l;
  187. u32 xmax_h;
  188. u32 ymax;
  189. };
  190. #endif /* #ifndef __PNX008_DUM_H__ */