This module use 74LS05 based circuit. It give buffered outputs/inputs and 3.3V/5V 
levels conversion. Take a look to i2c_gpio.pdf. You can also use NPN or PNP transistors.
Just use the "inverted" option of the module.

WARNING ! WARNING ! WARNING ! WARNING ! WARNING !
NEVER PUT +5V ON OUTPUT GPIO. THIS WILL KILL THE GPIO LINE !

Don't forget to enable i2c in the kernel configuration. 

Use  :

make kernel_menuconfig

and choose :

Device Drivers -> I2C support -> <M> I2C support
                                 I2C Algorithms -> <M> I2C bit-banging interfaces
				 [*]   I2C Core debugging messages
				 [*]   I2C Algorithm debugging messages
				 [*]   I2C Bus debugging messages

Then :

make menuconfig

and choose :

Kernel drivers -> <M> kmod-i2cgpio

You will get :

kmod-i2c-algos_2.6.19.2-atheros-1_mips.ipk
kmod-i2c-core_2.6.19.2-atheros-1_mips.ipk
kmod-i2cgpio_2.6.19.2-atheros-1_mips.ipk

Then, on the Fonera :

- Flash the new kernel from Redboot

- install packages

- remove autoloaded i2c_algo_bit with rmmod

- install i2c-algo-bit with test and debug stuff with :

insmod i2c_algo_bit i2c_debug=3 bit_test=1

- install i2c-gpio with :

insmod i2c-gpio inverted=1

- show i2c_algo_bit tests and debug messages with dmesg | tail :

i2c-algo-bit.o: (0) scl=128, sda=16
i2c-algo-bit.o: (1) scl=128, sda=0
i2c-algo-bit.o: (2) scl=128, sda=16
i2c-algo-bit.o: (3) scl=0, sda=16
needed 1 jiffies
i2c-algo-bit.o: (4) scl=128, sda=16
i2c-algo-bit.o: GPIO adapter passed test.
 : hw routines registered.
i2c_adapter i2c-0: adapter [GPIO adapter] registered
i2c-dev: adapter [GPIO adapter] registered as minor 0
gpio_i2c: module loaded
gpio_i2c: inverted outputs

It work !

Note that GPIO on La Fonera are very slow. Take a look to the gpio_i2c code :

static struct i2c_algo_bit_data i2c_gpio_algo_data = {
  .setsda   = bit_gpio_setsda,
  .setscl   = bit_gpio_setscl,
  .getsda   = bit_gpio_getsda,
  .getscl   = bit_gpio_getscl,
  600,   /* udelay */
  600,   /* mdelay, in millisecs, unused */
  100,   /* timeout, in jiffies */
};

i2c-parport-light.c use 60 for udelay. This won't work with La Fonera. 
It's too fast.

Have Fun.
Denis Bodor <lefinnois@lefinnois.net>
