Readme for the Intel® IXP400 Software Linux* I2C Driver Patch


Copyright Notice


 Copyright © 2007, Intel Corporation

July 4, 2007


This readme contains instructions for installing the Linux* I2C driver for the Intel(R) IXP46X Product Line of Network Processors
(Filename: GPL_ixp400LinuxI2CDriver-<version>.zip).

The GPL_ixp400LinuxI2CDriver-<version>.zip file contains the I2C adapter module driver for Intel IXP46X network processors.


<Supported Versions>

     Intel(R) IXP400 Software Release v3.0
     Linux kernel

<Features Supported by the Intel® IXP400 Software Linux* I2C Driver>

1. I2C device configuration (fast or normal mode, interrupt or poll mode, enable/disable slave response, enable/disable general call response)

2. Slave address response

3. General call response

4. Master-initiated repeated start transfer

5. Master-initiated single-byte read/write

6. Master-initiated multiple-bytes read/write

7. Statistics of master, slave, and general call transactions

8. Status register display

9. Bus scan for slave devices


<Features Not Supported by Intel® IXP400 Software Linux* I2C Driver>

Callbacks are not supported as the callbacks with user space address is not allowed to be called by the kernel.


1. This driver supports six additional features (features 1, 2, 3, 7, 8, and 9 of the above feature list) compared to the Intel® IOP3xx/IXP46X I2C driver
2. This driver is dependent upon the Intel® IXP400 Software Release Access Layer I2C component


<Files contained in GPL_ixp400LinuxI2CDriver-<version>.zip>




Ensure the environment file is being sourced according to the instruction found in the Intel(R) IXP400 Software Release Notes.

Ensure the environment is set up for the IXP46X product line by checking the env for IX_DEVICE=ixp46X.


Steps to compile the i2c-adap-ixp400.c:

1. Copy the i2c-adap-ixp400.c and i2c-adap-ixp400.h to the LSP's drivers/i2c/busses folder.

Example: $ cp i2c-adap-ixp400.c <LSP>/drivers/i2c/busses
                $ cp i2c-adap-ixp400.h <LSP>/drivers/i2c/busses

where <LSP> denotes the directory in which the LSP is installed.

2. Modify the <LSP>/drivers/i2c/busses/Kconfig: Add the following after the entry before "endmenu" for 'Intel XScale IOP3xx/IXP46X on-chip I2C interface':

config I2C_IXP46X

tristate "Intel XScale IXP46X on-chip CSR I2C interface"
requires m
depends on I2C

3. Modify the <LSP>/drivers/i2c/busses/Makefile:

a) Find "obj-$(CONFIG_I2C_IXP4XX) += i2c-ixp4xx.o" and add below it:

    obj-$(CONFIG_I2C_IXP46X) += i2c-adap-ixp400.o


b) Add the following to the end of the Makefile:

    OSAL_SRCDIR := $(IX_XSCALE_SW)/../ixp_osal
    include ${OSAL_SRCDIR}/platforms/ixp46X/os/linux/make/

    CFLAGS_i2c-adap-ixp400.o = -DWall -D__ixp46X -I$(IX_XSCALE_SW)/src/include/ \
                                                   $(OSAL_INCLUDES) $(OSAL_CFLAGS)

4. Enable the I2C adapter as a module and compile

Example: $ make ${IX_KBUILD_CROSSCOMPILE} menuconfig

               go to -> Device Drivers -> I2C support -> I2C Hardware Bus Support
               Set 'Intel XScale IXP46X on-chip CSR I2C interface' to <M> (module)

               $ make ${IX_KBUILD_CROSSCOMPILE} modules

5. The compilation will produce an object - i2c-adap-ixp400.ko

6. i2c-adap-ixp400.ko can be loaded only after the I2C algorithm module is loaded into the kernel.

Example: $ insmod ixp400.ko OR $ insmod ixp400_i2c.ko

$ insmod i2c-adap-ixp400.ko

<Instructions on Usage>

1. The I2C device file must be opened by the application in order to access the I2C device from the user space. The presence of I2C device file in the system depends on the setup. It will be automatically created in system with udev daemon running or with devfs enabled, while the rest require mknod. The minor number of IXP4XX I2C device also varies from system to system. The minor number is determined by the kernel and depends on the number of I2C bus device drivers registered to the kernel. If you have one existing I2C bus driver registered to the kernel, then the minor number assigned to IXP4XX I2C driver is 1, and 0 if no other I2C bus drivers are present. The common names used are /dev/i2c-<minor number> or /dev/i2c/<minor number>.

2. The list of commands for the I2C driver is available in i2c-adap-ixp400.h

Example: ioctl(i2cFd, I2C_DRV_INIT, &initI2cVarsSelected)
               ioctl(i2cFd, I2C_DRV_STATS_GET, &i2cStats)

3. The read and write commands will perform master read and write

Example: read(i2cFd, &i2cBuffer, 4)
               write(i2cFd, &i2cBuffer, 4)

4. To set the slave to be accessed, use the standard I2C ioctl command of I2C_SLAVE.

Example: ioctl(i2cFd, I2C_SLAVE, SLAVE_DEVICE_ADDR)