SOURCES: linux-2.4.34-i2c-2.10.2-drivers-i2c.diff (NEW) - 20ae9683...

marcus marcus at pld-linux.org
Sun Feb 18 14:09:11 CET 2007


Author: marcus                       Date: Sun Feb 18 13:09:11 2007 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- 20ae9683cc8b48dbbc77f9384be53f65  linux-2.4.34-i2c-2.10.2-drivers-i2c.diff

---- Files affected:
SOURCES:
   linux-2.4.34-i2c-2.10.2-drivers-i2c.diff (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/linux-2.4.34-i2c-2.10.2-drivers-i2c.diff
diff -u /dev/null SOURCES/linux-2.4.34-i2c-2.10.2-drivers-i2c.diff:1.1
--- /dev/null	Sun Feb 18 14:09:11 2007
+++ SOURCES/linux-2.4.34-i2c-2.10.2-drivers-i2c.diff	Sun Feb 18 14:09:06 2007
@@ -0,0 +1,7113 @@
+--- linux-old/Documentation/Configure.help	Tue Jan 16 08:30:38 2007
++++ linux/Documentation/Configure.help	Tue Jan 16 08:30:47 2007
+@@ -19386,6 +19386,16 @@
+   <file:Documentation/modules.txt>.
+   The module will be called i2c-velleman.o.
+ 
++Basic I2C on Parallel Port adapter
++CONFIG_I2C_PPORT
++  This supports directly connecting I2C devices to the parallel port.
++  See <file:Documentation/i2c/i2c-pport> for more information.
++
++  This driver is also available as a module.  If you want to compile
++  it as a module, say M here and read
++  <file:Documentation/modules.txt>.
++  The module will be called i2c-pport.o.
++
+ I2C PCF 8584 interfaces
+ CONFIG_I2C_ALGOPCF
+   This allows you to use a range of I2C adapters called PCF adapters.
+@@ -19407,6 +19417,15 @@
+   <file:Documentation/modules.txt>.
+   The module will be called i2c-elektor.o.
+ 
++PCF on the EPP Parallel Port
++CONFIG_I2C_PCFEPP
++  This supports the PCF8584 connected to the parallel port.
++
++  This driver is also available as a module.  If you want to compile
++  it as a module, say M here and read
++  <file:Documentation/modules.txt>.
++  The module will be called i2c-pcf-epp.o.
++
+ ITE I2C Algorithm
+ CONFIG_ITE_I2C_ALGO
+   This supports the use the ITE8172 I2C interface found on some MIPS
+@@ -19444,6 +19463,51 @@
+   Supports the SGI interfaces like the ones found on SGI Indy VINO
+   or SGI O2 MACE.
+ 
++Motorola 8xx I2C algorithm
++CONFIG_I2C_ALGO8XX
++  This is the algorithm that allows you to use Motorola 8xx I2C adapters.
++
++  This driver is also available as a module.  If you want to compile
++  it as a module, say M here and read
++  <file:Documentation/modules.txt>.
++  The module will be called i2c-algo-8xx.o.
++
++Motorola 8xx I2C interface
++CONFIG_I2C_RPXLITE
++  This supports the Motorola 8xx I2C device.
++
++  This driver is also available as a module.  If you want to compile
++  it as a module, say M here and read
++  <file:Documentation/modules.txt>.
++  The module will be called i2c-rpx.o.
++
++IBM 405 I2C algorithm
++CONFIG_I2C_IBM_OCP_ALGO
++  This is the algorithm that allows you to use IBM 405 I2C adapters.
++
++  This driver is also available as a module.  If you want to compile
++  it as a module, say M here and read
++  <file:Documentation/modules.txt>.
++  The module will be called i2c-algo-ibm_ocp.o.
++
++IBM 405 I2C interface
++CONFIG_I2C_IBM_OCP_ADAP
++  This supports the IBM 405 I2C device.
++
++  This driver is also available as a module.  If you want to compile
++  it as a module, say M here and read
++  <file:Documentation/modules.txt>.
++  The module will be called i2c-adap-ibm_ocp.o.
++
++StrongARM SA-1110 interface
++CONFIG_I2C_FRODO
++  This supports the StrongARM SA-1110 Development Board.
++
++  This driver is also available as a module.  If you want to compile
++  it as a module, say M here and read
++  <file:Documentation/modules.txt>.
++  The module will be called i2c-frodo.o.
++
+ I2C device interface
+ CONFIG_I2C_CHARDEV
+   Say Y here to use i2c-* device files, usually found in the /dev
+--- linux-old/drivers/i2c/Config.in	Tue Jan 16 08:30:39 2007
++++ linux/drivers/i2c/Config.in	Tue Jan 16 08:30:47 2007
+@@ -12,6 +12,10 @@
+       dep_tristate '  Philips style parallel port adapter' CONFIG_I2C_PHILIPSPAR $CONFIG_I2C_ALGOBIT $CONFIG_PARPORT
+       dep_tristate '  ELV adapter' CONFIG_I2C_ELV $CONFIG_I2C_ALGOBIT
+       dep_tristate '  Velleman K8000 adapter' CONFIG_I2C_VELLEMAN $CONFIG_I2C_ALGOBIT
++      dep_tristate '  Basic I2C on Parallel Port' CONFIG_I2C_PPORT $CONFIG_I2C_ALGOBIT
++      if [ "$CONFIG_ARCH_SA1100" = "y" ]; then
++         dep_tristate 'SA1100 I2C Adapter' CONFIG_I2C_FRODO $CONFIG_I2C_ALGOBIT
++      fi
+       dep_tristate '  NatSemi SCx200 I2C using GPIO pins' CONFIG_SCx200_I2C $CONFIG_SCx200_GPIO $CONFIG_I2C_ALGOBIT
+       if [ "$CONFIG_SCx200_I2C" != "n" ]; then
+          int  '    GPIO pin used for SCL' CONFIG_SCx200_I2C_SCL 12
+@@ -24,6 +28,7 @@
+    dep_tristate 'I2C PCF 8584 interfaces' CONFIG_I2C_ALGOPCF $CONFIG_I2C
+    if [ "$CONFIG_I2C_ALGOPCF" != "n" ]; then
+       dep_tristate '  Elektor ISA card' CONFIG_I2C_ELEKTOR $CONFIG_I2C_ALGOPCF
++      dep_tristate '  PCF on EPP port' CONFIG_I2C_PCFEPP $CONFIG_I2C_ALGOPCF
+    fi
+ 
+    if [ "$CONFIG_MIPS_ITE8172" = "y" ]; then
+@@ -58,6 +63,13 @@
+       dep_tristate 'I2C SGI interfaces' CONFIG_I2C_ALGO_SGI $CONFIG_I2C
+    fi
+  
++   if [ "$CONFIG_IBM_OCP" = "y" ]; then
++      dep_tristate 'IBM on-chip I2C Algorithm' CONFIG_I2C_IBM_OCP_ALGO $CONFIG_I2C
++      if [ "$CONFIG_I2C_IBM_OCP_ALGO" != "n" ]; then
++         dep_tristate '  IBM on-chip I2C Adapter' CONFIG_I2C_IBM_OCP_ADAP $CONFIG_I2C_IBM_OCP_ALGO
++      fi
++   fi
++
+ # This is needed for automatic patch generation: sensors code starts here
+ # This is needed for automatic patch generation: sensors code ends here
+ 
+--- linux-old/drivers/i2c/Makefile	Wed Feb 18 13:36:31 2004
++++ linux/drivers/i2c/Makefile	Tue Jan 16 08:30:47 2007
+@@ -6,6 +6,7 @@
+ 
+ export-objs	:= i2c-core.o i2c-algo-bit.o i2c-algo-pcf.o \
+ 		   i2c-algo-ite.o i2c-algo-sibyte.o i2c-algo-sgi.o \
++		   i2c-algo-8xx.o i2c-algo-ibm_ocp.o \
+ 		   i2c-proc.o
+ 
+ obj-$(CONFIG_I2C)		+= i2c-core.o
+@@ -18,6 +19,13 @@
+ obj-$(CONFIG_I2C_ELEKTOR)	+= i2c-elektor.o
+ obj-$(CONFIG_ITE_I2C_ALGO)	+= i2c-algo-ite.o
+ obj-$(CONFIG_ITE_I2C_ADAP)	+= i2c-adap-ite.o
++obj-$(CONFIG_I2C_PPORT)		+= i2c-pport.o
++obj-$(CONFIG_I2C_FRODO)		+= i2c-frodo.o
++obj-$(CONFIG_I2C_PCFEPP)	+= i2c-pcf-epp.o
++obj-$(CONFIG_I2C_ALGO8XX)	+= i2c-algo-8xx.o
++obj-$(CONFIG_I2C_RPXLITE)	+= i2c-rpx.o
++obj-$(CONFIG_I2C_IBM_OCP_ALGO)	+= i2c-algo-ibm_ocp.o
++obj-$(CONFIG_I2C_IBM_OCP_ADAP)	+= i2c-adap-ibm_ocp.o
+ obj-$(CONFIG_I2C_PROC)		+= i2c-proc.o
+ obj-$(CONFIG_SCx200_I2C)	+= scx200_i2c.o
+ obj-$(CONFIG_SCx200_ACB)	+= scx200_acb.o
+--- linux-old/Documentation/i2c/dev-interface	Tue Jan 16 08:30:38 2007
++++ linux/Documentation/i2c/dev-interface	Tue Jan 16 08:30:47 2007
+@@ -14,9 +14,12 @@
+ =========
+ 
+ So let's say you want to access an i2c adapter from a C program. The
+-first thing to do is `#include <linux/i2c.h>" and "#include <linux/i2c-dev.h>. 
+-Yes, I know, you should never include kernel header files, but until glibc 
+-knows about i2c, there is not much choice.
++first thing to do is "#include <linux/i2c-dev.h>". Please note that
++there are two files named "i2c-dev.h" out there, one is distributed
++with the Linux kernel and is meant to be included from kernel
++driver code, the other one is distributed with lm_sensors and is
++meant to be included from user-space programs. You obviously want
++the second one here.
+ 
+ Now, you have to decide which adapter you want to access. You should
+ inspect /proc/bus/i2c to decide this. Adapter numbers are assigned
+@@ -78,7 +81,7 @@
+ ==========================
+ 
+ The following IOCTLs are defined and fully supported 
+-(see also i2c-dev.h and i2c.h):
++(see also i2c-dev.h):
+ 
+ ioctl(file,I2C_SLAVE,long addr)
+   Change slave address. The address is passed in the 7 lower bits of the
+@@ -89,6 +92,11 @@
+   Selects ten bit addresses if select not equals 0, selects normal 7 bit
+   addresses if select equals 0. Default 0.
+ 
++ioctl(file,I2C_PEC,long select)
++  Selects SMBus PEC (packet error checking) generation and verification
++  if select not equals 0, disables if select equals 0. Default 0.
++  Used only for SMBus transactions.
++
+ ioctl(file,I2C_FUNCS,unsigned long *funcs)
+   Gets the adapter functionality and puts it in *funcs.
+ 
+--- linux-old/Documentation/i2c/functionality	Tue Jan 16 08:30:38 2007
++++ linux/Documentation/i2c/functionality	Tue Jan 16 08:30:47 2007
+@@ -17,7 +17,7 @@
+   I2C_FUNC_I2C                    Plain i2c-level commands (Pure SMBus
+                                   adapters typically can not do these)
+   I2C_FUNC_10BIT_ADDR             Handles the 10-bit address extensions
+-  I2C_FUNC_PROTOCOL_MANGLING      Knows about the
++  I2C_FUNC_PROTOCOL_MANGLING      Knows about the I2C_M_IGNORE_NAK,
+                                   I2C_M_REV_DIR_ADDR and I2C_M_NOSTART
+                                   flags (which modify the i2c protocol!)
+   I2C_FUNC_SMBUS_QUICK            Handles the SMBus write_quick command
+--- linux-old/Documentation/i2c/i2c-pport	Thu Jan  1 00:00:00 1970
++++ linux/Documentation/i2c/i2c-pport	Tue Jan 16 08:30:47 2007
+@@ -0,0 +1,67 @@
++Parallel Port Adapters
++----------------------
++If you are installing parallel port adapters it means you are probably messing 
++around with wires and IC's and the like. If you have purchased a card that 
++provides an external i2c/smbus this will require combined algorithm and 
++adapter code in a single module.
++If you are doing it yourself by using the parallel port there 
++are basically 2 options.
++
++1) Using the parallel port and using the i2c-pport adapter module and the 
++i2c-algo-bit algorithm module together to enable you to wire up your parallel 
++port to act as an i2c/smbus. This provides a bus that will enable most 
++sensors to work but doesn't support the entire i2c/smbus capability.
++
++2) Using the parallel port to interface to a Philips PCF8584 parallel to i2c 
++adapter chip. You will need to build a bit of a circuit to do this. This 
++configuration needs the i2c-pcf-epp adapter module and the i2c-algo-pcf 
++algorithm module. This support almost all of the i2c/smbus capabilities.
++
++
++i2c-pport Documentation
++-----------------------
++This is a primitive parallel port driver for the i2c bus, which exploits 
++features of modern bidirectional parallel ports. 
++
++Bidirectional ports have particular bits connected in following way:
++   
++                        |
++            /-----|     R
++         --o|     |-----|
++      read  \-----|     /------- Out pin
++                      |/
++                   - -|\
++                write   V
++                        |
++                       ---  
++
++
++It means when output is set to 1 we can read the port. Therefore 
++we can use 2 pins of parallel port as SDA and SCL for i2c bus. It 
++is not necessary to add any external - additional parts, we can 
++read and write the same port simultaneously.
++	I only use register base+2 so it is possible to use all 
++8 data bits of parallel port for other applications (I have 
++connected EEPROM and LCD display). I do not use bit Enable Bi-directional
++ Port. The only disadvantage is we can only support 5V chips.
++
++Layout:
++
++Cannon 25 pin
++
++SDA - connect to pin 14 (Auto Linefeed)
++SCL - connect to pin 16 (Initialize Printer)
++GND - connect to pin 18-25
+++5V - use external supply (I use 5V from 3.5" floppy connector)
++      
++no pullups  requied
++
++Module parameters:
++
++base = 0xXXX
++XXX - 278 or 378
++
++That's all.
++
++Daniel Smolik
++marvin at sitour.cz
+--- linux-old/Documentation/i2c/i2c-protocol	Wed Feb 18 13:36:30 2004
++++ linux/Documentation/i2c/i2c-protocol	Tue Jan 16 08:30:47 2007
+@@ -65,3 +65,12 @@
+     need to emit an Rd instead of a Wr, or vice versa, you set this
+     flag. For example:
+       S Addr Rd [A] Data [A] Data [A] ... [A] Data [A] P
++
++  Flags I2C_M_IGNORE_NAK
++    Normally message is interrupted immediately if there is [NA] from the
++    client. Setting this flag treats any [NA] as [A], and all of
++    message is sent.
++    These messages may still fail to SCL lo->hi timeout.
++
++  Flags I2C_M_NO_RD_ACK
++    In a read message, master A/NA bit is skipped.
+--- linux-old/Documentation/i2c/smbus-protocol	Wed Feb 18 13:36:30 2004
++++ linux/Documentation/i2c/smbus-protocol	Tue Jan 16 08:30:47 2007
+@@ -97,7 +97,7 @@
+ =====================
+ 
+ This is the opposite operation of the Read Word Data command. 16 bits
+-of data is read from a device, from a designated register that is 
++of data is written to a device, to the designated register that is
+ specified through the Comm byte. 
+ 
+ S Addr Wr [A] Comm [A] DataLow [A] DataHigh [A] P
+--- linux-old/Documentation/i2c/summary	Tue Jan 16 08:30:38 2007
++++ linux/Documentation/i2c/summary	Tue Jan 16 08:30:47 2007
+@@ -59,16 +59,16 @@
+ i2c-algo-8xx:    An algorithm for CPM's I2C device in Motorola 8xx processors (NOT BUILT BY DEFAULT)
+ i2c-algo-bit:    A bit-banging algorithm
+ i2c-algo-pcf:    A PCF 8584 style algorithm
+-i2c-algo-ppc405: An algorithm for the I2C device in IBM 405xx processors (NOT BUILT BY DEFAULT)
++i2c-algo-ibm_ocp: An algorithm for the I2C device in IBM 4xx processors (NOT BUILT BY DEFAULT)
+ 
+ Adapter drivers
+ ---------------
+ 
+ i2c-elektor:     Elektor ISA card (uses i2c-algo-pcf)
+ i2c-elv:         ELV parallel port adapter (uses i2c-algo-bit)
+-i2c-pcf-epp:     PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (BROKEN - missing i2c-pcf-epp.h)
++i2c-pcf-epp:     PCF8584 on a EPP parallel port (uses i2c-algo-pcf) (NOT mkpatched)
+ i2c-philips-par: Philips style parallel port adapter (uses i2c-algo-bit)
+-i2c-ppc405:      IBM 405xx processor I2C device (uses i2c-algo-ppc405) (NOT BUILT BY DEFAULT)
++i2c-adap-ibm_ocp: IBM 4xx processor I2C device (uses i2c-algo-ibm_ocp) (NOT BUILT BY DEFAULT)
+ i2c-pport:       Primitive parallel port adapter (uses i2c-algo-bit)
+ i2c-rpx:         RPX board Motorola 8xx I2C device (uses i2c-algo-8xx) (NOT BUILT BY DEFAULT)
+ i2c-velleman:    Velleman K8000 parallel port adapter (uses i2c-algo-bit)
+--- linux-old/Documentation/i2c/writing-clients	Tue Jan 16 08:30:38 2007
++++ linux/Documentation/i2c/writing-clients	Tue Jan 16 08:30:48 2007
+@@ -58,8 +58,12 @@
+ If your driver can also be compiled as a module, there are moments at 
+ which the module can not be removed from memory. For example, when you
+ are doing a lengthy transaction, or when you create a /proc directory,
+-and some process has entered that directory (this last case is the
+-main reason why these call-backs were introduced).
++and some process has entered that directory.
++
++i2c-core and i2c-proc will take care of properly counting the users
++of the client driver for the common cases. If however your driver has
++functions used by other parts of the kernel, you will have to implement
++the inc_use and dec_use callback functions and use them.
+ 
+ To increase or decrease the module usage count, you can use the
+ MOD_{INC,DEC}_USE_COUNT macros. They must be called from the module
+@@ -102,6 +106,7 @@
+ An example structure is below.
+ 
+   struct foo_data {
++    struct i2c_client client;
+     struct semaphore lock; /* For ISA access in `sensors' drivers. */
+     int sysctl_id;         /* To keep the /proc directory entry for 
+                               `sensors' drivers. */
+@@ -444,20 +449,12 @@
+        client structure, even though we cannot fill it completely yet.
+        But it allows us to access several i2c functions safely */
+     
+-    /* Note that we reserve some space for foo_data too. If you don't
+-       need it, remove it. We do it here to help to lessen memory
+-       fragmentation. */
+-    if (! (new_client = kmalloc(sizeof(struct i2c_client) + 
+-                                sizeof(struct foo_data),
+-                                GFP_KERNEL))) {
++    if (!(data = kzalloc(sizeof(struct foo_data), GFP_KERNEL))) {
+       err = -ENOMEM;
+       goto ERROR0;
+     }
+ 
+-    /* This is tricky, but it will set the data to the right value. */
+-    client->data = new_client + 1;
+-    data = (struct foo_data *) (client->data);
+-
++    new_client = &data->client;
+     new_client->addr = address;
+     new_client->data = data;
+     new_client->adapter = adapter;
+@@ -554,7 +551,7 @@
+         release_region(address,FOO_EXTENT);
+     /* SENSORS ONLY END */
+     ERROR1:
+-      kfree(new_client);
++      kfree(data);
+     ERROR0:
+       return err;
+   }
+@@ -587,7 +584,7 @@
+       release_region(client->addr,LM78_EXTENT);
+     /* SENSORS ONLY END */
+ 
+-    kfree(client); /* Frees client data too, if allocated at the same time */
++    kfree(client->data);
+     return 0;
+   }
+ 
+@@ -660,12 +657,6 @@
+ A generic ioctl-like function call back is supported. You will seldom
+ need this. You may even set it to NULL.
+ 
+-  /* No commands defined */
+-  int foo_command(struct i2c_client *client, unsigned int cmd, void *arg)
+-  {
+-    return 0;
+-  }
+-
+ 
+ Sending and receiving
+ =====================
+--- linux-old/drivers/i2c/i2c-adap-ibm_ocp.c	Thu Jan  1 00:00:00 1970
++++ linux/drivers/i2c/i2c-adap-ibm_ocp.c	Tue Jan 16 08:30:48 2007
+@@ -0,0 +1,368 @@
++/*
++   -------------------------------------------------------------------------
++   i2c-adap-ibm_ocp.c i2c-hw access for the IIC peripheral on the IBM PPC 405
++   -------------------------------------------------------------------------
++  
++   Ian DaSilva, MontaVista Software, Inc.
++   idasilva at mvista.com or source at mvista.com
++
++   Copyright 2000 MontaVista Software Inc.
++
++   Changes made to support the IIC peripheral on the IBM PPC 405 
++
++
++   ----------------------------------------------------------------------------
++   This file was highly leveraged from i2c-elektor.c, which was created
++   by Simon G. Vogl and Hans Berglund:
++
++ 
++     Copyright (C) 1995-97 Simon G. Vogl
++                   1998-99 Hans Berglund
++
++   With some changes from Kyösti Mälkki <kmalkki at cc.hut.fi> and even
++   Frodo Looijaard <frodol at dds.nl>
++
++
++    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.
++   ----------------------------------------------------------------------------
++
++   History: 01/20/12 - Armin
++   	akuster at mvista.com
++   	ported up to 2.4.16+	
++
++   Version 02/03/25 - Armin
++       converted to ocp format
++       removed commented out or #if 0 code
++
++   TODO: convert to ocp_register
++         add PM hooks
++
++*/
++
++
++#include <linux/kernel.h>
++#include <linux/ioport.h>
++#include <linux/module.h>
++#include <linux/delay.h>
++#include <linux/slab.h>
++#include <linux/init.h>
++#include <linux/i2c.h>
++#include <linux/i2c-algo-ibm_ocp.h>
++#include <asm/irq.h>
++#include <asm/io.h>
++#include <asm/ocp.h>
++
++/*
++ * This next section is configurable, and it is used to set the number
++ * of i2c controllers in the system.  The default number of instances is 1,
++ * however, this should be changed to reflect your system's configuration.
++ */ 
++
++/*
++ * The STB03xxx, with a PPC405 core, has two i2c controllers.
++ */
++//(sizeof(IIC_ADDR)/sizeof(struct iic_regs))
++extern iic_t *IIC_ADDR[];
++static struct iic_ibm iic_ibmocp_adaps[IIC_NUMS][5];
++
++static struct i2c_algo_iic_data *iic_ibmocp_data[IIC_NUMS];
++static struct i2c_adapter *iic_ibmocp_ops[IIC_NUMS];
++
++static int i2c_debug=0;
++static wait_queue_head_t iic_wait[IIC_NUMS];
++static int iic_pending;
++static spinlock_t irq_driver_lock = SPIN_LOCK_UNLOCKED;
++
++
++/* ----- global defines -----------------------------------------------	*/
++#define DEB(x)	if (i2c_debug>=1) x
++#define DEB2(x) if (i2c_debug>=2) x
++#define DEB3(x) if (i2c_debug>=3) x
++#define DEBE(x)	x	/* error messages 				*/
++
++/* ----- local functions ----------------------------------------------	*/
++
++//
++// Description: Write a byte to IIC hardware
++//
++static void iic_ibmocp_setbyte(void *data, int ctl, int val)
++{
++   // writeb resolves to a write to the specified memory location
++   // plus a call to eieio.  eieio ensures that all instructions
++   // preceding it are completed before any further stores are
++   // completed.
++   // Delays at this level (to protect writes) are not needed here.
++   writeb(val, ctl);
++}
++
++
++//
++// Description: Read a byte from IIC hardware
++//
++static int iic_ibmocp_getbyte(void *data, int ctl)
++{
++   int val;
++
++   val = readb(ctl);
++   return (val);
++}
++
++
++//
++// Description: Return our slave address.  This is the address
++// put on the I2C bus when another master on the bus wants to address us
++// as a slave
++//
++static int iic_ibmocp_getown(void *data)
++{
++   return(((struct iic_ibm *)(data))->iic_own);
++}
++
++
++//
++// Description: Return the clock rate
++//
++static int iic_ibmocp_getclock(void *data)
++{
++   return(((struct iic_ibm *)(data))->iic_clock);
++}
++
++
++
++//
++// Description:  Put this process to sleep.  We will wake up when the
++// IIC controller interrupts.
++//
++static void iic_ibmocp_waitforpin(void *data) {
++
++   int timeout = 2;
++   struct iic_ibm *priv_data = data;
++
++   //
++   // If interrupts are enabled (which they are), then put the process to
++   // sleep.  This process will be awakened by two events -- either the
++   // the IIC peripheral interrupts or the timeout expires. 
++   //
++   if (priv_data->iic_irq > 0) {
++      spin_lock_irq(&irq_driver_lock);
++      if (iic_pending == 0) {
++  	 interruptible_sleep_on_timeout(&(iic_wait[priv_data->index]), timeout*HZ );
++      } else
++ 	 iic_pending = 0;
++      spin_unlock_irq(&irq_driver_lock);
++   } else {
++      //
++      // If interrupts are not enabled then delay for a reasonable amount
++      // of time and return.  We expect that by time we return to the calling
++      // function that the IIC has finished our requested transaction and
++      // the status bit reflects this.
++      //
++      // udelay is probably not the best choice for this since it is
++      // the equivalent of a busy wait
++      //
++      udelay(100);
++   }
++   //printk("iic_ibmocp_waitforpin: exitting\n");
++}
++
++
++//
++// Description: The registered interrupt handler
++//
++static void iic_ibmocp_handler(int this_irq, void *dev_id, struct pt_regs *regs) 
++{
++   int ret;
++   struct iic_regs *iic;
++   struct iic_ibm *priv_data = dev_id;
++   iic = (struct iic_regs *) priv_data->iic_base;
++   iic_pending = 1;
++   DEB2(printk("iic_ibmocp_handler: in interrupt handler\n"));
++   // Read status register
++   ret = readb((int) &(iic->sts));
++   DEB2(printk("iic_ibmocp_handler: status = %x\n", ret));
++   // Clear status register.  See IBM PPC 405 reference manual for details
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list