<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: i.MX51 Device Tree GPIO as output</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295986#M36682</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before device trees configuring a GPIO was easy.&amp;nbsp; You would just go to the board's init function and make the modifications/patch to configure the GPIO, initialize the value of the GPIO if it was an output, and export the GPIO to sysfs for easy user space access.&amp;nbsp; The board init was performed early on and thus the GPIOs were configured shortly after MUXing was complete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fabio I'll look to see if setting up the GPIO as a GPIO controlled regulator will work for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 14 May 2014 11:17:52 GMT</pubDate>
    <dc:creator>daveebright</dc:creator>
    <dc:date>2014-05-14T11:17:52Z</dc:date>
    <item>
      <title>i.MX51 Device Tree GPIO as output</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295981#M36677</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am looking for a device tree example to define a GPIO as an output.&amp;nbsp; The gpio output is software controlled and is not connected to a button or LED (not a gpio-keys or gpio-leds compatible).&amp;nbsp; The gpio is a power enable/switch for a peripheral to the i.MX51 (when high (1) powered on and when low (0) powered off).&amp;nbsp; Additionally is there a way during kernel init to export this gpio to sysfs as was done in pre-device tree days?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Dave&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 19:23:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295981#M36677</guid>
      <dc:creator>daveebright</dc:creator>
      <dc:date>2014-05-12T19:23:59Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX51 Device Tree GPIO as output</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295982#M36678</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Here's how I'm doing it on the i.MX6 in the Dora branch.&amp;nbsp; The approach for the i.MX51 looks to be similar.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the DTS, there's a group of pinmux entries named &lt;SPAN style="font-family: 'courier new', courier;"&gt;pinctrl_hog&lt;/SPAN&gt;.&amp;nbsp; This group is not well documented, but I've been assuming these are set up unconditionally by the kernel (pins that need to be setup, but aren't managed by any particular device/driver).&amp;nbsp; Add a pinmux and pad control entry to this group along the lines of:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro _jivemacro_uid_13999289781352336 jive_macro_code" jivemacro_uid="_13999289781352336" modifiedtitle="true"&gt;
&lt;P&gt;&amp;amp;iomuxc {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pinctrl-names = "default";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pinctrl-0 = &amp;lt;&amp;amp;pinctrl_hog&amp;gt;;&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; hog {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pinctrl_hog: hoggrp {&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; fsl,pins = &amp;lt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&amp;nbsp; This is just an example; your own setup *will* vary.&amp;nbsp; */&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MX51_PAD_EIM_A27__GPIO2_21&amp;nbsp;&amp;nbsp; 0x5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/P&gt;
&lt;P&gt;};&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This example sets up the mux for pin EIM_A27 as connecting to GPIO2_21.&amp;nbsp; The "argument" to the &lt;SPAN style="font-family: 'courier new', courier;"&gt;MX51_*&lt;/SPAN&gt; entry is the pad control.&amp;nbsp; On the i.MX6, this value is stuffed directly into the &lt;SPAN style="font-family: 'courier new', courier;"&gt;IOMUXC_SW_PAD_CTL_*&lt;/SPAN&gt; register; consult your reference manual for the proper pad control values.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, this only sets up the mux and pad control.&amp;nbsp; It does not set up the GPIO state (input vs. output, current pin level, etc.).&amp;nbsp; For that, it looks like you have to wait for the kernel to come up.&amp;nbsp; In order to expose a GPIO to user space, you must first "export" it by writing the pin number you want exported to &lt;SPAN style="font-family: 'courier new', courier;"&gt;/sys/class/gpio/export&lt;/SPAN&gt;.&amp;nbsp; This in turn creates a subdirectory named &lt;SPAN style="font-family: 'courier new', courier;"&gt;/sys/class/gpio/gpio&lt;EM&gt;&amp;lt;nn&amp;gt;&lt;/EM&gt;&lt;/SPAN&gt;, where &lt;EM&gt;&amp;lt;nn&amp;gt;&lt;/EM&gt; is the pin number.&amp;nbsp; In there are various files that let you configure the GPIO pin the way you need it.&amp;nbsp; However, everything under /sys is owned and writable only by root, so you (probably) need to make those entries writable by non-privileged applications.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can do this using an init script, but I've chosen to do it using udev rules, since they run fairly early, are somewhat simpler once you understand the syntax, and will work regardless of what init system you're using.&amp;nbsp; Here are the rules I created to make a GPIO entry available for applications:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13999300774393407" jivemacro_uid="_13999300774393407" modifiedtitle="true"&gt;
&lt;P&gt;ACTION=="add", SUBSYSTEM=="gpio", DEVPATH=="/devices/*/gpio/gpiochip64", ATTR{subsystem/export}="86"&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;ACTION=="add", SUBSYSTEM=="gpio", DEVPATH=="/devices/*/gpio/gpio86",&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RUN+="/bin/chgrp -R gpio $sys$devpath", RUN+="/bin/chmod -R g+w $sys$devpath"&lt;/SPAN&gt;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first rule performs the export operation, creating the entry &lt;SPAN style="font-family: 'courier new', courier;"&gt;/sys/class/gpio/gpio86&lt;/SPAN&gt;.&amp;nbsp; That, in turn, triggers the second rule, which changes the group ownership and permissions of everything under &lt;SPAN style="font-family: 'courier new', courier;"&gt;/sys/class/gpio/gpio86&lt;/SPAN&gt; to be writable by members of the group "gpio" (which you will need to create).&amp;nbsp; You then create a user who is a member of the group "gpio", run your application(s) as that user, and you should be able to dance on the GPIO pin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Again, this is all for the 3.10.x series kernel in Dora (and probably Daisy as well).&amp;nbsp; Hope this made some sense...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 May 2014 21:47:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295982#M36678</guid>
      <dc:creator>leoschwab</dc:creator>
      <dc:date>2014-05-12T21:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX51 Device Tree GPIO as output</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295983#M36679</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I already had added my GPIOs to the hoggrp and defined the pad control.&amp;nbsp; Export and configuration of the gpio via command line in an init script, shell script, or c code were going to be backup plan.&amp;nbsp; Leo thanks for the specifics on how you went about this.&amp;nbsp; That is helpful!!!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However I still think it would be better to perform this configuration during kernel init so that you have defined the state of the gpio (it doesn't blip on or off for several seconds until the init completes and an init script performs the desired configuration).&amp;nbsp; I guess I can at least configure the gpios in u-boot so that their initial state is defined until an init script can run to configure them for general purpose use.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 11:26:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295983#M36679</guid>
      <dc:creator>daveebright</dc:creator>
      <dc:date>2014-05-13T11:26:59Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX51 Device Tree GPIO as output</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295984#M36680</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Can't you define this GPIO as a GPIO controlled regulator in your dts file?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 13 May 2014 17:53:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295984#M36680</guid>
      <dc:creator>fabio_estevam</dc:creator>
      <dc:date>2014-05-13T17:53:48Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX51 Device Tree GPIO as output</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295985#M36681</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;
&lt;P&gt;Dave Ebright wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;However I still think it would be better to perform this configuration during kernel init so that you have defined the state of the gpio (it doesn't blip on or off for several seconds until the init completes and an init script performs the desired configuration).&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;&lt;P&gt;I agree.&amp;nbsp; However, this appears to be a common complaint about embedded Linux.&amp;nbsp; While Googling for possible solutions, I got the impression that the Raspberry-PI crowd has the same complaint -- Linux doesn't init GPIOs until comparatively late, causing them to flap in the breeze for a long time at startup.&amp;nbsp; Doing the setup in U-Boot appears to be best available solution, assuming the kernel doesn't come along and completely reset everything...&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 02:19:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295985#M36681</guid>
      <dc:creator>leoschwab</dc:creator>
      <dc:date>2014-05-14T02:19:21Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX51 Device Tree GPIO as output</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295986#M36682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before device trees configuring a GPIO was easy.&amp;nbsp; You would just go to the board's init function and make the modifications/patch to configure the GPIO, initialize the value of the GPIO if it was an output, and export the GPIO to sysfs for easy user space access.&amp;nbsp; The board init was performed early on and thus the GPIOs were configured shortly after MUXing was complete.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fabio I'll look to see if setting up the GPIO as a GPIO controlled regulator will work for me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 14 May 2014 11:17:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295986#M36682</guid>
      <dc:creator>daveebright</dc:creator>
      <dc:date>2014-05-14T11:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX51 Device Tree GPIO as output</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295987#M36683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I am exactly at this situation trying to configure my mx6 gpio pins with a 3.10.17 kernel. More importantly the idea is to set direction for each gpio pin in the dts(i) files. While input gpio pins seem adequately documented, I haven't found anything with output pins. Is it true that a gpio can be configured as output only in userspace with sysfs? or there is a way of setting it in the dts file? Please confirm.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Nov 2014 09:46:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX51-Device-Tree-GPIO-as-output/m-p/295987#M36683</guid>
      <dc:creator>kartiknatarajan</dc:creator>
      <dc:date>2014-11-04T09:46:58Z</dc:date>
    </item>
  </channel>
</rss>

