From 947c48086623d9ca2207dd0434bd58458af4ba86 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 27 Sep 2012 10:38:18 -0300 Subject: [media] omap3isp: Replace cpu_is_omap3630() with ISP revision check Drivers must not rely on cpu_is_omap* macros (they will soon become private). Use the ISP revision instead to identify the hardware. Signed-off-by: Laurent Pinchart Acked-by: Tony Lindgren Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/omap3isp/isp.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'drivers/media/platform/omap3isp') diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index d7aa513dcc8d..6034dca63404 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -1345,10 +1345,7 @@ static int isp_enable_clocks(struct isp_device *isp) * has to be twice of what is set on OMAP3430 to get * the required value for cam_mclk */ - if (cpu_is_omap3630()) - divisor = 1; - else - divisor = 2; + divisor = isp->revision == ISP_REVISION_15_0 ? 1 : 2; r = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); if (r) { @@ -2093,7 +2090,11 @@ static int __devinit isp_probe(struct platform_device *pdev) isp->isp_csiphy1.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY1"); isp->isp_csiphy2.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY2"); - /* Clocks */ + /* Clocks + * + * The ISP clock tree is revision-dependent. We thus need to enable ICLK + * manually to read the revision before calling __omap3isp_get(). + */ ret = isp_map_mem_resource(pdev, isp, OMAP3_ISP_IOMEM_MAIN); if (ret < 0) goto error; @@ -2102,6 +2103,16 @@ static int __devinit isp_probe(struct platform_device *pdev) if (ret < 0) goto error; + ret = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); + if (ret < 0) + goto error; + + isp->revision = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); + dev_info(isp->dev, "Revision %d.%d found\n", + (isp->revision & 0xf0) >> 4, isp->revision & 0x0f); + + clk_disable(isp->clock[ISP_CLK_CAM_ICK]); + if (__omap3isp_get(isp, false) == NULL) { ret = -ENODEV; goto error; @@ -2112,10 +2123,6 @@ static int __devinit isp_probe(struct platform_device *pdev) goto error_isp; /* Memory resources */ - isp->revision = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); - dev_info(isp->dev, "Revision %d.%d found\n", - (isp->revision & 0xf0) >> 4, isp->revision & 0x0f); - for (m = 0; m < ARRAY_SIZE(isp_res_maps); m++) if (isp->revision == isp_res_maps[m].isp_rev) break; -- cgit v1.2.3 From 8a18382c3196978164f0f6290aac98f2f6f43c00 Mon Sep 17 00:00:00 2001 From: Ido Yariv Date: Mon, 1 Oct 2012 18:46:27 -0300 Subject: [media] omap3isp: Fix compilation error in ispreg.h Commit c49f34bc ("ARM: OMAP2+ Move SoC specific headers to be local to mach-omap2") moved omap34xx.h to mach-omap2. This broke omap3isp, as it includes omap34xx.h. Instead of moving omap34xx to platform_data, simply add the two definitions the driver needs and remove the include altogether. Signed-off-by: Ido Yariv Acked-by: Tony Lindgren Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/omap3isp/ispreg.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/media/platform/omap3isp') diff --git a/drivers/media/platform/omap3isp/ispreg.h b/drivers/media/platform/omap3isp/ispreg.h index 084ea77d65a7..e2c57f334c5d 100644 --- a/drivers/media/platform/omap3isp/ispreg.h +++ b/drivers/media/platform/omap3isp/ispreg.h @@ -27,13 +27,13 @@ #ifndef OMAP3_ISP_REG_H #define OMAP3_ISP_REG_H -#include - - #define CM_CAM_MCLK_HZ 172800000 /* Hz */ /* ISP Submodules offset */ +#define L4_34XX_BASE 0x48000000 +#define OMAP3430_ISP_BASE (L4_34XX_BASE + 0xBC000) + #define OMAP3ISP_REG_BASE OMAP3430_ISP_BASE #define OMAP3ISP_REG(offset) (OMAP3ISP_REG_BASE + (offset)) -- cgit v1.2.3 From d6d022e7382343b57184c83f5fea0532be240b98 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Tue, 9 Oct 2012 19:28:00 -0300 Subject: Revert "[media] omap3isp: Replace cpu_is_omap3630() with ISP revision check" Reverted, as requested by Laurent: I don't consider it as being ready yet, as Sakari pointed out we need to investigate whether the right fix shouldn't be at the OMAP3 clocks level instead. This reverts commit 947c48086623d9ca2207dd0434bd58458af4ba86. Requested-by: Laurent Pinchart Cc: Tony Lindgren Signed-off-by: Mauro Carvalho Chehab --- drivers/media/platform/omap3isp/isp.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'drivers/media/platform/omap3isp') diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c index 6034dca63404..d7aa513dcc8d 100644 --- a/drivers/media/platform/omap3isp/isp.c +++ b/drivers/media/platform/omap3isp/isp.c @@ -1345,7 +1345,10 @@ static int isp_enable_clocks(struct isp_device *isp) * has to be twice of what is set on OMAP3430 to get * the required value for cam_mclk */ - divisor = isp->revision == ISP_REVISION_15_0 ? 1 : 2; + if (cpu_is_omap3630()) + divisor = 1; + else + divisor = 2; r = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); if (r) { @@ -2090,11 +2093,7 @@ static int __devinit isp_probe(struct platform_device *pdev) isp->isp_csiphy1.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY1"); isp->isp_csiphy2.vdd = regulator_get(&pdev->dev, "VDD_CSIPHY2"); - /* Clocks - * - * The ISP clock tree is revision-dependent. We thus need to enable ICLK - * manually to read the revision before calling __omap3isp_get(). - */ + /* Clocks */ ret = isp_map_mem_resource(pdev, isp, OMAP3_ISP_IOMEM_MAIN); if (ret < 0) goto error; @@ -2103,16 +2102,6 @@ static int __devinit isp_probe(struct platform_device *pdev) if (ret < 0) goto error; - ret = clk_enable(isp->clock[ISP_CLK_CAM_ICK]); - if (ret < 0) - goto error; - - isp->revision = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); - dev_info(isp->dev, "Revision %d.%d found\n", - (isp->revision & 0xf0) >> 4, isp->revision & 0x0f); - - clk_disable(isp->clock[ISP_CLK_CAM_ICK]); - if (__omap3isp_get(isp, false) == NULL) { ret = -ENODEV; goto error; @@ -2123,6 +2112,10 @@ static int __devinit isp_probe(struct platform_device *pdev) goto error_isp; /* Memory resources */ + isp->revision = isp_reg_readl(isp, OMAP3_ISP_IOMEM_MAIN, ISP_REVISION); + dev_info(isp->dev, "Revision %d.%d found\n", + (isp->revision & 0xf0) >> 4, isp->revision & 0x0f); + for (m = 0; m < ARRAY_SIZE(isp_res_maps); m++) if (isp->revision == isp_res_maps[m].isp_rev) break; -- cgit v1.2.3