Date:2010-10-27 12:00:57 (9 years 8 months ago)
Author:Xiangfu Liu
Commit:3b8d5515c17c131e1a6859fe2e4b77e2d70093eb
Message:[uboot-xburst] cleanup the lcm init - cleanup code style - remove useless code - make the color correct in u-boot

Signed-off-by: Xiangfu Liu <xiangfu@sharism.cc>
Files: package/uboot-xburst/files/arch/mips/include/asm/jz4740.h (1 diff)
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.c (4 diffs)
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.h (2 diffs)
package/uboot-xburst/files/include/configs/nanonote.h (2 diffs)

Change Details

package/uboot-xburst/files/arch/mips/include/asm/jz4740.h
193193#define RTC_HWRSR_PIN (1 << 1) /* Wakeup pin status bit */
194194#define RTC_HWRSR_ALM (1 << 0) /* RTC alarm status bit */
195195
196
197196/*************************************************************************
198197 * CPM (Clock reset and Power control Management)
199198 *************************************************************************/
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.c
11/*
22 * JzRISC lcd controller
33 *
4 * xiangfu liu <xiangfu.z@gmail.com>
4 * Xiangfu Liu <xiangfu@sharism.cc>
55 *
66 * This program is free software; you can redistribute it and/or
77 * modify it under the terms of the GNU General Public License as
...... 
5656};
5757
5858int lcd_line_length;
59
6059int lcd_color_fg;
6160int lcd_color_bg;
6261/*
...... 
7473
7574static int jz_lcd_init_mem(void *lcdbase, vidinfo_t *vid);
7675static void jz_lcd_desc_init(vidinfo_t *vid);
77static int jz_lcd_hw_init( vidinfo_t *vid );
78extern int flush_cache_all(void);
76static int jz_lcd_hw_init(vidinfo_t *vid);
77extern int flush_cache_all(void);
7978
8079void lcd_ctrl_init (void *lcdbase)
8180{
...... 
9190/*
9291 * Before enabled lcd controller, lcd registers should be configured correctly.
9392 */
94
9593void lcd_enable (void)
9694{
9795    REG_LCD_CTRL &= ~(1<<4); /* LCDCTRL.DIS */
package/uboot-xburst/files/drivers/video/nanonote_gpm940b0.h
11/*
22 * JzRISC lcd controller
33 *
4 * xiangfu liu <xiangfu.z@gmail.com>
4 * Xiangfu Liu <xiangfu@sharism.cc>
55 *
66 * This program is free software; you can redistribute it and/or
77 * modify it under the terms of the GNU General Public License as
...... 
8686/*
8787 * LCD panel specific definition
8888 */
89#define MODE 0xc9 /* 8bit serial RGB */
90#define SPEN (32*2+21) /*LCD_SPL */
91#define SPCK (32*2+23) /*LCD_CLS */
92#define SPDA (32*2+22) /*LCD_D12 */
93#define LCD_RET (32*3+27)
94
95#define __spi_write_reg1(reg, val) \
96do { \
97    unsigned char no;\
98    unsigned short value;\
99    unsigned char a=0;\
100    unsigned char b=0;\
101    a=reg;\
102    b=val;\
103    __gpio_set_pin(SPEN);\
104    __gpio_set_pin(SPCK);\
105    __gpio_clear_pin(SPDA);\
106    __gpio_clear_pin(SPEN);\
107    udelay(25);\
108    value=((a<<8)|(b&0xFF));\
109    for(no=0;no<16;no++)\
110    {\
111        __gpio_clear_pin(SPCK);\
112        if((value&0x8000)==0x8000)\
113        __gpio_set_pin(SPDA);\
114        else\
115        __gpio_clear_pin(SPDA);\
116        udelay(25);\
117        __gpio_set_pin(SPCK);\
118        value=(value<<1); \
119        udelay(25);\
120     }\
121    __gpio_set_pin(SPEN);\
122    udelay(100);\
89#define MODE (0xc9) /* 8bit serial RGB */
90
91#define __spi_write_reg1(reg, val) \
92do { \
93    unsigned char no; \
94    unsigned short value; \
95    unsigned char a=reg; \
96    unsigned char b=val; \
97    __gpio_set_pin(SPEN); \
98    __gpio_set_pin(SPCK); \
99    __gpio_clear_pin(SPDA); \
100    __gpio_clear_pin(SPEN); \
101    udelay(25); \
102    value=((a<<8)|(b&0xFF)); \
103    for(no=0;no<16;no++) \
104    { \
105        __gpio_clear_pin(SPCK); \
106        if((value&0x8000)==0x8000) \
107            __gpio_set_pin(SPDA); \
108        else \
109            __gpio_clear_pin(SPDA); \
110        udelay(25); \
111        __gpio_set_pin(SPCK); \
112        value=(value<<1); \
113        udelay(25); \
114    } \
115    __gpio_set_pin(SPEN); \
116    udelay(100); \
123117} while (0)
124118
125#define __spi_write_reg(reg, val) \
126do {\
127    __spi_write_reg1((reg<<2|2), val);\
128    udelay(100); \
129}while(0)
130
131#define __lcd_special_pin_init() \
132do { \
133    __gpio_as_output(SPEN); /* use SPDA */\
134    __gpio_as_output(SPCK); /* use SPCK */\
135    __gpio_as_output(SPDA); /* use SPDA */\
136    __gpio_as_output(LCD_RET);\
119#define __lcd_display_pin_init() \
120do { \
121    __cpm_start_tcu(); \
122    __gpio_as_output(SPEN); /* use SPDA */ \
123    __gpio_as_output(SPCK); /* use SPCK */ \
124    __gpio_as_output(SPDA); /* use SPDA */ \
137125} while (0)
138126
139#define __lcd_special_on() \
140do { \
141    __spi_write_reg1(0x05, 0x1e); \
142    udelay(50);\
143    __spi_write_reg1(0x05, 0x5d); \
144    __spi_write_reg1(0x0B, 0x81); \
145    __spi_write_reg1(0x01, 0x95); \
146    __spi_write_reg1(0x00, 0x07); \
147    __spi_write_reg1(0x06, 0x15); \
148    __spi_write_reg1(0x07, 0x8d); \
149    __spi_write_reg1(0x04, 0x0f); \
150    __spi_write_reg1(0x0d, 0x3d); \
151    __spi_write_reg1(0x10, 0x42); \
152    __spi_write_reg1(0x11, 0x3a); \
153    __spi_write_reg1(0x05, 0x5f); \
127#define __lcd_display_on() \
128do { \
129    __spi_write_reg1(0x05, 0x1e); \
130    __spi_write_reg1(0x05, 0xc6); \
131    __spi_write_reg1(0x07, 0x8d); \
132    __spi_write_reg1(0x13, 0x01); \
133    __spi_write_reg1(0x05, 0xc7); \
154134} while (0)
155135
156#define __lcd_special_off() \
157do { \
158    __spi_write_reg1(0x05, 0x5e); \
136#define __lcd_display_off() \
137do { \
138    __spi_write_reg1(0x05, 0x5e); \
159139} while (0)
160140
161#define __lcd_set_backlight_level(n)\
162do { \
163    __gpio_as_output(LCD_RET); \
164    __gpio_set_pin(LCD_RET); \
165} while (0)
166
167#if defined(CONFIG_SAKC)
168#define __lcd_close_backlight() \
169do { \
170    __gpio_as_output(GPIO_PWM); \
171    __gpio_clear_pin(GPIO_PWM); \
172} while (0)
173#endif
174
175#if defined(CONFIG_SAKC)
176#define __lcd_display_pin_init() \
177do { \
178    __cpm_start_tcu(); \
179    __lcd_special_pin_init(); \
180} while (0)
181
182#define __lcd_display_on() \
183do { \
184    __lcd_special_on(); \
185} while (0)
186
187#define __lcd_display_off() \
188do { \
189    __lcd_special_off(); \
190} while (0)
191#else
192#define __lcd_display_pin_init() \
193do { \
194    __cpm_start_tcu(); \
195    __lcd_special_pin_init(); \
196} while (0)
197
198#define __lcd_display_on() \
199do { \
200    __gpio_set_pin(GPIO_DISP_OFF_N); \
201    __lcd_special_on(); \
202} while (0)
203
204#define __lcd_display_off() \
205do { \
206    __lcd_special_off(); \
207    __gpio_clear_pin(GPIO_DISP_OFF_N); \
208} while (0)
209#endif
210
211141#endif /* __QI_LB60_GPM940B0_H__ */
package/uboot-xburst/files/include/configs/nanonote.h
178178 * GPIO definition
179179 */
180180#define GPIO_LCD_CS (2 * 32 + 21)
181#define GPIO_DISP_OFF_N (3 * 32 + 21)
182#define GPIO_PWM (3 * 32 + 27)
183
184181#define GPIO_AMP_EN (3 * 32 + 4)
185182
186183#define GPIO_SDPW_EN (3 * 32 + 2)
187184#define GPIO_SD_DETECT (3 * 32 + 0)
188185
189#define GPIO_USB_DETECT (3 * 32 + 27)
190#define GPIO_BUZZ_PWM (3 * 32 + 28)
186#define GPIO_BUZZ_PWM (3 * 32 + 27)
187#define GPIO_USB_DETECT (3 * 32 + 28)
191188
192189#define GPIO_AUDIO_POP (1 * 32 + 29)
193190#define GPIO_COB_TEST (1 * 32 + 30)
...... 
199196#define GPIO_SD_CD_N GPIO_SD_DETECT /* SD Card insert detect */
200197#define GPIO_SD_VCC_EN_N GPIO_SDPW_EN /* SD Card Power Enable */
201198
199#define SPEN GPIO_LCD_CS /* LCDCS :Serial command enable */
200#define SPDA (2 * 32 + 22) /* LCDSCL:Serial command clock input */
201#define SPCK (2 * 32 + 23) /* LCDSDA:Serial command data input */
202202#endif /* __CONFIG_NANONOTE_H */

Archive Download the corresponding diff file



interactive