I'm using Linux on an imx258 chipset with an IIM kernel driver based on Freescale's original version. This driver provides an mmap method that sets pgprot_noncached() and calls remap_pfn_range().
To test this from user space, I do something like
fd = open("/dev/mxc_iim", O_RDWR|O_SYNC);
p = mmap(NULL, 0x1000, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0x0000);
printf("byte 0x%x\n", *(volatile uint32_t *)(p+0x24));
This results in a fault
[ 1929.298287] Unhandled fault: external abort on non-linefetch (0x008) at 0xb6e40024
The mmap() call from user space triggers the driver's mmap routine. remap_pfn_range() returns successfully.
I'm sure that the clock for IIM is running. I tried a private or shared mapping, uint8_t access instead of uint32, mapping a diffrent offset instead of 0. None of this made any difference.
I am aware that some registers can be accessed only from supervisor mode, not from user mode. Therefore, I chose offset 0x24 (silicon revision register) where the reference manual says explicitly "User read". Still no success. Is there any configuration to globally disable register access in user mode? (I am running in engineering mode, I'm not using HAB for secure boot.)
Any idea what is causing this problem or what else I can do to track it down?