AnsweredAssumed Answered

怎么测试EIM

Question asked by AF Fast on Nov 2, 2018
Latest reply on Nov 8, 2018 by jimmychan

我的平台上已经添加EIM总线,但我不知道如何在用户空间里测试EIM应用。

我打算使用devmem2读写0x0800_0000内存做测试,但是失败了

 

 - 处理器:imx6qsabresd

 - 系统:Linux 4.1.15

 

厂家提供的uImage,已经添加EIM驱动,CS0控制器 0x021b8000

root@imx6qsabresd:~# find /sys/ -name "*eim*"
/sys/bus/platform/devices/21b8000.weim
/sys/bus/platform/drivers/imx-weim
/sys/bus/platform/drivers/imx-weim/21b8000.weim
/sys/devices/soc0/soc/2100000.aips-bus/21b8000.weim
/sys/firmware/devicetree/base/soc/aips-bus@02100000/weim@021b8000
/sys/kernel/debug/clk/eim_slow
root@imx6qsabresd:~#

可以使用devmem2直接访问寄存器,如修改CS0GCR1的值

 

root@imx6qsabresd:~# devmem2 0x021B8018 w 0x10081                       < ---- change to 0x10081
/dev/mem opened.
Memory mapped at address 0x76f66000.
Value at address 0x21B8018 (0x76f66018): 0x10080
Written 0x10081; readback 0x10081
root@imx6qsabresd:~# devmem2 0x021B8018 w 0x10080                         < ---- change to 0x10080
/dev/mem opened.
Memory mapped at address 0x76fcf000.
Value at address 0x21B8018 (0x76fcf018): 0x10081
Written 0x10080; readback 0x10080

 

EIM共有128MB内存可访问,地址范围 0x08000000 ~ 0x0FFFFFFF。被分成4个区域,CS0 ~ CS3,每个区域拥有32MB

CS0 起始地址 0x08000000
CS1 起始地址 0x0a000000
CS2 起始地址 0x0c000000
CS3 起始地址 0x0e000000

为什么同样使用devmem2访问该128MB内存看不到效果?

root@imx6qsabresd:~# devmem2 0x08000000 w 0xaabbccdd <----- change to 0xaabbccdd
/dev/mem opened.
Memory mapped at address 0x76fa0000.
Value at address 0x8000000 (0x76fa0000): 0x38613860
Written 0xAABBCCDD; readback 0x38613860 <----- read is not 0xaabbccdd
root@imx6qsabresd:~#
root@imx6qsabresd:~# devmem2 0x0a000000 w 0xaabbccdd
/dev/mem opened.
Memory mapped at address 0x76f81000.
Value at address 0xA000000 (0x76f81000): 0x38613860 <----- still 0x38613860
Written 0xAABBCCDD; readback 0x38613860
root@imx6qsabresd:~#
root@imx6qsabresd:~# devmem2 0x0c000000 w 0xaabbccdd
/dev/mem opened.
Memory mapped at address 0x76fa8000.
Value at address 0xC000000 (0x76fa8000): 0x38613860
Written 0xAABBCCDD; readback 0x38613860
root@imx6qsabresd:~#
root@imx6qsabresd:~# devmem2 0x0e000000 w 0xaabbccdd
/dev/mem opened.
Memory mapped at address 0x76fa9000.
Value at address 0xE000000 (0x76fa9000): 0x38613860
Written 0xAABBCCDD; readback 0x38613860

Outcomes