2008-08-11 20:04:43     How to get at simple-gpio?

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

2008-08-11 20:04:43     How to get at simple-gpio?

Isaac Leung (CANADA)

Message: 60261   

 

We have the BF548 EZ-Kit as well as our own custom board and I am using the latest (as of today anyways) 2008R1 code from SVN with the simple-gpio driver turned on and the simple test programs included. From what I can gather, I should be able to test the gpio using, for example:

 

simple-gpio-test /dev/gpio2

 

Leaving aside the issue of whether there is actually a button or something on gpio2, I can't see any gpio populated in /dev

 

During the boot, I can see the following messages which would seem relevant:

 

=====================================

 

Blackfin GPIO Controller

.

 

.

 

.

simple-gpio: now handling 160 GPIOs: 0 - 159

=====================================

 

There are no error messages that I can see (except BF548 should have only 152 GPIO?), and this is common to both the EZ-Kit and our custom board. I'm not sure if it is related but in a similar issue on both boards, I can add a boot option "console=/dev/tty0" and the LCD screen "clones" the serial console while booting, showing me all boot message. But after the command prompt, it stops mirroring my console AND /dev/tty0 doesn't exist. Using "mknod /dev/tty0 c 4 0" allows me access to the LCD again, but it would seem odd I don't get /dev/tty0 since I had to explicitly put  on the boot options to get it to show in the first place. I could try the same thing with the GPIO pins, but then what is the order of the gpio's? i.e. is PA1 = gpio0, PA2 = gpio1 or some other scheme?.

 

I wouldn't rule out simple user stupidity, so any tips or tricks greatly appreciated!

 

 

 

Thanks,

 

Isaac

QuoteReplyEditDelete

 

 

2008-08-11 20:37:34     Re: How to get at simple-gpio?

Mike Frysinger (UNITED STATES)

Message: 60262   

 

did you disable hotplugging in the kernel ?  if so, you wont get device nodes created dynamically

QuoteReplyEditDelete

 

 

2008-08-12 06:10:11     Re: How to get at simple-gpio?

Michael McTernan (UNITED KINGDOM)

Message: 60286   

 

If hotplug is disabled in the Kernel, you can still run "mdev -s" manually to get the dev nodes, assuming mdev is built.

 

 

QuoteReplyEditDelete

 

 

2008-08-12 13:16:41     Re: How to get at simple-gpio?

Isaac Leung (CANADA)

Message: 60341   

 

Hot plugging is enabled, (or it is indicated as being enabled during the kernel config) but still no show on /dev.

 

Even if I run "mdev -s" it doesn't populate. However when I check out "/sys/class/simple-gpio" I can see them there. Would it work to use mknod? And if I could, what is the correlation to the actual GPIO pins? (i.e. which pin is gpio0?)

 

 

 

Thanks,

 

Isaac

 

 

 

bugreport.tgz

QuoteReplyEditDelete

 

 

2008-08-12 13:51:39     Re: How to get at simple-gpio?

Mike Frysinger (UNITED STATES)

Message: 60345   

 

is your rootfs and/or /dev read only ?  device nodes cant be created if your filesystem is read only.

QuoteReplyEditDelete

 

 

2008-08-13 11:53:34     Re: How to get at simple-gpio?

Isaac Leung (CANADA)

Message: 60413   

 

No, it shouldn't be read only as I can manually create the device nodes and dump temporary files into the rootfs.

QuoteReplyEditDelete

 

 

2008-08-13 12:05:19     Re: How to get at simple-gpio?

Mike Frysinger (UNITED STATES)

Message: 60414   

 

you should have /sys/class/simple-gpio/ and one gpio# directory in there for every gpio on your part ... in each dir should be a "dev" file

 

mdev scans /sys looking for those and then creates device nodes with that information

QuoteReplyEditDelete

 

 

2008-08-13 17:33:10     Re: How to get at simple-gpio?

Ben Burleson (UNITED STATES)

Message: 60426   

 

I have a similar problem with no /dev/gpio* even though simple-gpio is enabled  One difference I can see is that I have nothing listed in /sys/class/simple-gpio -- but that directory does exist.

 

/var/log/messages contains the line:

 

Blackfin GPIO Controllers

 

but no message about simple-gpio: now handling anything.

 

 

 

Result of cat /proc/gpio:

 

GPIO_32: bfin_mac         Peripheral

GPIO_33: bfin_mac         Peripheral

GPIO_34: bfin_mac         Peripheral

GPIO_35: bfin_mac         Peripheral

GPIO_36: bfin_mac         Peripheral

GPIO_37: bfin_mac         Peripheral

GPIO_38: bfin_mac         Peripheral

GPIO_39: bfin_mac         Peripheral

GPIO_40: bfin_mac         Peripheral

GPIO_41: bfin_mac         Peripheral

GPIO_42: bfin_mac         Peripheral

GPIO_43: bfin_mac         Peripheral

GPIO_44: bfin_mac         Peripheral

GPIO_45: bfin_mac         Peripheral

GPIO_46: bfin_mac         Peripheral

GPIO_47: bfin_mac         Peripheral

GPIO_48: bfin_mac         Peripheral

GPIO_49: bfin_mac         Peripheral

GPIO_50: i2c-bfin-twi         Peripheral

GPIO_51: i2c-bfin-twi         Peripheral

 

 

 

Sorry I haven't included much description or evidence, but I'm not sure where else to look yet.  Any advice on how to get /dev/gpio* visible will be much appreciated!  Thank you,

 

Ben

 

 

QuoteReplyEditDelete

 

 

2008-08-14 13:01:40     Re: How to get at simple-gpio?

Isaac Leung (CANADA)

Message: 60484   

 

I found the solution for my problem, though it sounds like your issue is slightly different.

 

I get all the "right" messages during boot, just no /dev/gpio* and mdev doesn't populate it either. Well, it turns out I have to turn on the feature in "General Setup->Create deprecated sysfs files". Yes, the help says it should not be used anymore and you should say "N", but ... well, it seems not true yet.

 

 

QuoteReplyEditDelete

 

 

2008-08-15 12:40:54     Re: How to get at simple-gpio?

Ben Burleson (UNITED STATES)

Message: 60504   

 

Thanks for the idea Isaac,

 

Unfortunately, I did have SYSFS_DEPRECATED=y and disabling that didn't change anything for me.

 

I'm attaching my linux-2.6.x/.config if anyone can take a look and see if there is anything obvious to try.

 

Thanks,

 

Ben

 

 

 

config

QuoteReplyEditDelete

 

 

2008-08-15 13:29:48     Re: How to get at simple-gpio?

Ben Burleson (UNITED STATES)

Message: 60505   

 

My mistake!  I had changed from stamp to the cm-bf537 and didn't notice that arch/blackfin/mach-bf537/boards/cm_bf537.c does not include the simple-gpio resource allocation.  I copied that in and all is well.

 

Cheers,

 

Ben

Attachments

Outcomes