[PATCH v3 3/3] pinctrl: single: Add tests for request API

Roman Bacik roman.bacik at broadcom.com
Tue Oct 5 18:49:56 CEST 2021


Add request tests to dm_test_pinctrl_single with corresponding node in
test.dts

Signed-off-by: Roman Bacik <roman.bacik at broadcom.com>

---

Changes in v3:
- Add request API test to dm_test_pinctrl_single

 arch/sandbox/dts/test.dts | 17 +++++++++++++++++
 test/dm/pinmux.c          | 13 +++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index e27d106466b4..0a9f24092eb6 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -1517,6 +1517,23 @@
 		};
 	};
 
+	pinctrl-single-gpio-range {
+		compatible = "pinctrl-single";
+		reg = <0x0000 0x238>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges;
+
+		pinctrl-single,register-width = <32>;
+		pinctrl-single,function-mask = <7>;
+
+		pinctrl-single,gpio-range = <&range 0 2 1 &range 2 3 0>;
+
+		range: gpio-range {
+			#pinctrl-single,gpio-range-cells = <3>;
+		};
+	};
+
 	hwspinlock at 0 {
 		compatible = "sandbox,hwspinlock";
 	};
diff --git a/test/dm/pinmux.c b/test/dm/pinmux.c
index 265df4ccb979..d4a8a7907006 100644
--- a/test/dm/pinmux.c
+++ b/test/dm/pinmux.c
@@ -132,6 +132,19 @@ static int dm_test_pinctrl_single(struct unit_test_state *uts)
 	test_muxing(159, "0x0000004c 0x00000000 UNCLAIMED");
 	ret = pinctrl_get_pin_muxing(dev, 160, buf, sizeof(buf));
 	ut_asserteq(-EINVAL, ret);
+	ut_assertok(uclass_get_device_by_name(UCLASS_PINCTRL,
+					      "pinctrl-single-gpio-range", &dev));
+	ut_asserteq(142, pinctrl_get_pins_count(dev));
+	ut_assertok(pinctrl_request(dev, 0, 0));
+	test_muxing(0, "0x00000000 0x00000001 UNCLAIMED");
+	ut_assertok(pinctrl_request(dev, 1, 0));
+	test_muxing(1, "0x00000004 0x00000001 UNCLAIMED");
+	ut_assertok(pinctrl_request(dev, 2, 0));
+	test_muxing(2, "0x00000008 0x00000000 UNCLAIMED");
+	ut_assertok(pinctrl_request(dev, 3, 0));
+	test_muxing(3, "0x0000000c 0x00000000 UNCLAIMED");
+	ut_assertok(pinctrl_request(dev, 4, 0));
+	test_muxing(4, "0x00000010 0x00000000 UNCLAIMED");
 	return 0;
 }
 
-- 
2.17.1


-- 
This electronic communication and the information and any files transmitted 
with it, or attached to it, are confidential and are intended solely for 
the use of the individual or entity to whom it is addressed and may contain 
information that is confidential, legally privileged, protected by privacy 
laws, or otherwise restricted from disclosure to anyone else. If you are 
not the intended recipient or the person responsible for delivering the 
e-mail to the intended recipient, you are hereby notified that any use, 
copying, distributing, dissemination, forwarding, printing, or copying of 
this e-mail is strictly prohibited. If you received this e-mail in error, 
please return the e-mail to the sender, delete it from your computer, and 
destroy any printed copy of it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4206 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20211005/dadc2699/attachment-0001.bin>


More information about the U-Boot mailing list