lxfb.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. #ifndef _LXFB_H_
  2. #define _LXFB_H_
  3. #include <linux/fb.h>
  4. #define OUTPUT_CRT 0x01
  5. #define OUTPUT_PANEL 0x02
  6. struct lxfb_par {
  7. int output;
  8. int panel_width;
  9. int panel_height;
  10. void __iomem *gp_regs;
  11. void __iomem *dc_regs;
  12. void __iomem *df_regs;
  13. };
  14. static inline unsigned int lx_get_pitch(unsigned int xres, int bpp)
  15. {
  16. return (((xres * (bpp >> 3)) + 7) & ~7);
  17. }
  18. void lx_set_mode(struct fb_info *);
  19. void lx_get_gamma(struct fb_info *, unsigned int *, int);
  20. void lx_set_gamma(struct fb_info *, unsigned int *, int);
  21. unsigned int lx_framebuffer_size(void);
  22. int lx_blank_display(struct fb_info *, int);
  23. void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int,
  24. unsigned int, unsigned int);
  25. /* MSRS */
  26. #define MSR_LX_GLD_CONFIG 0x48002001
  27. #define MSR_LX_GLCP_DOTPLL 0x4c000015
  28. #define MSR_LX_DF_PADSEL 0x48000011
  29. #define MSR_LX_DC_SPARE 0x80000011
  30. #define MSR_LX_DF_GLCONFIG 0x48002001
  31. #define MSR_LX_GLIU0_P2D_RO0 0x10000029
  32. #define GLCP_DOTPLL_RESET (1 << 0)
  33. #define GLCP_DOTPLL_BYPASS (1 << 15)
  34. #define GLCP_DOTPLL_HALFPIX (1 << 24)
  35. #define GLCP_DOTPLL_LOCK (1 << 25)
  36. #define DF_CONFIG_OUTPUT_MASK 0x38
  37. #define DF_OUTPUT_PANEL 0x08
  38. #define DF_OUTPUT_CRT 0x00
  39. #define DF_SIMULTANEOUS_CRT_AND_FP (1 << 15)
  40. #define DF_DEFAULT_TFT_PAD_SEL_LOW 0xDFFFFFFF
  41. #define DF_DEFAULT_TFT_PAD_SEL_HIGH 0x0000003F
  42. #define DC_SPARE_DISABLE_CFIFO_HGO 0x00000800
  43. #define DC_SPARE_VFIFO_ARB_SELECT 0x00000400
  44. #define DC_SPARE_WM_LPEN_OVRD 0x00000200
  45. #define DC_SPARE_LOAD_WM_LPEN_MASK 0x00000100
  46. #define DC_SPARE_DISABLE_INIT_VID_PRI 0x00000080
  47. #define DC_SPARE_DISABLE_VFIFO_WM 0x00000040
  48. #define DC_SPARE_DISABLE_CWD_CHECK 0x00000020
  49. #define DC_SPARE_PIX8_PAN_FIX 0x00000010
  50. #define DC_SPARE_FIRST_REQ_MASK 0x00000002
  51. /* Registers */
  52. #define DC_UNLOCK 0x00
  53. #define DC_UNLOCK_CODE 0x4758
  54. #define DC_GENERAL_CFG 0x04
  55. #define DC_GCFG_DFLE (1 << 0)
  56. #define DC_GCFG_VIDE (1 << 3)
  57. #define DC_GCFG_VGAE (1 << 7)
  58. #define DC_GCFG_CMPE (1 << 5)
  59. #define DC_GCFG_DECE (1 << 6)
  60. #define DC_GCFG_FDTY (1 << 17)
  61. #define DC_DISPLAY_CFG 0x08
  62. #define DC_DCFG_TGEN (1 << 0)
  63. #define DC_DCFG_GDEN (1 << 3)
  64. #define DC_DCFG_VDEN (1 << 4)
  65. #define DC_DCFG_TRUP (1 << 6)
  66. #define DC_DCFG_DCEN (1 << 24)
  67. #define DC_DCFG_PALB (1 << 25)
  68. #define DC_DCFG_VISL (1 << 27)
  69. #define DC_DCFG_16BPP 0x0
  70. #define DC_DCFG_DISP_MODE_MASK 0x00000300
  71. #define DC_DCFG_DISP_MODE_8BPP 0x00000000
  72. #define DC_DCFG_DISP_MODE_16BPP 0x00000100
  73. #define DC_DCFG_DISP_MODE_24BPP 0x00000200
  74. #define DC_DCFG_DISP_MODE_32BPP 0x00000300
  75. #define DC_ARB_CFG 0x0C
  76. #define DC_FB_START 0x10
  77. #define DC_CB_START 0x14
  78. #define DC_CURSOR_START 0x18
  79. #define DC_DV_TOP 0x2C
  80. #define DC_DV_TOP_ENABLE (1 << 0)
  81. #define DC_LINE_SIZE 0x30
  82. #define DC_GRAPHICS_PITCH 0x34
  83. #define DC_H_ACTIVE_TIMING 0x40
  84. #define DC_H_BLANK_TIMING 0x44
  85. #define DC_H_SYNC_TIMING 0x48
  86. #define DC_V_ACTIVE_TIMING 0x50
  87. #define DC_V_BLANK_TIMING 0x54
  88. #define DC_V_SYNC_TIMING 0x58
  89. #define DC_FB_ACTIVE 0x5C
  90. #define DC_PAL_ADDRESS 0x70
  91. #define DC_PAL_DATA 0x74
  92. #define DC_PHY_MEM_OFFSET 0x84
  93. #define DC_DV_CTL 0x88
  94. #define DC_DV_LINE_SIZE_MASK 0x00000C00
  95. #define DC_DV_LINE_SIZE_1024 0x00000000
  96. #define DC_DV_LINE_SIZE_2048 0x00000400
  97. #define DC_DV_LINE_SIZE_4096 0x00000800
  98. #define DC_DV_LINE_SIZE_8192 0x00000C00
  99. #define DC_GFX_SCALE 0x90
  100. #define DC_IRQ_FILT_CTL 0x94
  101. #define DC_IRQ 0xC8
  102. #define DC_IRQ_MASK (1 << 0)
  103. #define DC_VSYNC_IRQ_MASK (1 << 1)
  104. #define DC_IRQ_STATUS (1 << 20)
  105. #define DC_VSYNC_IRQ_STATUS (1 << 21)
  106. #define DC_GENLCK_CTRL 0xD4
  107. #define DC_GENLCK_ENABLE (1 << 18)
  108. #define DC_GC_ALPHA_FLICK_ENABLE (1 << 25)
  109. #define DC_GC_FLICKER_FILTER_ENABLE (1 << 24)
  110. #define DC_GC_FLICKER_FILTER_MASK (0x0F << 28)
  111. #define DC_COLOR_KEY 0xB8
  112. #define DC_CLR_KEY_ENABLE (1 << 24)
  113. #define DC3_DV_LINE_SIZE_MASK 0x00000C00
  114. #define DC3_DV_LINE_SIZE_1024 0x00000000
  115. #define DC3_DV_LINE_SIZE_2048 0x00000400
  116. #define DC3_DV_LINE_SIZE_4096 0x00000800
  117. #define DC3_DV_LINE_SIZE_8192 0x00000C00
  118. #define DF_VIDEO_CFG 0x0
  119. #define DF_VCFG_VID_EN (1 << 0)
  120. #define DF_DISPLAY_CFG 0x08
  121. #define DF_DCFG_CRT_EN (1 << 0)
  122. #define DF_DCFG_HSYNC_EN (1 << 1)
  123. #define DF_DCFG_VSYNC_EN (1 << 2)
  124. #define DF_DCFG_DAC_BL_EN (1 << 3)
  125. #define DF_DCFG_CRT_HSYNC_POL (1 << 8)
  126. #define DF_DCFG_CRT_VSYNC_POL (1 << 9)
  127. #define DF_DCFG_GV_PAL_BYP (1 << 21)
  128. #define DF_DCFG_CRT_SYNC_SKW_INIT 0x10000
  129. #define DF_DCFG_CRT_SYNC_SKW_MASK 0x1c000
  130. #define DF_DCFG_PWR_SEQ_DLY_INIT 0x80000
  131. #define DF_DCFG_PWR_SEQ_DLY_MASK 0xe0000
  132. #define DF_MISC 0x50
  133. #define DF_MISC_GAM_BYPASS (1 << 0)
  134. #define DF_MISC_DAC_PWRDN (1 << 10)
  135. #define DF_MISC_A_PWRDN (1 << 11)
  136. #define DF_PAR 0x38
  137. #define DF_PDR 0x40
  138. #define DF_ALPHA_CONTROL_1 0xD8
  139. #define DF_VIDEO_REQUEST 0x120
  140. #define DF_PANEL_TIM1 0x400
  141. #define DF_DEFAULT_TFT_PMTIM1 0x0
  142. #define DF_PANEL_TIM2 0x408
  143. #define DF_DEFAULT_TFT_PMTIM2 0x08000000
  144. #define DF_FP_PM 0x410
  145. #define DF_FP_PM_P (1 << 24)
  146. #define DF_DITHER_CONTROL 0x418
  147. #define DF_DEFAULT_TFT_DITHCTL 0x00000070
  148. #define GP_BLT_STATUS 0x44
  149. #define GP_BS_BLT_BUSY (1 << 0)
  150. #define GP_BS_CB_EMPTY (1 << 4)
  151. #endif