test: pinmux: Add test for pin muxing

This extends the pinctrl-sandbox driver to support pin muxing, and adds a
test for that behaviour. The test is done in C and not python (like the
existing tests for the pinctrl uclass) because it needs to call
pinctrl_select_state.  Another option could be to add a command that
invokes pinctrl_select_state and then test everything in
test/py/tests/test_pinmux.py.

The pinctrl-sandbox driver now mimics the way that many pinmux devices
work.  There are two groups of pins which are muxed together, as well as
four pins which are muxed individually. I have tried to test all normal
paths. However, very few error cases are explicitly checked for.

Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Sean Anderson
2020-09-14 11:01:57 -04:00
committed by Tom Rini
parent 5eee93e5b1
commit 7f0f1806e3
7 changed files with 274 additions and 73 deletions

View File

@@ -28,15 +28,15 @@ def test_pinmux_status_all(u_boot_console):
assert ('a6 : gpio output .' in output)
assert ('pinctrl:' in output)
assert ('SCL : I2C SCL.' in output)
assert ('SDA : I2C SDA.' in output)
assert ('TX : Uart TX.' in output)
assert ('RX : Uart RX.' in output)
assert ('W1 : 1-wire gpio.' in output)
assert ('GPIO0 : gpio bias-pull-up input-disable.' in output)
assert ('GPIO1 : gpio drive-open-drain.' in output)
assert ('GPIO2 : gpio bias-pull-down input-enable.' in output)
assert ('GPIO3 : gpio bias-disable.' in output)
assert ('P0 : UART TX.' in output)
assert ('P1 : UART RX.' in output)
assert ('P2 : I2S SCK.' in output)
assert ('P3 : I2S SD.' in output)
assert ('P4 : I2S WS.' in output)
assert ('P5 : GPIO0 bias-pull-up input-disable.' in output)
assert ('P6 : GPIO1 drive-open-drain.' in output)
assert ('P7 : GPIO2 bias-pull-down input-enable.' in output)
assert ('P8 : GPIO3 bias-disable.' in output)
@pytest.mark.buildconfigspec('cmd_pinmux')
@pytest.mark.boardspec('sandbox')
@@ -73,12 +73,12 @@ def test_pinmux_status(u_boot_console):
assert (not 'pinctrl-gpio:' in output)
assert (not 'pinctrl:' in output)
assert ('SCL : I2C SCL.' in output)
assert ('SDA : I2C SDA.' in output)
assert ('TX : Uart TX.' in output)
assert ('RX : Uart RX.' in output)
assert ('W1 : 1-wire gpio.' in output)
assert ('GPIO0 : gpio bias-pull-up input-disable.' in output)
assert ('GPIO1 : gpio drive-open-drain.' in output)
assert ('GPIO2 : gpio bias-pull-down input-enable.' in output)
assert ('GPIO3 : gpio bias-disable.' in output)
assert ('P0 : UART TX.' in output)
assert ('P1 : UART RX.' in output)
assert ('P2 : I2S SCK.' in output)
assert ('P3 : I2S SD.' in output)
assert ('P4 : I2S WS.' in output)
assert ('P5 : GPIO0 bias-pull-up input-disable.' in output)
assert ('P6 : GPIO1 drive-open-drain.' in output)
assert ('P7 : GPIO2 bias-pull-down input-enable.' in output)
assert ('P8 : GPIO3 bias-disable.' in output)