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);
31 /* Graphics Processor registers (table 6-29 from the data book) */
70 GP_INT_CNTRL, /* 0x78 */
73 #define GP_BLT_STATUS_CE (1 << 4) /* cmd buf empty */
74 #define GP_BLT_STATUS_PB (1 << 0) /* primative busy */
77 /* Display Controller registers (table 6-47 from the data book) */
146 DC_VID_EVEN_Y_ST_OFFSET,
147 DC_VID_EVEN_U_ST_OFFSET,
149 DC_VID_EVEN_V_ST_OFFSET,
150 DC_V_ACTIVE_EVEN_TIMING,
151 DC_V_BLANK_EVEN_TIMING,
152 DC_V_SYNC_EVEN_TIMING, /* 0xec */
155 #define DC_UNLOCK_LOCK 0x00000000
156 #define DC_UNLOCK_UNLOCK 0x00004758 /* magic value */
158 #define DC_GENERAL_CFG_FDTY (1 << 17)
159 #define DC_GENERAL_CFG_DFHPEL_SHIFT (12)
160 #define DC_GENERAL_CFG_DFHPSL_SHIFT (8)
161 #define DC_GENERAL_CFG_VGAE (1 << 7)
162 #define DC_GENERAL_CFG_DECE (1 << 6)
163 #define DC_GENERAL_CFG_CMPE (1 << 5)
164 #define DC_GENERAL_CFG_VIDE (1 << 3)
165 #define DC_GENERAL_CFG_DFLE (1 << 0)
167 #define DC_DISPLAY_CFG_VISL (1 << 27)
168 #define DC_DISPLAY_CFG_PALB (1 << 25)
169 #define DC_DISPLAY_CFG_DCEN (1 << 24)
170 #define DC_DISPLAY_CFG_DISP_MODE_24BPP (1 << 9)
171 #define DC_DISPLAY_CFG_DISP_MODE_16BPP (1 << 8)
172 #define DC_DISPLAY_CFG_DISP_MODE_8BPP (0)
173 #define DC_DISPLAY_CFG_TRUP (1 << 6)
174 #define DC_DISPLAY_CFG_VDEN (1 << 4)
175 #define DC_DISPLAY_CFG_GDEN (1 << 3)
176 #define DC_DISPLAY_CFG_TGEN (1 << 0)
178 #define DC_DV_TOP_DV_TOP_EN (1 << 0)
180 #define DC_DV_CTL_DV_LINE_SIZE ((1 << 10) | (1 << 11))
181 #define DC_DV_CTL_DV_LINE_SIZE_1K (0)
182 #define DC_DV_CTL_DV_LINE_SIZE_2K (1 << 10)
183 #define DC_DV_CTL_DV_LINE_SIZE_4K (1 << 11)
184 #define DC_DV_CTL_DV_LINE_SIZE_8K ((1 << 10) | (1 << 11))
186 #define DC_CLR_KEY_CLR_KEY_EN (1 << 24)
188 #define DC_IRQ_VIP_VSYNC_IRQ_STATUS (1 << 21) /* undocumented? */
189 #define DC_IRQ_STATUS (1 << 20) /* undocumented? */
190 #define DC_IRQ_VIP_VSYNC_LOSS_IRQ_MASK (1 << 1)
191 #define DC_IRQ_MASK (1 << 0)
193 #define DC_GENLK_CTL_FLICK_SEL_MASK (0x0F << 28)
194 #define DC_GENLK_CTL_ALPHA_FLICK_EN (1 << 25)
195 #define DC_GENLK_CTL_FLICK_EN (1 << 24)
196 #define DC_GENLK_CTL_GENLK_EN (1 << 18)
200 * Video Processor registers (table 6-71).
201 * There is space for 64 bit values, but we never use more than the
202 * lower 32 bits. The actual register save/restore code only bothers
203 * to restore those 32 bits.
272 #define VP_VCFG_VID_EN (1 << 0)
274 #define VP_DCFG_GV_GAM (1 << 21)
275 #define VP_DCFG_PWR_SEQ_DELAY ((1 << 17) | (1 << 18) | (1 << 19))
276 #define VP_DCFG_PWR_SEQ_DELAY_DEFAULT (1 << 19) /* undocumented */
277 #define VP_DCFG_CRT_SYNC_SKW ((1 << 14) | (1 << 15) | (1 << 16))
278 #define VP_DCFG_CRT_SYNC_SKW_DEFAULT (1 << 16)
279 #define VP_DCFG_CRT_VSYNC_POL (1 << 9)
280 #define VP_DCFG_CRT_HSYNC_POL (1 << 8)
281 #define VP_DCFG_DAC_BL_EN (1 << 3)
282 #define VP_DCFG_VSYNC_EN (1 << 2)
283 #define VP_DCFG_HSYNC_EN (1 << 1)
284 #define VP_DCFG_CRT_EN (1 << 0)
286 #define VP_MISC_APWRDN (1 << 11)
287 #define VP_MISC_DACPWRDN (1 << 10)
288 #define VP_MISC_BYP_BOTH (1 << 0)
292 * Flat Panel registers (table 6-71).
293 * Also 64 bit registers; see above note about 32-bit handling.
296 /* we're actually in the VP register space, starting at address 0x400 */
297 #define VP_FP_START 0x400
319 #define FP_PT2_SCRC (1 << 27) /* shfclk free */
321 #define FP_PM_P (1 << 24) /* panel power ctl */
323 #define FP_DFC_BC ((1 << 4) | (1 << 5) | (1 << 6))
326 /* register access functions */
328 static inline uint32_t read_gp(struct lxfb_par *par, int reg)
330 return readl(par->gp_regs + 4*reg);
333 static inline void write_gp(struct lxfb_par *par, int reg, uint32_t val)
335 writel(val, par->gp_regs + 4*reg);
338 static inline uint32_t read_dc(struct lxfb_par *par, int reg)
340 return readl(par->dc_regs + 4*reg);
343 static inline void write_dc(struct lxfb_par *par, int reg, uint32_t val)
345 writel(val, par->dc_regs + 4*reg);
348 static inline uint32_t read_vp(struct lxfb_par *par, int reg)
350 return readl(par->vp_regs + 8*reg);
353 static inline void write_vp(struct lxfb_par *par, int reg, uint32_t val)
355 writel(val, par->vp_regs + 8*reg);
358 static inline uint32_t read_fp(struct lxfb_par *par, int reg)
360 return readl(par->vp_regs + 8*reg + VP_FP_START);
363 static inline void write_fp(struct lxfb_par *par, int reg, uint32_t val)
365 writel(val, par->vp_regs + 8*reg + VP_FP_START);
369 /* MSRs are defined in asm/geode.h; their bitfields are here */
371 #define MSR_GLCP_DOTPLL_LOCK (1 << 25) /* r/o */
372 #define MSR_GLCP_DOTPLL_HALFPIX (1 << 24)
373 #define MSR_GLCP_DOTPLL_BYPASS (1 << 15)
374 #define MSR_GLCP_DOTPLL_DOTRESET (1 << 0)
376 /* note: this is actually the VP's GLD_MSR_CONFIG */
377 #define MSR_LX_GLD_MSR_CONFIG_FMT ((1 << 3) | (1 << 4) | (1 << 5))
378 #define MSR_LX_GLD_MSR_CONFIG_FMT_FP (1 << 3)
379 #define MSR_LX_GLD_MSR_CONFIG_FMT_CRT (0)
380 #define MSR_LX_GLD_MSR_CONFIG_FPC (1 << 15) /* FP *and* CRT */
382 #define MSR_LX_MSR_PADSEL_TFT_SEL_LOW 0xDFFFFFFF /* ??? */
383 #define MSR_LX_MSR_PADSEL_TFT_SEL_HIGH 0x0000003F /* ??? */
385 #define MSR_LX_SPARE_MSR_DIS_CFIFO_HGO (1 << 11) /* undocumented */
386 #define MSR_LX_SPARE_MSR_VFIFO_ARB_SEL (1 << 10) /* undocumented */
387 #define MSR_LX_SPARE_MSR_WM_LPEN_OVRD (1 << 9) /* undocumented */
388 #define MSR_LX_SPARE_MSR_LOAD_WM_LPEN_M (1 << 8) /* undocumented */
389 #define MSR_LX_SPARE_MSR_DIS_INIT_V_PRI (1 << 7) /* undocumented */
390 #define MSR_LX_SPARE_MSR_DIS_VIFO_WM (1 << 6)
391 #define MSR_LX_SPARE_MSR_DIS_CWD_CHECK (1 << 5) /* undocumented */
392 #define MSR_LX_SPARE_MSR_PIX8_PAN_FIX (1 << 4) /* undocumented */
393 #define MSR_LX_SPARE_MSR_FIRST_REQ_MASK (1 << 1) /* undocumented */