User:Uli/Tests:PFC-bias

From eLinux.org
Jump to: navigation, search

This describes a method for testing pin control driver bias setting functionality. It uses the R-Car H3 SoC and Salvator-X board as an example.

PFC bias debug interface

The pin control framework does not provide a user space interface for controlling pin bias. This patch adds a simple interface to debugfs, the use of which is described below.

Test procedure

The following steps can be taken to verify that a pin control driver's bias setting code works as expected.

  1. Find an GPIO pin on the SoC and board that is not connected to anything. (Example: pin GP6_21 is not used on the Salvator-X board; all further examples also refer that board.)
  2. Check the DTS file of the board to find out which controller is handling this pin. (For GP6_21, that is gpio6 at 0xe6055400.)
  3. Go to the /sys/class/gpio directory and check which link points to this GPIO controller (gpio@e6055400 points to gpiochip361.)
  4. Calculate GPIO subsystem pin number by adding the base (361) to the pin number (21) and write that number to /sys/class/gpio/export.
  5. Go to the newly created GPIO pin directory (/sys/class/gpio/gpio382).
  6. Make sure the "direction" property of the pin is set to "in".
  7. Look at the pin control driver code and find out how it calculates the pin index. (For the sh-pfc driver, the formula is "bank * 32 + pin", resulting in 213 for GP6_21.)
  8. Ensure that debugfs is mounted at /sys/kernel/debug.
  9. Tell the pin control driver to to enable pull-down:
    echo "213 3" >/sys/kernel/debug/pinctrl/e6060000.pfc/bias
  10. Check the "value" property, it should be "0".
  11. Enable pull-up instead:
    echo "213 5" >/sys/kernel/debug/pinctrl/e6060000.pfc/bias
  12. Check the "value" property, it should be "1".