[LEDE-DEV] [PATCH 2/3] ramips-mt7621: add GPIO-config for Ubiquiti-EdgeRouterX(-SFP)

Sven Roederer devel-sven at geroedel.de
Sun May 14 17:50:39 PDT 2017


Martin,

in my flow-up mail I found this wrong numbering also. I attched a
copy of the relavant section from this mail.
I defined a new "label" gpio_pca and reference gpio0 of the pca ...

On Sonntag, 14. Mai 2017 23:50:25 CEST Mathias Kresin wrote:
> > 	poe_passthrough {
> > 	
> > 	    gpio-export,name = "poe_power_port0";
> > 	    gpio-export,output = <1>;
> > 	    gpios = <&gpio0 496 0>;
> 
> Your GPIO number is wrong.
> 

When using the following dts-file it improves, a bit:
/ {                                                                                                                          
        model = "UBNT-ERX-SFP";                                                                                              
                                                                                                                             
        i2c-gpio {                                                                                                           
                compatible = "i2c-gpio";                                                                                     
                gpios = <&gpio0 3 GPIO_ACTIVE_HIGH /* sda */                                                                 
                         &gpio0 4 GPIO_ACTIVE_HIGH /* scl */                                                                 
                             >;                                                                                                   
                #address-cells = <1>;                                                                                        
                #size-cells = <0>;                                                                                           
                                                                                                                             
                gpio_pca: pca9555 at 25 {                                                                                       
                        compatible = "pca9555";                                                                              
                        reg = <0x25>;                                                                                        
                };                                                                                                           
        };                                                                                                                   
                                                                                                                             
gpio_export {                                                                                                                
        compatible = "gpio-export";                                                                                          
        #size-cells = <0>;                                                                                                   
                                                                                                                             
        poe_passthrough {                                                                                                    
            gpio-export,name = "poe_power_port0";                                                                            
            gpio-export,output = <1>;                                                                                        
            gpios = <&gpio_pca 0 0>;                                                                                         
        };                                                                                                                   
                                                                                                                             
};                                                                                                                           
};                                                                                                                           

I think I got the trick to define a name for the PCA-gpio-chip and 
reference it in the gpio-export section.
But it fails now with

[    1.640000] /gpio_export/poe_passthrough: could not get #gpio-cells for /i2c-gpio/pca9555 at 25
[    1.660000] ------------[ cut here ]------------
[    1.670000] WARNING: CPU: 3 PID: 1 at drivers/gpio/gpiolib.c:85 0x801dc2fc()
[    1.680000] invalid GPIO -22
[    1.690000] Modules linked in:
[    1.690000] CPU: 3 PID: 1 Comm: swapper/0 Not tainted 4.4.61 #0

seems not to find the i2c-pca and it's gpios, as these modules are not 
compile into the kernel. 
[   10.460000] kmodloader: loading kernel modules from /etc/modules.d/*
[   10.470000] i2c /dev entries driver
[   10.480000] pca953x 0-0025: interrupt support not compiled in
[   10.500000] i2c-gpio i2c-gpio: using pins 3 (SDA) and 4 (SCL)
[   10.510000] PPP generic driver version 2.4.2

They will load during init.scripts.
I see following options:
- use the 03-gpio script in board.d
- compile the drivers into the kernel, but will this be done for all 
 mt7621-kernels?





More information about the Lede-dev mailing list