Well, the bug I found in my last blog post was found by someone else (and fixed commit1 commit2 ) in bootc's kernel branch (not in the official one though, sadly).
So here is how I updated stuff and tested.
First, update the firmware using the rpi-update tool installed previously:
Code:
$ sudo rpi-update
$ sudo reboot
Then install new kernel and give it a try:
Code:
$ wget http://apt.bootc.net/debian/pool/main/l/linux-source-3.2.21-rpi1+/linux-image-3.2.21-rpi1+_2_armel.deb
$ sudo dpkg -i linux-image-3.2.21-rpi1+_2_armel.deb
$ rm !$
$ sudo cp /boot/vmlinuz-3.2.21-rpi1+ /boot/kernel.img
$ sudo reboot
Now, try the stuff we did before. Load up the i2c-dev driver and manually configure the I/O expander using the sysfs mechanism:
(as root)
Code:
# modprobe i2c_dev
# echo pca9535 0x20 > /sys/bus/i2c/devices/i2c-0/new_device
# dmesg | tail -2
[ 272.400789] i2c i2c-0: new_device: Instantiated device pca9535 at 0x20
[ 272.440470] pca953x 0-0020: interrupt support not compiled in
Yay! No error!
Code:
$ cd /sys/class/gpio/gpiochip240
$ cat label base ngpio
pca9535
240
16
It auto-sets the range of gpios! The default number for ARCH_NR_GPIOS is 256, so I guess it is counting backwards as it tries to find a range.
Try to actually allocate
...