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.
The following steps can be taken to verify that a pin control driver's bias setting code works as expected.
- 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.)
- Check the DTS file of the board to find out which controller is handling this pin. (For GP6_21, that is gpio6 at 0xe6055400.)
- Go to the /sys/class/gpio directory and check which link points to this GPIO controller (gpio@e6055400 points to gpiochip361.)
- Calculate GPIO subsystem pin number by adding the base (361) to the pin number (21) and write that number to /sys/class/gpio/export.
- Go to the newly created GPIO pin directory (/sys/class/gpio/gpio382).
- Make sure the "direction" property of the pin is set to "in".
- 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.)
- Ensure that debugfs is mounted at /sys/kernel/debug.
- Tell the pin control driver to to enable pull-down:
echo "213 3" >/sys/kernel/debug/pinctrl/e6060000.pfc/bias
- Check the "value" property, it should be "0".
- Enable pull-up instead:
echo "213 5" >/sys/kernel/debug/pinctrl/e6060000.pfc/bias
- Check the "value" property, it should be "1".