2009-03-14 22:28:24     simple-gpio problem

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

2009-03-14 22:28:24     simple-gpio problem


Message: 70989   




Am using cm-bf537. I have included the simple-gpio driver in menuconfig. I also copied the simple-gpio resource allocation from arch/blackfin/mach-bf537/boards/stamp.c to arch/blackfin/mach-bf537/boards/cm_bf537.c.


But I still dont see anything in dev/gpio*.


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


What step am I missing here to get the gpio to show up under /dev?






2009-03-15 00:32:38     Re: simple-gpio problem


Message: 70990   


Ok I added gpio resource structure pointer to the devices structure and now the gpios appear under devices.


I have been developing on the 2006 release of uclinux previously. In order to access gpio, I would use IOCTL commands and open the /dev/pf$ file. In the latest release I noticed that simple-gpio driver does not have IOCTL provisions? Also how does the gpio$ map to the corresponding pf$ ? for example if I wanted to open pf12 from the application level how would I go about it?


I tried searching for the simple-gpio and pflags test program source code on the distribution but could not find it. Could anyone point me to where I can find it?






2009-03-15 00:37:32     Re: simple-gpio problem

Mike Frysinger (UNITED STATES)

Message: 70991   


please read the documentation:



how the previous pflag driver works is unrelated as the simple gpio driver was written from scratch




2009-03-15 03:51:55     Re: simple-gpio problem


Message: 70992   


thanks. I had already looked at that page. My problem was the mapping between the pflags and the gpio numbers. It finally dawned upon me that PF is gpio1-16 , PG is gpio17-32 and so on...


I grepped for the test source files in the distribution but could not find it. Could you please point me to the location of the source files.




2009-03-15 04:17:31     Re: simple-gpio problem

Mike Frysinger (UNITED STATES)

Message: 71000   


they werent in the last release




2009-03-18 05:28:41     Re: simple-gpio problem

Ashish Gupta (INDIA)

Message: 71194   




I am also using the same module - Bluetechnix CM-BF537E. I want to access the simple-gpio driver from my application but no device nodes appear in the /dev folder, hence i cannot access the devices. "simple-gpio-test" test binary also fails with "no such file or directory" error.


The symbolic links (simple-gpio:gpio0 ... 1) for devices are created in the /sys/devices/platform/simple-gpio folder which point to directories gpio0, gpio1, gpio2 ...etc in the folder /sys/class/simple-gpio.


and /proc/gpio contentents are: -




GPIO_0: bfin-uart Peripheral


GPIO_1: bfin-uart Peripheral


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


GPIO_54: soc-audio Peripheral


GPIO_55: soc-audio Peripheral


GPIO_56: soc-audio Peripheral


GPIO_57: soc-audio Peripheral


GPIO_59: soc-audio Peripheral

I tried the following

A. Manual creation of device nodes

root: /> mknod /dev/gpio0 c 253 0

mknod: /dev/gpio0: Read-only file system


B. using mdev to creat device nodes

root: /> mdev -s

mdev: mknod ram0: Read-only file system


so /dev is romfs and i also checked the config file found in /proc directory, and found that HOT PLUGGING was not enabled.

# CONFIG_HOTPLUG is not set


Is there any other way apart from recompiling and re flashing the image to get around this problem.?



Files attached:


1. config file found in /proc






2009-03-18 05:55:11     Re: simple-gpio problem

Mike Frysinger (UNITED STATES)

Message: 71196   


you need to remount your root so it is read/write, then run `mknod` manually




2009-03-19 03:39:07     Re: simple-gpio problem

Ashish Gupta (INDIA)

Message: 71233   


Thanks Mike,


the problem is solved now, I've modified the bootargs in u-boot to

bootargs = root=/dev/mtdblock0 rw

this makes /dev as rw and i can see the devices nodes in /dev now   :-) .