Re: [OpenWrt-Devel] GPIO and pinctrl problem

2013-10-11 Thread Gerhard Bertelsmann
Am Fr, 11.10.2013, 02:59, schrieb Jiapeng Li:
 Which version of trunk do you use? After i downgrade to r38025, all things
 work fine.

Thanks for your response.
I'm using 38333 at the moment. I have opened a ticket: #14309
It seems that some glue code between gpio api and pinctrl is missing.
Hopefully John Crispin will fix it.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


[OpenWrt-Devel] GPIO and pinctrl problem

2013-10-10 Thread Gerhard Bertelsmann
Hi,

I'm having a problem with getting and freeing GPIOs. Please have a look at
this simple module:
-8
#include linux/kernel.h
#include linux/module.h
#include linux/init.h
#include linux/gpio.h

#define DRV_NAME GPIO Test
#define PFX DRV_NAME : 
#define GPIO_TEST_PIN 12

static int __init mymodule_init(void) {
int err;
printk (KERN_INFO PFX requesting GPIO %d\n, GPIO_TEST_PIN);
err = gpio_request(GPIO_TEST_PIN, GPIO TEST);
if (err ) {
printk (KERN_ERR PFX didn't get %d\n, GPIO_TEST_PIN);
return -1;
}
return 0;
}

static void __exit mymodule_exit(void) {
   printk (KERN_INFO PFX freeing GPIO %d\n, GPIO_TEST_PIN);
   gpio_free(GPIO_TEST_PIN);
   return;
}

module_init(mymodule_init);
module_exit(mymodule_exit);

MODULE_LICENSE(GPL);
MODULE_AUTHOR(Mister X);
-8

It just request a GPIO and freeing it at module unload. Here is the according
dmesg: (Carambola 1 with RT3052 using actual trunk)

insmod gpio-test
[ 3814.15] GPIO Test: requesting GPIO 12
[ 3814.15] rt2880-pinmux pinctrl.1: request pin 12 (io12) for pio:12
rmmod gpio-test
[ 3825.00] GPIO Test: freeing GPIO 12
insmod gpio-test # again
[ 3832.25] GPIO Test: requesting GPIO 12
[ 3832.25] rt2880-pinmux pinctrl.1: request pin 12 (io12) for pio:12
[ 3832.25] rt2880-pinmux pinctrl.1: pin io12 already requested by pio:12; 
cannot claim for pio:12
[ 3832.26] rt2880-pinmux pinctrl.1: pin-12 (pio:12) status -22
[ 3832.27] GPIO Test: didn't get 12

Why is gpio_free() not enough ? Is there a missing peace in GPIO pinctrl glue ?
Any hint is greatly welcome ...

Regards

Gerd
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] GPIO and pinctrl problem

2013-10-10 Thread Jiapeng Li
I think the new gpio driver(after r38026(include)) of ramips platform has
some bugs, after i set uartf to gpio uartf mode, i can't export any gpio.
Maybe there are some relationship between this error and mine.

root@OpenWrt:/sys/class/gpio# echo 1  export
[ 1056.70] rt2880-pinmux pinctrl.1: pin 1 is not set to gpio mux
[ 1056.72] rt2880-pinmux pinctrl.1: request() failed for pin 1
[ 1056.73] rt2880-pinmux pinctrl.1: pin-1 (pio:1) status -22
ash: write error: Invalid argument
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


Re: [OpenWrt-Devel] GPIO and pinctrl problem

2013-10-10 Thread Jiapeng Li
Which version of trunk do you use? After i downgrade to r38025, all things
work fine.
___
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel