All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-22 11:50 ` Joakim Tjernlund
  0 siblings, 0 replies; 16+ messages in thread
From: Joakim Tjernlund @ 2009-09-22 11:50 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA, linuxppc-dev-mnsaURCQ41sdnm+yROfE0A
  Cc: Joakim Tjernlund, Esben Haabendal

The driver always ends a read with a STOP condition which
breaks subsequent I2C reads/writes in the same transaction as
these expect to do a repeated START(ReSTART).

This will also help I2C multimaster as the bus will not be released
after the first read, but when the whole transaction ends.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
---

This should also fix a problem reported by Esben Haabendal:

[PATCH v2] i2c-mpc: generate START condition after STOP caused by read i2c_msg

This fixes MAL (arbitration lost) bug caused by illegal use of
RSTA (repeated START) after STOP condition generated after last byte
of reads. With this patch, it is possible to do an i2c_transfer() with
additional i2c_msg's following the I2C_M_RD messages.

It still needs to be resolved if it is possible to fix this issue
by removing the STOP condition after reads in a robust way.

Signed-off-by: Esben Haabendal <eha-SIcX2qgNSybd/EuGEV170n9LOBIZ5rWg@public.gmane.org>

 drivers/i2c/busses/i2c-mpc.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index cdb1858..88ae582 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -369,9 +369,6 @@ static int mpc_write(struct mpc_i2c *i2c, int target,
 	unsigned timeout = i2c->adap.timeout;
 	u32 flags = restart ? CCR_RSTA : 0;
 
-	/* Start with MEN */
-	if (!restart)
-		writeccr(i2c, CCR_MEN);
 	/* Start as master */
 	writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
 	/* Write target byte */
@@ -400,9 +397,6 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
 	int i, result;
 	u32 flags = restart ? CCR_RSTA : 0;
 
-	/* Start with MEN */
-	if (!restart)
-		writeccr(i2c, CCR_MEN);
 	/* Switch to read - restart */
 	writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
 	/* Write target address byte - this time with the read flag set */
@@ -429,9 +423,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
 		/* Generate txack on next to last byte */
 		if (i == length - 2)
 			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_TXAK);
-		/* Generate stop on last byte */
+		/* Do not generate stop on last byte */
 		if (i == length - 1)
-			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_TXAK);
+			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX);
 		data[i] = readb(i2c->base + MPC_I2C_DR);
 	}
 
-- 
1.6.4.3

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

* [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-22 11:50 ` Joakim Tjernlund
  0 siblings, 0 replies; 16+ messages in thread
From: Joakim Tjernlund @ 2009-09-22 11:50 UTC (permalink / raw)
  To: linux-i2c, linuxppc-dev, Esben Haabendal; +Cc: Esben Haabendal

The driver always ends a read with a STOP condition which
breaks subsequent I2C reads/writes in the same transaction as
these expect to do a repeated START(ReSTART).

This will also help I2C multimaster as the bus will not be released
after the first read, but when the whole transaction ends.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
---

This should also fix a problem reported by Esben Haabendal:

[PATCH v2] i2c-mpc: generate START condition after STOP caused by read i2c_msg

This fixes MAL (arbitration lost) bug caused by illegal use of
RSTA (repeated START) after STOP condition generated after last byte
of reads. With this patch, it is possible to do an i2c_transfer() with
additional i2c_msg's following the I2C_M_RD messages.

It still needs to be resolved if it is possible to fix this issue
by removing the STOP condition after reads in a robust way.

Signed-off-by: Esben Haabendal <eha@doredevelopment.dk>

 drivers/i2c/busses/i2c-mpc.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index cdb1858..88ae582 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -369,9 +369,6 @@ static int mpc_write(struct mpc_i2c *i2c, int target,
 	unsigned timeout = i2c->adap.timeout;
 	u32 flags = restart ? CCR_RSTA : 0;
 
-	/* Start with MEN */
-	if (!restart)
-		writeccr(i2c, CCR_MEN);
 	/* Start as master */
 	writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
 	/* Write target byte */
@@ -400,9 +397,6 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
 	int i, result;
 	u32 flags = restart ? CCR_RSTA : 0;
 
-	/* Start with MEN */
-	if (!restart)
-		writeccr(i2c, CCR_MEN);
 	/* Switch to read - restart */
 	writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
 	/* Write target address byte - this time with the read flag set */
@@ -429,9 +423,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
 		/* Generate txack on next to last byte */
 		if (i == length - 2)
 			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_TXAK);
-		/* Generate stop on last byte */
+		/* Do not generate stop on last byte */
 		if (i == length - 1)
-			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_TXAK);
+			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX);
 		data[i] = readb(i2c->base + MPC_I2C_DR);
 	}
 
-- 
1.6.4.3

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
  2009-09-22 11:50 ` Joakim Tjernlund
@ 2009-09-25 10:01     ` Wolfgang Grandegger
  -1 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Grandegger @ 2009-09-25 10:01 UTC (permalink / raw)
  To: Joakim Tjernlund
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, Esben Haabendal

Joakim Tjernlund wrote:
> The driver always ends a read with a STOP condition which
> breaks subsequent I2C reads/writes in the same transaction as
> these expect to do a repeated START(ReSTART).
> 
> This will also help I2C multimaster as the bus will not be released
> after the first read, but when the whole transaction ends.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
Tested-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

on a MPC8548 board with an up-to-date kernel. I did not realize any
problems.

Wolfgang.

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-25 10:01     ` Wolfgang Grandegger
  0 siblings, 0 replies; 16+ messages in thread
From: Wolfgang Grandegger @ 2009-09-25 10:01 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev, linux-i2c, Esben Haabendal

Joakim Tjernlund wrote:
> The driver always ends a read with a STOP condition which
> breaks subsequent I2C reads/writes in the same transaction as
> these expect to do a repeated START(ReSTART).
> 
> This will also help I2C multimaster as the bus will not be released
> after the first read, but when the whole transaction ends.
> 
> Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
Tested-by: Wolfgang Grandegger <wg@grandegger.com>

on a MPC8548 board with an up-to-date kernel. I did not realize any
problems.

Wolfgang.

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
  2009-09-25 10:01     ` Wolfgang Grandegger
  (?)
@ 2009-09-27 22:26     ` Joakim Tjernlund
       [not found]       ` <OFDA26E787.32612566-ONC125763E.007AD2FD-C125763E.007B4FFC-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
  -1 siblings, 1 reply; 16+ messages in thread
From: Joakim Tjernlund @ 2009-09-27 22:26 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linuxppc-dev, linux-i2c, Esben Haabendal

Jean, I just noticed you pull request for i2c on LKML but I didn't see this
patch nor have I got any feedback from you. What is your view?

   Jocke

Wolfgang Grandegger <wg@grandegger.com> wrote on 25/09/2009 12:01:17:
>
> Joakim Tjernlund wrote:
> > The driver always ends a read with a STOP condition which
> > breaks subsequent I2C reads/writes in the same transaction as
> > these expect to do a repeated START(ReSTART).
> >
> > This will also help I2C multimaster as the bus will not be released
> > after the first read, but when the whole transaction ends.
> >
> > Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund@transmode.se>
> Tested-by: Wolfgang Grandegger <wg@grandegger.com>
>
> on a MPC8548 board with an up-to-date kernel. I did not realize any
> problems.
>
> Wolfgang.
>

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
  2009-09-27 22:26     ` Joakim Tjernlund
@ 2009-09-28  7:28           ` Jean Delvare
  0 siblings, 0 replies; 16+ messages in thread
From: Jean Delvare @ 2009-09-28  7:28 UTC (permalink / raw)
  To: Joakim Tjernlund
  Cc: Esben Haabendal, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, Wolfgang Grandegger

On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> patch nor have I got any feedback from you. What is your view?

My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
will not, pay any attention to it.

-- 
Jean Delvare

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-28  7:28           ` Jean Delvare
  0 siblings, 0 replies; 16+ messages in thread
From: Jean Delvare @ 2009-09-28  7:28 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev, linux-i2c, Esben Haabendal

On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> patch nor have I got any feedback from you. What is your view?

My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
will not, pay any attention to it.

-- 
Jean Delvare

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
  2009-09-28  7:28           ` Jean Delvare
@ 2009-09-28  7:30               ` Joakim Tjernlund
  -1 siblings, 0 replies; 16+ messages in thread
From: Joakim Tjernlund @ 2009-09-28  7:30 UTC (permalink / raw)
  To: Jean Delvare, galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r
  Cc: Esben Haabendal, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, Wolfgang Grandegger

Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> wrote on 28/09/2009 09:28:09:
>
> On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> > Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> > patch nor have I got any feedback from you. What is your view?
>
> My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
> will not, pay any attention to it.

Ah, that explains it. Who then will look after i2c-mpc? Kumar?

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-28  7:30               ` Joakim Tjernlund
  0 siblings, 0 replies; 16+ messages in thread
From: Joakim Tjernlund @ 2009-09-28  7:30 UTC (permalink / raw)
  To: Jean Delvare, galak; +Cc: linuxppc-dev, linux-i2c, Esben Haabendal

Jean Delvare <khali@linux-fr.org> wrote on 28/09/2009 09:28:09:
>
> On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> > Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> > patch nor have I got any feedback from you. What is your view?
>
> My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
> will not, pay any attention to it.

Ah, that explains it. Who then will look after i2c-mpc? Kumar?

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
  2009-09-28  7:30               ` Joakim Tjernlund
@ 2009-09-28  7:33                   ` Peter Korsgaard
  -1 siblings, 0 replies; 16+ messages in thread
From: Peter Korsgaard @ 2009-09-28  7:33 UTC (permalink / raw)
  To: Joakim Tjernlund
  Cc: Jean Delvare, galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r,
	Esben Haabendal, linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, Wolfgang Grandegger

>>>>> "Joakim" == Joakim Tjernlund <joakim.tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org> writes:

Hi,

 Joakim> Ah, that explains it. Who then will look after i2c-mpc? Kumar?

Ben Dooks (embedded i2c maintainer). He's afaik coming home today, so
give him a few days to catch up on mails.

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-28  7:33                   ` Peter Korsgaard
  0 siblings, 0 replies; 16+ messages in thread
From: Peter Korsgaard @ 2009-09-28  7:33 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: Esben Haabendal, linuxppc-dev, linux-i2c, Jean Delvare

>>>>> "Joakim" == Joakim Tjernlund <joakim.tjernlund@transmode.se> writes:

Hi,

 Joakim> Ah, that explains it. Who then will look after i2c-mpc? Kumar?

Ben Dooks (embedded i2c maintainer). He's afaik coming home today, so
give him a few days to catch up on mails.

-- 
Bye, Peter Korsgaard

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
  2009-09-28  7:30               ` Joakim Tjernlund
@ 2009-09-28  7:34                   ` Jean Delvare
  -1 siblings, 0 replies; 16+ messages in thread
From: Jean Delvare @ 2009-09-28  7:34 UTC (permalink / raw)
  To: Joakim Tjernlund
  Cc: galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r, Esben Haabendal,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, Wolfgang Grandegger

On Mon, 28 Sep 2009 09:30:32 +0200, Joakim Tjernlund wrote:
> Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> wrote on 28/09/2009 09:28:09:
> >
> > On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> > > Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> > > patch nor have I got any feedback from you. What is your view?
> >
> > My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
> > will not, pay any attention to it.
> 
> Ah, that explains it. Who then will look after i2c-mpc? Kumar?

What does MAINTAINERS say?

-- 
Jean Delvare

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-28  7:34                   ` Jean Delvare
  0 siblings, 0 replies; 16+ messages in thread
From: Jean Delvare @ 2009-09-28  7:34 UTC (permalink / raw)
  To: Joakim Tjernlund; +Cc: linuxppc-dev, Esben Haabendal, linux-i2c

On Mon, 28 Sep 2009 09:30:32 +0200, Joakim Tjernlund wrote:
> Jean Delvare <khali@linux-fr.org> wrote on 28/09/2009 09:28:09:
> >
> > On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> > > Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> > > patch nor have I got any feedback from you. What is your view?
> >
> > My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
> > will not, pay any attention to it.
> 
> Ah, that explains it. Who then will look after i2c-mpc? Kumar?

What does MAINTAINERS say?

-- 
Jean Delvare

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
  2009-09-28  7:34                   ` Jean Delvare
@ 2009-09-28  7:43                       ` Joakim Tjernlund
  -1 siblings, 0 replies; 16+ messages in thread
From: Joakim Tjernlund @ 2009-09-28  7:43 UTC (permalink / raw)
  To: Jean Delvare
  Cc: Esben Haabendal, galak-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linuxppc-dev-mnsaURCQ41sdnm+yROfE0A, Wolfgang Grandegger

Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> wrote on 28/09/2009 09:34:34:
>
> On Mon, 28 Sep 2009 09:30:32 +0200, Joakim Tjernlund wrote:
> > Jean Delvare <khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org> wrote on 28/09/2009 09:28:09:
> > >
> > > On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> > > > Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> > > > patch nor have I got any feedback from you. What is your view?
> > >
> > > My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
> > > will not, pay any attention to it.
> >
> > Ah, that explains it. Who then will look after i2c-mpc? Kumar?
>
> What does MAINTAINERS say?

I did a grep for i2c-mpc and nothing turned up. Now that someone mentioned
Ben Dooks I found it.

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

* Re: [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-09-28  7:43                       ` Joakim Tjernlund
  0 siblings, 0 replies; 16+ messages in thread
From: Joakim Tjernlund @ 2009-09-28  7:43 UTC (permalink / raw)
  To: Jean Delvare; +Cc: linuxppc-dev, Esben Haabendal, linux-i2c

Jean Delvare <khali@linux-fr.org> wrote on 28/09/2009 09:34:34:
>
> On Mon, 28 Sep 2009 09:30:32 +0200, Joakim Tjernlund wrote:
> > Jean Delvare <khali@linux-fr.org> wrote on 28/09/2009 09:28:09:
> > >
> > > On Mon, 28 Sep 2009 00:26:54 +0200, Joakim Tjernlund wrote:
> > > > Jean, I just noticed you pull request for i2c on LKML but I didn't see this
> > > > patch nor have I got any feedback from you. What is your view?
> > >
> > > My view is that i2c-mpc is nor under my jurisdiction, so I did not, and
> > > will not, pay any attention to it.
> >
> > Ah, that explains it. Who then will look after i2c-mpc? Kumar?
>
> What does MAINTAINERS say?

I did a grep for i2c-mpc and nothing turned up. Now that someone mentioned
Ben Dooks I found it.

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

* [PATCH] i2c-mpc: Do not generate STOP after read.
@ 2009-10-13  8:12 Joakim Tjernlund
  0 siblings, 0 replies; 16+ messages in thread
From: Joakim Tjernlund @ 2009-10-13  8:12 UTC (permalink / raw)
  To: Andrew Morton, linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Joakim Tjernlund

The driver always ends a read with a STOP condition which
breaks subsequent I2C reads/writes in the same transaction as
these expect to do a repeated START(ReSTART).

This will also help I2C multimaster as the bus will not be released
after the first read, but when the whole transaction ends.

Signed-off-by: Joakim Tjernlund <Joakim.Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
---

Andrew,

Seems like nobody wants to touch this patch. Jean Delvare
refers to Ben Dooks and he has not replied to any of my mails.
Perhaps you can carry it in you patch queue?

 drivers/i2c/busses/i2c-mpc.c |   10 ++--------
 1 files changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index cdb1858..88ae582 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -369,9 +369,6 @@ static int mpc_write(struct mpc_i2c *i2c, int target,
 	unsigned timeout = i2c->adap.timeout;
 	u32 flags = restart ? CCR_RSTA : 0;
 
-	/* Start with MEN */
-	if (!restart)
-		writeccr(i2c, CCR_MEN);
 	/* Start as master */
 	writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
 	/* Write target byte */
@@ -400,9 +397,6 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
 	int i, result;
 	u32 flags = restart ? CCR_RSTA : 0;
 
-	/* Start with MEN */
-	if (!restart)
-		writeccr(i2c, CCR_MEN);
 	/* Switch to read - restart */
 	writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX | flags);
 	/* Write target address byte - this time with the read flag set */
@@ -429,9 +423,9 @@ static int mpc_read(struct mpc_i2c *i2c, int target,
 		/* Generate txack on next to last byte */
 		if (i == length - 2)
 			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_TXAK);
-		/* Generate stop on last byte */
+		/* Do not generate stop on last byte */
 		if (i == length - 1)
-			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_TXAK);
+			writeccr(i2c, CCR_MIEN | CCR_MEN | CCR_MSTA | CCR_MTX);
 		data[i] = readb(i2c->base + MPC_I2C_DR);
 	}
 
-- 
1.6.4.3

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

end of thread, other threads:[~2009-10-13  8:12 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-22 11:50 [PATCH] i2c-mpc: Do not generate STOP after read Joakim Tjernlund
2009-09-22 11:50 ` Joakim Tjernlund
     [not found] ` <1253620242-18461-1-git-send-email-Joakim.Tjernlund-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2009-09-25 10:01   ` Wolfgang Grandegger
2009-09-25 10:01     ` Wolfgang Grandegger
2009-09-27 22:26     ` Joakim Tjernlund
     [not found]       ` <OFDA26E787.32612566-ONC125763E.007AD2FD-C125763E.007B4FFC-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2009-09-28  7:28         ` Jean Delvare
2009-09-28  7:28           ` Jean Delvare
     [not found]           ` <20090928092809.7272b6e6-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-28  7:30             ` Joakim Tjernlund
2009-09-28  7:30               ` Joakim Tjernlund
     [not found]               ` <OFC822309E.F9FB4F3C-ONC125763F.0029159C-C125763F.00293F85-SNLAxHN9vbcOP4wsBPIw7w@public.gmane.org>
2009-09-28  7:33                 ` Peter Korsgaard
2009-09-28  7:33                   ` Peter Korsgaard
2009-09-28  7:34                 ` Jean Delvare
2009-09-28  7:34                   ` Jean Delvare
     [not found]                   ` <20090928093434.57157435-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2009-09-28  7:43                     ` Joakim Tjernlund
2009-09-28  7:43                       ` Joakim Tjernlund
2009-10-13  8:12 Joakim Tjernlund

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.