<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <br>
    Hello All,<br>
    <br>
    As I suspected the solution was simple.   For those of you out there
    running into the same problem here is the solution.<br>
    <br>
    look at the MT7620 data sheet on page 23 and fine the GPIOs that
    need to be mapped to the LEDs.    For me that is GPIO #24, #25, and
    #72.   Then locate the I/O Pad Group the pin belongs to.  For me
    that is rgmii1 and wlan.  Then add these to the pinctl section as in
    <br>
    <br>
            pinctrl
    {                                                                                                                                                                    &
 nbsp;&nbs
p; 
    <br>
                    state_default: pinctrl0
    {                                                                                                                                               
    <br>
                            default
    {                                                                                                                                                       
    <br>
                                    ralink,group = "i2c", "uartf",
    "wled",
    "rgmii1";                                                                                                        
    <br>
                                    ralink,function =
    "gpio";                                                                                                                               
    <br>
                           
    };                                                                                                                                                              
    <br>
                   
    };                                                                                                                                                                    
  &nb
sp;
    <br>
            };                                   <br>
    <br>
    <br>
    compile and install the new kernel and you will magically see your
    LEDs appear in /sys/devices/gpio-led...<br>
    <br>
    Thanks,<br>
    <br>
    --luis<br>
    <br>
    <div class="moz-cite-prefix">On 8/28/14, 1:32 AM, Luis Soltero
      wrote:<br>
    </div>
    <blockquote cite="mid:53FEBEF6.7070905@globalmarinenet.com"
      type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=ISO-8859-1">
      <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 moz-do-not-send="true" 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/;                                                                                                                                                                  &nb
 sp; 
&n
bsp;          

      <br>
                                                                                                                                                                          
  &nb
sp;
;                  

      <br>
      /include/
      "mt7620a.dtsi"                                                                                                                                                                

      <br>
                                                                                                                                                                          
  &nb
sp;
;                  

      <br>
      /
      {                                                                                                                                                                   &nbsp
 ; &a
mp;nbs
p;               

      <br>
              compatible = "ralink,mt7620a-eval-board",
      "ralink,mt7620a-soc";                                                                                                                 

      <br>
              model = "Ralink MT7620a
      GEMINI";                                                                                                                                                

      <br>
                                                                                                                                                                          
  &nb
sp;
;                  

      <br>
              palmbus@10000000
      {                                                                                                                                                              

      <br>
                      gpio0: gpio@600
      {                                                                                                                                                       

      <br>
                             status =
      "okay";                                                                                                                                                 

      <br>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;nb
sp;

      <br>
                                                                                                                                                                          
  &nb
sp;
;                  

      <br>
                      gpio1: gpio@638
      {                                                                                                                                                       

      <br>
                             status =
      "okay";                                                                                                                                                 

      <br>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;nb
sp;

      <br>
                                                                                                                                                                          
  &nb
sp;
;                  

      <br>
                      gpio3: gpio@688
      {                                                                                                                                                       

      <br>
                             status =
      "okay";                                                                                                                                                 

      <br>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;nb
sp;

      <br>
                                                                                                                                                                          
  &nb
sp;
;                  

      <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
 ; &a
mp;nbs
p; 

      <br>
                      state_default: pinctrl0
      {                                                                                                                                               

      <br>
                              default
      {                                                                                                                                                       

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

      <br>
                                      ralink,function =
      "gpio";                                                                                                                               

      <br>
                             
      };                                                                                                                                                              

      <br>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;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>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;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>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;nb
sp;

      <br>
             
      };                                                                                                                                                                   &nbs
 p; &
amp;nb
sp;        

      <br>
                                                                                                                                                                          
  &nb
sp;
;                  

      <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>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;nb
sp;

      <br>
             
      };                                                                                                                                                                   &nbs
 p; &
amp;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 moz-do-not-send="true" 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 moz-do-not-send="true" 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_l
ed_probe</a>(struct <a moz-do-not-send="true" href="http://lxr.free-ele%0Actrons.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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" href="http://lxr.free-electrons.com/ident?v=3.8;i=pdev" style="text-decoration: none; border-bottom-wi
 dth: 1px;
 border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); color: black; backgro
und-color: white;">pdev</a>-><a moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" href="http://lxr.free-electrons.com/ident?v=3.8;i=pdev" style="text-decoration: non
 e; border
-bottom-width: 1px; border-bottom-style: dotted; border-bottom-color: rgb(153, 153, 153); co
lor: black; background-color: white;">pdev</a>-><a moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" 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 moz-do-not-send="true" href="http://lxr.free-electrons.com/ident?v=3.8;i=dev" style="text-decoration: none; border-bottom-width: 1px; border-bottom-
 style: do
tted; border-bottom-color: rgb(153, 153, 153); color: black; background-color: white;">dev<!--
a-->,
</a><a moz-do-not-send="true" 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 moz-do-not-send="true" 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
 ; &a
mp;nbs
p; 


      <br>
                      state_default: pinctrl0
      {                                                                                                                                               


      <br>
                              default
      {                                                                                                                                                       


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


      <br>
                                      ralink,function =
      "gpio";                                                                                                                               


      <br>
                             
      };                                                                                                                                                              


      <br>
                     
      };                                                                                                                                                                   &nbs
 p; &
amp;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 moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:lsoltero@globalmarinenet.net">lsoltero@globalmarinenet.net</a>
Web: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.globalmarinenet.net">http://www.globalmarinenet.net</a>
Web: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.redportglobal.com">http://www.redportglobal.com</a>
Web: <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.starpilotllc.com">http://www.starpilotllc.com</a>
</pre>
    </blockquote>
    <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>