linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/6] Geode GX framebuffer patches
@ 2006-11-28 23:06 Jordan Crouse
  2006-11-28 23:14 ` [PATCH 1/6] FB: Get the Geode GX frambuffer size from the BIOS Jordan Crouse
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Jordan Crouse @ 2006-11-28 23:06 UTC (permalink / raw)
  To: linux-fbdev-devel, info-linux; +Cc: akpm

I had mentioned previously that the FB patches were pulled from the Geode
GIT tree into -mm, but obviously I need to be hit with the GIT cluebat a
few more times. So to get things moving forward, I'm offering the fbdev 
specific patches from that tree in the usual fashion.  They have been 
heavily beaten up on the OLPC project and seem to be quite sane.

And for those who are interested, I'll still have the Geode GIT available
for those who wish to pull the latest and greatest Geode code, it just won't 
be part of the kernel development workflow.

---
Jordan Crouse
Senior Linux Engineer
Advanced Micro Devices, Inc.
<www.amd.com/embeddedprocessors>



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/6] FB: Get the Geode GX frambuffer size from the BIOS
  2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
@ 2006-11-28 23:14 ` Jordan Crouse
  2006-11-29 14:21   ` James Simmons
  2006-11-28 23:14 ` [PATCH 2/6] [PATCH] gxfb: Fixups for the AMD Geode GX framebuffer driver Jordan Crouse
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jordan Crouse @ 2006-11-28 23:14 UTC (permalink / raw)
  To: linux-fbdev-devel, info-linux; +Cc: akpm

From: Jordan Crouse <jordan.crouse@amd.com>

Use the Geode GX BIOS virtual registers to get the actual size of the
framebuffer.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 drivers/video/geode/display_gx.c |   15 ++++++++++++---
 drivers/video/geode/display_gx.h |    2 +-
 2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
index 825c340..0245169 100644
--- a/drivers/video/geode/display_gx.c
+++ b/drivers/video/geode/display_gx.c
@@ -21,10 +21,19 @@ #include <asm/delay.h>
 #include "geodefb.h"
 #include "display_gx.h"
 
-int gx_frame_buffer_size(void)
+unsigned int gx_frame_buffer_size(void)
 {
-	/* Assuming 16 MiB. */
-	return 16*1024*1024;
+	unsigned int val;
+
+	/* FB size is reported by a virtual register */
+	/* Virtual register class = 0x02 */
+	/* VG_MEM_SIZE(512Kb units) = 0x00 */
+
+	outw(0xFC53, 0xAC1C);
+	outw(0x0200, 0xAC1C);
+
+	val = (unsigned int)(inw(0xAC1E)) & 0xFFl;
+	return (val << 19);
 }
 
 int gx_line_delta(int xres, int bpp)
diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
index 86c6233..41e79f4 100644
--- a/drivers/video/geode/display_gx.h
+++ b/drivers/video/geode/display_gx.h
@@ -11,7 +11,7 @@
 #ifndef __DISPLAY_GX_H__
 #define __DISPLAY_GX_H__
 
-int gx_frame_buffer_size(void);
+unsigned int gx_frame_buffer_size(void);
 int gx_line_delta(int xres, int bpp);
 
 extern struct geode_dc_ops gx_dc_ops;



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/6] [PATCH] gxfb: Fixups for the AMD Geode GX framebuffer driver
  2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
  2006-11-28 23:14 ` [PATCH 1/6] FB: Get the Geode GX frambuffer size from the BIOS Jordan Crouse
@ 2006-11-28 23:14 ` Jordan Crouse
  2006-11-29 14:21   ` James Simmons
  2006-11-28 23:15 ` [PATCH 3/6] [PATCH] gxfb: Support flat panel timings Jordan Crouse
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jordan Crouse @ 2006-11-28 23:14 UTC (permalink / raw)
  To: linux-fbdev-devel, info-linux; +Cc: akpm

From: Jordan Crouse <jordan.crouse@amd.com>

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.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 drivers/video/geode/Kconfig      |   20 ++++++++++++++++++++
 drivers/video/geode/display_gx.c |    7 +++++++
 drivers/video/geode/display_gx.h |    1 +
 drivers/video/geode/gxfb_core.c  |    6 ++++++
 drivers/video/geode/video_gx.c   |   24 +++++++++++++++++++++++-
 drivers/video/geode/video_gx.h   |    7 +++++++
 6 files changed, 64 insertions(+), 1 deletions(-)

diff --git a/drivers/video/geode/Kconfig b/drivers/video/geode/Kconfig
index 4e173ef..5704879 100644
--- a/drivers/video/geode/Kconfig
+++ b/drivers/video/geode/Kconfig
@@ -23,6 +23,26 @@ config FB_GEODE_GX
 
 	  If unsure, say N.
 
+config FB_GEODE_GX_SET_FBSIZE
+	bool "Manually specify the Geode GX framebuffer size"
+	depends on FB_GEODE_GX
+	default n
+	---help---
+	  If you want to manually specify the size of your GX framebuffer,
+	  say Y here, otherwise say N to dynamically probe it.
+	  
+	  Say N unless you know what you are doing.
+
+config FB_GEODE_GX_FBSIZE
+	hex "Size of the GX framebuffer, in bytes"
+	depends on FB_GEODE_GX_SET_FBSIZE
+	default "0x1600000"
+	---help---
+	  Specify the size of the GX framebuffer.  Normally, you will
+	  want this to be MB aligned.  Common values are 0x80000 (8MB)
+	  and 0x1600000 (16MB).  Don't change this unless you know what
+	  you are doing
+
 config FB_GEODE_GX1
 	tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)"
 	depends on FB && FB_GEODE && EXPERIMENTAL
diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
index 0245169..7faf62a 100644
--- a/drivers/video/geode/display_gx.c
+++ b/drivers/video/geode/display_gx.c
@@ -21,6 +21,11 @@ #include <asm/delay.h>
 #include "geodefb.h"
 #include "display_gx.h"
 
+#ifdef CONFIG_FB_GEODE_GX_SET_FBSIZE
+unsigned int gx_frame_buffer_size(void) {
+	return CONFIG_FB_GEODE_GX_FBSIZE;
+}
+#else
 unsigned int gx_frame_buffer_size(void)
 {
 	unsigned int val;
@@ -35,6 +40,7 @@ unsigned int gx_frame_buffer_size(void)
 	val = (unsigned int)(inw(0xAC1E)) & 0xFFl;
 	return (val << 19);
 }
+#endif
 
 int gx_line_delta(int xres, int bpp)
 {
@@ -90,6 +96,7 @@ static void gx_set_mode(struct fb_info *
 	writel(((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2,
 	       par->dc_regs + DC_LINE_SIZE);
 
+
 	/* Enable graphics and video data and unmask address lines. */
 	dcfg |= DC_DCFG_GDEN | DC_DCFG_VDEN | DC_DCFG_A20M | DC_DCFG_A18M;
 
diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
index 41e79f4..e962c76 100644
--- a/drivers/video/geode/display_gx.h
+++ b/drivers/video/geode/display_gx.h
@@ -93,4 +93,5 @@ #define DC_V_SYNC_TIMING   0x58
 #define DC_PAL_ADDRESS 0x70
 #define DC_PAL_DATA    0x74
 
+#define DC_GLIU0_MEM_OFFSET 0x84
 #endif /* !__DISPLAY_GX1_H__ */
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 0d3643f..16b7393 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(
 	if (!info->screen_base)
 		return -ENOMEM;
 
+	/* Set the 16MB aligned base address of the graphics memory region
+	 * in the display controller */
+
+	writel(info->fix.smem_start & 0xFF000000,
+			par->dc_regs + DC_GLIU0_MEM_OFFSET);
+
 	dev_info(&dev->dev, "%d Kibyte of video memory at 0x%lx\n",
 		 info->fix.smem_len / 1024, info->fix.smem_start);
 
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index 2b2a788..616ce33 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
 static void gx_configure_display(struct fb_info *info)
 {
 	struct geodefb_par *par = info->par;
-	u32 dcfg, fp_pm;
+	u32 dcfg, fp_pm, misc;
+
+	/* Set up the MISC register */
+
+	misc = readl(par->vid_regs + GX_MISC);
+
+	/* Power up the DAC */
+	misc &= ~(GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN);
+
+	/* Disable gamma correction */
+	misc |= GX_MISC_GAM_EN;
+
+	writel(misc, par->vid_regs + GX_MISC);
+
+	/* Write the display configuration */
 
 	dcfg = readl(par->vid_regs + GX_DCFG);
 
@@ -199,9 +213,17 @@ static void gx_configure_display(struct
 	if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
 		dcfg |= GX_DCFG_CRT_VSYNC_POL;
 
+	/* Enable the display logic */
+	/* Set up the DACS to blank normally */
+
+	dcfg |= GX_DCFG_CRT_EN | GX_DCFG_DAC_BL_EN;
+
+	/* Enable the external DAC VREF? */
+
 	writel(dcfg, par->vid_regs + GX_DCFG);
 
 	/* Power on flat panel. */
+
 	fp_pm = readl(par->vid_regs + GX_FP_PM);
 	fp_pm |= GX_FP_PM_P;
 	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 2d9211f..238181a 100644
--- a/drivers/video/geode/video_gx.h
+++ b/drivers/video/geode/video_gx.h
@@ -28,6 +28,13 @@ #  define GX_DCFG_VG_CK			0x00100000
 #  define GX_DCFG_GV_GAM		0x00200000
 #  define GX_DCFG_DAC_VREF		0x04000000
 
+/* Geode GX MISC video configuration */
+
+#define GX_MISC 0x50
+#define GX_MISC_GAM_EN     0x00000001
+#define GX_MISC_DAC_PWRDN  0x00000400
+#define GX_MISC_A_PWRDN    0x00000800
+
 /* Geode GX flat panel display control registers */
 #define GX_FP_PM 0x410
 #  define GX_FP_PM_P 0x01000000



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/6] [PATCH] gxfb: Support flat panel timings
  2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
  2006-11-28 23:14 ` [PATCH 1/6] FB: Get the Geode GX frambuffer size from the BIOS Jordan Crouse
  2006-11-28 23:14 ` [PATCH 2/6] [PATCH] gxfb: Fixups for the AMD Geode GX framebuffer driver Jordan Crouse
@ 2006-11-28 23:15 ` Jordan Crouse
  2006-11-29 14:21   ` James Simmons
  2006-11-28 23:15 ` [PATCH 4/6] [PATCH] gxfb: Support command line options Jordan Crouse
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jordan Crouse @ 2006-11-28 23:15 UTC (permalink / raw)
  To: linux-fbdev-devel, info-linux; +Cc: akpm

From: Jordan Crouse <jordan.crouse@amd.com>

Support TFT panels by correctly setting up the flat panel registers

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 drivers/video/geode/display_gx.h |    4 ++
 drivers/video/geode/gxfb_core.c  |   10 +++++
 drivers/video/geode/video_gx.c   |   76 +++++++++++++++++++++++++++++++++-----
 drivers/video/geode/video_gx.h   |   16 ++++++++
 4 files changed, 95 insertions(+), 11 deletions(-)

diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
index e962c76..ba0ccc8 100644
--- a/drivers/video/geode/display_gx.h
+++ b/drivers/video/geode/display_gx.h
@@ -16,6 +16,10 @@ int gx_line_delta(int xres, int bpp);
 
 extern struct geode_dc_ops gx_dc_ops;
 
+/* MSR that tells us if a TFT or CRT is attached */
+#define GLD_MSR_CONFIG   0xC0002001
+#define GLD_MSR_CONFIG_FMT_FP 0x01
+
 /* Display controller registers */
 
 #define DC_UNLOCK 0x00
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index 16b7393..ccc50fc 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -308,6 +308,7 @@ static int __init gxfb_probe(struct pci_
 	struct geodefb_par *par;
 	struct fb_info *info;
 	int ret;
+	unsigned long val;
 
 	info = gxfb_init_fbinfo(&pdev->dev);
 	if (!info)
@@ -323,6 +324,15 @@ static int __init gxfb_probe(struct pci_
 		goto err;
 	}
 
+	/* Figure out if this is a TFT or CRT part */
+
+	rdmsrl(GLD_MSR_CONFIG, val);
+
+	if (val & GLD_MSR_CONFIG_FMT_FP)
+		par->enable_crt = 0;
+	else
+		par->enable_crt = 1;
+
 	ret = fb_find_mode(&info->var, info, mode_option,
 			   gx_modedb, ARRAY_SIZE(gx_modedb), NULL, 16);
 	if (ret == 0 || ret == 4) {
diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index 616ce33..e6a4c70 100644
--- a/drivers/video/geode/video_gx.c
+++ b/drivers/video/geode/video_gx.c
@@ -175,10 +175,62 @@ static void gx_set_dclk_frequency(struct
 	} while (timeout-- && !(dotpll & MSR_GLCP_DOTPLL_LOCK));
 }
 
+static void
+gx_configure_tft(struct fb_info *info) {
+
+	struct geodefb_par *par = info->par;
+	unsigned long val;
+	unsigned long fp;
+
+	/* Set up the DF pad select MSR */
+
+	rdmsrl(GX_VP_MSR_PAD_SELECT, val);
+	val &= ~GX_VP_PAD_SELECT_MASK;
+	val |= GX_VP_PAD_SELECT_TFT;
+	wrmsrl(GX_VP_MSR_PAD_SELECT, val);
+
+	/* Turn off the panel */
+
+	fp = readl(par->vid_regs + GX_FP_PM);
+	fp &= ~GX_FP_PM_P;
+	writel(fp, par->vid_regs + GX_FP_PM);
+
+	/* Set timing 1 */
+
+	fp = readl(par->vid_regs + GX_FP_PT1);
+	fp &= GX_FP_PT1_VSIZE_MASK;
+	fp |= info->var.yres << GX_FP_PT1_VSIZE_SHIFT;
+	writel(fp, par->vid_regs + GX_FP_PT1);
+
+	/* Timing 2 */
+	/* Set bits that are always on for TFT */
+
+	fp = 0x0F100000;
+
+	/* Add sync polarity */
+
+	if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT))
+		fp |= GX_FP_PT2_VSP;
+
+	if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT))
+		fp |= GX_FP_PT2_HSP;
+
+	writel(fp, par->vid_regs + GX_FP_PT2);
+
+	/*  Set the dither control */
+	writel(0x70, par->vid_regs + GX_FP_DFC);
+
+	/* Turn on the device */
+
+	fp = readl(par->vid_regs + GX_FP_PM);
+	fp |= GX_FP_PM_P;
+	writel(fp, par->vid_regs + GX_FP_PM);
+}
+
 static void gx_configure_display(struct fb_info *info)
 {
 	struct geodefb_par *par = info->par;
-	u32 dcfg, fp_pm, misc;
+	u32 dcfg, misc;
 
 	/* Set up the MISC register */
 
@@ -222,11 +274,10 @@ static void gx_configure_display(struct
 
 	writel(dcfg, par->vid_regs + GX_DCFG);
 
-	/* Power on flat panel. */
+	/* Set up the flat panel (if it is enabled) */
 
-	fp_pm = readl(par->vid_regs + GX_FP_PM);
-	fp_pm |= GX_FP_PM_P;
-	writel(fp_pm, par->vid_regs + GX_FP_PM);
+	if (par->enable_crt == 0)
+		gx_configure_tft(info);
 }
 
 static int gx_blank_display(struct fb_info *info, int blank_mode)
@@ -267,12 +318,15 @@ static int gx_blank_display(struct fb_in
 	writel(dcfg, par->vid_regs + GX_DCFG);
 
 	/* Power on/off flat panel. */
-	fp_pm = readl(par->vid_regs + GX_FP_PM);
-	if (blank_mode == FB_BLANK_POWERDOWN)
-		fp_pm &= ~GX_FP_PM_P;
-	else
-		fp_pm |= GX_FP_PM_P;
-	writel(fp_pm, par->vid_regs + GX_FP_PM);
+
+	if (par->enable_crt == 0) {
+		fp_pm = readl(par->vid_regs + GX_FP_PM);
+		if (blank_mode == FB_BLANK_POWERDOWN)
+			fp_pm &= ~GX_FP_PM_P;
+		else
+			fp_pm |= GX_FP_PM_P;
+		writel(fp_pm, par->vid_regs + GX_FP_PM);
+	}
 
 	return 0;
 }
diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
index 238181a..8f1e85b 100644
--- a/drivers/video/geode/video_gx.h
+++ b/drivers/video/geode/video_gx.h
@@ -13,6 +13,11 @@ #define __VIDEO_GX_H__
 
 extern struct geode_vid_ops gx_vid_ops;
 
+/* GX Flatpanel control MSR */
+#define GX_VP_MSR_PAD_SELECT           0x2011
+#define GX_VP_PAD_SELECT_MASK          0x3FFFFFFF
+#define GX_VP_PAD_SELECT_TFT           0x1FFFFFFF
+
 /* Geode GX video processor registers */
 
 #define GX_DCFG		0x0008
@@ -36,9 +41,20 @@ #define GX_MISC_DAC_PWRDN  0x00000400
 #define GX_MISC_A_PWRDN    0x00000800
 
 /* Geode GX flat panel display control registers */
+
+#define GX_FP_PT1 0x0400
+#define GX_FP_PT1_VSIZE_MASK 0x7FF0000
+#define GX_FP_PT1_VSIZE_SHIFT 16
+
+#define GX_FP_PT2 0x408
+#define GX_FP_PT2_VSP (1 << 23)
+#define GX_FP_PT2_HSP (1 << 22)
+
 #define GX_FP_PM 0x410
 #  define GX_FP_PM_P 0x01000000
 
+#define GX_FP_DFC 0x418
+
 /* Geode GX clock control MSRs */
 
 #define MSR_GLCP_SYS_RSTPLL	0x4c000014



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/6] [PATCH] gxfb: Support command line options
  2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
                   ` (2 preceding siblings ...)
  2006-11-28 23:15 ` [PATCH 3/6] [PATCH] gxfb: Support flat panel timings Jordan Crouse
@ 2006-11-28 23:15 ` Jordan Crouse
  2006-11-29 14:21   ` James Simmons
  2006-11-28 23:15 ` [PATCH 5/6] [PATCH] gxfb: Fixup flatpanel detection Jordan Crouse
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jordan Crouse @ 2006-11-28 23:15 UTC (permalink / raw)
  To: linux-fbdev-devel, info-linux; +Cc: akpm

From: Jordan Crouse <jordan.crouse@amd.com>

Add support for command line options for setting the mode and various
settings.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 drivers/video/geode/gxfb_core.c |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index ccc50fc..d404f56 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -35,10 +35,10 @@ #include "geodefb.h"
 #include "display_gx.h"
 #include "video_gx.h"
 
-static char mode_option[32] = "640x480-16@60";
+static char *mode_option;
 
 /* Modes relevant to the GX (taken from modedb.c) */
-static const struct fb_videomode __initdata gx_modedb[] = {
+static const struct fb_videomode gx_modedb[] __initdata = {
 	/* 640x480-60 VESA */
 	{ NULL, 60, 640, 480, 39682,  48, 16, 33, 10, 96, 2,
 	  0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
@@ -341,7 +341,8 @@ static int __init gxfb_probe(struct pci_
 		goto err;
 	}
 
-        /* Clear the frame buffer of garbage. */
+       
+	/* Clear the frame buffer of garbage. */
         memset_io(info->screen_base, 0, info->fix.smem_len);
 
 	gxfb_check_var(&info->var, info);
@@ -411,11 +412,34 @@ static struct pci_driver gxfb_driver = {
 	.remove		= gxfb_remove,
 };
 
+#ifndef MODULE
+static int __init gxfb_setup(char *options) {
+
+	char *opt;
+
+	if (!options || !*options)
+		return 0;
+
+	while((opt = strsep(&options, ",")) != NULL) {
+		if (!*opt)
+			continue;
+
+		mode_option = opt;
+	}
+
+	return 0;
+}
+#endif
+
 static int __init gxfb_init(void)
 {
 #ifndef MODULE
-	if (fb_get_options("gxfb", NULL))
+	char *option = NULL;
+
+	if (fb_get_options("gxfb", &option))
 		return -ENODEV;
+
+	gxfb_setup(option);
 #endif
 	return pci_register_driver(&gxfb_driver);
 }
@@ -428,8 +452,8 @@ static void __exit gxfb_cleanup(void)
 module_init(gxfb_init);
 module_exit(gxfb_cleanup);
 
-module_param_string(mode, mode_option, sizeof(mode_option), 0444);
-MODULE_PARM_DESC(mode, "video mode (<x>x<y>[-<bpp>][@<refr>])");
+module_param(mode_option, charp, 0);
+MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])");
 
 MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode GX");
 MODULE_LICENSE("GPL");



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 5/6] [PATCH] gxfb: Fixup flatpanel detection
  2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
                   ` (3 preceding siblings ...)
  2006-11-28 23:15 ` [PATCH 4/6] [PATCH] gxfb: Support command line options Jordan Crouse
@ 2006-11-28 23:15 ` Jordan Crouse
  2006-11-29 14:22   ` James Simmons
  2006-11-28 23:15 ` [PATCH 6/6] [PATCH] gxfb: Turn on the flatpanel power and data Jordan Crouse
  2006-11-29  0:10 ` [PATCH 0/6] Geode GX framebuffer patches Andrew Morton
  6 siblings, 1 reply; 14+ messages in thread
From: Jordan Crouse @ 2006-11-28 23:15 UTC (permalink / raw)
  To: linux-fbdev-devel, info-linux; +Cc: akpm

From: Jordan Crouse <jordan.crouse@amd.com>

Use the right MSR and bits to detect if the GX is strapped for TFT or CRT

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 drivers/video/geode/display_gx.h |    2 +-
 drivers/video/geode/gxfb_core.c  |    2 +-
 drivers/video/geode/video_gx.h   |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
index ba0ccc8..0af33f3 100644
--- a/drivers/video/geode/display_gx.h
+++ b/drivers/video/geode/display_gx.h
@@ -18,7 +18,7 @@ extern struct geode_dc_ops gx_dc_ops;
 
 /* MSR that tells us if a TFT or CRT is attached */
 #define GLD_MSR_CONFIG   0xC0002001
-#define GLD_MSR_CONFIG_FMT_FP 0x01
+#define GLD_MSR_CONFIG_DM_FP 0x40
 
 /* Display controller registers */
 
diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
index d404f56..83ab18a 100644
--- a/drivers/video/geode/gxfb_core.c
+++ b/drivers/video/geode/gxfb_core.c
@@ -328,7 +328,7 @@ static int __init gxfb_probe(struct pci_
 
 	rdmsrl(GLD_MSR_CONFIG, val);
 
-	if (val & GLD_MSR_CONFIG_FMT_FP)
+	if ((val & GLD_MSR_CONFIG_DM_FP) == GLD_MSR_CONFIG_DM_FP)
 		par->enable_crt = 0;
 	else
 		par->enable_crt = 1;
diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
index 8f1e85b..119d0ab 100644
--- a/drivers/video/geode/video_gx.h
+++ b/drivers/video/geode/video_gx.h
@@ -14,7 +14,7 @@ #define __VIDEO_GX_H__
 extern struct geode_vid_ops gx_vid_ops;
 
 /* GX Flatpanel control MSR */
-#define GX_VP_MSR_PAD_SELECT           0x2011
+#define GX_VP_MSR_PAD_SELECT           0xC0002011
 #define GX_VP_PAD_SELECT_MASK          0x3FFFFFFF
 #define GX_VP_PAD_SELECT_TFT           0x1FFFFFFF
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 6/6] [PATCH] gxfb: Turn on the flatpanel power and data
  2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
                   ` (4 preceding siblings ...)
  2006-11-28 23:15 ` [PATCH 5/6] [PATCH] gxfb: Fixup flatpanel detection Jordan Crouse
@ 2006-11-28 23:15 ` Jordan Crouse
  2006-11-29 14:22   ` James Simmons
  2006-11-29  0:10 ` [PATCH 0/6] Geode GX framebuffer patches Andrew Morton
  6 siblings, 1 reply; 14+ messages in thread
From: Jordan Crouse @ 2006-11-28 23:15 UTC (permalink / raw)
  To: linux-fbdev-devel, info-linux; +Cc: akpm

From: Jordan Crouse <jordan.crouse@amd.com>

For Geode devices without a flatpanel aware BIOS, this enables the flatpanel
power and data.

Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
---

 drivers/video/geode/video_gx.c |   13 +++++++++++--
 drivers/video/geode/video_gx.h |    2 ++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
index e6a4c70..ed6a174 100644
--- a/drivers/video/geode/video_gx.c
+++ b/drivers/video/geode/video_gx.c
@@ -220,7 +220,13 @@ gx_configure_tft(struct fb_info *info) {
 	/*  Set the dither control */
 	writel(0x70, par->vid_regs + GX_FP_DFC);
 
-	/* Turn on the device */
+	/* Enable the FP data and power (in case the BIOS didn't) */
+
+	fp = readl(par->vid_regs + GX_DCFG);
+	fp |= GX_DCFG_FP_PWR_EN | GX_DCFG_FP_DATA_EN;
+	writel(fp, par->vid_regs + GX_DCFG);
+
+	/* Unblank the panel */
 
 	fp = readl(par->vid_regs + GX_FP_PM);
 	fp |= GX_FP_PM_P;
@@ -245,9 +251,12 @@ static void gx_configure_display(struct
 	writel(misc, par->vid_regs + GX_MISC);
 
 	/* Write the display configuration */
-
 	dcfg = readl(par->vid_regs + GX_DCFG);
 
+	/* Disable hsync and vsync */
+	dcfg &= ~(GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN);
+	writel(dcfg, par->vid_regs + GX_DCFG);
+
 	/* Clear bits from existing mode. */
 	dcfg &= ~(GX_DCFG_CRT_SYNC_SKW_MASK
 		  | GX_DCFG_CRT_HSYNC_POL   | GX_DCFG_CRT_VSYNC_POL
diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
index 119d0ab..ce28d8f 100644
--- a/drivers/video/geode/video_gx.h
+++ b/drivers/video/geode/video_gx.h
@@ -25,6 +25,8 @@ #  define GX_DCFG_CRT_EN		0x00000001
 #  define GX_DCFG_HSYNC_EN		0x00000002
 #  define GX_DCFG_VSYNC_EN		0x00000004
 #  define GX_DCFG_DAC_BL_EN		0x00000008
+#  define GX_DCFG_FP_PWR_EN		0x00000040
+#  define GX_DCFG_FP_DATA_EN		0x00000080
 #  define GX_DCFG_CRT_HSYNC_POL		0x00000100
 #  define GX_DCFG_CRT_VSYNC_POL		0x00000200
 #  define GX_DCFG_CRT_SYNC_SKW_MASK	0x0001C000



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/6] Geode GX framebuffer patches
  2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
                   ` (5 preceding siblings ...)
  2006-11-28 23:15 ` [PATCH 6/6] [PATCH] gxfb: Turn on the flatpanel power and data Jordan Crouse
@ 2006-11-29  0:10 ` Andrew Morton
  6 siblings, 0 replies; 14+ messages in thread
From: Andrew Morton @ 2006-11-29  0:10 UTC (permalink / raw)
  To: Jordan Crouse; +Cc: info-linux, linux-fbdev-devel

On Tue, 28 Nov 2006 16:06:39 -0700
"Jordan Crouse" <jordan.crouse@amd.com> wrote:

> I had mentioned previously that the FB patches were pulled from the Geode
> GIT tree into -mm, but obviously I need to be hit with the GIT cluebat a
> few more times. So to get things moving forward, I'm offering the fbdev 
> specific patches from that tree in the usual fashion.  They have been 
> heavily beaten up on the OLPC project and seem to be quite sane.

OK...

> And for those who are interested, I'll still have the Geode GIT available
> for those who wish to pull the latest and greatest Geode code, it just won't 
> be part of the kernel development workflow.

I don't understand the geode git tree.  It seems to keep floating about but
not getting merged into mainline.  What's the score here?

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/6] FB: Get the Geode GX frambuffer size from the BIOS
  2006-11-28 23:14 ` [PATCH 1/6] FB: Get the Geode GX frambuffer size from the BIOS Jordan Crouse
@ 2006-11-29 14:21   ` James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2006-11-29 14:21 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: info-linux, akpm


Acked-By: James Simmons <jsimmons@infradead.org>

On Tue, 28 Nov 2006, Jordan Crouse wrote:

> From: Jordan Crouse <jordan.crouse@amd.com>
> 
> Use the Geode GX BIOS virtual registers to get the actual size of the
> framebuffer.
> 
> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
> ---
> 
>  drivers/video/geode/display_gx.c |   15 ++++++++++++---
>  drivers/video/geode/display_gx.h |    2 +-
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
> index 825c340..0245169 100644
> --- a/drivers/video/geode/display_gx.c
> +++ b/drivers/video/geode/display_gx.c
> @@ -21,10 +21,19 @@ #include <asm/delay.h>
>  #include "geodefb.h"
>  #include "display_gx.h"
>  
> -int gx_frame_buffer_size(void)
> +unsigned int gx_frame_buffer_size(void)
>  {
> -	/* Assuming 16 MiB. */
> -	return 16*1024*1024;
> +	unsigned int val;
> +
> +	/* FB size is reported by a virtual register */
> +	/* Virtual register class = 0x02 */
> +	/* VG_MEM_SIZE(512Kb units) = 0x00 */
> +
> +	outw(0xFC53, 0xAC1C);
> +	outw(0x0200, 0xAC1C);
> +
> +	val = (unsigned int)(inw(0xAC1E)) & 0xFFl;
> +	return (val << 19);
>  }
>  
>  int gx_line_delta(int xres, int bpp)
> diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
> index 86c6233..41e79f4 100644
> --- a/drivers/video/geode/display_gx.h
> +++ b/drivers/video/geode/display_gx.h
> @@ -11,7 +11,7 @@
>  #ifndef __DISPLAY_GX_H__
>  #define __DISPLAY_GX_H__
>  
> -int gx_frame_buffer_size(void);
> +unsigned int gx_frame_buffer_size(void);
>  int gx_line_delta(int xres, int bpp);
>  
>  extern struct geode_dc_ops gx_dc_ops;
> 
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/6] [PATCH] gxfb: Fixups for the AMD Geode GX framebuffer driver
  2006-11-28 23:14 ` [PATCH 2/6] [PATCH] gxfb: Fixups for the AMD Geode GX framebuffer driver Jordan Crouse
@ 2006-11-29 14:21   ` James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2006-11-29 14:21 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: info-linux, akpm


Acked-By: James Simmons <jsimmons@infradead.org>

On Tue, 28 Nov 2006, Jordan Crouse wrote:

> From: Jordan Crouse <jordan.crouse@amd.com>
> 
> 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.
> 
> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
> ---
> 
>  drivers/video/geode/Kconfig      |   20 ++++++++++++++++++++
>  drivers/video/geode/display_gx.c |    7 +++++++
>  drivers/video/geode/display_gx.h |    1 +
>  drivers/video/geode/gxfb_core.c  |    6 ++++++
>  drivers/video/geode/video_gx.c   |   24 +++++++++++++++++++++++-
>  drivers/video/geode/video_gx.h   |    7 +++++++
>  6 files changed, 64 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/video/geode/Kconfig b/drivers/video/geode/Kconfig
> index 4e173ef..5704879 100644
> --- a/drivers/video/geode/Kconfig
> +++ b/drivers/video/geode/Kconfig
> @@ -23,6 +23,26 @@ config FB_GEODE_GX
>  
>  	  If unsure, say N.
>  
> +config FB_GEODE_GX_SET_FBSIZE
> +	bool "Manually specify the Geode GX framebuffer size"
> +	depends on FB_GEODE_GX
> +	default n
> +	---help---
> +	  If you want to manually specify the size of your GX framebuffer,
> +	  say Y here, otherwise say N to dynamically probe it.
> +	  
> +	  Say N unless you know what you are doing.
> +
> +config FB_GEODE_GX_FBSIZE
> +	hex "Size of the GX framebuffer, in bytes"
> +	depends on FB_GEODE_GX_SET_FBSIZE
> +	default "0x1600000"
> +	---help---
> +	  Specify the size of the GX framebuffer.  Normally, you will
> +	  want this to be MB aligned.  Common values are 0x80000 (8MB)
> +	  and 0x1600000 (16MB).  Don't change this unless you know what
> +	  you are doing
> +
>  config FB_GEODE_GX1
>  	tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)"
>  	depends on FB && FB_GEODE && EXPERIMENTAL
> diff --git a/drivers/video/geode/display_gx.c b/drivers/video/geode/display_gx.c
> index 0245169..7faf62a 100644
> --- a/drivers/video/geode/display_gx.c
> +++ b/drivers/video/geode/display_gx.c
> @@ -21,6 +21,11 @@ #include <asm/delay.h>
>  #include "geodefb.h"
>  #include "display_gx.h"
>  
> +#ifdef CONFIG_FB_GEODE_GX_SET_FBSIZE
> +unsigned int gx_frame_buffer_size(void) {
> +	return CONFIG_FB_GEODE_GX_FBSIZE;
> +}
> +#else
>  unsigned int gx_frame_buffer_size(void)
>  {
>  	unsigned int val;
> @@ -35,6 +40,7 @@ unsigned int gx_frame_buffer_size(void)
>  	val = (unsigned int)(inw(0xAC1E)) & 0xFFl;
>  	return (val << 19);
>  }
> +#endif
>  
>  int gx_line_delta(int xres, int bpp)
>  {
> @@ -90,6 +96,7 @@ static void gx_set_mode(struct fb_info *
>  	writel(((info->var.xres * info->var.bits_per_pixel/8) >> 3) + 2,
>  	       par->dc_regs + DC_LINE_SIZE);
>  
> +
>  	/* Enable graphics and video data and unmask address lines. */
>  	dcfg |= DC_DCFG_GDEN | DC_DCFG_VDEN | DC_DCFG_A20M | DC_DCFG_A18M;
>  
> diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
> index 41e79f4..e962c76 100644
> --- a/drivers/video/geode/display_gx.h
> +++ b/drivers/video/geode/display_gx.h
> @@ -93,4 +93,5 @@ #define DC_V_SYNC_TIMING   0x58
>  #define DC_PAL_ADDRESS 0x70
>  #define DC_PAL_DATA    0x74
>  
> +#define DC_GLIU0_MEM_OFFSET 0x84
>  #endif /* !__DISPLAY_GX1_H__ */
> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
> index 0d3643f..16b7393 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(
>  	if (!info->screen_base)
>  		return -ENOMEM;
>  
> +	/* Set the 16MB aligned base address of the graphics memory region
> +	 * in the display controller */
> +
> +	writel(info->fix.smem_start & 0xFF000000,
> +			par->dc_regs + DC_GLIU0_MEM_OFFSET);
> +
>  	dev_info(&dev->dev, "%d Kibyte of video memory at 0x%lx\n",
>  		 info->fix.smem_len / 1024, info->fix.smem_start);
>  
> diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
> index 2b2a788..616ce33 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
>  static void gx_configure_display(struct fb_info *info)
>  {
>  	struct geodefb_par *par = info->par;
> -	u32 dcfg, fp_pm;
> +	u32 dcfg, fp_pm, misc;
> +
> +	/* Set up the MISC register */
> +
> +	misc = readl(par->vid_regs + GX_MISC);
> +
> +	/* Power up the DAC */
> +	misc &= ~(GX_MISC_A_PWRDN | GX_MISC_DAC_PWRDN);
> +
> +	/* Disable gamma correction */
> +	misc |= GX_MISC_GAM_EN;
> +
> +	writel(misc, par->vid_regs + GX_MISC);
> +
> +	/* Write the display configuration */
>  
>  	dcfg = readl(par->vid_regs + GX_DCFG);
>  
> @@ -199,9 +213,17 @@ static void gx_configure_display(struct
>  	if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
>  		dcfg |= GX_DCFG_CRT_VSYNC_POL;
>  
> +	/* Enable the display logic */
> +	/* Set up the DACS to blank normally */
> +
> +	dcfg |= GX_DCFG_CRT_EN | GX_DCFG_DAC_BL_EN;
> +
> +	/* Enable the external DAC VREF? */
> +
>  	writel(dcfg, par->vid_regs + GX_DCFG);
>  
>  	/* Power on flat panel. */
> +
>  	fp_pm = readl(par->vid_regs + GX_FP_PM);
>  	fp_pm |= GX_FP_PM_P;
>  	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 2d9211f..238181a 100644
> --- a/drivers/video/geode/video_gx.h
> +++ b/drivers/video/geode/video_gx.h
> @@ -28,6 +28,13 @@ #  define GX_DCFG_VG_CK			0x00100000
>  #  define GX_DCFG_GV_GAM		0x00200000
>  #  define GX_DCFG_DAC_VREF		0x04000000
>  
> +/* Geode GX MISC video configuration */
> +
> +#define GX_MISC 0x50
> +#define GX_MISC_GAM_EN     0x00000001
> +#define GX_MISC_DAC_PWRDN  0x00000400
> +#define GX_MISC_A_PWRDN    0x00000800
> +
>  /* Geode GX flat panel display control registers */
>  #define GX_FP_PM 0x410
>  #  define GX_FP_PM_P 0x01000000
> 
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/6] [PATCH] gxfb: Support flat panel timings
  2006-11-28 23:15 ` [PATCH 3/6] [PATCH] gxfb: Support flat panel timings Jordan Crouse
@ 2006-11-29 14:21   ` James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2006-11-29 14:21 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: info-linux, akpm


Acked-By: James Simmons <jsimmons@infradead.org>

On Tue, 28 Nov 2006, Jordan Crouse wrote:

> From: Jordan Crouse <jordan.crouse@amd.com>
> 
> Support TFT panels by correctly setting up the flat panel registers
> 
> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
> ---
> 
>  drivers/video/geode/display_gx.h |    4 ++
>  drivers/video/geode/gxfb_core.c  |   10 +++++
>  drivers/video/geode/video_gx.c   |   76 +++++++++++++++++++++++++++++++++-----
>  drivers/video/geode/video_gx.h   |   16 ++++++++
>  4 files changed, 95 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
> index e962c76..ba0ccc8 100644
> --- a/drivers/video/geode/display_gx.h
> +++ b/drivers/video/geode/display_gx.h
> @@ -16,6 +16,10 @@ int gx_line_delta(int xres, int bpp);
>  
>  extern struct geode_dc_ops gx_dc_ops;
>  
> +/* MSR that tells us if a TFT or CRT is attached */
> +#define GLD_MSR_CONFIG   0xC0002001
> +#define GLD_MSR_CONFIG_FMT_FP 0x01
> +
>  /* Display controller registers */
>  
>  #define DC_UNLOCK 0x00
> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
> index 16b7393..ccc50fc 100644
> --- a/drivers/video/geode/gxfb_core.c
> +++ b/drivers/video/geode/gxfb_core.c
> @@ -308,6 +308,7 @@ static int __init gxfb_probe(struct pci_
>  	struct geodefb_par *par;
>  	struct fb_info *info;
>  	int ret;
> +	unsigned long val;
>  
>  	info = gxfb_init_fbinfo(&pdev->dev);
>  	if (!info)
> @@ -323,6 +324,15 @@ static int __init gxfb_probe(struct pci_
>  		goto err;
>  	}
>  
> +	/* Figure out if this is a TFT or CRT part */
> +
> +	rdmsrl(GLD_MSR_CONFIG, val);
> +
> +	if (val & GLD_MSR_CONFIG_FMT_FP)
> +		par->enable_crt = 0;
> +	else
> +		par->enable_crt = 1;
> +
>  	ret = fb_find_mode(&info->var, info, mode_option,
>  			   gx_modedb, ARRAY_SIZE(gx_modedb), NULL, 16);
>  	if (ret == 0 || ret == 4) {
> diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
> index 616ce33..e6a4c70 100644
> --- a/drivers/video/geode/video_gx.c
> +++ b/drivers/video/geode/video_gx.c
> @@ -175,10 +175,62 @@ static void gx_set_dclk_frequency(struct
>  	} while (timeout-- && !(dotpll & MSR_GLCP_DOTPLL_LOCK));
>  }
>  
> +static void
> +gx_configure_tft(struct fb_info *info) {
> +
> +	struct geodefb_par *par = info->par;
> +	unsigned long val;
> +	unsigned long fp;
> +
> +	/* Set up the DF pad select MSR */
> +
> +	rdmsrl(GX_VP_MSR_PAD_SELECT, val);
> +	val &= ~GX_VP_PAD_SELECT_MASK;
> +	val |= GX_VP_PAD_SELECT_TFT;
> +	wrmsrl(GX_VP_MSR_PAD_SELECT, val);
> +
> +	/* Turn off the panel */
> +
> +	fp = readl(par->vid_regs + GX_FP_PM);
> +	fp &= ~GX_FP_PM_P;
> +	writel(fp, par->vid_regs + GX_FP_PM);
> +
> +	/* Set timing 1 */
> +
> +	fp = readl(par->vid_regs + GX_FP_PT1);
> +	fp &= GX_FP_PT1_VSIZE_MASK;
> +	fp |= info->var.yres << GX_FP_PT1_VSIZE_SHIFT;
> +	writel(fp, par->vid_regs + GX_FP_PT1);
> +
> +	/* Timing 2 */
> +	/* Set bits that are always on for TFT */
> +
> +	fp = 0x0F100000;
> +
> +	/* Add sync polarity */
> +
> +	if (!(info->var.sync & FB_SYNC_VERT_HIGH_ACT))
> +		fp |= GX_FP_PT2_VSP;
> +
> +	if (!(info->var.sync & FB_SYNC_HOR_HIGH_ACT))
> +		fp |= GX_FP_PT2_HSP;
> +
> +	writel(fp, par->vid_regs + GX_FP_PT2);
> +
> +	/*  Set the dither control */
> +	writel(0x70, par->vid_regs + GX_FP_DFC);
> +
> +	/* Turn on the device */
> +
> +	fp = readl(par->vid_regs + GX_FP_PM);
> +	fp |= GX_FP_PM_P;
> +	writel(fp, par->vid_regs + GX_FP_PM);
> +}
> +
>  static void gx_configure_display(struct fb_info *info)
>  {
>  	struct geodefb_par *par = info->par;
> -	u32 dcfg, fp_pm, misc;
> +	u32 dcfg, misc;
>  
>  	/* Set up the MISC register */
>  
> @@ -222,11 +274,10 @@ static void gx_configure_display(struct
>  
>  	writel(dcfg, par->vid_regs + GX_DCFG);
>  
> -	/* Power on flat panel. */
> +	/* Set up the flat panel (if it is enabled) */
>  
> -	fp_pm = readl(par->vid_regs + GX_FP_PM);
> -	fp_pm |= GX_FP_PM_P;
> -	writel(fp_pm, par->vid_regs + GX_FP_PM);
> +	if (par->enable_crt == 0)
> +		gx_configure_tft(info);
>  }
>  
>  static int gx_blank_display(struct fb_info *info, int blank_mode)
> @@ -267,12 +318,15 @@ static int gx_blank_display(struct fb_in
>  	writel(dcfg, par->vid_regs + GX_DCFG);
>  
>  	/* Power on/off flat panel. */
> -	fp_pm = readl(par->vid_regs + GX_FP_PM);
> -	if (blank_mode == FB_BLANK_POWERDOWN)
> -		fp_pm &= ~GX_FP_PM_P;
> -	else
> -		fp_pm |= GX_FP_PM_P;
> -	writel(fp_pm, par->vid_regs + GX_FP_PM);
> +
> +	if (par->enable_crt == 0) {
> +		fp_pm = readl(par->vid_regs + GX_FP_PM);
> +		if (blank_mode == FB_BLANK_POWERDOWN)
> +			fp_pm &= ~GX_FP_PM_P;
> +		else
> +			fp_pm |= GX_FP_PM_P;
> +		writel(fp_pm, par->vid_regs + GX_FP_PM);
> +	}
>  
>  	return 0;
>  }
> diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
> index 238181a..8f1e85b 100644
> --- a/drivers/video/geode/video_gx.h
> +++ b/drivers/video/geode/video_gx.h
> @@ -13,6 +13,11 @@ #define __VIDEO_GX_H__
>  
>  extern struct geode_vid_ops gx_vid_ops;
>  
> +/* GX Flatpanel control MSR */
> +#define GX_VP_MSR_PAD_SELECT           0x2011
> +#define GX_VP_PAD_SELECT_MASK          0x3FFFFFFF
> +#define GX_VP_PAD_SELECT_TFT           0x1FFFFFFF
> +
>  /* Geode GX video processor registers */
>  
>  #define GX_DCFG		0x0008
> @@ -36,9 +41,20 @@ #define GX_MISC_DAC_PWRDN  0x00000400
>  #define GX_MISC_A_PWRDN    0x00000800
>  
>  /* Geode GX flat panel display control registers */
> +
> +#define GX_FP_PT1 0x0400
> +#define GX_FP_PT1_VSIZE_MASK 0x7FF0000
> +#define GX_FP_PT1_VSIZE_SHIFT 16
> +
> +#define GX_FP_PT2 0x408
> +#define GX_FP_PT2_VSP (1 << 23)
> +#define GX_FP_PT2_HSP (1 << 22)
> +
>  #define GX_FP_PM 0x410
>  #  define GX_FP_PM_P 0x01000000
>  
> +#define GX_FP_DFC 0x418
> +
>  /* Geode GX clock control MSRs */
>  
>  #define MSR_GLCP_SYS_RSTPLL	0x4c000014
> 
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/6] [PATCH] gxfb: Support command line options
  2006-11-28 23:15 ` [PATCH 4/6] [PATCH] gxfb: Support command line options Jordan Crouse
@ 2006-11-29 14:21   ` James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2006-11-29 14:21 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: info-linux, akpm


Acked-By: James Simmons <jsimmons@infradead.org>

On Tue, 28 Nov 2006, Jordan Crouse wrote:

> From: Jordan Crouse <jordan.crouse@amd.com>
> 
> Add support for command line options for setting the mode and various
> settings.
> 
> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
> ---
> 
>  drivers/video/geode/gxfb_core.c |   36 ++++++++++++++++++++++++++++++------
>  1 files changed, 30 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
> index ccc50fc..d404f56 100644
> --- a/drivers/video/geode/gxfb_core.c
> +++ b/drivers/video/geode/gxfb_core.c
> @@ -35,10 +35,10 @@ #include "geodefb.h"
>  #include "display_gx.h"
>  #include "video_gx.h"
>  
> -static char mode_option[32] = "640x480-16@60";
> +static char *mode_option;
>  
>  /* Modes relevant to the GX (taken from modedb.c) */
> -static const struct fb_videomode __initdata gx_modedb[] = {
> +static const struct fb_videomode gx_modedb[] __initdata = {
>  	/* 640x480-60 VESA */
>  	{ NULL, 60, 640, 480, 39682,  48, 16, 33, 10, 96, 2,
>  	  0, FB_VMODE_NONINTERLACED, FB_MODE_IS_VESA },
> @@ -341,7 +341,8 @@ static int __init gxfb_probe(struct pci_
>  		goto err;
>  	}
>  
> -        /* Clear the frame buffer of garbage. */
> +       
> +	/* Clear the frame buffer of garbage. */
>          memset_io(info->screen_base, 0, info->fix.smem_len);
>  
>  	gxfb_check_var(&info->var, info);
> @@ -411,11 +412,34 @@ static struct pci_driver gxfb_driver = {
>  	.remove		= gxfb_remove,
>  };
>  
> +#ifndef MODULE
> +static int __init gxfb_setup(char *options) {
> +
> +	char *opt;
> +
> +	if (!options || !*options)
> +		return 0;
> +
> +	while((opt = strsep(&options, ",")) != NULL) {
> +		if (!*opt)
> +			continue;
> +
> +		mode_option = opt;
> +	}
> +
> +	return 0;
> +}
> +#endif
> +
>  static int __init gxfb_init(void)
>  {
>  #ifndef MODULE
> -	if (fb_get_options("gxfb", NULL))
> +	char *option = NULL;
> +
> +	if (fb_get_options("gxfb", &option))
>  		return -ENODEV;
> +
> +	gxfb_setup(option);
>  #endif
>  	return pci_register_driver(&gxfb_driver);
>  }
> @@ -428,8 +452,8 @@ static void __exit gxfb_cleanup(void)
>  module_init(gxfb_init);
>  module_exit(gxfb_cleanup);
>  
> -module_param_string(mode, mode_option, sizeof(mode_option), 0444);
> -MODULE_PARM_DESC(mode, "video mode (<x>x<y>[-<bpp>][@<refr>])");
> +module_param(mode_option, charp, 0);
> +MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])");
>  
>  MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode GX");
>  MODULE_LICENSE("GPL");
> 
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/6] [PATCH] gxfb: Fixup flatpanel detection
  2006-11-28 23:15 ` [PATCH 5/6] [PATCH] gxfb: Fixup flatpanel detection Jordan Crouse
@ 2006-11-29 14:22   ` James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2006-11-29 14:22 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: info-linux, akpm



Acked-By: James Simmons <jsimmons@infradead.org>

On Tue, 28 Nov 2006, Jordan Crouse wrote:

> From: Jordan Crouse <jordan.crouse@amd.com>
> 
> Use the right MSR and bits to detect if the GX is strapped for TFT or CRT
> 
> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
> ---
> 
>  drivers/video/geode/display_gx.h |    2 +-
>  drivers/video/geode/gxfb_core.c  |    2 +-
>  drivers/video/geode/video_gx.h   |    2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/video/geode/display_gx.h b/drivers/video/geode/display_gx.h
> index ba0ccc8..0af33f3 100644
> --- a/drivers/video/geode/display_gx.h
> +++ b/drivers/video/geode/display_gx.h
> @@ -18,7 +18,7 @@ extern struct geode_dc_ops gx_dc_ops;
>  
>  /* MSR that tells us if a TFT or CRT is attached */
>  #define GLD_MSR_CONFIG   0xC0002001
> -#define GLD_MSR_CONFIG_FMT_FP 0x01
> +#define GLD_MSR_CONFIG_DM_FP 0x40
>  
>  /* Display controller registers */
>  
> diff --git a/drivers/video/geode/gxfb_core.c b/drivers/video/geode/gxfb_core.c
> index d404f56..83ab18a 100644
> --- a/drivers/video/geode/gxfb_core.c
> +++ b/drivers/video/geode/gxfb_core.c
> @@ -328,7 +328,7 @@ static int __init gxfb_probe(struct pci_
>  
>  	rdmsrl(GLD_MSR_CONFIG, val);
>  
> -	if (val & GLD_MSR_CONFIG_FMT_FP)
> +	if ((val & GLD_MSR_CONFIG_DM_FP) == GLD_MSR_CONFIG_DM_FP)
>  		par->enable_crt = 0;
>  	else
>  		par->enable_crt = 1;
> diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
> index 8f1e85b..119d0ab 100644
> --- a/drivers/video/geode/video_gx.h
> +++ b/drivers/video/geode/video_gx.h
> @@ -14,7 +14,7 @@ #define __VIDEO_GX_H__
>  extern struct geode_vid_ops gx_vid_ops;
>  
>  /* GX Flatpanel control MSR */
> -#define GX_VP_MSR_PAD_SELECT           0x2011
> +#define GX_VP_MSR_PAD_SELECT           0xC0002011
>  #define GX_VP_PAD_SELECT_MASK          0x3FFFFFFF
>  #define GX_VP_PAD_SELECT_TFT           0x1FFFFFFF
>  
> 
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 6/6] [PATCH] gxfb: Turn on the flatpanel power and data
  2006-11-28 23:15 ` [PATCH 6/6] [PATCH] gxfb: Turn on the flatpanel power and data Jordan Crouse
@ 2006-11-29 14:22   ` James Simmons
  0 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2006-11-29 14:22 UTC (permalink / raw)
  To: linux-fbdev-devel; +Cc: info-linux, akpm


Acked-By: James Simmons <jsimmons@infradead.org>


On Tue, 28 Nov 2006, Jordan Crouse wrote:

> From: Jordan Crouse <jordan.crouse@amd.com>
> 
> For Geode devices without a flatpanel aware BIOS, this enables the flatpanel
> power and data.
> 
> Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
> ---
> 
>  drivers/video/geode/video_gx.c |   13 +++++++++++--
>  drivers/video/geode/video_gx.h |    2 ++
>  2 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/geode/video_gx.c b/drivers/video/geode/video_gx.c
> index e6a4c70..ed6a174 100644
> --- a/drivers/video/geode/video_gx.c
> +++ b/drivers/video/geode/video_gx.c
> @@ -220,7 +220,13 @@ gx_configure_tft(struct fb_info *info) {
>  	/*  Set the dither control */
>  	writel(0x70, par->vid_regs + GX_FP_DFC);
>  
> -	/* Turn on the device */
> +	/* Enable the FP data and power (in case the BIOS didn't) */
> +
> +	fp = readl(par->vid_regs + GX_DCFG);
> +	fp |= GX_DCFG_FP_PWR_EN | GX_DCFG_FP_DATA_EN;
> +	writel(fp, par->vid_regs + GX_DCFG);
> +
> +	/* Unblank the panel */
>  
>  	fp = readl(par->vid_regs + GX_FP_PM);
>  	fp |= GX_FP_PM_P;
> @@ -245,9 +251,12 @@ static void gx_configure_display(struct
>  	writel(misc, par->vid_regs + GX_MISC);
>  
>  	/* Write the display configuration */
> -
>  	dcfg = readl(par->vid_regs + GX_DCFG);
>  
> +	/* Disable hsync and vsync */
> +	dcfg &= ~(GX_DCFG_VSYNC_EN | GX_DCFG_HSYNC_EN);
> +	writel(dcfg, par->vid_regs + GX_DCFG);
> +
>  	/* Clear bits from existing mode. */
>  	dcfg &= ~(GX_DCFG_CRT_SYNC_SKW_MASK
>  		  | GX_DCFG_CRT_HSYNC_POL   | GX_DCFG_CRT_VSYNC_POL
> diff --git a/drivers/video/geode/video_gx.h b/drivers/video/geode/video_gx.h
> index 119d0ab..ce28d8f 100644
> --- a/drivers/video/geode/video_gx.h
> +++ b/drivers/video/geode/video_gx.h
> @@ -25,6 +25,8 @@ #  define GX_DCFG_CRT_EN		0x00000001
>  #  define GX_DCFG_HSYNC_EN		0x00000002
>  #  define GX_DCFG_VSYNC_EN		0x00000004
>  #  define GX_DCFG_DAC_BL_EN		0x00000008
> +#  define GX_DCFG_FP_PWR_EN		0x00000040
> +#  define GX_DCFG_FP_DATA_EN		0x00000080
>  #  define GX_DCFG_CRT_HSYNC_POL		0x00000100
>  #  define GX_DCFG_CRT_VSYNC_POL		0x00000200
>  #  define GX_DCFG_CRT_SYNC_SKW_MASK	0x0001C000
> 
> 
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Linux-fbdev-devel mailing list
> Linux-fbdev-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel
> 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2006-11-29 14:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-28 23:06 [PATCH 0/6] Geode GX framebuffer patches Jordan Crouse
2006-11-28 23:14 ` [PATCH 1/6] FB: Get the Geode GX frambuffer size from the BIOS Jordan Crouse
2006-11-29 14:21   ` James Simmons
2006-11-28 23:14 ` [PATCH 2/6] [PATCH] gxfb: Fixups for the AMD Geode GX framebuffer driver Jordan Crouse
2006-11-29 14:21   ` James Simmons
2006-11-28 23:15 ` [PATCH 3/6] [PATCH] gxfb: Support flat panel timings Jordan Crouse
2006-11-29 14:21   ` James Simmons
2006-11-28 23:15 ` [PATCH 4/6] [PATCH] gxfb: Support command line options Jordan Crouse
2006-11-29 14:21   ` James Simmons
2006-11-28 23:15 ` [PATCH 5/6] [PATCH] gxfb: Fixup flatpanel detection Jordan Crouse
2006-11-29 14:22   ` James Simmons
2006-11-28 23:15 ` [PATCH 6/6] [PATCH] gxfb: Turn on the flatpanel power and data Jordan Crouse
2006-11-29 14:22   ` James Simmons
2006-11-29  0:10 ` [PATCH 0/6] Geode GX framebuffer patches Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).