Accessing registers from Linux

Hi,

I’m trying to access hardware registers (VI_CFG_INTERRUPT_STATUS_0:0x15c0140d) using devmem2, but I get this error.

/dev/mem opened.
Memory mapped at address 0x7f950d6000.
Bus error

I guess I need to first map the MMIO I’m trying to access? Any help with this is appreciated, thanks!

Seems like I should be able to access these registers if I do not add the VI node to the SMMU, by modifying the device tree. Will test and confirm.

Still not able to access the VI registers at 0x15c11000, with devmem2 0x15c11000 w. Can anyone help with this please?

The VI_CFG_INTERRUPT_STATUS_0 address should be 0x15f05034
Also you need to disable the power gate and enable the clock first.

Have a reference to the driver vi5_fops.c(tegra_vi5_power_on) and mipi_cal.c(tegra_mipi_clk_enable)

Thanks for the reply!

If this information is easily available, could you please tell me the register addresses for the power gate and clock?

You can try the sysfs like /sys/kernel/debug/bpmp/debug/clk/vi

echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/state

Hi Shane,

Tried that, but it didn’t seem to work either. Let me know if there’s anything else I can try, thanks.

root@sanjay-dev-xav:~# echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/mrq_rate_locked
root@sanjay-dev-xav:~# cat /sys/kernel/debug/bpmp/debug/clk/vi/max_rate |tee /sys/kernel/debug/bpmp/debug/clk/vi/rate
998400000
root@sanjay-dev-xav:~# echo 1 > /sys/kernel/debug/bpmp/debug/clk/vi/state
root@sanjay-dev-xav:~#
root@sanjay-dev-xav:~#
root@sanjay-dev-xav:~# devmem2 0x15f05034 w
/dev/mem opened.
Memory mapped at address 0x7f8d69b000.
Bus error
root@sanjay-dev-xav:~#

Have a try this tool. Remove the .txt and chomd +x reg
reg.txt (2.6 MB)

Hi Shane,

Thanks, I just tried the tool. Accessing this registers crashes the system because of a hardware exception as shown below. I was able to read memory address 0x0, 0x4 etc, so it seems to be an invalid address or the register is not ready to be read.

root@sanjay-dev-xav:~# ./reg 15f05034                                                                                                                                                       
[  245.111222] CPU1: SError detected, daif=1c0, spsr=0x40c000c5, mpidr=80000001, esr=be000000
[  245.111231] CPU5: SError detected, daif=1c0, spsr=0x40c000c5, mpidr=80000201, esr=be000000
[  245.111239] CPU7: SError detected, daif=1c0, spsr=0x40c000c5, mpidr=80000301, esr=be000000
[  245.111249] CPU3: SError detected, daif=1c0, spsr=0x40c000c5, mpidr=80000101, esr=be000000
[  245.111255] CPU6: SError detected, daif=1c0, spsr=0x40c000c5, mpidr=80000300, esr=be000000
[  245.111261] CPU2: SError detected, daif=1c0, spsr=0x40c000c5, mpidr=80000100, esr=be000000
[  245.111852] **************************************
[  245.111856] * For more Internal Decode Help
[  245.111858] *     http://nv/cbberr
[  245.111860] * NVIDIA userID is required to access
[  245.111862] **************************************
[  245.111867] CPU:5, Error:CBB-NOC
[  245.111876]  Error Logger            : 1
15f05034: 00000000
root@sanjay-dev-xav:~# [  245.111889]   ErrLog0                 : 0x80030600
[  245.111892]    Transaction Type      : RD  - Read, Incrementing
[  245.111895]    Error Code            : TMO
[  245.111898]    Error Source          : Target NIU
[  245.111901]    Error Description     : Target time-out error
[  245.111905]    Packet header Lock    : 0
[  245.111917] CPU:0, Error:CBB-NOC@0x2300000,irq=481
[  245.111920]    Packet header Len1    : 3
[  245.111923] **************************************
[  245.111926] * For more Internal Decode Help
[  245.111932] *     http://nv/cbberr
[  245.111934] * NVIDIA userID is required to access
[  245.111938] **************************************
[  245.111940] CPU:0, Error:CBB-NOC
[  245.111944]  Error Logger            : 1
[  245.111954]  ErrLog0                 : 0x80030600
[  245.111958]    NOC protocol version  : version >= 2.7
[  245.111961]    Transaction Type      : RD  - Read, Incrementing
[  245.111964]  ErrLog1                 : 0x352828
[  245.111967]    Error Code            : TMO
[  245.111969]  ErrLog2                 : 0x0
[  245.111971]    Error Source          : Target NIU
[  245.111974]    RouteId               : 0x352828
[  245.111984]    Error Description     : Target time-out error
[  245.111986]    InitFlow              : ccroc_p2ps/I/ccroc_p2ps
[  245.111989]    Packet header Lock    : 0
[  245.111992]    Targflow              : host1x_p2pm/T/host1x_p2pm
[  245.111995]    Packet header Len1    : 3
[  245.111997]    TargSubRange          : 20
[  245.112000]    SeqId                 : 0
[  245.112003]  ErrLog3                 : 0x305034
[  245.112006]  ErrLog4                 : 0x0
[  245.112032]    NOC protocol version  : version >= 2.7
[  245.112039]  ErrLog1                 : 0x352828
[  245.112045]  ErrLog2                 : 0x0
[  245.112052]    Address               : 0x15f05034 -- /host1x/vi@15c10000 + 0x5034
[  245.112055]    RouteId               : 0x352828
[  245.112059]  ErrLog5                 : 0xa09f850
[  245.112062]    Non-Modify            : 0x1
[  245.112065]    AXI ID                : 0x14
[  245.112068]    InitFlow              : ccroc_p2ps/I/ccroc_p2ps
[  245.112071]    Master ID             : CCPLEX
[  245.112073]    Targflow              : host1x_p2pm/T/host1x_p2pm
[  245.112076]    Security Group(GRPSEC): 0x7e
[  245.112079]    TargSubRange          : 20
[  245.112082]    Cache                 : 0x0 -- Non-cacheable/Non-Bufferable)
[  245.112084]    SeqId                 : 0
[  245.112088]    Protection            : 0x2 -- Unprivileged, Non-Secure, Data Access
[  245.112092]  ErrLog3                 : 0x305034
[  245.112094]    FALCONSEC             : 0x0
[  245.112100]  ErrLog4                 : 0x0
[  245.112103]    Virtual Queuing Channel(VQC): 0x0

P.S The 15th line of the in-lined log indicates that the tool read the value 0 from the register, before the exception restarted the system.

Thanks this works for reading. I’m also able to use devmem2 to read/write when nvargus-daemon is running (it takes care of the initialization I guess)