--- Begin Message ---
Author: werner
Date: 2008-01-15 12:12:21 +0100 (Tue, 15 Jan 2008)
New Revision: 3840
Modified:
branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
Log:
Applied "detect-glamo-irq-pullup.patch"
http://git.openmoko.org/?p=kernel.git;a=commit;h=c6be860fc5bb86ae5af7e26b61dba43566d43d3c
Runtime detection of if the glamo IRQ# line is blessed with a pullup or not
GTA-02 < A5 do not have it but can be reworked
Signed-off-by: Andy Green <[EMAIL PROTECTED]>
gta02-core.patch:
- arch/arm/mach-s3c2440/mach-gta02.c (mangle_glamo_res_by_system_rev): removed
mangling of interrupt resource for GTA02v4
smedia-glamo.patch:
- drivers/mfd/glamo/glamo-core.c (glamo_probe): added detection whether the
INT# line works or not
- drivers/mfd/glamo/glamo-core.h (struct glamo_core): added field "irq_works",
for INT# detection hack
Modified: branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
2008-01-15 11:04:28 UTC (rev 3839)
+++ branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
2008-01-15 11:12:21 UTC (rev 3840)
@@ -1,7 +1,7 @@
-Index: linux-2.6/arch/arm/mach-s3c2440/mach-gta02.c
+Index: linux-2.6.24-rc7/arch/arm/mach-s3c2440/mach-gta02.c
===================================================================
--- /dev/null
-+++ linux-2.6/arch/arm/mach-s3c2440/mach-gta02.c
++++ linux-2.6.24-rc7/arch/arm/mach-s3c2440/mach-gta02.c
@@ -0,0 +1,710 @@
+/*
+ * linux/arch/arm/mach-s3c2440/mach-gta02.c
@@ -619,7 +619,7 @@
+ case GTA02v1_SYSTEM_REV:
+ case GTA02v2_SYSTEM_REV:
+ case GTA02v3_SYSTEM_REV:
-+ case GTA02v4_SYSTEM_REV:
++ /* case GTA02v4_SYSTEM_REV: - FIXME: handle this later */
+ /* The hardware is missing a pull-up resistor and thus can't
+ * support the Smedia Glamo IRQ */
+ gta02_glamo_resources[1].start = 0;
@@ -713,10 +713,10 @@
+ .init_machine = gta02_machine_init,
+ .timer = &s3c24xx_timer,
+MACHINE_END
-Index: linux-2.6/include/asm-arm/arch-s3c2410/gta02.h
+Index: linux-2.6.24-rc7/include/asm-arm/arch-s3c2410/gta02.h
===================================================================
--- /dev/null
-+++ linux-2.6/include/asm-arm/arch-s3c2410/gta02.h
++++ linux-2.6.24-rc7/include/asm-arm/arch-s3c2410/gta02.h
@@ -0,0 +1,97 @@
+#ifndef _GTA02_H
+#define _GTA02_H
@@ -815,10 +815,10 @@
+#define GTA02v3_IRQ_nGSM_OC IRQ_EINT19 /* v3 + v4 only */
+
+#endif /* _GTA02_H */
-Index: linux-2.6/arch/arm/mach-s3c2440/Kconfig
+Index: linux-2.6.24-rc7/arch/arm/mach-s3c2440/Kconfig
===================================================================
---- linux-2.6.orig/arch/arm/mach-s3c2440/Kconfig
-+++ linux-2.6/arch/arm/mach-s3c2440/Kconfig
+--- linux-2.6.24-rc7.orig/arch/arm/mach-s3c2440/Kconfig
++++ linux-2.6.24-rc7/arch/arm/mach-s3c2440/Kconfig
@@ -74,5 +74,20 @@
help
Say Y here if you are using the FIC Neo1973 GSM Phone
@@ -840,19 +840,19 @@
+
endmenu
-Index: linux-2.6/arch/arm/mach-s3c2440/Makefile
+Index: linux-2.6.24-rc7/arch/arm/mach-s3c2440/Makefile
===================================================================
---- linux-2.6.orig/arch/arm/mach-s3c2440/Makefile
-+++ linux-2.6/arch/arm/mach-s3c2440/Makefile
+--- linux-2.6.24-rc7.orig/arch/arm/mach-s3c2440/Makefile
++++ linux-2.6.24-rc7/arch/arm/mach-s3c2440/Makefile
@@ -22,3 +22,4 @@
obj-$(CONFIG_ARCH_S3C2440) += mach-smdk2440.o
obj-$(CONFIG_MACH_NEXCODER_2440) += mach-nexcoder.o
obj-$(CONFIG_MACH_HXD8) += mach-hxd8.o
+obj-$(CONFIG_MACH_NEO1973_GTA02) += mach-gta02.o
-Index: linux-2.6/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
+Index: linux-2.6.24-rc7/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
===================================================================
---- linux-2.6.orig/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
-+++ linux-2.6/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
+--- linux-2.6.24-rc7.orig/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
++++ linux-2.6.24-rc7/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
@@ -19,7 +19,9 @@
#include <linux/pcf50606.h>
@@ -970,10 +970,10 @@
/* we pull reset to low to make sure that the chip doesn't
* drain power through the reset line */
s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
-Index: linux-2.6/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
+Index: linux-2.6.24-rc7/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
===================================================================
---- linux-2.6.orig/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
-+++ linux-2.6/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
+--- linux-2.6.24-rc7.orig/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
++++ linux-2.6.24-rc7/arch/arm/plat-s3c24xx/neo1973_pm_gsm.c
@@ -19,8 +19,14 @@
#include <linux/errno.h>
@@ -1082,10 +1082,10 @@
return sysfs_create_group(&pdev->dev.kobj, >a01_gsm_attr_group);
}
-Index: linux-2.6/drivers/leds/leds-neo1973-vibrator.c
+Index: linux-2.6.24-rc7/drivers/leds/leds-neo1973-vibrator.c
===================================================================
---- linux-2.6.orig/drivers/leds/leds-neo1973-vibrator.c
-+++ linux-2.6/drivers/leds/leds-neo1973-vibrator.c
+--- linux-2.6.24-rc7.orig/drivers/leds/leds-neo1973-vibrator.c
++++ linux-2.6.24-rc7/drivers/leds/leds-neo1973-vibrator.c
@@ -107,7 +107,7 @@
struct resource *r;
int rc;
@@ -1095,10 +1095,10 @@
return -EIO;
r = platform_get_resource(pdev, 0, 0);
-Index: linux-2.6/sound/soc/s3c24xx/neo1973_wm8753.c
+Index: linux-2.6.24-rc7/sound/soc/s3c24xx/neo1973_wm8753.c
===================================================================
---- linux-2.6.orig/sound/soc/s3c24xx/neo1973_wm8753.c
-+++ linux-2.6/sound/soc/s3c24xx/neo1973_wm8753.c
+--- linux-2.6.24-rc7.orig/sound/soc/s3c24xx/neo1973_wm8753.c
++++ linux-2.6.24-rc7/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -672,6 +672,12 @@
{
int ret;
Modified: branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
2008-01-15 11:04:28 UTC (rev 3839)
+++ branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
2008-01-15 11:12:21 UTC (rev 3840)
@@ -508,7 +508,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.24-rc7/drivers/mfd/glamo/glamo-core.c
-@@ -0,0 +1,1068 @@
+@@ -0,0 +1,1106 @@
+/* Smedia Glamo 336x/337x driver
+ *
+ * (C) 2007 by OpenMoko, Inc.
@@ -561,6 +561,14 @@
+#include "glamo-regs.h"
+#include "glamo-core.h"
+
++#ifndef UGLY_HACK_BE_GONE
++#ifdef CONFIG_MACH_NEO1973_GTA02
++#include <asm/arch/gpio.h>
++#include <asm/arch/regs-gpio.h>
++#include <asm/arch/regs-gpioj.h>
++#endif
++#endif /* UGLY_HACK_BE_GONE */
++
+#define RESSIZE(ressource) (((ressource)->end - (ressource)->start)+1)
+
+static struct glamo_core *glamo_handle;
@@ -1385,6 +1393,7 @@
+static int __init glamo_probe(struct platform_device *pdev)
+{
+ int rc, irq;
++ int count = 0;
+ struct glamo_core *glamo;
+
+ if (glamo_handle) {
@@ -1494,7 +1503,36 @@
+ set_irq_flags(irq, IRQF_VALID);
+ }
+
-+ if (!glamo->irq)
++#ifndef UGLY_HACK_BE_GONE
++ /*
++ * GTA-02 S-Media IRQs prior to A5 are broken due to a lack of
++ * a pullup on the INT# line. Check for the bad behaviour.
++ */
++ s3c2410_gpio_setpin(S3C2410_GPG4, 0);
++ s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_OUTP);
++ s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_INP);
++ /*
++ * we force it low ourselves for a moment and resume being input.
++ * If there is a pullup, it won't stay low for long. But if the
++ * level converter is there as on < A5 revision, the weak keeper
++ * on the input of the LC will hold the line low indefinitiely
++ */
++ do {
++ rc = s3c2410_gpio_getpin(S3C2410_GPG4);
++ } while ((!rc) && ((count++) < 10));
++
++ if (rc) { /* it got pulled back up, it's good */
++ dev_info(&glamo->pdev->dev, "Detected S-Media IRQ# pullup, "
++ "enabling interrupt\n");
++ glamo->irq_works = 1;
++ } else { /* Gah we can't work with this level converter */
++ dev_warn(&glamo->pdev->dev, "** Detected bad IRQ# circuit found"
++ " on pre-A5 GTA-02: S-Media interrupt disabled **\n");
++ glamo->irq_works = 0;
++ }
++#endif /* UGLY_HACK_BE_GONE */
++
++ if (!glamo->irq || !glamo->irq_works)
+ dev_warn(&glamo->pdev->dev, "No IRQ support on this
hardware!\n");
+ else {
+ dev_dbg(&glamo->pdev->dev, "chained\n");
@@ -2359,12 +2397,13 @@
===================================================================
--- /dev/null
+++ linux-2.6.24-rc7/drivers/mfd/glamo/glamo-core.h
-@@ -0,0 +1,53 @@
+@@ -0,0 +1,54 @@
+#ifndef __GLAMO_CORE_H
+#define __GLAMO_CORE_H
+
+struct glamo_core {
+ int irq;
++ int irq_works; /* 0 means PCB does not support Glamo IRQ - UGLY HACK */
+ struct resource *mem;
+ struct resource *mem_core;
+ void __iomem *base;
--- End Message ---
--- Begin Message ---
Author: werner
Date: 2008-01-15 21:01:51 +0100 (Tue, 15 Jan 2008)
New Revision: 3842
Modified:
branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
Log:
Applied r3788 and r3790 changes from 2.4.22.5 tree:
fbset-gta02-core.patch:
- arch/arm/mach-s3c2440/mach-gta02.c (gta02_glamo_pdata): increase maximum xres
from 480 to 640, to support rotation
- arch/arm/mach-s3c2440/mach-gta02.c (gta02_glamo_pdata): initialize
fb_mem_size to 4MB (half of the SRAM available on the chip)
fbset-smedia-glamo.patch:
- drivers/video/glamo/glamo-fb.c (GLAMO_LOG): added optional logging function
- drivers/video/glamo/glamo-fb.c (reg_set_bit_mask, rotate_lcd,
get_orientation, will_orientation_change): new helper functions for rotation
- drivers/video/glamo/glamo-fb.c (glamofb_activate_var): renamed to
glamofb_update_lcd_controller and added handling of rotation
- drivers/video/glamo/glamo-fb.c (glamofb_set_par): use
glamofb_update_lcd_controller instead of glamofb_activate_var
- drivers/video/glamo/glamo-regs.h: added rotation mode values
- include/linux/glamofb.h (struct glamofb_platform_data): new field fb_mem_size
for the allocated size of the frame buffer memory
- drivers/video/glamo/glamo-fb.c (GLAMO_FB_ALLOC, glamofb_probe): removed
RESSIZE(glamofb->fb_res). Allocation now comes from machine information.
- drivers/mfd/glamo/glamo-core.c (glamo_irq_demux_handler): fixed argument
mixup in call to desc_handle_irq
Modified: branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
2008-01-15 12:14:23 UTC (rev 3841)
+++ branches/src/target/kernel/2.6.24.x/patches/gta02-core.patch
2008-01-15 20:01:51 UTC (rev 3842)
@@ -2,7 +2,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.24-rc7/arch/arm/mach-s3c2440/mach-gta02.c
-@@ -0,0 +1,710 @@
+@@ -0,0 +1,711 @@
+/*
+ * linux/arch/arm/mach-s3c2440/mach-gta02.c
+ *
@@ -559,9 +559,10 @@
+ .lower_margin = 16,
+ .hsync_len = 8,
+ .vsync_len = 2,
++ .fb_mem_size = 0x400000, /* glamo has 8 megs of SRAM. we use 4 */
+ .xres = {
+ .min = 240,
-+ .max = 480,
++ .max = 640,
+ .defval = 480,
+ },
+ .yres = {
Modified: branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
===================================================================
--- branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
2008-01-15 12:14:23 UTC (rev 3841)
+++ branches/src/target/kernel/2.6.24.x/patches/smedia-glamo.patch
2008-01-15 20:01:51 UTC (rev 3842)
@@ -36,7 +36,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.24-rc7/drivers/mfd/glamo/glamo-regs.h
-@@ -0,0 +1,467 @@
+@@ -0,0 +1,477 @@
+#ifndef _GLAMO_REGS_H
+#define _GLAMO_REGS_H
+
@@ -470,6 +470,16 @@
+ GLAMO_LCD_MODE3_18BITS = 0x0040,
+};
+
++enum glamo_lcd_rot_mode {
++ GLAMO_LCD_ROT_MODE_0 = 0x0000,
++ GLAMO_LCD_ROT_MODE_180 = 0x2000,
++ GLAMO_LCD_ROT_MODE_MIRROR = 0x4000,
++ GLAMO_LCD_ROT_MODE_FLIP = 0x6000,
++ GLAMO_LCD_ROT_MODE_90 = 0x8000,
++ GLAMO_LCD_ROT_MODE_270 = 0xa000,
++};
++#define GLAMO_LCD_ROT_MODE_MASK 0xe000
++
+enum glamo_lcd_cmd_type {
+ GLAMO_LCD_CMD_TYPE_DISP = 0x0000,
+ GLAMO_LCD_CMD_TYPE_PARALLEL = 0x4000,
@@ -877,7 +887,7 @@
+ irqstatus = __reg_read(glamo_handle, GLAMO_REG_IRQ_STATUS);
+ for (i = 0; i < 9; i++)
+ if (irqstatus & (1 << i))
-+ desc_handle_irq(irq_desc+IRQ_GLAMO(i), desc);
++ desc_handle_irq(irq, irq_desc+IRQ_GLAMO(i));
+
+ } while ((desc->status & (IRQ_PENDING | IRQ_DISABLED)) == IRQ_PENDING);
+
@@ -1664,7 +1674,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.24-rc7/drivers/mfd/glamo/glamo-fb.c
-@@ -0,0 +1,658 @@
+@@ -0,0 +1,829 @@
+/* Smedia Glamo 336x/337x driver
+ *
+ * (C) 2007 by OpenMoko, Inc.
@@ -1719,6 +1729,17 @@
+#include "glamo-regs.h"
+#include "glamo-core.h"
+
++#ifdef DEBUG
++#define GLAMO_LOG(...)
++#else
++#define GLAMO_LOG(...) \
++do { \
++ printk(KERN_DEBUG "in %s:%s:%d", __FILE__, __func__, __LINE__); \
++ printk(KERN_DEBUG __VA_ARGS__); \
++} while (0);
++#endif
++
++
+#define RESSIZE(ressource) (((ressource)->end - (ressource)->start)+1)
+
+struct glamofb_handle {
@@ -1851,7 +1872,7 @@
+ case 32:
+ default:
+ /* The Smedia Glamo doesn't support anything but 16bit color */
-+ printk("Smedia driver doens't [yet?] support 24/32bpp\n");
++ printk("Smedia driver doesn't [yet?] support 24/32bpp\n");
+ return -EINVAL;
+ break;
+ }
@@ -1859,49 +1880,211 @@
+ return 0;
+}
+
-+static void glamofb_activate_var(struct glamofb_handle *glamo,
-+ struct fb_var_screeninfo *var)
++static void reg_set_bit_mask(struct glamofb_handle *glamo,
++ u_int16_t reg, u_int16_t mask,
++ u_int16_t val)
+{
-+ int sync, bp, disp, fp, total;
++ u_int16_t tmp;
+
++ val &= mask;
++
++ tmp = reg_read(glamo, reg);
++ tmp &= ~mask;
++ tmp |= val;
++ reg_write(glamo, reg, tmp);
++}
++
++#define GLAMO_LCD_WIDTH_MASK 0x03FF
++#define GLAMO_LCD_HEIGHT_MASK 0x03FF
++#define GLAMO_LCD_PITCH_MASK 0x07FE
++#define GLAMO_LCD_HV_TOTAL_MASK 0x03FF
++#define GLAMO_LCD_HV_RETR_START_MASK 0x03FF
++#define GLAMO_LCD_HV_RETR_END_MASK 0x03FF
++#define GLAMO_LCD_HV_RETR_DISP_START_MASK 0x03FF
++#define GLAMO_LCD_HV_RETR_DISP_END_MASK 0x03FF
++
++enum orientation {
++ ORIENTATION_PORTRAIT,
++ ORIENTATION_LANDSCAPE
++};
++
++
++static void rotate_lcd(struct glamofb_handle *glamo,
++ __u32 rotation)
++{
++ int glamo_rot;
++
++ switch (rotation) {
++ case FB_ROTATE_UR:
++ glamo_rot = GLAMO_LCD_ROT_MODE_0;
++ break;
++ case FB_ROTATE_CW:
++ glamo_rot = GLAMO_LCD_ROT_MODE_90;
++ break;
++ case FB_ROTATE_UD:
++ glamo_rot = GLAMO_LCD_ROT_MODE_180;
++ break;
++ case FB_ROTATE_CCW:
++ glamo_rot = GLAMO_LCD_ROT_MODE_270;
++ break;
++ default:
++ glamo_rot = GLAMO_LCD_ROT_MODE_0;
++ break;
++ }
+ glamofb_cmd_mode(glamo, 1);
++ reg_set_bit_mask(glamo,
++ GLAMO_REG_LCD_WIDTH,
++ GLAMO_LCD_ROT_MODE_MASK,
++ glamo_rot);
++ reg_set_bit_mask(glamo,
++ GLAMO_REG_LCD_MODE1,
++ GLAMO_LCD_MODE1_ROTATE_EN,
++ (glamo_rot != GLAMO_LCD_ROT_MODE_0)?
++ GLAMO_LCD_MODE1_ROTATE_EN : 0);
++ glamofb_cmd_mode(glamo, 0);
++}
+
++static enum orientation get_orientation(struct fb_var_screeninfo *var)
++{
++ GLAMO_LOG("mark\n")
++ if (var->xres <= var->yres) {
++ GLAMO_LOG("portrait\n")
++ return ORIENTATION_PORTRAIT;
++ }
++ GLAMO_LOG("landscape\n")
++ return ORIENTATION_LANDSCAPE;
++}
++
++static int will_orientation_change(struct fb_var_screeninfo *var)
++{
++ enum orientation orient = get_orientation(var);
++ switch (orient) {
++ case ORIENTATION_LANDSCAPE:
++ if (var->rotate == FB_ROTATE_UR || var->rotate ==
FB_ROTATE_UD)
++ return 1;
++ break;
++ case ORIENTATION_PORTRAIT:
++ if (var->rotate == FB_ROTATE_CW || var->rotate ==
FB_ROTATE_CCW)
++ return 1;
++ break;
++ }
++ return 0;
++}
++
++static void glamofb_update_lcd_controller(struct glamofb_handle *glamo,
++ struct fb_var_screeninfo *var)
++{
++ int sync, bp, disp, fp, total, xres, yres, pitch, orientation_changing;
++
++ GLAMO_LOG("enter: glamo:%#x, var:%#x\n", (unsigned)glamo,
(unsigned)var);
++ if (!glamo || !var)
++ return;
++
++ glamofb_cmd_mode(glamo, 1);
++
+ if (var->pixclock)
+ glamo_engine_reclock(glamo->mach_info->glamo,
+ GLAMO_ENGINE_LCD,
+ var->pixclock);
+
-+ /* XXX highest bits of the following two regs have other meanings */
-+ reg_write(glamo, GLAMO_REG_LCD_WIDTH, var->xres);
-+ reg_write(glamo, GLAMO_REG_LCD_HEIGHT, var->yres);
-+ reg_write(glamo, GLAMO_REG_LCD_PITCH,
-+ (var->xres * var->bits_per_pixel) / 8);
++ xres = var->xres;
++ yres = var->yres;
++ GLAMO_LOG("xres:%d, yres:%d, rotate:%d\n", xres, yres, var->rotate);
+
++ /*
++ * figure out if orientation is going to change
++ */
++ orientation_changing = will_orientation_change(var);
++ GLAMO_LOG("orientation_changing:%d\n", orientation_changing);
++
++ /*
++ * adjust the pitch according to new orientation to come
++ */
++ if (orientation_changing) {
++ pitch = var->yres * var->bits_per_pixel / 8;
++ } else {
++ pitch = var->xres * var->bits_per_pixel / 8;
++ }
++ GLAMO_LOG("pitch:%d\n", pitch);
++
++ /*
++ * set the awaiten LCD geometry
++ */
++ reg_set_bit_mask(glamo,
++ GLAMO_REG_LCD_WIDTH,
++ GLAMO_LCD_WIDTH_MASK,
++ xres);
++ reg_set_bit_mask(glamo,
++ GLAMO_REG_LCD_HEIGHT,
++ GLAMO_LCD_HEIGHT_MASK,
++ yres);
++ reg_set_bit_mask(glamo,
++ GLAMO_REG_LCD_PITCH,
++ GLAMO_LCD_PITCH_MASK,
++ pitch);
++
++ GLAMO_LOG("mark:\n");
++ /*
++ * honour the rotation request
++ */
++ rotate_lcd(glamo, var->rotate);
++
++ /*
++ * update the reported geometry
++ * of the framebuffer.
++ */
++ if (orientation_changing) {
++ var->xres_virtual = var->xres = yres;
++ var->yres_virtual = var->yres = xres;
++ } else {
++ var->xres_virtual = var->xres = xres;
++ var->yres_virtual = var->yres = yres;
++ }
++
++ GLAMO_LOG("reported res:(%d,%d)\n", var->xres, var->yres);
++ /*
++ * update scannout timings
++ */
+ sync = 0;
+ bp = sync + var->hsync_len;
+ disp = bp + var->left_margin;
-+ fp = disp + var->xres;
++ fp = disp + xres;
+ total = fp + var->right_margin;
+
-+ reg_write(glamo, GLAMO_REG_LCD_HORIZ_TOTAL, total);
-+ reg_write(glamo, GLAMO_REG_LCD_HORIZ_RETR_START, sync);
-+ reg_write(glamo, GLAMO_REG_LCD_HORIZ_RETR_END, bp);
-+ reg_write(glamo, GLAMO_REG_LCD_HORIZ_DISP_START, disp);
-+ reg_write(glamo, GLAMO_REG_LCD_HORIZ_DISP_END, fp);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_TOTAL,
++ GLAMO_LCD_HV_TOTAL_MASK, total);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_RETR_START,
++ GLAMO_LCD_HV_RETR_START_MASK, sync);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_RETR_END,
++ GLAMO_LCD_HV_RETR_END_MASK, bp);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_DISP_START,
++ GLAMO_LCD_HV_RETR_DISP_START_MASK, disp);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_HORIZ_DISP_END,
++ GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
+
++ GLAMO_LOG("mark:\n");
++
+ sync = 0;
+ bp = sync + var->vsync_len;
+ disp = bp + var->upper_margin;
-+ fp = disp + var->yres;
++ fp = disp + yres;
+ total = fp + var->lower_margin;
+
-+ reg_write(glamo, GLAMO_REG_LCD_VERT_TOTAL, total);
-+ reg_write(glamo, GLAMO_REG_LCD_VERT_RETR_START, sync);
-+ reg_write(glamo, GLAMO_REG_LCD_VERT_RETR_END, bp);
-+ reg_write(glamo, GLAMO_REG_LCD_VERT_DISP_START, disp);
-+ reg_write(glamo, GLAMO_REG_LCD_VERT_DISP_END, fp);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_TOTAL,
++ GLAMO_LCD_HV_TOTAL_MASK, total);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_RETR_START,
++ GLAMO_LCD_HV_RETR_START_MASK, sync);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_RETR_END,
++ GLAMO_LCD_HV_RETR_END_MASK, bp);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_DISP_START,
++ GLAMO_LCD_HV_RETR_DISP_START_MASK, disp);
++ reg_set_bit_mask(glamo, GLAMO_REG_LCD_VERT_DISP_END,
++ GLAMO_LCD_HV_RETR_DISP_END_MASK, fp);
+
++ GLAMO_LOG("mark:\n");
+ glamofb_cmd_mode(glamo, 0);
++
++ GLAMO_LOG("leave:\n");
+}
+
+static int glamofb_set_par(struct fb_info *info)
@@ -1914,14 +2097,13 @@
+ info->fix.visual = FB_VISUAL_TRUECOLOR;
+ break;
+ default:
-+ printk("Smedia driver doens't support != 16bpp\n");
++ printk("Smedia driver doesn't support != 16bpp\n");
+ return -EINVAL;
+ }
+
+ info->fix.line_length = (var->xres * var->bits_per_pixel) / 8;
-+ info->fix.smem_len = info->fix.line_length * var->yres_virtual;
+
-+ glamofb_activate_var(glamo, var);
++ glamofb_update_lcd_controller(glamo, var);
+
+ return 0;
+}
@@ -2163,7 +2345,8 @@
+ }
+
+ glamofb->fb_res = request_mem_region(glamofb->fb_res->start,
-+ RESSIZE(glamofb->fb_res),
pdev->name);
++ mach_info->fb_mem_size,
++ pdev->name);
+ if (!glamofb->fb_res) {
+ dev_err(&pdev->dev, "failed to request vram region\n");
+ goto out_release_reg;
@@ -2177,7 +2360,7 @@
+ goto out_release_fb;
+ }
+ fbinfo->fix.smem_start = (unsigned long) glamofb->fb_res->start;
-+ fbinfo->fix.smem_len = RESSIZE(glamofb->fb_res);
++ fbinfo->fix.smem_len = mach_info->fb_mem_size;
+
+ fbinfo->screen_base = ioremap(glamofb->fb_res->start,
+ RESSIZE(glamofb->fb_res));
@@ -2223,9 +2406,7 @@
+ fbinfo->var.hsync_len = mach_info->hsync_len;
+ fbinfo->var.vsync_len = mach_info->vsync_len;
+
-+ memset(fbinfo->screen_base, 0, mach_info->xres.max *
-+ mach_info->yres.max *
-+ mach_info->bpp.max / 8);
++ memset(fbinfo->screen_base, 0, fbinfo->fix.smem_len);
+
+ glamo_engine_enable(mach_info->glamo, GLAMO_ENGINE_LCD);
+ glamo_engine_reset(mach_info->glamo, GLAMO_ENGINE_LCD);
@@ -2327,7 +2508,7 @@
===================================================================
--- /dev/null
+++ linux-2.6.24-rc7/include/linux/glamofb.h
-@@ -0,0 +1,33 @@
+@@ -0,0 +1,34 @@
+#ifndef _LINUX_GLAMOFB_H
+#define _LINUX_GLAMOFB_H
+
@@ -2347,6 +2528,7 @@
+ int left_margin, right_margin;
+ int upper_margin, lower_margin;
+ int hsync_len, vsync_len;
++ int fb_mem_size;
+
+ struct glamofb_val xres;
+ struct glamofb_val yres;
--- End Message ---