2 * Copyright (C) 2008 Andres Salomon <dilinger@debian.org>
4 * Geode GX2 header information
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
18 void __iomem *dc_regs;
19 void __iomem *vid_regs;
22 unsigned int gx_frame_buffer_size(void);
23 int gx_line_delta(int xres, int bpp);
24 void gx_set_mode(struct fb_info *info);
25 void gx_set_hw_palette_reg(struct fb_info *info, unsigned regno,
26 unsigned red, unsigned green, unsigned blue);
28 void gx_set_dclk_frequency(struct fb_info *info);
29 void gx_configure_display(struct fb_info *info);
30 int gx_blank_display(struct fb_info *info, int blank_mode);
33 /* Display Controller registers (table 6-38 from the data book) */
81 #define DC_UNLOCK_LOCK 0x00000000
82 #define DC_UNLOCK_UNLOCK 0x00004758 /* magic value */
84 #define DC_GENERAL_CFG_YUVM (1 << 20)
85 #define DC_GENERAL_CFG_VDSE (1 << 19)
86 #define DC_GENERAL_CFG_DFHPEL_SHIFT 12
87 #define DC_GENERAL_CFG_DFHPSL_SHIFT 8
88 #define DC_GENERAL_CFG_DECE (1 << 6)
89 #define DC_GENERAL_CFG_CMPE (1 << 5)
90 #define DC_GENERAL_CFG_VIDE (1 << 3)
91 #define DC_GENERAL_CFG_ICNE (1 << 2)
92 #define DC_GENERAL_CFG_CURE (1 << 1)
93 #define DC_GENERAL_CFG_DFLE (1 << 0)
95 #define DC_DISPLAY_CFG_A20M (1 << 31)
96 #define DC_DISPLAY_CFG_A18M (1 << 30)
97 #define DC_DISPLAY_CFG_PALB (1 << 25)
98 #define DC_DISPLAY_CFG_DISP_MODE_24BPP (1 << 9)
99 #define DC_DISPLAY_CFG_DISP_MODE_16BPP (1 << 8)
100 #define DC_DISPLAY_CFG_DISP_MODE_8BPP (0)
101 #define DC_DISPLAY_CFG_VDEN (1 << 4)
102 #define DC_DISPLAY_CFG_GDEN (1 << 3)
103 #define DC_DISPLAY_CFG_TGEN (1 << 0)
107 * Video Processor registers (table 6-54).
108 * There is space for 64 bit values, but we never use more than the
109 * lower 32 bits. The actual register save/restore code only bothers
110 * to restore those 32 bits.
173 #define VP_VCFG_VID_EN (1 << 0)
175 #define VP_DCFG_DAC_VREF (1 << 26)
176 #define VP_DCFG_GV_GAM (1 << 21)
177 #define VP_DCFG_VG_CK (1 << 20)
178 #define VP_DCFG_CRT_SYNC_SKW_DEFAULT (1 << 16)
179 #define VP_DCFG_CRT_SYNC_SKW ((1 << 14) | (1 << 15) | (1 << 16))
180 #define VP_DCFG_CRT_VSYNC_POL (1 << 9)
181 #define VP_DCFG_CRT_HSYNC_POL (1 << 8)
182 #define VP_DCFG_FP_DATA_EN (1 << 7) /* undocumented */
183 #define VP_DCFG_FP_PWR_EN (1 << 6) /* undocumented */
184 #define VP_DCFG_DAC_BL_EN (1 << 3)
185 #define VP_DCFG_VSYNC_EN (1 << 2)
186 #define VP_DCFG_HSYNC_EN (1 << 1)
187 #define VP_DCFG_CRT_EN (1 << 0)
189 #define VP_MISC_GAM_EN (1 << 0)
190 #define VP_MISC_DACPWRDN (1 << 10)
191 #define VP_MISC_APWRDN (1 << 11)
195 * Flat Panel registers (table 6-55).
196 * Also 64 bit registers; see above note about 32-bit handling.
199 /* we're actually in the VP register space, starting at address 0x400 */
200 #define VP_FP_START 0x400
224 #define FP_PT1_VSIZE_SHIFT 16 /* undocumented? */
225 #define FP_PT1_VSIZE_MASK 0x7FF0000 /* undocumented? */
227 #define FP_PT2_HSP (1 << 22)
228 #define FP_PT2_VSP (1 << 23)
230 #define FP_PM_P (1 << 24) /* panel power on */
231 #define FP_PM_PANEL_PWR_UP (1 << 3) /* r/o */
232 #define FP_PM_PANEL_PWR_DOWN (1 << 2) /* r/o */
233 #define FP_PM_PANEL_OFF (1 << 1) /* r/o */
234 #define FP_PM_PANEL_ON (1 << 0) /* r/o */
236 #define FP_DFC_NFI ((1 << 4) | (1 << 5) | (1 << 6))
239 /* register access functions */
241 static inline uint32_t read_dc(struct gxfb_par *par, int reg)
243 return readl(par->dc_regs + 4*reg);
246 static inline void write_dc(struct gxfb_par *par, int reg, uint32_t val)
248 writel(val, par->dc_regs + 4*reg);
252 static inline uint32_t read_vp(struct gxfb_par *par, int reg)
254 return readl(par->vid_regs + 8*reg);
257 static inline void write_vp(struct gxfb_par *par, int reg, uint32_t val)
259 writel(val, par->vid_regs + 8*reg);
262 static inline uint32_t read_fp(struct gxfb_par *par, int reg)
264 return readl(par->vid_regs + 8*reg + VP_FP_START);
267 static inline void write_fp(struct gxfb_par *par, int reg, uint32_t val)
269 writel(val, par->vid_regs + 8*reg + VP_FP_START);
273 /* MSRs are defined in asm/geode.h; their bitfields are here */
275 #define MSR_GLCP_SYS_RSTPLL_DOTPOSTDIV3 (1 << 3)
276 #define MSR_GLCP_SYS_RSTPLL_DOTPREMULT2 (1 << 2)
277 #define MSR_GLCP_SYS_RSTPLL_DOTPREDIV2 (1 << 1)
279 #define MSR_GLCP_DOTPLL_LOCK (1 << 25) /* r/o */
280 #define MSR_GLCP_DOTPLL_BYPASS (1 << 15)
281 #define MSR_GLCP_DOTPLL_DOTRESET (1 << 0)
283 #define MSR_GX_MSR_PADSEL_MASK 0x3FFFFFFF /* undocumented? */
284 #define MSR_GX_MSR_PADSEL_TFT 0x1FFFFFFF /* undocumented? */
286 #define MSR_GX_GLD_MSR_CONFIG_FP (1 << 3)