[PATCH 1/3] glamo: set the end address of resouces correctly

Chia-I Wu olv at openmoko.com
Mon Oct 1 15:57:55 CEST 2007


The end address of resouces should be minus by one.  This patch also fixes a
typo where glamo-3d uses glamo-2d's resources.
---
 arch/arm/mach-s3c2440/mach-gta02.c |    2 +-
 drivers/video/glamo/glamo-core.c   |   18 +++++++++---------
 drivers/video/glamo/glamo-regs.h   |    1 +
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 453a20e..e8eb0bb 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -575,7 +575,7 @@ static struct glamofb_platform_data gta02_glamo_pdata = {
 static struct resource gta02_glamo_resources[] = {
 	[0] = {
 		.start	= S3C2410_CS1,
-		.end	= S3C2410_CS1 + 0x1000000,
+		.end	= S3C2410_CS1 + 0x1000000 - 1,
 		.flags	= IORESOURCE_MEM,
 	},
 	[1] = {
diff --git a/drivers/video/glamo/glamo-core.c b/drivers/video/glamo/glamo-core.c
index bd8e1e1..b6bdd3f 100644
--- a/drivers/video/glamo/glamo-core.c
+++ b/drivers/video/glamo/glamo-core.c
@@ -150,7 +150,7 @@ static struct resource glamo_mmc_resources[] = {
 	{
 		/* FIXME: those need to be incremented by parent base */
 		.start	= GLAMO_REGOFS_MMC,
-		.end	= GLAMO_REGOFS_MMC + 0x100,
+		.end	= GLAMO_REGOFS_MPROC0 - 1,
 		.flags	= IORESOURCE_MEM
 	}, {
 		.start	= IRQ_GLAMO_MMC,
@@ -168,7 +168,7 @@ static struct platform_device glamo_mmc_dev = {
 static struct resource glamo_jpeg_resources[] = {
 	{
 		.start	= GLAMO_REGOFS_JPEG,
-		.end	= GLAMO_REGOFS_MPEG,
+		.end	= GLAMO_REGOFS_MPEG - 1,
 		.flags	= IORESOURCE_MEM,
 	}, {
 		.start	= IRQ_GLAMO_JPEG,
@@ -186,7 +186,7 @@ static struct platform_device glamo_jpeg_dev = {
 static struct resource glamo_mpeg_resources[] = {
 	{
 		.start	= GLAMO_REGOFS_MPEG,
-		.end	= GLAMO_REGOFS_LCD,
+		.end	= GLAMO_REGOFS_LCD - 1,
 		.flags	= IORESOURCE_MEM,
 	}, {
 		.start	= IRQ_GLAMO_MPEG,
@@ -204,7 +204,7 @@ static struct platform_device glamo_mpeg_dev = {
 static struct resource glamo_2d_resources[] = {
 	{
 		.start	= GLAMO_REGOFS_2D,
-		.end	= GLAMO_REGOFS_3D,
+		.end	= GLAMO_REGOFS_3D - 1,
 		.flags	= IORESOURCE_MEM,
 	}, {
 		.start	= IRQ_GLAMO_2D,
@@ -222,15 +222,15 @@ static struct platform_device glamo_2d_dev = {
 static struct resource glamo_3d_resources[] = {
 	{
 		.start	= GLAMO_REGOFS_3D,
-		.end	= GLAMO_REGOFS_3D + 0x600,
+		.end	= GLAMO_REGOFS_END - 1,
 		.flags	= IORESOURCE_MEM,
 	},
 };
 
 static struct platform_device glamo_3d_dev = {
 	.name		= "glamo-3d",
-	.resource	= glamo_2d_resources,
-	.num_resources	= ARRAY_SIZE(glamo_2d_resources),
+	.resource	= glamo_3d_resources,
+	.num_resources	= ARRAY_SIZE(glamo_3d_resources),
 };
 
 static struct platform_device glamo_spigpio_dev = {
@@ -253,12 +253,12 @@ static struct resource glamo_fb_resources[] = {
 	{
 		.name	= "glamo-fb-regs",
 		.start	= GLAMO_REGOFS_LCD,
-		.end	= GLAMO_REGOFS_LCD + 0x100,
+		.end	= GLAMO_REGOFS_MMC - 1,
 		.flags	= IORESOURCE_MEM,
 	}, {
 		.name	= "glamo-fb-mem",
 		.start	= GLAMO_OFFSET_FB,
-		.end	= GLAMO_OFFSET_FB + GLAMO_FB_SIZE,
+		.end	= GLAMO_OFFSET_FB + GLAMO_FB_SIZE - 1,
 		.flags	= IORESOURCE_MEM,
 	},
 };
diff --git a/drivers/video/glamo/glamo-regs.h b/drivers/video/glamo/glamo-regs.h
index c4bc985..90a5a82 100644
--- a/drivers/video/glamo/glamo-regs.h
+++ b/drivers/video/glamo/glamo-regs.h
@@ -39,6 +39,7 @@ enum glamo_regster_offsets {
 	GLAMO_REGOFS_RISC	= 0x1680,
 	GLAMO_REGOFS_2D		= 0x1700,
 	GLAMO_REGOFS_3D		= 0x1b00,
+	GLAMO_REGOFS_END	= 0x2400,
 };
 
 
-- 
1.5.3.1





More information about the openmoko-kernel mailing list