Skip to contentSkip to conversation

2.5.30 i2c updates

PATCH In review Albert Cranford 2 participants 2 messages Aug 9, 2002 I2C

lore
Share & tools
lore
#0 lore raw

PATCH 3/4 2.5.30 i2c updates

Hello Linus,
Please apply the following four patches that update 2.5.30 with these I2C changes:
o Support for SMBus 2.0 PEC Packet Error Checking
o New adapter-i2c-frodo for SA 1110 board
o New adapter-i2c-rpx for embeded MPC8XX
o Replace depreciated cli()&sti() with spin_{un}lock_irq()
o Updated documentation
Thanks,
Albert

include/linux/i2c-algo-8xx.h 2002-06-11 22:29:54.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +43 -0
@@ -0,0 +1,43 @@
+/* ------------------------------------------------------------------------- */
+/* i2c-algo-8xx.h i2c driver algorithms for MPX8XX CPM                      */
+/*
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                */
+/* ------------------------------------------------------------------------- */
+
+/* $Id: i2c-algo-8xx.h,v 1.3 2002/06/12 02:29:54 mds Exp $ */
+
+#ifndef I2C_ALGO_8XX_H
+#define I2C_ALGO_8XX_H 1
+
+#include <linux/i2c.h>
+
+struct i2c_algo_8xx_data {
+       uint dp_addr;
+       int reloc;
+       volatile i2c8xx_t *i2c;
+       volatile iic_t  *iip;
+       volatile cpm8xx_t *cp;
+
+       int     (*setisr) (int irq,
+                          void (*func)(void *, void *),
+                          void *data);
+
+       u_char  temp[513];
+};
+
+int i2c_8xx_add_bus(struct i2c_adapter *);
+int i2c_8xx_del_bus(struct i2c_adapter *);
+
+#endif /* I2C_ALGO_8XX_H */
drivers/i2c/i2c-algo-bit.c 2002-07-07 20:41:49.000000000 -0400 renamed from drivers/i2c/i2c-algo-bit.c.orig 2002-07-05 19:42:28.000000000 -0400 +2 -2
@@ -21,7 +21,7 @@
 /* With some changes from Kyösti Mälkki <[email protected]> and even
    Frodo Looijaard <[email protected]> */
 
-/* $Id: i2c-algo-bit.c,v 1.34 2001/11/19 18:45:02 mds Exp $ */
+/* $Id: i2c-algo-bit.c,v 1.37 2002/07/08 00:41:49 mds Exp $ */
 
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -143,7 +148,7 @@
        /* scl, sda may not be high */
        DEBPROTO(printk(" Sr "));
        setsda(adap,1);
-       setscl(adap,1);
+       sclhi(adap);
        udelay(adap->udelay);
        
        sdalo(adap);
drivers/i2c/i2c-algo-ibm_ocp.c 2002-07-03 21:00:38.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +966 -0

966 lines not on this page · raw message

drivers/i2c/i2c-algo-ibm_ocp.h 2002-07-03 21:00:38.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +55 -0

55 lines not on this page · raw message

drivers/i2c/i2c-elektor.c 2002-08-07 22:39:08.000000000 -0400 renamed from drivers/i2c/i2c-elektor.c.orig 2002-07-05 19:42:02.000000000 -0400 +4 -8
@@ -55,12 +55,9 @@
   in some functions, called from the algo-pcf module. Sometimes it's
   need to be rewriten - but for now just remove this for simpler reading */
 
-#if (LINUX_VERSION_CODE < 0x020301)
-static struct wait_queue *pcf_wait = NULL;
-#else
 static wait_queue_head_t pcf_wait;
-#endif
 static int pcf_pending;
+spinlock_t irq_driver_lock = SPIN_LOCK_UNLOCKED;
 
 /* ----- global defines -----------------------------------------------        */
 #define DEB(x) if (i2c_debug>=1) x
@@ -121,12 +118,12 @@
        int timeout = 2;
 
        if (irq > 0) {
-               cli();
+               spin_lock_irq(&irq_driver_lock);
                if (pcf_pending == 0) {
                        interruptible_sleep_on_timeout(&pcf_wait, timeout*HZ );
                } else
                        pcf_pending = 0;
-               sti();
+               spin_unlock_irq(&irq_driver_lock);
        } else {
                udelay(100);
        }
@@ -280,9 +277,7 @@
                base = DEFAULT_BASE;
        }
 
-#if (LINUX_VERSION_CODE >= 0x020301)
        init_waitqueue_head(&pcf_wait);
-#endif
        if (pcf_isa_init() == 0) {
                if (i2c_pcf_add_bus(&pcf_isa_ops) < 0) {
                        pcf_isa_exit();
@@ -297,6 +292,7 @@
        return 0;
 }
 
+EXPORT_NO_SYMBOLS;
 
 #ifdef MODULE
 MODULE_AUTHOR("Hans Berglund <[email protected]>");
drivers/i2c/i2c-frodo.c 2002-07-09 08:39:21.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +118 -0

118 lines not on this page · raw message

drivers/i2c/i2c-rpx.c 2002-06-11 22:29:54.000000000 -0400 renamed from dev/null 1994-07-17 19:46:18.000000000 -0400 +136 -0

136 lines not on this page · raw message

Signature · 2 lines
Albert Cranford Deerfield Beach FL USA
[email protected]
#1 lore raw

btw, I'm Russell, not Rusty. 8)

drivers/i2c/i2c-elektor.c 2002-08-07 22:39:08.000000000 -0400 line 123

Quoted 11 lines · Albert Cranford
drivers/i2c/i2c-elektor.c 2002-08-07 22:39:08.000000000 -0400 renamed from drivers/i2c/i2c-elektor.c.orig 2002-07-05 19:42:02.000000000 -0400 +1 -1
...
@@ -121,12 +118,12 @@
        int timeout = 2;
 
        if (irq > 0) {
-               cli();
+               spin_lock_irq(&irq_driver_lock);
                if (pcf_pending == 0) {
                        interruptible_sleep_on_timeout(&pcf_wait, timeout*HZ );

Two points here:

- Sleeping with interrupts disabled.
- Use of interruptible_sleep_on_timeout().

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html