mpc8xx_lcd.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. /*
  2. * (C) Copyright 2001-2002
  3. * Wolfgang Denk, DENX Software Engineering -- wd@denx.de
  4. *
  5. * See file CREDITS for list of people who contributed to this
  6. * project.
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License as
  10. * published by the Free Software Foundation; either version 2 of
  11. * the License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  21. * MA 02111-1307 USA
  22. */
  23. /************************************************************************/
  24. /* ** HEADER FILES */
  25. /************************************************************************/
  26. /* #define DEBUG */
  27. #include <config.h>
  28. #include <common.h>
  29. #include <command.h>
  30. #include <watchdog.h>
  31. #include <version.h>
  32. #include <stdarg.h>
  33. #include <lcdvideo.h>
  34. #include <linux/types.h>
  35. #include <stdio_dev.h>
  36. #if defined(CONFIG_POST)
  37. #include <post.h>
  38. #endif
  39. #include <lcd.h>
  40. #ifdef CONFIG_LCD
  41. /************************************************************************/
  42. /* ** CONFIG STUFF -- should be moved to board config file */
  43. /************************************************************************/
  44. #ifndef CONFIG_LCD_INFO
  45. #define CONFIG_LCD_INFO /* Display Logo, (C) and system info */
  46. #endif
  47. #if defined(CONFIG_V37) || defined(CONFIG_EDT32F10)
  48. #undef CONFIG_LCD_LOGO
  49. #undef CONFIG_LCD_INFO
  50. #endif
  51. /*----------------------------------------------------------------------*/
  52. #ifdef CONFIG_KYOCERA_KCS057QV1AJ
  53. /*
  54. * Kyocera KCS057QV1AJ-G23. Passive, color, single scan.
  55. */
  56. #define LCD_BPP LCD_COLOR4
  57. vidinfo_t panel_info = {
  58. 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH,
  59. LCD_BPP, 1, 0, 1, 0, 5, 0, 0, 0
  60. /* wbl, vpw, lcdac, wbf */
  61. };
  62. #endif /* CONFIG_KYOCERA_KCS057QV1AJ */
  63. /*----------------------------------------------------------------------*/
  64. /*----------------------------------------------------------------------*/
  65. #ifdef CONFIG_HITACHI_SP19X001_Z1A
  66. /*
  67. * Hitachi SP19X001-. Active, color, single scan.
  68. */
  69. vidinfo_t panel_info = {
  70. 640, 480, 154, 116, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH,
  71. LCD_COLOR8, 1, 0, 1, 0, 0, 0, 0, 0
  72. /* wbl, vpw, lcdac, wbf */
  73. };
  74. #endif /* CONFIG_HITACHI_SP19X001_Z1A */
  75. /*----------------------------------------------------------------------*/
  76. /*----------------------------------------------------------------------*/
  77. #ifdef CONFIG_NEC_NL6448AC33
  78. /*
  79. * NEC NL6448AC33-18. Active, color, single scan.
  80. */
  81. vidinfo_t panel_info = {
  82. 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH,
  83. 3, 0, 0, 1, 1, 144, 2, 0, 33
  84. /* wbl, vpw, lcdac, wbf */
  85. };
  86. #endif /* CONFIG_NEC_NL6448AC33 */
  87. /*----------------------------------------------------------------------*/
  88. #ifdef CONFIG_NEC_NL6448BC20
  89. /*
  90. * NEC NL6448BC20-08. 6.5", 640x480. Active, color, single scan.
  91. */
  92. vidinfo_t panel_info = {
  93. 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH,
  94. 3, 0, 0, 1, 1, 144, 2, 0, 33
  95. /* wbl, vpw, lcdac, wbf */
  96. };
  97. #endif /* CONFIG_NEC_NL6448BC20 */
  98. /*----------------------------------------------------------------------*/
  99. #ifdef CONFIG_NEC_NL6448BC33_54
  100. /*
  101. * NEC NL6448BC33-54. 10.4", 640x480. Active, color, single scan.
  102. */
  103. vidinfo_t panel_info = {
  104. 640, 480, 212, 158, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH,
  105. 3, 0, 0, 1, 1, 144, 2, 0, 33
  106. /* wbl, vpw, lcdac, wbf */
  107. };
  108. #endif /* CONFIG_NEC_NL6448BC33_54 */
  109. /*----------------------------------------------------------------------*/
  110. #ifdef CONFIG_SHARP_LQ104V7DS01
  111. /*
  112. * SHARP LQ104V7DS01. 6.5", 640x480. Active, color, single scan.
  113. */
  114. vidinfo_t panel_info = {
  115. 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_LOW,
  116. 3, 0, 0, 1, 1, 25, 1, 0, 33
  117. /* wbl, vpw, lcdac, wbf */
  118. };
  119. #endif /* CONFIG_SHARP_LQ104V7DS01 */
  120. /*----------------------------------------------------------------------*/
  121. #ifdef CONFIG_SHARP_16x9
  122. /*
  123. * Sharp 320x240. Active, color, single scan. It isn't 16x9, and I am
  124. * not sure what it is.......
  125. */
  126. vidinfo_t panel_info = {
  127. 320, 240, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH,
  128. 3, 0, 0, 1, 1, 15, 4, 0, 3
  129. };
  130. #endif /* CONFIG_SHARP_16x9 */
  131. /*----------------------------------------------------------------------*/
  132. #ifdef CONFIG_SHARP_LQ057Q3DC02
  133. /*
  134. * Sharp LQ057Q3DC02 display. Active, color, single scan.
  135. */
  136. #undef LCD_DF
  137. #define LCD_DF 12
  138. vidinfo_t panel_info = {
  139. 320, 240, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH,
  140. 3, 0, 0, 1, 1, 15, 4, 0, 3
  141. /* wbl, vpw, lcdac, wbf */
  142. };
  143. #define CONFIG_LCD_INFO_BELOW_LOGO
  144. #endif /* CONFIG_SHARP_LQ057Q3DC02 */
  145. /*----------------------------------------------------------------------*/
  146. #ifdef CONFIG_SHARP_LQ64D341
  147. /*
  148. * Sharp LQ64D341 display, 640x480. Active, color, single scan.
  149. */
  150. vidinfo_t panel_info = {
  151. 640, 480, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH,
  152. 3, 0, 0, 1, 1, 128, 16, 0, 32
  153. /* wbl, vpw, lcdac, wbf */
  154. };
  155. #endif /* CONFIG_SHARP_LQ64D341 */
  156. #ifdef CONFIG_SHARP_LQ065T9DR51U
  157. /*
  158. * Sharp LQ065T9DR51U display, 400x240. Active, color, single scan.
  159. */
  160. vidinfo_t panel_info = {
  161. 400, 240, 143, 79, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH,
  162. 3, 0, 0, 1, 1, 248, 4, 0, 35
  163. /* wbl, vpw, lcdac, wbf */
  164. };
  165. #define CONFIG_LCD_INFO_BELOW_LOGO
  166. #endif /* CONFIG_SHARP_LQ065T9DR51U */
  167. #ifdef CONFIG_SHARP_LQ084V1DG21
  168. /*
  169. * Sharp LQ084V1DG21 display, 640x480. Active, color, single scan.
  170. */
  171. vidinfo_t panel_info = {
  172. 640, 480, 171, 129, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_LOW,
  173. 3, 0, 0, 1, 1, 160, 3, 0, 48
  174. /* wbl, vpw, lcdac, wbf */
  175. };
  176. #endif /* CONFIG_SHARP_LQ084V1DG21 */
  177. /*----------------------------------------------------------------------*/
  178. #ifdef CONFIG_HLD1045
  179. /*
  180. * HLD1045 display, 640x480. Active, color, single scan.
  181. */
  182. vidinfo_t panel_info = {
  183. 640, 480, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH,
  184. 3, 0, 0, 1, 1, 160, 3, 0, 48
  185. /* wbl, vpw, lcdac, wbf */
  186. };
  187. #endif /* CONFIG_HLD1045 */
  188. /*----------------------------------------------------------------------*/
  189. #ifdef CONFIG_PRIMEVIEW_V16C6448AC
  190. /*
  191. * Prime View V16C6448AC
  192. */
  193. vidinfo_t panel_info = {
  194. 640, 480, 130, 98, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH,
  195. 3, 0, 0, 1, 1, 144, 2, 0, 35
  196. /* wbl, vpw, lcdac, wbf */
  197. };
  198. #endif /* CONFIG_PRIMEVIEW_V16C6448AC */
  199. /*----------------------------------------------------------------------*/
  200. #ifdef CONFIG_OPTREX_BW
  201. /*
  202. * Optrex CBL50840-2 NF-FW 99 22 M5
  203. * or
  204. * Hitachi LMG6912RPFC-00T
  205. * or
  206. * Hitachi SP14Q002
  207. *
  208. * 320x240. Black & white.
  209. */
  210. #define OPTREX_BPP 0 /* 0 - monochrome, 1 bpp */
  211. /* 1 - 4 grey levels, 2 bpp */
  212. /* 2 - 16 grey levels, 4 bpp */
  213. vidinfo_t panel_info = {
  214. 320, 240, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW,
  215. OPTREX_BPP, 0, 0, 0, 0, 0, 0, 0, 0, 4
  216. };
  217. #endif /* CONFIG_OPTREX_BW */
  218. /*-----------------------------------------------------------------*/
  219. #ifdef CONFIG_EDT32F10
  220. /*
  221. * Emerging Display Technologies 320x240. Passive, monochrome, single scan.
  222. */
  223. #define LCD_BPP LCD_MONOCHROME
  224. #define LCD_DF 10
  225. vidinfo_t panel_info = {
  226. 320, 240, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW,
  227. LCD_BPP, 0, 0, 0, 0, 33, 0, 0, 0
  228. };
  229. #endif
  230. /************************************************************************/
  231. /* ----------------- chipset specific functions ----------------------- */
  232. /************************************************************************/
  233. /*
  234. * Calculate fb size for VIDEOLFB_ATAG.
  235. */
  236. ulong calc_fbsize (void)
  237. {
  238. ulong size;
  239. int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
  240. size = line_length * panel_info.vl_row;
  241. return size;
  242. }
  243. void lcd_ctrl_init (void *lcdbase)
  244. {
  245. volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  246. volatile lcd823_t *lcdp = &immr->im_lcd;
  247. uint lccrtmp;
  248. uint lchcr_hpc_tmp;
  249. /* Initialize the LCD control register according to the LCD
  250. * parameters defined. We do everything here but enable
  251. * the controller.
  252. */
  253. #ifdef CONFIG_RPXLITE
  254. /* This is special for RPXlite_DW Software Development Platform **[Sam]** */
  255. panel_info.vl_dp = CONFIG_SYS_LOW;
  256. #endif
  257. lccrtmp = LCDBIT (LCCR_BNUM_BIT,
  258. (((panel_info.vl_row * panel_info.vl_col) * (1 << LCD_BPP)) / 128));
  259. lccrtmp |= LCDBIT (LCCR_CLKP_BIT, panel_info.vl_clkp) |
  260. LCDBIT (LCCR_OEP_BIT, panel_info.vl_oep) |
  261. LCDBIT (LCCR_HSP_BIT, panel_info.vl_hsp) |
  262. LCDBIT (LCCR_VSP_BIT, panel_info.vl_vsp) |
  263. LCDBIT (LCCR_DP_BIT, panel_info.vl_dp) |
  264. LCDBIT (LCCR_BPIX_BIT, panel_info.vl_bpix) |
  265. LCDBIT (LCCR_LBW_BIT, panel_info.vl_lbw) |
  266. LCDBIT (LCCR_SPLT_BIT, panel_info.vl_splt) |
  267. LCDBIT (LCCR_CLOR_BIT, panel_info.vl_clor) |
  268. LCDBIT (LCCR_TFT_BIT, panel_info.vl_tft);
  269. #if 0
  270. lccrtmp |= ((SIU_LEVEL5 / 2) << 12);
  271. lccrtmp |= LCCR_EIEN;
  272. #endif
  273. lcdp->lcd_lccr = lccrtmp;
  274. lcdp->lcd_lcsr = 0xFF; /* Clear pending interrupts */
  275. /* Initialize LCD controller bus priorities.
  276. */
  277. #ifdef CONFIG_RBC823
  278. immr->im_siu_conf.sc_sdcr = (immr->im_siu_conf.sc_sdcr & ~0x0f) | 1; /* RAID = 01, LAID = 00 */
  279. #else
  280. immr->im_siu_conf.sc_sdcr &= ~0x0f; /* RAID = LAID = 0 */
  281. /* set SHFT/CLOCK division factor 4
  282. * This needs to be set based upon display type and processor
  283. * speed. The TFT displays run about 20 to 30 MHz.
  284. * I was running 64 MHz processor speed.
  285. * The value for this divider must be chosen so the result is
  286. * an integer of the processor speed (i.e., divide by 3 with
  287. * 64 MHz would be bad).
  288. */
  289. immr->im_clkrst.car_sccr &= ~0x1F;
  290. immr->im_clkrst.car_sccr |= LCD_DF; /* was 8 */
  291. #endif /* CONFIG_RBC823 */
  292. #if defined(CONFIG_RBC823)
  293. /* Enable LCD on port D.
  294. */
  295. immr->im_ioport.iop_pddat &= 0x0300;
  296. immr->im_ioport.iop_pdpar |= 0x1CFF;
  297. immr->im_ioport.iop_pddir |= 0x1CFF;
  298. /* Configure LCD_ON, VEE_ON, CCFL_ON on port B.
  299. */
  300. immr->im_cpm.cp_pbdat &= ~0x00005001;
  301. immr->im_cpm.cp_pbpar &= ~0x00005001;
  302. immr->im_cpm.cp_pbdir |= 0x00005001;
  303. #elif !defined(CONFIG_EDT32F10)
  304. /* Enable LCD on port D.
  305. */
  306. immr->im_ioport.iop_pdpar |= 0x1FFF;
  307. immr->im_ioport.iop_pddir |= 0x1FFF;
  308. /* Enable LCD_A/B/C on port B.
  309. */
  310. immr->im_cpm.cp_pbpar |= 0x00005001;
  311. immr->im_cpm.cp_pbdir |= 0x00005001;
  312. #else
  313. /* Enable LCD on port D.
  314. */
  315. immr->im_ioport.iop_pdpar |= 0x1DFF;
  316. immr->im_ioport.iop_pdpar &= ~0x0200;
  317. immr->im_ioport.iop_pddir |= 0x1FFF;
  318. immr->im_ioport.iop_pddat |= 0x0200;
  319. #endif
  320. /* Load the physical address of the linear frame buffer
  321. * into the LCD controller.
  322. * BIG NOTE: This has to be modified to load A and B depending
  323. * upon the split mode of the LCD.
  324. */
  325. lcdp->lcd_lcfaa = (ulong)lcdbase;
  326. lcdp->lcd_lcfba = (ulong)lcdbase;
  327. /* MORE HACKS...This must be updated according to 823 manual
  328. * for different panels.
  329. * Udi Finkelstein - done - see below:
  330. * Note: You better not try unsupported combinations such as
  331. * 4-bit wide passive dual scan LCD at 4/8 Bit color.
  332. */
  333. lchcr_hpc_tmp =
  334. (panel_info.vl_col *
  335. (panel_info.vl_tft ? 8 :
  336. (((2 - panel_info.vl_lbw) << /* 4 bit=2, 8-bit = 1 */
  337. /* use << to mult by: single scan = 1, dual scan = 2 */
  338. panel_info.vl_splt) *
  339. (panel_info.vl_bpix | 1)))) >> 3; /* 2/4 BPP = 1, 8/16 BPP = 3 */
  340. lcdp->lcd_lchcr = LCHCR_BO |
  341. LCDBIT (LCHCR_AT_BIT, 4) |
  342. LCDBIT (LCHCR_HPC_BIT, lchcr_hpc_tmp) |
  343. panel_info.vl_wbl;
  344. lcdp->lcd_lcvcr = LCDBIT (LCVCR_VPW_BIT, panel_info.vl_vpw) |
  345. LCDBIT (LCVCR_LCD_AC_BIT, panel_info.vl_lcdac) |
  346. LCDBIT (LCVCR_VPC_BIT, panel_info.vl_row) |
  347. panel_info.vl_wbf;
  348. }
  349. /*----------------------------------------------------------------------*/
  350. #if LCD_BPP == LCD_COLOR8
  351. void
  352. lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
  353. {
  354. volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  355. volatile cpm8xx_t *cp = &(immr->im_cpm);
  356. unsigned short colreg, *cmap_ptr;
  357. cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
  358. colreg = ((red & 0x0F) << 8) |
  359. ((green & 0x0F) << 4) |
  360. (blue & 0x0F) ;
  361. #ifdef CONFIG_SYS_INVERT_COLORS
  362. colreg ^= 0x0FFF;
  363. #endif
  364. *cmap_ptr = colreg;
  365. debug ("setcolreg: reg %2d @ %p: R=%02X G=%02X B=%02X => %02X%02X\n",
  366. regno, &(cp->lcd_cmap[regno * 2]),
  367. red, green, blue,
  368. cp->lcd_cmap[ regno * 2 ], cp->lcd_cmap[(regno * 2) + 1]);
  369. }
  370. #endif /* LCD_COLOR8 */
  371. /*----------------------------------------------------------------------*/
  372. #if LCD_BPP == LCD_MONOCHROME
  373. static
  374. void lcd_initcolregs (void)
  375. {
  376. volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  377. volatile cpm8xx_t *cp = &(immr->im_cpm);
  378. ushort regno;
  379. for (regno = 0; regno < 16; regno++) {
  380. cp->lcd_cmap[regno * 2] = 0;
  381. cp->lcd_cmap[(regno * 2) + 1] = regno & 0x0f;
  382. }
  383. }
  384. #endif
  385. /*----------------------------------------------------------------------*/
  386. void lcd_enable (void)
  387. {
  388. volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  389. volatile lcd823_t *lcdp = &immr->im_lcd;
  390. /* Enable the LCD panel */
  391. #ifndef CONFIG_RBC823
  392. immr->im_siu_conf.sc_sdcr |= (1 << (31 - 25)); /* LAM = 1 */
  393. #endif
  394. lcdp->lcd_lccr |= LCCR_PON;
  395. #ifdef CONFIG_V37
  396. /* Turn on display backlight */
  397. immr->im_cpm.cp_pbpar |= 0x00008000;
  398. immr->im_cpm.cp_pbdir |= 0x00008000;
  399. #elif defined(CONFIG_RBC823)
  400. /* Turn on display backlight */
  401. immr->im_cpm.cp_pbdat |= 0x00004000;
  402. #endif
  403. #if defined(CONFIG_LWMON)
  404. { uchar c = pic_read (0x60);
  405. #if defined(CONFIG_LCD) && defined(CONFIG_LWMON) && (CONFIG_POST & CONFIG_SYS_POST_SYSMON)
  406. /* Enable LCD later in sysmon test, only if temperature is OK */
  407. #else
  408. c |= 0x07; /* Power on CCFL, Enable CCFL, Chip Enable LCD */
  409. #endif
  410. pic_write (0x60, c);
  411. }
  412. #endif /* CONFIG_LWMON */
  413. #if defined(CONFIG_R360MPI)
  414. {
  415. extern void r360_i2c_lcd_write (uchar data0, uchar data1);
  416. unsigned long bgi, ctr;
  417. char *p;
  418. if ((p = getenv("lcdbgi")) != NULL) {
  419. bgi = simple_strtoul (p, 0, 10) & 0xFFF;
  420. } else {
  421. bgi = 0xFFF;
  422. }
  423. if ((p = getenv("lcdctr")) != NULL) {
  424. ctr = simple_strtoul (p, 0, 10) & 0xFFF;
  425. } else {
  426. ctr=0x7FF;
  427. }
  428. r360_i2c_lcd_write(0x10, 0x01);
  429. r360_i2c_lcd_write(0x20, 0x01);
  430. r360_i2c_lcd_write(0x30 | ((bgi>>8) & 0xF), bgi & 0xFF);
  431. r360_i2c_lcd_write(0x40 | ((ctr>>8) & 0xF), ctr & 0xFF);
  432. }
  433. #endif /* CONFIG_R360MPI */
  434. #ifdef CONFIG_RBC823
  435. udelay(200000); /* wait 200ms */
  436. /* Turn VEE_ON first */
  437. immr->im_cpm.cp_pbdat |= 0x00000001;
  438. udelay(200000); /* wait 200ms */
  439. /* Now turn on LCD_ON */
  440. immr->im_cpm.cp_pbdat |= 0x00001000;
  441. #endif
  442. #ifdef CONFIG_RRVISION
  443. debug ("PC4->Output(1): enable LVDS\n");
  444. debug ("PC5->Output(0): disable PAL clock\n");
  445. immr->im_ioport.iop_pddir |= 0x1000;
  446. immr->im_ioport.iop_pcpar &= ~(0x0C00);
  447. immr->im_ioport.iop_pcdir |= 0x0C00 ;
  448. immr->im_ioport.iop_pcdat |= 0x0800 ;
  449. immr->im_ioport.iop_pcdat &= ~(0x0400);
  450. debug ("PDPAR=0x%04X PDDIR=0x%04X PDDAT=0x%04X\n",
  451. immr->im_ioport.iop_pdpar,
  452. immr->im_ioport.iop_pddir,
  453. immr->im_ioport.iop_pddat);
  454. debug ("PCPAR=0x%04X PCDIR=0x%04X PCDAT=0x%04X\n",
  455. immr->im_ioport.iop_pcpar,
  456. immr->im_ioport.iop_pcdir,
  457. immr->im_ioport.iop_pcdat);
  458. #endif
  459. }
  460. /*----------------------------------------------------------------------*/
  461. #if defined (CONFIG_RBC823)
  462. void lcd_disable (void)
  463. {
  464. volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR;
  465. volatile lcd823_t *lcdp = &immr->im_lcd;
  466. #if defined(CONFIG_LWMON)
  467. { uchar c = pic_read (0x60);
  468. c &= ~0x07; /* Power off CCFL, Disable CCFL, Chip Disable LCD */
  469. pic_write (0x60, c);
  470. }
  471. #elif defined(CONFIG_R360MPI)
  472. {
  473. extern void r360_i2c_lcd_write (uchar data0, uchar data1);
  474. r360_i2c_lcd_write(0x10, 0x00);
  475. r360_i2c_lcd_write(0x20, 0x00);
  476. r360_i2c_lcd_write(0x30, 0x00);
  477. r360_i2c_lcd_write(0x40, 0x00);
  478. }
  479. #endif /* CONFIG_LWMON */
  480. /* Disable the LCD panel */
  481. lcdp->lcd_lccr &= ~LCCR_PON;
  482. #ifdef CONFIG_RBC823
  483. /* Turn off display backlight, VEE and LCD_ON */
  484. immr->im_cpm.cp_pbdat &= ~0x00005001;
  485. #else
  486. immr->im_siu_conf.sc_sdcr &= ~(1 << (31 - 25)); /* LAM = 0 */
  487. #endif /* CONFIG_RBC823 */
  488. }
  489. #endif /* NOT_USED_SO_FAR || CONFIG_RBC823 */
  490. /************************************************************************/
  491. #endif /* CONFIG_LCD */