]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - cpu/mpc8xx/lcd.c
cc58676868bf80215aa94ab9feca0fdb63478cc4
[karo-tx-uboot.git] / cpu / mpc8xx / lcd.c
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 /************************************************************************/
25 /* ** HEADER FILES                                                      */
26 /************************************************************************/
27
28 /* #define DEBUG */
29
30 #include <config.h>
31 #include <common.h>
32 #include <command.h>
33 #include <watchdog.h>
34 #include <version.h>
35 #include <stdarg.h>
36 #include <lcdvideo.h>
37 #include <linux/types.h>
38 #include <devices.h>
39 #if defined(CONFIG_POST)
40 #include <post.h>
41 #endif
42 #include <lcd.h>
43
44 #ifdef CONFIG_LCD
45
46 /************************************************************************/
47 /* ** CONFIG STUFF -- should be moved to board config file              */
48 /************************************************************************/
49 #define CONFIG_LCD_LOGO
50 #define LCD_INFO                /* Display Logo, (C) and system info    */
51
52 #if defined(CONFIG_V37) || defined(CONFIG_EDT32F10)
53 #undef CONFIG_LCD_LOGO
54 #undef LCD_INFO
55 #endif
56
57 /*----------------------------------------------------------------------*/
58 #ifdef CONFIG_KYOCERA_KCS057QV1AJ
59 /*
60  *  Kyocera KCS057QV1AJ-G23. Passive, color, single scan.
61  */
62 #define LCD_BPP LCD_COLOR4
63
64 vidinfo_t panel_info = {
65     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
66     LCD_BPP, 1, 0, 1, 0,  5, 0, 0, 0
67                 /* wbl, vpw, lcdac, wbf */
68 };
69 #endif /* CONFIG_KYOCERA_KCS057QV1AJ */
70 /*----------------------------------------------------------------------*/
71
72 /*----------------------------------------------------------------------*/
73 #ifdef CONFIG_HITACHI_SP19X001_Z1A
74 /*
75  *  Hitachi SP19X001-. Active, color, single scan.
76  */
77 vidinfo_t panel_info = {
78     640, 480, 154, 116, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
79     LCD_COLOR8, 1, 0, 1, 0, 0, 0, 0, 0
80                 /* wbl, vpw, lcdac, wbf */
81 };
82 #endif /* CONFIG_HITACHI_SP19X001_Z1A */
83 /*----------------------------------------------------------------------*/
84
85 /*----------------------------------------------------------------------*/
86 #ifdef CONFIG_NEC_NL6448AC33
87 /*
88  *  NEC NL6448AC33-18. Active, color, single scan.
89  */
90 vidinfo_t panel_info = {
91     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
92     3, 0, 0, 1, 1, 144, 2, 0, 33
93                 /* wbl, vpw, lcdac, wbf */
94 };
95 #endif /* CONFIG_NEC_NL6448AC33 */
96 /*----------------------------------------------------------------------*/
97
98 #ifdef CONFIG_NEC_NL6448BC20
99 /*
100  *  NEC NL6448BC20-08.  6.5", 640x480. Active, color, single scan.
101  */
102 vidinfo_t panel_info = {
103     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
104     3, 0, 0, 1, 1, 144, 2, 0, 33
105                 /* wbl, vpw, lcdac, wbf */
106 };
107 #endif /* CONFIG_NEC_NL6448BC20 */
108 /*----------------------------------------------------------------------*/
109
110 #ifdef CONFIG_NEC_NL6448BC33_54
111 /*
112  *  NEC NL6448BC33-54. 10.4", 640x480. Active, color, single scan.
113  */
114 vidinfo_t panel_info = {
115     640, 480, 212, 158, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
116     3, 0, 0, 1, 1, 144, 2, 0, 33
117                 /* wbl, vpw, lcdac, wbf */
118 };
119 #endif /* CONFIG_NEC_NL6448BC33_54 */
120 /*----------------------------------------------------------------------*/
121
122 #ifdef CONFIG_SHARP_LQ104V7DS01
123 /*
124  *  SHARP LQ104V7DS01. 6.5", 640x480. Active, color, single scan.
125  */
126 vidinfo_t panel_info = {
127     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_LOW,
128     3, 0, 0, 1, 1, 25, 1, 0, 33
129                 /* wbl, vpw, lcdac, wbf */
130 };
131 #endif /* CONFIG_SHARP_LQ104V7DS01 */
132 /*----------------------------------------------------------------------*/
133
134 #ifdef CONFIG_SHARP_16x9
135 /*
136  * Sharp 320x240. Active, color, single scan.  It isn't 16x9, and I am
137  * not sure what it is.......
138  */
139 vidinfo_t panel_info = {
140     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
141     3, 0, 0, 1, 1, 15, 4, 0, 3
142 };
143 #endif /* CONFIG_SHARP_16x9 */
144 /*----------------------------------------------------------------------*/
145
146 #ifdef CONFIG_SHARP_LQ057Q3DC02
147 /*
148  * Sharp LQ057Q3DC02 display. Active, color, single scan.
149  */
150 #undef LCD_DF
151 #define LCD_DF 12
152
153 vidinfo_t panel_info = {
154     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
155     3, 0, 0, 1, 1, 15, 4, 0, 3
156                 /* wbl, vpw, lcdac, wbf */
157 };
158 #define LCD_INFO_BELOW_LOGO
159 #endif /* CONFIG_SHARP_LQ057Q3DC02 */
160 /*----------------------------------------------------------------------*/
161
162 #ifdef CONFIG_SHARP_LQ64D341
163 /*
164  * Sharp LQ64D341 display, 640x480. Active, color, single scan.
165  */
166 vidinfo_t panel_info = {
167     640, 480, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
168     3, 0, 0, 1, 1, 128, 16, 0, 32
169                 /* wbl, vpw, lcdac, wbf */
170 };
171 #endif /* CONFIG_SHARP_LQ64D341 */
172
173 #ifdef CONFIG_SHARP_LQ065T9DR51U
174 /*
175  * Sharp LQ065T9DR51U display, 400x240. Active, color, single scan.
176  */
177 vidinfo_t panel_info = {
178     400, 240, 143, 79, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
179     3, 0, 0, 1, 1, 248, 4, 0, 35
180                 /* wbl, vpw, lcdac, wbf */
181 };
182 #define LCD_INFO_BELOW_LOGO
183 #endif /* CONFIG_SHARP_LQ065T9DR51U */
184
185 #ifdef CONFIG_SHARP_LQ084V1DG21
186 /*
187  * Sharp LQ084V1DG21 display, 640x480. Active, color, single scan.
188  */
189 vidinfo_t panel_info = {
190     640, 480, 171, 129, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_LOW,
191     3, 0, 0, 1, 1, 160, 3, 0, 48
192                 /* wbl, vpw, lcdac, wbf */
193 };
194 #endif /* CONFIG_SHARP_LQ084V1DG21 */
195
196 /*----------------------------------------------------------------------*/
197
198 #ifdef CONFIG_HLD1045
199 /*
200  * HLD1045 display, 640x480. Active, color, single scan.
201  */
202 vidinfo_t panel_info = {
203     640, 480, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
204     3, 0, 0, 1, 1, 160, 3, 0, 48
205                 /* wbl, vpw, lcdac, wbf */
206 };
207 #endif /* CONFIG_HLD1045 */
208 /*----------------------------------------------------------------------*/
209
210 #ifdef CONFIG_PRIMEVIEW_V16C6448AC
211 /*
212  * Prime View V16C6448AC
213  */
214 vidinfo_t panel_info = {
215     640, 480, 130, 98, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
216     3, 0, 0, 1, 1, 144, 2, 0, 35
217                 /* wbl, vpw, lcdac, wbf */
218 };
219 #endif /* CONFIG_PRIMEVIEW_V16C6448AC */
220
221 /*----------------------------------------------------------------------*/
222
223 #ifdef CONFIG_OPTREX_BW
224 /*
225  * Optrex   CBL50840-2 NF-FW 99 22 M5
226  * or
227  * Hitachi  LMG6912RPFC-00T
228  * or
229  * Hitachi  SP14Q002
230  *
231  * 320x240. Black & white.
232  */
233 #define OPTREX_BPP      0       /* 0 - monochrome,     1 bpp */
234                                 /* 1 -  4 grey levels, 2 bpp */
235                                 /* 2 - 16 grey levels, 4 bpp */
236 vidinfo_t panel_info = {
237     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
238     OPTREX_BPP, 0, 0, 0, 0, 0, 0, 0, 0, 4
239 };
240 #endif /* CONFIG_OPTREX_BW */
241
242 /*-----------------------------------------------------------------*/
243 #ifdef CONFIG_EDT32F10
244 /*
245  * Emerging Display Technologies 320x240. Passive, monochrome, single scan.
246  */
247 #define LCD_BPP         LCD_MONOCHROME
248 #define LCD_DF          10
249
250 vidinfo_t panel_info = {
251     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
252     LCD_BPP,  0, 0, 0, 0, 33, 0, 0, 0
253 };
254 #endif
255 /*----------------------------------------------------------------------*/
256
257
258 int lcd_line_length;
259
260 int lcd_color_fg;
261 int lcd_color_bg;
262
263 /*
264  * Frame buffer memory information
265  */
266 void *lcd_base;                 /* Start of framebuffer memory  */
267 void *lcd_console_address;      /* Start of console buffer      */
268
269 short console_col;
270 short console_row;
271
272 /************************************************************************/
273
274 void lcd_ctrl_init (void *lcdbase);
275 void lcd_enable (void);
276 #if LCD_BPP == LCD_COLOR8
277 void lcd_setcolreg (ushort regno,
278                                 ushort red, ushort green, ushort blue);
279 #endif
280 #if LCD_BPP == LCD_MONOCHROME
281 void lcd_initcolregs (void);
282 #endif
283
284 #if defined(CONFIG_RBC823)
285 void lcd_disable (void);
286 #endif
287
288 /************************************************************************/
289
290 /************************************************************************/
291 /* ----------------- chipset specific functions ----------------------- */
292 /************************************************************************/
293
294 /*
295  * Calculate fb size for VIDEOLFB_ATAG.
296  */
297 ulong calc_fbsize (void)
298 {
299         ulong size;
300         int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
301
302         size = line_length * panel_info.vl_row;
303
304         return size;
305 }
306
307 void lcd_ctrl_init (void *lcdbase)
308 {
309         volatile immap_t *immr = (immap_t *) CFG_IMMR;
310         volatile lcd823_t *lcdp = &immr->im_lcd;
311
312         uint lccrtmp;
313         uint lchcr_hpc_tmp;
314
315         /* Initialize the LCD control register according to the LCD
316          * parameters defined.  We do everything here but enable
317          * the controller.
318          */
319
320 #ifdef CONFIG_RPXLITE
321         /* This is special for RPXlite_DW Software Development Platform **[Sam]** */
322         panel_info.vl_dp = CFG_LOW;
323 #endif
324
325         lccrtmp  = LCDBIT (LCCR_BNUM_BIT,
326                    (((panel_info.vl_row * panel_info.vl_col) * (1 << LCD_BPP)) / 128));
327
328         lccrtmp |= LCDBIT (LCCR_CLKP_BIT, panel_info.vl_clkp)   |
329                    LCDBIT (LCCR_OEP_BIT,  panel_info.vl_oep)    |
330                    LCDBIT (LCCR_HSP_BIT,  panel_info.vl_hsp)    |
331                    LCDBIT (LCCR_VSP_BIT,  panel_info.vl_vsp)    |
332                    LCDBIT (LCCR_DP_BIT,   panel_info.vl_dp)     |
333                    LCDBIT (LCCR_BPIX_BIT, panel_info.vl_bpix)   |
334                    LCDBIT (LCCR_LBW_BIT,  panel_info.vl_lbw)    |
335                    LCDBIT (LCCR_SPLT_BIT, panel_info.vl_splt)   |
336                    LCDBIT (LCCR_CLOR_BIT, panel_info.vl_clor)   |
337                    LCDBIT (LCCR_TFT_BIT,  panel_info.vl_tft);
338
339 #if 0
340         lccrtmp |= ((SIU_LEVEL5 / 2) << 12);
341         lccrtmp |= LCCR_EIEN;
342 #endif
343
344         lcdp->lcd_lccr = lccrtmp;
345         lcdp->lcd_lcsr = 0xFF;          /* Clear pending interrupts */
346
347         /* Initialize LCD controller bus priorities.
348          */
349 #ifdef CONFIG_RBC823
350         immr->im_siu_conf.sc_sdcr = (immr->im_siu_conf.sc_sdcr & ~0x0f) | 1;    /* RAID = 01, LAID = 00 */
351 #else
352         immr->im_siu_conf.sc_sdcr &= ~0x0f;     /* RAID = LAID = 0 */
353
354         /* set SHFT/CLOCK division factor 4
355          * This needs to be set based upon display type and processor
356          * speed.  The TFT displays run about 20 to 30 MHz.
357          * I was running 64 MHz processor speed.
358          * The value for this divider must be chosen so the result is
359          * an integer of the processor speed (i.e., divide by 3 with
360          * 64 MHz would be bad).
361          */
362         immr->im_clkrst.car_sccr &= ~0x1F;
363         immr->im_clkrst.car_sccr |= LCD_DF;     /* was 8 */
364
365 #endif /* CONFIG_RBC823 */
366
367 #if defined(CONFIG_RBC823)
368         /* Enable LCD on port D.
369          */
370         immr->im_ioport.iop_pddat &= 0x0300;
371         immr->im_ioport.iop_pdpar |= 0x1CFF;
372         immr->im_ioport.iop_pddir |= 0x1CFF;
373
374         /* Configure LCD_ON, VEE_ON, CCFL_ON on port B.
375          */
376         immr->im_cpm.cp_pbdat &= ~0x00005001;
377         immr->im_cpm.cp_pbpar &= ~0x00005001;
378         immr->im_cpm.cp_pbdir |=  0x00005001;
379 #elif !defined(CONFIG_EDT32F10)
380         /* Enable LCD on port D.
381          */
382         immr->im_ioport.iop_pdpar |= 0x1FFF;
383         immr->im_ioport.iop_pddir |= 0x1FFF;
384
385         /* Enable LCD_A/B/C on port B.
386          */
387         immr->im_cpm.cp_pbpar |= 0x00005001;
388         immr->im_cpm.cp_pbdir |= 0x00005001;
389 #else
390         /* Enable LCD on port D.
391          */
392         immr->im_ioport.iop_pdpar |= 0x1DFF;
393         immr->im_ioport.iop_pdpar &= ~0x0200;
394         immr->im_ioport.iop_pddir |= 0x1FFF;
395         immr->im_ioport.iop_pddat |= 0x0200;
396 #endif
397
398         /* Load the physical address of the linear frame buffer
399          * into the LCD controller.
400          * BIG NOTE:  This has to be modified to load A and B depending
401          * upon the split mode of the LCD.
402          */
403         lcdp->lcd_lcfaa = (ulong)lcd_base;
404         lcdp->lcd_lcfba = (ulong)lcd_base;
405
406         /* MORE HACKS...This must be updated according to 823 manual
407          * for different panels.
408          * Udi Finkelstein - done - see below:
409          * Note: You better not try unsupported combinations such as
410          * 4-bit wide passive dual scan LCD at 4/8 Bit color.
411          */
412         lchcr_hpc_tmp =
413                 (panel_info.vl_col *
414                  (panel_info.vl_tft ? 8 :
415                         (((2 - panel_info.vl_lbw) << /* 4 bit=2, 8-bit = 1 */
416                          /* use << to mult by: single scan = 1, dual scan = 2 */
417                           panel_info.vl_splt) *
418                          (panel_info.vl_bpix | 1)))) >> 3; /* 2/4 BPP = 1, 8/16 BPP = 3 */
419
420         lcdp->lcd_lchcr = LCHCR_BO |
421                           LCDBIT (LCHCR_AT_BIT, 4) |
422                           LCDBIT (LCHCR_HPC_BIT, lchcr_hpc_tmp) |
423                           panel_info.vl_wbl;
424
425         lcdp->lcd_lcvcr = LCDBIT (LCVCR_VPW_BIT, panel_info.vl_vpw) |
426                           LCDBIT (LCVCR_LCD_AC_BIT, panel_info.vl_lcdac) |
427                           LCDBIT (LCVCR_VPC_BIT, panel_info.vl_row) |
428                           panel_info.vl_wbf;
429
430 }
431
432 /*----------------------------------------------------------------------*/
433
434 #ifdef  NOT_USED_SO_FAR
435 static void
436 lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue)
437 {
438         volatile immap_t *immr = (immap_t *) CFG_IMMR;
439         volatile cpm8xx_t *cp = &(immr->im_cpm);
440         unsigned short colreg, *cmap_ptr;
441
442         cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
443
444         colreg = *cmap_ptr;
445 #ifdef  CFG_INVERT_COLORS
446         colreg ^= 0x0FFF;
447 #endif
448
449         *red   = (colreg >> 8) & 0x0F;
450         *green = (colreg >> 4) & 0x0F;
451         *blue  =  colreg       & 0x0F;
452 }
453 #endif  /* NOT_USED_SO_FAR */
454
455 /*----------------------------------------------------------------------*/
456
457 #if LCD_BPP == LCD_COLOR8
458 void
459 lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
460 {
461         volatile immap_t *immr = (immap_t *) CFG_IMMR;
462         volatile cpm8xx_t *cp = &(immr->im_cpm);
463         unsigned short colreg, *cmap_ptr;
464
465         cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
466
467         colreg = ((red   & 0x0F) << 8) |
468                  ((green & 0x0F) << 4) |
469                   (blue  & 0x0F) ;
470 #ifdef  CFG_INVERT_COLORS
471         colreg ^= 0x0FFF;
472 #endif
473         *cmap_ptr = colreg;
474
475         debug ("setcolreg: reg %2d @ %p: R=%02X G=%02X B=%02X => %02X%02X\n",
476                 regno, &(cp->lcd_cmap[regno * 2]),
477                 red, green, blue,
478                 cp->lcd_cmap[ regno * 2 ], cp->lcd_cmap[(regno * 2) + 1]);
479 }
480 #endif  /* LCD_COLOR8 */
481
482 /*----------------------------------------------------------------------*/
483
484 #if LCD_BPP == LCD_MONOCHROME
485 static
486 void lcd_initcolregs (void)
487 {
488         volatile immap_t *immr = (immap_t *) CFG_IMMR;
489         volatile cpm8xx_t *cp = &(immr->im_cpm);
490         ushort regno;
491
492         for (regno = 0; regno < 16; regno++) {
493                 cp->lcd_cmap[regno * 2] = 0;
494                 cp->lcd_cmap[(regno * 2) + 1] = regno & 0x0f;
495         }
496 }
497 #endif
498
499 /*----------------------------------------------------------------------*/
500
501 void lcd_enable (void)
502 {
503         volatile immap_t *immr = (immap_t *) CFG_IMMR;
504         volatile lcd823_t *lcdp = &immr->im_lcd;
505
506         /* Enable the LCD panel */
507 #ifndef CONFIG_RBC823
508         immr->im_siu_conf.sc_sdcr |= (1 << (31 - 25));          /* LAM = 1 */
509 #endif
510         lcdp->lcd_lccr |= LCCR_PON;
511
512 #ifdef CONFIG_V37
513         /* Turn on display backlight */
514         immr->im_cpm.cp_pbpar |= 0x00008000;
515         immr->im_cpm.cp_pbdir |= 0x00008000;
516 #elif defined(CONFIG_RBC823)
517         /* Turn on display backlight */
518         immr->im_cpm.cp_pbdat |= 0x00004000;
519 #endif
520
521 #if defined(CONFIG_LWMON)
522     {   uchar c = pic_read (0x60);
523 #if defined(CONFIG_LCD) && defined(CONFIG_LWMON) && (CONFIG_POST & CFG_POST_SYSMON)
524         /* Enable LCD later in sysmon test, only if temperature is OK */
525 #else
526         c |= 0x07;      /* Power on CCFL, Enable CCFL, Chip Enable LCD */
527 #endif
528         pic_write (0x60, c);
529     }
530 #endif /* CONFIG_LWMON */
531
532 #if defined(CONFIG_R360MPI)
533     {
534         extern void r360_i2c_lcd_write (uchar data0, uchar data1);
535         unsigned long bgi, ctr;
536         char *p;
537
538         if ((p = getenv("lcdbgi")) != NULL) {
539                 bgi = simple_strtoul (p, 0, 10) & 0xFFF;
540         } else {
541                 bgi = 0xFFF;
542         }
543
544         if ((p = getenv("lcdctr")) != NULL) {
545                 ctr = simple_strtoul (p, 0, 10) & 0xFFF;
546         } else {
547                 ctr=0x7FF;
548         }
549
550         r360_i2c_lcd_write(0x10, 0x01);
551         r360_i2c_lcd_write(0x20, 0x01);
552         r360_i2c_lcd_write(0x30 | ((bgi>>8) & 0xF), bgi & 0xFF);
553         r360_i2c_lcd_write(0x40 | ((ctr>>8) & 0xF), ctr & 0xFF);
554     }
555 #endif /* CONFIG_R360MPI */
556 #ifdef CONFIG_RBC823
557         udelay(200000); /* wait 200ms */
558         /* Turn VEE_ON first */
559         immr->im_cpm.cp_pbdat |= 0x00000001;
560         udelay(200000); /* wait 200ms */
561         /* Now turn on LCD_ON */
562         immr->im_cpm.cp_pbdat |= 0x00001000;
563 #endif
564 #ifdef CONFIG_RRVISION
565         debug ("PC4->Output(1): enable LVDS\n");
566         debug ("PC5->Output(0): disable PAL clock\n");
567         immr->im_ioport.iop_pddir |=  0x1000;
568         immr->im_ioport.iop_pcpar &= ~(0x0C00);
569         immr->im_ioport.iop_pcdir |=   0x0C00 ;
570         immr->im_ioport.iop_pcdat |=   0x0800 ;
571         immr->im_ioport.iop_pcdat &= ~(0x0400);
572         debug ("PDPAR=0x%04X PDDIR=0x%04X PDDAT=0x%04X\n",
573                immr->im_ioport.iop_pdpar,
574                immr->im_ioport.iop_pddir,
575                immr->im_ioport.iop_pddat);
576         debug ("PCPAR=0x%04X PCDIR=0x%04X PCDAT=0x%04X\n",
577                immr->im_ioport.iop_pcpar,
578                immr->im_ioport.iop_pcdir,
579                immr->im_ioport.iop_pcdat);
580 #endif
581 }
582
583 /*----------------------------------------------------------------------*/
584
585 #if defined (CONFIG_RBC823)
586 void lcd_disable (void)
587 {
588         volatile immap_t *immr = (immap_t *) CFG_IMMR;
589         volatile lcd823_t *lcdp = &immr->im_lcd;
590
591 #if defined(CONFIG_LWMON)
592     {   uchar c = pic_read (0x60);
593         c &= ~0x07;     /* Power off CCFL, Disable CCFL, Chip Disable LCD */
594         pic_write (0x60, c);
595     }
596 #elif defined(CONFIG_R360MPI)
597     {
598         extern void r360_i2c_lcd_write (uchar data0, uchar data1);
599
600         r360_i2c_lcd_write(0x10, 0x00);
601         r360_i2c_lcd_write(0x20, 0x00);
602         r360_i2c_lcd_write(0x30, 0x00);
603         r360_i2c_lcd_write(0x40, 0x00);
604     }
605 #endif /* CONFIG_LWMON */
606         /* Disable the LCD panel */
607         lcdp->lcd_lccr &= ~LCCR_PON;
608 #ifdef CONFIG_RBC823
609         /* Turn off display backlight, VEE and LCD_ON */
610         immr->im_cpm.cp_pbdat &= ~0x00005001;
611 #else
612         immr->im_siu_conf.sc_sdcr &= ~(1 << (31 - 25)); /* LAM = 0 */
613 #endif /* CONFIG_RBC823 */
614 }
615 #endif  /* NOT_USED_SO_FAR || CONFIG_RBC823 */
616
617
618 /************************************************************************/
619
620 #endif /* CONFIG_LCD */