au1100fb.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. /*
  2. * BRIEF MODULE DESCRIPTION
  3. * Hardware definitions for the Au1100 LCD controller
  4. *
  5. * Copyright 2002 MontaVista Software
  6. * Copyright 2002 Alchemy Semiconductor
  7. * Author: Alchemy Semiconductor, MontaVista Software
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License as published by the
  11. * Free Software Foundation; either version 2 of the License, or (at your
  12. * option) any later version.
  13. *
  14. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  15. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  16. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  17. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  18. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  19. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  20. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  21. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  23. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. *
  25. * You should have received a copy of the GNU General Public License along
  26. * with this program; if not, write to the Free Software Foundation, Inc.,
  27. * 675 Mass Ave, Cambridge, MA 02139, USA.
  28. */
  29. #ifndef _AU1100LCD_H
  30. #define _AU1100LCD_H
  31. /********************************************************************/
  32. #define uint32 unsigned long
  33. typedef volatile struct
  34. {
  35. uint32 lcd_control;
  36. uint32 lcd_intstatus;
  37. uint32 lcd_intenable;
  38. uint32 lcd_horztiming;
  39. uint32 lcd_verttiming;
  40. uint32 lcd_clkcontrol;
  41. uint32 lcd_dmaaddr0;
  42. uint32 lcd_dmaaddr1;
  43. uint32 lcd_words;
  44. uint32 lcd_pwmdiv;
  45. uint32 lcd_pwmhi;
  46. uint32 reserved[(0x0400-0x002C)/4];
  47. uint32 lcd_pallettebase[256];
  48. } AU1100_LCD;
  49. /********************************************************************/
  50. #define AU1100_LCD_ADDR 0xB5000000
  51. /*
  52. * Register bit definitions
  53. */
  54. /* lcd_control */
  55. #define LCD_CONTROL_SBPPF (7<<18)
  56. #define LCD_CONTROL_SBPPF_655 (0<<18)
  57. #define LCD_CONTROL_SBPPF_565 (1<<18)
  58. #define LCD_CONTROL_SBPPF_556 (2<<18)
  59. #define LCD_CONTROL_SBPPF_1555 (3<<18)
  60. #define LCD_CONTROL_SBPPF_5551 (4<<18)
  61. #define LCD_CONTROL_WP (1<<17)
  62. #define LCD_CONTROL_WD (1<<16)
  63. #define LCD_CONTROL_C (1<<15)
  64. #define LCD_CONTROL_SM (3<<13)
  65. #define LCD_CONTROL_SM_0 (0<<13)
  66. #define LCD_CONTROL_SM_90 (1<<13)
  67. #define LCD_CONTROL_SM_180 (2<<13)
  68. #define LCD_CONTROL_SM_270 (3<<13)
  69. #define LCD_CONTROL_DB (1<<12)
  70. #define LCD_CONTROL_CCO (1<<11)
  71. #define LCD_CONTROL_DP (1<<10)
  72. #define LCD_CONTROL_PO (3<<8)
  73. #define LCD_CONTROL_PO_00 (0<<8)
  74. #define LCD_CONTROL_PO_01 (1<<8)
  75. #define LCD_CONTROL_PO_10 (2<<8)
  76. #define LCD_CONTROL_PO_11 (3<<8)
  77. #define LCD_CONTROL_MPI (1<<7)
  78. #define LCD_CONTROL_PT (1<<6)
  79. #define LCD_CONTROL_PC (1<<5)
  80. #define LCD_CONTROL_BPP (7<<1)
  81. #define LCD_CONTROL_BPP_1 (0<<1)
  82. #define LCD_CONTROL_BPP_2 (1<<1)
  83. #define LCD_CONTROL_BPP_4 (2<<1)
  84. #define LCD_CONTROL_BPP_8 (3<<1)
  85. #define LCD_CONTROL_BPP_12 (4<<1)
  86. #define LCD_CONTROL_BPP_16 (5<<1)
  87. #define LCD_CONTROL_GO (1<<0)
  88. /* lcd_intstatus, lcd_intenable */
  89. #define LCD_INT_SD (1<<7)
  90. #define LCD_INT_OF (1<<6)
  91. #define LCD_INT_UF (1<<5)
  92. #define LCD_INT_SA (1<<3)
  93. #define LCD_INT_SS (1<<2)
  94. #define LCD_INT_S1 (1<<1)
  95. #define LCD_INT_S0 (1<<0)
  96. /* lcd_horztiming */
  97. #define LCD_HORZTIMING_HN2 (255<<24)
  98. #define LCD_HORZTIMING_HN2_N(N) (((N)-1)<<24)
  99. #define LCD_HORZTIMING_HN1 (255<<16)
  100. #define LCD_HORZTIMING_HN1_N(N) (((N)-1)<<16)
  101. #define LCD_HORZTIMING_HPW (63<<10)
  102. #define LCD_HORZTIMING_HPW_N(N) (((N)-1)<<10)
  103. #define LCD_HORZTIMING_PPL (1023<<0)
  104. #define LCD_HORZTIMING_PPL_N(N) (((N)-1)<<0)
  105. /* lcd_verttiming */
  106. #define LCD_VERTTIMING_VN2 (255<<24)
  107. #define LCD_VERTTIMING_VN2_N(N) (((N)-1)<<24)
  108. #define LCD_VERTTIMING_VN1 (255<<16)
  109. #define LCD_VERTTIMING_VN1_N(N) (((N)-1)<<16)
  110. #define LCD_VERTTIMING_VPW (63<<10)
  111. #define LCD_VERTTIMING_VPW_N(N) (((N)-1)<<10)
  112. #define LCD_VERTTIMING_LPP (1023<<0)
  113. #define LCD_VERTTIMING_LPP_N(N) (((N)-1)<<0)
  114. /* lcd_clkcontrol */
  115. #define LCD_CLKCONTROL_IB (1<<18)
  116. #define LCD_CLKCONTROL_IC (1<<17)
  117. #define LCD_CLKCONTROL_IH (1<<16)
  118. #define LCD_CLKCONTROL_IV (1<<15)
  119. #define LCD_CLKCONTROL_BF (31<<10)
  120. #define LCD_CLKCONTROL_BF_N(N) (((N)-1)<<10)
  121. #define LCD_CLKCONTROL_PCD (1023<<0)
  122. #define LCD_CLKCONTROL_PCD_N(N) ((N)<<0)
  123. /* lcd_pwmdiv */
  124. #define LCD_PWMDIV_EN (1<<12)
  125. #define LCD_PWMDIV_PWMDIV (2047<<0)
  126. #define LCD_PWMDIV_PWMDIV_N(N) (((N)-1)<<0)
  127. /* lcd_pwmhi */
  128. #define LCD_PWMHI_PWMHI1 (2047<<12)
  129. #define LCD_PWMHI_PWMHI1_N(N) ((N)<<12)
  130. #define LCD_PWMHI_PWMHI0 (2047<<0)
  131. #define LCD_PWMHI_PWMHI0_N(N) ((N)<<0)
  132. /* lcd_pallettebase - MONOCHROME */
  133. #define LCD_PALLETTE_MONO_MI (15<<0)
  134. #define LCD_PALLETTE_MONO_MI_N(N) ((N)<<0)
  135. /* lcd_pallettebase - COLOR */
  136. #define LCD_PALLETTE_COLOR_BI (15<<8)
  137. #define LCD_PALLETTE_COLOR_BI_N(N) ((N)<<8)
  138. #define LCD_PALLETTE_COLOR_GI (15<<4)
  139. #define LCD_PALLETTE_COLOR_GI_N(N) ((N)<<4)
  140. #define LCD_PALLETTE_COLOR_RI (15<<0)
  141. #define LCD_PALLETTE_COLOR_RI_N(N) ((N)<<0)
  142. /* lcd_palletebase - COLOR TFT PALLETIZED */
  143. #define LCD_PALLETTE_TFT_DC (65535<<0)
  144. #define LCD_PALLETTE_TFT_DC_N(N) ((N)<<0)
  145. /********************************************************************/
  146. struct known_lcd_panels
  147. {
  148. uint32 xres;
  149. uint32 yres;
  150. uint32 bpp;
  151. unsigned char panel_name[256];
  152. uint32 mode_control;
  153. uint32 mode_horztiming;
  154. uint32 mode_verttiming;
  155. uint32 mode_clkcontrol;
  156. uint32 mode_pwmdiv;
  157. uint32 mode_pwmhi;
  158. uint32 mode_toyclksrc;
  159. uint32 mode_backlight;
  160. };
  161. #if defined(__BIG_ENDIAN)
  162. #define LCD_DEFAULT_PIX_FORMAT LCD_CONTROL_PO_11
  163. #else
  164. #define LCD_DEFAULT_PIX_FORMAT LCD_CONTROL_PO_00
  165. #endif
  166. /*
  167. * The fb driver assumes that AUX PLL is at 48MHz. That can
  168. * cover up to 800x600 resolution; if you need higher resolution,
  169. * you should modify the driver as needed, not just this structure.
  170. */
  171. struct known_lcd_panels panels[] =
  172. {
  173. { /* 0: Pb1100 LCDA: Sharp 320x240 TFT panel */
  174. 320, /* xres */
  175. 240, /* yres */
  176. 16, /* bpp */
  177. "Sharp_320x240_16",
  178. /* mode_control */
  179. ( LCD_CONTROL_SBPPF_565
  180. /*LCD_CONTROL_WP*/
  181. /*LCD_CONTROL_WD*/
  182. | LCD_CONTROL_C
  183. | LCD_CONTROL_SM_0
  184. /*LCD_CONTROL_DB*/
  185. /*LCD_CONTROL_CCO*/
  186. /*LCD_CONTROL_DP*/
  187. | LCD_DEFAULT_PIX_FORMAT
  188. /*LCD_CONTROL_MPI*/
  189. | LCD_CONTROL_PT
  190. | LCD_CONTROL_PC
  191. | LCD_CONTROL_BPP_16 ),
  192. /* mode_horztiming */
  193. ( LCD_HORZTIMING_HN2_N(8)
  194. | LCD_HORZTIMING_HN1_N(60)
  195. | LCD_HORZTIMING_HPW_N(12)
  196. | LCD_HORZTIMING_PPL_N(320) ),
  197. /* mode_verttiming */
  198. ( LCD_VERTTIMING_VN2_N(5)
  199. | LCD_VERTTIMING_VN1_N(17)
  200. | LCD_VERTTIMING_VPW_N(1)
  201. | LCD_VERTTIMING_LPP_N(240) ),
  202. /* mode_clkcontrol */
  203. ( 0
  204. /*LCD_CLKCONTROL_IB*/
  205. /*LCD_CLKCONTROL_IC*/
  206. /*LCD_CLKCONTROL_IH*/
  207. /*LCD_CLKCONTROL_IV*/
  208. | LCD_CLKCONTROL_PCD_N(1) ),
  209. /* mode_pwmdiv */
  210. 0,
  211. /* mode_pwmhi */
  212. 0,
  213. /* mode_toyclksrc */
  214. ((1<<7) | (1<<6) | (1<<5)),
  215. /* mode_backlight */
  216. 6
  217. },
  218. { /* 1: Pb1100 LCDC 640x480 TFT panel */
  219. 640, /* xres */
  220. 480, /* yres */
  221. 16, /* bpp */
  222. "Generic_640x480_16",
  223. /* mode_control */
  224. 0x004806a | LCD_DEFAULT_PIX_FORMAT,
  225. /* mode_horztiming */
  226. 0x3434d67f,
  227. /* mode_verttiming */
  228. 0x0e0e39df,
  229. /* mode_clkcontrol */
  230. ( 0
  231. /*LCD_CLKCONTROL_IB*/
  232. /*LCD_CLKCONTROL_IC*/
  233. /*LCD_CLKCONTROL_IH*/
  234. /*LCD_CLKCONTROL_IV*/
  235. | LCD_CLKCONTROL_PCD_N(1) ),
  236. /* mode_pwmdiv */
  237. 0,
  238. /* mode_pwmhi */
  239. 0,
  240. /* mode_toyclksrc */
  241. ((1<<7) | (1<<6) | (0<<5)),
  242. /* mode_backlight */
  243. 7
  244. },
  245. { /* 2: Pb1100 LCDB 640x480 PrimeView TFT panel */
  246. 640, /* xres */
  247. 480, /* yres */
  248. 16, /* bpp */
  249. "PrimeView_640x480_16",
  250. /* mode_control */
  251. 0x0004886a | LCD_DEFAULT_PIX_FORMAT,
  252. /* mode_horztiming */
  253. 0x0e4bfe7f,
  254. /* mode_verttiming */
  255. 0x210805df,
  256. /* mode_clkcontrol */
  257. 0x00038001,
  258. /* mode_pwmdiv */
  259. 0,
  260. /* mode_pwmhi */
  261. 0,
  262. /* mode_toyclksrc */
  263. ((1<<7) | (1<<6) | (0<<5)),
  264. /* mode_backlight */
  265. 7
  266. },
  267. { /* 3: Pb1100 800x600x16bpp NEON CRT */
  268. 800, /* xres */
  269. 600, /* yres */
  270. 16, /* bpp */
  271. "NEON_800x600_16",
  272. /* mode_control */
  273. 0x0004886A | LCD_DEFAULT_PIX_FORMAT,
  274. /* mode_horztiming */
  275. 0x005AFF1F,
  276. /* mode_verttiming */
  277. 0x16000E57,
  278. /* mode_clkcontrol */
  279. 0x00020000,
  280. /* mode_pwmdiv */
  281. 0,
  282. /* mode_pwmhi */
  283. 0,
  284. /* mode_toyclksrc */
  285. ((1<<7) | (1<<6) | (0<<5)),
  286. /* mode_backlight */
  287. 7
  288. },
  289. { /* 4: Pb1100 640x480x16bpp NEON CRT */
  290. 640, /* xres */
  291. 480, /* yres */
  292. 16, /* bpp */
  293. "NEON_640x480_16",
  294. /* mode_control */
  295. 0x0004886A | LCD_DEFAULT_PIX_FORMAT,
  296. /* mode_horztiming */
  297. 0x0052E27F,
  298. /* mode_verttiming */
  299. 0x18000DDF,
  300. /* mode_clkcontrol */
  301. 0x00020000,
  302. /* mode_pwmdiv */
  303. 0,
  304. /* mode_pwmhi */
  305. 0,
  306. /* mode_toyclksrc */
  307. ((1<<7) | (1<<6) | (0<<5)),
  308. /* mode_backlight */
  309. 7
  310. },
  311. };
  312. #endif /* _AU1100LCD_H */