Hi,<br><br>I am new to device driver development. I am trying to access the GPIO of MPC837xERDB eval board. I have upgraded its kernel to linux-2.6.28.9 and enable support for mpc8xxx_gpio.c. On boot up, it successfully detect two gpio controllers. Now my question is how I am going to use it to communicate with the gpio pins? Do I have to modify the code in mpc8xxx_gpio.c file to do whatever I want to do with gpios or I can use the standard gpio API provided in kernel ( gpio_request()/gpio_free() ). I also tries the standard kernel API, but it fails. Here is my code :<br>
<br>#include <linux/module.h><br>#include <linux/errno.h> /* error codes */<br>#include <linux/gpio.h><br><br>static __init int sample_module_init(void)<br>{<br> int ret;<br><br> int i;<br> for (i=1; i<32; i++) {<br>
ret = gpio_request(i, "Sample Driver");<br> if (ret) {<br> printk(KERN_WARNING "sample_driver: unable to request GPIO_PG%d\n", i); <br> //return ret;<br> } <br> }<br><br> return 0;<br>
}<br><br>static __exit void sample_module_exit(void)<br>{<br> gpio_free(9);<br>}<br><br>MODULE_LICENSE("GPL");<br><br>module_init(sample_module_init);<br>module_exit(sample_module_exit);<br><br>It give the following O/P:<br>
<br>[ 617.075329] sample_driver: unable to request GPIO_PG1<br>[ 617.080418] sample_driver: unable to request GPIO_PG2<br>[ 617.085470] sample_driver: unable to request GPIO_PG3<br>[ 617.090522] sample_driver: unable to request GPIO_PG4<br>
[ 617.095574] sample_driver: unable to request GPIO_PG5<br>[ 617.100625] sample_driver: unable to request GPIO_PG6<br>[ 617.105676] sample_driver: unable to request GPIO_PG7<br>[ 617.110727] sample_driver: unable to request GPIO_PG8<br>
[ 617.115779] sample_driver: unable to request GPIO_PG9<br>[ 617.120830] sample_driver: unable to request GPIO_PG10<br>[ 617.125968] sample_driver: unable to request GPIO_PG11<br>[ 617.131106] sample_driver: unable to request GPIO_PG12<br>
[ 617.136245] sample_driver: unable to request GPIO_PG13<br>[ 617.141383] sample_driver: unable to request GPIO_PG14<br>[ 617.146521] sample_driver: unable to request GPIO_PG15<br>[ 617.151660] sample_driver: unable to request GPIO_PG16<br>
[ 617.156798] sample_driver: unable to request GPIO_PG17<br>[ 617.161936] sample_driver: unable to request GPIO_PG18<br>[ 617.167074] sample_driver: unable to request GPIO_PG19<br>[ 617.172213] sample_driver: unable to request GPIO_PG20<br>
[ 617.177351] sample_driver: unable to request GPIO_PG21<br>[ 617.182489] sample_driver: unable to request GPIO_PG22<br>[ 617.187628] sample_driver: unable to request GPIO_PG23<br>[ 617.192767] sample_driver: unable to request GPIO_PG24<br>
[ 617.197905] sample_driver: unable to request GPIO_PG25<br>[ 617.203042] sample_driver: unable to request GPIO_PG26<br>[ 617.208182] sample_driver: unable to request GPIO_PG27<br>[ 617.213319] sample_driver: unable to request GPIO_PG28<br>
[ 617.218458] sample_driver: unable to request GPIO_PG29<br>[ 617.223597] sample_driver: unable to request GPIO_PG30<br>[ 617.228735] sample_driver: unable to request GPIO_PG31<br>[ 617.233873] sample_driver: unable to request GPIO_PG32<br>
<br>Can someone provide me a sample code or something else. Actually I am trying to set the GPIO pin no. 9 to active low as it is connected to a LED on board. <br><br>Thanks in advance<br>Ravi Gupta<br>