CSI2: Fix to csi2 reset.
Subsystems (4)
PATCH 1/1 CSI2: Fix to csi2 reset.
From: Dominic Curran <[email protected]>
Subject: [OMAPZOOM][PATCH] CSI2: Fix to csi2 reset.
This patch fixes an issue where CSI2 setup is incorrect for the following scenario:
QBUF
STREAMON
DQBUF
STREAMOFF
QBUF
STREAMON <- csi2 setup incorrect at power_on
DQBUF <- forever wait here
When STREAMOFF occurs then csi2 register setup ends up in an unknown state.
This patch performs a csi2 reset everytime a PowerOn occurs to get it back into know state.
SUMMARY:
board-*.c - Remove the 'if' condition so that csi2 reset is called everytime.
isp.c - Configuration in isp_csi2_ctx_config_format() depends on
changes that happen in isp_csi2_ctrl_config_vp_only_enable(). Thus change order so that isp_csi2_ctrl_config_vp_only_enable() is called first.
ispcsi2.c - Clear internal structures at beginning of every reset.
--- arch/arm/mach-omap2/board-3430sdp.c | 6 ++---- arch/arm/mach-omap2/board-ldp.c | 4 ++-- arch/arm/mach-omap2/board-zoom2.c | 3 +-- drivers/media/video/isp/isp.c | 6 +++--- drivers/media/video/isp/ispcsi2.c | 4 ++++ 5 files changed, 12 insertions(+), 11 deletions(-)
arch/arm/mach-omap2/board-3430sdp.c +2 -4
@@ -835,8 +835,7 @@ static int ov3640_sensor_power_set(enumswitch (power) {case V4L2_POWER_ON :printk (KERN_DEBUG "ov3640_sensor_power_set(ON)\n" ); -if (previous_power ==V4L2_POWER_OFF ) -isp_csi2_reset (); +isp_csi2_reset (); lanecfg.clk.pol =OV3640_CSI2_CLOCK_POLARITY ; lanecfg.clk.pos =OV3640_CSI2_CLOCK_LANE ;
@@ -1019,8 +1018,7 @@ static int imx046_sensor_power_set(enumcase V4L2_POWER_ON :/* Power Up Sequence */ printk (KERN_DEBUG "imx046_sensor_power_set(ON)\n" ); -if (previous_power ==V4L2_POWER_OFF ) -isp_csi2_reset (); +isp_csi2_reset (); lanecfg.clk.pol =IMX046_CSI2_CLOCK_POLARITY ; lanecfg.clk.pos =IMX046_CSI2_CLOCK_LANE ;
arch/arm/mach-omap2/board-ldp.c +2 -2
@@ -675,8 +675,8 @@ static int ov3640_sensor_power_set(enumswitch (power) {case V4L2_POWER_ON :printk (KERN_DEBUG "ov3640_sensor_power_set(ON)\n" ); -if (previous_power ==V4L2_POWER_OFF ) -isp_csi2_reset (); +isp_csi2_reset (); + lanecfg.clk.pol =OV3640_CSI2_CLOCK_POLARITY ; lanecfg.clk.pos =OV3640_CSI2_CLOCK_LANE ; lanecfg.data[0 ].pol =OV3640_CSI2_DATA0_POLARITY ;
arch/arm/mach-omap2/board-zoom2.c +1 -2
@@ -397,8 +397,7 @@ static int imx046_sensor_power_set(enumcase V4L2_POWER_ON :/* Power Up Sequence */ printk (KERN_DEBUG "imx046_sensor_power_set(ON)\n" ); -if (previous_power ==V4L2_POWER_OFF ) -isp_csi2_reset (); +isp_csi2_reset (); lanecfg.clk.pol =IMX046_CSI2_CLOCK_POLARITY ; lanecfg.clk.pos =IMX046_CSI2_CLOCK_LANE ;
drivers/media/video/isp/isp.c +3 -3
@@ -907,9 +907,6 @@ int isp_configure_interface(struct isp_i ispctrl_val &= ~ISPCTRL_PAR_BRIDGE_BENDIAN ; ispctrl_val |= (0x03 <<ISPCTRL_PAR_BRIDGE_SHIFT ); -isp_csi2_ctx_config_format (0 , config->u.csi.format); -isp_csi2_ctx_update (0 , false); -if (config->u.csi.crc)isp_csi2_ctrl_config_ecc_enable (true);
@@ -918,6 +915,9 @@ int isp_configure_interface(struct isp_iisp_csi2_ctrl_config_vp_clk_enable (true);isp_csi2_ctrl_update (false); +isp_csi2_ctx_config_format (0 , config->u.csi.format); +isp_csi2_ctx_update (0 , false); +isp_csi2_irq_complexio1_set (1 );isp_csi2_irq_status_set (1 );isp_csi2_irq_set (1 );
drivers/media/video/isp/ispcsi2.c +4 -0
@@ -1966,6 +1966,10 @@ int isp_csi2_reset(void)u8 soft_reset_retries =0 ;int i; +memset (¤t_csi2_cfg,0x00 ,sizeof (struct isp_csi2_cfg )); +memset (¤t_csi2_cfg_update,0x00 , +sizeof (struct isp_csi2_cfg_update )); + reg =omap_readl (ISPCSI2_SYSCONFIG ); reg |=ISPCSI2_SYSCONFIG_SOFT_RESET_RESET ;omap_writel (reg,ISPCSI2_SYSCONFIG );