Skip to content

r8a77961 CMT test setup using UIO

Magnus Damm linux-renesas-soc 1 version In review

Get series with b4
b4 am 160056199852.9912.5581183514421117508.sendpatchset@octo

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2r8a77961 CMT0 device exposed via UIOarch/arm64/boot/dts/renesas/r8a77961.dtsi drivers/uio/uio.c drivers/uio/uio_pdrv_genirq.c+20 -31 reply
2/2UIO CMT test programuio-cmt-test-20200919.c+190 -00 replies

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by.

PatchMagnus Damm
SeriesNot-Yet-Signed-off-by
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] r8a77961 CMT test setup using UIO

r8a77961 CMT test setup using UIO

[PATCH 1/2] r8a77961 CMT0 device exposed via UIO
[PATCH 2/2] UIO CMT test program

These two patches contain kernel and user space modificatons to allow some basic testing from user space of the CMT0 device included on the r8a77961 SoC.

For the kernel, simply apply the kernel patch (including a few debug printouts) and make sure to extend your kernel config with CONFIG_UIO_PDRV_GENIRQ=y.

The following log shows how to execute the test program on the target:

# ./uio-cmt-test
found matching UIO device at /sys/class/uio/uio0/
CLKE
CMCSR
CMCOR
[   12.284451] irqhandler 20
waiting 10s
UIO write
CLKE
UIO read
got CMT IRQ
CLKE
#

Please note that only a few registers of a single channel of the CMT0 device has been exercised. The kernel debug printout and /proc/interrupts may be used to verify that at least one interrupt has been delivered.

One limitation with the current setup is that the UIO kernel driver only supports a single interrupt however the CMT devices come with one interrupt per channel on R-Car Gen3. Currently the code only uses a single IRQ.

If it turns out that the current test coverage should be extended then perhaps it would be wise to also extend the UIO kernel driver with support for multiple interrupts as well. To maintain the same user space interface the UIO driver can simply have a list of interrupts associated with each device and then enable/disable all of them on each IRQ. Not fast but good enough for testing.

The code applies cleanly on renesas-drivers-2020-09-15-v5.9-rc5 from the renesas-drivers repo on kernel.org. Testing has been performed remotely on r8a77961 Salvator-XS but should be easy enough to move to more or less any other SoC with any kind of memory mapped device. Devices that do not support bus mastering (like the CMT) can be safely used without any IOMMU.

Not-Yet-Signed-off-by Magnus Damm <[email protected]>

---

 arch/arm64/boot/dts/renesas/r8a77961.dtsi |   10 +
 drivers/uio/uio.c                         |    3 
 drivers/uio/uio_pdrv_genirq.c             |   10 +
 uio-cmt-test-20200919.c                   |  190 +++++++++++++++++++++++++++++
 4 files changed, 210 insertions(+), 3 deletions(-)