[Soekris] GPIO support for the net-4801 on Linux
Jim Cromie
jim.cromie at gmail.com
Wed Dec 27 04:43:06 UTC 2006
Arnau Sanchez wrote:
> Hello,
>
> I have a Soekris net4801 with voyage v0.2 installed (it includes a kernel
> 2.6.15-486-voyage). I needed to use the GPIO for digital input/output, and
> looking for information I found this message from Jim Cromie:
>
> http://lists.soekris.com/pipermail/soekris-tech/2006-June/010550.html
>
>
Also, to corroborate your config..
soekris:~# more /etc/modprobe.d/{gpio,sensors,scx*}
::::::::::::::
/etc/modprobe.d/gpio
::::::::::::::
# assign last 2 dynamic devnums to gpios (255..240)
options scx200_gpio major=240
options pc8736x_gpio major=241
::::::::::::::
/etc/modprobe.d/sensors
::::::::::::::
options pc87360 init=3
::::::::::::::
/etc/modprobe.d/scx200_hrt
::::::::::::::
options scx200_hrt mhz27=1
# scx200_hrt ppm=-18
> install pc8736x_gpio /sbin/modprobe --ignore-install pc8736x_gpio &&
> /usr/local/sbin/gpio-dev create
>
>
I don't have to do that workaround, but I wasnt using udev then either.
You could just make the nodes unconditionally, say in rc.local.
This simplifies a tiny bit, and if the module isnt there, the user App
still gets an error that is readily identifiable:
soekris:/dev# cat gpio-00
cat: gpio-00: No such device or address
soekris:/dev#
soekris:/dev# echo 1 > gpio-00
-bash: gpio-00: No such device or address
FYI - this test was contrived to show the msg above..
soekris:/dev# ll gpio-00
crw-r--r-- 1 root root 250, 1 Dec 26 20:43 gpio-00
> By the way, I have a problem with the pc8736x_gpio module: if I rmmod it and
> then do a modprobe, it fails:
>
> meta:~# modprobe pc8736x_gpio
> meta:~# rmmod pc8736x_gpio
> meta:~# modprobe pc8736x_gpio
> FATAL: Error inserting pc8736x_gpio
> (/lib/modules/2.6.17-voyage-ehas/kernel/drivers/char/pc8736x_gpio.ko): No such
> device
> FATAL: Error running install command for pc8736x_gpio
>
>
Ive not seen this.
Can you send me your .config, dmesg, etc (I cant think of anything else atm)
I dont think the ML needs a CC, but its your choice.
And perhaps recompile with DEBUG=1 added near the top of the code
(both pc8736x_gpio and nsc_gpio), along with various CONFIG_*_DEBUG..
CONFIG_PCI_DEBUG, etc
Its been a while since I looked at the code, so Im being a bit vague here.
> ...
>
> Well, now the question is: although all of this works, I am not sure if this is
> the correct procedure, is there any better way to do it?
>
>
your setup is essentially equivalent to mine - except for the
re-modprobe error.
I take it you are running udev, and need to repopulate /dev on each boot ?
I wrote something like your shell-script, and used it just once.
Now that Ive switched (forgetting about the /dev/gpio-* entries)
I need to do this myself..
Has anyone here written any udev rules, and want to post an example ?
> pd: many thanks, of course, to Jim for this great work on the GPIO interface! I
> hope the official kernel include his patches soon.
>
FYI, the patchset is in 2.6.18, that makes things a bit easier.
And youre quite welcome. Thanks for the report, and good luck
with the module and your app.
-jimc
More information about the Soekris-tech
mailing list