All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Delaunay <patrick.delaunay@st.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 11/14] test: dm: update test for pins configuration in pinctrl node
Date: Tue, 26 Nov 2019 09:49:08 +0100	[thread overview]
Message-ID: <20191126084911.19761-12-patrick.delaunay@st.com> (raw)
In-Reply-To: <20191126084911.19761-1-patrick.delaunay@st.com>

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>
---

Changes in v2: None

 arch/sandbox/dts/test.dts         | 25 +++++++++++++++++++++++++
 drivers/pinctrl/pinctrl-sandbox.c | 14 +++++++++++++-
 test/py/tests/test_pinmux.py      | 28 ++++++++++++++++++----------
 3 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index fdb08f2111..b57f152fa3 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -851,6 +851,31 @@
 
 	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 at 0 {
diff --git a/drivers/pinctrl/pinctrl-sandbox.c b/drivers/pinctrl/pinctrl-sandbox.c
index d1a21f0f19..3ee75fbbee 100644
--- a/drivers/pinctrl/pinctrl-sandbox.c
+++ b/drivers/pinctrl/pinctrl-sandbox.c
@@ -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[] = {
diff --git a/test/py/tests/test_pinmux.py b/test/py/tests/test_pinmux.py
index 25394f1faf..5ca0b4b630 100644
--- a/test/py/tests/test_pinmux.py
+++ b/test/py/tests/test_pinmux.py
@@ -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)
-- 
2.17.1

  parent reply	other threads:[~2019-11-26  8:49 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  8:48 [U-Boot] [PATCH v2 00/14] dm: add support of new binding in gpio and pincontrol Patrick Delaunay
2019-11-26  8:48 ` [U-Boot] [PATCH v2 01/14] dm: pinctrl: convert pinctrl-single to livetree Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2019-11-26  8:48 ` [U-Boot] [PATCH v2 02/14] dm: core: add ofnode and dev function to iterate on node property Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2020-01-09  8:29     ` Patrick DELAUNAY
2019-11-26  8:49 ` [U-Boot] [PATCH v2 03/14] dm: pinctrl: migrate pinctrl-generic to livetree Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2019-11-26  8:49 ` [U-Boot] [PATCH v2 04/14] dt-bindings: gpio: document the new pull-up/pull-down flags Patrick Delaunay
2019-11-26  8:49 ` [U-Boot] [PATCH v2 05/14] gpio: remove GPIOD_REQUESTED Patrick Delaunay
2019-11-26  8:49 ` [U-Boot] [PATCH v2 06/14] gpio: remove the open_drain API and ops Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2019-11-26  8:49 ` [U-Boot] [PATCH v2 07/14] gpio: add gpio descriptor initialization helper Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2019-11-26  8:49 ` [U-Boot] [PATCH v2 08/14] gpio: add ops for configuration with dir flags Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2020-01-09 10:19     ` Patrick DELAUNAY
2019-11-26  8:49 ` [U-Boot] [PATCH v2 09/14] dt-bindings: gpio: alignment with kernel v5.3 Patrick Delaunay
2019-11-26  8:49 ` [U-Boot] [PATCH v2 10/14] pinctrl: sandbox: Add mux information in get_pin_muxing Patrick Delaunay
2019-11-26  8:49 ` Patrick Delaunay [this message]
2019-11-26  8:49 ` [U-Boot] [PATCH v2 12/14] gpio: sandbox: cleanup binding support Patrick Delaunay
2019-11-26  8:49 ` [U-Boot] [PATCH v2 13/14] test: dm: update test for pins configuration in gpio Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2019-11-26  8:49 ` [U-Boot] [PATCH v2 14/14] test: pinmux: add pincontrol-gpio for pin configuration Patrick Delaunay
2019-12-30  1:21   ` Simon Glass
2020-01-09 10:30     ` Patrick DELAUNAY
2020-01-10  9:39       ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191126084911.19761-12-patrick.delaunay@st.com \
    --to=patrick.delaunay@st.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.