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