Question about GPIO Lib

Bruce_Leonard at selinc.com Bruce_Leonard at selinc.com
Fri Jan 27 15:31:00 EST 2012


(This time with a subject line, sorry)

Hi,

I'm using the 3.0.3 kernel on an MPC8308 and have turned on GPIO support 
(CONFIG_GPIOLIB = Y) because the SPI sub-system needed to use it for the 
GPIO pin I'm using as a CS to a NvRAM part.  I also have some jumpers on 
the processor GPIO pins and I thought it would be really slick to use the 
built in GPIO support in the kernel rather than roll my own driver to read 

five pins.  So I've got GPIO sysfs support turned on (CONFIG_GPIO_SYSFS = 
Y) and everything shows up in /sys/class/gpio and works as advertised. 
Really nice.

The problem is we've got a number of other things hooked up to the GPIO 
pins that it would be very bad if someone from user space played with 
them, like our FPGA configuration pin.  Some one toggles that and our box 
goes stupid.  So what I'm wondering is if there's a way, preferably via 
the device tree, to limit the GPIOs that GPIO Lib exposes to user space?

I tried the following in my device tree without success:

      gpio1: gpio at c00 {
         #gpio-cells = <2>;
         device_type = "gpio";
         compatible = "fsl,mpc8308-gpio", "fsl,mpc8349-gpio";
         reg = <0xc00 0x18>;
         interrupts = <74 0x8>;
         interrupt-parent = <&ipic>;
         gpio-controller;
         gpios = <&gpio1 0 0
                  &gpio1 1 0
                  &gpio1 2 0
                  &gpio1 3 0
                  &gpio1 4 0
                  &gpio1 5 0
                  &gpio1 6 0>;
      };

I also thought maybe a separate child node of the gpio1 node, but I think 
it would require a "compatible" attribute which would mean a driver to 
bind it to, and the whole point is to avoid writing a driver if someone 
else has already got something that will work.

Thanks.

Bruce


More information about the Linuxppc-dev mailing list