diff mbox

[V3,13/15,media] marvell-ccic: add dma burst mode support in marvell-ccic driver

Message ID 1355565484-15791-14-git-send-email-twang13@marvell.com (mailing list archive)
State New, archived
Headers show

Commit Message

Albert Wang Dec. 15, 2012, 9:58 a.m. UTC
This patch adds the dma burst size config support for marvell-ccic.
Developer can set the dma burst size in specified board driver.

Signed-off-by: Albert Wang <twang13@marvell.com>
Signed-off-by: Libin Yang <lbyang@marvell.com>
---
 .../media/platform/marvell-ccic/mcam-core-soc.c    |    2 +-
 drivers/media/platform/marvell-ccic/mcam-core.h    |    7 ++++---
 drivers/media/platform/marvell-ccic/mmp-driver.c   |   11 +++++++++++
 include/media/mmp-camera.h                         |    1 +
 4 files changed, 17 insertions(+), 4 deletions(-)

Comments

Jonathan Corbet Dec. 16, 2012, 4:49 p.m. UTC | #1
On Sat, 15 Dec 2012 17:58:02 +0800
Albert Wang <twang13@marvell.com> wrote:

> This patch adds the dma burst size config support for marvell-ccic.
> Developer can set the dma burst size in specified board driver.

> diff --git a/drivers/media/platform/marvell-ccic/mcam-core.h b/drivers/media/platform/marvell-ccic/mcam-core.h
> index 57442e0..e1025f2 100755
> --- a/drivers/media/platform/marvell-ccic/mcam-core.h
> +++ b/drivers/media/platform/marvell-ccic/mcam-core.h
> @@ -126,6 +126,7 @@ struct mcam_camera {
>  	short int use_smbus;	/* SMBUS or straight I2c? */
>  	enum mcam_buffer_mode buffer_mode;
>  
> +	int burst;

That's a register flag value, seems it should be unsigned (says the guy who
is admittedly sloppy about such things).

>  	int mclk_min;
>  	int mclk_src;
>  	int mclk_div;
> @@ -411,9 +412,9 @@ int mcam_soc_camera_host_register(struct mcam_camera *mcam);
>  #define   C1_DESC_3WORD   0x00000200	/* Three-word descriptors used */
>  #define	  C1_444ALPHA	  0x00f00000	/* Alpha field in RGB444 */
>  #define	  C1_ALPHA_SHFT	  20
> -#define	  C1_DMAB32	  0x00000000	/* 32-byte DMA burst */
> -#define	  C1_DMAB16	  0x02000000	/* 16-byte DMA burst */
> -#define	  C1_DMAB64	  0x04000000	/* 64-byte DMA burst */
> +#define	  C1_DMAB64	  0x00000000	/* 64-byte DMA burst */
> +#define	  C1_DMAB128	  0x02000000	/* 128-byte DMA burst */
> +#define	  C1_DMAB256	  0x04000000	/* 256-byte DMA burst */

Interesting, did I just get those wrong somehow?  Or might they have been
different in the Cafe days?  

Acked-by: Jonathan Corbet <corbet@lwn.net>

jon
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Albert Wang Dec. 16, 2012, 10:22 p.m. UTC | #2
Hi, Jonathan



>-----Original Message-----
>From: Jonathan Corbet [mailto:corbet@lwn.net]
>Sent: Monday, 17 December, 2012 00:49
>To: Albert Wang
>Cc: g.liakhovetski@gmx.de; linux-media@vger.kernel.org; Libin Yang
>Subject: Re: [PATCH V3 13/15] [media] marvell-ccic: add dma burst mode support in
>marvell-ccic driver
>
>On Sat, 15 Dec 2012 17:58:02 +0800
>Albert Wang <twang13@marvell.com> wrote:
>
>> This patch adds the dma burst size config support for marvell-ccic.
>> Developer can set the dma burst size in specified board driver.
>
>> diff --git a/drivers/media/platform/marvell-ccic/mcam-core.h
>b/drivers/media/platform/marvell-ccic/mcam-core.h
>> index 57442e0..e1025f2 100755
>> --- a/drivers/media/platform/marvell-ccic/mcam-core.h
>> +++ b/drivers/media/platform/marvell-ccic/mcam-core.h
>> @@ -126,6 +126,7 @@ struct mcam_camera {
>>  	short int use_smbus;	/* SMBUS or straight I2c? */
>>  	enum mcam_buffer_mode buffer_mode;
>>
>> +	int burst;
>
>That's a register flag value, seems it should be unsigned (says the guy who
>is admittedly sloppy about such things).
>
[Albert Wang] Yes, you are right.

>>  	int mclk_min;
>>  	int mclk_src;
>>  	int mclk_div;
>> @@ -411,9 +412,9 @@ int mcam_soc_camera_host_register(struct mcam_camera
>*mcam);
>>  #define   C1_DESC_3WORD   0x00000200	/* Three-word descriptors used */
>>  #define	  C1_444ALPHA	  0x00f00000	/* Alpha field in RGB444 */
>>  #define	  C1_ALPHA_SHFT	  20
>> -#define	  C1_DMAB32	  0x00000000	/* 32-byte DMA burst */
>> -#define	  C1_DMAB16	  0x02000000	/* 16-byte DMA burst */
>> -#define	  C1_DMAB64	  0x04000000	/* 64-byte DMA burst */
>> +#define	  C1_DMAB64	  0x00000000	/* 64-byte DMA burst */
>> +#define	  C1_DMAB128	  0x02000000	/* 128-byte DMA burst */
>> +#define	  C1_DMAB256	  0x04000000	/* 256-byte DMA burst */
>
>Interesting, did I just get those wrong somehow?  Or might they have been
>different in the Cafe days?
>
[Albert Wang] Yes, it looks the original definitions are wrong. We can't find them in all Marvell documents. :)
Just correct them.

>Acked-by: Jonathan Corbet <corbet@lwn.net>
>
>jon



Thanks
Albert Wang
86-21-61092656
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/platform/marvell-ccic/mcam-core-soc.c b/drivers/media/platform/marvell-ccic/mcam-core-soc.c
index 9016dc6..5b1dcfe 100644
--- a/drivers/media/platform/marvell-ccic/mcam-core-soc.c
+++ b/drivers/media/platform/marvell-ccic/mcam-core-soc.c
@@ -83,7 +83,7 @@  static int mcam_camera_add_device(struct soc_camera_device *icd)
 	mcam_ctlr_stop(mcam);
 	mcam_set_config_needed(mcam, 1);
 	mcam_reg_write(mcam, REG_CTRL1,
-				   C1_RESERVED | C1_DMAPOSTED);
+			mcam->burst |  C1_RESERVED | C1_DMAPOSTED);
 	mcam_reg_write(mcam, REG_CLKCTRL,
 		(mcam->mclk_src << 29) | mcam->mclk_div);
 	cam_dbg(mcam, "camera: set sensor mclk = %dMHz\n", mcam->mclk_min);
diff --git a/drivers/media/platform/marvell-ccic/mcam-core.h b/drivers/media/platform/marvell-ccic/mcam-core.h
index 57442e0..e1025f2 100755
--- a/drivers/media/platform/marvell-ccic/mcam-core.h
+++ b/drivers/media/platform/marvell-ccic/mcam-core.h
@@ -126,6 +126,7 @@  struct mcam_camera {
 	short int use_smbus;	/* SMBUS or straight I2c? */
 	enum mcam_buffer_mode buffer_mode;
 
+	int burst;
 	int mclk_min;
 	int mclk_src;
 	int mclk_div;
@@ -411,9 +412,9 @@  int mcam_soc_camera_host_register(struct mcam_camera *mcam);
 #define   C1_DESC_3WORD   0x00000200	/* Three-word descriptors used */
 #define	  C1_444ALPHA	  0x00f00000	/* Alpha field in RGB444 */
 #define	  C1_ALPHA_SHFT	  20
-#define	  C1_DMAB32	  0x00000000	/* 32-byte DMA burst */
-#define	  C1_DMAB16	  0x02000000	/* 16-byte DMA burst */
-#define	  C1_DMAB64	  0x04000000	/* 64-byte DMA burst */
+#define	  C1_DMAB64	  0x00000000	/* 64-byte DMA burst */
+#define	  C1_DMAB128	  0x02000000	/* 128-byte DMA burst */
+#define	  C1_DMAB256	  0x04000000	/* 256-byte DMA burst */
 #define	  C1_DMAB_MASK	  0x06000000
 #define	  C1_TWOBUFS	  0x08000000	/* Use only two DMA buffers */
 #define	  C1_PWRDWN	  0x10000000	/* Power down */
diff --git a/drivers/media/platform/marvell-ccic/mmp-driver.c b/drivers/media/platform/marvell-ccic/mmp-driver.c
index cd850f4..3469f02 100755
--- a/drivers/media/platform/marvell-ccic/mmp-driver.c
+++ b/drivers/media/platform/marvell-ccic/mmp-driver.c
@@ -400,6 +400,17 @@  static int mmpcam_probe(struct platform_device *pdev)
 	mcam->dphy = pdata->dphy;
 	mcam->mipi_enabled = 0;
 	mcam->lane = pdata->lane;
+	switch (pdata->dma_burst) {
+	case 128:
+		mcam->burst = C1_DMAB128;
+		break;
+	case 256:
+		mcam->burst = C1_DMAB256;
+		break;
+	default:
+		mcam->burst = C1_DMAB64;
+		break;
+	}
 	INIT_LIST_HEAD(&mcam->buffers);
 
 	/*
diff --git a/include/media/mmp-camera.h b/include/media/mmp-camera.h
index ec4f21f..4da0df7 100755
--- a/include/media/mmp-camera.h
+++ b/include/media/mmp-camera.h
@@ -13,6 +13,7 @@  struct mmp_camera_platform_data {
 	int mclk_src;
 	int mclk_div;
 	int chip_id;
+	int dma_burst;
 	/*
 	 * MIPI support
 	 */