aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Crouse <jordan.crouse@amd.com>2006-12-08 05:40:53 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-08 11:29:08 -0500
commitf378819a19e2b9639f17a1a82c5e12adc9512390 (patch)
treeef6278a50642f63d3ae1667fe33e92fb78536f5b
parent4c1979c8963528cc6f52203ae62162ed22e171f4 (diff)
[PATCH] gxfb: Fixups for the AMD Geode GX framebuffer driver
We cannot assume that the BIOS will be correctly setting up the hardware, so set some bits in various display registers to enable video output. Allow an advanced user to specify a frambuffer size, rather then probing the BIOS. All of these fixes were prompted by the OLPC effort. [akpm@osdl.org: cleanups] Signed-off-by: Jordan Crouse <jordan.crouse@amd.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Acked-by: James Simmons <jsimmons@infradead.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--drivers/video/geode/Kconfig20
-rw-r--r--drivers/video/geode/display_gx.c8
-rw-r--r--drivers/video/geode/display_gx.h1
-rw-r--r--drivers/video/geode/gxfb_core.c6
-rw-r--r--drivers/video/geode/video_gx.c24
-rw-r--r--drivers/video/geode/video_gx.h7
6 files changed, 65 insertions, 1 deletions
diff --git a/drivers/video/geode/Kconfig b/drivers/video/geode/Kconfig
index 4e173ef20a7d..a814b6c2605c 100644
--- a/drivers/video/geode/Kconfig
+++ b/drivers/video/geode/Kconfig
@@ -23,6 +23,26 @@ config FB_GEODE_GX
23 23
24 If unsure, say N. 24 If unsure, say N.
25 25
26config FB_GEODE_GX_SET_FBSIZE
27 bool "Manually specify the Geode GX framebuffer size"
28 depends on FB_GEODE_GX
29 default n
30 ---help---
31 If you want to manually specify the size of your GX framebuffer,
32 say Y here, otherwise say N to dynamically probe it.
33
34 Say N unless you know what you are doing.
35
36config FB_GEODE_GX_FBSIZE
37 hex "Size of the GX framebuffer, in bytes"
38 depends on FB_GEODE_GX_SET_FBSIZE
39 default "0x1600000"
40 ---help---
41 Specify the size of the GX framebuffer. Normally, you will
42 want this to be MB aligned. Common values are 0x80000 (8MB)
43 and 0x1600000 (16MB). Don't change this unless you know what
44 you are doing
45
26config FB_GEODE_GX1 46config FB_GEODE_GX1
27 tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)" 47 tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)"
28 depends on FB && FB_GEODE && EXPERIMENTAL 48 depends on FB && FB_GEODE && EXPERIMENTAL
diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
index 0245169366b3..0f16e4bffc6c 100644
--- a/drivers/video/geode/display_gx.c
+++ b/drivers/video/geode/display_gx.c
@@ -21,6 +21,12 @@
21#include "geodefb.h" 21#include "geodefb.h"
22#include "display_gx.h" 22#include "display_gx.h"
23 23
24#ifdef CONFIG_FB_GEODE_GX_SET_FBSIZE
25unsigned int gx_frame_buffer_size(void)
26{
27 return CONFIG_FB_GEODE_GX_FBSIZE;
28}
29#else
24unsigned int gx_frame_buffer_size(void) 30unsigned int gx_frame_buffer_size(void)
25{ 31{
26 unsigned int val; 32 unsigned int val;
@@ -35,6 +41,7 @@ unsigned int gx_frame_buffer_size(void)
35 val = (unsigned int)(inw(0xAC1E)) & 0xFFl; 41 val = (unsigned int)(inw(0xAC1E)) & 0xFFl;
36 return (val << 19); 42 return (val << 19);
37} 43}
44#endif
38 45
39int gx_line_delta(int xres, int bpp) 46int gx_line_delta(int xres, int bpp)
40{ 47{
@@ -90,6 +97,7 @@ static void gx_set_mode(struct fb_info *info)
90 writel(((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2, 97 writel(((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2,
91 par->dc_regs + DC_LINE_SIZE); 98 par->dc_regs + DC_LINE_SIZE);
92 99
100
93 /* Enable graphics and video data and unmask address lines. */ 101 /* Enable graphics and video data and unmask address lines. */
94 dcfg |= DC_DCFG_GDEN | DC_DCFG_VDEN | DC_DCFG_A20M | DC_DCFG_A18M; 102 dcfg |= DC_DCFG_GDEN | DC_DCFG_VDEN | DC_DCFG_A20M | DC_DCFG_A18M;
95 103
diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
index 41e79f440670..e962c7679d08 100644
--- a/drivers/video/geode/display_gx.h
+++ b/drivers/video/geode/display_gx.h
@@ -93,4 +93,5 @@ extern struct geode_dc_ops gx_dc_ops;
93#define DC_PAL_ADDRESS 0x70 93#define DC_PAL_ADDRESS 0x70
94#define DC_PAL_DATA 0x74 94#define DC_PAL_DATA 0x74
95 95
96#define DC_GLIU0_MEM_OFFSET 0x84
96#endif /* !__DISPLAY_GX1_H__ */ 97#endif /* !__DISPLAY_GX1_H__ */
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index a454dcb8e215..742fd04178c3 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -240,6 +240,12 @@ static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *de
240 if (!info->screen_base) 240 if (!info->screen_base)
241 return -ENOMEM; 241 return -ENOMEM;
242 242
243 /* Set the 16MB aligned base address of the graphics memory region
244 * in the display controller */
245
246 writel(info->fix.smem_start & 0xFF000000,
247 par->dc_regs + DC_GLIU0_MEM_OFFSET);
248
243 dev_info(&dev->dev, "%d Kibyte of video memory at 0x%lx\n", 249 dev_info(&dev->dev, "%d Kibyte of video memory at 0x%lx\n",
244 info->fix.smem_len / 1024, info->fix.smem_start); 250 info->fix.smem_len / 1024, info->fix.smem_start);
245 251
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index 2b2a7880ea75..616ce339c5fa 100644
--- a/drivers/video/geode/video_gx.c
+++ b/drivers/video/geode/video_gx.c
@@ -178,7 +178,21 @@ static void gx_set_dclk_frequency(struct fb_info *info)
178static void gx_configure_display(struct fb_info *info) 178static void gx_configure_display(struct fb_info *info)
179{ 179{
180 struct geodefb_par *par = info->par; 180 struct geodefb_par *par = info->par;
181 u32 dcfg, fp_pm; 181 u32 dcfg, fp_pm, misc;
182
183 /* Set up the MISC register */
184
185 misc = readl(par->vid_regs + GX_MISC);
186
187 /* Power up the DAC */
188 misc &= ~(GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN);
189
190 /* Disable gamma correction */
191 misc |= GX_MISC_GAM_EN;
192
193 writel(misc, par->vid_regs + GX_MISC);
194
195 /* Write the display configuration */
182 196
183 dcfg = readl(par->vid_regs + GX_DCFG); 197 dcfg = readl(par->vid_regs + GX_DCFG);
184 198
@@ -199,9 +213,17 @@ static void gx_configure_display(struct fb_info *info)
199 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT) 213 if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
200 dcfg |= GX_DCFG_CRT_VSYNC_POL; 214 dcfg |= GX_DCFG_CRT_VSYNC_POL;
201 215
216 /* Enable the display logic */
217 /* Set up the DACS to blank normally */
218
219 dcfg |= GX_DCFG_CRT_EN | GX_DCFG_DAC_BL_EN;
220
221 /* Enable the external DAC VREF? */
222
202 writel(dcfg, par->vid_regs + GX_DCFG); 223 writel(dcfg, par->vid_regs + GX_DCFG);
203 224
204 /* Power on flat panel. */ 225 /* Power on flat panel. */
226
205 fp_pm = readl(par->vid_regs + GX_FP_PM); 227 fp_pm = readl(par->vid_regs + GX_FP_PM);
206 fp_pm |= GX_FP_PM_P; 228 fp_pm |= GX_FP_PM_P;
207 writel(fp_pm, par->vid_regs + GX_FP_PM); 229 writel(fp_pm, par->vid_regs + GX_FP_PM);
diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
index 2d9211f3ed84..238181a7d536 100644
--- a/drivers/video/geode/video_gx.h
+++ b/drivers/video/geode/video_gx.h
@@ -28,6 +28,13 @@ extern struct geode_vid_ops gx_vid_ops;
28# define GX_DCFG_GV_GAM 0x00200000 28# define GX_DCFG_GV_GAM 0x00200000
29# define GX_DCFG_DAC_VREF 0x04000000 29# define GX_DCFG_DAC_VREF 0x04000000
30 30
31/* Geode GX MISC video configuration */
32
33#define GX_MISC 0x50
34#define GX_MISC_GAM_EN 0x00000001
35#define GX_MISC_DAC_PWRDN 0x00000400
36#define GX_MISC_A_PWRDN 0x00000800
37
31/* Geode GX flat panel display control registers */ 38/* Geode GX flat panel display control registers */
32#define GX_FP_PM 0x410 39#define GX_FP_PM 0x410
33# define GX_FP_PM_P 0x01000000 40# define GX_FP_PM_P 0x01000000