Skip to contentSkip to conversation

GPIO commands on OMAP4

DISCUSSION Patrick 2 participants 6 messages Apr 5, 2012

lore
Share & tools
lore

Patrick

author
#0 lore raw

Dear mailing-list,

I am using a pcm049 phyCORE omap4430 module from Phytec with BareBox 2011.09.0 patched with BSP from Phytec.

I would like to use the GPIO command to read a switch at startup. This chip is connected on ABE_MCBSP1_DX (gpio_116). I have edited the boards/pcm049/mux.c files to change the configuration of this GPIO as follow: {ABE_MCBSP1_DX, (DIS | IEN | M3)} instead of {ABE_MCBSP1_DX, (SAFE_MODE)}.

I then use the "gpio_get_value 116" command followed by "echo $?" to read the value. I always read a 0. On Linux I could read the right value depending of the position of the switch, so it's not an hardware problems.

I have tried with one of the two LEDs on the module (gpio_152) and I could change the LED state and read it back with gpio_get_value.

I do not understand what I am doing wrong. Any help will be appreciated.

Patrick

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

author
#1 lore raw
Quoted 20 lines · Patrick

Dear mailing-list,

I am using a pcm049 phyCORE omap4430 module from Phytec with BareBox 2011.09.0 patched with BSP from Phytec.

I would like to use the GPIO command to read a switch at startup. This chip is connected on ABE_MCBSP1_DX (gpio_116). I have edited the boards/pcm049/mux.c files to change the configuration of this GPIO as
follow: {ABE_MCBSP1_DX, (DIS | IEN | M3)} instead of {ABE_MCBSP1_DX, (SAFE_MODE)}.

I then use the "gpio_get_value 116" command followed by "echo $?" to read the value. I always read a 0. On Linux I could read the right value depending of the position of the switch, so it's not an hardware problems.

I have tried with one of the two LEDs on the module (gpio_152) and I could change the LED state and read it back with gpio_get_value.

I do not understand what I am doing wrong. Any help will be appreciated.

Quoted 8 lines

Patrick

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

I have done same test with the latest revision on the pengutronix git and the results are the same...

Any idea ?

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#2 lore raw
In reply to Patrick
Quoted 16 lines · Patrick

Dear mailing-list,

I am using a pcm049 phyCORE omap4430 module from Phytec with BareBox 2011.09.0 patched with BSP from Phytec.

I would like to use the GPIO command to read a switch at startup. This chip is connected on ABE_MCBSP1_DX (gpio_116). I have edited the boards/pcm049/mux.c files to change the configuration of this GPIO as follow: {ABE_MCBSP1_DX, (DIS | IEN | M3)} instead of {ABE_MCBSP1_DX, (SAFE_MODE)}.

I then use the "gpio_get_value 116" command followed by "echo $?" to read the value. I always read a 0. On Linux I could read the right value depending of the position of the switch, so it's not an hardware problems.

Quoted 4 lines

I have tried with one of the two LEDs on the module (gpio_152) and I could change the LED state and read it back with gpio_get_value.

I do not understand what I am doing wrong. Any help will be appreciated.

What you tried should work. The only thing I can imagine is that you need a gpio_direction_input before reading the value.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
author
#3 lore raw
Quoted 20 lines · Sascha Hauer
Quoted 19 lines · Patrick

Dear mailing-list,

I am using a pcm049 phyCORE omap4430 module from Phytec with BareBox 2011.09.0 patched with BSP from Phytec.

I would like to use the GPIO command to read a switch at startup. This chip is connected on ABE_MCBSP1_DX (gpio_116). I have edited the boards/pcm049/mux.c files to change the configuration of this GPIO as follow: {ABE_MCBSP1_DX, (DIS | IEN | M3)} instead of {ABE_MCBSP1_DX, (SAFE_MODE)}.

I then use the "gpio_get_value 116" command followed by "echo $?" to read the value. I always read a 0. On Linux I could read the right value depending of the position of the switch, so it's not an hardware problems.

I have tried with one of the two LEDs on the module (gpio_152) and I could change the LED state and read it back with gpio_get_value.

Quoted 7 lines
Quoted 1 line

I do not understand what I am doing wrong. Any help will be appreciated.

What you tried should work. The only thing I can imagine is that you need a gpio_direction_input before reading the value.

Sascha

I have found the the problem come from the mux configuration.

I have added a call to set_muxconf_regs() from the gpio_get_value() (this is only to try) and then it works. I have checked my configuration and the lowlevel init is enabled:

CONFIG_MACH_HAS_LOWLEVEL_INIT=y
CONFIG_MACH_DO_LOWLEVEL_INIT=y

I am runnig my development version of barebox from the stable barebox flashed on NAND. I do the following:

tftp barebox.bin /dev/ram0
go /dev/ram0

Could this be a problem ?

Thanks for your help

Patrick

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

author
#4 lore raw
Quoted 47 lines · Patrick
Quoted 20 lines · Sascha Hauer
Quoted 19 lines · Patrick

Dear mailing-list,

I am using a pcm049 phyCORE omap4430 module from Phytec with BareBox 2011.09.0 patched with BSP from Phytec.

I would like to use the GPIO command to read a switch at startup. This chip is connected on ABE_MCBSP1_DX (gpio_116). I have edited the boards/pcm049/mux.c files to change the configuration of this GPIO as follow: {ABE_MCBSP1_DX, (DIS | IEN | M3)} instead of {ABE_MCBSP1_DX, (SAFE_MODE)}.

I then use the "gpio_get_value 116" command followed by "echo $?" to read the value. I always read a 0. On Linux I could read the right value depending of the position of the switch, so it's not an hardware problems.

I have tried with one of the two LEDs on the module (gpio_152) and I could change the LED state and read it back with gpio_get_value.

Quoted 7 lines
Quoted 1 line

I do not understand what I am doing wrong. Any help will be appreciated.

What you tried should work. The only thing I can imagine is that you need a gpio_direction_input before reading the value.

Sascha

I have found the the problem come from the mux configuration.

I have added a call to set_muxconf_regs() from the gpio_get_value() (this is only to try) and then it works. I have checked my configuration and the lowlevel init is enabled:

CONFIG_MACH_HAS_LOWLEVEL_INIT=y
CONFIG_MACH_DO_LOWLEVEL_INIT=y

I am runnig my development version of barebox from the stable barebox flashed on NAND. I do the following:

tftp barebox.bin /dev/ram0
go /dev/ram0

Could this be a problem ?

Thanks for your help

Quoted 7 lines

Patrick

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Ok things start to become clearer; As I say before I start my dev version of BareBox from a stable flashed version.

My dev version is then executed from adress 0x80000000. On the board_init_lowlevel() function there is the following test:

if (get_pc() > 0x80000000)

		return;

As my version is started from 0x80000000 this test is true and then the set_muxconf_regs(); is never called !

Now the question is why there is this test ?
Is the right place to call set_muxconf_regs(); from this location ?

Thanks for your help

Patrick

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

#5 lore raw
Quoted 38 lines · Patrick
Quoted 37 lines · Patrick
Quoted 20 lines · Sascha Hauer
Quoted 19 lines · Patrick

Dear mailing-list,

I am using a pcm049 phyCORE omap4430 module from Phytec with BareBox 2011.09.0 patched with BSP from Phytec.

I would like to use the GPIO command to read a switch at startup. This chip is connected on ABE_MCBSP1_DX (gpio_116). I have edited the boards/pcm049/mux.c files to change the configuration of this GPIO as follow: {ABE_MCBSP1_DX, (DIS | IEN | M3)} instead of {ABE_MCBSP1_DX, (SAFE_MODE)}.

I then use the "gpio_get_value 116" command followed by "echo $?" to read the value. I always read a 0. On Linux I could read the right value depending of the position of the switch, so it's not an hardware problems.

I have tried with one of the two LEDs on the module (gpio_152) and I could change the LED state and read it back with gpio_get_value.

Quoted 7 lines
Quoted 1 line

I do not understand what I am doing wrong. Any help will be appreciated.

What you tried should work. The only thing I can imagine is that you need a gpio_direction_input before reading the value.

Sascha

I have found the the problem come from the mux configuration.

I have added a call to set_muxconf_regs() from the gpio_get_value() (this is only to try) and then it works. I have checked my configuration and the lowlevel init is enabled:

CONFIG_MACH_HAS_LOWLEVEL_INIT=y
CONFIG_MACH_DO_LOWLEVEL_INIT=y

Quoted 7 lines
Quoted 7 lines

I am runnig my development version of barebox from the stable barebox flashed on NAND. I do the following:

tftp barebox.bin /dev/ram0
go /dev/ram0

Could this be a problem ?

The mux config is executed from lowlevel_init which returns immediately when it detects that barebox runs from SDRAM. So yes, that's your problem.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox