<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hello All,<br>
    <br>
    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.<br>
    <br>
    From the manufacturer...<br>
    <br>
    GPIO#24 - Reset switch on board<br>
    GPIO#25 - Status (or system LED)<br>
    GPIO#72 - WLED<br>
    <br>
    Now on to the DTS... i used this as a template<br>
    <a class="moz-txt-link-freetext" href="http://wiki.openwrt.org/toh/asus/rt-n14u">http://wiki.openwrt.org/toh/asus/rt-n14u</a><br>
    since the GPIOs are defined on the wiki and the DTS file is sitting
    right next to mine.<br>
    <br>
    first we enable the appropriate GPIO register banks.<br>
    <br>
    /dts-v1/;                                                                                                                                                                  &nbsp
 ; &n
bsp;          
    <br>
                                                                                                                                                                        &n
 bsp;&nbsp
;                  
    <br>
    /include/
    "mt7620a.dtsi"                                                                                                                                                                
    <br>
                                                                                                                                                                        &n
 bsp;&nbsp
;                  
    <br>
    /
    {                                                                                                                                                                    &
 nbsp;&nbs
p;               
    <br>
            compatible = "ralink,mt7620a-eval-board",
    "ralink,mt7620a-soc";                                                                                                                 
    <br>
            model = "Ralink MT7620a
    GEMINI";                                                                                                                                                
    <br>
                                                                                                                                                                        &n
 bsp;&nbsp
;                  
    <br>
            palmbus@10000000
    {                                                                                                                                                              
    <br>
                    gpio0: gpio@600
    {                                                                                                                                                       
    <br>
                           status =
    "okay";                                                                                                                                                 
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
                                                                                                                                                                        &n
 bsp;&nbsp
;                  
    <br>
                    gpio1: gpio@638
    {                                                                                                                                                       
    <br>
                           status =
    "okay";                                                                                                                                                 
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
                                                                                                                                                                        &n
 bsp;&nbsp
;                  
    <br>
                    gpio3: gpio@688
    {                                                                                                                                                       
    <br>
                           status =
    "okay";                                                                                                                                                 
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
                                                                                                                                                                        &n
 bsp;&nbsp
;                  
    <br>
                    spi@b00
    {                                                                                                                                                               
    <br>
                            status = "okay";                     <br>
    <br>
    snip...<br>
    <br>
    <br>
    Then we configure pinctl to multiplex the pins<br>
    <br>
    snip....<br>
    <br>
            pinctrl
    {                                                                                                                                                                    &
 nbsp;&nbs
p; 
    <br>
                    state_default: pinctrl0
    {                                                                                                                                               
    <br>
                            default
    {                                                                                                                                                       
    <br>
                                    ralink,group = "i2c", "uartf",
    "ephy",
    "wled";                                                                                                          
    <br>
                                    ralink,function =
    "gpio";                                                                                                                               
    <br>
                           
    };                                                                                                                                                              
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
            };             <br>
    <br>
    snip...<br>
    <br>
    then we define the buttons and leds<br>
    <br>
           gpio-leds
    {                                                                                                                                                                    &
 nbsp;
    <br>
                    compatible =
    "gpio-leds";                                                                                                                                               
    <br>
                    sys
    {                                                                                                                                                                   
    <br>
                            label =
    "gemini:sys";                                                                                                                                           
    <br>
                            gpios = <&gpio1 1 1>;    # GPIO 25
    is the send slot in the second bank
                                                                                                                                          
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
                    wifi
    {                                                                                                                                                                  
    <br>
                            label =
    "gemini:wifi";                                                                                                                                          
    <br>
                            gpios = <&gpio3 0 1>;    # GPIO 72
    is the one and only slot in the 4th bank
                                                                                                                                         
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
           
    };                                                                                                                                                                    
  &nb
sp;        
    <br>
                                                                                                                                                                        &n
 bsp;&nbsp
;                  
    <br>
            gpio-keys-polled
    {                                                                                                                                                              
    <br>
                    compatible =
    "gpio-keys-polled";                                                                                                                                        
    <br>
                    #address-cells =
    <1>;                                                                                                                                                   
    <br>
                    #size-cells =
    <0>;                                                                                                                                                      
    <br>
                    poll-interval =
    <20>;                                                                                                                                                   
    <br>
                    reset
    {                                                                                                                                                                 
    <br>
                            label =
    "reset";                                                                                                                                                
    <br>
                            gpios = <&gpio1 0 1>;    # GPIO 24
    is the first slot of the second bank
                                                                                                                                          
    <br>
                            linux,code =
    <0x198>;                                                                                                                                           
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
           
    };                                                                                                                                                                    
  &nb
sp;        
    <br>
                                                                            
    <br>
    <br>
    we add the following to ../ramips/base-files/etc/board.d/01_leds<br>
    <br>
            gemini7620a)<br>
                    ucidef_set_led_default "power" "power" "gemini:sys"
    "1"<br>
                    set_wifi_led "gemini:wifi"<br>
                    ;;<br>
    <br>
    we compile and install...<br>
    <br>
    here is what i get from the system log at boot...<br>
    <br>
    [    0.520000] rt2880_gpio 10000600.gpio: registering 24 gpios<br>
    [    0.530000] rt2880_gpio 10000600.gpio: registering 24 irq
    handlers<br>
    [    0.540000] rt2880_gpio 10000638.gpio: registering 16 gpios<br>
    [    0.550000] rt2880_gpio 10000638.gpio: registering 16 irq
    handlers<br>
    [    0.560000] rt2880_gpio 10000688.gpio: registering 1 gpios<br>
    [    0.570000] rt2880_gpio 10000688.gpio: registering 1 irq handlers<br>
    [    6.310000] rt2880-pinmux pinctrl.1: pin 24 is not set to gpio
    mux<br>
    [    6.340000] gpio-keys-polled gpio-keys-polled.5: unable to claim
    gpio 24, err=-22<br>
    [    6.360000] gpio-keys-polled: probe of gpio-keys-polled.5 failed
    with error -22<br>
    [    6.870000] leds-gpio gpio-leds.4: pins are not configured from
    the driver<br>
    [    6.890000] rt2880-pinmux pinctrl.1: pin 25 is not set to gpio
    mux<br>
    [    6.890000] rt2880-pinmux pinctrl.1: request pin 25 (io25) for
    pio:25                 <br>
    [    6.890000] rt2880-pinmux pinctrl.1: pin 25 is not set to gpio
    mux                                         <br>
    [    6.900000] rt2880-pinmux pinctrl.1: request() failed for pin
    25                                           <br>
    [    6.910000] rt2880-pinmux pinctrl.1: pin-25 (pio:25) status
    -22             <br>
    <br>
    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).<br>
    <br>
    However... I can't understand why <br>
    <br>
    leds-gpio gpio-leds.4: pins are not configured from the driver<br>
    [    6.890000] rt2880-pinmux pinctrl.1: pin 25 is not set to gpio
    mux<br>
    <br>
    what does this error mean?  <br>
    <br>
    leds-gpio.c<br>
    <br>
    tells me this...<br>
    <meta charset="utf-8">
    <pre style="font-family: Monaco, 'Courier New', Courier, monospace; font-size: 14px; padding: 1em; color: rgb(120, 120, 120); background-color: rgb(255, 255, 255); overflow: auto; font-style: normal; font-variant: normal; font-weight: bold; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a name="L234" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L234" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">234</a> static int <a href="http://lxr.free-electrons.com/ident?v=3.8;i=gpio_led_probe" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">gpio_led_probe</a>(struct <a href="http://lxr
 .free-ele
ctrons.com/ident?v=3.8;i=platform_device" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">platform_device</a> *<a href="http://lxr.free-electrons.com/ident?v=3.8;i=pdev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">pdev</a>)
<a name="L235" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L235" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">235</a> {
<a name="L236" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L236" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">236</a>         struct <a href="http://lxr.free-electrons.com/ident?v=3.8;i=gpio_led_platform_data" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">gpio_led_platform_data</a> *<a href="http://lxr.free-electrons.com/ident?v=3.8;i=pdata" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">pdata</a> = <a href="http://lxr.free-electrons.com/ident?v=3.8;i=pdev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black
 ; backgro
und-color: white;">pdev</a>-><a href="http://lxr.free-electrons.com/ident?v=3.8;i=dev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">dev</a>.<a href="http://lxr.free-electrons.com/ident?v=3.8;i=platform_data" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">platform_data</a>;
<a name="L237" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L237" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">237</a>         struct <a href="http://lxr.free-electrons.com/ident?v=3.8;i=gpio_leds_priv" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">gpio_leds_priv</a> *<a href="http://lxr.free-electrons.com/ident?v=3.8;i=priv" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">priv</a>;
<a name="L238" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L238" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">238</a>         struct <a href="http://lxr.free-electrons.com/ident?v=3.8;i=pinctrl" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">pinctrl</a> *<a href="http://lxr.free-electrons.com/ident?v=3.8;i=pinctrl" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">pinctrl</a>;
<a name="L239" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L239" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">239</a>         int <a href="http://lxr.free-electrons.com/ident?v=3.8;i=i" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">i</a>, <a href="http://lxr.free-electrons.com/ident?v=3.8;i=ret" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">ret</a> = 0;
<a name="L240" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L240" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">240</a> 
<a name="L241" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L241" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">241</a>         <a href="http://lxr.free-electrons.com/ident?v=3.8;i=pinctrl" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">pinctrl</a> = <a href="http://lxr.free-electrons.com/ident?v=3.8;i=devm_pinctrl_get_select_default" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">devm_pinctrl_get_select_default</a>(&<a href="http://lxr.free-electrons.com/ident?v=3.8;i=pdev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153,
  153); co
lor: black; background-color: white;">pdev</a>-><a href="http://lxr.free-electrons.com/ident?v=3.8;i=dev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">dev</a>);
<a name="L242" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L242" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">242</a>         if (<a href="http://lxr.free-electrons.com/ident?v=3.8;i=IS_ERR" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">IS_ERR</a>(<a href="http://lxr.free-electrons.com/ident?v=3.8;i=pinctrl" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">pinctrl</a>))
<a name="L243" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L243" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">243</a>                 <a href="http://lxr.free-electrons.com/ident?v=3.8;i=dev_warn" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">dev_warn</a>(&<a href="http://lxr.free-electrons.com/ident?v=3.8;i=pdev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">pdev</a>-><a href="http://lxr.free-electrons.com/ident?v=3.8;i=dev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: whit
 e;">dev</
a>,
<a name="L244" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L244" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">244</a>                         <i>"pins are not configured from the driver\n"</i>);
<a name="L245" href="http://lxr.free-electrons.com/source/drivers/leds/leds-gpio.c?v=3.8#L245" style="text-decoration: none; border-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">245</a> 
</pre>
    <br class="Apple-interchange-newline">
    so the error seems to indicate that pinctl has not default
    defined?   I thought this is what this did<br>
    <br>
         pinctrl
    {                                                                                                                                                                    &
 nbsp;&nbs
p; 

    <br>
                    state_default: pinctrl0
    {                                                                                                                                               

    <br>
                            default
    {                                                                                                                                                       

    <br>
                                    ralink,group = "i2c", "uartf",
    "ephy",
    "wled";                                                                                                          

    <br>
                                    ralink,function =
    "gpio";                                                                                                                               

    <br>
                           
    };                                                                                                                                                              

    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;

    <br>
            };             <br>
    <br>
    <br>
    Can some kind person help.  I am sure its a simple DTS
    misconfiguration.<br>
    <br>
    Thanks,<br>
    <br>
    --luis<br>
    <br>
    <br>
    <br>
                             <br>
    <br>
     <br>
    <pre class="moz-signature" cols="120">-- 


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: <a class="moz-txt-link-abbreviated" href="mailto:lsoltero@globalmarinenet.net">lsoltero@globalmarinenet.net</a>
Web: <a class="moz-txt-link-freetext" href="http://www.globalmarinenet.net">http://www.globalmarinenet.net</a>
Web: <a class="moz-txt-link-freetext" href="http://www.redportglobal.com">http://www.redportglobal.com</a>
Web: <a class="moz-txt-link-freetext" href="http://www.starpilotllc.com">http://www.starpilotllc.com</a>
</pre>
  </body>
</html>