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