aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-s3c2442/mach-gta02.c3
-rw-r--r--drivers/mfd/glamo/glamo-core.c34
-rw-r--r--drivers/mfd/glamo/glamo-core.h34
-rw-r--r--drivers/mfd/glamo/glamo-fb.c8
4 files changed, 64 insertions, 15 deletions
diff --git a/arch/arm/mach-s3c2442/mach-gta02.c b/arch/arm/mach-s3c2442/mach-gta02.c
index e1f8b9b2fd6..d469d033afd 100644
--- a/arch/arm/mach-s3c2442/mach-gta02.c
+++ b/arch/arm/mach-s3c2442/mach-gta02.c
@@ -1397,7 +1397,8 @@ static struct glamofb_platform_data gta02_glamo_pdata = {
.lower_margin = 16,
.hsync_len = 8,
.vsync_len = 2,
- .fb_mem_size = 0x400000, /* glamo has 8 megs of SRAM. we use 4 */
+ //.fb_mem_size = 0x400000, /* glamo has 8 megs of SRAM. we use 4 */
+ .fb_mem_size = 0x12c000, /* 640 x 480 x 4 = 1200 kiB */
.xres = {
.min = 240,
.max = 640,
diff --git a/drivers/mfd/glamo/glamo-core.c b/drivers/mfd/glamo/glamo-core.c
index 28dc1f309ac..506e7e6ab41 100644
--- a/drivers/mfd/glamo/glamo-core.c
+++ b/drivers/mfd/glamo/glamo-core.c
@@ -175,6 +175,25 @@ static inline void glamo_vmem_read(struct glamo_core *glamo, u_int16_t *buf,
/***********************************************************************
* resources of sibling devices
***********************************************************************/
+static struct resource glamo_cmdq_resources[] = {
+ {
+ .start = GLAMO_REGOFS_CMDQUEUE,
+ .end = GLAMO_REGOFS_RISC - 1,
+ .flags = IORESOURCE_MEM,
+ }, {
+ .name = "glamo-work-mem",
+ .start = GLAMO_MEM_BASE + GLAMO_OFFSET_WORK,
+ .end = GLAMO_MEM_BASE + GLAMO_OFFSET_WORK +
+ GLAMO_WORK_SIZE - 1,
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+static struct platform_device glamo_cmdq_dev = {
+ .name = "glamo-cmdq",
+ .resource = glamo_cmdq_resources,
+ .num_resources = ARRAY_SIZE(glamo_cmdq_resources),
+};
#if 0
static struct resource glamo_core_resources[] = {
@@ -277,8 +296,9 @@ static struct resource glamo_fb_resources[] = {
.flags = IORESOURCE_MEM,
}, {
.name = "glamo-fb-mem",
- .start = GLAMO_OFFSET_FB,
- .end = GLAMO_OFFSET_FB + GLAMO_FB_SIZE - 1,
+ .start = GLAMO_MEM_BASE + GLAMO_OFFSET_FB,
+ .end = GLAMO_MEM_BASE + GLAMO_OFFSET_FB +
+ GLAMO_FB_SIZE - 1,
.flags = IORESOURCE_MEM,
},
};
@@ -300,9 +320,9 @@ static struct resource glamo_mmc_resources[] = {
.end = IRQ_GLAMO_MMC,
.flags = IORESOURCE_IRQ,
}, { /* our data buffer for MMC transfers */
- .start = GLAMO_OFFSET_FB + GLAMO_FB_SIZE,
- .end = GLAMO_OFFSET_FB + GLAMO_FB_SIZE +
- GLAMO_MMC_BUFFER_SIZE - 1,
+ .start = GLAMO_MEM_BASE + GLAMO_OFFSET_MMC,
+ .end = GLAMO_MEM_BASE + GLAMO_OFFSET_MMC +
+ GLAMO_MMC_BUFFER_SIZE - 1,
.flags = IORESOURCE_MEM
},
};
@@ -1308,6 +1328,10 @@ static int __init glamo_probe(struct platform_device *pdev)
glamo->pdata->glamo_irq_is_wired;
/* start creating the siblings */
+ glamo_cmdq_dev.dev.parent = &pdev->dev;
+ mangle_mem_resources(glamo_cmdq_dev.resource,
+ glamo_cmdq_dev.num_resources, glamo->mem);
+ platform_device_register(&glamo_cmdq_dev);
glamo_2d_dev.dev.parent = &pdev->dev;
mangle_mem_resources(glamo_2d_dev.resource,
diff --git a/drivers/mfd/glamo/glamo-core.h b/drivers/mfd/glamo/glamo-core.h
index 8e09564bc3f..f7062cddf70 100644
--- a/drivers/mfd/glamo/glamo-core.h
+++ b/drivers/mfd/glamo/glamo-core.h
@@ -3,18 +3,34 @@
#include <asm/system.h>
-/* for the time being, we put the on-screen framebuffer into the lowest
- * VRAM space. This should make the code easily compatible with the various
- * 2MB/4MB/8MB variants of the Smedia chips */
-#define GLAMO_OFFSET_VRAM 0x800000
-#define GLAMO_OFFSET_FB (GLAMO_OFFSET_VRAM)
-
/* we only allocate the minimum possible size for the framebuffer to make
* sure we have sufficient memory for other functions of the chip */
-//#define GLAMO_FB_SIZE (640*480*4) /* == 0x12c000 */
+/* FIXME: this should be autodetected */
#define GLAMO_INTERNAL_RAM_SIZE 0x800000
-#define GLAMO_MMC_BUFFER_SIZE (64 * 1024)
-#define GLAMO_FB_SIZE (GLAMO_INTERNAL_RAM_SIZE - GLAMO_MMC_BUFFER_SIZE)
+#define GLAMO_MMC_BUFFER_SIZE (64 * 1024) /* 64k MMC buffer */
+/* A 640x480, 16bpp, double-buffered framebuffer */
+#define GLAMO_FB_SIZE (640 * 480 * 4) /* == 0x12c000 */
+#define GLAMO_CMDQ_SIZE (128 * 1024) /* 128k ring buffer */
+/* Arbitrarily determined amount for the hardware cursor */
+#define GLAMO_CURSOR_SIZE (4096)
+/* Remaining memory will be used for 2D and 3D graphics */
+#define GLAMO_WORK_SIZE (GLAMO_INTERNAL_RAM_SIZE - GLAMO_FB_SIZE \
+ - GLAMO_CURSOR_SIZE \
+ - GLAMO_MMC_BUFFER_SIZE \
+ - GLAMO_CMDQ_SIZE)
+
+/* for the time being, we put the on-screen framebuffer into the lowest
+ * VRAM space. This should make the code easily compatible with the various
+ * 2MB/4MB/8MB variants of the Smedia chips
+ * glamo-fb.c assumes FB comes first, followed by cursor, so DON'T MOVE THEM
+ * (see glamo_regs[] in glamo-fb.c for more information) */
+#define GLAMO_MEM_BASE (0x800000)
+#define GLAMO_OFFSET_VRAM (0x000000)
+#define GLAMO_OFFSET_FB (GLAMO_OFFSET_VRAM)
+#define GLAMO_OFFSET_CURSOR (GLAMO_OFFSET_FB + GLAMO_FB_SIZE)
+#define GLAMO_OFFSET_MMC (GLAMO_OFFSET_CURSOR + GLAMO_CURSOR_SIZE)
+#define GLAMO_OFFSET_CMDQ (GLAMO_OFFSET_MMC + GLAMO_MMC_BUFFER_SIZE)
+#define GLAMO_OFFSET_WORK (GLAMO_OFFSET_CMDQ + GLAMO_CMDQ_SIZE)
struct glamo_core {
int irq;
diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
index 4eb81a508e5..77725a370e9 100644
--- a/drivers/mfd/glamo/glamo-fb.c
+++ b/drivers/mfd/glamo/glamo-fb.c
@@ -595,6 +595,12 @@ static int glamofb_cursor(struct fb_info *info, struct fb_cursor *cursor)
struct glamofb_handle *glamo = info->par;
unsigned long flags;
+ /* Reject if the cursor is too big to fit in the memory allocated in
+ * glamo-core.h */
+
+ if ((cursor->image.width * cursor->image.height) > GLAMO_CURSOR_SIZE )
+ return -EINVAL;
+
spin_lock_irqsave(&glamo->lock_cmd, flags);
reg_write(glamo, GLAMO_REG_LCD_CURSOR_X_SIZE,
@@ -847,6 +853,8 @@ static int __init glamofb_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "failed to request mmio region\n");
goto out_free;
}
+ if (mach_info->fb_mem_size != RESSIZE(glamofb->fb_res))
+ dev_warn(&pdev->dev, "different vram sizes\n");
glamofb->fb_res = request_mem_region(glamofb->fb_res->start,
mach_info->fb_mem_size,