All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: riic: fix restart condition
@ 2017-03-06 20:20 Chris Brandt
  2017-03-07  6:42 ` Simon Horman
  2017-03-09 14:40 ` Wolfram Sang
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Brandt @ 2017-03-06 20:20 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-i2c, linux-renesas-soc, Simon Horman, Geert Uytterhoeven,
	Chris Brandt

While modifying the driver to use the STOP interrupt, the completion of the
intermediate transfers need to wake the driver back up in order to initiate
the next transfer (restart condition). Otherwise you get never ending
interrupts and only the first transfer sent.

Fixes: 71ccea095ea1 ("i2c: riic: correctly finish transfers")
Reported-by: Simon Horman <horms@verge.net.au>
Signed-off-by: Chris Brandt <chris.brandt@renesas.com>
---
 drivers/i2c/busses/i2c-riic.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
index 8f11d34..c811af4 100644
--- a/drivers/i2c/busses/i2c-riic.c
+++ b/drivers/i2c/busses/i2c-riic.c
@@ -218,8 +218,12 @@ static irqreturn_t riic_tend_isr(int irq, void *data)
 	}
 
 	if (riic->is_last || riic->err) {
-		riic_clear_set_bit(riic, 0, ICIER_SPIE, RIIC_ICIER);
+		riic_clear_set_bit(riic, ICIER_TEIE, ICIER_SPIE, RIIC_ICIER);
 		writeb(ICCR2_SP, riic->base + RIIC_ICCR2);
+	} else {
+		/* Transfer is complete, but do not send STOP */
+		riic_clear_set_bit(riic, ICIER_TEIE, 0, RIIC_ICIER);
+		complete(&riic->msg_done);
 	}
 
 	return IRQ_HANDLED;
-- 
2.10.1

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

* Re: [PATCH] i2c: riic: fix restart condition
  2017-03-06 20:20 [PATCH] i2c: riic: fix restart condition Chris Brandt
@ 2017-03-07  6:42 ` Simon Horman
  2017-03-09 14:40 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Simon Horman @ 2017-03-07  6:42 UTC (permalink / raw)
  To: Chris Brandt
  Cc: Wolfram Sang, linux-i2c, linux-renesas-soc, Geert Uytterhoeven

On Mon, Mar 06, 2017 at 03:20:51PM -0500, Chris Brandt wrote:
> While modifying the driver to use the STOP interrupt, the completion of the
> intermediate transfers need to wake the driver back up in order to initiate
> the next transfer (restart condition). Otherwise you get never ending
> interrupts and only the first transfer sent.
> 
> Fixes: 71ccea095ea1 ("i2c: riic: correctly finish transfers")
> Reported-by: Simon Horman <horms@verge.net.au>
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>

Thanks Chris,

with this patch applied on top of v4.11-rc1 Genmai once again boots
to userspace with shmobile_defconfig.

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

> ---
>  drivers/i2c/busses/i2c-riic.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-riic.c b/drivers/i2c/busses/i2c-riic.c
> index 8f11d34..c811af4 100644
> --- a/drivers/i2c/busses/i2c-riic.c
> +++ b/drivers/i2c/busses/i2c-riic.c
> @@ -218,8 +218,12 @@ static irqreturn_t riic_tend_isr(int irq, void *data)
>  	}
>  
>  	if (riic->is_last || riic->err) {
> -		riic_clear_set_bit(riic, 0, ICIER_SPIE, RIIC_ICIER);
> +		riic_clear_set_bit(riic, ICIER_TEIE, ICIER_SPIE, RIIC_ICIER);
>  		writeb(ICCR2_SP, riic->base + RIIC_ICCR2);
> +	} else {
> +		/* Transfer is complete, but do not send STOP */
> +		riic_clear_set_bit(riic, ICIER_TEIE, 0, RIIC_ICIER);
> +		complete(&riic->msg_done);
>  	}
>  
>  	return IRQ_HANDLED;
> -- 
> 2.10.1
> 
> 

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

* Re: [PATCH] i2c: riic: fix restart condition
  2017-03-06 20:20 [PATCH] i2c: riic: fix restart condition Chris Brandt
  2017-03-07  6:42 ` Simon Horman
@ 2017-03-09 14:40 ` Wolfram Sang
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfram Sang @ 2017-03-09 14:40 UTC (permalink / raw)
  To: Chris Brandt
  Cc: linux-i2c, linux-renesas-soc, Simon Horman, Geert Uytterhoeven

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

On Mon, Mar 06, 2017 at 03:20:51PM -0500, Chris Brandt wrote:
> While modifying the driver to use the STOP interrupt, the completion of the
> intermediate transfers need to wake the driver back up in order to initiate
> the next transfer (restart condition). Otherwise you get never ending
> interrupts and only the first transfer sent.
> 
> Fixes: 71ccea095ea1 ("i2c: riic: correctly finish transfers")
> Reported-by: Simon Horman <horms@verge.net.au>
> Signed-off-by: Chris Brandt <chris.brandt@renesas.com>

Applied to for-current, thanks!


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

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

end of thread, other threads:[~2017-03-09 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-06 20:20 [PATCH] i2c: riic: fix restart condition Chris Brandt
2017-03-07  6:42 ` Simon Horman
2017-03-09 14:40 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.