All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision
@ 2012-10-31  3:00 sachin surendran
  2012-10-31  9:52 ` Jochen Friedrich
  2012-11-25 13:21 ` Kumar Gala
  0 siblings, 2 replies; 4+ messages in thread
From: sachin surendran @ 2012-10-31  3:00 UTC (permalink / raw)
  To: linuxppc-dev, jochen

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

In case of collision on i2c bus the controller which lost bus mastership
stays as a slave
for all subsequent transfers. This results in the i2c controller never
writing to the bus
for future transactions, resulting in i2c transfer timeouts.
  This fix checks for a collision on last I2C transaction and sets the
I2COM_MASTER
bit for the new transaction.

Signed-off-by: Sachin Surendran <sachin.surendran@alliedtelesis.co.nz>
---
 drivers/i2c/busses/i2c-cpm.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096..bb94c6d 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -338,6 +338,14 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap,
struct i2c_msg *msgs, int num)
        tptr = 0;
        rptr = 0;

+       /*
+        * If there was a collision in the last i2c transaction,
+        * Set I2COM_MASTER as it was cleared during collision.
+        */
+       if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) {
+               out_8(&cpm->i2c_reg->i2com, I2COM_MASTER);
+       }
+
        while (tptr < num) {
                pmsg = &msgs[tptr];
                dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr);

[-- Attachment #2: Type: text/html, Size: 1736 bytes --]

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

* Re: [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision
  2012-10-31  3:00 [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision sachin surendran
@ 2012-10-31  9:52 ` Jochen Friedrich
  2012-11-25 13:21 ` Kumar Gala
  1 sibling, 0 replies; 4+ messages in thread
From: Jochen Friedrich @ 2012-10-31  9:52 UTC (permalink / raw)
  To: sachin surendran; +Cc: linuxppc-dev

Hi Sachin,

looks good to me.

Acked-By: Jochen Friedrich <jochen@scram.de>

> Signed-off-by: Sachin Surendran <sachin.surendran@alliedtelesis.co.nz
> <mailto:sachin.surendran@alliedtelesis.co.nz>>
> ---
>   drivers/i2c/busses/i2c-cpm.c |    8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..bb94c6d 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -338,6 +338,14 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap,
> struct i2c_msg *msgs, int num)
>          tptr = 0;
>          rptr = 0;
> +       /*
> +        * If there was a collision in the last i2c transaction,
> +        * Set I2COM_MASTER as it was cleared during collision.
> +        */
> +       if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) {
> +               out_8(&cpm->i2c_reg->i2com, I2COM_MASTER);
> +       }
> +
>          while (tptr < num) {
>                  pmsg = &msgs[tptr];
>                  dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr);
>

Thanks, Jochen

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

* Re: [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision
  2012-10-31  3:00 [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision sachin surendran
  2012-10-31  9:52 ` Jochen Friedrich
@ 2012-11-25 13:21 ` Kumar Gala
  2012-11-25 22:57   ` sachin surendran
  1 sibling, 1 reply; 4+ messages in thread
From: Kumar Gala @ 2012-11-25 13:21 UTC (permalink / raw)
  To: sachin surendran; +Cc: linuxppc-dev


On Oct 30, 2012, at 10:00 PM, sachin surendran wrote:

> In case of collision on i2c bus the controller which lost bus =
mastership stays as a slave
> for all subsequent transfers. This results in the i2c controller never =
writing to the bus=20
> for future transactions, resulting in i2c transfer timeouts.
>   This fix checks for a collision on last I2C transaction and sets the =
I2COM_MASTER=20
> bit for the new transaction.
>=20
> Signed-off-by: Sachin Surendran <sachin.surendran@alliedtelesis.co.nz>
> ---
>  drivers/i2c/busses/i2c-cpm.c |    8 ++++++++
>  1 file changed, 8 insertions(+)

patch doesn't apply, please resend properly.

- k

>=20
> diff --git a/drivers/i2c/busses/i2c-cpm.c =
b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..bb94c6d 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -338,6 +338,14 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, =
struct i2c_msg *msgs, int num)
>         tptr =3D 0;
>         rptr =3D 0;
> =20
> +       /*
> +        * If there was a collision in the last i2c transaction,
> +        * Set I2COM_MASTER as it was cleared during collision.
> +        */
> +       if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) {
> +               out_8(&cpm->i2c_reg->i2com, I2COM_MASTER);
> +       }
> +
>         while (tptr < num) {
>                 pmsg =3D &msgs[tptr];
>                 dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr);
>=20
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

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

* Re: [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision
  2012-11-25 13:21 ` Kumar Gala
@ 2012-11-25 22:57   ` sachin surendran
  0 siblings, 0 replies; 4+ messages in thread
From: sachin surendran @ 2012-11-25 22:57 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev

Hi Kumar,
             I have resent the updated patch.

Regards
Sachin

On Mon, Nov 26, 2012 at 2:21 AM, Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Oct 30, 2012, at 10:00 PM, sachin surendran wrote:
>
>> In case of collision on i2c bus the controller which lost bus mastership stays as a slave
>> for all subsequent transfers. This results in the i2c controller never writing to the bus
>> for future transactions, resulting in i2c transfer timeouts.
>>   This fix checks for a collision on last I2C transaction and sets the I2COM_MASTER
>> bit for the new transaction.
>>
>> Signed-off-by: Sachin Surendran <sachin.surendran@alliedtelesis.co.nz>
>> ---
>>  drivers/i2c/busses/i2c-cpm.c |    8 ++++++++
>>  1 file changed, 8 insertions(+)
>
> patch doesn't apply, please resend properly.
>
> - k
>
>>
>> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
>> index c1e1096..bb94c6d 100644
>> --- a/drivers/i2c/busses/i2c-cpm.c
>> +++ b/drivers/i2c/busses/i2c-cpm.c
>> @@ -338,6 +338,14 @@ static int cpm_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
>>         tptr = 0;
>>         rptr = 0;
>>
>> +       /*
>> +        * If there was a collision in the last i2c transaction,
>> +        * Set I2COM_MASTER as it was cleared during collision.
>> +        */
>> +       if (in_be16(&tbdf->cbd_sc) & BD_SC_CL) {
>> +               out_8(&cpm->i2c_reg->i2com, I2COM_MASTER);
>> +       }
>> +
>>         while (tptr < num) {
>>                 pmsg = &msgs[tptr];
>>                 dev_dbg(&adap->dev, "R: %d T: %d\n", rptr, tptr);
>>
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>

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

end of thread, other threads:[~2012-11-25 22:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-31  3:00 [PATCH] i2c-cpm: Fix to takeback i2c bus master-ship after a collision sachin surendran
2012-10-31  9:52 ` Jochen Friedrich
2012-11-25 13:21 ` Kumar Gala
2012-11-25 22:57   ` sachin surendran

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.