Skip to contentSkip to conversation

sysinfo: Add gpio sysinfo driver

PATCH New Sean Anderson 2 participants 11 messages Apr 20, 2021 – May 6, 2021 GPIO

lore
Share & tools
lore
#0 lore raw

v4 cover sysinfo: Add gpio sysinfo driver

This series adds a GPIO sysinfo driver using the dm_gpio_get_values_as_int_base3 function. The board revision is mapped based in devicetree properties. This series is based on Simon's GPIO series [1].

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=228126

Changes in v4:
- Enable sysinfo_gpio test for sandbox
- Fix test failure caused by uninitialized variable
- Rebase onto u-boot/master

Changes in v3:
- Fix assuming any nonzero return of dev_count_phandle_with_args was an error.
- Fix assuming nonzero return from dm_gpio_get_values_as_int_base3 is an error.
- Move detected bool into sysinfo_priv struct
- Rebase onto u-boot/next
- Use SYSINFO_ID_BOARD_MODEL instead of SYSINFO_ID_REVISION

Changes in v2:
- Document sysinfo_gpio_priv
- Enforce sysinfo detect ordering in uclass. Users must still call sysinfo_detect beforehand.
- Fix unbalanced brace in sysinfo_gpio_get_int
- Modify sysinfo test to check for detect() ordering.
- Refactor driver to take advantage of the uclass detect ordering guarantee.
- Reorder includes
- Set BOARD_HWVERSION to SYSINFO_ID_REVISION, as they represent the same content.
- Use enums instead of defines for sysinfo ids

Sean Anderson (5):
dm: gpio: Fix gpio_get_list_count failing with livetree
sysinfo: Use global sysinfo IDs for existing sysinfo drivers
sysinfo: Require that sysinfo_detect be called before other methods
sysinfo: Add gpio-sysinfo driver
test: Add gpio-sysinfo test

 arch/sandbox/dts/test.dts                     |   7 +
 common/spl/spl_fit.c                          |   4 +
 configs/sandbox64_defconfig                   |   1 +
 configs/sandbox_defconfig                     |   1 +
 configs/sandbox_flattree_defconfig            |   1 +
 configs/sandbox_noinst_defconfig              |   1 +
 configs/sandbox_spl_defconfig                 |   1 +
 .../sysinfo/gpio-sysinfo.txt                  |  37 +++++
 drivers/gpio/gpio-uclass.c                    |   6 +-
 drivers/sysinfo/Kconfig                       |   8 +
 drivers/sysinfo/Makefile                      |   1 +
 drivers/sysinfo/gazerbeam.h                   |   8 +-
 drivers/sysinfo/gpio.c                        | 141 ++++++++++++++++++
 drivers/sysinfo/sandbox.h                     |   2 +-
 drivers/sysinfo/sysinfo-uclass.c              |  29 +++-
 include/sysinfo.h                             |  26 ++--
 test/dm/Makefile                              |   1 +
 test/dm/sysinfo-gpio.c                        |  69 +++++++++
 test/dm/sysinfo.c                             |  25 ++--
 19 files changed, 342 insertions(+), 27 deletions(-)
 create mode 100644 doc/device-tree-bindings/sysinfo/gpio-sysinfo.txt
 create mode 100644 drivers/sysinfo/gpio.c
 create mode 100644 test/dm/sysinfo-gpio.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH v4 1/5 dm: gpio: Fix gpio_get_list_count failing with livetree

of_parse_phandle_with_args (called by dev_read_phandle_with_args) does not support getting the length of a phandle list by using the index -1. Instead, use dev_count_phandle_with_args which supports exactly this use-case.

Fixes 8558217153 ("gpio: Convert to use APIs which support live DT")

---

(no changes since v3)

Changes in v3:
- Fix assuming any nonzero return of dev_count_phandle_with_args was an error.

Changes in v2:
- Change Fixes tag to the most recent commit touching these lines

 drivers/gpio/gpio-uclass.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpio/gpio-uclass.c +3 -3
index e4e7f58c39..131099cc17 100644
@@ -1215,9 +1215,9 @@ int gpio_get_list_count(struct udevice *dev, const char *list_name)
 {
 	int ret;
 
-	ret = dev_read_phandle_with_args(dev, list_name, "#gpio-cells", 0, -1,
-					 NULL);
-	if (ret) {
+	ret = dev_count_phandle_with_args(dev, list_name, "#gpio-cells",
+					  -ENOENT);
+	if (ret < 0) {
 		debug("%s: Node '%s', property '%s', GPIO count failed: %d\n",
 		      __func__, dev->name, list_name, ret);
 	}
Signature · 1 line
2.25.1
#2 lore raw

PATCH v4 1/5 dm: gpio: Fix gpio_get_list_count failing with livetree

Quoted 9 lines · Sean Anderson

of_parse_phandle_with_args (called by dev_read_phandle_with_args) does not support getting the length of a phandle list by using the index -1. Instead, use dev_count_phandle_with_args which supports exactly this use-case.

Fixes 8558217153 ("gpio: Convert to use APIs which support live DT")

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210506/d53f7a97/attachment.sig>
#3 lore raw

PATCH v4 2/5 sysinfo: Use global sysinfo IDs for existing sysinfo drivers

In reply to Sean Anderson

Since 07c9e683a4 ("smbios: Allow a few values to come from sysinfo") there are common global sysinfo IDs. This patch moved existing IDs above SYSINFO_ID_USER.

---

(no changes since v3)

Changes in v3:
- Rework patch to use sjg's sysinfo IDs

Changes in v2:
- Set BOARD_HWVERSION to SYSINFO_ID_REVISION, as they represent the same content.
- Use enums instead of defines for sysinfo ids

 drivers/sysinfo/gazerbeam.h | 8 +++++---
 drivers/sysinfo/sandbox.h   | 2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/sysinfo/gazerbeam.h +5 -3
index 171729d203..6bf3c0098d 100644
@@ -5,10 +5,12 @@
  *
  */
 
+#include <sysinfo.h>
+
 enum {
-	BOARD_MULTICHANNEL,
-	BOARD_VARIANT,
-	BOARD_HWVERSION,
+	BOARD_HWVERSION = SYSINFO_ID_BOARD_MODEL,
+	BOARD_MULTICHANNEL = SYSINFO_ID_USER,
+	BOARD_VARIANT
 };
 
 enum {
drivers/sysinfo/sandbox.h +1 -1
index 2cff494f56..d9c5804c26 100644
@@ -5,7 +5,7 @@
  */
 
 enum {
-	BOOL_CALLED_DETECT,
+	BOOL_CALLED_DETECT = SYSINFO_ID_USER,
 	INT_TEST1,
 	INT_TEST2,
 	STR_VACATIONSPOT,
Signature · 1 line
2.25.1
#4 lore raw

PATCH v4 2/5 sysinfo: Use global sysinfo IDs for existing sysinfo drivers

Quoted 6 lines · Sean Anderson

Since 07c9e683a4 ("smbios: Allow a few values to come from sysinfo") there are common global sysinfo IDs. This patch moved existing IDs above SYSINFO_ID_USER.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210506/ab743744/attachment.sig>
#5 lore raw

PATCH v4 3/5 sysinfo: Require that sysinfo_detect be called before other methods

In reply to Sean Anderson

This has the uclass enforce calling detect() before other methods. This allows drivers to cache information in detect() and perform (cheaper) retrieval in the other accessors. This also modifies the only instance where this sequencing was not followed.

---

Changes in v4:
- Fix test failure caused by uninitialized variable

Changes in v3:
- Move detected bool into sysinfo_priv struct

Changes in v2:
- Enforce sysinfo detect ordering in uclass. Users must still call sysinfo_detect beforehand.
- Modify sysinfo test to check for detect() ordering.

 common/spl/spl_fit.c             |  4 ++++
 drivers/sysinfo/sysinfo-uclass.c | 29 ++++++++++++++++++++++++++++-
 include/sysinfo.h                | 26 +++++++++++++++++---------
 test/dm/sysinfo.c                | 25 +++++++++++++++----------
 4 files changed, 64 insertions(+), 20 deletions(-)
common/spl/spl_fit.c +4 -0
index 4288f571fc..caddf51196 100644
@@ -110,6 +110,10 @@ static int spl_fit_get_image_name(const struct spl_fit_info *ctx,
 		 * no string in the property for this index. Check if the
 		 * sysinfo-level code can supply one.
 		 */
+		rc = sysinfo_detect(sysinfo);
+		if (rc)
+			return rc;
+
 		rc = sysinfo_get_fit_loadable(sysinfo, index - i - 1, type,
 					      &str);
 		if (rc && rc != -ENOENT)
drivers/sysinfo/sysinfo-uclass.c +28 -1
index 6df58fe160..4a660dfd15 100644
@@ -8,6 +8,10 @@
 #include <dm.h>
 #include <sysinfo.h>
 
+struct sysinfo_priv {
+	bool detected;
+};
+
 int sysinfo_get(struct udevice **devp)
 {
 	return uclass_first_device_err(UCLASS_SYSINFO, devp);
@@ -15,19 +19,29 @@ int sysinfo_get(struct udevice **devp)
 
 int sysinfo_detect(struct udevice *dev)
 {
+	int ret;
+	struct sysinfo_priv *priv = dev_get_uclass_priv(dev);
 	struct sysinfo_ops *ops = sysinfo_get_ops(dev);
 
 	if (!ops->detect)
 		return -ENOSYS;
 
-	return ops->detect(dev);
+	ret = ops->detect(dev);
+	if (!ret)
+		priv->detected = true;
+
+	return ret;
 }
 
 int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type,
 			     const char **strp)
 {
+	struct sysinfo_priv *priv = dev_get_uclass_priv(dev);
 	struct sysinfo_ops *ops = sysinfo_get_ops(dev);
 
+	if (!priv->detected)
+		return -EPERM;
+
 	if (!ops->get_fit_loadable)
 		return -ENOSYS;
 
@@ -36,8 +50,12 @@ int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type,
 
 int sysinfo_get_bool(struct udevice *dev, int id, bool *val)
 {
+	struct sysinfo_priv *priv = dev_get_uclass_priv(dev);
 	struct sysinfo_ops *ops = sysinfo_get_ops(dev);
 
+	if (!priv->detected)
+		return -EPERM;
+
 	if (!ops->get_bool)
 		return -ENOSYS;
 
@@ -46,8 +64,12 @@ int sysinfo_get_bool(struct udevice *dev, int id, bool *val)
 
 int sysinfo_get_int(struct udevice *dev, int id, int *val)
 {
+	struct sysinfo_priv *priv = dev_get_uclass_priv(dev);
 	struct sysinfo_ops *ops = sysinfo_get_ops(dev);
 
+	if (!priv->detected)
+		return -EPERM;
+
 	if (!ops->get_int)
 		return -ENOSYS;
 
@@ -56,8 +78,12 @@ int sysinfo_get_int(struct udevice *dev, int id, int *val)
 
 int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val)
 {
+	struct sysinfo_priv *priv = dev_get_uclass_priv(dev);
 	struct sysinfo_ops *ops = sysinfo_get_ops(dev);
 
+	if (!priv->detected)
+		return -EPERM;
+
 	if (!ops->get_str)
 		return -ENOSYS;
 
@@ -68,4 +94,5 @@ UCLASS_DRIVER(sysinfo) = {
 	.id		= UCLASS_SYSINFO,
 	.name		= "sysinfo",
 	.post_bind	= dm_scan_fdt_dev,
+	.per_device_auto	= sizeof(bool),
 };
include/sysinfo.h +17 -9
index 8054d4d4a1..b140d742e9 100644
@@ -60,7 +60,8 @@ struct sysinfo_ops {
 	 * This operation might take a long time (e.g. read from EEPROM,
 	 * check the presence of a device on a bus etc.), hence this is not
 	 * done in the probe() method, but later during operation in this
-	 * dedicated method.
+	 * dedicated method. This method will be called before any other
+	 * methods.
 	 *
 	 * Return: 0 if OK, -ve on error.
 	 */
@@ -104,7 +105,7 @@ struct sysinfo_ops {
 	 * get_fit_loadable - Get the name of an image to load from FIT
 	 * This function can be used to provide the image names based on runtime
 	 * detection. A classic use-case would when DTBOs are used to describe
-	 * additionnal daughter cards.
+	 * additional daughter cards.
 	 *
 	 * @dev:	The sysinfo instance to gather the data.
 	 * @index:	Index of the image. Starts at 0 and gets incremented
@@ -127,6 +128,9 @@ struct sysinfo_ops {
  *
  * @dev:	The device containing the information
  *
+ * This function must be called before any other accessor function for this
+ * device.
+ *
  * Return: 0 if OK, -ve on error.
  */
 int sysinfo_detect(struct udevice *dev);
@@ -138,7 +142,8 @@ int sysinfo_detect(struct udevice *dev);
  * @id:		A unique identifier for the bool value to be read.
  * @val:	Pointer to a buffer that receives the value read.
  *
- * Return: 0 if OK, -ve on error.
+ * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on
+ * error.
  */
 int sysinfo_get_bool(struct udevice *dev, int id, bool *val);
 
@@ -149,7 +154,8 @@ int sysinfo_get_bool(struct udevice *dev, int id, bool *val);
  * @id:		A unique identifier for the int value to be read.
  * @val:	Pointer to a buffer that receives the value read.
  *
- * Return: 0 if OK, -ve on error.
+ * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on
+ * error.
  */
 int sysinfo_get_int(struct udevice *dev, int id, int *val);
 
@@ -161,7 +167,8 @@ int sysinfo_get_int(struct udevice *dev, int id, int *val);
  * @size:	The size of the buffer to receive the string data.
  * @val:	Pointer to a buffer that receives the value read.
  *
- * Return: 0 if OK, -ve on error.
+ * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on
+ * error.
  */
 int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val);
 
@@ -173,7 +180,8 @@ int sysinfo_get_str(struct udevice *dev, int id, size_t size, char *val);
  * function that returns the unique device. This is especially useful for use
  * in sysinfo files.
  *
- * Return: 0 if OK, -ve on error.
+ * Return: 0 if OK, -EPERM if called before sysinfo_detect(), else -ve on
+ * error.
  */
 int sysinfo_get(struct udevice **devp);
 
@@ -181,7 +189,7 @@ int sysinfo_get(struct udevice **devp);
  * sysinfo_get_fit_loadable - Get the name of an image to load from FIT
  * This function can be used to provide the image names based on runtime
  * detection. A classic use-case would when DTBOs are used to describe
- * additionnal daughter cards.
+ * additional daughter cards.
  *
  * @dev:	The sysinfo instance to gather the data.
  * @index:	Index of the image. Starts at 0 and gets incremented
@@ -190,8 +198,8 @@ int sysinfo_get(struct udevice **devp);
  * @strp:	A pointer to string. Untouched if the function fails
  *
  *
- * Return: 0 if OK, -ENOENT if no loadable is available else -ve on
- * error.
+ * Return: 0 if OK, -EPERM if called before sysinfo_detect(), -ENOENT if no
+ * loadable is available else -ve on error.
  */
 int sysinfo_get_fit_loadable(struct udevice *dev, int index, const char *type,
 			     const char **strp);
test/dm/sysinfo.c +15 -10
index 4aaa9e85bc..96b3a8ebab 100644
@@ -17,40 +17,45 @@
 static int dm_test_sysinfo(struct unit_test_state *uts)
 {
 	struct udevice *sysinfo;
-	bool called_detect;
+	bool called_detect = false;
 	char str[64];
 	int i;
 
 	ut_assertok(sysinfo_get(&sysinfo));
 	ut_assert(sysinfo);
 
-	sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, &called_detect);
+	ut_asserteq(-EPERM, sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT,
+					     &called_detect));
 	ut_assert(!called_detect);
 
 	sysinfo_detect(sysinfo);
 
-	sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT, &called_detect);
+	ut_assertok(sysinfo_get_bool(sysinfo, BOOL_CALLED_DETECT,
+				     &called_detect));
 	ut_assert(called_detect);
 
-	sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str);
+	ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
+				    str));
 	ut_assertok(strcmp(str, "R'lyeh"));
 
-	sysinfo_get_int(sysinfo, INT_TEST1, &i);
+	ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i));
 	ut_asserteq(0, i);
 
-	sysinfo_get_int(sysinfo, INT_TEST2, &i);
+	ut_assertok(sysinfo_get_int(sysinfo, INT_TEST2, &i));
 	ut_asserteq(100, i);
 
-	sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str);
+	ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
+				    str));
 	ut_assertok(strcmp(str, "Carcosa"));
 
-	sysinfo_get_int(sysinfo, INT_TEST1, &i);
+	ut_assertok(sysinfo_get_int(sysinfo, INT_TEST1, &i));
 	ut_asserteq(1, i);
 
-	sysinfo_get_int(sysinfo, INT_TEST2, &i);
+	ut_assertok(sysinfo_get_int(sysinfo, INT_TEST2, &i));
 	ut_asserteq(99, i);
 
-	sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str), str);
+	ut_assertok(sysinfo_get_str(sysinfo, STR_VACATIONSPOT, sizeof(str),
+				    str));
 	ut_assertok(strcmp(str, "Yuggoth"));
 
 	return 0;
Signature · 1 line
2.25.1
#6 lore raw

PATCH v4 3/5 sysinfo: Require that sysinfo_detect be called before other methods

Quoted 7 lines · Sean Anderson

This has the uclass enforce calling detect() before other methods. This allows drivers to cache information in detect() and perform (cheaper) retrieval in the other accessors. This also modifies the only instance where this sequencing was not followed.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210506/d3b436d4/attachment.sig>
#7 lore raw

PATCH v4 4/5 sysinfo: Add gpio-sysinfo driver

In reply to Sean Anderson

This uses the newly-added dm_gpio_get_values_as_int_base3 function to implement a sysinfo device. The revision map is stored in the device tree.

---

(no changes since v3)

Changes in v3:
- Fix assuming nonzero return from dm_gpio_get_values_as_int_base3 is an error.
- Use SYSINFO_ID_BOARD_MODEL instead of SYSINFO_ID_REVISION

Changes in v2:
- Document sysinfo_gpio_priv
- Fix unbalanced brace in sysinfo_gpio_get_int
- Refactor driver to take advantage of the uclass detect ordering guarantee.
- Reorder includes

 .../sysinfo/gpio-sysinfo.txt                  |  37 +++++
 drivers/sysinfo/Kconfig                       |   8 +
 drivers/sysinfo/Makefile                      |   1 +
 drivers/sysinfo/gpio.c                        | 141 ++++++++++++++++++
 4 files changed, 187 insertions(+)
 create mode 100644 doc/device-tree-bindings/sysinfo/gpio-sysinfo.txt
 create mode 100644 drivers/sysinfo/gpio.c
doc/device-tree-bindings/sysinfo/gpio-sysinfo.txt new file +37 -0
new file mode 100644
index 0000000000..b5739d94e9
@@ -0,0 +1,37 @@
+GPIO-based Sysinfo device
+
+This binding describes several GPIOs which specify a board revision. Each GPIO
+forms a digit in a ternary revision number. This revision is then mapped to a
+name using the revisions and names properties.
+
+Each GPIO may be floating, pulled-up, or pulled-down, mapping to digits 2, 1,
+and 0, respectively. The first GPIO forms the least-significant digit of the
+revision. For example, consider the property
+
+	gpios = <&gpio 0>, <&gpio 1>, <&gpio 2>;
+
+If GPIO 0 is pulled-up, GPIO 1 is pulled-down, and GPIO 2 is floating, then the
+revision would be
+
+	0t201 = 2*9 + 0*3 + 1*3 = 19
+
+If instead GPIO 0 is floating, GPIO 1 is pulled-up, and GPIO 2 is pulled-down,
+then the revision would be
+
+	0t012 = 0*9 + 1*3 + 2*1 = 5
+
+Required properties:
+- compatible: should be "gpio-sysinfo".
+- gpios: should be a list of gpios forming the revision number,
+  least-significant-digit first
+- revisions: a list of known revisions; any revisions not present will have the
+  name "unknown"
+- names: the name of each revision in revisions
+
+Example:
+sysinfo {
+	compatible = "gpio-sysinfo";
+	gpios = <&gpio_a 15>, <&gpio_a 16>, <&gpio_a 17>;
+	revisions = <19>, <5>;
+	names = "rev_a", "foo";
+};
drivers/sysinfo/Kconfig +8 -0
index 85c1e81e41..381dcd8844 100644
@@ -30,4 +30,12 @@ config SYSINFO_SMBIOS
 	  one which provides a way to specify this SMBIOS information in the
 	  devicetree, without needing any board-specific functionality.
 
+config SYSINFO_GPIO
+	bool "Enable gpio sysinfo driver"
+	help
+	  Support querying gpios to determine board revision. This uses gpios to
+	  form a ternary number (when they are pulled-up, -down, or floating).
+	  This ternary number is then mapped to a board revision name using
+	  device tree properties.
+
 endif
drivers/sysinfo/Makefile +1 -0
index 6d04fcba1d..d9f708b7ea 100644
@@ -4,5 +4,6 @@
 # Mario Six,  Guntermann & Drunck GmbH, mario.six at gdsys.cc
 obj-y += sysinfo-uclass.o
 obj-$(CONFIG_SYSINFO_GAZERBEAM) += gazerbeam.o
+obj-$(CONFIG_SYSINFO_GPIO) += gpio.o
 obj-$(CONFIG_SYSINFO_SANDBOX) += sandbox.o
 obj-$(CONFIG_SYSINFO_SMBIOS) += smbios.o
drivers/sysinfo/gpio.c new file +141 -0

141 lines not on this page · raw message

Signature · 1 line
2.25.1
#8 lore raw

PATCH v4 4/5 sysinfo: Add gpio-sysinfo driver

Quoted 5 lines · Sean Anderson

This uses the newly-added dm_gpio_get_values_as_int_base3 function to implement a sysinfo device. The revision map is stored in the device tree.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210506/bdd9b56d/attachment.sig>
#9 lore raw

PATCH v4 5/5 test: Add gpio-sysinfo test

In reply to Sean Anderson

This adds a test for the gpio-sysinfo driver.

---

Changes in v4:
- Enable sysinfo_gpio test for sandbox

Changes in v3:
- Use SYSINFO_ID_BOARD_MODEL instead of SYSINFO_ID_REVISION

Changes in v2:
- Reorder includes

 arch/sandbox/dts/test.dts          |  7 +++
 configs/sandbox64_defconfig        |  1 +
 configs/sandbox_defconfig          |  1 +
 configs/sandbox_flattree_defconfig |  1 +
 configs/sandbox_noinst_defconfig   |  1 +
 configs/sandbox_spl_defconfig      |  1 +
 test/dm/Makefile                   |  1 +
 test/dm/sysinfo-gpio.c             | 69 ++++++++++++++++++++++++++++++
 8 files changed, 82 insertions(+)
 create mode 100644 test/dm/sysinfo-gpio.c
arch/sandbox/dts/test.dts +7 -0
index 48240aa26f..78a2fcbc56 100644
@@ -1526,6 +1526,13 @@
 		compatible = "sandbox,sysinfo-sandbox";
 	};
 
+	sysinfo-gpio {
+		compatible = "gpio-sysinfo";
+		gpios = <&gpio_a 15>, <&gpio_a 16>, <&gpio_a 17>;
+		revisions = <19>, <5>;
+		names = "rev_a", "foo";
+	};
+
 	some_regmapped-bus {
 		#address-cells = <0x1>;
 		#size-cells = <0x1>;
configs/sandbox64_defconfig +1 -0
index 8a7e519847..80c5be2067 100644
@@ -204,6 +204,7 @@ CONFIG_SPMI=y
 CONFIG_SPMI_SANDBOX=y
 CONFIG_SYSINFO=y
 CONFIG_SYSINFO_SANDBOX=y
+CONFIG_SYSINFO_GPIO=y
 CONFIG_SYSRESET=y
 CONFIG_TIMER=y
 CONFIG_TIMER_EARLY=y
configs/sandbox_defconfig +1 -0
index d3de9c3155..48dfd194e2 100644
@@ -247,6 +247,7 @@ CONFIG_SPMI=y
 CONFIG_SPMI_SANDBOX=y
 CONFIG_SYSINFO=y
 CONFIG_SYSINFO_SANDBOX=y
+CONFIG_SYSINFO_GPIO=y
 CONFIG_SYSRESET=y
 CONFIG_TIMER=y
 CONFIG_TIMER_EARLY=y
configs/sandbox_flattree_defconfig +1 -0
index 97ac46d21f..853c9440ea 100644
@@ -178,6 +178,7 @@ CONFIG_SPMI=y
 CONFIG_SPMI_SANDBOX=y
 CONFIG_SYSINFO=y
 CONFIG_SYSINFO_SANDBOX=y
+CONFIG_SYSINFO_GPIO=y
 CONFIG_SYSRESET=y
 CONFIG_TIMER=y
 CONFIG_TIMER_EARLY=y
configs/sandbox_noinst_defconfig +1 -0
index 01905900cb..e47e351e56 100644
@@ -198,6 +198,7 @@ CONFIG_SPMI=y
 CONFIG_SPMI_SANDBOX=y
 CONFIG_SYSINFO=y
 CONFIG_SYSINFO_SANDBOX=y
+CONFIG_SYSINFO_GPIO=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_TIMER=y
configs/sandbox_spl_defconfig +1 -0
index 0fac3adba7..d463ee421c 100644
@@ -200,6 +200,7 @@ CONFIG_SPMI=y
 CONFIG_SPMI_SANDBOX=y
 CONFIG_SYSINFO=y
 CONFIG_SYSINFO_SANDBOX=y
+CONFIG_SYSINFO_GPIO=y
 CONFIG_SYSRESET=y
 CONFIG_SPL_SYSRESET=y
 CONFIG_TIMER=y
test/dm/Makefile +1 -0
index 100e7701d2..33a6fa9620 100644
@@ -101,5 +101,6 @@ ifneq ($(CONFIG_EFI_PARTITION),)
 obj-$(CONFIG_FASTBOOT_FLASH_MMC) += fastboot.o
 endif
 obj-$(CONFIG_QFW) += qfw.o
+obj-$(CONFIG_SYSINFO_GPIO) += sysinfo-gpio.o
 endif
 endif # !SPL
test/dm/sysinfo-gpio.c new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.25.1
#10 lore raw

PATCH v4 5/5 test: Add gpio-sysinfo test

Quoted 4 lines · Sean Anderson

This adds a test for the gpio-sysinfo driver.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210506/b9691d61/attachment.sig>