Tests:SCIF-FIFO

From eLinux.org
Revision as of 04:14, 31 May 2016 by Geert (talk | contribs) (Add renesas-drivers tag where SCIF FIFO flushing was fixed.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This document describes how to test FIFO behavior for the Renesas SCIF, SCIFA, SCIFB, and HSCIF serial ports.


Kernel Version and Configuration

  • arm32: shmobile_defconfig (you may want to enable CONFIG_CGROUPS)
  • arm64: defconfig

By default, serial port DMA is disabled. You can test either with DMA enabled:

CONFIG_SERIAL_SH_SCI_DMA=y

or disabled:

# CONFIG_SERIAL_SH_SCI_DMA is not set


Hardware Environment

Koelsch

  • For testing transfers between SCIF3 and SCIFA5:
    • Connect SCIF3 TXD (EXIO Connector C pin 38) to SCIFA5 RXD (EXIO Connector C pin 39)
    • Connect SCIF3 RXD (EXIO Connector C pin 40) to SCIFA5 TXD (EXIO Connector C pin 37)
  • For testing transfers between SCIFB0 and HSCIF1:
    • Connect SCIFB0 TXD (EXIO Connector A pin 60) to HSCIF1 RXD (EXIO Connector A pin 72)
    • Connect SCIFB0 RXD (EXIO Connector A pin 66) to HSCIF1 TXD (EXIO Connector A pin 53)

Salvator-X

  • For testing transfers between SCIF3 and HSCIF3:
    • Connect SCIF3 TXD (EXIO Connect D pin 21) to HSCIF3 RXD (EXIO Connect D pin 28)
    • Connect SCIF3 RXD (EXIO Connect D pin 27) to HSCIF3 TXD (EXIO Connect D pin 30)


Test Procedure

Koelsch

Load all needed DT overlays:

overlay add r8a7791-koelsch-exio-c-scif3.dtbo \
            r8a7791-koelsch-exio-c-scifa5-c.dtbo \
            r8a7791-koelsch-exio-a-scifb0.dtbo \
            r8a7791-koelsch-exio-a-hscif1.dtbo

Set up a few convenience macros:

scif3=/dev/ttySC3
scifa5=/dev/ttySC11
scifb0=/dev/ttySC12
hscif1=/dev/ttySC16

Test transfers from HSCIF1 to SCIFB0:

fifotest $hscif1 $scifb0 -s 1000000 -n 100

Test transfers from SCIFB0 to HSCIF1:

fifotest $scifb0 $hscif1 -s 1000000 -n 100

Test transfers from SCIF3 to SCIFA5:

fifotest $scif3 $scifa5 -s 1000000 -n 100

Test transfers from SCIFA5 to SCIF3:

fifotest $scifa5 $scif3 -s 1000000 -n 100

Expected output for all four tests above (after ca. 12 seconds):

MSG: 100, TX: 55208 bytes, RX: 25932 bytes


Salvator-X

SCIF3 and HSCIF3 are already enabled by r8a7795-salvator-x.dts in renesas-drivers. If you use a different tree, you have to make sure the right overlays have been loaded:

overlay add r8a7795-salvator-x-exio-d-scif3.dtbo \
            r8a7795-salvator-x-exio-d-hscif3.dtbo

Set up a few convenience macros:

scif3=/dev/ttySC2
hscif3=/dev/ttySC3

Test transfers from SCIF3 to HSCIF3:

fifotest $scif3 $hscif3 -s 1000000 -n 100

Test transfers from HSCIF3 to SCIF3:

fifotest $hscif3 $scif3 -s 1000000 -n 100

Expected output for all two tests above (after ca. 12 seconds):

MSG: 100, TX: 55208 bytes, RX: 25932 bytes


References

Linux Kernel Source Tree

Note: The DT overlays are not included in above source trees, so you have to merge the 'renesas-overlays' branch yourself to test on Koelsch. Please see R-Car/DT-Overlays for more information about using DT overlays.

Hence for now I'm providing the following two branches, containing all prerequisites:

  • fifotest-fail (shows failures)
  • fifotest-ok (fixed)


Test Software


Samtec QTE Breakout Adapters


Udev rules

If you want to refer to serial ports by their hardware name (e.g. "/dev/scifa5"), you can use the following udev rules:

  • "/etc/udev/rules.d/99-scif.rules" on Koelsch:
ENV{DEVNAME}=="/dev/ttySC0", SYMLINK+="scif0"
ENV{DEVNAME}=="/dev/ttySC1", SYMLINK+="scif1"
ENV{DEVNAME}=="/dev/ttySC2", SYMLINK+="scif2"
ENV{DEVNAME}=="/dev/ttySC3", SYMLINK+="scif3"
ENV{DEVNAME}=="/dev/ttySC4", SYMLINK+="scif4"
ENV{DEVNAME}=="/dev/ttySC5", SYMLINK+="scif5"

ENV{DEVNAME}=="/dev/ttySC6", SYMLINK+="scifa0"
ENV{DEVNAME}=="/dev/ttySC7", SYMLINK+="scifa1"
ENV{DEVNAME}=="/dev/ttySC8", SYMLINK+="scifa2"
ENV{DEVNAME}=="/dev/ttySC9", SYMLINK+="scifa3"
ENV{DEVNAME}=="/dev/ttySC10", SYMLINK+="scifa4"
ENV{DEVNAME}=="/dev/ttySC11", SYMLINK+="scifa5"

ENV{DEVNAME}=="/dev/ttySC12", SYMLINK+="scifb0"
ENV{DEVNAME}=="/dev/ttySC13", SYMLINK+="scifb1"
ENV{DEVNAME}=="/dev/ttySC14", SYMLINK+="scifb2"

ENV{DEVNAME}=="/dev/ttySC15", SYMLINK+="hscif0"
ENV{DEVNAME}=="/dev/ttySC16", SYMLINK+="hscif1"
ENV{DEVNAME}=="/dev/ttySC17", SYMLINK+="hscif2"
  • "/etc/udev/rules.d/99-scif.rules" on Salvator-X:
ENV{DEVNAME}=="/dev/ttySC0", SYMLINK+="scif2"
ENV{DEVNAME}=="/dev/ttySC1", SYMLINK+="scif1"
ENV{DEVNAME}=="/dev/ttySC2", SYMLINK+="scif3"
ENV{DEVNAME}=="/dev/ttySC3", SYMLINK+="hscif3"
ENV{DEVNAME}=="/dev/ttySC4", SYMLINK+="hscif4"