STM32MP157F-DK2 FMC cannot be configured in userspace.
I enabled fmc in arch/arm/boot/dts/stm32mp157f-dk2.dts:
&fmc {
status = "okay";
};And this is how i read or write its registers:
static inline unsigned int readl(const volatile void *addr)
{
unsigned int val;
__asm__ __volatile__("": : :"memory");
val = *(volatile unsigned int *)addr;
__asm__ __volatile__("": : :"memory");
return val;
}
static inline void writel(unsigned int value, volatile void *addr)
{
__asm__ __volatile__("": : :"memory");
*(volatile unsigned int *)addr = value;
__asm__ __volatile__("": : :"memory");
}
int main()
{
fd = open ("/dev/mem", O_RDWR | O_SYNC);
if(fd == 0)
{
DBG("open mem failed\n");
return -1;
}
iobase = mmap(NULL, 0x1000, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x58002000);
if(iobase == MAP_FAILED)
{
DBG("iobase mmap failed\n");
ret = -1;
goto close_fd;
}
bcr0 = readl(iobase+FMC2_BCR(0));
...
writel(bcr0, iobase+FMC2_BCR(0));
...
}But I guess I did not read the proper values of its registers, which are all 0x000030db. And if I try to write it, it did not change its value.
I had tried to do the same thing on STM32MP157D-EV1, but it could read the correct value and my writings did work.
Now I have to work on dk2 for some reasons, how can I configure it?
BTW, "cat /proc/iomem" will not print that range of mapped memory.
