Hello... I have been working on this for two days and I finally got the pin D12 on the i.mx25 to move up and down.... However the method I am using seems caothic... I will describe it now:
I have added the following item to the mxc_iomux_pin[] in the /arch/arm/mach-mx25/mx25_3stack_gpio.c
{ MX25_PIN_D12, MUX_CONFIG_ALT5, PAD_CTL_SRE_FAST | PAD_CTL_DRV_HIGH |
PAD_CTL_DRV_3_3V | PAD_CTL_HYS_CMOS | PAD_CTL_47K_PU | PAD_CTL_PUE_PULL |
PAD_CTL_ODE_CMOS | PAD_CTL_PKE_ENABLE, },
Then I have added this code in the mx25_3stack_gpio_init() function in the same file:
a = gpio_request(IOMUX_TO_GPIO(MX25_PIN_D12), "d12");
b = gpio_direction_output(IOMUX_TO_GPIO(MX25_PIN_D12), 0);
printk(KERN_ERR "\n\r ------------------------------ TRYING TO REQUEST GPIOs ------------------------\n\r");
printk(KERN_ERR "gpio_request(IOMUX_TO_GPIO(MX25_PIN_D12),NULL) = %d", a);
printk(KERN_ERR "\n\rgpio_direction_output(IOMUX_TO_GPIO(MX25_PIN_D12), 0) = %d", b);
for (i=0;i<10;i++) {
printk(KERN_ERR "\n\r-------->SWITCHING D12");
gpio_set_value(IOMUX_TO_GPIO(MX25_PIN_D12), 0);
gpio_set_value(IOMUX_TO_GPIO(MX25_PIN_D12), 1); }
a = gpio_request(IOMUX_TO_GPIO(MX25_PIN_D11), "d11");
b = gpio_direction_output(IOMUX_TO_GPIO(MX25_PIN_D11), 0);
printk(KERN_ERR "\n\r ------------------------------ TRYING TO REQUEST GPIOs ------------------------\n\r");
printk(KERN_ERR "gpio_request(IOMUX_TO_GPIO(MX25_PIN_D11),NULL) = %d", a);
printk(KERN_ERR "\n\rgpio_direction_output(IOMUX_TO_GPIO(MX25_PIN_D11), 0) = %d", b);
for (i=0;i<10;i++) {
printk(KERN_ERR "\n\r-------->SWITCHING D11");
gpio_set_value(IOMUX_TO_GPIO(MX25_PIN_D11), 0);
gpio_set_value(IOMUX_TO_GPIO(MX25_PIN_D11), 1); }
I inserted this text right after the for loop which seems to initialise the iomux block and the pads.
Ironically, D12 throws out a -16 error (which means the resource is busy) and D11 does not give me an error (returns 0), however, D12 actually works and goes up and down evey time I reboot and D11 does not....
I am sorry but this is so caothic for me... how can I know wether this pin is beeing used by another driver/code/whatever ?
If I where to compile an application, could I still invoke these functions (gpio_set_value, gpio_request, gpio_direction_outpu....) from the application? is this a good way to move the gpio pins? I mean, I observed with an oscilloscope and the pins are moving at 250ns.. isn't that a bit slow? is there a way to improve it by writing directly to the GPIOC registers from a driver?
Could someone explain to me or refer me to some document explaining the exact procedure to move gpio pins up and down? I don't only mean the standard linux part of it (which I understand is the part involving the calls to gpio_request, gpio_set_value etc... please correct me if I am wrong) but the platform specific procedure....
i don't know, anyone who can drop me a line with some knowledge on the topic will be of help in getting a more complete view of the problem.
Thanks a lot.