sh7760fb.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /*
  2. * sh7760fb.h -- platform data for SH7760/SH7763 LCDC framebuffer driver.
  3. *
  4. * (c) 2006-2008 MSC Vertriebsges.m.b.H.,
  5. * Manuel Lauss <mano@roarinelk.homelinux.net>
  6. * (c) 2008 Nobuhiro Iwamatsu <iwamatsu.nobuhiro@renesas.com>
  7. */
  8. #ifndef _ASM_SH_SH7760FB_H
  9. #define _ASM_SH_SH7760FB_H
  10. /*
  11. * some bits of the colormap registers should be written as zero.
  12. * create a mask for that.
  13. */
  14. #define SH7760FB_PALETTE_MASK 0x00f8fcf8
  15. /* The LCDC dma engine always sets bits 27-26 to 1: this is Area3 */
  16. #define SH7760FB_DMA_MASK 0x0C000000
  17. /* palette */
  18. #define LDPR(x) (((x) << 2))
  19. /* framebuffer registers and bits */
  20. #define LDICKR 0x400
  21. #define LDMTR 0x402
  22. /* see sh7760fb.h for LDMTR bits */
  23. #define LDDFR 0x404
  24. #define LDDFR_PABD (1 << 8)
  25. #define LDDFR_COLOR_MASK 0x7F
  26. #define LDSMR 0x406
  27. #define LDSMR_ROT (1 << 13)
  28. #define LDSARU 0x408
  29. #define LDSARL 0x40c
  30. #define LDLAOR 0x410
  31. #define LDPALCR 0x412
  32. #define LDPALCR_PALS (1 << 4)
  33. #define LDPALCR_PALEN (1 << 0)
  34. #define LDHCNR 0x414
  35. #define LDHSYNR 0x416
  36. #define LDVDLNR 0x418
  37. #define LDVTLNR 0x41a
  38. #define LDVSYNR 0x41c
  39. #define LDACLNR 0x41e
  40. #define LDINTR 0x420
  41. #define LDPMMR 0x424
  42. #define LDPSPR 0x426
  43. #define LDCNTR 0x428
  44. #define LDCNTR_DON (1 << 0)
  45. #define LDCNTR_DON2 (1 << 4)
  46. #ifdef CONFIG_CPU_SUBTYPE_SH7763
  47. # define LDLIRNR 0x440
  48. /* LDINTR bit */
  49. # define LDINTR_MINTEN (1 << 15)
  50. # define LDINTR_FINTEN (1 << 14)
  51. # define LDINTR_VSINTEN (1 << 13)
  52. # define LDINTR_VEINTEN (1 << 12)
  53. # define LDINTR_MINTS (1 << 11)
  54. # define LDINTR_FINTS (1 << 10)
  55. # define LDINTR_VSINTS (1 << 9)
  56. # define LDINTR_VEINTS (1 << 8)
  57. # define VINT_START (LDINTR_VSINTEN)
  58. # define VINT_CHECK (LDINTR_VSINTS)
  59. #else
  60. /* LDINTR bit */
  61. # define LDINTR_VINTSEL (1 << 12)
  62. # define LDINTR_VINTE (1 << 8)
  63. # define LDINTR_VINTS (1 << 0)
  64. # define VINT_START (LDINTR_VINTSEL)
  65. # define VINT_CHECK (LDINTR_VINTS)
  66. #endif
  67. /* HSYNC polarity inversion */
  68. #define LDMTR_FLMPOL (1 << 15)
  69. /* VSYNC polarity inversion */
  70. #define LDMTR_CL1POL (1 << 14)
  71. /* DISPLAY-ENABLE polarity inversion */
  72. #define LDMTR_DISPEN_LOWACT (1 << 13)
  73. /* DISPLAY DATA BUS polarity inversion */
  74. #define LDMTR_DPOL_LOWACT (1 << 12)
  75. /* AC modulation signal enable */
  76. #define LDMTR_MCNT (1 << 10)
  77. /* Disable output of HSYNC during VSYNC period */
  78. #define LDMTR_CL1CNT (1 << 9)
  79. /* Disable output of VSYNC during VSYNC period */
  80. #define LDMTR_CL2CNT (1 << 8)
  81. /* Display types supported by the LCDC */
  82. #define LDMTR_STN_MONO_4 0x00
  83. #define LDMTR_STN_MONO_8 0x01
  84. #define LDMTR_STN_COLOR_4 0x08
  85. #define LDMTR_STN_COLOR_8 0x09
  86. #define LDMTR_STN_COLOR_12 0x0A
  87. #define LDMTR_STN_COLOR_16 0x0B
  88. #define LDMTR_DSTN_MONO_8 0x11
  89. #define LDMTR_DSTN_MONO_16 0x13
  90. #define LDMTR_DSTN_COLOR_8 0x19
  91. #define LDMTR_DSTN_COLOR_12 0x1A
  92. #define LDMTR_DSTN_COLOR_16 0x1B
  93. #define LDMTR_TFT_COLOR_16 0x2B
  94. /* framebuffer color layout */
  95. #define LDDFR_1BPP_MONO 0x00
  96. #define LDDFR_2BPP_MONO 0x01
  97. #define LDDFR_4BPP_MONO 0x02
  98. #define LDDFR_6BPP_MONO 0x04
  99. #define LDDFR_4BPP 0x0A
  100. #define LDDFR_8BPP 0x0C
  101. #define LDDFR_16BPP_RGB555 0x1D
  102. #define LDDFR_16BPP_RGB565 0x2D
  103. /* LCDC Pixclock sources */
  104. #define LCDC_CLKSRC_BUSCLOCK 0
  105. #define LCDC_CLKSRC_PERIPHERAL 1
  106. #define LCDC_CLKSRC_EXTERNAL 2
  107. #define LDICKR_CLKSRC(x) \
  108. (((x) & 3) << 12)
  109. /* LCDC pixclock input divider. Set to 1 at a minimum! */
  110. #define LDICKR_CLKDIV(x) \
  111. ((x) & 0x1f)
  112. struct sh7760fb_platdata {
  113. /* Set this member to a valid fb_videmode for the display you
  114. * wish to use. The following members must be initialized:
  115. * xres, yres, hsync_len, vsync_len, sync,
  116. * {left,right,upper,lower}_margin.
  117. * The driver uses the above members to calculate register values
  118. * and memory requirements. Other members are ignored but may
  119. * be used by other framebuffer layer components.
  120. */
  121. struct fb_videomode *def_mode;
  122. /* LDMTR includes display type and signal polarity. The
  123. * HSYNC/VSYNC polarities are derived from the fb_var_screeninfo
  124. * data above; however the polarities of the following signals
  125. * must be encoded in the ldmtr member:
  126. * Display Enable signal (default high-active) DISPEN_LOWACT
  127. * Display Data signals (default high-active) DPOL_LOWACT
  128. * AC Modulation signal (default off) MCNT
  129. * Hsync-During-Vsync suppression (default off) CL1CNT
  130. * Vsync-during-vsync suppression (default off) CL2CNT
  131. * NOTE: also set a display type!
  132. * (one of LDMTR_{STN,DSTN,TFT}_{MONO,COLOR}_{4,8,12,16})
  133. */
  134. u16 ldmtr;
  135. /* LDDFR controls framebuffer image format (depth, organization)
  136. * Use ONE of the LDDFR_?BPP_* macros!
  137. */
  138. u16 lddfr;
  139. /* LDPMMR and LDPSPR control the timing of the power signals
  140. * for the display. Please read the SH7760 Hardware Manual,
  141. * Chapters 30.3.17, 30.3.18 and 30.4.6!
  142. */
  143. u16 ldpmmr;
  144. u16 ldpspr;
  145. /* LDACLNR contains the line numbers after which the AC modulation
  146. * signal is to toggle. Set to ZERO for TFTs or displays which
  147. * do not need it. (Chapter 30.3.15 in SH7760 Hardware Manual).
  148. */
  149. u16 ldaclnr;
  150. /* LDICKR contains information on pixelclock source and config.
  151. * Please use the LDICKR_CLKSRC() and LDICKR_CLKDIV() macros.
  152. * minimal value for CLKDIV() must be 1!.
  153. */
  154. u16 ldickr;
  155. /* set this member to 1 if you wish to use the LCDC's hardware
  156. * rotation function. This is limited to displays <= 320x200
  157. * pixels resolution!
  158. */
  159. int rotate; /* set to 1 to rotate 90 CCW */
  160. /* set this to 1 to suppress vsync irq use. */
  161. int novsync;
  162. /* blanking hook for platform. Set this if your platform can do
  163. * more than the LCDC in terms of blanking (e.g. disable clock
  164. * generator / backlight power supply / etc.
  165. */
  166. void (*blank) (int);
  167. };
  168. #endif /* _ASM_SH_SH7760FB_H */