Hello All,

I am having issues implementing GPIO definitions in the DTS file for the AsiaRF board that we are trying to bring up.  This is seemingly an easy task but for the life of me I can't figure out why this is not working.   First some info.

From the manufacturer...

GPIO#24 - Reset switch on board
GPIO#25 - Status (or system LED)
GPIO#72 - WLED

Now on to the DTS... i used this as a template
http://wiki.openwrt.org/toh/asus/rt-n14u
since the GPIOs are defined on the wiki and the DTS file is sitting right next to mine.

first we enable the appropriate GPIO register banks.

/dts-v1/;                                                                                                                                                                    ; &n bsp;          
                                                                                                                                                                    &n bsp;  ;                  
/include/ "mt7620a.dtsi"                                                                                                                                                                
                                                                                                                                                                    &n bsp;  ;                  
/ {                                                                                                                                                                    & nbsp;&nbs p;               
        compatible = "ralink,mt7620a-eval-board", "ralink,mt7620a-soc";                                                                                                                 
        model = "Ralink MT7620a GEMINI";                                                                                                                                                
                                                                                                                                                                    &n bsp;  ;                  
        palmbus@10000000 {                                                                                                                                                              
                gpio0: gpio@600 {                                                                                                                                                       
                       status = "okay";                                                                                                                                                 
                };                                                                                                                                                                      &nb sp;
                                                                                                                                                                    &n bsp;  ;                  
                gpio1: gpio@638 {                                                                                                                                                       
                       status = "okay";                                                                                                                                                 
                };                                                                                                                                                                      &nb sp;
                                                                                                                                                                    &n bsp;  ;                  
                gpio3: gpio@688 {                                                                                                                                                       
                       status = "okay";                                                                                                                                                 
                };                                                                                                                                                                      &nb sp;
                                                                                                                                                                    &n bsp;  ;                  
                spi@b00 {                                                                                                                                                               
                        status = "okay";                    

snip...


Then we configure pinctl to multiplex the pins

snip....

        pinctrl {                                                                                                                                                                    & nbsp;&nbs p; 
                state_default: pinctrl0 {                                                                                                                                               
                        default {                                                                                                                                                       
                                ralink,group = "i2c", "uartf", "ephy", "wled";                                                                                                          
                                ralink,function = "gpio";                                                                                                                               
                        };                                                                                                                                                              
                };                                                                                                                                                                      &nb sp;
        };            

snip...

then we define the buttons and leds

       gpio-leds {                                                                                                                                                                    & nbsp;
                compatible = "gpio-leds";                                                                                                                                               
                sys {                                                                                                                                                                   
                        label = "gemini:sys";                                                                                                                                           
                        gpios = <&gpio1 1 1>;    # GPIO 25 is the send slot in the second bank                                                                                                                                       
                };                                                                                                                                                                      &nb sp;
                wifi {                                                                                                                                                                  
                        label = "gemini:wifi";                                                                                                                                          
                        gpios = <&gpio3 0 1>;    # GPIO 72 is the one and only slot in the 4th bank                                                                                                                                      
                };                                                                                                                                                                      &nb sp;
        };                                                                                                                                                                      &nb sp;        
                                                                                                                                                                    &n bsp;  ;                  
        gpio-keys-polled {                                                                                                                                                              
                compatible = "gpio-keys-polled";                                                                                                                                        
                #address-cells = <1>;                                                                                                                                                   
                #size-cells = <0>;                                                                                                                                                      
                poll-interval = <20>;                                                                                                                                                   
                reset {                                                                                                                                                                 
                        label = "reset";                                                                                                                                                
                        gpios = <&gpio1 0 1>;    # GPIO 24 is the first slot of the second bank                                                                                                                                       
                        linux,code = <0x198>;                                                                                                                                           
                };                                                                                                                                                                      &nb sp;
        };                                                                                                                                                                      &nb sp;        
                                                                        

we add the following to ../ramips/base-files/etc/board.d/01_leds

        gemini7620a)
                ucidef_set_led_default "power" "power" "gemini:sys" "1"
                set_wifi_led "gemini:wifi"
                ;;

we compile and install...

here is what i get from the system log at boot...

[    0.520000] rt2880_gpio 10000600.gpio: registering 24 gpios
[    0.530000] rt2880_gpio 10000600.gpio: registering 24 irq handlers
[    0.540000] rt2880_gpio 10000638.gpio: registering 16 gpios
[    0.550000] rt2880_gpio 10000638.gpio: registering 16 irq handlers
[    0.560000] rt2880_gpio 10000688.gpio: registering 1 gpios
[    0.570000] rt2880_gpio 10000688.gpio: registering 1 irq handlers
[    6.310000] rt2880-pinmux pinctrl.1: pin 24 is not set to gpio mux
[    6.340000] gpio-keys-polled gpio-keys-polled.5: unable to claim gpio 24, err=-22
[    6.360000] gpio-keys-polled: probe of gpio-keys-polled.5 failed with error -22
[    6.870000] leds-gpio gpio-leds.4: pins are not configured from the driver
[    6.890000] rt2880-pinmux pinctrl.1: pin 25 is not set to gpio mux
[    6.890000] rt2880-pinmux pinctrl.1: request pin 25 (io25) for pio:25                
[    6.890000] rt2880-pinmux pinctrl.1: pin 25 is not set to gpio mux                                        
[    6.900000] rt2880-pinmux pinctrl.1: request() failed for pin 25                                          
[    6.910000] rt2880-pinmux pinctrl.1: pin-25 (pio:25) status -22            

OK... i can live with keys-polled errors since this board does not actually have a switch (my new board (in route) will have one).

However... I can't understand why

leds-gpio gpio-leds.4: pins are not configured from the driver
[    6.890000] rt2880-pinmux pinctrl.1: pin 25 is not set to gpio mux

what does this error mean? 

leds-gpio.c

tells me this...
234 static int gpio_led_probe(struct platform_device *pdev)
235 {
236         struct gpio_led_platform_data *pdata = pdev->dev.platform_data;
237         struct gpio_leds_priv *priv;
238         struct pinctrl *pinctrl;
239         int i, ret = 0;
240 
241         pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
242         if (IS_ERR(pinctrl))
243                 dev_warn(&pdev->dev,
244                         "pins are not configured from the driver\n");
245 

so the error seems to indicate that pinctl has not default defined?   I thought this is what this did

     pinctrl {                                                                                                                                                                    & nbsp;&nbs p; 

    
                state_default: pinctrl0 {                                                                                                                                               
                        default {                                                                                                                                                       
                                ralink,group = "i2c", "uartf", "ephy", "wled";                                                                                                          
                                ralink,function = "gpio";                                                                                                                               
                        };                                                                                                                                                              
                };                                                                                                                                                                      &nb sp;
        };            


Can some kind person help.  I am sure its a simple DTS misconfiguration.

Thanks,

--luis



                        

 
-- 


Luis Soltero, Ph.D., MCS
Director of Software Development, CTO
Global Marine Networks, LLC
StarPilot, LLC
Tel: +1.865.379.8723
Fax: +1.865.681.5017
E-Mail: lsolt...@globalmarinenet.net
Web: http://www.globalmarinenet.net
Web: http://www.redportglobal.com
Web: http://www.starpilotllc.com
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to