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