diff options
author | Sakari Ailus <sakari.ailus@iki.fi> | 2012-10-14 06:31:49 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-11-28 07:39:40 -0500 |
commit | ec51e960bc355c5ebf7501f1e74723d5d4f4212d (patch) | |
tree | abb60905acd94c5a477e4b57b4d862ac581f728e /drivers/media | |
parent | c19d19ebd200ad1f982159519017129a5ed6515e (diff) |
[media] omap3isp: Add PHY routing configuration
Add PHY routing configuration for both 3430 and 3630. Also add register bit
definitions of CSIRXFE and CAMERA_PHY_CTRL registers on OMAP 3430 and 3630,
respectively.
Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/omap3isp/ispcsiphy.c | 88 | ||||
-rw-r--r-- | drivers/media/platform/omap3isp/ispreg.h | 22 |
2 files changed, 110 insertions, 0 deletions
diff --git a/drivers/media/platform/omap3isp/ispcsiphy.c b/drivers/media/platform/omap3isp/ispcsiphy.c index 348f67ebbbc9..8ac99b9dc053 100644 --- a/drivers/media/platform/omap3isp/ispcsiphy.c +++ b/drivers/media/platform/omap3isp/ispcsiphy.c | |||
@@ -32,6 +32,94 @@ | |||
32 | #include "ispreg.h" | 32 | #include "ispreg.h" |
33 | #include "ispcsiphy.h" | 33 | #include "ispcsiphy.h" |
34 | 34 | ||
35 | static void csiphy_routing_cfg_3630(struct isp_csiphy *phy, u32 iface, | ||
36 | bool ccp2_strobe) | ||
37 | { | ||
38 | u32 reg = isp_reg_readl( | ||
39 | phy->isp, OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, 0); | ||
40 | u32 shift, mode; | ||
41 | |||
42 | switch (iface) { | ||
43 | case ISP_INTERFACE_CCP2B_PHY1: | ||
44 | reg &= ~OMAP3630_CONTROL_CAMERA_PHY_CTRL_CSI1_RX_SEL_PHY2; | ||
45 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY1_SHIFT; | ||
46 | break; | ||
47 | case ISP_INTERFACE_CSI2C_PHY1: | ||
48 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY1_SHIFT; | ||
49 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_DPHY; | ||
50 | break; | ||
51 | case ISP_INTERFACE_CCP2B_PHY2: | ||
52 | reg |= OMAP3630_CONTROL_CAMERA_PHY_CTRL_CSI1_RX_SEL_PHY2; | ||
53 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY2_SHIFT; | ||
54 | break; | ||
55 | case ISP_INTERFACE_CSI2A_PHY2: | ||
56 | shift = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY2_SHIFT; | ||
57 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_DPHY; | ||
58 | break; | ||
59 | } | ||
60 | |||
61 | /* Select data/clock or data/strobe mode for CCP2 */ | ||
62 | switch (iface) { | ||
63 | case ISP_INTERFACE_CCP2B_PHY1: | ||
64 | case ISP_INTERFACE_CCP2B_PHY2: | ||
65 | if (ccp2_strobe) | ||
66 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_STROBE; | ||
67 | else | ||
68 | mode = OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_CLOCK; | ||
69 | } | ||
70 | |||
71 | reg &= ~(OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_MASK << shift); | ||
72 | reg |= mode << shift; | ||
73 | |||
74 | isp_reg_writel(phy->isp, reg, | ||
75 | OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL, 0); | ||
76 | } | ||
77 | |||
78 | static void csiphy_routing_cfg_3430(struct isp_csiphy *phy, u32 iface, bool on, | ||
79 | bool ccp2_strobe) | ||
80 | { | ||
81 | u32 csirxfe = OMAP343X_CONTROL_CSIRXFE_PWRDNZ | ||
82 | | OMAP343X_CONTROL_CSIRXFE_RESET; | ||
83 | |||
84 | /* Only the CCP2B on PHY1 is configurable. */ | ||
85 | if (iface != ISP_INTERFACE_CCP2B_PHY1) | ||
86 | return; | ||
87 | |||
88 | if (!on) { | ||
89 | isp_reg_writel(phy->isp, 0, | ||
90 | OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, 0); | ||
91 | return; | ||
92 | } | ||
93 | |||
94 | if (ccp2_strobe) | ||
95 | csirxfe |= OMAP343X_CONTROL_CSIRXFE_SELFORM; | ||
96 | |||
97 | isp_reg_writel(phy->isp, csirxfe, | ||
98 | OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE, 0); | ||
99 | } | ||
100 | |||
101 | /* | ||
102 | * Configure OMAP 3 CSI PHY routing. | ||
103 | * @phy: relevant phy device | ||
104 | * @iface: ISP_INTERFACE_* | ||
105 | * @on: power on or off | ||
106 | * @ccp2_strobe: false: data/clock, true: data/strobe | ||
107 | * | ||
108 | * Note that the underlying routing configuration registers are part of the | ||
109 | * control (SCM) register space and part of the CORE power domain on both 3430 | ||
110 | * and 3630, so they will not hold their contents in off-mode. This isn't an | ||
111 | * issue since the MPU power domain is forced on whilst the ISP is in use. | ||
112 | */ | ||
113 | static void csiphy_routing_cfg(struct isp_csiphy *phy, u32 iface, bool on, | ||
114 | bool ccp2_strobe) | ||
115 | { | ||
116 | if (phy->isp->mmio_base[OMAP3_ISP_IOMEM_3630_CONTROL_CAMERA_PHY_CTRL] | ||
117 | && on) | ||
118 | return csiphy_routing_cfg_3630(phy, iface, ccp2_strobe); | ||
119 | if (phy->isp->mmio_base[OMAP3_ISP_IOMEM_343X_CONTROL_CSIRXFE]) | ||
120 | return csiphy_routing_cfg_3430(phy, iface, on, ccp2_strobe); | ||
121 | } | ||
122 | |||
35 | /* | 123 | /* |
36 | * csiphy_lanes_config - Configuration of CSIPHY lanes. | 124 | * csiphy_lanes_config - Configuration of CSIPHY lanes. |
37 | * | 125 | * |
diff --git a/drivers/media/platform/omap3isp/ispreg.h b/drivers/media/platform/omap3isp/ispreg.h index fd13d8bb63e2..b7d90e6fb01d 100644 --- a/drivers/media/platform/omap3isp/ispreg.h +++ b/drivers/media/platform/omap3isp/ispreg.h | |||
@@ -1506,4 +1506,26 @@ | |||
1506 | #define ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_MASK \ | 1506 | #define ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_MASK \ |
1507 | (0x7fffff << ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_SHIFT) | 1507 | (0x7fffff << ISPCSIPHY_REG2_CCP2_SYNC_PATTERN_SHIFT) |
1508 | 1508 | ||
1509 | /* ----------------------------------------------------------------------------- | ||
1510 | * CONTROL registers for CSI-2 phy routing | ||
1511 | */ | ||
1512 | |||
1513 | /* OMAP343X_CONTROL_CSIRXFE */ | ||
1514 | #define OMAP343X_CONTROL_CSIRXFE_CSIB_INV (1 << 7) | ||
1515 | #define OMAP343X_CONTROL_CSIRXFE_RESENABLE (1 << 8) | ||
1516 | #define OMAP343X_CONTROL_CSIRXFE_SELFORM (1 << 10) | ||
1517 | #define OMAP343X_CONTROL_CSIRXFE_PWRDNZ (1 << 12) | ||
1518 | #define OMAP343X_CONTROL_CSIRXFE_RESET (1 << 13) | ||
1519 | |||
1520 | /* OMAP3630_CONTROL_CAMERA_PHY_CTRL */ | ||
1521 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY1_SHIFT 2 | ||
1522 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_PHY2_SHIFT 0 | ||
1523 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_DPHY 0x0 | ||
1524 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_STROBE 0x1 | ||
1525 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_CCP2_DATA_CLOCK 0x2 | ||
1526 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_GPI 0x3 | ||
1527 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CAMMODE_MASK 0x3 | ||
1528 | /* CCP2B: set to receive data from PHY2 instead of PHY1 */ | ||
1529 | #define OMAP3630_CONTROL_CAMERA_PHY_CTRL_CSI1_RX_SEL_PHY2 (1 << 4) | ||
1530 | |||
1509 | #endif /* OMAP3_ISP_REG_H */ | 1531 | #endif /* OMAP3_ISP_REG_H */ |