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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1,134 Views
hhan
Contributor I

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!

Tags (2)
0 Kudos
1 Reply

565 Views
Yuri
NXP Employee
NXP Employee

Please use Linux driver as examples how to access CAAM registers,

In particular use test module tcrypt.c. The sources may be found in

<kernel>/drivers/crypto/

<kernel>/drivers/crypto/caam


Also please refer to Chapter 51 [CAAM (Cryptographic Acceleration and Assurance

  Module)] of “i.MX_6_Linux_Reference_Manual.pdf”.


https://www.freescale.com/webapp/Download?colCode=L3.10.17_1.0.0_IMX6QDLS_BUNDLE&appType=license&loc...


Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos