[Skiboot] [PATCH 4/4] hdata/i2c: add support to the i2c array version 2

Claudio Carvalho cclaudio at linux.vnet.ibm.com
Thu Aug 31 16:20:52 AEST 2017


This adds the description field to the i2c array, as specified in the i2c
array version 2.

When the description field is populated, we should be able to get the
description (name, compat and label) of new i2c devices from it, instead
of having to input these information manually in the list of known i2c
devices.

Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
---
 hdata/i2c.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/hdata/i2c.c b/hdata/i2c.c
index 8a2e392..c365a92 100644
--- a/hdata/i2c.c
+++ b/hdata/i2c.c
@@ -22,6 +22,7 @@ struct i2c_dev {
 	__be32 purpose;
 	__be32 i2c_link;
 	__be16 slca_index;
+	char desc[64];
 };
 
 #define P9_I2CM_XSCOM_SIZE 0x1000
@@ -202,11 +203,8 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
 		version = be32_to_cpu(ahdr->version);
 	}
 
-	if (version == 2) {
-		prerror("I2C: v%d found, but not supported. Parsing as v1\n",
-			version);
-	} else if (version > 2) {
-		prerror("I2C: v%d found, but not supported! THIS IS A BUG\n",
+	if (version != 1 && version != 2) {
+		prerror("I2C: HDAT version %d not supported! THIS IS A BUG\n",
 			version);
 		return -1;
 	}
-- 
2.7.4



More information about the Skiboot mailing list