aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSakari Ailus <sakari.ailus@iki.fi>2015-03-25 18:57:34 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 15:44:18 -0400
commit503596a15225e00bdf24f0805567d5195f6c749f (patch)
treec585caa89010913c60191839f714c7d541ba1341
parent4fcfeca833c48e8cb899ae9cff31de481ae52ca2 (diff)
[media] omap3isp: Move the syscon register out of the ISP register maps
The syscon register isn't part of the ISP, use it through the syscom driver regmap instead. The syscom block is considered to be from 343x on ISP revision 2.0 whereas 15.0 is assumed to have 3630 syscon. Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--arch/arm/mach-omap2/devices.c10
-rw-r--r--drivers/media/platform/Kconfig1
-rw-r--r--drivers/media/platform/omap3isp/isp.c20
-rw-r--r--drivers/media/platform/omap3isp/isp.h19
-rw-r--r--drivers/media/platform/omap3isp/ispcsiphy.c20
5 files changed, 43 insertions, 27 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1afb50d6d636..e945957c1604 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -143,16 +143,6 @@ static struct resource omap3isp_resources[] = {
143 .flags = IORESOURCE_MEM, 143 .flags = IORESOURCE_MEM,
144 }, 144 },
145 { 145 {
146 .start = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE,
147 .end = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE + 3,
148 .flags = IORESOURCE_MEM,
149 },
150 {
151 .start = OMAP343X_CTRL_BASE + OMAP3630_CONTROL_CAMERA_PHY_CTRL,
152 .end = OMAP343X_CTRL_BASE + OMAP3630_CONTROL_CAMERA_PHY_CTRL + 3,
153 .flags = IORESOURCE_MEM,
154 },
155 {
156 .start = 24 + OMAP_INTC_START, 146 .start = 24 + OMAP_INTC_START,
157 .flags = IORESOURCE_IRQ, 147 .flags = IORESOURCE_IRQ,
158 } 148 }
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 2e30be55d17a..272dc8c40f57 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -90,6 +90,7 @@ config VIDEO_OMAP3
90 select ARM_DMA_USE_IOMMU 90 select ARM_DMA_USE_IOMMU
91 select OMAP_IOMMU 91 select OMAP_IOMMU
92 select VIDEOBUF2_DMA_CONTIG 92 select VIDEOBUF2_DMA_CONTIG
93 select MFD_SYSCON
93 ---help--- 94 ---help---
94 Driver for an OMAP 3 camera controller. 95 Driver for an OMAP 3 camera controller.
95 96
diff --git a/drivers/media/platform/omap3isp/isp.c b/drivers/media/platform/omap3isp/isp.c
index 68d7edfc6553..83b4368380cf 100644
--- a/drivers/media/platform/omap3isp/isp.c
+++ b/drivers/media/platform/omap3isp/isp.c
@@ -51,6 +51,7 @@
51#include <linux/dma-mapping.h> 51#include <linux/dma-mapping.h>
52#include <linux/i2c.h> 52#include <linux/i2c.h>
53#include <linux/interrupt.h> 53#include <linux/interrupt.h>
54#include <linux/mfd/syscon.h>
54#include <linux/module.h> 55#include <linux/module.h>
55#include <linux/omap-iommu.h> 56#include <linux/omap-iommu.h>
56#include <linux/platform_device.h> 57#include <linux/platform_device.h>
@@ -94,8 +95,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
94 1 << OMAP3_ISP_IOMEM_RESZ | 95 1 << OMAP3_ISP_IOMEM_RESZ |
95 1 << OMAP3_ISP_IOMEM_SBL | 96 1 << OMAP3_ISP_IOMEM_SBL |
96 1 << OMAP3_ISP_IOMEM_CSI2A_REGS1 | 97 1 << OMAP3_ISP_IOMEM_CSI2A_REGS1 |
97 1 << OMAP3_ISP_IOMEM_CSIPHY2 | 98 1 << OMAP3_ISP_IOMEM_CSIPHY2,
98 1 << OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, 99 .syscon_offset = 0xdc,
100 .phy_type = ISP_PHY_TYPE_3430,
99 }, 101 },
100 { 102 {
101 .isp_rev = ISP_REVISION_15_0, 103 .isp_rev = ISP_REVISION_15_0,
@@ -112,8 +114,9 @@ static const struct isp_res_mapping isp_res_maps[] = {
112 1 << OMAP3_ISP_IOMEM_CSI2A_REGS2 | 114 1 << OMAP3_ISP_IOMEM_CSI2A_REGS2 |
113 1 << OMAP3_ISP_IOMEM_CSI2C_REGS1 | 115 1 << OMAP3_ISP_IOMEM_CSI2C_REGS1 |
114 1 << OMAP3_ISP_IOMEM_CSIPHY1 | 116 1 << OMAP3_ISP_IOMEM_CSIPHY1 |
115 1 << OMAP3_ISP_IOMEM_CSI2C_REGS2 | 117 1 << OMAP3_ISP_IOMEM_CSI2C_REGS2,
116 1 << OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, 118 .syscon_offset = 0x2f0,
119 .phy_type = ISP_PHY_TYPE_3630,
117 }, 120 },
118}; 121};
119 122
@@ -2352,6 +2355,15 @@ static int isp_probe(struct platform_device *pdev)
2352 } 2355 }
2353 } 2356 }
2354 2357
2358 isp->syscon = syscon_regmap_lookup_by_pdevname("syscon.0");
2359 if (IS_ERR(isp->syscon)) {
2360 ret = PTR_ERR(isp->syscon);
2361 goto error_isp;
2362 }
2363
2364 isp->syscon_offset = isp_res_maps[m].syscon_offset;
2365 isp->phy_type = isp_res_maps[m].phy_type;
2366
2355 /* IOMMU */ 2367 /* IOMMU */
2356 ret = isp_attach_iommu(isp); 2368 ret = isp_attach_iommu(isp);
2357 if (ret < 0) { 2369 if (ret < 0) {
diff --git a/drivers/media/platform/omap3isp/isp.h b/drivers/media/platform/omap3isp/isp.h
index 9535524a21f6..03d21298c1f5 100644
--- a/drivers/media/platform/omap3isp/isp.h
+++ b/drivers/media/platform/omap3isp/isp.h
@@ -59,8 +59,6 @@ enum isp_mem_resources {
59 OMAP3_ISP_IOMEM_CSI2C_REGS1, 59 OMAP3_ISP_IOMEM_CSI2C_REGS1,
60 OMAP3_ISP_IOMEM_CSIPHY1, 60 OMAP3_ISP_IOMEM_CSIPHY1,
61 OMAP3_ISP_IOMEM_CSI2C_REGS2, 61 OMAP3_ISP_IOMEM_CSI2C_REGS2,
62 OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE,
63 OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL,
64 OMAP3_ISP_IOMEM_LAST 62 OMAP3_ISP_IOMEM_LAST
65}; 63};
66 64
@@ -93,14 +91,25 @@ enum isp_subclk_resource {
93/* ISP2P: OMAP 36xx */ 91/* ISP2P: OMAP 36xx */
94#define ISP_REVISION_15_0 0xF0 92#define ISP_REVISION_15_0 0xF0
95 93
94#define ISP_PHY_TYPE_3430 0
95#define ISP_PHY_TYPE_3630 1
96
97struct regmap;
98
96/* 99/*
97 * struct isp_res_mapping - Map ISP io resources to ISP revision. 100 * struct isp_res_mapping - Map ISP io resources to ISP revision.
98 * @isp_rev: ISP_REVISION_x_x 101 * @isp_rev: ISP_REVISION_x_x
99 * @map: bitmap for enum isp_mem_resources 102 * @map: bitmap for enum isp_mem_resources
103 * @syscon_offset: offset of the syscon register for 343x / 3630
104 * (CONTROL_CSIRXFE / CONTROL_CAMERA_PHY_CTRL, respectively)
105 * from the syscon base address
106 * @phy_type: ISP_PHY_TYPE_{3430,3630}
100 */ 107 */
101struct isp_res_mapping { 108struct isp_res_mapping {
102 u32 isp_rev; 109 u32 isp_rev;
103 u32 map; 110 u32 map;
111 u32 syscon_offset;
112 u32 phy_type;
104}; 113};
105 114
106/* 115/*
@@ -140,6 +149,9 @@ struct isp_xclk {
140 * regions. 149 * regions.
141 * @mmio_hist_base_phys: Physical L4 bus address for ISP hist block register 150 * @mmio_hist_base_phys: Physical L4 bus address for ISP hist block register
142 * region. 151 * region.
152 * @syscon: Regmap for the syscon register space
153 * @syscon_offset: Offset of the CSIPHY control register in syscon
154 * @phy_type: ISP_PHY_TYPE_{3430,3630}
143 * @mapping: IOMMU mapping 155 * @mapping: IOMMU mapping
144 * @stat_lock: Spinlock for handling statistics 156 * @stat_lock: Spinlock for handling statistics
145 * @isp_mutex: Mutex for serializing requests to ISP. 157 * @isp_mutex: Mutex for serializing requests to ISP.
@@ -176,6 +188,9 @@ struct isp_device {
176 188
177 void __iomem *mmio_base[OMAP3_ISP_IOMEM_LAST]; 189 void __iomem *mmio_base[OMAP3_ISP_IOMEM_LAST];
178 unsigned long mmio_hist_base_phys; 190 unsigned long mmio_hist_base_phys;
191 struct regmap *syscon;
192 u32 syscon_offset;
193 u32 phy_type;
179 194
180 struct dma_iommu_mapping *mapping; 195 struct dma_iommu_mapping *mapping;
181 196
diff --git a/drivers/media/platform/omap3isp/ispcsiphy.c b/drivers/media/platform/omap3isp/ispcsiphy.c
index 4486e9f492df..d91dde19eb14 100644
--- a/drivers/media/platform/omap3isp/ispcsiphy.c
+++ b/drivers/media/platform/omap3isp/ispcsiphy.c
@@ -16,6 +16,7 @@
16 16
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/regmap.h>
19#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
20 21
21#include "isp.h" 22#include "isp.h"
@@ -26,10 +27,11 @@ static void csiphy_routing_cfg_3630(struct isp_csiphy *phy,
26 enum isp_interface_type iface, 27 enum isp_interface_type iface,
27 bool ccp2_strobe) 28 bool ccp2_strobe)
28{ 29{
29 u32 reg = isp_reg_readl( 30 u32 reg;
30 phy->isp, OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, 0);
31 u32 shift, mode; 31 u32 shift, mode;
32 32
33 regmap_read(phy->isp->syscon, phy->isp->syscon_offset, &reg);
34
33 switch (iface) { 35 switch (iface) {
34 default: 36 default:
35 /* Should not happen in practice, but let's keep the compiler happy. */ 37 /* Should not happen in practice, but let's keep the compiler happy. */
@@ -63,8 +65,7 @@ static void csiphy_routing_cfg_3630(struct isp_csiphy *phy,
63 reg &= ~(OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_MASK << shift); 65 reg &= ~(OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_MASK << shift);
64 reg |= mode << shift; 66 reg |= mode << shift;
65 67
66 isp_reg_writel(phy->isp, reg, 68 regmap_write(phy->isp->syscon, phy->isp->syscon_offset, reg);
67 OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, 0);
68} 69}
69 70
70static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on, 71static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
@@ -78,16 +79,14 @@ static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on,
78 return; 79 return;
79 80
80 if (!on) { 81 if (!on) {
81 isp_reg_writel(phy->isp, 0, 82 regmap_write(phy->isp->syscon, phy->isp->syscon_offset, 0);
82 OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, 0);
83 return; 83 return;
84 } 84 }
85 85
86 if (ccp2_strobe) 86 if (ccp2_strobe)
87 csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM; 87 csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM;
88 88
89 isp_reg_writel(phy->isp, csirxfe, 89 regmap_write(phy->isp->syscon, phy->isp->syscon_offset, csirxfe);
90 OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, 0);
91} 90}
92 91
93/* 92/*
@@ -106,10 +105,9 @@ static void csiphy_routing_cfg(struct isp_csiphy *phy,
106 enum isp_interface_type iface, bool on, 105 enum isp_interface_type iface, bool on,
107 bool ccp2_strobe) 106 bool ccp2_strobe)
108{ 107{
109 if (phy->isp->mmio_base[OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL] 108 if (phy->isp->phy_type == ISP_PHY_TYPE_3630 && on)
110 && on)
111 return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe); 109 return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe);
112 if (phy->isp->mmio_base[OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE]) 110 if (phy->isp->phy_type == ISP_PHY_TYPE_3430)
113 return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe); 111 return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe);
114} 112}
115 113