This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM57x IPU AMMU configuration from U-boot

We have a use-case of loading IPU2 codec binary from PSDK 02.00.00.00 Uboot. We are able to do it with configuring IPU_UNICACHE_MMU as done by the GEL file "DRA7xx_multicore_reset.gel" but we see some performance issues. Now since the PSDK 02.00.00.00 Linux uses IPU_AMMU, we wanted to try loading using IPU_AMMU. We are doing the below steps for doing the same:

1. Setting and Enabling IPU-2 clocks - This step works fine

2. Put IPU-2 in reset: by giving the below commands:

mw 0x4ae06910 7
mw 0x4ae06914 7
mw 0x4ae06910 3

3. Configure AMMU:

mw 0x5508204C 0xb0000000 #Translation Table address to 0xB0000000
mw 0x55082088 0x1  #enable bus-error back
mw 0x55082044 0x6 #emutlbupdate|TWLENABLE|MMUENABLE

4. Update entries in Translation Table by calling a Uboot function. I am writing the relevant code below:

unsigned int config_pagetable(unsigned int virt, unsigned int phys, unsigned int len, unsigned long addr)
{
unsigned int index = virt >> PGT_L1_DESC_SECTION_INDEX_SHIFT;
unsigned int l = len;
unsigned int desc;
unsigned int *page_table = (unsigned int *)addr;
printf("page-table virt 0x%x phys 0x%x len 0x%x\n", virt, phys, len);
while (l > 0) {
desc = (phys & PGT_L1_DESC_SECTION_MASK) | PGT_L1_DESC_SECTION;
page_table[index++] = desc;

l -= PGT_SECTION_SIZE;
phys += PGT_SECTION_SIZE;

}

return len;
}

int do_config_ipu_ammu(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
{
unsigned long addr; /* Address of the ELF image */
unsigned long rc; /* Return value from user code */
char *sload, *saddr;
const char *ep = getenv("autostart");

/* -------------------------------------------------- */
int rcode = 0;
#if 0
sload = saddr = NULL;
if (argc == 3) {
sload = argv[1];
saddr = argv[2];
} else if (argc == 2) {
if (argv[1][0] == '-')
sload = argv[1];
else
saddr = argv[1];
}
#endif
saddr = argv[1];

if (saddr)
addr = simple_strtoul(saddr, NULL, 16);
else
addr = 0xB0000000;

printf("IPU page table at 0x%x\n",addr);

// config_iommu(addr);
printf("IOMMU configuration done\n",addr);

config_pagetable(0x00000000, 0x55020000, IPU_AMMU_SZ_1M, addr);

config_pagetable(0x50000000, 0x40300000, IPU_AMMU_SZ_1M, addr);

config_pagetable(0x40000000, 0x40000000, IPU_AMMU_SZ_256M, addr);
config_pagetable(0x50000000, 0x50000000, IPU_AMMU_SZ_256M, addr);
config_pagetable(0x80000000, 0x80000000, IPU_AMMU_SZ_256M, addr);
config_pagetable(0x90000000, 0x90000000, IPU_AMMU_SZ_256M, addr);

}

U_BOOT_CMD(
config_ipu_ammu, 2, 0, do_config_ipu_ammu,
"Configure and map via IPU AMMU",
" [address] - load address of AMMU page table."
);

5. Set IPU2 Entry point and bring it out of reset:

mw 0x55020000 0x10000
mw 0x55020004 ${entryIPU2}
mw 0x55020008 0xe7fee7ee
mw 0x4ae06910 0
mw 0x4ae06914 7
mw 0x4a0051e4 0x0

After doing above steps, I connect IPU2 through CCS. It is not able to access memory via 0x00000000 or 0x80000000 which suggests the mapping did not happen. Whereas I have updated the page table entries. 

Please help me in getting IPU_AMMU up. Is there some configuration which I am missing?