]> git.kernelconcepts.de Git - karo-tx-uboot.git/blob - cpu/mpc8xx/lcd.c
9e92676d6512d5c0e910361343b5639e48a23b95
[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 #include <config.h>
29 #include <common.h>
30 #include <version.h>
31 #include <stdarg.h>
32 #include <lcdvideo.h>
33 #include <linux/types.h>
34 #include <devices.h>
35
36
37 #ifdef CONFIG_LCD
38
39 /************************************************************************/
40 /* ** CONFIG STUFF -- should be moved to board config file              */
41 /************************************************************************/
42 #define CONFIG_LCD_LOGO
43 #define LCD_INFO                /* Display Logo, (C) and system info    */
44
45 #if defined(CONFIG_V37) || defined(CONFIG_EDT32F10)
46 #undef CONFIG_LCD_LOGO
47 #undef LCD_INFO
48 #endif
49
50 /* #define LCD_TEST_PATTERN */  /* color backgnd for frame/color adjust */
51 /* #define CFG_INVERT_COLORS */ /* Not needed - adjust vl_dp instead    */
52 /************************************************************************/
53
54 /************************************************************************/
55 /* ** BITMAP DISPLAY SUPPORT  -- should probably be moved elsewhere     */
56 /************************************************************************/
57
58 #if (CONFIG_COMMANDS & CFG_CMD_BMP)
59 #include <bmp_layout.h>
60 #endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
61
62 /************************************************************************/
63 /* ** FONT AND LOGO DATA                                                */
64 /************************************************************************/
65
66 #include <video_font.h>         /* Get font data, width and height      */
67
68 #ifdef CONFIG_LCD_LOGO
69 # include <bmp_logo.h>          /* Get logo data, width and height      */
70 #endif
71
72 /************************************************************************/
73 /************************************************************************/
74
75 /*
76  *  Information about displays we are using.  This is for configuring
77  *  the LCD controller and memory allocation.  Someone has to know what
78  *  is connected, as we can't autodetect anything.
79  */
80 #define CFG_HIGH        0       /* Pins are active high */
81 #define CFG_LOW         1       /* Pins are active low */
82
83 typedef struct vidinfo {
84     ushort      vl_col;         /* Number of columns (i.e. 640) */
85     ushort      vl_row;         /* Number of rows (i.e. 480) */
86     ushort      vl_width;       /* Width of display area in millimeters */
87     ushort      vl_height;      /* Height of display area in millimeters */
88
89     /* LCD configuration register.
90     */
91     u_char      vl_clkp;        /* Clock polarity */
92     u_char      vl_oep;         /* Output Enable polarity */
93     u_char      vl_hsp;         /* Horizontal Sync polarity */
94     u_char      vl_vsp;         /* Vertical Sync polarity */
95     u_char      vl_dp;          /* Data polarity */
96     u_char      vl_bpix;        /* Bits per pixel, 0 = 1, 1 = 2, 2 = 4, 3 = 8 */
97     u_char      vl_lbw;         /* LCD Bus width, 0 = 4, 1 = 8 */
98     u_char      vl_splt;        /* Split display, 0 = single-scan, 1 = dual-scan */
99     u_char      vl_clor;        /* Color, 0 = mono, 1 = color */
100     u_char      vl_tft;         /* 0 = passive, 1 = TFT */
101
102     /* Horizontal control register.  Timing from data sheet.
103     */
104     ushort      vl_wbl;         /* Wait between lines */
105
106     /* Vertical control register.
107     */
108     u_char      vl_vpw;         /* Vertical sync pulse width */
109     u_char      vl_lcdac;       /* LCD AC timing */
110     u_char      vl_wbf;         /* Wait between frames */
111 } vidinfo_t;
112
113 #define LCD_MONOCHROME  0
114 #define LCD_COLOR2      1
115 #define LCD_COLOR4      2
116 #define LCD_COLOR8      3
117
118 /*----------------------------------------------------------------------*/
119 #ifdef CONFIG_KYOCERA_KCS057QV1AJ
120 /*
121  *  Kyocera KCS057QV1AJ-G23. Passive, color, single scan.
122  */
123 #define LCD_BPP LCD_COLOR4
124
125 static vidinfo_t panel_info = {
126     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
127     LCD_BPP, 1, 0, 1, 0,  5, 0, 0, 0
128                 /* wbl, vpw, lcdac, wbf */
129 };
130 #endif /* CONFIG_KYOCERA_KCS057QV1AJ */
131 /*----------------------------------------------------------------------*/
132
133 /*----------------------------------------------------------------------*/
134 #ifdef CONFIG_NEC_NL6648AC33
135 /*
136  *  NEC NL6648AC33-18. Active, color, single scan.
137  */
138 static vidinfo_t panel_info = {
139     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
140     3, 0, 0, 1, 1, 144, 2, 0, 33
141                 /* wbl, vpw, lcdac, wbf */
142 };
143 #endif /* CONFIG_NEC_NL6648AC33 */
144 /*----------------------------------------------------------------------*/
145
146 #ifdef CONFIG_NEC_NL6648BC20
147 /*
148  *  NEC NL6648BC20-08. 6.5", 640x480. Active, color, single scan.
149  */
150 static vidinfo_t panel_info = {
151     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
152     3, 0, 0, 1, 1, 144, 2, 0, 33
153                 /* wbl, vpw, lcdac, wbf */
154 };
155 #endif /* CONFIG_NEC_NL6648BC20 */
156 /*----------------------------------------------------------------------*/
157
158 #ifdef CONFIG_SHARP_LQ104V7DS01
159 /*
160  *  SHARP LQ104V7DS01. 6.5", 640x480. Active, color, single scan.
161  */
162 static vidinfo_t panel_info = {
163     640, 480, 132, 99, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_LOW,
164     3, 0, 0, 1, 1, 25, 1, 0, 33
165                 /* wbl, vpw, lcdac, wbf */
166 };
167 #endif /* CONFIG_SHARP_LQ104V7DS01 */
168 /*----------------------------------------------------------------------*/
169
170 #ifdef CONFIG_SHARP_16x9
171 /*
172  * Sharp 320x240. Active, color, single scan.  It isn't 16x9, and I am
173  * not sure what it is.......
174  */
175 static vidinfo_t panel_info = {
176     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH,
177     3, 0, 0, 1, 1, 15, 4, 0, 3
178 };
179 #endif /* CONFIG_SHARP_16x9 */
180 /*----------------------------------------------------------------------*/
181
182 #ifdef CONFIG_SHARP_LQ057Q3DC02
183 /*
184  * Sharp LQ057Q3DC02 display. Active, color, single scan.
185  */
186 #define LCD_DF 12
187
188 static vidinfo_t panel_info = {
189     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
190     3, 0, 0, 1, 1, 15, 4, 0, 3
191                 /* wbl, vpw, lcdac, wbf */
192 };
193 #define LCD_INFO_BELOW_LOGO
194 #endif /* CONFIG_SHARP_LQ057Q3DC02 */
195 /*----------------------------------------------------------------------*/
196
197 #ifdef CONFIG_SHARP_LQ64D341
198 /*
199  * Sharp LQ64D341 display, 640x480. Active, color, single scan.
200  */
201 static vidinfo_t panel_info = {
202     640, 480, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
203     3, 0, 0, 1, 1, 128, 16, 0, 32
204                 /* wbl, vpw, lcdac, wbf */
205 };
206 #endif /* CONFIG_SHARP_LQ64D341 */
207
208 #ifdef CONFIG_SHARP_LQ084V1DG21
209 /*
210  * Sharp LQ084V1DG21 display, 640x480. Active, color, single scan.
211  */
212 static vidinfo_t panel_info = {
213     640, 480, 171, 129, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_LOW,
214     3, 0, 0, 1, 1, 160, 3, 0, 48
215                 /* wbl, vpw, lcdac, wbf */
216 };
217 #endif /* CONFIG_SHARP_LQ084V1DG21 */
218
219 /*----------------------------------------------------------------------*/
220
221 #ifdef CONFIG_HLD1045
222 /*
223  * HLD1045 display, 640x480. Active, color, single scan.
224  */
225 static vidinfo_t panel_info = {
226     640, 480, 0, 0, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
227     3, 0, 0, 1, 1, 160, 3, 0, 48
228                 /* wbl, vpw, lcdac, wbf */
229 };
230 #endif /* CONFIG_HLD1045 */
231 /*----------------------------------------------------------------------*/
232
233 #ifdef CONFIG_PRIMEVIEW_V16C6448AC
234 /*
235  * Prime View V16C6448AC
236  */
237 static vidinfo_t panel_info = {
238     640, 480, 130, 98, CFG_HIGH, CFG_HIGH, CFG_LOW, CFG_LOW, CFG_HIGH,
239     3, 0, 0, 1, 1, 144, 2, 0, 35
240                 /* wbl, vpw, lcdac, wbf */
241 };
242 #endif /* CONFIG_PRIMEVIEW_V16C6448AC */
243
244 /*----------------------------------------------------------------------*/
245
246 #ifdef CONFIG_OPTREX_BW
247 /*
248  * Optrex   CBL50840-2 NF-FW 99 22 M5
249  * or
250  * Hitachi  LMG6912RPFC-00T
251  * or
252  * Hitachi  SP14Q002
253  *
254  * 320x240. Black & white.
255  */
256 #define OPTREX_BPP      0       /* 0 - monochrome,     1 bpp */
257                                 /* 1 -  4 grey levels, 2 bpp */
258                                 /* 2 - 16 grey levels, 4 bpp */
259 static vidinfo_t panel_info = {
260     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
261     OPTREX_BPP, 0, 0, 0, 0, 0, 0, 0, 0, 4
262 };
263 #endif /* CONFIG_OPTREX_BW */
264
265 /*-----------------------------------------------------------------*/
266 #ifdef CONFIG_EDT32F10
267 /*
268  * Emerging Display Technologies 320x240. Passive, monochrome, single scan.
269  */
270 #define LCD_BPP         LCD_MONOCHROME
271 #define LCD_DF          10
272
273 static vidinfo_t panel_info = {
274     320, 240, 0, 0, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_HIGH, CFG_LOW,
275     LCD_BPP,  0, 0, 0, 0, 33, 0, 0, 0
276 };
277 #endif
278 /*----------------------------------------------------------------------*/
279
280 #if defined(LCD_INFO_BELOW_LOGO)
281 # define LCD_INFO_X             0
282 # define LCD_INFO_Y             (BMP_LOGO_HEIGHT + VIDEO_FONT_HEIGHT)
283 #elif defined(CONFIG_LCD_LOGO)
284 # define LCD_INFO_X             (BMP_LOGO_WIDTH + 4 * VIDEO_FONT_WIDTH)
285 # define LCD_INFO_Y             (VIDEO_FONT_HEIGHT)
286 #else
287 # define LCD_INFO_X             (VIDEO_FONT_WIDTH)
288 # define LCD_INFO_Y             (VIDEO_FONT_HEIGHT)
289 #endif
290
291 #ifndef LCD_BPP
292 #define LCD_BPP                 LCD_COLOR8
293 #endif
294 #ifndef LCD_DF
295 #define LCD_DF                  1
296 #endif
297
298 #define NBITS(bit_code)         (1 << (bit_code))
299 #define NCOLORS(bit_code)       (1 << NBITS(bit_code))
300
301 static int lcd_line_length;
302
303 static int lcd_color_fg;
304 static int lcd_color_bg;
305
306 static char lcd_is_enabled = 0;         /* Indicate that LCD is enabled */
307
308 /*
309  * Frame buffer memory information
310  */
311 static void *lcd_base;                  /* Start of framebuffer memory  */
312 static void *lcd_console_address;       /* Start of console buffer      */
313
314
315 /************************************************************************/
316 /* ** CONSOLE CONSTANTS                                                 */
317 /************************************************************************/
318
319 #if LCD_BPP == LCD_MONOCHROME
320
321 /*
322  * Simple color definitions
323  */
324 #define CONSOLE_COLOR_BLACK      0
325 #define CONSOLE_COLOR_WHITE      1      /* Must remain last / highest */
326
327 #else
328
329 /*
330  * Simple color definitions
331  */
332 #define CONSOLE_COLOR_BLACK      0
333 #define CONSOLE_COLOR_RED        1
334 #define CONSOLE_COLOR_GREEN      2
335 #define CONSOLE_COLOR_YELLOW     3
336 #define CONSOLE_COLOR_BLUE       4
337 #define CONSOLE_COLOR_MAGENTA    5
338 #define CONSOLE_COLOR_CYAN       6
339 #define CONSOLE_COLOR_GREY      14
340 #define CONSOLE_COLOR_WHITE     15      /* Must remain last / highest */
341
342 #endif
343
344 #if defined(CONFIG_LCD_LOGO) && (CONSOLE_COLOR_WHITE >= BMP_LOGO_OFFSET)
345 #error Default Color Map overlaps with Logo Color Map
346 #endif
347
348 /************************************************************************/
349
350 #ifndef PAGE_SIZE
351 #define PAGE_SIZE       4096
352 #endif
353
354
355 /************************************************************************/
356 /* ** CONSOLE DEFINITIONS & FUNCTIONS                                   */
357 /************************************************************************/
358
359 #if defined(CONFIG_LCD_LOGO) && !defined(LCD_INFO_BELOW_LOGO)
360 #define CONSOLE_ROWS            ((panel_info.vl_row-BMP_LOGO_HEIGHT) \
361                                         / VIDEO_FONT_HEIGHT)
362 #else
363 #define CONSOLE_ROWS            (panel_info.vl_row / VIDEO_FONT_HEIGHT)
364 #endif
365 #define CONSOLE_COLS            (panel_info.vl_col / VIDEO_FONT_WIDTH)
366 #define CONSOLE_ROW_SIZE        (VIDEO_FONT_HEIGHT * lcd_line_length)
367 #define CONSOLE_ROW_FIRST       (lcd_console_address)
368 #define CONSOLE_ROW_SECOND      (lcd_console_address + CONSOLE_ROW_SIZE)
369 #define CONSOLE_ROW_LAST        (lcd_console_address + CONSOLE_SIZE \
370                                         - CONSOLE_ROW_SIZE)
371 #define CONSOLE_SIZE            (CONSOLE_ROW_SIZE * CONSOLE_ROWS)
372 #define CONSOLE_SCROLL_SIZE     (CONSOLE_SIZE - CONSOLE_ROW_SIZE)
373
374 #if  LCD_BPP == LCD_MONOCHROME
375 #define COLOR_MASK(c)           ((c)      | (c) << 1 | (c) << 2 | (c) << 3 | \
376                                  (c) << 4 | (c) << 5 | (c) << 6 | (c) << 7)
377 #elif LCD_BPP == LCD_COLOR8
378 #define COLOR_MASK(c)           (c)
379 #else
380 #error Unsupported LCD BPP.
381 #endif
382
383 static short console_col;
384 static short console_row;
385
386 /************************************************************************/
387
388 ulong   lcd_setmem (ulong addr);
389
390 static void     lcd_drawchars  (ushort x, ushort y, uchar *str, int count);
391 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s);
392 static inline void lcd_putc_xy (ushort x, ushort y, uchar  c);
393
394 static int      lcd_init (void *lcdbase);
395 static void     lcd_ctrl_init (void *lcdbase);
396 static void     lcd_enable (void);
397 static void    *lcd_logo (void);
398 #if LCD_BPP == LCD_COLOR8
399 static void     lcd_setcolreg (ushort regno,
400                                 ushort red, ushort green, ushort blue);
401 #endif
402 #if LCD_BPP == LCD_MONOCHROME
403 static void     lcd_initcolregs (void);
404 #endif
405 static int      lcd_getbgcolor (void);
406 static void     lcd_setfgcolor (int color);
407 static void     lcd_setbgcolor (int color);
408
409 #ifdef  NOT_USED_SO_FAR
410 static void     lcd_disable (void);
411 static void     lcd_getcolreg (ushort regno,
412                                 ushort *red, ushort *green, ushort *blue);
413 static int      lcd_getfgcolor (void);
414 #endif  /* NOT_USED_SO_FAR */
415
416 /************************************************************************/
417
418 /*----------------------------------------------------------------------*/
419
420 static void console_scrollup (void)
421 {
422 #if 1
423         /* Copy up rows ignoring the first one */
424         memcpy (CONSOLE_ROW_FIRST, CONSOLE_ROW_SECOND, CONSOLE_SCROLL_SIZE);
425
426         /* Clear the last one */
427         memset (CONSOLE_ROW_LAST, COLOR_MASK(lcd_color_bg), CONSOLE_ROW_SIZE);
428 #else
429         /*
430          * Poor attempt to optimize speed by moving "long"s.
431          * But the code is ugly, and not a bit faster :-(
432          */
433         ulong *t = (ulong *)CONSOLE_ROW_FIRST;
434         ulong *s = (ulong *)CONSOLE_ROW_SECOND;
435         ulong    l = CONSOLE_SCROLL_SIZE / sizeof(ulong);
436         uchar  c = lcd_color_bg & 0xFF;
437         ulong val= (c<<24) | (c<<16) | (c<<8) | c;
438
439         while (l--)
440                 *t++ = *s++;
441
442         t = (ulong *)CONSOLE_ROW_LAST;
443         l = CONSOLE_ROW_SIZE / sizeof(ulong);
444
445         while (l-- > 0)
446                 *t++ = val;
447 #endif
448 }
449
450 /*----------------------------------------------------------------------*/
451
452 static inline void console_back (void)
453 {
454         if (--console_col < 0) {
455                 console_col = CONSOLE_COLS-1 ;
456                 if (--console_row < 0) {
457                         console_row = 0;
458                 }
459         }
460
461         lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
462                      console_row * VIDEO_FONT_HEIGHT,
463                      ' ');
464 }
465
466 /*----------------------------------------------------------------------*/
467
468 static inline void console_newline (void)
469 {
470         ++console_row;
471         console_col = 0;
472
473         /* Check if we need to scroll the terminal */
474         if (console_row >= CONSOLE_ROWS) {
475                 /* Scroll everything up */
476                 console_scrollup () ;
477                 --console_row;
478         }
479 }
480
481 /*----------------------------------------------------------------------*/
482
483 void lcd_putc (const char c)
484 {
485         if (!lcd_is_enabled) {
486                 serial_putc(c);
487                 return;
488         }
489
490         switch (c) {
491         case '\r':      console_col = 0;
492                         return;
493
494         case '\n':      console_newline();
495                         return;
496
497         case '\t':      /* Tab (8 chars alignment) */
498                         console_col |=  8;
499                         console_col &= ~7;
500
501                         if (console_col >= CONSOLE_COLS) {
502                                 console_newline();
503                         }
504                         return;
505
506         case '\b':      console_back();
507                         return;
508
509         default:        lcd_putc_xy (console_col * VIDEO_FONT_WIDTH,
510                                      console_row * VIDEO_FONT_HEIGHT,
511                                      c);
512                         if (++console_col >= CONSOLE_COLS) {
513                                 console_newline();
514                         }
515                         return;
516         }
517         /* NOTREACHED */
518 }
519
520 /*----------------------------------------------------------------------*/
521
522 void lcd_puts (const char *s)
523 {
524         if (!lcd_is_enabled) {
525                 serial_puts (s);
526                 return;
527         }
528
529         while (*s) {
530                 lcd_putc (*s++);
531         }
532 }
533
534 /************************************************************************/
535 /* ** Low-Level Graphics Routines                                       */
536 /************************************************************************/
537
538 static void lcd_drawchars (ushort x, ushort y, uchar *str, int count)
539 {
540         uchar *dest;
541         ushort off, row;
542
543         dest = (uchar *)(lcd_base + y * lcd_line_length + x * (1 << LCD_BPP) / 8);
544         off  = x * (1 << LCD_BPP) % 8;
545
546         for (row=0;  row < VIDEO_FONT_HEIGHT;  ++row, dest += lcd_line_length)  {
547                 uchar *s = str;
548                 uchar *d = dest;
549                 int i;
550
551 #if LCD_BPP == LCD_MONOCHROME
552                 uchar rest = *d & -(1 << (8-off));
553                 uchar sym;
554 #endif
555                 for (i=0; i<count; ++i) {
556                         uchar c, bits;
557
558                         c = *s++;
559                         bits = video_fontdata[c * VIDEO_FONT_HEIGHT + row];
560
561 #if LCD_BPP == LCD_MONOCHROME
562                         sym  = (COLOR_MASK(lcd_color_fg) & bits) |
563                                (COLOR_MASK(lcd_color_bg) & ~bits);
564
565                         *d++ = rest | (sym >> off);
566                         rest = sym << (8-off);
567 #elif LCD_BPP == LCD_COLOR8
568                         for (c=0; c<8; ++c) {
569                                 *d++ = (bits & 0x80) ?
570                                                 lcd_color_fg : lcd_color_bg;
571                                 bits <<= 1;
572                         }
573 #endif
574                 }
575
576 #if LCD_BPP == LCD_MONOCHROME
577                 *d  = rest | (*d & ((1 << (8-off)) - 1));
578 #endif
579         }
580 }
581
582 /*----------------------------------------------------------------------*/
583
584 static inline void lcd_puts_xy (ushort x, ushort y, uchar *s)
585 {
586 #if defined(CONFIG_LCD_LOGO) && !defined(LCD_INFO_BELOW_LOGO)
587         lcd_drawchars (x, y+BMP_LOGO_HEIGHT, s, strlen (s));
588 #else
589         lcd_drawchars (x, y, s, strlen (s));
590 #endif
591 }
592
593 /*----------------------------------------------------------------------*/
594
595 static inline void lcd_putc_xy (ushort x, ushort y, uchar c)
596 {
597 #if defined(CONFIG_LCD_LOGO) && !defined(LCD_INFO_BELOW_LOGO)
598         lcd_drawchars (x, y+BMP_LOGO_HEIGHT, &c, 1);
599 #else
600         lcd_drawchars (x, y, &c, 1);
601 #endif
602 }
603
604 /************************************************************************/
605 /**  Small utility to check that you got the colours right              */
606 /************************************************************************/
607 #ifdef LCD_TEST_PATTERN
608
609 #define N_BLK_VERT      2
610 #define N_BLK_HOR       3
611
612 static int test_colors[N_BLK_HOR*N_BLK_VERT] = {
613         CONSOLE_COLOR_RED,      CONSOLE_COLOR_GREEN,    CONSOLE_COLOR_YELLOW,
614         CONSOLE_COLOR_BLUE,     CONSOLE_COLOR_MAGENTA,  CONSOLE_COLOR_CYAN,
615 };
616
617 static void test_pattern (void)
618 {
619         ushort v_max  = panel_info.vl_row;
620         ushort h_max  = panel_info.vl_col;
621         ushort v_step = (v_max + N_BLK_VERT - 1) / N_BLK_VERT;
622         ushort h_step = (h_max + N_BLK_HOR  - 1) / N_BLK_HOR;
623         ushort v, h;
624         uchar *pix = (uchar *)lcd_base;
625
626         printf ("[LCD] Test Pattern: %d x %d [%d x %d]\n",
627                 h_max, v_max, h_step, v_step);
628
629         /* WARNING: Code silently assumes 8bit/pixel */
630         for (v=0; v<v_max; ++v) {
631                 uchar iy = v / v_step;
632                 for (h=0; h<h_max; ++h) {
633                         uchar ix = N_BLK_HOR * iy + (h/h_step);
634                         *pix++ = test_colors[ix];
635                 }
636         }
637 }
638 #endif /* LCD_TEST_PATTERN */
639
640
641 /************************************************************************/
642 /* ** GENERIC Initialization Routines                                   */
643 /************************************************************************/
644
645 int drv_lcd_init (void)
646 {
647         DECLARE_GLOBAL_DATA_PTR;
648
649         device_t lcddev;
650         int rc;
651
652         lcd_base = (void *)(gd->fb_base);
653
654         lcd_line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
655
656         lcd_init (lcd_base);            /* LCD initialization */
657
658         /* Device initialization */
659         memset (&lcddev, 0, sizeof (lcddev));
660
661         strcpy (lcddev.name, "lcd");
662         lcddev.ext   = 0;                       /* No extensions */
663         lcddev.flags = DEV_FLAGS_OUTPUT;        /* Output only */
664         lcddev.putc  = lcd_putc;                /* 'putc' function */
665         lcddev.puts  = lcd_puts;                /* 'puts' function */
666
667         rc = device_register (&lcddev);
668
669         return (rc == 0) ? 1 : rc;
670 }
671
672 /*----------------------------------------------------------------------*/
673
674 static int lcd_init (void *lcdbase)
675 {
676         /* Initialize the lcd controller */
677         debug ("[LCD] Initializing LCD frambuffer at %p\n", lcdbase);
678
679         lcd_ctrl_init (lcdbase);
680
681 #if LCD_BPP == LCD_MONOCHROME
682         /* Setting the palette */
683         lcd_initcolregs();
684
685 #elif LCD_BPP == LCD_COLOR8
686         /* Setting the palette */
687         lcd_setcolreg  (CONSOLE_COLOR_BLACK,       0,    0,    0);
688         lcd_setcolreg  (CONSOLE_COLOR_RED,      0xFF,    0,    0);
689         lcd_setcolreg  (CONSOLE_COLOR_GREEN,       0, 0xFF,    0);
690         lcd_setcolreg  (CONSOLE_COLOR_YELLOW,   0xFF, 0xFF,    0);
691         lcd_setcolreg  (CONSOLE_COLOR_BLUE,        0,    0, 0xFF);
692         lcd_setcolreg  (CONSOLE_COLOR_MAGENTA,  0xFF,    0, 0xFF);
693         lcd_setcolreg  (CONSOLE_COLOR_CYAN,        0, 0xFF, 0xFF);
694         lcd_setcolreg  (CONSOLE_COLOR_GREY,     0xAA, 0xAA, 0xAA);
695         lcd_setcolreg  (CONSOLE_COLOR_WHITE,    0xFF, 0xFF, 0xFF);
696 #endif
697
698 #ifndef CFG_WHITE_ON_BLACK
699         lcd_setfgcolor (CONSOLE_COLOR_BLACK);
700         lcd_setbgcolor (CONSOLE_COLOR_WHITE);
701 #else
702         lcd_setfgcolor (CONSOLE_COLOR_WHITE);
703         lcd_setbgcolor (CONSOLE_COLOR_BLACK);
704 #endif  /* CFG_WHITE_ON_BLACK */
705
706 #ifdef  LCD_TEST_PATTERN
707         test_pattern();
708 #else
709         /* set framebuffer to background color */
710         memset ((char *)lcd_base,
711                 COLOR_MASK(lcd_getbgcolor()),
712                 lcd_line_length*panel_info.vl_row);
713 #endif
714
715         lcd_enable ();
716
717         /* Paint the logo and retrieve LCD base address */
718         debug ("[LCD] Drawing the logo...\n");
719         lcd_console_address = lcd_logo ();
720
721         /* Initialize the console */
722         console_col = 0;
723 #ifdef LCD_INFO_BELOW_LOGO
724         console_row = 7 + BMP_LOGO_HEIGHT / VIDEO_FONT_HEIGHT;
725 #else
726         console_row = 1;        /* leave 1 blank line below logo */
727 #endif
728         lcd_is_enabled = 1;
729
730         return 0;
731 }
732
733
734 /************************************************************************/
735 /* ** ROM capable initialization part - needed to reserve FB memory     */
736 /************************************************************************/
737
738 /*
739  * This is called early in the system initialization to grab memory
740  * for the LCD controller.
741  * Returns new address for monitor, after reserving LCD buffer memory
742  *
743  * Note that this is running from ROM, so no write access to global data.
744  */
745 ulong lcd_setmem (ulong addr)
746 {
747         ulong size;
748         int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8;
749
750         debug ("LCD panel info: %d x %d, %d bit/pix\n",
751                 panel_info.vl_col, panel_info.vl_row, NBITS (panel_info.vl_bpix) );
752
753         size = line_length * panel_info.vl_row;
754
755         /* Round up to nearest full page */
756         size = (size + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
757
758         /* Allocate pages for the frame buffer. */
759         addr -= size;
760
761         debug ("Reserving %ldk for LCD Framebuffer at: %08lx\n", size>>10, addr);
762
763         return (addr);
764 }
765
766
767 /************************************************************************/
768 /* ----------------- chipset specific functions ----------------------- */
769 /************************************************************************/
770
771 static void lcd_ctrl_init (void *lcdbase)
772 {
773         volatile immap_t *immr = (immap_t *) CFG_IMMR;
774         volatile lcd823_t *lcdp = &immr->im_lcd;
775
776         uint lccrtmp;
777
778         /* Initialize the LCD control register according to the LCD
779          * parameters defined.  We do everything here but enable
780          * the controller.
781          */
782
783         lccrtmp  = LCDBIT (LCCR_BNUM_BIT,
784                    (((panel_info.vl_row * panel_info.vl_col) * (1 << LCD_BPP)) / 128));
785
786         lccrtmp |= LCDBIT (LCCR_CLKP_BIT, panel_info.vl_clkp)   |
787                    LCDBIT (LCCR_OEP_BIT,  panel_info.vl_oep)    |
788                    LCDBIT (LCCR_HSP_BIT,  panel_info.vl_hsp)    |
789                    LCDBIT (LCCR_VSP_BIT,  panel_info.vl_vsp)    |
790                    LCDBIT (LCCR_DP_BIT,   panel_info.vl_dp)     |
791                    LCDBIT (LCCR_BPIX_BIT, panel_info.vl_bpix)   |
792                    LCDBIT (LCCR_LBW_BIT,  panel_info.vl_lbw)    |
793                    LCDBIT (LCCR_SPLT_BIT, panel_info.vl_splt)   |
794                    LCDBIT (LCCR_CLOR_BIT, panel_info.vl_clor)   |
795                    LCDBIT (LCCR_TFT_BIT,  panel_info.vl_tft);
796
797 #if 0
798         lccrtmp |= ((SIU_LEVEL5 / 2) << 12);
799         lccrtmp |= LCCR_EIEN;
800 #endif
801
802         lcdp->lcd_lccr = lccrtmp;
803         lcdp->lcd_lcsr = 0xFF;          /* Clear pending interrupts */
804
805         /* Initialize LCD controller bus priorities.
806          */
807         immr->im_siu_conf.sc_sdcr &= ~0x0f;     /* RAID = LAID = 0 */
808
809         /* set SHFT/CLOCK division factor 4
810          * This needs to be set based upon display type and processor
811          * speed.  The TFT displays run about 20 to 30 MHz.
812          * I was running 64 MHz processor speed.
813          * The value for this divider must be chosen so the result is
814          * an integer of the processor speed (i.e., divide by 3 with
815          * 64 MHz would be bad).
816          */
817         immr->im_clkrst.car_sccr &= ~0x1F;
818         immr->im_clkrst.car_sccr |= LCD_DF;     /* was 8 */
819
820 #ifndef CONFIG_EDT32F10
821         /* Enable LCD on port D.
822          */
823         immr->im_ioport.iop_pdpar |= 0x1FFF;
824         immr->im_ioport.iop_pddir |= 0x1FFF;
825
826         /* Enable LCD_A/B/C on port B.
827          */
828         immr->im_cpm.cp_pbpar |= 0x00005001;
829         immr->im_cpm.cp_pbdir |= 0x00005001;
830 #else
831         /* Enable LCD on port D.
832          */
833         immr->im_ioport.iop_pdpar |= 0x1DFF;
834         immr->im_ioport.iop_pdpar &= ~0x0200;
835         immr->im_ioport.iop_pddir |= 0x1FFF;
836         immr->im_ioport.iop_pddat |= 0x0200;
837 #endif
838
839         /* Load the physical address of the linear frame buffer
840          * into the LCD controller.
841          * BIG NOTE:  This has to be modified to load A and B depending
842          * upon the split mode of the LCD.
843          */
844         lcdp->lcd_lcfaa = (ulong)lcd_base;
845         lcdp->lcd_lcfba = (ulong)lcd_base;
846
847         /* MORE HACKS...This must be updated according to 823 manual
848          * for different panels.
849          */
850 #ifndef CONFIG_EDT32F10
851         lcdp->lcd_lchcr = LCHCR_BO |
852                           LCDBIT (LCHCR_AT_BIT, 4) |
853                           LCDBIT (LCHCR_HPC_BIT, panel_info.vl_col) |
854                           panel_info.vl_wbl;
855 #else
856         lcdp->lcd_lchcr = LCHCR_BO |
857                           LCDBIT (LCHCR_AT_BIT, 4) |
858                           LCDBIT (LCHCR_HPC_BIT, panel_info.vl_col/4) |
859                           panel_info.vl_wbl;
860 #endif
861
862         lcdp->lcd_lcvcr = LCDBIT (LCVCR_VPW_BIT, panel_info.vl_vpw) |
863                           LCDBIT (LCVCR_LCD_AC_BIT, panel_info.vl_lcdac) |
864                           LCDBIT (LCVCR_VPC_BIT, panel_info.vl_row) |
865                           panel_info.vl_wbf;
866
867 }
868
869 /*----------------------------------------------------------------------*/
870
871 #ifdef  NOT_USED_SO_FAR
872 static void
873 lcd_getcolreg (ushort regno, ushort *red, ushort *green, ushort *blue)
874 {
875         volatile immap_t *immr = (immap_t *) CFG_IMMR;
876         volatile cpm8xx_t *cp = &(immr->im_cpm);
877         unsigned short colreg, *cmap_ptr;
878
879         cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
880
881         colreg = *cmap_ptr;
882 #ifdef  CFG_INVERT_COLORS
883         colreg ^= 0x0FFF;
884 #endif
885
886         *red   = (colreg >> 8) & 0x0F;
887         *green = (colreg >> 4) & 0x0F;
888         *blue  =  colreg       & 0x0F;
889 }
890 #endif  /* NOT_USED_SO_FAR */
891
892 /*----------------------------------------------------------------------*/
893
894 #if LCD_BPP == LCD_COLOR8
895 static void
896 lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue)
897 {
898         volatile immap_t *immr = (immap_t *) CFG_IMMR;
899         volatile cpm8xx_t *cp = &(immr->im_cpm);
900         unsigned short colreg, *cmap_ptr;
901
902         cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2];
903
904         colreg = ((red   & 0x0F) << 8) |
905                  ((green & 0x0F) << 4) |
906                   (blue  & 0x0F) ;
907 #ifdef  CFG_INVERT_COLORS
908         colreg ^= 0x0FFF;
909 #endif
910         *cmap_ptr = colreg;
911
912         debug ("setcolreg: reg %2d @ %p: R=%02X G=%02X B=%02X => %02X%02X\n",
913                 regno, &(cp->lcd_cmap[regno * 2]),
914                 red, green, blue,
915                 cp->lcd_cmap[ regno * 2 ], cp->lcd_cmap[(regno * 2) + 1]);
916 }
917 #endif  /* LCD_COLOR8 */
918
919 /*----------------------------------------------------------------------*/
920
921 #if LCD_BPP == LCD_MONOCHROME
922 static
923 void lcd_initcolregs (void)
924 {
925         volatile immap_t *immr = (immap_t *) CFG_IMMR;
926         volatile cpm8xx_t *cp = &(immr->im_cpm);
927         ushort regno;
928
929         for (regno = 0; regno < 16; regno++) {
930                 cp->lcd_cmap[regno * 2] = 0;
931                 cp->lcd_cmap[(regno * 2) + 1] = regno & 0x0f;
932         }
933 }
934 #endif
935
936 /*----------------------------------------------------------------------*/
937
938 static void lcd_setfgcolor (int color)
939 {
940         lcd_color_fg = color & 0x0F;
941 }
942
943 /*----------------------------------------------------------------------*/
944
945 static void lcd_setbgcolor (int color)
946 {
947         lcd_color_bg = color & 0x0F;
948 }
949
950 /*----------------------------------------------------------------------*/
951
952 #ifdef  NOT_USED_SO_FAR
953 static int lcd_getfgcolor (void)
954 {
955         return lcd_color_fg;
956 }
957 #endif  /* NOT_USED_SO_FAR */
958
959 /*----------------------------------------------------------------------*/
960
961 static int lcd_getbgcolor (void)
962 {
963         return lcd_color_bg;
964 }
965
966 /*----------------------------------------------------------------------*/
967
968 static void lcd_enable (void)
969 {
970         volatile immap_t *immr = (immap_t *) CFG_IMMR;
971         volatile lcd823_t *lcdp = &immr->im_lcd;
972
973         /* Enable the LCD panel */
974         immr->im_siu_conf.sc_sdcr |= (1 << (31 - 25));          /* LAM = 1 */
975         lcdp->lcd_lccr |= LCCR_PON;
976
977 #ifdef CONFIG_V37
978         /* Turn on display backlight */
979         immr->im_cpm.cp_pbpar |= 0x00008000;
980         immr->im_cpm.cp_pbdir |= 0x00008000;
981 #endif
982
983 #if defined(CONFIG_LWMON)
984     {   uchar c = pic_read (0x60);
985         c |= 0x07;      /* Power on CCFL, Enable CCFL, Chip Enable LCD */
986         pic_write (0x60, c);
987     }
988 #endif /* CONFIG_LWMON */
989
990 #if defined(CONFIG_R360MPI)
991     {
992         extern void r360_i2c_lcd_write (uchar data0, uchar data1);
993
994         r360_i2c_lcd_write(0x10, 0x01);
995         r360_i2c_lcd_write(0x20, 0x01);
996         r360_i2c_lcd_write(0x3F, 0xFF);
997         r360_i2c_lcd_write(0x47, 0xFF);
998     }
999 #endif /* CONFIG_R360MPI */
1000 }
1001
1002 /*----------------------------------------------------------------------*/
1003
1004 #ifdef  NOT_USED_SO_FAR
1005 static void lcd_disable (void)
1006 {
1007         volatile immap_t *immr = (immap_t *) CFG_IMMR;
1008         volatile lcd823_t *lcdp = &immr->im_lcd;
1009
1010 #if defined(CONFIG_LWMON)
1011     {   uchar c = pic_read (0x60);
1012         c &= ~0x07;     /* Power off CCFL, Disable CCFL, Chip Disable LCD */
1013         pic_write (0x60, c);
1014     }
1015 #elif defined(CONFIG_R360MPI)
1016     {
1017         extern void r360_i2c_lcd_write (uchar data0, uchar data1);
1018
1019         r360_i2c_lcd_write(0x10, 0x00);
1020         r360_i2c_lcd_write(0x20, 0x00);
1021         r360_i2c_lcd_write(0x30, 0x00);
1022         r360_i2c_lcd_write(0x40, 0x00);
1023     }
1024 #endif /* CONFIG_LWMON */
1025         /* Disable the LCD panel */
1026         lcdp->lcd_lccr &= ~LCCR_PON;
1027         immr->im_siu_conf.sc_sdcr &= ~(1 << (31 - 25)); /* LAM = 0 */
1028 }
1029 #endif  /* NOT_USED_SO_FAR */
1030
1031
1032 /************************************************************************/
1033 /* ** Chipset depending Bitmap / Logo stuff...                          */
1034 /************************************************************************/
1035
1036
1037 #ifdef CONFIG_LCD_LOGO
1038 static void bitmap_plot (int x, int y)
1039 {
1040         volatile immap_t *immr = (immap_t *) CFG_IMMR;
1041         volatile cpm8xx_t *cp = &(immr->im_cpm);
1042         ushort *cmap;
1043         ushort i;
1044         uchar *bmap;
1045         uchar *fb;
1046
1047         debug ("Logo: width %d  height %d  colors %d  cmap %d\n",
1048                 BMP_LOGO_WIDTH, BMP_LOGO_HEIGHT, BMP_LOGO_COLORS,
1049                 sizeof(bmp_logo_palette)/(sizeof(ushort))
1050         );
1051
1052         /* Leave room for default color map */
1053         cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET*sizeof(ushort)]);
1054
1055         /* Set color map */
1056         for (i=0; i<(sizeof(bmp_logo_palette)/(sizeof(ushort))); ++i) {
1057                 ushort colreg = bmp_logo_palette[i];
1058 #ifdef  CFG_INVERT_COLORS
1059                 colreg ^= 0xFFF;
1060 #endif
1061                 *cmap++ = colreg;
1062         }
1063
1064         bmap = &bmp_logo_bitmap[0];
1065         fb   = (char *)(lcd_base + y * lcd_line_length + x);
1066
1067         for (i=0; i<BMP_LOGO_HEIGHT; ++i) {
1068                 memcpy (fb, bmap, BMP_LOGO_WIDTH);
1069                 bmap += BMP_LOGO_WIDTH;
1070                 fb   += panel_info.vl_col;
1071         }
1072 }
1073 #endif /* CONFIG_LCD_LOGO */
1074
1075 #if (CONFIG_COMMANDS & CFG_CMD_BMP)
1076 /*
1077  * Display the BMP file located at address bmp_image.
1078  * Only uncompressed
1079  */
1080 int lcd_display_bitmap(ulong bmp_image)
1081 {
1082         volatile immap_t *immr = (immap_t *) CFG_IMMR;
1083         volatile cpm8xx_t *cp = &(immr->im_cpm);
1084         ushort *cmap;
1085         ushort i, j;
1086         uchar *fb;
1087         bmp_image_t *bmp=(bmp_image_t *)bmp_image;
1088         uchar *bmap;
1089         ushort padded_line;
1090         unsigned long width, height;
1091         unsigned colors,bpix;
1092         unsigned long compression;
1093
1094         if (!((bmp->header.signature[0]=='B') &&
1095               (bmp->header.signature[1]=='M'))) {
1096                 printf ("Error: no valid bmp image at %lx\n", bmp_image);
1097                 return 1;
1098         }
1099
1100         width = le32_to_cpu (bmp->header.width);
1101         height = le32_to_cpu (bmp->header.height);
1102         colors = 1<<le16_to_cpu (bmp->header.bit_count);
1103         compression = le32_to_cpu (bmp->header.compression);
1104
1105         bpix = NBITS(panel_info.vl_bpix);
1106
1107         if ((bpix != 1) && (bpix != 8)) {
1108                 printf ("Error: %d bit/pixel mode not supported by U-Boot\n",
1109                         bpix);
1110                 return 1;
1111         }
1112
1113         if (bpix != le16_to_cpu(bmp->header.bit_count)) {
1114                 printf ("Error: %d bit/pixel mode, but BMP has %d bit/pixel\n",
1115                         bpix,
1116                         le16_to_cpu(bmp->header.bit_count));
1117                 return 1;
1118         }
1119
1120         if (compression!=BMP_BI_RGB) {
1121                 printf ("Error: compression type %ld not supported\n",
1122                         compression);
1123                 return 1;
1124         }
1125
1126         debug ("Display-bmp: %d x %d  with %d colors\n",
1127                width, height, colors);
1128
1129         if (bpix==8) {
1130                 /* Fill the entire color map */
1131                 cmap = (ushort *)&(cp->lcd_cmap[255*sizeof(ushort)]);
1132
1133                 /* Set color map */
1134                 for (i = 0; i < colors; ++i) {
1135                         bmp_color_table_entry_t cte = bmp->color_table[i];
1136                         ushort colreg =
1137                                 ((cte.red>>4)   << 8) |
1138                                 ((cte.green>>4) << 4) |
1139                                 (cte.blue>>4) ;
1140 #ifdef  CFG_INVERT_COLORS
1141                         colreg ^= 0xFFF;
1142 #endif
1143                         *cmap-- = colreg;
1144                 }
1145         }
1146
1147         padded_line = (width&0x3) ? ((width&~0x3)+4) : (width);
1148         if (width>panel_info.vl_col)
1149                 width = panel_info.vl_col;
1150         if (height>panel_info.vl_row)
1151                 height = panel_info.vl_row;
1152
1153         bmap = (uchar *)bmp + le32_to_cpu (bmp->header.data_offset);
1154         fb   = (uchar *)
1155                 (lcd_base +
1156                  (((height>=panel_info.vl_row) ? panel_info.vl_row : height)-1)
1157                  * lcd_line_length);
1158         for (i = 0; i < height; ++i) {
1159                 for (j = 0; j < width ; j++)
1160                         *(fb++)=255-*(bmap++);
1161                 bmap += (width - padded_line);
1162                 fb   -= (width + lcd_line_length);
1163         }
1164
1165         return (0);
1166 }
1167 #endif /* (CONFIG_COMMANDS & CFG_CMD_BMP) */
1168
1169 /*----------------------------------------------------------------------*/
1170
1171 static void *lcd_logo (void)
1172 {
1173 #ifdef LCD_INFO
1174         DECLARE_GLOBAL_DATA_PTR;
1175
1176         char info[80];
1177         char temp[32];
1178 #endif /* LCD_INFO */
1179
1180 #ifdef CONFIG_SPLASH_SCREEN
1181         char *s;
1182         ulong addr;
1183
1184         if ((s = getenv("splashimage")) != NULL) {
1185                 addr = simple_strtoul(s, NULL, 16);
1186
1187                 if (lcd_display_bitmap (addr) == 0) {
1188                         return ((void *)lcd_base);
1189                 }
1190         }
1191 #endif  /* CONFIG_SPLASH_SCREEN */
1192
1193 #ifdef CONFIG_LCD_LOGO
1194         bitmap_plot (0, 0);
1195 #endif /* CONFIG_LCD_LOGO */
1196
1197
1198 #ifdef LCD_INFO
1199         sprintf (info, "%s (%s - %s) ", U_BOOT_VERSION, __DATE__, __TIME__);
1200         lcd_drawchars (LCD_INFO_X, LCD_INFO_Y, info, strlen(info));
1201
1202         sprintf (info, "(C) 2003 DENX Software Engineering");
1203         lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT,
1204                                         info, strlen(info));
1205
1206         sprintf (info, "    Wolfgang DENK, wd@denx.de");
1207         lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 2,
1208                                         info, strlen(info));
1209 #ifdef LCD_INFO_BELOW_LOGO
1210         sprintf (info, "MPC823 CPU at %s MHz",
1211                 strmhz(temp, gd->cpu_clk));
1212         lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 3,
1213                                         info, strlen(info));
1214         sprintf (info, "  %ld MB RAM, %ld MB Flash",
1215                 gd->ram_size >> 20,
1216                 gd->bd->bi_flashsize >> 20 );
1217         lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
1218                                         info, strlen(info));
1219 #else
1220         /* leave one blank line */
1221
1222         sprintf (info, "MPC823 CPU at %s MHz, %ld MB RAM, %ld MB Flash",
1223                 strmhz(temp, gd->cpu_clk),
1224                 gd->ram_size >> 20,
1225                 gd->bd->bi_flashsize >> 20 );
1226         lcd_drawchars (LCD_INFO_X, LCD_INFO_Y + VIDEO_FONT_HEIGHT * 4,
1227                                         info, strlen(info));
1228 #endif /* LCD_INFO_BELOW_LOGO */
1229 #endif /* LCD_INFO */
1230
1231 #if defined(CONFIG_LCD_LOGO) && !defined(LCD_INFO_BELOW_LOGO)
1232         return ((void *)((ulong)lcd_base + BMP_LOGO_HEIGHT * lcd_line_length));
1233 #else
1234         return ((void *)lcd_base);
1235 #endif  /* CONFIG_LCD_LOGO */
1236 }
1237
1238 /************************************************************************/
1239 /************************************************************************/
1240
1241 #endif /* CONFIG_LCD */