AnsweredAssumed Answered

Writing TCMU and L in Linux iMX7

Question asked by ALLEN BLAYLOCK on Jun 12, 2018
Latest reply on Jun 21, 2018 by ALLEN BLAYLOCK

I am trying to write the TCM to load the M4 and boot it from Linux and can load the DDR and OCRAM_S but I cannot load the TCM. When I try to ioremap_uncached() the address I get a valid pointer back and then when I go to do an iowrite or an memcpy_toio linux freezes.

 

Any ideas? Code example below:

 

    if ((request_mem_region(0x007f8000,0x8000, "TCML")) == NULL) {
        printk(KERN_ERR "Failed to get TCML region\n");
        return -EIO;
    }
    printk(KERN_INFO "ioremapping TCML 0x007f8000 size 0x8000\n");
    mem = ioremap_nocache(0x007f8000, 0x8000);
    if(mem) {
        printk(KERN_INFO "ioremap successful\n");
        // First we need to set the region to be zero
        for(m4_data = 0; m4_data < 1 /*0x8000*/; ++m4_data)
        {
            printk(KERN_INFO "attempting memset %d @ 0x%p\n",m4_data,mem + m4_data);
            iowrite8(0, mem + m4_data);
            printk(KERN_INFO "memset %d @ 0x%p successful \n",m4_data,mem + m4_data);
        }
        // Now we copy in the data
        printk(KERN_INFO "memset successful\n");
        // Cleanup
        iounmap(mem);  
        printk(KERN_INFO "iounmap successful\n");
    } else {
        printk(KERN_ERR "error ioremapping TCML 0x007f8000 size 0x8000\n");
    }
    release_mem_region(0x007f8000, 0x8000);

Outcomes