<?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>topic Re: Configuring IMX6 SW CTL PAD Registers in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/Configuring-IMX6-SW-CTL-PAD-Registers/m-p/499122#M80501</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;Solution&lt;/P&gt;&lt;P&gt;/********************************************************************************************************************************************/&lt;/P&gt;&lt;P&gt;Prerequisite:&lt;/P&gt;&lt;P&gt;1. Find the IOMUX SW MUX CTL PAD Base Address&lt;/P&gt;&lt;P&gt;2. Find the offset address of the register that needs to be modified. (Example DIO Register)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the source code&lt;/P&gt;&lt;P&gt;Include the following Header file&lt;/P&gt;&lt;P&gt;#include &amp;lt;asm/io.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare a Variable of type void __iomem RegAddress&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next we need to use ioremap to map that register to an address&lt;/P&gt;&lt;P&gt;RegAddress = ioremap(BASE_ADDRESS + OFFSET , 4)&amp;nbsp; // void *ioremap(unsigned long phys_addr, unsigned long size);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now we read the register value using &lt;/P&gt;&lt;P&gt;RegValue = readl(RegAddress);&amp;nbsp; // &lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;unsigned readl(address);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Write to the register using&lt;/P&gt;&lt;P&gt;writel((RegValue | VALUE), RegAddress);&amp;nbsp;&amp;nbsp;&amp;nbsp; // &lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;void writel(unsigned value, address);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;where VALUE is the data that needs to be written to the register&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before exiting make sure to unmap the regsiter using&lt;/P&gt;&lt;P&gt;iounmap(RegAddress) // void ioport_unmap(void *addr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks You&lt;/P&gt;&lt;P&gt;Happy Coding. :smileyhappy: :smileyhappy: :smileyhappy:&lt;/P&gt;&lt;P&gt;/******************************************************************************************************************************************/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Mar 2016 06:33:39 GMT</pubDate>
    <dc:creator>soumyadas</dc:creator>
    <dc:date>2016-03-04T06:33:39Z</dc:date>
    <item>
      <title>Configuring IMX6 SW CTL PAD Registers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Configuring-IMX6-SW-CTL-PAD-Registers/m-p/499120#M80499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;I am an absolute newbie in this device driver field. I am developing a character driver for IMX6 with a custom keyboard. I have been able to develop a basic device driver for the system.&lt;/P&gt;&lt;P&gt;Now I need to configure some of the pins as GPIOs using the SW CTL PAD Register.I am able to get my system to work using the memtools but could not figure out a way to configure the register in the device driver source code or otherwise. I need assistance on how to set the CTL PAD Register to the appropriate value.&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 04:47:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Configuring-IMX6-SW-CTL-PAD-Registers/m-p/499120#M80499</guid>
      <dc:creator>soumyadas</dc:creator>
      <dc:date>2016-03-02T04:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Configuring IMX6 SW CTL PAD Registers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Configuring-IMX6-SW-CTL-PAD-Registers/m-p/499121#M80500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Soumia&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;one can look at linux documentation in folder:&lt;/P&gt;&lt;P&gt;../Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;AN5125 Introduction to Device Tree&lt;/P&gt;&lt;P&gt;&lt;A href="http://cache.nxp.com/files/32bit/doc/app_note/AN5125.pdf" title="http://cache.nxp.com/files/32bit/doc/app_note/AN5125.pdf"&gt;http://cache.nxp.com/files/32bit/doc/app_note/AN5125.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.kosagi.com/w/index.php?title=Definitive_GPIO_guide" title="http://www.kosagi.com/w/index.php?title=Definitive_GPIO_guide"&gt;Definitive GPIO guide - Studio Kousagi Wiki&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;igor&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Mar 2016 00:23:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Configuring-IMX6-SW-CTL-PAD-Registers/m-p/499121#M80500</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2016-03-03T00:23:35Z</dc:date>
    </item>
    <item>
      <title>Re: Configuring IMX6 SW CTL PAD Registers</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/Configuring-IMX6-SW-CTL-PAD-Registers/m-p/499122#M80501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear All,&lt;/P&gt;&lt;P&gt;Solution&lt;/P&gt;&lt;P&gt;/********************************************************************************************************************************************/&lt;/P&gt;&lt;P&gt;Prerequisite:&lt;/P&gt;&lt;P&gt;1. Find the IOMUX SW MUX CTL PAD Base Address&lt;/P&gt;&lt;P&gt;2. Find the offset address of the register that needs to be modified. (Example DIO Register)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now the source code&lt;/P&gt;&lt;P&gt;Include the following Header file&lt;/P&gt;&lt;P&gt;#include &amp;lt;asm/io.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Declare a Variable of type void __iomem RegAddress&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Next we need to use ioremap to map that register to an address&lt;/P&gt;&lt;P&gt;RegAddress = ioremap(BASE_ADDRESS + OFFSET , 4)&amp;nbsp; // void *ioremap(unsigned long phys_addr, unsigned long size);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now we read the register value using &lt;/P&gt;&lt;P&gt;RegValue = readl(RegAddress);&amp;nbsp; // &lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;unsigned readl(address);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Write to the register using&lt;/P&gt;&lt;P&gt;writel((RegValue | VALUE), RegAddress);&amp;nbsp;&amp;nbsp;&amp;nbsp; // &lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;void writel(unsigned value, address);&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;where VALUE is the data that needs to be written to the register&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docPubcolor"&gt;&lt;SPAN class="docMonofont"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Before exiting make sure to unmap the regsiter using&lt;/P&gt;&lt;P&gt;iounmap(RegAddress) // void ioport_unmap(void *addr);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks You&lt;/P&gt;&lt;P&gt;Happy Coding. :smileyhappy: :smileyhappy: :smileyhappy:&lt;/P&gt;&lt;P&gt;/******************************************************************************************************************************************/&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Mar 2016 06:33:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/Configuring-IMX6-SW-CTL-PAD-Registers/m-p/499122#M80501</guid>
      <dc:creator>soumyadas</dc:creator>
      <dc:date>2016-03-04T06:33:39Z</dc:date>
    </item>
  </channel>
</rss>

