<?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: EIM access from device driver</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259491#M25612</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I got it (it amazes me how often I figure something out&amp;nbsp; right AFTER I post the question to this forum)...&lt;/P&gt;&lt;P&gt;My .dts file is very barebones because my hardware is also minimal.&amp;nbsp; I had commented out the weim node...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weim: weim@021b8000 {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; compatible = "fsl,imx6q-weim";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; reg = &amp;lt;0x021b8000 0x4000&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; interrupts = &amp;lt;0 14 0x04&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; clocks = &amp;lt;&amp;amp;clks 196&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is what sets up (turns on) the clocks for EIM space.&lt;/P&gt;&lt;P&gt;With that snippet re-installed in the .dts file, things are working.&lt;/P&gt;&lt;P&gt;It works now using either of the above methods.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Feb 2014 22:55:39 GMT</pubDate>
    <dc:creator>EdSutter</dc:creator>
    <dc:date>2014-02-25T22:55:39Z</dc:date>
    <item>
      <title>EIM access from device driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259489#M25610</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a devices connected to EIM_CS0, EIM_CS1 &amp;amp; EIM_CS2.&amp;nbsp; To verify the hardware, I've been able to work with them at the u-boot level successfully; hence, I believe I understand the necessary configuration issues for the EIM bus. Now I'm trying to get portions of these interfaces running through a driver (module).&amp;nbsp; Every time I try to access the EIM space from the driver the board just locks up.&amp;nbsp; I've tried it using a module (using ioremap() and iowrite8()), and I've tried it using /dev/mem in user space.&amp;nbsp; In both cases the board just locks up as soon as I attempt to access that memory.&lt;/P&gt;&lt;P&gt;I have each CS set for 32M, so CS0=0x08000000, CS1=0x0a000000, CS2=0x0c000000.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the driver I do this (note that error checking is removed here just to simplify):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;void * virt_addr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;virt_addr = ioremap_nocache(0x0a000000,0x100));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;iowrite8(0x99,virt_addr);&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&amp;lt; LOCKUP&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;and in user space I do this (again, error checking removed for simplicity):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;uint32_t&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mem_address, mem_size, alloc_mem_size, page_mask, page_size;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;void&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; *mem_pointer, *virt_addr;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;mem_dev = open("/dev/mem", O_RDWR | O_SYNC);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;mem_size = 4;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;page_size = sysconf(_SC_PAGESIZE);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;alloc_mem_size = (((mem_size / page_size) + 1) * page_size);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;page_mask = (page_size - 1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;mem_pointer = mmap(NULL, alloc_mem_size, PROT_READ | PROT_WRITE,&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; MAP_SHARED, mem_dev, (mem_address &amp;amp; ~page_mask));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;virt_addr = (mem_pointer + (mem_address &amp;amp; page_mask));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;fprintf(stderr,"*0x%x: 0x%x'\n",mem_address,*(unsigned long*)virt_addr); &amp;lt;&amp;lt;LOCKUP&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;munmap(mem_pointer, alloc_mem_size);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that I am able to use the /dev/mem code to access other addresses within the CPU's register space, so fundamentally I know this implementation is good.&amp;nbsp; It appears that the issue is that for some reason the address space becomes "unavailable" when the kernel takes over.&amp;nbsp; Any thoughts on what might be the issue here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 22:33:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259489#M25610</guid>
      <dc:creator>EdSutter</dc:creator>
      <dc:date>2014-02-25T22:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: EIM access from device driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259490#M25611</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I was typing the original question, I had a hunch...&lt;/P&gt;&lt;P&gt;It appears that the CCM_CCGR6 CG5 bits are cleared by the kernel. &lt;/P&gt;&lt;P&gt;Gotta do more investigation; however if this turns out to be the problem; how to I tell the kernel to turn this on?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 22:37:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259490#M25611</guid>
      <dc:creator>EdSutter</dc:creator>
      <dc:date>2014-02-25T22:37:39Z</dc:date>
    </item>
    <item>
      <title>Re: EIM access from device driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259491#M25612</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, I got it (it amazes me how often I figure something out&amp;nbsp; right AFTER I post the question to this forum)...&lt;/P&gt;&lt;P&gt;My .dts file is very barebones because my hardware is also minimal.&amp;nbsp; I had commented out the weim node...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weim: weim@021b8000 {&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; compatible = "fsl,imx6q-weim";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; reg = &amp;lt;0x021b8000 0x4000&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; interrupts = &amp;lt;0 14 0x04&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&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; clocks = &amp;lt;&amp;amp;clks 196&amp;gt;;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; };&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;which is what sets up (turns on) the clocks for EIM space.&lt;/P&gt;&lt;P&gt;With that snippet re-installed in the .dts file, things are working.&lt;/P&gt;&lt;P&gt;It works now using either of the above methods.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2014 22:55:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259491#M25612</guid>
      <dc:creator>EdSutter</dc:creator>
      <dc:date>2014-02-25T22:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: EIM access from device driver</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259492#M25613</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Which of the above 2 implementation is better to use?&lt;/P&gt;&lt;P&gt;Only userspace changes are preferred by me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Feb 2020 06:16:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/EIM-access-from-device-driver/m-p/259492#M25613</guid>
      <dc:creator>abhijeet_ghodga</dc:creator>
      <dc:date>2020-02-25T06:16:23Z</dc:date>
    </item>
  </channel>
</rss>

