6 #define OUTPUT_CRT 0x01
7 #define OUTPUT_PANEL 0x02
12 void __iomem *gp_regs;
13 void __iomem *dc_regs;
14 void __iomem *vp_regs;
17 static inline unsigned int lx_get_pitch(unsigned int xres, int bpp)
19 return (((xres * (bpp >> 3)) + 7) & ~7);
22 void lx_set_mode(struct fb_info *);
23 void lx_get_gamma(struct fb_info *, unsigned int *, int);
24 void lx_set_gamma(struct fb_info *, unsigned int *, int);
25 unsigned int lx_framebuffer_size(void);
26 int lx_blank_display(struct fb_info *, int);
27 void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int,
28 unsigned int, unsigned int);
32 #define GLCP_DOTPLL_RESET (1 << 0)
33 #define GLCP_DOTPLL_BYPASS (1 << 15)
34 #define GLCP_DOTPLL_HALFPIX (1 << 24)
35 #define GLCP_DOTPLL_LOCK (1 << 25)
37 #define DF_CONFIG_OUTPUT_MASK 0x38
38 #define DF_OUTPUT_PANEL 0x08
39 #define DF_OUTPUT_CRT 0x00
40 #define DF_SIMULTANEOUS_CRT_AND_FP (1 << 15)
42 #define DF_DEFAULT_TFT_PAD_SEL_LOW 0xDFFFFFFF
43 #define DF_DEFAULT_TFT_PAD_SEL_HIGH 0x0000003F
45 #define DC_SPARE_DISABLE_CFIFO_HGO 0x00000800
46 #define DC_SPARE_VFIFO_ARB_SELECT 0x00000400
47 #define DC_SPARE_WM_LPEN_OVRD 0x00000200
48 #define DC_SPARE_LOAD_WM_LPEN_MASK 0x00000100
49 #define DC_SPARE_DISABLE_INIT_VID_PRI 0x00000080
50 #define DC_SPARE_DISABLE_VFIFO_WM 0x00000040
51 #define DC_SPARE_DISABLE_CWD_CHECK 0x00000020
52 #define DC_SPARE_PIX8_PAN_FIX 0x00000010
53 #define DC_SPARE_FIRST_REQ_MASK 0x00000002
56 /* Graphics Processor registers (table 6-29 from the data book) */
95 GP_INT_CNTRL, /* 0x78 */
98 #define GP_BLT_STATUS_CE (1 << 4) /* cmd buf empty */
99 #define GP_BLT_STATUS_PB (1 << 0) /* primative busy */
102 /* Display Controller registers (table 6-47 from the data book) */
171 DC_VID_EVEN_Y_ST_OFFSET,
172 DC_VID_EVEN_U_ST_OFFSET,
174 DC_VID_EVEN_V_ST_OFFSET,
175 DC_V_ACTIVE_EVEN_TIMING,
176 DC_V_BLANK_EVEN_TIMING,
177 DC_V_SYNC_EVEN_TIMING, /* 0xec */
180 #define DC_UNLOCK_LOCK 0x00000000
181 #define DC_UNLOCK_UNLOCK 0x00004758 /* magic value */
183 #define DC_GENERAL_CFG_FDTY (1 << 17)
184 #define DC_GENERAL_CFG_DFHPEL_SHIFT (12)
185 #define DC_GENERAL_CFG_DFHPSL_SHIFT (8)
186 #define DC_GENERAL_CFG_VGAE (1 << 7)
187 #define DC_GENERAL_CFG_DECE (1 << 6)
188 #define DC_GENERAL_CFG_CMPE (1 << 5)
189 #define DC_GENERAL_CFG_VIDE (1 << 3)
190 #define DC_GENERAL_CFG_DFLE (1 << 0)
192 #define DC_DISPLAY_CFG_VISL (1 << 27)
193 #define DC_DISPLAY_CFG_PALB (1 << 25)
194 #define DC_DISPLAY_CFG_DCEN (1 << 24)
195 #define DC_DISPLAY_CFG_DISP_MODE_24BPP (1 << 9)
196 #define DC_DISPLAY_CFG_DISP_MODE_16BPP (1 << 8)
197 #define DC_DISPLAY_CFG_DISP_MODE_8BPP (0)
198 #define DC_DISPLAY_CFG_TRUP (1 << 6)
199 #define DC_DISPLAY_CFG_VDEN (1 << 4)
200 #define DC_DISPLAY_CFG_GDEN (1 << 3)
201 #define DC_DISPLAY_CFG_TGEN (1 << 0)
203 #define DC_DV_TOP_DV_TOP_EN (1 << 0)
205 #define DC_DV_CTL_DV_LINE_SIZE ((1 << 10) | (1 << 11))
206 #define DC_DV_CTL_DV_LINE_SIZE_1K (0)
207 #define DC_DV_CTL_DV_LINE_SIZE_2K (1 << 10)
208 #define DC_DV_CTL_DV_LINE_SIZE_4K (1 << 11)
209 #define DC_DV_CTL_DV_LINE_SIZE_8K ((1 << 10) | (1 << 11))
211 #define DC_CLR_KEY_CLR_KEY_EN (1 << 24)
213 #define DC_IRQ_VIP_VSYNC_IRQ_STATUS (1 << 21) /* undocumented? */
214 #define DC_IRQ_STATUS (1 << 20) /* undocumented? */
215 #define DC_IRQ_VIP_VSYNC_LOSS_IRQ_MASK (1 << 1)
216 #define DC_IRQ_MASK (1 << 0)
218 #define DC_GENLK_CTL_FLICK_SEL_MASK (0x0F << 28)
219 #define DC_GENLK_CTL_ALPHA_FLICK_EN (1 << 25)
220 #define DC_GENLK_CTL_FLICK_EN (1 << 24)
221 #define DC_GENLK_CTL_GENLK_EN (1 << 18)
225 * Video Processor registers (table 6-71).
226 * There is space for 64 bit values, but we never use more than the
227 * lower 32 bits. The actual register save/restore code only bothers
228 * to restore those 32 bits.
297 #define VP_VCFG_VID_EN (1 << 0)
299 #define VP_DCFG_GV_GAM (1 << 21)
300 #define VP_DCFG_PWR_SEQ_DELAY ((1 << 17) | (1 << 18) | (1 << 19))
301 #define VP_DCFG_PWR_SEQ_DELAY_DEFAULT (1 << 19) /* undocumented */
302 #define VP_DCFG_CRT_SYNC_SKW ((1 << 14) | (1 << 15) | (1 << 16))
303 #define VP_DCFG_CRT_SYNC_SKW_DEFAULT (1 << 16)
304 #define VP_DCFG_CRT_VSYNC_POL (1 << 9)
305 #define VP_DCFG_CRT_HSYNC_POL (1 << 8)
306 #define VP_DCFG_DAC_BL_EN (1 << 3)
307 #define VP_DCFG_VSYNC_EN (1 << 2)
308 #define VP_DCFG_HSYNC_EN (1 << 1)
309 #define VP_DCFG_CRT_EN (1 << 0)
311 #define VP_MISC_APWRDN (1 << 11)
312 #define VP_MISC_DACPWRDN (1 << 10)
313 #define VP_MISC_BYP_BOTH (1 << 0)
317 * Flat Panel registers (table 6-71).
318 * Also 64 bit registers; see above note about 32-bit handling.
321 /* we're actually in the VP register space, starting at address 0x400 */
322 #define VP_FP_START 0x400
344 #define FP_PT2_SCRC (1 << 27) /* shfclk free */
346 #define FP_PM_P (1 << 24) /* panel power ctl */
348 #define FP_DFC_BC ((1 << 4) | (1 << 5) | (1 << 6))
351 /* register access functions */
353 static inline uint32_t read_gp(struct lxfb_par *par, int reg)
355 return readl(par->gp_regs + 4*reg);
358 static inline void write_gp(struct lxfb_par *par, int reg, uint32_t val)
360 writel(val, par->gp_regs + 4*reg);
363 static inline uint32_t read_dc(struct lxfb_par *par, int reg)
365 return readl(par->dc_regs + 4*reg);
368 static inline void write_dc(struct lxfb_par *par, int reg, uint32_t val)
370 writel(val, par->dc_regs + 4*reg);
373 static inline uint32_t read_vp(struct lxfb_par *par, int reg)
375 return readl(par->vp_regs + 8*reg);
378 static inline void write_vp(struct lxfb_par *par, int reg, uint32_t val)
380 writel(val, par->vp_regs + 8*reg);
383 static inline uint32_t read_fp(struct lxfb_par *par, int reg)
385 return readl(par->vp_regs + 8*reg + VP_FP_START);
388 static inline void write_fp(struct lxfb_par *par, int reg, uint32_t val)
390 writel(val, par->vp_regs + 8*reg + VP_FP_START);