OMAP2,3: DSS2: Use platform device to get baseaddr
authorSenthilvadivu Guruswamy <svadivu@ti.com>
Mon, 24 Jan 2011 06:22:04 +0000 (06:22 +0000)
committerTomi Valkeinen <tomi.valkeinen@ti.com>
Fri, 11 Mar 2011 13:46:21 +0000 (15:46 +0200)
DSS, DISPC, DSI, RFBI, VENC baseaddr can be obtained from platform_get_resource().
This API in turn picks the right silicon baseaddr from the hwmod database.
So hardcoding of base addr could be removed.

Reviewed-by: Paul Walmsley <paul@pwsan.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Sumit Semwal <sumit.semwal@ti.com>
Signed-off-by: Senthilvadivu Guruswamy <svadivu@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
drivers/video/omap2/dss/dispc.c
drivers/video/omap2/dss/dsi.c
drivers/video/omap2/dss/dss.c
drivers/video/omap2/dss/rfbi.c
drivers/video/omap2/dss/venc.c

index 032e5dd19e098b4c8fe42819a1675e303744a444..96e37f8e75dcd5d18e3a5de6e83849c3093a8542 100644 (file)
@@ -42,8 +42,6 @@
 #include "dss_features.h"
 
 /* DISPC */
-#define DISPC_BASE                     0x48050400
-
 #define DISPC_SZ_REGS                  SZ_4K
 
 struct dispc_reg { u16 idx; };
@@ -3324,6 +3322,8 @@ int dispc_setup_plane(enum omap_plane plane,
 static int omap_dispchw_probe(struct platform_device *pdev)
 {
        u32 rev;
+       struct resource *dispc_mem;
+
        dispc.pdev = pdev;
 
        spin_lock_init(&dispc.irq_lock);
@@ -3335,7 +3335,12 @@ static int omap_dispchw_probe(struct platform_device *pdev)
 
        INIT_WORK(&dispc.error_work, dispc_error_worker);
 
-       dispc.base = ioremap(DISPC_BASE, DISPC_SZ_REGS);
+       dispc_mem = platform_get_resource(dispc.pdev, IORESOURCE_MEM, 0);
+       if (!dispc_mem) {
+               DSSERR("can't get IORESOURCE_MEM DISPC\n");
+               return -EINVAL;
+       }
+       dispc.base = ioremap(dispc_mem->start, resource_size(dispc_mem));
        if (!dispc.base) {
                DSSERR("can't ioremap DISPC\n");
                return -ENOMEM;
index df246033b940383a9451903302bcfe08ec5811e2..c42acae10af015eef52dc005bcf72c4607a1376e 100644 (file)
@@ -42,8 +42,6 @@
 /*#define VERBOSE_IRQ*/
 #define DSI_CATCH_MISSING_TE
 
-#define DSI_BASE               0x4804FC00
-
 struct dsi_reg { u16 idx; };
 
 #define DSI_REG(idx)           ((const struct dsi_reg) { idx })
@@ -3257,6 +3255,7 @@ static int dsi_init(struct platform_device *pdev)
 {
        u32 rev;
        int r;
+       struct resource *dsi_mem;
 
        spin_lock_init(&dsi.errors_lock);
        dsi.errors = 0;
@@ -3283,7 +3282,13 @@ static int dsi_init(struct platform_device *pdev)
        dsi.te_timer.function = dsi_te_timeout;
        dsi.te_timer.data = 0;
 #endif
-       dsi.base = ioremap(DSI_BASE, DSI_SZ_REGS);
+       dsi_mem = platform_get_resource(dsi.pdev, IORESOURCE_MEM, 0);
+       if (!dsi_mem) {
+               DSSERR("can't get IORESOURCE_MEM DSI\n");
+               r = -EINVAL;
+               goto err1;
+       }
+       dsi.base = ioremap(dsi_mem->start, resource_size(dsi_mem));
        if (!dsi.base) {
                DSSERR("can't ioremap DSI\n");
                r = -ENOMEM;
index 72b395d69aaeb172d49819efa5b9c99d92374fb4..ee9ce4af58b53ea2e4f3ecea79a2bee415d7938a 100644 (file)
@@ -34,8 +34,6 @@
 #include <plat/clock.h>
 #include "dss.h"
 
-#define DSS_BASE                       0x48050000
-
 #define DSS_SZ_REGS                    SZ_512
 
 struct dss_reg {
@@ -567,8 +565,15 @@ static int dss_init(bool skip_init)
 {
        int r;
        u32 rev;
+       struct resource *dss_mem;
 
-       dss.base = ioremap(DSS_BASE, DSS_SZ_REGS);
+       dss_mem = platform_get_resource(dss.pdev, IORESOURCE_MEM, 0);
+       if (!dss_mem) {
+               DSSERR("can't get IORESOURCE_MEM DSS\n");
+               r = -EINVAL;
+               goto fail0;
+       }
+       dss.base = ioremap(dss_mem->start, resource_size(dss_mem));
        if (!dss.base) {
                DSSERR("can't ioremap DSS\n");
                r = -ENOMEM;
index 5f186484984fb57e414b4ba404190728b674736a..6dbb95d557f8b19ba6dd039dfa508498eef2378b 100644 (file)
@@ -36,8 +36,6 @@
 #include <plat/display.h>
 #include "dss.h"
 
-#define RFBI_BASE               0x48050800
-
 struct rfbi_reg { u16 idx; };
 
 #define RFBI_REG(idx)          ((const struct rfbi_reg) { idx })
@@ -1019,6 +1017,7 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
 {
        u32 rev;
        u32 l;
+       struct resource *rfbi_mem;
 
        rfbi.pdev = pdev;
 
@@ -1028,7 +1027,12 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
        atomic_set(&rfbi.cmd_fifo_full, 0);
        atomic_set(&rfbi.cmd_pending, 0);
 
-       rfbi.base = ioremap(RFBI_BASE, SZ_256);
+       rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0);
+       if (!rfbi_mem) {
+               DSSERR("can't get IORESOURCE_MEM RFBI\n");
+               return -EINVAL;
+       }
+       rfbi.base = ioremap(rfbi_mem->start, resource_size(rfbi_mem));
        if (!rfbi.base) {
                DSSERR("can't ioremap RFBI\n");
                return -ENOMEM;
index 4a02f8eeb0d882deea3f097ce7b7c02f6bd4215b..ef36811f6ac8bddf64bdba16b1c9938abcdf1c40 100644 (file)
@@ -39,8 +39,6 @@
 
 #include "dss.h"
 
-#define VENC_BASE      0x48050C00
-
 /* Venc registers */
 #define VENC_REV_ID                            0x00
 #define VENC_STATUS                            0x04
@@ -717,13 +715,20 @@ void venc_dump_regs(struct seq_file *s)
 static int omap_venchw_probe(struct platform_device *pdev)
 {
        u8 rev_id;
+       struct resource *venc_mem;
+
        venc.pdev = pdev;
 
        mutex_init(&venc.venc_lock);
 
        venc.wss_data = 0;
 
-       venc.base = ioremap(VENC_BASE, SZ_1K);
+       venc_mem = platform_get_resource(venc.pdev, IORESOURCE_MEM, 0);
+       if (!venc_mem) {
+               DSSERR("can't get IORESOURCE_MEM VENC\n");
+               return -EINVAL;
+       }
+       venc.base = ioremap(venc_mem->start, resource_size(venc_mem));
        if (!venc.base) {
                DSSERR("can't ioremap VENC\n");
                return -ENOMEM;