Writing TCMU and L in Linux iMX7

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.

I do have that present in my dts file. Does it enable any clocks as part of the boot up process. I found if I attach a debugger to the M4 and then boot the process works so I strongly suspect a clock is not enabled that should be. Are there additional clock configurations that need to be set up to write to the TCM?

void __iomem* m4rcr;void __iomem* ccgr;void __iomem* mem; uint32_t m4_data;struct m4loader_drv* m4_dev =to_m4loader_drv(filep);/* Reset the buffer index, we assume if it is being opened we are getting a * new ELF to load. */ m4_dev->current_buffer_index =0;

if((request_mem_region(0x3039000C,32,"SRC_M4RCR"))== NULL){dev_err(&m4_dev->pdev->dev,"Failed to get m4rcr region\n");return-1;}

I have found that with clk_unused_ignore and just calling bootaux on the tcm in uboot allows the write to TCM to work. Any idea which clocks I need to enable in arch/arm/mach-imx/clk-imx7d.c that would allow linux to properly configure the system without uboot being involved?

I also had to call bootaux 7f80000 in uboot before booting. This still seems like a pretty unsatisfactory solution. I would like to be able to set up all of the clocking in linux in the event that uboot isnt properly set up.

I also had the same issue trying to load code from Linux to the M4 on an imx6sx. I have investigated why, and have found the following. When Linux boots, it checks to see if the M4 is running or not, and performs additional initialization if the M4 is running. This additional initialization, among other things, allows the A9 to write to the M4's TCM. This is why running the bootaux command in uBoot allows Linux to write to the TCM. There is nothing in particular that the bootaux command does to enable A9 to write to the TCM, other than start the M4 and allow Linux to perform the additional initialization.

The file arch/arm/mach-imx/src.c contains a function imx_src_is_m4_enabled. As a test, I have patched this function to always return true, and I am now able to load firmware from the A9 to the M4 without running the bootaux command.

I have yet to investigate if there are any negative side effects of doing this.