2010-06-17 15:06:30     simple-gpio

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

2010-06-17 15:06:30     simple-gpio

Howard Gordon (UNITED STATES)

Message: 90387   

 

I have visited the various discussions on enabling simple-gpio, but have the same problem discussed elsewhere of not finding a /dev/gpio, even though https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?action=ForumBrowse&forum_id=39&thread_id=29113&_forum_action=ForumMessageBrowse , even though CONFIG_SIMPLE_GPIO is enabled, and the interface appears in /proc/gpio .  What am I missing ?  Is there another API I can use to access BF537 GPIO's ?

QuoteReplyEditDelete

 

 

2010-06-17 15:11:13     Re: simple-gpio

Peter Naulls (UNITED STATES)

Message: 90388   

 

You can access GPIOs from userspace via /sys.  See the end of Documntation/gpio.txt in the kernel source.

QuoteReplyEditDelete

 

 

2010-06-17 15:16:58     Re: simple-gpio

Robin Getz (UNITED STATES)

Message: 90389   

 

Howard:

 

/dev/gpio isn't there anymore -

 

https://docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:gpio-sysfs

 

-Robin

QuoteReplyEditDelete

 

 

2010-06-17 16:00:37     Re: simple-gpio

Mike Frysinger (UNITED STATES)

Message: 90390   

 

the documentation already says it's dead:

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:simple-gpio

QuoteReplyEditDelete

 

 

2010-06-17 16:04:22     Re: simple-gpio

Howard Gordon (UNITED STATES)

Message: 90391   

 

I should have clarified that I am working from the srv1 patch to 2008R1.5-RC3 which doesn't have gpio-sysfs.  We will start moving to the current distribution within the next 1-2 weeks, but I'd like to get this working with the existing code base in the interim.

QuoteReplyEditDelete

 

 

2010-06-17 16:13:08     Re: simple-gpio

Robin Getz (UNITED STATES)

Message: 90392   

 

Howard:

 

We don't support 2008. Current docs, and support is for the latest release only. Right now that is 2009, and soon (in a few months, when we make the 2010 release) it will be 2010 only.

 

-Robin

QuoteReplyEditDelete

 

 

2010-06-17 16:30:22     Re: simple-gpio

Howard Gordon (UNITED STATES)

Message: 90393   

 

Understood - we will be migrating, but I hoped someone might remember how to fix this on 2008 as an interim solution.

QuoteReplyEditDelete

 

 

2010-06-17 22:06:52     Re: simple-gpio

Mike Frysinger (UNITED STATES)

Message: 90395   

 

did you follow the documentation about adding the right resources to your board ?

QuoteReplyEditDelete

 

 

2010-06-18 11:32:18     Re: simple-gpio

Howard Gordon (UNITED STATES)

Message: 90427   

 

Yes, but I received this warning when compiling -

 

    arch/blackfin/mach-bf537/boards/minotaur.c:139: warning: ‘bfin_gpios_device’ defined but not used

 

so I'm still missing something.

QuoteReplyEditDelete

 

 

2010-06-19 13:06:12     Re: simple-gpio

Mike Frysinger (UNITED STATES)

Message: 90462   

 

simply defining variables doesnt matter if you dont actually hook them up to the platform resources array

QuoteReplyEditDelete

 

 

2010-06-19 14:34:44     Re: simple-gpio

Howard Gordon (UNITED STATES)

Message: 90469   

 

Got it.  I had to add &bfin_gpios_device to the __initdata array.  gpio devices now appear in /dev.  However, the actual GPIO bits aren't changing value in response to commands, so maybe there is still a PORT_MUX configuation issue.

 

 

 

root:~> ls /dev

 

console    gpio2      gpio32     gpio45     null       ram5       timer7

full       gpio20     gpio33     gpio46     ptmx       ram6       tty

gpio0      gpio21     gpio34     gpio47     pts        ram7       ttyBF0

gpio1      gpio22     gpio35     gpio5      ram0       ram8       ttyBF1

gpio10     gpio23     gpio36     gpio6      ram1       ram9       uinput

gpio11     gpio24     gpio37     gpio7      ram10      random     urandom

gpio12     gpio25     gpio38     gpio8      ram11      root       video0

gpio13     gpio26     gpio39     gpio9      ram12      timer0     watchdog

gpio14     gpio27     gpio4      i2c-0      ram13      timer1     zero

gpio15     gpio28     gpio40     kmem       ram14      timer2

gpio16     gpio29     gpio41     kmsg       ram15      timer3

gpio17     gpio3      gpio42     log        ram2       timer4

gpio18     gpio30     gpio43     mem        ram3       timer5

gpio19     gpio31     gpio44     mtdblock0  ram4       timer6

QuoteReplyEditDelete

 

 

2010-06-19 14:58:57     Re: simple-gpio

Howard Gordon (UNITED STATES)

Message: 90470   

 

To clarify, I can change the values of the GPIO bits in the processor, but the bit values don't map to the actual processor pins.  So

 

echo 'O1' > /dev/gpio47

 

cat /dev/gpio47

 

111111111111111111111111111111111111111111111111111 ...

 

echo 'O0' > dev/gpio47

 

cat /dev/gpio47

 

00000000000000000000000000000000000000000 ...

 

However, the voltage on GPIO-H15 never changes.

QuoteReplyEditDelete

 

 

2010-06-19 15:19:56     Re: simple-gpio

Mike Frysinger (UNITED STATES)

Message: 90471   

 

please read the documentation with an eye towards the details:

  docs.blackfin.uclinux.org/doku.php?id=linux-kernel:drivers:simple-gpio#testing

QuoteReplyEditDelete

 

 

2010-06-19 15:54:20     Re: simple-gpio

Howard Gordon (UNITED STATES)

Message: 90472   

 

Right you are.  I was following suggestions in the driver source code rather than the docs.  Now my LEDs light and my motors change direction.  Thanks again.

QuoteReplyEditDelete

Attachments

    Outcomes