public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c-pxa.c recover from false start
@ 2008-06-17 22:39 Chuck Kamas
       [not found] ` <36A8B4824CA88E478F1A25136D0597610112DD04-RKsfjrak5bi0VCHWTNMfawC/G2K4zDHf@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Chuck Kamas @ 2008-06-17 22:39 UTC (permalink / raw)
  To: i2c-GZX6beZjE8VD60Wz+7aTrA


[-- Attachment #1.1: Type: text/plain, Size: 1609 bytes --]

Hi all,

 

I made this patch to recover from a false start on the bus.  This
scenario happens in my system when a device is hot-inserted onto the bus
causing a false start.  This is caused by the new device pulling SDA
low.  The PXA then thinks someone is trying to talk on the bus and will
not transmit.  My solution is to detect this fault and reset the pxa's
i2c subsystem... not nice I know.  If there is a better way, let me
know!

 

Chuck

 

--- i2c-pxa.c.orig      2008-06-12 00:22:11.000000000 -0700

+++ i2c-pxa.c   2008-06-17 15:34:45.000000000 -0700

@@ -540,6 +540,18 @@

        writel(icr | ICR_START | ICR_TB, _ICR(i2c));

 }

 

+static inline void i2c_pxa_stop_message(struct pxa_i2c *i2c)

+{

+       u32 icr;

+

+       /*

+        * Clear the STOP and ACK flags

+        */

+       icr = readl(_ICR(i2c));

+       icr &= ~(ICR_STOP | ICR_ACKNAK);

+       writel(icr, _ICR(i2c));

+}

+

 /*

  * We are protected by the adapter bus mutex.

  */

@@ -554,6 +566,7 @@

        ret = i2c_pxa_wait_bus_not_busy(i2c);

        if (ret) {

                dev_err(&i2c->adap.dev, "i2c_pxa: timeout waiting for
bus free\n");

+               i2c_pxa_reset(i2c);

                goto out;

        }

 

@@ -582,6 +595,7 @@

         * The rest of the processing occurs in the interrupt handler.

         */

        timeout = wait_event_timeout(i2c->wait, i2c->msg_num == 0, HZ *
5);

+       i2c_pxa_stop_message(i2c);

 

        /*

         * We place the return code in i2c->msg_idx.


[-- Attachment #1.2: Type: text/html, Size: 8812 bytes --]

[-- Attachment #2: Type: text/plain, Size: 157 bytes --]

_______________________________________________
i2c mailing list
i2c-GZX6beZjE8VD60Wz+7aTrA@public.gmane.org
http://lists.lm-sensors.org/mailman/listinfo/i2c

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

end of thread, other threads:[~2008-06-24 16:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-17 22:39 [PATCH] i2c-pxa.c recover from false start Chuck Kamas
     [not found] ` <36A8B4824CA88E478F1A25136D0597610112DD04-RKsfjrak5bi0VCHWTNMfawC/G2K4zDHf@public.gmane.org>
2008-06-19 11:42   ` Jean Delvare
     [not found]     ` <36A8B4824CA88E478F1A25136D0597610112DEAE@mail.ad.skymv.com>
     [not found]       ` <36A8B4824CA88E478F1A25136D0597610112DEAE-RKsfjrak5bi0VCHWTNMfawC/G2K4zDHf@public.gmane.org>
2008-06-24 16:03         ` Jean Delvare
     [not found]           ` <20080624180307.6de9d47d-ig7AzVSIIG7kN2dkZ6Wm7A@public.gmane.org>
2008-06-24 16:13             ` Chuck Kamas
     [not found]               ` <36A8B4824CA88E478F1A25136D05976101163DF1-RKsfjrak5bi0VCHWTNMfawC/G2K4zDHf@public.gmane.org>
2008-06-24 16:51                 ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox