Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com --- vgasrc/geodevga.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c index c2dabf5..ef840a4 100644 --- a/vgasrc/geodevga.c +++ b/vgasrc/geodevga.c @@ -140,7 +140,7 @@ static u32 geode_fp_read(int reg) { u32 val = geode_mem_read(GET_GLOBAL(GeodeVP) + VP_FP_START + reg); dprintf(4, "%s(0x%08x) = 0x%08x\n" - , __func__, GET_GLOBAL(GeodeVP) + reg, val); + , __func__, GET_GLOBAL(GeodeVP) + VP_FP_START + reg, val); return val; }
@@ -148,7 +148,7 @@ static void geode_fp_write(int reg, u32 val) { dprintf(4, "%s(0x%08x, 0x%08x)\n" , __func__, GET_GLOBAL(GeodeVP) + VP_FP_START + reg, val); - geode_mem_mask(GET_GLOBAL(GeodeVP) + reg, ~0, val); + geode_mem_mask(GET_GLOBAL(GeodeVP) + VP_FP_START + reg, ~0, val); }
/****************************************************************
Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com --- vgasrc/geodevga.c | 2 +- vgasrc/geodevga.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c index 42e2eeb..e508cbd 100644 --- a/vgasrc/geodevga.c +++ b/vgasrc/geodevga.c @@ -258,7 +258,7 @@ static void dc_setup(void) geode_dc_write(DC_CURS_ST_OFFSET, 0x0);
geode_dc_mask(DC_DISPLAY_CFG, ~DC_CFG_MSK, DC_DISPLAY_CFG_GDEN|DC_DISPLAY_CFG_TRUP); - geode_dc_write(DC_GENERAL_CFG, DC_DISPLAY_CFG_VGAE); + geode_dc_write(DC_GENERAL_CFG, DC_GENERAL_CFG_VGAE);
geode_dc_write(DC_UNLOCK, DC_LOCK_LOCK); } diff --git a/vgasrc/geodevga.h b/vgasrc/geodevga.h index 180bd05..067b4f8 100644 --- a/vgasrc/geodevga.h +++ b/vgasrc/geodevga.h @@ -65,7 +65,7 @@
/* DC bits */ -#define DC_DISPLAY_CFG_VGAE (1 << 7) +#define DC_GENERAL_CFG_VGAE (1 << 7) #define DC_DISPLAY_CFG_GDEN (1 << 3) #define DC_DISPLAY_CFG_TRUP (1 << 6)
Framebuffer setup has nothing to do with dc_setup(..) so move it to geodevga_init(..).
Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com --- vgasrc/geodevga.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c index ef840a4..e96698c 100644 --- a/vgasrc/geodevga.c +++ b/vgasrc/geodevga.c @@ -218,22 +218,10 @@ static void dc_setup(void) geode_dc_write(DC_CB_ST_OFFSET, 0x0); geode_dc_write(DC_CURS_ST_OFFSET, 0x0);
- /* read fb-bar from pci, then point dc to the fb base */ - u32 fb = GET_GLOBAL(GeodeFB); - if (geode_dc_read(DC_GLIU0_MEM_OFFSET) != fb) - geode_dc_write(DC_GLIU0_MEM_OFFSET, fb); - geode_dc_mask(DC_DISPLAY_CFG, ~DC_CFG_MSK, DC_DISPLAY_CFG_GDEN|DC_DISPLAY_CFG_TRUP); geode_dc_write(DC_GENERAL_CFG, DC_DISPLAY_CFG_VGAE);
geode_dc_write(DC_UNLOCK, DC_LOCK_LOCK); - - u32 fb_size = framebuffer_size(); // in byte - dprintf(1, "%d KB of video memory at 0x%08x\n", fb_size / 1024, fb); - - /* update VBE variables */ - SET_VGA(VBE_framebuffer, fb); - SET_VGA(VBE_total_memory, fb_size / 1024 / 64); // number of 64K blocks }
/* Setup the vp (video processor) portion of the geodelx @@ -408,6 +396,23 @@ int geodevga_setup(void) dprintf(1, "dc addr: 0x%08x\n", GET_GLOBAL(GeodeDC)); dprintf(1, "vp addr: 0x%08x\n", GET_GLOBAL(GeodeVP));
+ /* setup framebuffer */ + geode_dc_write(DC_UNLOCK, DC_LOCK_UNLOCK); + + /* read fb-bar from pci, then point dc to the fb base */ + u32 fb = GET_GLOBAL(GeodeFB); + if (geode_dc_read(DC_GLIU0_MEM_OFFSET) != fb) + geode_dc_write(DC_GLIU0_MEM_OFFSET, fb); + + geode_dc_write(DC_UNLOCK, DC_LOCK_LOCK); + + u32 fb_size = framebuffer_size(); // in byte + dprintf(1, "%d KB of video memory at 0x%08x\n", fb_size / 1024, fb); + + /* update VBE variables */ + SET_VGA(VBE_framebuffer, fb); + SET_VGA(VBE_total_memory, fb_size / 1024 / 64); // number of 64K blocks + vp_setup(); dc_setup();
Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com --- vgasrc/geodevga.c | 64 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 29 deletions(-)
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c index e96698c..50216b6 100644 --- a/vgasrc/geodevga.c +++ b/vgasrc/geodevga.c @@ -204,6 +204,38 @@ static u32 framebuffer_size(void) * Init Functions ****************************************************************/
+static void geodevga_set_output_mode(void) +{ + u64 msr_addr; + u64 msr; + + /* set output to crt and RGB/YUV */ + if (CONFIG_VGA_GEODEGX2) + msr_addr = VP_MSR_CONFIG_GX2; + else + msr_addr = VP_MSR_CONFIG_LX; + + /* set output mode (RGB/YUV) */ + msr = geode_msr_read(msr_addr); + msr &= ~VP_MSR_CONFIG_FMT; // mask out FMT (bits 5:3) + + if (CONFIG_VGA_OUTPUT_PANEL || CONFIG_VGA_OUTPUT_CRT_PANEL) { + msr |= VP_MSR_CONFIG_FMT_FP; // flat panel + + if (CONFIG_VGA_OUTPUT_CRT_PANEL) { + msr |= VP_MSR_CONFIG_FPC; // simultaneous Flat Panel and CRT + dprintf(1, "output: simultaneous Flat Panel and CRT\n"); + } else { + msr &= ~VP_MSR_CONFIG_FPC; // no simultaneous Flat Panel and CRT + dprintf(1, "ouput: flat panel\n"); + } + } else { + msr |= VP_MSR_CONFIG_FMT_CRT; // CRT only + dprintf(1, "output: CRT\n"); + } + geode_msr_mask(msr_addr, ~msr, msr); +} + /* Set up the dc (display controller) portion of the geodelx * The dc provides hardware support for VGA graphics. */ @@ -232,37 +264,9 @@ static void dc_setup(void) */ static void vp_setup(void) { - u32 msr_addr; - u64 msr; - dprintf(2,"VP_SETUP\n");
- /* set output to crt and RGB/YUV */ - if (CONFIG_VGA_GEODEGX2) - msr_addr = VP_MSR_CONFIG_GX2; - else - msr_addr = VP_MSR_CONFIG_LX; - - /* set output mode (RGB/YUV) */ - msr = geode_msr_read(msr_addr); - msr &= ~VP_MSR_CONFIG_FMT; // mask out FMT (bits 5:3) - - if (CONFIG_VGA_OUTPUT_PANEL || CONFIG_VGA_OUTPUT_CRT_PANEL) { - msr |= VP_MSR_CONFIG_FMT_FP; // flat panel - - if (CONFIG_VGA_OUTPUT_CRT_PANEL) { - msr |= VP_MSR_CONFIG_FPC; // simultaneous Flat Panel and CRT - dprintf(1, "output: simultaneous Flat Panel and CRT\n"); - } else { - msr &= ~VP_MSR_CONFIG_FPC; // no simultaneous Flat Panel and CRT - dprintf(1, "ouput: flat panel\n"); - } - } else { - msr |= VP_MSR_CONFIG_FMT_CRT; // CRT only - dprintf(1, "output: CRT\n"); - } - geode_msr_mask(msr_addr, ~msr, msr); - + geodevga_set_output_mode();
/* Set mmio registers * there may be some timing issues here, the reads seem @@ -283,6 +287,8 @@ static void vp_setup(void)
/* setup flat panel */ if (CONFIG_VGA_OUTPUT_PANEL || CONFIG_VGA_OUTPUT_CRT_PANEL) { + u64 msr; + dprintf(1, "Setting up flat panel\n"); /* write timing register */ geode_fp_write(FP_PT1, 0x0);
Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com --- vgasrc/geodevga.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c index 50216b6..42e2eeb 100644 --- a/vgasrc/geodevga.c +++ b/vgasrc/geodevga.c @@ -33,6 +33,9 @@ static u64 geode_msr_read(u32 msrAddr) : "c"(msrAddr) : "cc" ); + + dprintf(4, "%s(0x%08x) = 0x%08x-0x%08x\n" + , __func__, msrAddr, val.hi, val.lo); return val.val; }
@@ -41,6 +44,10 @@ static void geode_msr_mask(u32 msrAddr, u64 off, u64 on) union u64_u32_u uand, uor; uand.val = ~off; uor.val = on; + + dprintf(4, "%s(0x%08x, 0x%016llx, 0x%016llx)\n" + , __func__, msrAddr, off, on); + asm __volatile__ ( "push %%eax \n" "movw $0x0AC1C, %%dx \n"
Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com --- vgasrc/geodevga.c | 2 +- vgasrc/geodevga.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/vgasrc/geodevga.c b/vgasrc/geodevga.c index 42e2eeb..e508cbd 100644 --- a/vgasrc/geodevga.c +++ b/vgasrc/geodevga.c @@ -258,7 +258,7 @@ static void dc_setup(void) geode_dc_write(DC_CURS_ST_OFFSET, 0x0);
geode_dc_mask(DC_DISPLAY_CFG, ~DC_CFG_MSK, DC_DISPLAY_CFG_GDEN|DC_DISPLAY_CFG_TRUP); - geode_dc_write(DC_GENERAL_CFG, DC_DISPLAY_CFG_VGAE); + geode_dc_write(DC_GENERAL_CFG, DC_GENERAL_CFG_VGAE);
geode_dc_write(DC_UNLOCK, DC_LOCK_LOCK); } diff --git a/vgasrc/geodevga.h b/vgasrc/geodevga.h index 180bd05..067b4f8 100644 --- a/vgasrc/geodevga.h +++ b/vgasrc/geodevga.h @@ -65,7 +65,7 @@
/* DC bits */ -#define DC_DISPLAY_CFG_VGAE (1 << 7) +#define DC_GENERAL_CFG_VGAE (1 << 7) #define DC_DISPLAY_CFG_GDEN (1 << 3) #define DC_DISPLAY_CFG_TRUP (1 << 6)
On Thu, Feb 14, 2013 at 10:34:32AM +0100, Christian Gmeiner wrote:
Signed-off-by: Christian Gmeiner christian.gmeiner@gmail.com
Thanks. I committed this series.
-Kevin