Re: [PATCH v2 5/7] i2c: img-scb: remove start bit detected status after handling

2015-08-19 Thread James Hogan
On Fri, Aug 14, 2015 at 04:50:22PM +0100, Sifan Naeem wrote:
 Remove start bit detected status after it is handled,
 doing so will prevent this condition being hit for
 every interrupt on a particular transfer.
 
 Fixes: commit 27bce457d588 (i2c: img-scb: Add Imagination Technologies I2C 
 SCB driver)
 Signed-off-by: Sifan Naeem sifan.na...@imgtec.com
 Reviewed-by: James Hartley james.hart...@imgtec.com
 ---
  drivers/i2c/busses/i2c-img-scb.c |   16 
  1 file changed, 12 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/i2c/busses/i2c-img-scb.c 
 b/drivers/i2c/busses/i2c-img-scb.c
 index e4daebcdf824..200108dbd194 100644
 --- a/drivers/i2c/busses/i2c-img-scb.c
 +++ b/drivers/i2c/busses/i2c-img-scb.c
 @@ -857,10 +857,18 @@ static unsigned int img_i2c_auto(struct img_i2c *i2c,
   }
  
   /* Enable transaction halt on start bit */
 - if (!i2c-last_msg  i2c-line_status  LINESTAT_START_BIT_DET) {
 - img_i2c_transaction_halt(i2c, true);
 - /* we're no longer interested in the slave event */
 - i2c-int_enable = ~INT_SLAVE_EVENT;
 + if (line_status  LINESTAT_START_BIT_DET) {
 + if (!i2c-last_msg) {
 + img_i2c_transaction_halt(i2c, true);
 + /* we're no longer interested in the slave event */
 + i2c-int_enable = ~INT_SLAVE_EVENT;
 + }
 + /*
 +  * Remove start bit detected status after it is handled,
 +  * doing so will prevent this condition being hit for
 +  * every interrupt on a particular transfer.
 +  */
 + i2c-line_status = ~LINESTAT_START_BIT_DET;

If we start checking line_status instead of i2c-line_status, this
masking off of START_BIT_DET from i2c-line_status seems redundant as it
won't have any effect on whether we hit this condition again on the next
interrupt.

I think the one line patch with just s/i2c-line_status/line_status/ on
the condition should be sufficient to prevent it handling the situation
repeatedly (that line status bit is latched, and should have been
already acked).

Cheers
James

   }
  
   mod_timer(i2c-check_timer, jiffies + msecs_to_jiffies(1));
 -- 
 1.7.9.5
 


signature.asc
Description: Digital signature


[PATCH v2 5/7] i2c: img-scb: remove start bit detected status after handling

2015-08-14 Thread Sifan Naeem
Remove start bit detected status after it is handled,
doing so will prevent this condition being hit for
every interrupt on a particular transfer.

Fixes: commit 27bce457d588 (i2c: img-scb: Add Imagination Technologies I2C SCB 
driver)
Signed-off-by: Sifan Naeem sifan.na...@imgtec.com
Reviewed-by: James Hartley james.hart...@imgtec.com
---
 drivers/i2c/busses/i2c-img-scb.c |   16 
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
index e4daebcdf824..200108dbd194 100644
--- a/drivers/i2c/busses/i2c-img-scb.c
+++ b/drivers/i2c/busses/i2c-img-scb.c
@@ -857,10 +857,18 @@ static unsigned int img_i2c_auto(struct img_i2c *i2c,
}
 
/* Enable transaction halt on start bit */
-   if (!i2c-last_msg  i2c-line_status  LINESTAT_START_BIT_DET) {
-   img_i2c_transaction_halt(i2c, true);
-   /* we're no longer interested in the slave event */
-   i2c-int_enable = ~INT_SLAVE_EVENT;
+   if (line_status  LINESTAT_START_BIT_DET) {
+   if (!i2c-last_msg) {
+   img_i2c_transaction_halt(i2c, true);
+   /* we're no longer interested in the slave event */
+   i2c-int_enable = ~INT_SLAVE_EVENT;
+   }
+   /*
+* Remove start bit detected status after it is handled,
+* doing so will prevent this condition being hit for
+* every interrupt on a particular transfer.
+*/
+   i2c-line_status = ~LINESTAT_START_BIT_DET;
}
 
mod_timer(i2c-check_timer, jiffies + msecs_to_jiffies(1));
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-i2c in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html