2 * JzRISC lcd controller
4 * xiangfu liu <xiangfu.z@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of
9 * the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 * change u-boot macro to celinux macro
30 #if defined(CONFIG_JZ4740)
31 #define CONFIG_MIPS_JZ4740 1
35 #if defined(CONFIG_NANONOTE)
36 #define CONFIG_MIPS_JZ4740_PI 1
39 #define mdelay(n) udelay((n)*1000)
42 * change u-boot macro to celinux macro
45 #define NR_PALETTE 256
48 unsigned int next_desc
; /* LCDDAx */
49 unsigned int databuf
; /* LCDSAx */
50 unsigned int frame_id
; /* LCDFIDx */
51 unsigned int cmd
; /* LCDCMDx */
54 #define MODE_MASK 0x0f
55 #define MODE_TFT_GEN 0x00
56 #define MODE_TFT_SHARP 0x01
57 #define MODE_TFT_CASIO 0x02
58 #define MODE_TFT_SAMSUNG 0x03
59 #define MODE_CCIR656_NONINT 0x04
60 #define MODE_CCIR656_INT 0x05
61 #define MODE_STN_COLOR_SINGLE 0x08
62 #define MODE_STN_MONO_SINGLE 0x09
63 #define MODE_STN_COLOR_DUAL 0x0a
64 #define MODE_STN_MONO_DUAL 0x0b
65 #define MODE_8BIT_SERIAL_TFT 0x0c
67 #define MODE_TFT_18BIT (1<<7)
69 #define STN_DAT_PIN1 (0x00 << 4)
70 #define STN_DAT_PIN2 (0x01 << 4)
71 #define STN_DAT_PIN4 (0x02 << 4)
72 #define STN_DAT_PIN8 (0x03 << 4)
73 #define STN_DAT_PINMASK STN_DAT_PIN8
75 #define STFT_PSHI (1 << 15)
76 #define STFT_CLSHI (1 << 14)
77 #define STFT_SPLHI (1 << 13)
78 #define STFT_REVHI (1 << 12)
80 #define SYNC_MASTER (0 << 16)
81 #define SYNC_SLAVE (1 << 16)
86 #define PCLK_P (0 << 10)
87 #define PCLK_N (1 << 10)
89 #define HSYNC_P (0 << 11)
90 #define HSYNC_N (1 << 11)
92 #define VSYNC_P (0 << 8)
93 #define VSYNC_N (1 << 8)
95 #define DATA_NORMAL (0 << 17)
96 #define DATA_INVERSE (1 << 17)
99 /* Jz LCDFB supported I/O controls. */
100 #define FBIOSETBACKLIGHT 0x4688
101 #define FBIODISPON 0x4689
102 #define FBIODISPOFF 0x468a
103 #define FBIORESET 0x468b
104 #define FBIOPRINT_REG 0x468c
107 * LCD panel specific definition
110 #if defined(CONFIG_JZLCD_FOXCONN_PT035TN01) || defined(CONFIG_JZLCD_INNOLUX_PT035TN01_SERIAL)
112 #if defined(CONFIG_JZLCD_FOXCONN_PT035TN01) /* board pmp */
113 #define MODE 0xcd /* 24bit parellel RGB */
115 #if defined(CONFIG_JZLCD_INNOLUX_PT035TN01_SERIAL)
116 #define MODE 0xc9 /* 8bit serial RGB */
119 #if defined(CONFIG_MIPS_JZ4740_PI) /* board pavo */
120 #define SPEN (32*2+21) /*LCD_SPL */
121 #define SPCK (32*2+23) /*LCD_CLS */
122 #define SPDA (32*2+22) /*LCD_D12 */
123 #define LCD_RET (32*3+27)
125 #error "cpu/misp/Jzlcd.h, please define SPI pins on your board."
128 #define __spi_write_reg1(reg, val) \
131 unsigned short value;\
136 __gpio_set_pin(SPEN);\
137 __gpio_set_pin(SPCK);\
138 __gpio_clear_pin(SPDA);\
139 __gpio_clear_pin(SPEN);\
141 value=((a<<8)|(b&0xFF));\
142 for(no=0;no<16;no++)\
144 __gpio_clear_pin(SPCK);\
145 if((value&0x8000)==0x8000)\
146 __gpio_set_pin(SPDA);\
148 __gpio_clear_pin(SPDA);\
150 __gpio_set_pin(SPCK);\
154 __gpio_set_pin(SPEN);\
158 #define __spi_write_reg(reg, val) \
160 __spi_write_reg1((reg<<2|2), val);\
165 #define __lcd_special_pin_init() \
167 __gpio_as_output(SPEN); /* use SPDA */\
168 __gpio_as_output(SPCK); /* use SPCK */\
169 __gpio_as_output(SPDA); /* use SPDA */\
170 __gpio_as_output(LCD_RET);\
173 #if defined(CONFIG_NANONOTE)
174 #define __lcd_special_on() \
177 __spi_write_reg1(0x05, 0x16); \
178 __spi_write_reg1(0x04, 0x0b); \
179 __spi_write_reg1(0x07, 0x8d); \
180 __spi_write_reg1(0x01, 0x95); \
181 __spi_write_reg1(0x08, 0xc0); \
182 __spi_write_reg1(0x03, 0x40); \
183 __spi_write_reg1(0x06, 0x15); \
184 __spi_write_reg1(0x05, 0xd7); \
185 } while (0) /* reg 0x0a is control the display direction:DB0->horizontal level DB1->vertical level */
187 #define __lcd_special_off() \
189 __spi_write_reg1(0x05, 0x5e); \
191 #endif /* CONFIG_NANONOTE */
192 #endif /* CONFIG_JZLCD_FOXCONN_PT035TN01 or CONFIG_JZLCD_INNOLUX_PT035TN01_SERIAL */
194 #ifndef __lcd_special_pin_init
195 #define __lcd_special_pin_init()
197 #ifndef __lcd_special_on
198 #define __lcd_special_on()
200 #ifndef __lcd_special_off
201 #define __lcd_special_off()
206 * Platform specific definition
209 #if defined(CONFIG_MIPS_JZ4740_PI)
211 /* 100 level: 0,1,...,100 */
212 #define __lcd_set_backlight_level(n)\
214 __gpio_as_output(32*3+27); \
215 __gpio_set_pin(32*3+27); \
218 #define __lcd_close_backlight() \
220 __gpio_as_output(GPIO_PWM); \
221 __gpio_clear_pin(GPIO_PWM); \
224 #define __lcd_display_pin_init() \
226 __gpio_as_output(GPIO_DISP_OFF_N); \
228 __lcd_special_pin_init(); \
230 /* __lcd_set_backlight_level(100); \*/
231 #define __lcd_display_on() \
233 __gpio_set_pin(GPIO_DISP_OFF_N); \
234 __lcd_special_on(); \
237 #define __lcd_display_off() \
239 __lcd_special_off(); \
240 __gpio_clear_pin(GPIO_DISP_OFF_N); \
243 #endif /* CONFIG_MIPS_JZ4740_PI) */
245 /*****************************************************************************
246 * LCD display pin dummy macros
247 *****************************************************************************/
248 #ifndef __lcd_display_pin_init
249 #define __lcd_display_pin_init()
251 #ifndef __lcd_display_on
252 #define __lcd_display_on()
254 #ifndef __lcd_display_off
255 #define __lcd_display_off()
257 #ifndef __lcd_set_backlight_level
258 #define __lcd_set_backlight_level(n)
This page took 0.051074 seconds and 5 git commands to generate.