SOURCES: linux-2.4.32-i2c-2.10.0-drivers-i2c.diff (NEW) b41acb0d9e...

hawk hawk at pld-linux.org
Thu Apr 6 00:47:55 CEST 2006


Author: hawk                         Date: Wed Apr  5 22:47:55 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
b41acb0d9e4eefd1aa9d0e9ff5f54220  linux-2.4.32-i2c-2.10.0-drivers-i2c.diff

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

---- Diffs:

================================================================
Index: SOURCES/linux-2.4.32-i2c-2.10.0-drivers-i2c.diff
diff -u /dev/null SOURCES/linux-2.4.32-i2c-2.10.0-drivers-i2c.diff:1.1
--- /dev/null	Thu Apr  6 00:47:55 2006
+++ SOURCES/linux-2.4.32-i2c-2.10.0-drivers-i2c.diff	Thu Apr  6 00:47:50 2006
@@ -0,0 +1,7718 @@
+--- linux-old/Documentation/Configure.help	Sat Feb 18 17:38:46 2006
++++ linux/Documentation/Configure.help	Sun Feb 19 08:27:20 2006
+@@ -19368,6 +19368,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.
+@@ -19389,6 +19399,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
+@@ -19426,6 +19445,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	Wed Apr 14 13:05:29 2004
++++ linux/drivers/i2c/Config.in	Sun Feb 19 08:27:20 2006
+@@ -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	Sun Feb 19 08:27:20 2006
+@@ -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	Thu Sep  8 19:39:37 2005
++++ linux/Documentation/i2c/dev-interface	Sun Feb 19 08:27:20 2006
+@@ -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,13 +92,18 @@
+   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.
+ 
+-ioctl(file,I2C_RDWR,struct i2c_ioctl_rdwr_data *msgset)
++ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset)
+ 
+   Do combined read/write transaction without stop in between.
+-  The argument is a pointer to a struct i2c_ioctl_rdwr_data {
++  The argument is a pointer to a struct i2c_rdwr_ioctl_data {
+ 
+       struct i2c_msg *msgs;  /* ptr to array of simple messages */
+       int nmsgs;             /* number of messages to exchange */
+--- linux-old/Documentation/i2c/functionality	Thu Sep  8 19:39:33 2005
++++ linux/Documentation/i2c/functionality	Sun Feb 19 08:27:20 2006
+@@ -17,8 +17,8 @@
+   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_M_REV_DIR_ADDR,
+-                                  I2C_M_REV_DIR_ADDR and I2C_M_REV_DIR_NOSTART
++  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
+   I2C_FUNC_SMBUS_READ_BYTE        Handles the SMBus read_byte command
+@@ -115,7 +115,7 @@
+ If you try to access an adapter from a userspace program, you will have
+ to use the /dev interface. You will still have to check whether the
+ functionality you need is supported, of course. This is done using
+-the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2c_detect
++the I2C_FUNCS ioctl. An example, adapted from the lm_sensors i2cdetect
+ program, is below:
+ 
+   int file;
+--- linux-old/Documentation/i2c/i2c-pport	Thu Jan  1 00:00:00 1970
++++ linux/Documentation/i2c/i2c-pport	Sun Feb 19 08:27:20 2006
+@@ -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	Sun Feb 19 08:27:20 2006
+@@ -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/summary	Wed Feb 18 13:36:30 2004
++++ linux/Documentation/i2c/summary	Sun Feb 19 08:27:21 2006
+@@ -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	Thu Sep  8 19:39:33 2005
++++ linux/Documentation/i2c/writing-clients	Sun Feb 19 08:27:21 2006
+@@ -28,14 +28,14 @@
+ 	.name		= "Foo version 2.3 driver",
+ 	.id		= I2C_DRIVERID_FOO, /* from i2c-id.h, optional */
+ 	.flags		= I2C_DF_NOTIFY,
+-	.attach_adapter	= &foo_attach_adapter,
+-	.detach_client	= &foo_detach_client,
+-	.command	= &foo_command, /* may be NULL */
+-	.inc_use	= &foo_inc_use, /* May be NULL */
+-	.dec_use	= &foo_dec_use, /* May be NULL */
++	.attach_adapter	= foo_attach_adapter,
++	.detach_client	= foo_detach_client,
++	.command	= foo_command, /* may be NULL */
++	.inc_use	= foo_inc_use, /* May be NULL */
++	.dec_use	= foo_dec_use, /* May be NULL */
+ }
+  
+-The name can be chosen freely, and may be upto 40 characters long. Please
++The name can be chosen freely, and may be up to 31 characters long. Please
+ use something descriptive here.
+ 
+ If used, the id should be a unique ID. The range 0xf000 to 0xffff is
+@@ -58,32 +58,37 @@
+ 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
+ which needs to get its usage count changed; that is why each driver
+-module has to implement its own callback.
++module has to implement its own callback functions.
+ 
+-  void foo_inc_use (struct i2c_client *client)
+-  {
+-  #ifdef MODULE
+-    MOD_INC_USE_COUNT;
+-  #endif
+-  }
++static void foo_inc_use (struct i2c_client *client)
++{
++#ifdef MODULE
++	MOD_INC_USE_COUNT;
++#endif
++}
+ 
+-  void foo_dec_use (struct i2c_client *client)
+-  {
+-  #ifdef MODULE
+-    MOD_DEC_USE_COUNT;
+-  #endif
+-  }
++static void foo_dec_use (struct i2c_client *client)
++{
++#ifdef MODULE
++	MOD_DEC_USE_COUNT;
++#endif
++}
+ 
+-Do not call these call-back functions directly; instead, use one of the
++Do not call these callback functions directly; instead, use the
+ following functions defined in i2c.h:
+-  void i2c_inc_use_client(struct i2c_client *);
+-  void i2c_dec_use_client(struct i2c_client *);
++
++void i2c_inc_use_client(struct i2c_client *);
++void i2c_dec_use_client(struct i2c_client *);
+ 
+ You should *not* increase the module count just because a device is
+ detected and a client created. This would make it impossible to remove
+@@ -101,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. */
+@@ -302,7 +308,7 @@
+      These are automatically translated to insmod variables of the form
+      force_foo.
+ 
+-So we have a generic insmod variabled `force', and chip-specific variables
++So we have a generic insmod variable `force', and chip-specific variables
+ `force_CHIPNAME'.
+ 
+ Fortunately, as a module writer, you just have to define the `normal' 
+@@ -443,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;
+@@ -553,7 +551,7 @@
+         release_region(address,FOO_EXTENT);
+     /* SENSORS ONLY END */
+     ERROR1:
+-      kfree(new_client);
++      kfree(data);
+     ERROR0:
+       return err;
+   }
+@@ -586,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;
+   }
+ 
+@@ -659,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	Sun Feb 19 08:27:21 2006
+@@ -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)
++{
<<Diff was trimmed, longer than 597 lines>>


More information about the pld-cvs-commit mailing list