03-14-2016 09:57 PM
I can read and write emio register in u-boot with md.l and mw.l.
When I config the emio register in u-boot, I can control the gpio pin.
But when I mmap(APP) the 0xe000a000(emio base address), or ioremap(KERNEL DRIVER), I read the registers 0x00000000. Of cause, the gpio can't controlled by me.
What' wrong with it?
Thank you very much.
03-19-2016 07:47 AM
Can you try it using "devmem" utility. This command should already be installed on your system.
# devmem 0xe000a000 0x00000280
If this works, then it suggests some error in your application. You can look at the source code for devmem (http://free-electrons.com/pub/mirror/devmem2.c)
03-31-2016 02:31 PM
Using the /sys/class/gpio method is one of many possible ways to access the GPIO. This makes use of a driver in the kernel, which accesses the same hardware registers at physical address 0xE000A000. The source code for this driver is available in the standard xilinx kernel tree.
I'm afraid I do not understand exactly what problem you are facing.
01-31-2019 11:23 AM
I have encountered same problem, and I found the missing step.
Before access GPIO/EMIO register it will need set/update gpio clocks with set bit 22(GPIO_CPU_1XCLKACT) over APER_CLK_CTRL(0x0000012C) reg under "System Level Control Registers(0xF8000000)".
uint32_t* sysctl = (uint32_t *)mmap(NULL, 0x1000, PROT_READ | PROT_WRITE, MAP_SHARED, fd_mem, (0xF8000000 & ~(0x1000 - 1))); uint32_t* gpioclk = &sysctl[APER_CLK_CTRL>>2]; uint32_t clks = *gpioclk; *gpioclk = clks|(1<<22);