* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-10 10:46 ext-eero.nurkkala
2008-11-10 12:27 ` Felipe Balbi
0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-10 10:46 UTC (permalink / raw)
To: linux-omap; +Cc: Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
drivers/i2c/busses/i2c-omap.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index f4d1edc..9ae3ad3 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -642,8 +642,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_RRDY)
num_bytes = dev->fifo_size;
else
- num_bytes = omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG);
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG)
+ >> 8) & 0x3F;
}
while (num_bytes) {
num_bytes--;
--
1.5.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-10 10:46 ext-eero.nurkkala
@ 2008-11-10 12:27 ` Felipe Balbi
0 siblings, 0 replies; 16+ messages in thread
From: Felipe Balbi @ 2008-11-10 12:27 UTC (permalink / raw)
To: ext ext-eero.nurkkala@nokia.com; +Cc: linux-omap
On Mon, Nov 10, 2008 at 12:46:49PM +0200, ext ext-eero.nurkkala@nokia.com wrote:
> From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
>
you need to put a patch description here. Ditto to other patches.
>
> Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index f4d1edc..9ae3ad3 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -642,8 +642,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & OMAP_I2C_STAT_RRDY)
> num_bytes = dev->fifo_size;
> else
> - num_bytes = omap_i2c_read_reg(dev,
> - OMAP_I2C_BUFSTAT_REG);
> + num_bytes = (omap_i2c_read_reg(dev,
> + OMAP_I2C_BUFSTAT_REG)
> + >> 8) & 0x3F;
> }
> while (num_bytes) {
> num_bytes--;
> --
> 1.5.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
balbi
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-11 6:51 ext-eero.nurkkala
2008-11-11 9:57 ` shekhar, chandra
0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-11 6:51 UTC (permalink / raw)
To: linux-omap; +Cc: Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
The amount of bytes to receive is read from wrong
place. It is the 6 bits starting from the bit 8 from
BUFSTAT_REG that indicate this amount. Not the 8 LSB:s.
6 LSB:s are used for the TX buffer.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
drivers/i2c/busses/i2c-omap.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a999606..f15668d 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -621,8 +621,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_RRDY)
num_bytes = dev->fifo_size;
else
- num_bytes = omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG);
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG)
+ >> 8) & 0x3F;
}
while (num_bytes) {
num_bytes--;
--
1.6.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-11 6:51 ext-eero.nurkkala
@ 2008-11-11 9:57 ` shekhar, chandra
0 siblings, 0 replies; 16+ messages in thread
From: shekhar, chandra @ 2008-11-11 9:57 UTC (permalink / raw)
To: linux-omap; +Cc: Eero Nurkkala
----- Original Message -----
From: <ext-eero.nurkkala@nokia.com>
To: <linux-omap@vger.kernel.org>
Cc: "Eero Nurkkala" <ext-eero.nurkkala@nokia.com>
Sent: Tuesday, November 11, 2008 12:21 PM
Subject: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
> From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
>
> The amount of bytes to receive is read from wrong
> place. It is the 6 bits starting from the bit 8 from
> BUFSTAT_REG that indicate this amount. Not the 8 LSB:s.
> 6 LSB:s are used for the TX buffer.
>
> Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 5 +++--
> 1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index a999606..f15668d 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -621,8 +621,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & OMAP_I2C_STAT_RRDY)
> num_bytes = dev->fifo_size;
> else
> - num_bytes = omap_i2c_read_reg(dev,
> - OMAP_I2C_BUFSTAT_REG);
> + num_bytes = (omap_i2c_read_reg(dev,
> + OMAP_I2C_BUFSTAT_REG)
> + >> 8) & 0x3F;
> }
I believe "And"ing by 0x3F will apply to transmit also.
> while (num_bytes) {
> num_bytes--;
> --
> 1.6.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-14 8:41 ext-eero.nurkkala
2008-11-14 19:16 ` David Brownell
0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-14 8:41 UTC (permalink / raw)
To: linux-omap; +Cc: Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
The amount of bytes to receive is read from wrong
place. It is the 6 bits starting from the bit 8 from
BUFSTAT_REG that indicate this amount. Not the 8 LSB:s.
Only 6 LSB:s are used for the TX buffer. Also, with
omap 3430, only the 6 LSB:s are relevant for XDR.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
drivers/i2c/busses/i2c-omap.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index a999606..e708ebd 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -618,11 +618,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
u8 num_bytes = 1;
if (dev->fifo_size) {
- if (stat & OMAP_I2C_STAT_RRDY)
+ if (stat & OMAP_I2C_STAT_RRDY) {
num_bytes = dev->fifo_size;
- else
- num_bytes = omap_i2c_read_reg(dev,
+ } else {
+ if (cpu_is_omap34xx())
+ num_bytes =
+ (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG)
+ >> 8) & 0x3F;
+ else
+ num_bytes =
+ omap_i2c_read_reg(dev,
OMAP_I2C_BUFSTAT_REG);
+ }
}
while (num_bytes) {
num_bytes--;
@@ -657,11 +665,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
u8 num_bytes = 1;
if (dev->fifo_size) {
- if (stat & OMAP_I2C_STAT_XRDY)
+ if (stat & OMAP_I2C_STAT_XRDY) {
num_bytes = dev->fifo_size;
- else
- num_bytes = omap_i2c_read_reg(dev,
+ } else {
+ num_bytes =
+ omap_i2c_read_reg(dev,
OMAP_I2C_BUFSTAT_REG);
+
+ if (cpu_is_omap34xx())
+ num_bytes &= 0x3F;
+ }
}
while (num_bytes) {
num_bytes--;
--
1.6.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-14 8:41 ext-eero.nurkkala
@ 2008-11-14 19:16 ` David Brownell
2008-11-19 12:12 ` Eero Nurkkala
0 siblings, 1 reply; 16+ messages in thread
From: David Brownell @ 2008-11-14 19:16 UTC (permalink / raw)
To: ext-eero.nurkkala; +Cc: linux-omap
On Friday 14 November 2008, ext-eero.nurkkala@nokia.com wrote:
> The amount of bytes to receive is read from wrong
> place. It is the 6 bits starting from the bit 8 from
> BUFSTAT_REG that indicate this amount. Not the 8 LSB:s.
> Only 6 LSB:s are used for the TX buffer. Also, with
> omap 3430, only the 6 LSB:s are relevant for XDR.
So to summarize: 2430 and 3430 define this register
differently? Lacking 2430 docs, I can't verify that.
Agreed that 3430 has two 6-bit fields, RXSTAT at 8..13
and TXSTAT at 0..5, so this code is wrong for 3430.
But if the issue is that the 2430 version of the FIFO
support works differently, please say so in the patch
commend and code...
- Dave
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-14 19:16 ` David Brownell
@ 2008-11-19 12:12 ` Eero Nurkkala
2008-11-19 17:34 ` David Brownell
0 siblings, 1 reply; 16+ messages in thread
From: Eero Nurkkala @ 2008-11-19 12:12 UTC (permalink / raw)
To: ext David Brownell; +Cc: linux-omap
On Fri, 2008-11-14 at 11:16 -0800, ext David Brownell wrote:
> On Friday 14 November 2008, ext-eero.nurkkala@nokia.com wrote:
> > The amount of bytes to receive is read from wrong
> > place. It is the 6 bits starting from the bit 8 from
> > BUFSTAT_REG that indicate this amount. Not the 8 LSB:s.
> > Only 6 LSB:s are used for the TX buffer. Also, with
> > omap 3430, only the 6 LSB:s are relevant for XDR.
>
> So to summarize: 2430 and 3430 define this register
> differently? Lacking 2430 docs, I can't verify that.
>
> Agreed that 3430 has two 6-bit fields, RXSTAT at 8..13
> and TXSTAT at 0..5, so this code is wrong for 3430.
>
> But if the issue is that the 2430 version of the FIFO
> support works differently, please say so in the patch
> commend and code...
>
> - Dave
>
I checked against 2420, and there was no such register avaiable at all.
(no 2430 TRM access)
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-19 12:12 ` Eero Nurkkala
@ 2008-11-19 17:34 ` David Brownell
2008-11-21 22:03 ` Tony Lindgren
0 siblings, 1 reply; 16+ messages in thread
From: David Brownell @ 2008-11-19 17:34 UTC (permalink / raw)
To: ext-eero.nurkkala; +Cc: linux-omap
On Wednesday 19 November 2008, Eero Nurkkala wrote:
> On Fri, 2008-11-14 at 11:16 -0800, ext David Brownell wrote:
> > But if the issue is that the 2430 version of the FIFO
> > support works differently, please say so in the patch
> > commend and code...
>
> I checked against 2420, and there was no such register
> avaiable at all. (no 2430 TRM access)
That code path couldn't be triggered on 2420; just 2430,
which has the FIFO (as evidently needed for highspeed I2C).
My default assumption would be that 2430 works just like
OMAP3 here, but obviously someone should check the 2430
TRM to see its I2C BUFSTAT_REG really works differently.
- Dave
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-19 17:34 ` David Brownell
@ 2008-11-21 22:03 ` Tony Lindgren
0 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2008-11-21 22:03 UTC (permalink / raw)
To: David Brownell; +Cc: ext-eero.nurkkala, linux-omap
* David Brownell <david-b@pacbell.net> [081119 09:34]:
> On Wednesday 19 November 2008, Eero Nurkkala wrote:
> > On Fri, 2008-11-14 at 11:16 -0800, ext David Brownell wrote:
>
> > > But if the issue is that the 2430 version of the FIFO
> > > support works differently, please say so in the patch
> > > commend and code...
> >
> > I checked against 2420, and there was no such register
> > avaiable at all. (no 2430 TRM access)
>
> That code path couldn't be triggered on 2420; just 2430,
> which has the FIFO (as evidently needed for highspeed I2C).
>
> My default assumption would be that 2430 works just like
> OMAP3 here, but obviously someone should check the 2430
> TRM to see its I2C BUFSTAT_REG really works differently.
Yes, they seem to be the same for 2430 and 34xx. Eero, can you please
update it to use the dev->rev instead? I just pushed Paul's earlier
patches for the dev->rev.
Tony
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-25 6:56 ext-eero.nurkkala
2008-11-25 7:27 ` David Brownell
0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-25 6:56 UTC (permalink / raw)
To: linux-omap; +Cc: Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
The amount of bytes to receive is read from wrong
place with omap 2430 and omap 3430. It is the 6 bits
starting from the bit 8 from BUFSTAT_REG that indicate
this amount. Not the 8 LSB:s. Only 6 LSB:s are used
for the TX buffer. Moreover, only the 6 LSB:s are
relevant for XDR.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
drivers/i2c/busses/i2c-omap.c | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 96f3bed..630702c 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -672,11 +672,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
u8 num_bytes = 1;
if (dev->fifo_size) {
- if (stat & OMAP_I2C_STAT_RRDY)
+ if (stat & OMAP_I2C_STAT_RRDY) {
num_bytes = dev->fifo_size;
- else
- num_bytes = omap_i2c_read_reg(dev,
+ } else {
+ if (dev->rev >= OMAP_I2C_REV_ON_2430)
+ num_bytes =
+ (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG)
+ >> 8) & 0x3F;
+ else
+ num_bytes =
+ omap_i2c_read_reg(dev,
OMAP_I2C_BUFSTAT_REG);
+ }
}
while (num_bytes) {
num_bytes--;
@@ -711,11 +719,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
u8 num_bytes = 1;
if (dev->fifo_size) {
- if (stat & OMAP_I2C_STAT_XRDY)
+ if (stat & OMAP_I2C_STAT_XRDY) {
num_bytes = dev->fifo_size;
- else
- num_bytes = omap_i2c_read_reg(dev,
+ } else {
+ num_bytes =
+ omap_i2c_read_reg(dev,
OMAP_I2C_BUFSTAT_REG);
+
+ if (dev->rev >= OMAP_I2C_REV_ON_2430)
+ num_bytes &= 0x3F;
+ }
}
while (num_bytes) {
num_bytes--;
--
1.6.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-25 6:56 ext-eero.nurkkala
@ 2008-11-25 7:27 ` David Brownell
2008-11-25 9:19 ` Eero Nurkkala
0 siblings, 1 reply; 16+ messages in thread
From: David Brownell @ 2008-11-25 7:27 UTC (permalink / raw)
To: ext-eero.nurkkala; +Cc: linux-omap
On Monday 24 November 2008, ext-eero.nurkkala@nokia.com wrote:
> From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
>
> The amount of bytes to receive is read from wrong
> place with omap 2430 and omap 3430.
More simply: on all OMAPs with highspeed I2C support,
which involves a FIFO and BUFSTAT_REG.
> It is the 6 bits
> starting from the bit 8 from BUFSTAT_REG that indicate
> this amount. Not the 8 LSB:s. Only 6 LSB:s are used
> for the TX buffer. Moreover, only the 6 LSB:s are
> relevant for XDR.
>
> Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 25 +++++++++++++++++++------
> 1 files changed, 19 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 96f3bed..630702c 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -672,11 +672,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
> u8 num_bytes = 1;
> if (dev->fifo_size) {
... i.e. if (dev->rev >= OMAP_I2C_REV_ON_2430) ..
> - if (stat & OMAP_I2C_STAT_RRDY)
> + if (stat & OMAP_I2C_STAT_RRDY) {
> num_bytes = dev->fifo_size;
> - else
> - num_bytes = omap_i2c_read_reg(dev,
> + } else {
> + if (dev->rev >= OMAP_I2C_REV_ON_2430)
> + num_bytes =
> + (omap_i2c_read_reg(dev,
> + OMAP_I2C_BUFSTAT_REG)
> + >> 8) & 0x3F;
> + else
> + num_bytes =
> + omap_i2c_read_reg(dev,
> OMAP_I2C_BUFSTAT_REG);
... so this "else" branch is not needed, neither is the "if" test defining
the two branches ...
> + }
> }
> while (num_bytes) {
> num_bytes--;
> @@ -711,11 +719,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
> u8 num_bytes = 1;
> if (dev->fifo_size) {
... likewise ...
> - if (stat & OMAP_I2C_STAT_XRDY)
> + if (stat & OMAP_I2C_STAT_XRDY) {
> num_bytes = dev->fifo_size;
> - else
> - num_bytes = omap_i2c_read_reg(dev,
> + } else {
> + num_bytes =
> + omap_i2c_read_reg(dev,
> OMAP_I2C_BUFSTAT_REG);
> +
> + if (dev->rev >= OMAP_I2C_REV_ON_2430)
> + num_bytes &= 0x3F;
... and likewise.
> + }
> }
> while (num_bytes) {
> num_bytes--;
> --
> 1.6.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-25 7:27 ` David Brownell
@ 2008-11-25 9:19 ` Eero Nurkkala
2008-11-25 10:01 ` David Brownell
0 siblings, 1 reply; 16+ messages in thread
From: Eero Nurkkala @ 2008-11-25 9:19 UTC (permalink / raw)
To: ext David Brownell; +Cc: linux-omap
Shortly: Restate the introductory header and resend the patches?
On Mon, 2008-11-24 at 23:27 -0800, ext David Brownell wrote:
> On Monday 24 November 2008, ext-eero.nurkkala@nokia.com wrote:
> > From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> >
> > The amount of bytes to receive is read from wrong
> > place with omap 2430 and omap 3430.
>
> More simply: on all OMAPs with highspeed I2C support,
> which involves a FIFO and BUFSTAT_REG.
>
>
> > It is the 6 bits
> > starting from the bit 8 from BUFSTAT_REG that indicate
> > this amount. Not the 8 LSB:s. Only 6 LSB:s are used
> > for the TX buffer. Moreover, only the 6 LSB:s are
> > relevant for XDR.
> >
> > Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> > ---
> > drivers/i2c/busses/i2c-omap.c | 25 +++++++++++++++++++------
> > 1 files changed, 19 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> > index 96f3bed..630702c 100644
> > --- a/drivers/i2c/busses/i2c-omap.c
> > +++ b/drivers/i2c/busses/i2c-omap.c
> > @@ -672,11 +672,19 @@ omap_i2c_isr(int this_irq, void *dev_id)
> > if (stat & (OMAP_I2C_STAT_RRDY | OMAP_I2C_STAT_RDR)) {
> > u8 num_bytes = 1;
> > if (dev->fifo_size) {
>
> ... i.e. if (dev->rev >= OMAP_I2C_REV_ON_2430) ..
>
> > - if (stat & OMAP_I2C_STAT_RRDY)
> > + if (stat & OMAP_I2C_STAT_RRDY) {
> > num_bytes = dev->fifo_size;
> > - else
> > - num_bytes = omap_i2c_read_reg(dev,
> > + } else {
> > + if (dev->rev >= OMAP_I2C_REV_ON_2430)
> > + num_bytes =
> > + (omap_i2c_read_reg(dev,
> > + OMAP_I2C_BUFSTAT_REG)
> > + >> 8) & 0x3F;
> > + else
> > + num_bytes =
> > + omap_i2c_read_reg(dev,
> > OMAP_I2C_BUFSTAT_REG);
>
> ... so this "else" branch is not needed, neither is the "if" test defining
> the two branches ...
>
>
> > + }
> > }
> > while (num_bytes) {
> > num_bytes--;
> > @@ -711,11 +719,16 @@ omap_i2c_isr(int this_irq, void *dev_id)
> > if (stat & (OMAP_I2C_STAT_XRDY | OMAP_I2C_STAT_XDR)) {
> > u8 num_bytes = 1;
> > if (dev->fifo_size) {
>
> ... likewise ...
>
>
> > - if (stat & OMAP_I2C_STAT_XRDY)
> > + if (stat & OMAP_I2C_STAT_XRDY) {
> > num_bytes = dev->fifo_size;
> > - else
> > - num_bytes = omap_i2c_read_reg(dev,
> > + } else {
> > + num_bytes =
> > + omap_i2c_read_reg(dev,
> > OMAP_I2C_BUFSTAT_REG);
> > +
> > + if (dev->rev >= OMAP_I2C_REV_ON_2430)
> > + num_bytes &= 0x3F;
>
> ... and likewise.
>
>
> > + }
> > }
> > while (num_bytes) {
> > num_bytes--;
> > --
> > 1.6.0
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
> >
>
>
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-25 9:19 ` Eero Nurkkala
@ 2008-11-25 10:01 ` David Brownell
0 siblings, 0 replies; 16+ messages in thread
From: David Brownell @ 2008-11-25 10:01 UTC (permalink / raw)
To: ext-eero.nurkkala; +Cc: linux-omap
On Tuesday 25 November 2008, Eero Nurkkala wrote:
> Shortly: Restate the introductory header and resend the patches?
Restate, and update the patch to address the issues noted inline.
You had added the
if (34xx) {
...
} else /* must be 2430 */ {
...
}
branches, but since 34xx and 2430 act the same there (per Tony's
check of the 2430 manual) ... neither the check, nor the "else"
branch, is needed.
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-25 11:02 ext-eero.nurkkala
0 siblings, 0 replies; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-25 11:02 UTC (permalink / raw)
To: linux-omap; +Cc: Eero Nurkkala
From: Eero Nurkkala <eenurkka@lahna.nmp.nokia.com>
The number of bytes to be received is read from wrong
place with all OMAPs with highspeed I2C support,
which involves a FIFO and BUFSTAT_REG. It is the 6
bits starting from the bit 8 in the BUFSTAT_REG
that indicate this amount of bytes to be read.
Moreover, only the 6 LSB:s are relevant for the
TXSTAT field.
Signed-off-by: Eero Nurkkala <eenurkka@lahna.nmp.nokia.com>
---
drivers/i2c/busses/i2c-omap.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 96f3bed..71b37ed 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -675,8 +675,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_RRDY)
num_bytes = dev->fifo_size;
else
- num_bytes = omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG);
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG)
+ >> 8) & 0x3F;
}
while (num_bytes) {
num_bytes--;
@@ -714,8 +715,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_XRDY)
num_bytes = dev->fifo_size;
else
- num_bytes = omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG);
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG))
+ & 0x3F;
}
while (num_bytes) {
num_bytes--;
--
1.6.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
@ 2008-11-25 11:03 ext-eero.nurkkala
2009-01-08 13:37 ` Tony Lindgren
0 siblings, 1 reply; 16+ messages in thread
From: ext-eero.nurkkala @ 2008-11-25 11:03 UTC (permalink / raw)
To: linux-omap; +Cc: Eero Nurkkala
From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
The number of bytes to be received is read from wrong
place with all OMAPs with highspeed I2C support,
which involves a FIFO and BUFSTAT_REG. It is the 6
bits starting from the bit 8 in the BUFSTAT_REG
that indicate this amount of bytes to be read.
Moreover, only the 6 LSB:s are relevant for the
TXSTAT field.
Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
---
drivers/i2c/busses/i2c-omap.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 96f3bed..71b37ed 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -675,8 +675,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_RRDY)
num_bytes = dev->fifo_size;
else
- num_bytes = omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG);
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG)
+ >> 8) & 0x3F;
}
while (num_bytes) {
num_bytes--;
@@ -714,8 +715,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
if (stat & OMAP_I2C_STAT_XRDY)
num_bytes = dev->fifo_size;
else
- num_bytes = omap_i2c_read_reg(dev,
- OMAP_I2C_BUFSTAT_REG);
+ num_bytes = (omap_i2c_read_reg(dev,
+ OMAP_I2C_BUFSTAT_REG))
+ & 0x3F;
}
while (num_bytes) {
num_bytes--;
--
1.6.0
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading
2008-11-25 11:03 [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading ext-eero.nurkkala
@ 2009-01-08 13:37 ` Tony Lindgren
0 siblings, 0 replies; 16+ messages in thread
From: Tony Lindgren @ 2009-01-08 13:37 UTC (permalink / raw)
To: ext-eero.nurkkala; +Cc: linux-omap
* ext-eero.nurkkala@nokia.com <ext-eero.nurkkala@nokia.com> [081125 13:04]:
> From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
>
> The number of bytes to be received is read from wrong
> place with all OMAPs with highspeed I2C support,
> which involves a FIFO and BUFSTAT_REG. It is the 6
> bits starting from the bit 8 in the BUFSTAT_REG
> that indicate this amount of bytes to be read.
> Moreover, only the 6 LSB:s are relevant for the
> TXSTAT field.
Pushing to l-o tree and adding to omap-fixes queue.
Tony
> Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> ---
> drivers/i2c/busses/i2c-omap.c | 10 ++++++----
> 1 files changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 96f3bed..71b37ed 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -675,8 +675,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & OMAP_I2C_STAT_RRDY)
> num_bytes = dev->fifo_size;
> else
> - num_bytes = omap_i2c_read_reg(dev,
> - OMAP_I2C_BUFSTAT_REG);
> + num_bytes = (omap_i2c_read_reg(dev,
> + OMAP_I2C_BUFSTAT_REG)
> + >> 8) & 0x3F;
> }
> while (num_bytes) {
> num_bytes--;
> @@ -714,8 +715,9 @@ omap_i2c_isr(int this_irq, void *dev_id)
> if (stat & OMAP_I2C_STAT_XRDY)
> num_bytes = dev->fifo_size;
> else
> - num_bytes = omap_i2c_read_reg(dev,
> - OMAP_I2C_BUFSTAT_REG);
> + num_bytes = (omap_i2c_read_reg(dev,
> + OMAP_I2C_BUFSTAT_REG))
> + & 0x3F;
> }
> while (num_bytes) {
> num_bytes--;
> --
> 1.6.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2009-01-08 13:37 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-25 11:03 [PATCH] i2c: i2c-omap: Fix BUFSTAT_REG reading ext-eero.nurkkala
2009-01-08 13:37 ` Tony Lindgren
-- strict thread matches above, loose matches on Subject: below --
2008-11-25 11:02 ext-eero.nurkkala
2008-11-25 6:56 ext-eero.nurkkala
2008-11-25 7:27 ` David Brownell
2008-11-25 9:19 ` Eero Nurkkala
2008-11-25 10:01 ` David Brownell
2008-11-14 8:41 ext-eero.nurkkala
2008-11-14 19:16 ` David Brownell
2008-11-19 12:12 ` Eero Nurkkala
2008-11-19 17:34 ` David Brownell
2008-11-21 22:03 ` Tony Lindgren
2008-11-11 6:51 ext-eero.nurkkala
2008-11-11 9:57 ` shekhar, chandra
2008-11-10 10:46 ext-eero.nurkkala
2008-11-10 12:27 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox