aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2009-06-02 22:06:50 +0100
committerThomas White <taw@bitwiz.org.uk>2009-06-02 22:06:50 +0100
commit31f56d4cb19c8ba73bd2b5fba91ce7d626dc642e (patch)
tree74ddc4935f557a7a24f8b96c289f7839983d1172
parent740d8196e83bd7eaccf2f3575019a7bd96444c1d (diff)
Reorganise memory map (again)
This reuinites the "framebuffer" and "work" VRAM areas. With KMS, both roles will be done by one pool of memory. Signed-off-by: Thomas White <taw@bitwiz.org.uk>
-rw-r--r--drivers/mfd/glamo/glamo-cmdq.c2
-rw-r--r--drivers/mfd/glamo/glamo-core.c20
-rw-r--r--drivers/mfd/glamo/glamo-core.h13
-rw-r--r--drivers/mfd/glamo/glamo-drm-drv.c52
-rw-r--r--drivers/mfd/glamo/glamo-fb.c10
5 files changed, 40 insertions, 57 deletions
diff --git a/drivers/mfd/glamo/glamo-cmdq.c b/drivers/mfd/glamo/glamo-cmdq.c
index 199cb6cc170..f24d6814849 100644
--- a/drivers/mfd/glamo/glamo-cmdq.c
+++ b/drivers/mfd/glamo/glamo-cmdq.c
@@ -281,7 +281,7 @@ static int glamo_do_relocation(struct glamodrm_handle *gdrm,
goto fail;
}
- addr = GLAMO_OFFSET_WORK + gobj->block->start;
+ addr = GLAMO_OFFSET_FB + gobj->block->start;
addr_low = addr & 0xffff;
addr_high = (addr >> 16) & 0x7f;
printk(KERN_INFO "Addr low 0x%x, high 0x%x\n",
diff --git a/drivers/mfd/glamo/glamo-core.c b/drivers/mfd/glamo/glamo-core.c
index a485e34f748..075b9a05a0e 100644
--- a/drivers/mfd/glamo/glamo-core.c
+++ b/drivers/mfd/glamo/glamo-core.c
@@ -182,17 +182,17 @@ static struct resource glamo_cmdq_resources[] = {
.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,
- }, {
.name = "glamo-command-queue",
.start = GLAMO_MEM_BASE + GLAMO_OFFSET_CMDQ,
.end = GLAMO_MEM_BASE + GLAMO_OFFSET_CMDQ +
GLAMO_CMDQ_SIZE - 1,
.flags = IORESOURCE_MEM,
+ }, {
+ .name = "glamo-fb-mem",
+ .start = GLAMO_MEM_BASE + GLAMO_OFFSET_FB,
+ .end = GLAMO_MEM_BASE + GLAMO_OFFSET_FB +
+ GLAMO_FB_SIZE - 1,
+ .flags = IORESOURCE_MEM,
},
};
@@ -213,13 +213,7 @@ static struct resource glamo_fb_resources[] = {
.start = GLAMO_REGOFS_LCD,
.end = GLAMO_REGOFS_MMC - 1,
.flags = IORESOURCE_MEM,
- }, {
- .name = "glamo-fb-mem",
- .start = GLAMO_MEM_BASE + GLAMO_OFFSET_FB,
- .end = GLAMO_MEM_BASE + GLAMO_OFFSET_FB +
- GLAMO_FB_SIZE - 1,
- .flags = IORESOURCE_MEM,
- },
+ }
};
static struct platform_device glamo_fb_dev = {
diff --git a/drivers/mfd/glamo/glamo-core.h b/drivers/mfd/glamo/glamo-core.h
index 63390492141..4808ad72bb4 100644
--- a/drivers/mfd/glamo/glamo-core.h
+++ b/drivers/mfd/glamo/glamo-core.h
@@ -7,18 +7,19 @@
* sure we have sufficient memory for other functions of the chip */
/* FIXME: this should be autodetected */
#define GLAMO_INTERNAL_RAM_SIZE 0x800000
-/* A 640x480, 16bpp, double-buffered framebuffer */
-#define GLAMO_FB_SIZE (640 * 480 * 4) /* == 0x12c000 */
/* Arbitrarily determined amount for the hardware cursor */
#define GLAMO_CURSOR_SIZE (4096)
#define GLAMO_MMC_BUFFER_SIZE (64 * 1024) /* 64k MMC buffer */
#define GLAMO_CMDQ_SIZE (128 * 1024) /* 128k ring buffer */
/* Remaining memory will be used for 2D and 3D graphics */
-#define GLAMO_WORK_SIZE (GLAMO_INTERNAL_RAM_SIZE \
- - GLAMO_FB_SIZE \
+#define GLAMO_FB_SIZE (GLAMO_INTERNAL_RAM_SIZE \
- GLAMO_CURSOR_SIZE \
- GLAMO_MMC_BUFFER_SIZE \
- GLAMO_CMDQ_SIZE)
+/* A 640x480, 16bpp, double-buffered framebuffer */
+#if (GLAMO_FB_SIZE < (640 * 480 * 4)) /* == 0x12c000 */
+#error Not enough Glamo VRAM for framebuffer!
+#endif
/* 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
@@ -26,12 +27,10 @@
* 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_FB (0x000000)
#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-drm-drv.c b/drivers/mfd/glamo/glamo-drm-drv.c
index 5136263375b..a2303ce1d7e 100644
--- a/drivers/mfd/glamo/glamo-drm-drv.c
+++ b/drivers/mfd/glamo/glamo-drm-drv.c
@@ -229,33 +229,8 @@ static int glamodrm_probe(struct platform_device *pdev)
goto out_release_regs;
}
- /* Find the working VRAM */
- gdrm->vram = platform_get_resource(pdev, IORESOURCE_MEM, 1);
- if ( !gdrm->vram ) {
- dev_err(&pdev->dev, "Unable to find work VRAM.\n");
- rc = -ENOENT;
- goto out_unmap_regs;
- }
- gdrm->vram = request_mem_region(gdrm->vram->start,
- RESSIZE(gdrm->vram), pdev->name);
- if ( !gdrm->vram ) {
- dev_err(&pdev->dev, "failed to request VRAM region\n");
- rc = -ENOENT;
- goto out_unmap_regs;
- }
- gdrm->vram_base = ioremap(gdrm->vram->start, RESSIZE(gdrm->vram));
- if ( !gdrm->vram_base ) {
- dev_err(&pdev->dev, "failed to ioremap() VRAM\n");
- rc = -ENOENT;
- goto out_release_vram;
- }
-
- gdrm->vram_size = GLAMO_WORK_SIZE;
- printk(KERN_INFO "[glamo-drm] %lli bytes of Glamo RAM to work with\n",
- (long long int)gdrm->vram_size);
-
/* Find the command queue itself */
- gdrm->cmdq = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+ gdrm->cmdq = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if ( !gdrm->cmdq ) {
dev_err(&pdev->dev, "Unable to find command queue.\n");
rc = -ENOENT;
@@ -275,6 +250,31 @@ static int glamodrm_probe(struct platform_device *pdev)
goto out_release_cmdq;
}
+ /* Find the VRAM */
+ gdrm->vram = platform_get_resource(pdev, IORESOURCE_MEM, 2);
+ if ( !gdrm->vram ) {
+ dev_err(&pdev->dev, "Unable to find VRAM.\n");
+ rc = -ENOENT;
+ goto out_unmap_regs;
+ }
+ gdrm->vram = request_mem_region(gdrm->vram->start,
+ RESSIZE(gdrm->vram), pdev->name);
+ if ( !gdrm->vram ) {
+ dev_err(&pdev->dev, "failed to request VRAM region\n");
+ rc = -ENOENT;
+ goto out_unmap_regs;
+ }
+ gdrm->vram_base = ioremap(gdrm->vram->start, RESSIZE(gdrm->vram));
+ if ( !gdrm->vram_base ) {
+ dev_err(&pdev->dev, "failed to ioremap() VRAM\n");
+ rc = -ENOENT;
+ goto out_release_vram;
+ }
+
+ gdrm->vram_size = GLAMO_FB_SIZE;
+ printk(KERN_INFO "[glamo-drm] %lli bytes of VRAM\n",
+ (long long int)gdrm->vram_size);
+
/* Initialise DRM */
drm_platform_init(&glamodrm_drm_driver, pdev, (void *)gdrm);
diff --git a/drivers/mfd/glamo/glamo-fb.c b/drivers/mfd/glamo/glamo-fb.c
index 589b924b6bf..d9a610eeda4 100644
--- a/drivers/mfd/glamo/glamo-fb.c
+++ b/drivers/mfd/glamo/glamo-fb.c
@@ -995,16 +995,6 @@ 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,
- pdev->name);
- if (!glamofb->fb_res) {
- dev_err(&pdev->dev, "failed to request vram region\n");
- goto out_release_reg;
- }
/* we want to remap only the registers required for this core
* driver. */