public inbox for linuxppc-dev@ozlabs.org
 help / color / mirror / Atom feed
* Trouble specifying dts gpio-leds with GPIO expander chip
@ 2009-12-21 19:40 Bill Gatliff
  2009-12-21 21:55 ` Anton Vorontsov
  2009-12-21 22:32 ` Grant Likely
  0 siblings, 2 replies; 4+ messages in thread
From: Bill Gatliff @ 2009-12-21 19:40 UTC (permalink / raw)
  To: Linux/PPC Development

Guys:


I'm trying to come up with the right stuff for my dts file to assign a
Linux "heartbeat" trigger to an I2C GPIO expansion device (MAX7314). 
I'm running on a platform that is very similar to the lite5200b, with
linux-2.6.32.  I'm a bit new to the device tree concept, having come
most recently from an ARM world, so please be gentle...  :)

I have this so far:

        soc5200@f0000000 {
            #address-cells = <1>;
            #size-cells = <1>;
            compatible = "fsl,mpc5200b-immr","simple-bus";
            ranges = <0 0xf0000000 0x0000c000>;
            reg = <0xf0000000 0x00000100>;
            bus-frequency = <0>;        // from bootloader
            system-frequency = <0>;        // from bootloader
    ...
            i2c@3d40 {
                #address-cells = <1>;
                #size-cells = <0>;
                compatible = "fsl,mpc5200b-i2c","fsl,mpc5200-i2c","fsl-i2c";
                reg = <0x3d40 0x40>;
                interrupts = <2 16 0>;
   
                lext20: max7314@20 {
                       #gpio-cells = <2>;
                       compatible = "maxim,max7314","phillips,pca953x";
                       reg = <0x20>;
                       linux,phandle = <0x20>;
                       gpio-controller;
                };
                ...
            };
        };
    ...
        system {
            compatible = "simple-bus";
   
            gpio-leds {
                compatible = "gpio-leds";
   
                heartbeat {
                    gpios = <&lext20 3 0>;
                    linux,default-trigger = "heartbeat";
                };
            };
        };
    ...


The MAX7314 chip is showing up under /debug/gpio:

    # cat /debug/gpio
    ...
    GPIOs 198-213, i2c/1-0020, max7314, can sleep:

And, indeed, I can twiddle the LED by hand:

    # echo 201 > /sys/class/gpio/export
    # while true; do for led in high low; \
        do echo $led > /sys/class/gpio/gpio201/direction; \
        sleep 1; done; done
       (observe blinking)

But I see this at boot:

    Skipping unavailable LED gpio -19 (heartbeat)

That error code is -ENODEV.  I double-checked that gpio-leds is showing
up on of_platform:

    # ls /sys/bus/of_platform/devices/
    ...
    gpio-leds.2
    ...


I'm stumped.  Could it be that the startup code is trying to register
the heartbeat device before it has registered the MAX7314, so it doesn't
know yet that the GPIO line exists?

Anyone have any suggestions?


b.g.

-- 
Bill Gatliff
bgat@billgatliff.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-31 17:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-21 19:40 Trouble specifying dts gpio-leds with GPIO expander chip Bill Gatliff
2009-12-21 21:55 ` Anton Vorontsov
2009-12-31 17:00   ` Bill Gatliff
2009-12-21 22:32 ` Grant Likely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox