AnsweredAssumed Answered

iMX6 peripheral memory access

Question asked by Aleksandr Gusarov on Mar 7, 2018

Hello,

While designing an iMX6ULL based device we've encountered an issue with reading/writing after ioremap.

Kernel 

DT and .config are attached.

 

The problems takes on two forms:

  • If during bootup ioremap was issued before a certain point, readw and writew both work, and then writew stops working;
  • If ioremap was issued after a certain point during bootup (or upon reaching shell), both readw and writew operations hang the system.

The system hangs happen when accessing:

  • KPP registers (base 0x20b8000)
  • EIM registers (base 0x21b8000)
  • EIM adress space (base 0x50000000)

We use this snippet to reproduce the issue:

 

/* DEBUG START */
{
        void __iomem *test_addr;

       printk(KERN_CRIT "%s:%d\n", __func__, __LINE__);

       test_addr = ioremap(0x020b8000, 0x4000);

       if (IS_ERR(test_addr)) {
               printk(KERN_CRIT "%s:%d ioremap failed\n", __func__, __LINE__);
       } else {
               printk(KERN_CRIT "%s:%d ioremap OK\n", __func__, __LINE__);
       }

       // System hangs here:
       printk(KERN_CRIT "%s:%d\nKPP: 0x%04x\n", __func__, __LINE__,
               readw(test_addr + 0)
       );

       iounmap(test_addr);    
}
/* DEBUG END   */

Do you have any advice?

Thanks!

Attachments

Outcomes