lcd.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  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 <devices.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, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_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, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_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, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_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, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
  227. LCD_BPP, 0, 0, 0, 0, 33, 0, 0, 0
  228. };
  229. #endif
  230. /*----------------------------------------------------------------------*/
  231. int lcd_line_length;
  232. int lcd_color_fg;
  233. int lcd_color_bg;
  234. /*
  235. * Frame buffer memory information
  236. */
  237. void *lcd_base; /* Start of framebuffer memory */
  238. void *lcd_console_address; /* Start of console buffer */
  239. short console_col;
  240. short console_row;
  241. /************************************************************************/
  242. void lcd_ctrl_init (void *lcdbase);
  243. void lcd_enable (void);
  244. #if LCD_BPP == LCD_COLOR8
  245. void lcd_setcolreg (ushort regno,
  246. ushort red, ushort green, ushort blue);
  247. #endif
  248. #if LCD_BPP == LCD_MONOCHROME
  249. void lcd_initcolregs (void);
  250. #endif
  251. #if defined(CONFIG_RBC823)
  252. void lcd_disable (void);
  253. #endif
  254. /************************************************************************/
  255. /************************************************************************/
  256. /* ----------------- chipset specific functions ----------------------- */
  257. /************************************************************************/
  258. /*
  259. * Calculate fb size for VIDEOLFB_ATAG.
  260. */
  261. ulong calc_fbsize (void)
  262. {
  263. ulong size;
  264. int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
  265. size = line_length * panel_info.vl_row;
  266. return size;
  267. }
  268. void lcd_ctrl_init (void *lcdbase)
  269. {
  270. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  271. volatile lcd823_t *lcdp = &immr->im_lcd;
  272. uint lccrtmp;
  273. uint lchcr_hpc_tmp;
  274. /* Initialize the LCD control register according to the LCD
  275. * parameters defined. We do everything here but enable
  276. * the controller.
  277. */
  278. #ifdef CONFIG_RPXLITE
  279. /* This is special for RPXlite_DW Software Development Platform **[Sam]** */
  280. panel_info.vl_dp = CFG_LOW;
  281. #endif
  282. lccrtmp = LCDBIT (LCCR_BNUM_BIT,
  283. (((panel_info.vl_row * panel_info.vl_col) * (1 << LCD_BPP)) / 128));
  284. lccrtmp |= LCDBIT (LCCR_CLKP_BIT, panel_info.vl_clkp) |
  285. LCDBIT (LCCR_OEP_BIT, panel_info.vl_oep) |
  286. LCDBIT (LCCR_HSP_BIT, panel_info.vl_hsp) |
  287. LCDBIT (LCCR_VSP_BIT, panel_info.vl_vsp) |
  288. LCDBIT (LCCR_DP_BIT, panel_info.vl_dp) |
  289. LCDBIT (LCCR_BPIX_BIT, panel_info.vl_bpix) |
  290. LCDBIT (LCCR_LBW_BIT, panel_info.vl_lbw) |
  291. LCDBIT (LCCR_SPLT_BIT, panel_info.vl_splt) |
  292. LCDBIT (LCCR_CLOR_BIT, panel_info.vl_clor) |
  293. LCDBIT (LCCR_TFT_BIT, panel_info.vl_tft);
  294. #if 0
  295. lccrtmp |= ((SIU_LEVEL5 / 2) << 12);
  296. lccrtmp |= LCCR_EIEN;
  297. #endif
  298. lcdp->lcd_lccr = lccrtmp;
  299. lcdp->lcd_lcsr = 0xFF; /* Clear pending interrupts */
  300. /* Initialize LCD controller bus priorities.
  301. */
  302. #ifdef CONFIG_RBC823
  303. immr->im_siu_conf.sc_sdcr = (immr->im_siu_conf.sc_sdcr & ~0x0f) | 1; /* RAID = 01, LAID = 00 */
  304. #else
  305. immr->im_siu_conf.sc_sdcr &= ~0x0f; /* RAID = LAID = 0 */
  306. /* set SHFT/CLOCK division factor 4
  307. * This needs to be set based upon display type and processor
  308. * speed. The TFT displays run about 20 to 30 MHz.
  309. * I was running 64 MHz processor speed.
  310. * The value for this divider must be chosen so the result is
  311. * an integer of the processor speed (i.e., divide by 3 with
  312. * 64 MHz would be bad).
  313. */
  314. immr->im_clkrst.car_sccr &= ~0x1F;
  315. immr->im_clkrst.car_sccr |= LCD_DF; /* was 8 */
  316. #endif /* CONFIG_RBC823 */
  317. #if defined(CONFIG_RBC823)
  318. /* Enable LCD on port D.
  319. */
  320. immr->im_ioport.iop_pddat &= 0x0300;
  321. immr->im_ioport.iop_pdpar |= 0x1CFF;
  322. immr->im_ioport.iop_pddir |= 0x1CFF;
  323. /* Configure LCD_ON, VEE_ON, CCFL_ON on port B.
  324. */
  325. immr->im_cpm.cp_pbdat &= ~0x00005001;
  326. immr->im_cpm.cp_pbpar &= ~0x00005001;
  327. immr->im_cpm.cp_pbdir |= 0x00005001;
  328. #elif !defined(CONFIG_EDT32F10)
  329. /* Enable LCD on port D.
  330. */
  331. immr->im_ioport.iop_pdpar |= 0x1FFF;
  332. immr->im_ioport.iop_pddir |= 0x1FFF;
  333. /* Enable LCD_A/B/C on port B.
  334. */
  335. immr->im_cpm.cp_pbpar |= 0x00005001;
  336. immr->im_cpm.cp_pbdir |= 0x00005001;
  337. #else
  338. /* Enable LCD on port D.
  339. */
  340. immr->im_ioport.iop_pdpar |= 0x1DFF;
  341. immr->im_ioport.iop_pdpar &= ~0x0200;
  342. immr->im_ioport.iop_pddir |= 0x1FFF;
  343. immr->im_ioport.iop_pddat |= 0x0200;
  344. #endif
  345. /* Load the physical address of the linear frame buffer
  346. * into the LCD controller.
  347. * BIG NOTE: This has to be modified to load A and B depending
  348. * upon the split mode of the LCD.
  349. */
  350. lcdp->lcd_lcfaa = (ulong)lcd_base;
  351. lcdp->lcd_lcfba = (ulong)lcd_base;
  352. /* MORE HACKS...This must be updated according to 823 manual
  353. * for different panels.
  354. * Udi Finkelstein - done - see below:
  355. * Note: You better not try unsupported combinations such as
  356. * 4-bit wide passive dual scan LCD at 4/8 Bit color.
  357. */
  358. lchcr_hpc_tmp =
  359. (panel_info.vl_col *
  360. (panel_info.vl_tft ? 8 :
  361. (((2 - panel_info.vl_lbw) << /* 4 bit=2, 8-bit = 1 */
  362. /* use << to mult by: single scan = 1, dual scan = 2 */
  363. panel_info.vl_splt) *
  364. (panel_info.vl_bpix | 1)))) >> 3; /* 2/4 BPP = 1, 8/16 BPP = 3 */
  365. lcdp->lcd_lchcr = LCHCR_BO |
  366. LCDBIT (LCHCR_AT_BIT, 4) |
  367. LCDBIT (LCHCR_HPC_BIT, lchcr_hpc_tmp) |
  368. panel_info.vl_wbl;
  369. lcdp->lcd_lcvcr = LCDBIT (LCVCR_VPW_BIT, panel_info.vl_vpw) |
  370. LCDBIT (LCVCR_LCD_AC_BIT, panel_info.vl_lcdac) |
  371. LCDBIT (LCVCR_VPC_BIT, panel_info.vl_row) |
  372. panel_info.vl_wbf;
  373. }
  374. /*----------------------------------------------------------------------*/
  375. #ifdef NOT_USED_SO_FAR
  376. static void
  377. lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue)
  378. {
  379. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  380. volatile cpm8xx_t *cp = &(immr->im_cpm);
  381. unsigned short colreg, *cmap_ptr;
  382. cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
  383. colreg = *cmap_ptr;
  384. #ifdef CFG_INVERT_COLORS
  385. colreg ^= 0x0FFF;
  386. #endif
  387. *red = (colreg >> 8) & 0x0F;
  388. *green = (colreg >> 4) & 0x0F;
  389. *blue = colreg & 0x0F;
  390. }
  391. #endif /* NOT_USED_SO_FAR */
  392. /*----------------------------------------------------------------------*/
  393. #if LCD_BPP == LCD_COLOR8
  394. void
  395. lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
  396. {
  397. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  398. volatile cpm8xx_t *cp = &(immr->im_cpm);
  399. unsigned short colreg, *cmap_ptr;
  400. cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
  401. colreg = ((red & 0x0F) << 8) |
  402. ((green & 0x0F) << 4) |
  403. (blue & 0x0F) ;
  404. #ifdef CFG_INVERT_COLORS
  405. colreg ^= 0x0FFF;
  406. #endif
  407. *cmap_ptr = colreg;
  408. debug ("setcolreg: reg %2d @ %p: R=%02X G=%02X B=%02X => %02X%02X\n",
  409. regno, &(cp->lcd_cmap[regno * 2]),
  410. red, green, blue,
  411. cp->lcd_cmap[ regno * 2 ], cp->lcd_cmap[(regno * 2) + 1]);
  412. }
  413. #endif /* LCD_COLOR8 */
  414. /*----------------------------------------------------------------------*/
  415. #if LCD_BPP == LCD_MONOCHROME
  416. static
  417. void lcd_initcolregs (void)
  418. {
  419. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  420. volatile cpm8xx_t *cp = &(immr->im_cpm);
  421. ushort regno;
  422. for (regno = 0; regno < 16; regno++) {
  423. cp->lcd_cmap[regno * 2] = 0;
  424. cp->lcd_cmap[(regno * 2) + 1] = regno & 0x0f;
  425. }
  426. }
  427. #endif
  428. /*----------------------------------------------------------------------*/
  429. void lcd_enable (void)
  430. {
  431. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  432. volatile lcd823_t *lcdp = &immr->im_lcd;
  433. /* Enable the LCD panel */
  434. #ifndef CONFIG_RBC823
  435. immr->im_siu_conf.sc_sdcr |= (1 << (31 - 25)); /* LAM = 1 */
  436. #endif
  437. lcdp->lcd_lccr |= LCCR_PON;
  438. #ifdef CONFIG_V37
  439. /* Turn on display backlight */
  440. immr->im_cpm.cp_pbpar |= 0x00008000;
  441. immr->im_cpm.cp_pbdir |= 0x00008000;
  442. #elif defined(CONFIG_RBC823)
  443. /* Turn on display backlight */
  444. immr->im_cpm.cp_pbdat |= 0x00004000;
  445. #endif
  446. #if defined(CONFIG_LWMON)
  447. { uchar c = pic_read (0x60);
  448. #if defined(CONFIG_LCD) && defined(CONFIG_LWMON) && (CONFIG_POST & CFG_POST_SYSMON)
  449. /* Enable LCD later in sysmon test, only if temperature is OK */
  450. #else
  451. c |= 0x07; /* Power on CCFL, Enable CCFL, Chip Enable LCD */
  452. #endif
  453. pic_write (0x60, c);
  454. }
  455. #endif /* CONFIG_LWMON */
  456. #if defined(CONFIG_R360MPI)
  457. {
  458. extern void r360_i2c_lcd_write (uchar data0, uchar data1);
  459. unsigned long bgi, ctr;
  460. char *p;
  461. if ((p = getenv("lcdbgi")) != NULL) {
  462. bgi = simple_strtoul (p, 0, 10) & 0xFFF;
  463. } else {
  464. bgi = 0xFFF;
  465. }
  466. if ((p = getenv("lcdctr")) != NULL) {
  467. ctr = simple_strtoul (p, 0, 10) & 0xFFF;
  468. } else {
  469. ctr=0x7FF;
  470. }
  471. r360_i2c_lcd_write(0x10, 0x01);
  472. r360_i2c_lcd_write(0x20, 0x01);
  473. r360_i2c_lcd_write(0x30 | ((bgi>>8) & 0xF), bgi & 0xFF);
  474. r360_i2c_lcd_write(0x40 | ((ctr>>8) & 0xF), ctr & 0xFF);
  475. }
  476. #endif /* CONFIG_R360MPI */
  477. #ifdef CONFIG_RBC823
  478. udelay(200000); /* wait 200ms */
  479. /* Turn VEE_ON first */
  480. immr->im_cpm.cp_pbdat |= 0x00000001;
  481. udelay(200000); /* wait 200ms */
  482. /* Now turn on LCD_ON */
  483. immr->im_cpm.cp_pbdat |= 0x00001000;
  484. #endif
  485. #ifdef CONFIG_RRVISION
  486. debug ("PC4->Output(1): enable LVDS\n");
  487. debug ("PC5->Output(0): disable PAL clock\n");
  488. immr->im_ioport.iop_pddir |= 0x1000;
  489. immr->im_ioport.iop_pcpar &= ~(0x0C00);
  490. immr->im_ioport.iop_pcdir |= 0x0C00 ;
  491. immr->im_ioport.iop_pcdat |= 0x0800 ;
  492. immr->im_ioport.iop_pcdat &= ~(0x0400);
  493. debug ("PDPAR=0x%04X PDDIR=0x%04X PDDAT=0x%04X\n",
  494. immr->im_ioport.iop_pdpar,
  495. immr->im_ioport.iop_pddir,
  496. immr->im_ioport.iop_pddat);
  497. debug ("PCPAR=0x%04X PCDIR=0x%04X PCDAT=0x%04X\n",
  498. immr->im_ioport.iop_pcpar,
  499. immr->im_ioport.iop_pcdir,
  500. immr->im_ioport.iop_pcdat);
  501. #endif
  502. }
  503. /*----------------------------------------------------------------------*/
  504. #if defined (CONFIG_RBC823)
  505. void lcd_disable (void)
  506. {
  507. volatile immap_t *immr = (immap_t *) CFG_IMMR;
  508. volatile lcd823_t *lcdp = &immr->im_lcd;
  509. #if defined(CONFIG_LWMON)
  510. { uchar c = pic_read (0x60);
  511. c &= ~0x07; /* Power off CCFL, Disable CCFL, Chip Disable LCD */
  512. pic_write (0x60, c);
  513. }
  514. #elif defined(CONFIG_R360MPI)
  515. {
  516. extern void r360_i2c_lcd_write (uchar data0, uchar data1);
  517. r360_i2c_lcd_write(0x10, 0x00);
  518. r360_i2c_lcd_write(0x20, 0x00);
  519. r360_i2c_lcd_write(0x30, 0x00);
  520. r360_i2c_lcd_write(0x40, 0x00);
  521. }
  522. #endif /* CONFIG_LWMON */
  523. /* Disable the LCD panel */
  524. lcdp->lcd_lccr &= ~LCCR_PON;
  525. #ifdef CONFIG_RBC823
  526. /* Turn off display backlight, VEE and LCD_ON */
  527. immr->im_cpm.cp_pbdat &= ~0x00005001;
  528. #else
  529. immr->im_siu_conf.sc_sdcr &= ~(1 << (31 - 25)); /* LAM = 0 */
  530. #endif /* CONFIG_RBC823 */
  531. }
  532. #endif /* NOT_USED_SO_FAR || CONFIG_RBC823 */
  533. /************************************************************************/
  534. #endif /* CONFIG_LCD */