Accessing GPIO-pins on a MPC8308E RDB (powerpc)
As the subject says, I am attempting to access the GPIO-pins on a MPC8308 through /sys/class/gpio, and I suspect I am doing something elementary wrong.
For instance: Code:
echo 0 > /sys/class/gpio/export Code:
gpio_request: gpio-0 (sysfs) status -22 I am quite new to playing with embedded systems, so a nudge in the right direction would be highly appreciated :) ##system information:## uname -a: Quote:
Code:
gpio@c00 { |
Try it as root.
|
Thank you for the reply. All commands were run as root, I should probably have mentioned that.
|
Anyone?
I would welcome any suggestions as to how I can communicate with the GPIO-pins, it doesn't have to be through /sys (my ultimate goal is to create a char device driver, and I thought /sys/class/gpio would be a nice place to start in order to verify that GPIO worked as expected). My (somewhat vague) theory is that I have to add something to <..>/arch/powerpc/platforms/83xx/mpc830x_rdb.c, but I have no idea what I need to add. Extensive googling led me to try the driver found here: http://docs.blackfin.uclinux.org/dok...rs:simple-gpio, and I added this to mpc830x_rdb.c: Code:
static struct resource foo_resources[] = { All this leads me to suspect that the source of the problem lies in either mpc8308erdb.dts or mpc830x_rdb.c, but I have no idea whatsoever as to how I should debug this any further.. More details: kernel is compiled with both CONFIG_QUICC_ENGINE and CONFIG_SIMPLE_GPIO set to yes (and also various relevant SYSFS-flags). |
Just in case some other poor soul have a similar problem and comes across this thread, this is how I made it work:
* Make sure the pin you are measuring on is actually active (I had to modify the SICRH-register to do this) (It is probably wise to test that GPIO actually works by using devmem or similar to write directly to the memory locations used by GPIO and measure the output by using an oscilloscope, leds or similar) * Be inspired by <..>/drivers/gpio/xilinx_gpio.c and modify it to suit the MPC8308-board, and use this to control the pins. I am still not able to use sysfs to control gpio, but as long as my driver works I'm happy :) |
All times are GMT -5. The time now is 02:33 PM. |