Initializing GPIO pins

Hi everyone.

Currently I'm configuring the GPIO pins of the beagle board for
measuring our
algorithm's running time.

I've read all previous posts and can't manage yet how to initiliaze
the Board.
For me I do the following steps:
1) I declare at /include/asm-arm/arch-omap/mux.h
  In the enum omap34xx_index{
                                              AH4_3430_GPIO133
                                             }
2) Then at /arch/arm/mach-omap2/mux.c:
In the struct pin_config __initdata_or_module omap34xx_pins[]={
MUX_CNF_34xx("AH4_3430_GPIO133", 0x15, 4,0,0,1,0,1,0,0,0,0)
This is, I want it as an OUTPUT.

3) Finally at arch/arm/mach-omap2/board-omap3beagle.c in the
static void __init omap3evm_init_irq(void)
{
/*.............*/
                omap_gpio_init();
                 omap_cnf_reg(AH4_3430_GPIO133);

}

Is there something I'm doing wrong?

I think other choice may be doing this very thing but at :
/arch/arm/plat-omap/gpio.c

inside the function:
static int __init _omap_gpio_init(void)

Once done, I'm writing a simple code, that initializa all this stuff,
and triggers repeatedly
1-0-1-0 at the corresponding 15 pin (AH4) so that I can measure the
algorithm's effective time.

Can anyone help me?

thanks :slight_smile:

I'm not an expert on this, but I'll try my best to comment...

Guessing you already read http://www.hy-research.com/omap3_pinmux.html.

Hi everyone.

Currently I'm configuring the GPIO pins of the beagle board for
measuring our
algorithm's running time.

I've read all previous posts and can't manage yet how to initiliaze
the Board.
For me I do the following steps:
1) I declare at /include/asm-arm/arch-omap/mux.h
In the enum omap34xx_index{
AH4_3430_GPIO133
}
2) Then at /arch/arm/mach-omap2/mux.c:
In the struct pin_config __initdata_or_module omap34xx_pins[]={
MUX_CNF_34xx("AH4_3430_GPIO133", 0x15, 4,0,0,1,0,1,0,0,0,0)

Those are a lot of parameters. Do you really mean to separate all
those with commas (for them to be parameters)?

In arch/arm/plat-omap/include/mach/mux.h, I found:
#define MUX_CFG_34XX(desc, reg_offset, mux_value) { \
        .name = desc, \
        .debug = 0, \
        .mux_reg = reg_offset, \
        .mux_val = mux_value \
},

That clearly doesn't accept more than 3 arguments, so I'm unclear what
you are trying to accomplish with your extra parameters.

This is, I want it as an OUTPUT.

3) Finally at arch/arm/mach-omap2/board-omap3beagle.c in the
static void __init omap3evm_init_irq(void)
{
/*.............*/
omap_gpio_init();
omap_cnf_reg(AH4_3430_GPIO133);

}

Is there something I'm doing wrong?

Why is there even an omap3evm_init_irq() in your arch/arm/mach-omap2/
board-omap3beagle.c? Don't you want to be looking at omap3_beagle_init
()?

You can probably be a bit lazier and just use GPIOs that are already
configured, like the ones to control the LEDs:
root@beagleboard:~/u-boot-omap3# echo "none" > /sys/class/leds/
beagleboard\:\:usr0/trigger
root@beagleboard:~/u-boot-omap3# echo "1" > /sys/class/leds/beagleboard
\:\:usr0/brightness
root@beagleboard:~/u-boot-omap3# echo "0" > /sys/class/leds/beagleboard
\:\:usr0/brightness

Hi everyone.

Currently I'm configuring the GPIO pins of the beagle board for
measuring our
algorithm's running time.

I've read all previous posts and can't manage yet how to initiliaze
the Board.
For me I do the following steps:
1) I declare at /include/asm-arm/arch-omap/mux.h
  In the enum omap34xx_index{
                                              AH4_3430_GPIO133
                                             }
2) Then at /arch/arm/mach-omap2/mux.c:
In the struct pin_config __initdata_or_module omap34xx_pins[]={
MUX_CNF_34xx("AH4_3430_GPIO133", 0x15, 4,0,0,1,0,1,0,0,0,0)
This is, I want it as an OUTPUT.

Not sure what you are trying to do here. About the only comment is the mux.c
file is shared between OMAP2 and OMAP3. Follow the OMAP3 case.
The line should be something like -
MUX_CFG_34xx("AH4_3430_GPIO133", 0xNNN, OMAP34XX_MUX_MODEn |
OMAP34XX_PIN_OUTPUT);

Where 0xNNN is the register as listed in the TRM. Note the caveats for
determing the register as the TRM lists them as 32bit values but
the kernel wants them as 16bit regs. Please see my page for details.

The OMAP34XX_MUX_MODEn is from the desired mode for the pin in the TRM.

See my page for the details - http://www.hy-research.com/omap3_pinmux.html

If you got your example from some document, could you point to it in case
someone else run into a similar issue.