having toyed around with it, i remembered i had an old soekris net4801 lying around... which, unfortunately, does not have i2c ports pinned out - but it has 12 GPIO pins ... i quickly found i2c-gpio in the linux kernel, but that uses the arch-independent gpio layer called gpiolib. the soekris pc8736x gpio driver does not support this layer :(
i'm by far not a kernel developer, but i managed to insert a small wrapping layer that seems to work. it basically registers the pc8736x as generic gpio chip, additionally to the character device(s).
i repeat: i am not a kernel developer. this is a hack so ugly it will most likely not work for you. if you have a soekris net4801 (no, a net4501 will not work! it has lesser gpio pins! go count!) your chances are indefinitely higher it may work, but i don't guarantee anything. also, even the most basic cleanup code is missing - i am not removing the gpio chip on unload, i just dont' care for now.
included in the patch below is a i2c-gpio-generic module i found in the openwrt subversion by pure coincidence, it works very well. i just patched it so it hardcodes sda and scl to open drain, which is the default on the soekris.
to get i2c up and running on the gpio pins 0 and 1 (jp5 pins 3 and 4 on the connector!) with 0 being sda and 1 being scl, you have to
- modprobe pc8736x_gpio
- read dmesg and note the assigned lowest pin nr (244 for me)
- modprobe i2c-generic-custom bus0=245,244,245 (the latter two being the number from above 1st, and 1 added to it 2nd. the first nr. is the i2c bus id. choose it to your liking.)
- modprobe i2c-dev
a little warning: i wouldn't mess around with the character device while using this, especially not for the pins in use for i2c. you have been warned.
i also wrote a small test program that reads out the current light sensor value (left) of the rp6 running the IC2_Slave example program that it has been shipped with.
also, the *actual* pinout-to-minor-device-nr for the gpio character device might be of interest here:
|Soekris||PC8736x||Minor Device #|
|GPIO 0||GPIO 20, 117||16|
|GPIO 1||GPIO 21, 118||17|
|GPIO 2||GPIO 22, 119||18|
|GPIO 3||GPIO 23, 120||19|
|GPIO 4||GPIO 24, 121||20|
|GPIO 5||GPIO 24, 122||21|
|GPIO 6||GPIO 26, 123||22|
|GPIO 7||GPIO 26, 124||23|
|GPIO 8||GPIO 4, 6||4|
|GPIO 9||GPIO 5, 7||5|
|GPIO 10||GPIO 13, 55||11|
|GPIO 11||GPIO 12, 54||10|
kudos to the guy who found this out, it cost me 2 days to figure out the straightforward approach (GPIO 20 = minor 20?) was wrong.
here is the patch. handle with care. it's against linux-184.108.40.206. i used this .config to build the kernel.