AnsweredAssumed Answered

How to read/write CAAM registers in non-secure world kernel?

Question asked by Hao Han on May 20, 2014
Latest reply on May 25, 2014 by Yuri Muhin

I would like to read/write CAAM's Master Configuration Register (MCFGR) (address space 0x02100000+4) in non-secure world Linux kernel, but it does not function well and always return 0. The code I have used is as follows:

 

res = platform_get_resource_byname(pdev,

    IORESOURCE_MEM, "iobase_caam");

 

    if (!res) {

    dev_err(dev, "caam: invalid address resource type\n");

    return -ENODEV;

}

 

ctrl = ioremap(res->start, SZ_64K); //0x02100000

 

if (ctrl == NULL) {

    dev_err(dev, "caam: ioremap() failed\n");

    return -ENOMEM;

}

...

printk("MCFGR: %x\n", ioread32(&ctrl->mcr)); //0x02100000 + 4

setbits32(&topregs->ctrl.mcr, MCFGR_WDENABLE |(sizeof(dma_addr_t) == sizeof(u64) ? MCFGR_LONG_PTR : 0));

printk("MCFGR: %x\n", ioread32(&ctrl->mcr));

 

The returned value is always 0, while the expected value is 0x2140

U-Boot > md.l 0x02100000 6

02100000: 00000000 00002140 00000000 00000001    ....@!..........

02100010: 00000001 00020002                      ........

 

I have set the CSU_CSL17 register to 0x00ff00ff so that CAAM can be accessible in both non-secure and secure worlds. However, it does not solve the problem. Could anyone please help me figure it out?

 

Thank you very much!

Outcomes