<?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: GPIO toggle problem in LKM imx6</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-toggle-problem-in-LKM-imx6/m-p/767572#M119209</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vijesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;general answer one can find on linux documentation&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/22529039/how-to-acess-the-physical-address-from-linux-kernel-space" title="https://stackoverflow.com/questions/22529039/how-to-acess-the-physical-address-from-linux-kernel-space"&gt;How to acess the physical address from linux kernel space? - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for i.mx gpio manipulation examples one can look at linux documentation provided on&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.nxp.com%2Fproducts%2Fsoftware-and-tools%2Fsoftware-development-tools%2Fi.mx-software-and-tools%2Fi.mx-6series-i.mx-7series-software-and-development-tool-resources%3AIMX_SW" rel="nofollow" target="_blank"&gt;http://www.nxp.com/products/software-and-tools/software-development-tools/i.mx-software-and-tools/i.mx-6series-i.mx-7series-software-and-development-tool-resources:IMX_SW&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Dec 2017 10:21:57 GMT</pubDate>
    <dc:creator>igorpadykov</dc:creator>
    <dc:date>2017-12-06T10:21:57Z</dc:date>
    <item>
      <title>GPIO toggle problem in LKM imx6</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-toggle-problem-in-LKM-imx6/m-p/767571#M119208</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE style="width: 700px; white-space: pre-wrap; word-break: break-all; word-wrap: break-word;"&gt;I am trying to toggle an LED inside the init() function called during insmod of an LKM Module.&amp;nbsp; Following are the steps i followed. Step1: set the pin&amp;nbsp; mux to GPIO by changing the pin mux register using ioremap(), ioread32(),iowrite32(). step 2:&amp;nbsp; set the direction of gpio in gpio direction&amp;nbsp; register using ioremap(), ioread32(),iowrite32(). step 3:&amp;nbsp; toggle the gpio by writing to gpio data&amp;nbsp; register using ioremap(), ioread32(),iowrite32().&amp;nbsp; I am able to toggle the LED,but the LED is becoming OFF once the init() function is returned - It should be ON continuously as I have written high in data register before quitting. Source code attached for your reference. Please give your comments&amp;nbsp; Is there any problem with the way i am using the ioremap() function or any issues with my .dtb. Also please provide if you have any references of using ioremp() for imx6&amp;nbsp;&amp;nbsp; My actual requirement is to configure the CPU registers of SPI/EIM modules using ioremap() - before that i wanted to ensure ioremap() working with GPIO.&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please give your comments.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#include&amp;lt;linux/init.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/module.h&amp;gt;&lt;BR /&gt;#include &amp;lt;linux/gpio.h&amp;gt;&lt;BR /&gt;#include&amp;lt;linux/kernel.h&amp;gt;&lt;BR /&gt;#include&amp;lt;linux/interrupt.h&amp;gt;&lt;BR /&gt;#include&amp;lt;linux/ioport.h&amp;gt;&lt;BR /&gt;#include&amp;lt;linux/mm.h&amp;gt;&lt;BR /&gt;#include&amp;lt;asm/uaccess.h&amp;gt;&lt;BR /&gt;#include&amp;lt;asm/page.h&amp;gt;&lt;BR /&gt;#include&amp;lt;asm/io.h&amp;gt;&lt;BR /&gt;#include&amp;lt;linux/delay.h&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;MODULE_LICENSE("GPL") ;&lt;/P&gt;&lt;P&gt;static int mux= 0x020e01d8 ; // gpio pad mux register&lt;BR /&gt;static int dat= 0x0209c000 ; //gpio01_24 data register&lt;BR /&gt;static int dir= 0x0209c004 ;&amp;nbsp; //gpio01_24 direction register&lt;BR /&gt;unsigned int result ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void __iomem *ptr ;&lt;BR /&gt;static void __iomem *ptr1 ;&lt;BR /&gt;static void __iomem *ptr2 ;&lt;BR /&gt;static void __iomem *ptr3 ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void *a ;&lt;BR /&gt;void *b ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static int __init gpio_init(void)&lt;BR /&gt;{&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; char i ;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; printk(KERN_ALERT "inside init function ");&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; ptr = ioremap(mux,4);&lt;BR /&gt;&amp;nbsp; result = 0x05;&lt;BR /&gt;&amp;nbsp; iowrite32(result,ptr); &lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp; ptr2 = ioremap(dir,4);&lt;BR /&gt;&amp;nbsp; result = ioread32(ptr2);&lt;BR /&gt;&amp;nbsp; result = result| 0x0d000000 ;&lt;BR /&gt;&amp;nbsp; iowrite32(result,ptr2); &amp;nbsp;&lt;BR /&gt;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; ptr1 = ioremap(dat,4);&lt;BR /&gt;&amp;nbsp; result = ioread32(ptr1);&lt;BR /&gt;&amp;nbsp; printk(KERN_ALERT "value =%x\n",result);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; for(i =0 ; i &amp;lt; 5 ; i++)&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; result = ioread32(ptr1);&lt;BR /&gt;&amp;nbsp; result = result&amp;amp; 0xf2ffffff ; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; iowrite32(result,ptr1); &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; msleep(100);&lt;BR /&gt;&amp;nbsp; result = ioread32(ptr1);&lt;BR /&gt;&amp;nbsp; result = result| 0x0d000000 ; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;iowrite32(result,ptr1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; msleep(100); &amp;nbsp;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printk(KERN_ALERT "before\n");&lt;BR /&gt;msleep(5000); &lt;BR /&gt;result = ioread32(ptr1);&lt;BR /&gt;&amp;nbsp; result = result| 0x0d000000 ; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; iowrite32(result,ptr1);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; msleep(5000); &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;printk(KERN_ALERT "after \n");&lt;BR /&gt;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp; return 0 ;&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void __exit gpio_exit(void)&lt;BR /&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;BR /&gt;&amp;nbsp; //&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; release_mem_region(0x209c000,100);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; result = ioread32(ptr1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; printk(KERN_ALERT "value =%x\n",result);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;iounmap(ptr);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iounmap(ptr1);&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; iounmap(ptr2);&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;printk(KERN_ALERT "Exiting LKM Module\n");&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;module_init(gpio_init);&lt;BR /&gt;module_exit(gpio_exit);&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Dec 2017 09:32:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-toggle-problem-in-LKM-imx6/m-p/767571#M119208</guid>
      <dc:creator>vijeshreddy</dc:creator>
      <dc:date>2017-12-06T09:32:03Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO toggle problem in LKM imx6</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-toggle-problem-in-LKM-imx6/m-p/767572#M119209</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi vijesh&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;general answer one can find on linux documentation&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/22529039/how-to-acess-the-physical-address-from-linux-kernel-space" title="https://stackoverflow.com/questions/22529039/how-to-acess-the-physical-address-from-linux-kernel-space"&gt;How to acess the physical address from linux kernel space? - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for i.mx gpio manipulation examples one can look at linux documentation provided on&lt;/P&gt;&lt;P&gt;&lt;A class="jive-link-external-small" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.nxp.com%2Fproducts%2Fsoftware-and-tools%2Fsoftware-development-tools%2Fi.mx-software-and-tools%2Fi.mx-6series-i.mx-7series-software-and-development-tool-resources%3AIMX_SW" rel="nofollow" target="_blank"&gt;http://www.nxp.com/products/software-and-tools/software-development-tools/i.mx-software-and-tools/i.mx-6series-i.mx-7series-software-and-development-tool-resources:IMX_SW&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Dec 2017 10:21:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-toggle-problem-in-LKM-imx6/m-p/767572#M119209</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2017-12-06T10:21:57Z</dc:date>
    </item>
  </channel>
</rss>

