Linux-Renesas-SoC Archive on lore.kernel.org
 help / Atom feed
* [PATCH 0/2] i2c: rcar: minor upporting from BSP
@ 2019-01-21 17:07 Wolfram Sang
  2019-01-21 17:07 ` [PATCH 1/2] i2c: rcar: comment maintenance Wolfram Sang
  2019-01-21 17:08 ` [PATCH 2/2] i2c: rcar: refactor TCYC handling Wolfram Sang
  0 siblings, 2 replies; 8+ messages in thread
From: Wolfram Sang @ 2019-01-21 17:07 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-renesas-soc, Wolfram Sang

Two small patches originally from the BSP but improved.

Wolfram Sang (2):
  i2c: rcar: comment maintenance
  i2c: rcar: refactor TCYC handling

 drivers/i2c/busses/i2c-rcar.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] i2c: rcar: comment maintenance
  2019-01-21 17:07 [PATCH 0/2] i2c: rcar: minor upporting from BSP Wolfram Sang
@ 2019-01-21 17:07 ` Wolfram Sang
  2019-01-23 10:23   ` Simon Horman
  2019-02-05 13:33   ` Wolfram Sang
  2019-01-21 17:08 ` [PATCH 2/2] i2c: rcar: refactor TCYC handling Wolfram Sang
  1 sibling, 2 replies; 8+ messages in thread
From: Wolfram Sang @ 2019-01-21 17:07 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-renesas-soc, Wolfram Sang

Update copyright years and remove a comment which grew incorrect and
useless over time.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 254e6219e538..4da7a1f6178b 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -2,8 +2,8 @@
 /*
  * Driver for the Renesas R-Car I2C unit
  *
- * Copyright (C) 2014-15 Wolfram Sang <wsa@sang-engineering.com>
- * Copyright (C) 2011-2015 Renesas Electronics Corporation
+ * Copyright (C) 2014-19 Wolfram Sang <wsa@sang-engineering.com>
+ * Copyright (C) 2011-2019 Renesas Electronics Corporation
  *
  * Copyright (C) 2012-14 Renesas Solutions Corp.
  * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
@@ -355,9 +355,6 @@ static void rcar_i2c_next_msg(struct rcar_i2c_priv *priv)
 	rcar_i2c_prepare_msg(priv);
 }
 
-/*
- *		interrupt functions
- */
 static void rcar_i2c_dma_unmap(struct rcar_i2c_priv *priv)
 {
 	struct dma_chan *chan = priv->dma_direction == DMA_FROM_DEVICE
-- 
2.11.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/2] i2c: rcar: refactor TCYC handling
  2019-01-21 17:07 [PATCH 0/2] i2c: rcar: minor upporting from BSP Wolfram Sang
  2019-01-21 17:07 ` [PATCH 1/2] i2c: rcar: comment maintenance Wolfram Sang
@ 2019-01-21 17:08 ` Wolfram Sang
  2019-01-23 10:25   ` Simon Horman
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2019-01-21 17:08 UTC (permalink / raw)
  To: linux-i2c; +Cc: linux-renesas-soc, Wolfram Sang

The latest documentation made it clear that we need to initialize the
TCYC value independently of DMA. Simplify the code to do that.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 4da7a1f6178b..48312f22094c 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -39,8 +39,8 @@
 #define ICSAR	0x1C	/* slave address */
 #define ICMAR	0x20	/* master address */
 #define ICRXTX	0x24	/* data port */
-#define ICDMAER	0x3c	/* DMA enable */
-#define ICFBSCR	0x38	/* first bit setup cycle */
+#define ICFBSCR	0x38	/* first bit setup cycle (Gen3) */
+#define ICDMAER	0x3c	/* DMA enable (Gen3) */
 
 /* ICSCR */
 #define SDBS	(1 << 3)	/* slave data buffer select */
@@ -83,7 +83,6 @@
 #define TMDMAE	(1 << 0)	/* DMA Master Transmitted Enable */
 
 /* ICFBSCR */
-#define TCYC06	0x04		/*  6*Tcyc delay 1st bit between SDA and SCL */
 #define TCYC17	0x0f		/* 17*Tcyc delay 1st bit between SDA and SCL */
 
 
@@ -212,6 +211,10 @@ static void rcar_i2c_init(struct rcar_i2c_priv *priv)
 	rcar_i2c_write(priv, ICMSR, 0);
 	/* start clock */
 	rcar_i2c_write(priv, ICCCR, priv->icccr);
+
+	if (priv->devtype == I2C_RCAR_GEN3)
+		rcar_i2c_write(priv, ICFBSCR, TCYC17);
+
 }
 
 static int rcar_i2c_bus_barrier(struct rcar_i2c_priv *priv)
@@ -363,9 +366,6 @@ static void rcar_i2c_dma_unmap(struct rcar_i2c_priv *priv)
 	/* Disable DMA Master Received/Transmitted */
 	rcar_i2c_write(priv, ICDMAER, 0);
 
-	/* Reset default delay */
-	rcar_i2c_write(priv, ICFBSCR, TCYC06);
-
 	dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg),
 			 sg_dma_len(&priv->sg), priv->dma_direction);
 
@@ -461,9 +461,6 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv)
 		return;
 	}
 
-	/* Set delay for DMA operations */
-	rcar_i2c_write(priv, ICFBSCR, TCYC17);
-
 	/* Enable DMA Master Received/Transmitted */
 	if (read)
 		rcar_i2c_write(priv, ICDMAER, RMDMAE);
-- 
2.11.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] i2c: rcar: comment maintenance
  2019-01-21 17:07 ` [PATCH 1/2] i2c: rcar: comment maintenance Wolfram Sang
@ 2019-01-23 10:23   ` Simon Horman
  2019-02-05 13:33   ` Wolfram Sang
  1 sibling, 0 replies; 8+ messages in thread
From: Simon Horman @ 2019-01-23 10:23 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-renesas-soc

On Mon, Jan 21, 2019 at 06:07:59PM +0100, Wolfram Sang wrote:
> Update copyright years and remove a comment which grew incorrect and
> useless over time.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] i2c: rcar: refactor TCYC handling
  2019-01-21 17:08 ` [PATCH 2/2] i2c: rcar: refactor TCYC handling Wolfram Sang
@ 2019-01-23 10:25   ` Simon Horman
  2019-01-23 17:39     ` Wolfram Sang
  0 siblings, 1 reply; 8+ messages in thread
From: Simon Horman @ 2019-01-23 10:25 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-renesas-soc

On Mon, Jan 21, 2019 at 06:08:00PM +0100, Wolfram Sang wrote:
> The latest documentation made it clear that we need to initialize the
> TCYC value independently of DMA. Simplify the code to do that.

Hi Wolfram,

I see TCYC bit 6 is no longer used after this patch.
Does that warrant a mention in the changelog?

> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
>  drivers/i2c/busses/i2c-rcar.c | 15 ++++++---------
>  1 file changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
> index 4da7a1f6178b..48312f22094c 100644
> --- a/drivers/i2c/busses/i2c-rcar.c
> +++ b/drivers/i2c/busses/i2c-rcar.c
> @@ -39,8 +39,8 @@
>  #define ICSAR	0x1C	/* slave address */
>  #define ICMAR	0x20	/* master address */
>  #define ICRXTX	0x24	/* data port */
> -#define ICDMAER	0x3c	/* DMA enable */
> -#define ICFBSCR	0x38	/* first bit setup cycle */
> +#define ICFBSCR	0x38	/* first bit setup cycle (Gen3) */
> +#define ICDMAER	0x3c	/* DMA enable (Gen3) */
>  
>  /* ICSCR */
>  #define SDBS	(1 << 3)	/* slave data buffer select */
> @@ -83,7 +83,6 @@
>  #define TMDMAE	(1 << 0)	/* DMA Master Transmitted Enable */
>  
>  /* ICFBSCR */
> -#define TCYC06	0x04		/*  6*Tcyc delay 1st bit between SDA and SCL */
>  #define TCYC17	0x0f		/* 17*Tcyc delay 1st bit between SDA and SCL */
>  
>  
> @@ -212,6 +211,10 @@ static void rcar_i2c_init(struct rcar_i2c_priv *priv)
>  	rcar_i2c_write(priv, ICMSR, 0);
>  	/* start clock */
>  	rcar_i2c_write(priv, ICCCR, priv->icccr);
> +
> +	if (priv->devtype == I2C_RCAR_GEN3)
> +		rcar_i2c_write(priv, ICFBSCR, TCYC17);
> +
>  }
>  
>  static int rcar_i2c_bus_barrier(struct rcar_i2c_priv *priv)
> @@ -363,9 +366,6 @@ static void rcar_i2c_dma_unmap(struct rcar_i2c_priv *priv)
>  	/* Disable DMA Master Received/Transmitted */
>  	rcar_i2c_write(priv, ICDMAER, 0);
>  
> -	/* Reset default delay */
> -	rcar_i2c_write(priv, ICFBSCR, TCYC06);
> -
>  	dma_unmap_single(chan->device->dev, sg_dma_address(&priv->sg),
>  			 sg_dma_len(&priv->sg), priv->dma_direction);
>  
> @@ -461,9 +461,6 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv)
>  		return;
>  	}
>  
> -	/* Set delay for DMA operations */
> -	rcar_i2c_write(priv, ICFBSCR, TCYC17);
> -
>  	/* Enable DMA Master Received/Transmitted */
>  	if (read)
>  		rcar_i2c_write(priv, ICDMAER, RMDMAE);
> -- 
> 2.11.0
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] i2c: rcar: refactor TCYC handling
  2019-01-23 10:25   ` Simon Horman
@ 2019-01-23 17:39     ` Wolfram Sang
  2019-01-24 12:41       ` Simon Horman
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2019-01-23 17:39 UTC (permalink / raw)
  To: Simon Horman; +Cc: Wolfram Sang, linux-i2c, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 550 bytes --]

On Wed, Jan 23, 2019 at 11:25:06AM +0100, Simon Horman wrote:
> On Mon, Jan 21, 2019 at 06:08:00PM +0100, Wolfram Sang wrote:
> > The latest documentation made it clear that we need to initialize the
> > TCYC value independently of DMA. Simplify the code to do that.
> 
> Hi Wolfram,
> 
> I see TCYC bit 6 is no longer used after this patch.
> Does that warrant a mention in the changelog?

Do you think so? The old code used TCYC06 (wrongly) for non-DMA transfers.
The new code sets TCYC up "independently from DMA" <- commit message.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] i2c: rcar: refactor TCYC handling
  2019-01-23 17:39     ` Wolfram Sang
@ 2019-01-24 12:41       ` Simon Horman
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Horman @ 2019-01-24 12:41 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: Wolfram Sang, linux-i2c, linux-renesas-soc

On Wed, Jan 23, 2019 at 06:39:26PM +0100, Wolfram Sang wrote:
> On Wed, Jan 23, 2019 at 11:25:06AM +0100, Simon Horman wrote:
> > On Mon, Jan 21, 2019 at 06:08:00PM +0100, Wolfram Sang wrote:
> > > The latest documentation made it clear that we need to initialize the
> > > TCYC value independently of DMA. Simplify the code to do that.
> > 
> > Hi Wolfram,
> > 
> > I see TCYC bit 6 is no longer used after this patch.
> > Does that warrant a mention in the changelog?
> 
> Do you think so? The old code used TCYC06 (wrongly) for non-DMA transfers.
> The new code sets TCYC up "independently from DMA" <- commit message.

FWIIW, the text above is much clearer to me than the original changelog.
But perhaps that is more a reflection on me than anything else.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] i2c: rcar: comment maintenance
  2019-01-21 17:07 ` [PATCH 1/2] i2c: rcar: comment maintenance Wolfram Sang
  2019-01-23 10:23   ` Simon Horman
@ 2019-02-05 13:33   ` Wolfram Sang
  1 sibling, 0 replies; 8+ messages in thread
From: Wolfram Sang @ 2019-02-05 13:33 UTC (permalink / raw)
  To: Wolfram Sang; +Cc: linux-i2c, linux-renesas-soc

[-- Attachment #1: Type: text/plain, Size: 261 bytes --]

On Mon, Jan 21, 2019 at 06:07:59PM +0100, Wolfram Sang wrote:
> Update copyright years and remove a comment which grew incorrect and
> useless over time.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, back to index

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-21 17:07 [PATCH 0/2] i2c: rcar: minor upporting from BSP Wolfram Sang
2019-01-21 17:07 ` [PATCH 1/2] i2c: rcar: comment maintenance Wolfram Sang
2019-01-23 10:23   ` Simon Horman
2019-02-05 13:33   ` Wolfram Sang
2019-01-21 17:08 ` [PATCH 2/2] i2c: rcar: refactor TCYC handling Wolfram Sang
2019-01-23 10:25   ` Simon Horman
2019-01-23 17:39     ` Wolfram Sang
2019-01-24 12:41       ` Simon Horman

Linux-Renesas-SoC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-renesas-soc/0 linux-renesas-soc/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-renesas-soc linux-renesas-soc/ https://lore.kernel.org/linux-renesas-soc \
		linux-renesas-soc@vger.kernel.org linux-renesas-soc@archiver.kernel.org
	public-inbox-index linux-renesas-soc


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-renesas-soc


AGPL code for this site: git clone https://public-inbox.org/ public-inbox