wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 1 | /* |
| 2 | * (C) Copyright 2001-2002 |
| 3 | * Wolfgang Denk, DENX Software Engineering -- wd@denx.de |
| 4 | * |
Wolfgang Denk | 3765b3e | 2013-10-07 13:07:26 +0200 | [diff] [blame] | 5 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | /************************************************************************/ |
| 9 | /* ** HEADER FILES */ |
| 10 | /************************************************************************/ |
| 11 | |
wdenk | 8564acf | 2003-07-14 22:13:32 +0000 | [diff] [blame] | 12 | /* #define DEBUG */ |
| 13 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 14 | #include <config.h> |
| 15 | #include <common.h> |
wdenk | c3f4d17 | 2004-06-25 23:35:58 +0000 | [diff] [blame] | 16 | #include <command.h> |
wdenk | 7aa7861 | 2003-05-03 15:50:43 +0000 | [diff] [blame] | 17 | #include <watchdog.h> |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 18 | #include <stdarg.h> |
| 19 | #include <lcdvideo.h> |
| 20 | #include <linux/types.h> |
Jean-Christophe PLAGNIOL-VILLARD | 52cb4d4 | 2009-05-16 12:14:54 +0200 | [diff] [blame] | 21 | #include <stdio_dev.h> |
wdenk | 4532cb6 | 2003-04-27 22:52:51 +0000 | [diff] [blame] | 22 | #if defined(CONFIG_POST) |
| 23 | #include <post.h> |
| 24 | #endif |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 25 | #include <lcd.h> |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 26 | |
| 27 | #ifdef CONFIG_LCD |
| 28 | |
| 29 | /************************************************************************/ |
| 30 | /* ** CONFIG STUFF -- should be moved to board config file */ |
| 31 | /************************************************************************/ |
wdenk | 88804d1 | 2005-07-04 00:03:16 +0000 | [diff] [blame] | 32 | #ifndef CONFIG_LCD_INFO |
| 33 | #define CONFIG_LCD_INFO /* Display Logo, (C) and system info */ |
| 34 | #endif |
wdenk | 608c914 | 2003-01-13 23:54:46 +0000 | [diff] [blame] | 35 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 36 | /*----------------------------------------------------------------------*/ |
| 37 | #ifdef CONFIG_KYOCERA_KCS057QV1AJ |
| 38 | /* |
| 39 | * Kyocera KCS057QV1AJ-G23. Passive, color, single scan. |
| 40 | */ |
| 41 | #define LCD_BPP LCD_COLOR4 |
| 42 | |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 43 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 44 | 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 45 | LCD_BPP, 1, 0, 1, 0, 5, 0, 0, 0 |
| 46 | /* wbl, vpw, lcdac, wbf */ |
| 47 | }; |
| 48 | #endif /* CONFIG_KYOCERA_KCS057QV1AJ */ |
| 49 | /*----------------------------------------------------------------------*/ |
| 50 | |
| 51 | /*----------------------------------------------------------------------*/ |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 52 | #ifdef CONFIG_HITACHI_SP19X001_Z1A |
| 53 | /* |
| 54 | * Hitachi SP19X001-. Active, color, single scan. |
| 55 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 56 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 57 | 640, 480, 154, 116, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 58 | LCD_COLOR8, 1, 0, 1, 0, 0, 0, 0, 0 |
| 59 | /* wbl, vpw, lcdac, wbf */ |
| 60 | }; |
| 61 | #endif /* CONFIG_HITACHI_SP19X001_Z1A */ |
| 62 | /*----------------------------------------------------------------------*/ |
| 63 | |
| 64 | /*----------------------------------------------------------------------*/ |
wdenk | fd3103b | 2003-11-25 16:55:19 +0000 | [diff] [blame] | 65 | #ifdef CONFIG_NEC_NL6448AC33 |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 66 | /* |
wdenk | fd3103b | 2003-11-25 16:55:19 +0000 | [diff] [blame] | 67 | * NEC NL6448AC33-18. Active, color, single scan. |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 68 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 69 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 70 | 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 71 | 3, 0, 0, 1, 1, 144, 2, 0, 33 |
| 72 | /* wbl, vpw, lcdac, wbf */ |
| 73 | }; |
wdenk | fd3103b | 2003-11-25 16:55:19 +0000 | [diff] [blame] | 74 | #endif /* CONFIG_NEC_NL6448AC33 */ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 75 | /*----------------------------------------------------------------------*/ |
| 76 | |
wdenk | fd3103b | 2003-11-25 16:55:19 +0000 | [diff] [blame] | 77 | #ifdef CONFIG_NEC_NL6448BC20 |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 78 | /* |
wdenk | fd3103b | 2003-11-25 16:55:19 +0000 | [diff] [blame] | 79 | * NEC NL6448BC20-08. 6.5", 640x480. Active, color, single scan. |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 80 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 81 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 82 | 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 83 | 3, 0, 0, 1, 1, 144, 2, 0, 33 |
| 84 | /* wbl, vpw, lcdac, wbf */ |
| 85 | }; |
wdenk | fd3103b | 2003-11-25 16:55:19 +0000 | [diff] [blame] | 86 | #endif /* CONFIG_NEC_NL6448BC20 */ |
| 87 | /*----------------------------------------------------------------------*/ |
| 88 | |
| 89 | #ifdef CONFIG_NEC_NL6448BC33_54 |
| 90 | /* |
| 91 | * NEC NL6448BC33-54. 10.4", 640x480. Active, color, single scan. |
| 92 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 93 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 94 | 640, 480, 212, 158, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH, |
wdenk | fd3103b | 2003-11-25 16:55:19 +0000 | [diff] [blame] | 95 | 3, 0, 0, 1, 1, 144, 2, 0, 33 |
| 96 | /* wbl, vpw, lcdac, wbf */ |
| 97 | }; |
| 98 | #endif /* CONFIG_NEC_NL6448BC33_54 */ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 99 | /*----------------------------------------------------------------------*/ |
| 100 | |
| 101 | #ifdef CONFIG_SHARP_LQ104V7DS01 |
| 102 | /* |
| 103 | * SHARP LQ104V7DS01. 6.5", 640x480. Active, color, single scan. |
| 104 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 105 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 106 | 640, 480, 132, 99, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_LOW, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 107 | 3, 0, 0, 1, 1, 25, 1, 0, 33 |
| 108 | /* wbl, vpw, lcdac, wbf */ |
| 109 | }; |
| 110 | #endif /* CONFIG_SHARP_LQ104V7DS01 */ |
| 111 | /*----------------------------------------------------------------------*/ |
| 112 | |
| 113 | #ifdef CONFIG_SHARP_16x9 |
| 114 | /* |
| 115 | * Sharp 320x240. Active, color, single scan. It isn't 16x9, and I am |
| 116 | * not sure what it is....... |
| 117 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 118 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 119 | 320, 240, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 120 | 3, 0, 0, 1, 1, 15, 4, 0, 3 |
| 121 | }; |
| 122 | #endif /* CONFIG_SHARP_16x9 */ |
| 123 | /*----------------------------------------------------------------------*/ |
| 124 | |
| 125 | #ifdef CONFIG_SHARP_LQ057Q3DC02 |
| 126 | /* |
| 127 | * Sharp LQ057Q3DC02 display. Active, color, single scan. |
| 128 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 129 | #undef LCD_DF |
wdenk | 4a6fd34 | 2003-04-12 23:38:12 +0000 | [diff] [blame] | 130 | #define LCD_DF 12 |
| 131 | |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 132 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 133 | 320, 240, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 134 | 3, 0, 0, 1, 1, 15, 4, 0, 3 |
| 135 | /* wbl, vpw, lcdac, wbf */ |
| 136 | }; |
wdenk | 88804d1 | 2005-07-04 00:03:16 +0000 | [diff] [blame] | 137 | #define CONFIG_LCD_INFO_BELOW_LOGO |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 138 | #endif /* CONFIG_SHARP_LQ057Q3DC02 */ |
| 139 | /*----------------------------------------------------------------------*/ |
| 140 | |
| 141 | #ifdef CONFIG_SHARP_LQ64D341 |
| 142 | /* |
| 143 | * Sharp LQ64D341 display, 640x480. Active, color, single scan. |
| 144 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 145 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 146 | 640, 480, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 147 | 3, 0, 0, 1, 1, 128, 16, 0, 32 |
| 148 | /* wbl, vpw, lcdac, wbf */ |
| 149 | }; |
| 150 | #endif /* CONFIG_SHARP_LQ64D341 */ |
wdenk | 608c914 | 2003-01-13 23:54:46 +0000 | [diff] [blame] | 151 | |
dzu | 29127b6 | 2003-09-25 22:30:12 +0000 | [diff] [blame] | 152 | #ifdef CONFIG_SHARP_LQ065T9DR51U |
| 153 | /* |
| 154 | * Sharp LQ065T9DR51U display, 400x240. Active, color, single scan. |
| 155 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 156 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 157 | 400, 240, 143, 79, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, |
dzu | 29127b6 | 2003-09-25 22:30:12 +0000 | [diff] [blame] | 158 | 3, 0, 0, 1, 1, 248, 4, 0, 35 |
| 159 | /* wbl, vpw, lcdac, wbf */ |
| 160 | }; |
wdenk | 88804d1 | 2005-07-04 00:03:16 +0000 | [diff] [blame] | 161 | #define CONFIG_LCD_INFO_BELOW_LOGO |
dzu | 29127b6 | 2003-09-25 22:30:12 +0000 | [diff] [blame] | 162 | #endif /* CONFIG_SHARP_LQ065T9DR51U */ |
| 163 | |
wdenk | 608c914 | 2003-01-13 23:54:46 +0000 | [diff] [blame] | 164 | #ifdef CONFIG_SHARP_LQ084V1DG21 |
| 165 | /* |
| 166 | * Sharp LQ084V1DG21 display, 640x480. Active, color, single scan. |
| 167 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 168 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 169 | 640, 480, 171, 129, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_LOW, |
wdenk | 608c914 | 2003-01-13 23:54:46 +0000 | [diff] [blame] | 170 | 3, 0, 0, 1, 1, 160, 3, 0, 48 |
| 171 | /* wbl, vpw, lcdac, wbf */ |
| 172 | }; |
| 173 | #endif /* CONFIG_SHARP_LQ084V1DG21 */ |
| 174 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 175 | /*----------------------------------------------------------------------*/ |
| 176 | |
| 177 | #ifdef CONFIG_HLD1045 |
| 178 | /* |
| 179 | * HLD1045 display, 640x480. Active, color, single scan. |
| 180 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 181 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 182 | 640, 480, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 183 | 3, 0, 0, 1, 1, 160, 3, 0, 48 |
| 184 | /* wbl, vpw, lcdac, wbf */ |
| 185 | }; |
| 186 | #endif /* CONFIG_HLD1045 */ |
| 187 | /*----------------------------------------------------------------------*/ |
| 188 | |
| 189 | #ifdef CONFIG_PRIMEVIEW_V16C6448AC |
| 190 | /* |
| 191 | * Prime View V16C6448AC |
| 192 | */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 193 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 194 | 640, 480, 130, 98, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, CONFIG_SYS_LOW, CONFIG_SYS_HIGH, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 195 | 3, 0, 0, 1, 1, 144, 2, 0, 35 |
| 196 | /* wbl, vpw, lcdac, wbf */ |
| 197 | }; |
| 198 | #endif /* CONFIG_PRIMEVIEW_V16C6448AC */ |
| 199 | |
| 200 | /*----------------------------------------------------------------------*/ |
| 201 | |
| 202 | #ifdef CONFIG_OPTREX_BW |
| 203 | /* |
| 204 | * Optrex CBL50840-2 NF-FW 99 22 M5 |
| 205 | * or |
| 206 | * Hitachi LMG6912RPFC-00T |
| 207 | * or |
| 208 | * Hitachi SP14Q002 |
| 209 | * |
| 210 | * 320x240. Black & white. |
| 211 | */ |
| 212 | #define OPTREX_BPP 0 /* 0 - monochrome, 1 bpp */ |
| 213 | /* 1 - 4 grey levels, 2 bpp */ |
| 214 | /* 2 - 16 grey levels, 4 bpp */ |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 215 | vidinfo_t panel_info = { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 216 | 320, 240, 0, 0, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_HIGH, CONFIG_SYS_LOW, |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 217 | OPTREX_BPP, 0, 0, 0, 0, 0, 0, 0, 0, 4 |
| 218 | }; |
| 219 | #endif /* CONFIG_OPTREX_BW */ |
| 220 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 221 | /************************************************************************/ |
| 222 | /* ----------------- chipset specific functions ----------------------- */ |
| 223 | /************************************************************************/ |
| 224 | |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 225 | /* |
| 226 | * Calculate fb size for VIDEOLFB_ATAG. |
| 227 | */ |
| 228 | ulong calc_fbsize (void) |
| 229 | { |
| 230 | ulong size; |
| 231 | int line_length = (panel_info.vl_col * NBITS (panel_info.vl_bpix)) / 8; |
| 232 | |
| 233 | size = line_length * panel_info.vl_row; |
| 234 | |
| 235 | return size; |
| 236 | } |
| 237 | |
| 238 | void lcd_ctrl_init (void *lcdbase) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 239 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 240 | volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 241 | volatile lcd823_t *lcdp = &immr->im_lcd; |
| 242 | |
| 243 | uint lccrtmp; |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 244 | uint lchcr_hpc_tmp; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 245 | |
| 246 | /* Initialize the LCD control register according to the LCD |
| 247 | * parameters defined. We do everything here but enable |
| 248 | * the controller. |
| 249 | */ |
| 250 | |
| 251 | lccrtmp = LCDBIT (LCCR_BNUM_BIT, |
| 252 | (((panel_info.vl_row * panel_info.vl_col) * (1 << LCD_BPP)) / 128)); |
| 253 | |
| 254 | lccrtmp |= LCDBIT (LCCR_CLKP_BIT, panel_info.vl_clkp) | |
| 255 | LCDBIT (LCCR_OEP_BIT, panel_info.vl_oep) | |
| 256 | LCDBIT (LCCR_HSP_BIT, panel_info.vl_hsp) | |
| 257 | LCDBIT (LCCR_VSP_BIT, panel_info.vl_vsp) | |
| 258 | LCDBIT (LCCR_DP_BIT, panel_info.vl_dp) | |
| 259 | LCDBIT (LCCR_BPIX_BIT, panel_info.vl_bpix) | |
| 260 | LCDBIT (LCCR_LBW_BIT, panel_info.vl_lbw) | |
| 261 | LCDBIT (LCCR_SPLT_BIT, panel_info.vl_splt) | |
| 262 | LCDBIT (LCCR_CLOR_BIT, panel_info.vl_clor) | |
| 263 | LCDBIT (LCCR_TFT_BIT, panel_info.vl_tft); |
| 264 | |
| 265 | #if 0 |
| 266 | lccrtmp |= ((SIU_LEVEL5 / 2) << 12); |
| 267 | lccrtmp |= LCCR_EIEN; |
| 268 | #endif |
| 269 | |
| 270 | lcdp->lcd_lccr = lccrtmp; |
| 271 | lcdp->lcd_lcsr = 0xFF; /* Clear pending interrupts */ |
| 272 | |
| 273 | /* Initialize LCD controller bus priorities. |
| 274 | */ |
| 275 | immr->im_siu_conf.sc_sdcr &= ~0x0f; /* RAID = LAID = 0 */ |
| 276 | |
| 277 | /* set SHFT/CLOCK division factor 4 |
| 278 | * This needs to be set based upon display type and processor |
| 279 | * speed. The TFT displays run about 20 to 30 MHz. |
| 280 | * I was running 64 MHz processor speed. |
| 281 | * The value for this divider must be chosen so the result is |
| 282 | * an integer of the processor speed (i.e., divide by 3 with |
| 283 | * 64 MHz would be bad). |
| 284 | */ |
| 285 | immr->im_clkrst.car_sccr &= ~0x1F; |
| 286 | immr->im_clkrst.car_sccr |= LCD_DF; /* was 8 */ |
| 287 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 288 | /* Enable LCD on port D. |
| 289 | */ |
| 290 | immr->im_ioport.iop_pdpar |= 0x1FFF; |
| 291 | immr->im_ioport.iop_pddir |= 0x1FFF; |
| 292 | |
| 293 | /* Enable LCD_A/B/C on port B. |
| 294 | */ |
| 295 | immr->im_cpm.cp_pbpar |= 0x00005001; |
| 296 | immr->im_cpm.cp_pbdir |= 0x00005001; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 297 | |
| 298 | /* Load the physical address of the linear frame buffer |
| 299 | * into the LCD controller. |
| 300 | * BIG NOTE: This has to be modified to load A and B depending |
| 301 | * upon the split mode of the LCD. |
| 302 | */ |
Jeroen Hofstee | 00a0ca5 | 2013-01-22 10:44:12 +0000 | [diff] [blame] | 303 | lcdp->lcd_lcfaa = (ulong)lcdbase; |
| 304 | lcdp->lcd_lcfba = (ulong)lcdbase; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 305 | |
| 306 | /* MORE HACKS...This must be updated according to 823 manual |
| 307 | * for different panels. |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 308 | * Udi Finkelstein - done - see below: |
| 309 | * Note: You better not try unsupported combinations such as |
| 310 | * 4-bit wide passive dual scan LCD at 4/8 Bit color. |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 311 | */ |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 312 | lchcr_hpc_tmp = |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 313 | (panel_info.vl_col * |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 314 | (panel_info.vl_tft ? 8 : |
| 315 | (((2 - panel_info.vl_lbw) << /* 4 bit=2, 8-bit = 1 */ |
| 316 | /* use << to mult by: single scan = 1, dual scan = 2 */ |
| 317 | panel_info.vl_splt) * |
| 318 | (panel_info.vl_bpix | 1)))) >> 3; /* 2/4 BPP = 1, 8/16 BPP = 3 */ |
| 319 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 320 | lcdp->lcd_lchcr = LCHCR_BO | |
| 321 | LCDBIT (LCHCR_AT_BIT, 4) | |
wdenk | 682011f | 2003-06-03 23:54:09 +0000 | [diff] [blame] | 322 | LCDBIT (LCHCR_HPC_BIT, lchcr_hpc_tmp) | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 323 | panel_info.vl_wbl; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 324 | |
| 325 | lcdp->lcd_lcvcr = LCDBIT (LCVCR_VPW_BIT, panel_info.vl_vpw) | |
| 326 | LCDBIT (LCVCR_LCD_AC_BIT, panel_info.vl_lcdac) | |
| 327 | LCDBIT (LCVCR_VPC_BIT, panel_info.vl_row) | |
| 328 | panel_info.vl_wbf; |
| 329 | |
| 330 | } |
| 331 | |
| 332 | /*----------------------------------------------------------------------*/ |
| 333 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 334 | #if LCD_BPP == LCD_COLOR8 |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 335 | void |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 336 | lcd_setcolreg (ushort regno, ushort red, ushort green, ushort blue) |
| 337 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 338 | volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 339 | volatile cpm8xx_t *cp = &(immr->im_cpm); |
| 340 | unsigned short colreg, *cmap_ptr; |
| 341 | |
| 342 | cmap_ptr = (unsigned short *)&cp->lcd_cmap[regno * 2]; |
| 343 | |
| 344 | colreg = ((red & 0x0F) << 8) | |
| 345 | ((green & 0x0F) << 4) | |
| 346 | (blue & 0x0F) ; |
Nikita Kiryanov | dc6b5b3 | 2014-12-08 17:14:35 +0200 | [diff] [blame] | 347 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 348 | *cmap_ptr = colreg; |
| 349 | |
| 350 | debug ("setcolreg: reg %2d @ %p: R=%02X G=%02X B=%02X => %02X%02X\n", |
| 351 | regno, &(cp->lcd_cmap[regno * 2]), |
| 352 | red, green, blue, |
wdenk | 8bde7f7 | 2003-06-27 21:31:46 +0000 | [diff] [blame] | 353 | cp->lcd_cmap[ regno * 2 ], cp->lcd_cmap[(regno * 2) + 1]); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 354 | } |
| 355 | #endif /* LCD_COLOR8 */ |
| 356 | |
| 357 | /*----------------------------------------------------------------------*/ |
| 358 | |
Nikita Kiryanov | 38b5508 | 2015-02-03 13:32:21 +0200 | [diff] [blame] | 359 | ushort *configuration_get_cmap(void) |
| 360 | { |
| 361 | immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; |
| 362 | cpm8xx_t *cp = &(immr->im_cpm); |
| 363 | return (ushort *)&(cp->lcd_cmap[255 * sizeof(ushort)]); |
| 364 | } |
| 365 | |
Nikita Kiryanov | 27fad01 | 2015-02-03 13:32:23 +0200 | [diff] [blame] | 366 | #if defined(CONFIG_MPC823) |
| 367 | void fb_put_byte(uchar **fb, uchar **from) |
| 368 | { |
| 369 | *(*fb)++ = (255 - *(*from)++); |
| 370 | } |
| 371 | #endif |
| 372 | |
Nikita Kiryanov | 0ee261f | 2015-02-03 13:32:25 +0200 | [diff] [blame] | 373 | #ifdef CONFIG_LCD_LOGO |
| 374 | #include <bmp_logo.h> |
| 375 | void lcd_logo_set_cmap(void) |
| 376 | { |
| 377 | int i; |
| 378 | ushort *cmap; |
| 379 | immap_t *immr = (immap_t *)CONFIG_SYS_IMMR; |
| 380 | cpm8xx_t *cp = &(immr->im_cpm); |
| 381 | cmap = (ushort *)&(cp->lcd_cmap[BMP_LOGO_OFFSET * sizeof(ushort)]); |
| 382 | |
| 383 | for (i = 0; i < BMP_LOGO_COLORS; ++i) |
| 384 | *cmap++ = bmp_logo_palette[i]; |
| 385 | } |
| 386 | #endif |
| 387 | |
wdenk | 8655b6f | 2004-10-09 23:25:58 +0000 | [diff] [blame] | 388 | void lcd_enable (void) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 389 | { |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 390 | volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 391 | volatile lcd823_t *lcdp = &immr->im_lcd; |
| 392 | |
| 393 | /* Enable the LCD panel */ |
| 394 | immr->im_siu_conf.sc_sdcr |= (1 << (31 - 25)); /* LAM = 1 */ |
| 395 | lcdp->lcd_lccr |= LCCR_PON; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 396 | } |
| 397 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 398 | /************************************************************************/ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 399 | |
| 400 | #endif /* CONFIG_LCD */ |