]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00236722 mx6sl: csi: Ensure dma reflash operation done when dma is disabled
authorRobby Cai <R63905@freescale.com>
Mon, 10 Dec 2012 09:13:45 +0000 (17:13 +0800)
committerLothar Waßmann <LW@KARO-electronics.de>
Fri, 24 May 2013 06:35:48 +0000 (08:35 +0200)
If do dma reflash operation when dma is enabled, the system will hang and we
can not connect to the core through jtag. The reason is the reflash signal
(DMA_REFLASH_RFF) will initialize the AHB bus signals and it indeed seems to
modify the AHB address on the clock as soon as the programmable register value
is changed, the bus may not respond.

This patch revised it according to the RM:
"Reflash DMA Controller for RxFIFO. This bit reflash the embedded DMA controller
for RxFIFO. It should be reflashed before the embedded DMA controller starts
to work."

Signed-off-by: Robby Cai <R63905@freescale.com>
drivers/media/video/mxc/capture/csi_v4l2_capture.c
drivers/media/video/mxc/capture/fsl_csi.c
drivers/media/video/mxc/capture/fsl_csi.h

index 74266b0367a829b2e86de4aa926a8a7dee376389..53f35d487b212540e4669265032e2d52775c1d95 100644 (file)
@@ -547,6 +547,7 @@ static int csi_streamon(cam_data *cam)
        cam->capture_on = true;
        csi_cap_image(cam);
        csi_enable_int(1);
+       csi_dmareq_rff_enable();
 
        return 0;
 }
@@ -567,6 +568,7 @@ static int csi_streamoff(cam_data *cam)
        if (cam->capture_on == false)
                return 0;
 
+       csi_dmareq_rff_disable();
        csi_disable_int();
        cam->capture_on = false;
 
index cd59b8e3cb1b0cb8741e3cca81d6fdcdba8f29bf..ede69b814b1b574e5795035fb5851139df76f522 100644 (file)
@@ -56,6 +56,9 @@ static irqreturn_t csi_irq_handler(int irq, void *data)
                        __raw_writel(cr3 | BIT_DMA_REFLASH_RFF, CSI_CSICR3);
        }
 
+       if (status & BIT_HRESP_ERR_INT)
+               pr_warning("Hresponse error is detected.\n");
+
        if (status & BIT_DMA_TSF_DONE_FB1) {
                if (cam->capture_on) {
                        spin_lock(&cam->queue_int_lock);
@@ -264,6 +267,24 @@ void csi_mclk_disable(void)
        clk_disable(&csi_mclk);
 }
 
+void csi_dmareq_rff_enable(void)
+{
+       unsigned long cr3 = __raw_readl(CSI_CSICR3);
+
+       cr3 |= BIT_DMA_REQ_EN_RFF;
+       cr3 |= BIT_HRESP_ERR_EN;
+       __raw_writel(cr3, CSI_CSICR3);
+}
+
+void csi_dmareq_rff_disable(void)
+{
+       unsigned long cr3 = __raw_readl(CSI_CSICR3);
+
+       cr3 &= ~BIT_DMA_REQ_EN_RFF;
+       cr3 &= ~BIT_HRESP_ERR_EN;
+       __raw_writel(cr3, CSI_CSICR3);
+}
+
 static int __devinit csi_probe(struct platform_device *pdev)
 {
        int ret = 0;
@@ -293,6 +314,7 @@ static int __devinit csi_probe(struct platform_device *pdev)
 
        csihw_reset();
        csi_init_interface();
+       csi_dmareq_rff_disable();
 
        per_clk = clk_get(NULL, "csi_clk");
        if (IS_ERR(per_clk))
index 8dfce286fe531a73b987c525d676d8bf74afd025..d8096cc3b16d433580156d438c8f769493ae73f9 100644 (file)
@@ -195,3 +195,5 @@ void csi_enable_int(int arg);
 void csi_disable_int(void);
 void csi_mclk_enable(void);
 void csi_mclk_disable(void);
+void csi_dmareq_rff_enable(void);
+void csi_dmareq_rff_disable(void);