[#4246] simple gpio doesn't work for bf533 stamp board on 08r1 branch

Document created by Aaronwu Employee on Aug 29, 2013
Version 1Show Document
  • View in full screen mode

[#4246] simple gpio doesn't work for bf533 stamp board on 08r1 branch

Submitted By: Mingquan Pan

Open Date

2008-07-16 00:09:16     Close Date

2008-07-25 04:33:26


Low     Assignee:

Mike Frysinger

Michael Hennerich


Closed     Fixed In Release:


Found In Release:

N/A     Release:


N/A     Board:



N/A     Silicon Revision:

Is this bug repeatable?:

Yes     Resolution:


Uboot version or rev.:

    Toolchain version or rev.:


App binary format:


Summary: simple gpio doesn't work for bf533 stamp board on 08r1 branch



simple gpio doesn't work for bf533 stamp board on 08r1 branch.



root:/bin> ./simple-gpio-test

Usage: simple-gpio-test <gpio device>


This will open the specified gpio device, set it to input

mode, and then wait for it to go high.


You should specify a gpio device that represents a button.


Quick cheat sheet:


        LED1 => GPIO2   PB1 => GPIO5

        LED2 => GPIO3   PB2 => GPIO6

        LED3 => GPIO4   PB3 => GPIO8


root:/bin> ./simple-gpio-test /dev/gpio5

Going to sleep until the gpio goes high.

(if this is a button, you should push it :p)

The gpio went high!  Time to bail!



It directly finishs, and don't wait for PB1 to be pushed and go to high.


config file for kernel is attached.




--- Mike Frysinger                                           2008-07-16 06:27:45

should be fixed now ... the test assumed that all buttons were active low and

that the PB changed it to active high.  this assumption holds true on the

BF537-STAMP, but not the BF533-STAMP.


--- Mingquan Pan                                             2008-07-17 00:23:24

It is working except the first time you push the button. For the first time you

run: ./simple-gpio-test /dev/gpio5, it just doesn't exit and no reponse on



--- Mike Frysinger                                           2008-07-17 03:40:16

Michael: is there something that needs to be backported here ?  the first time i

boot up and attempt to read gpio5 (push button 1), the level never changes from

1.  but if i close and re-open, then it works.


perhaps something occurs in gpio_free() that changes the state to something

usable which gpio_request() should be doing ?  if i change the open() function

to do:

gpio_request(); gpio_free(); gpio_request();

then it works just fine


to reproduce on the 2008R1 branch, boot up and load the simple gpio module.

then do:

cat /dev/gpio5

then in a different terminal, do:

echo I > /dev/gpio5

this should show a constant stream of 1's ... the only thing the driver has

done is gpio_request(), gpio_direction_output(), and gpio_get_value().  pushing

the button does not change the level to 0.  if you kill the cat and repeat the

cat/echo, then pushing the button results in value changes as expected.


running things on trunk seems to work fine


--- Michael Hennerich                                        2008-07-21 03:35:55



- just saw your comment. I'll have a look.



--- Sonic Zhang                                              2008-07-23 22:20:39

Mike will add a walkaround in the uboot 2008R1.5 branch. But, Michael still need

to fix it in kernel someday. The walkaround only hide the bug in kernel.



--- Mike Frysinger                                           2008-07-24 00:01:45

ive committed the cleanup to the branch that was in trunk for the swap_to()

function.  as discovered by Michael, extraneous registers related to interrupts

(mask/polarity/etc...) were being programmed that didnt actually need to be.

this cause the weird behavior seen once the kernel was booted.


ive started [#4274] to track the long term resolution.


--- Mingquan Pan                                             2008-07-25 05:33:24

The checkin in u-boot works. So close.












File Name     File Type     File Size     Posted By

config.simple_gpio    application/octet-stream    25809    Mingquan Pan