1 /* 2 * Ben NanoNote LCD initialisation, based on uboot-xburst and xburst-tools. 3 * 4 * Copyright (C) 2001-2002 Wolfgang Denk, DENX Software Engineering, <wd@denx.de> 5 * Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk> 6 * 7 * This program is free software; you can redistribute it and/or modify it under 8 * the terms of the GNU General Public License as published by the Free Software 9 * Foundation; either version 3 of the License, or (at your option) any later 10 * version. 11 * 12 * This program is distributed in the hope that it will be useful, but WITHOUT 13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 15 * details. 16 * 17 * You should have received a copy of the GNU General Public License along with 18 * this program. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 21 #ifdef CONFIG_CPU_JZ4730_MINIPC 22 #include "minipc_claa070vc01.h" 23 #include "minipc.h" 24 #else 25 #include "nanonote_gpm940b0.h" 26 #include "nanonote.h" 27 #endif 28 29 #include "xburst_types.h" 30 #include "jzlcd.h" 31 #include "sdram.h" 32 #include "board.h" 33 34 extern vidinfo_t panel_info; 35 36 static void test_pattern(void *lcd_base) 37 { 38 unsigned short v_max = panel_info.vl_row; 39 unsigned short h_max = panel_info.vl_col; 40 unsigned short v, h; 41 u32 *pix = (u32 *)lcd_base; 42 43 /* WARNING: Code silently assumes 32 bit/pixel */ 44 for (v = 0; v < v_max; v += 1) { 45 for (h = 0; h < h_max; h += 1) { 46 *pix++ = ( 47 (((255 * (h_max - h)) / (h_max - 1)) << 16) + 48 ((((255 * h) / (h_max - 1) + (255 * (v_max - v)) / (v_max - 1)) / 2) << 8) + 49 ((255 * v) / (v_max - 1)) 50 ); 51 } 52 } 53 } 54 55 void lcd_clear(void *lcd_base) 56 { 57 test_pattern(lcd_base); 58 } 59 60 /* LCD initialisation. */ 61 62 static void *lcd_base; 63 64 void lcd_init(void) 65 { 66 __lcd_display_pin_init(); 67 __lcd_display_on(); 68 69 lcd_ctrl_init(&lcd_base); 70 lcd_clear(lcd_base); 71 lcd_enable(); 72 }