]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
test: dm: update test for pins configuration in pinctrl node
authorPatrick Delaunay <patrick.delaunay@st.com>
Mon, 13 Jan 2020 10:35:12 +0000 (11:35 +0100)
committerTom Rini <trini@konsulko.com>
Fri, 17 Apr 2020 03:06:54 +0000 (23:06 -0400)
Add test for "pins" configuration in gpio uclass with set_state() ops
and test for generic parsing of pinconf_param array).

set_state() is called by:
- pinctrl_generic_set_state
 |- pinctrl_generic_set_state_subnode

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
arch/sandbox/dts/test.dts
drivers/pinctrl/pinctrl-sandbox.c
test/py/tests/test_pinmux.py

index 6803c00f90ac155531f2f5bc7d9f2572fb99ef78..02e37abcc258ea4bf99a4053e5c4ba1675edfa21 100644 (file)
 
        pinctrl {
                compatible = "sandbox,pinctrl";
+
+               pinctrl-names = "default";
+               pinctrl-0 = <&gpios>;
+
+               gpios: gpios {
+                       gpio0 {
+                               pins = "GPIO0";
+                               bias-pull-up;
+                               input-disable;
+                       };
+                       gpio1 {
+                               pins = "GPIO1";
+                               output-high;
+                               drive-open-drain;
+                       };
+                       gpio2 {
+                               pins = "GPIO2";
+                               bias-pull-down;
+                               input-enable;
+                       };
+                       gpio3 {
+                               pins = "GPIO3";
+                               bias-disable;
+                       };
+               };
        };
 
        hwspinlock@0 {
index d1a21f0f197891954900147d8c226fc170a945a1..3ee75fbbeea1740c8d02242f2a25fe58fee8eed4 100644 (file)
@@ -14,7 +14,11 @@ static const char * const sandbox_pins[] = {
        "SDA",
        "TX",
        "RX",
-       "W1"
+       "W1",
+       "GPIO0",
+       "GPIO1",
+       "GPIO2",
+       "GPIO3",
 };
 
 static const char * const sandbox_pins_muxing[] = {
@@ -23,6 +27,10 @@ static const char * const sandbox_pins_muxing[] = {
        "Uart TX",
        "Uart RX",
        "1-wire gpio",
+       "gpio",
+       "gpio",
+       "gpio",
+       "gpio",
 };
 
 static const char * const sandbox_groups[] = {
@@ -38,6 +46,10 @@ static const char * const sandbox_functions[] = {
        "serial",
        "spi",
        "w1",
+       "gpio",
+       "gpio",
+       "gpio",
+       "gpio",
 };
 
 static const struct pinconf_param sandbox_conf_params[] = {
index 25394f1fafa58debcedf9859bee9aaac4841cd00..5ca0b4b6307c84e3a5592696570a6b1f0af66c29 100644 (file)
@@ -22,11 +22,15 @@ def test_pinmux_usage_2(u_boot_console):
 def test_pinmux_status_all(u_boot_console):
     """Test that 'pinmux status -a' displays pin's muxing."""
     output = u_boot_console.run_command('pinmux status -a')
-    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 ('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)
 
 @pytest.mark.buildconfigspec('cmd_pinmux')
 @pytest.mark.boardspec('sandbox')
@@ -59,8 +63,12 @@ def test_pinmux_status(u_boot_console):
     """Test that 'pinmux status' displays selected pincontroller's pin
     muxing descriptions."""
     output = u_boot_console.run_command('pinmux status')
-    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 ('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)