GPIO device busy error:
We are having trouble accessing the GPIO on the SMARC carrier board from the kernel v3.2. Are they somehow disabled?
# echo 7 > /sys/class/gpio/export
that gives me the device busy error.


To use GPIOs, you can either configure them in kernel or user space. Both way cannot be applied at the same time. 

We configure the GPIO in our kernel and that’s why you saw the device is busy because the kernel is in use. 

If you would like to use them in user space. You need to comment out those line in arch/arm/mach-omap2/board-am335xevm.c 

#define SMARC_GPIO0  GPIO_TO_PIN(3, 4)

#define SMARC_GPIO1  GPIO_TO_PIN(2, 5)

#define SMARC_GPIO2  GPIO_TO_PIN(1, 25)

#define SMARC_GPIO3  GPIO_TO_PIN(1, 24)

#define SMARC_GPIO4  GPIO_TO_PIN(2, 4)

#define SMARC_GPIO5  GPIO_TO_PIN(2, 3)

#define SMARC_GPIO6  GPIO_TO_PIN(1, 28)

#define SMARC_GPIO7  GPIO_TO_PIN(1, 29)

#define SMARC_GPIO8  GPIO_TO_PIN(2, 0)

#define SMARC_GPIO9  GPIO_TO_PIN(2, 1)

#define SMARC_GPIO10  GPIO_TO_PIN(3, 7)

#define SMARC_GPIO11  GPIO_TO_PIN(3, 8)

/* pin 37 of P1 in SBC-SMART-MEN */

#define SMARC_GPIO12  GPIO_TO_PIN(0, 15)

/* pin 38 of P1 in SBC-SMART-MEN */

#define SMARC_GPIO13  GPIO_TO_PIN(0, 14)

/*

* setup SMARC GPIO

* GPIO0-GPIO5 is recommended for use as output and GPIO6-GPIO11 as inputs by

* SMARC specification

*/

static void gpio_init(int evm_id, int profile)

{

        setup_pin_mux(gpio_pin_mux);

/* GPIO0-GPIO11 */

/* GPIO0*/

        gpio_request(SMARC_GPIO0, "GPIO0");

        gpio_direction_output(SMARC_GPIO0, 0);

/* GPIO1*/

        gpio_request(SMARC_GPIO1, "GPIO1");

        gpio_direction_output(SMARC_GPIO1, 0);

/* GPIO2*/

        gpio_request(SMARC_GPIO2, "GPIO2");

        gpio_direction_output(SMARC_GPIO2, 0);

/* GPIO3*/

        gpio_request(SMARC_GPIO3, "GPIO3");

        gpio_direction_output(SMARC_GPIO3, 0);

/* GPIO4*/

        gpio_request(SMARC_GPIO4, "GPIO4");

        gpio_direction_output(SMARC_GPIO4, 0);

/* GPIO5*/

        gpio_request(SMARC_GPIO5, "GPIO5");

        gpio_direction_output(SMARC_GPIO5, 0);

/* GPIO6*/

        gpio_request(SMARC_GPIO6, "GPIO6");

        gpio_direction_input(SMARC_GPIO6);

/* GPIO7*/

        gpio_request(SMARC_GPIO7, "GPIO7");

        gpio_direction_input(SMARC_GPIO7);

/* GPIO8*/

/* GPIO9*/

        gpio_request(SMARC_GPIO9, "GPIO9");

        gpio_direction_input(SMARC_GPIO9);

/* GPIO10*/

        gpio_request(SMARC_GPIO10, "GPIO10");

        gpio_direction_input(SMARC_GPIO10);

/* GPIO11*/

        gpio_request(SMARC_GPIO11, "GPIO11");

        gpio_direction_input(SMARC_GPIO11);

        return;

If you release those lines from kernel. You are free to use GPIOs under user space. 

Tags: GPIO, v3.2
Last update:
2014-08-16 18:13
Author:
Eric Lee
Revision:
1.5
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.