aboutsummaryrefslogtreecommitdiff
path: root/hdata/i2c.c
diff options
context:
space:
mode:
authorOliver O'Halloran <oohall@gmail.com>2017-08-02 22:58:46 +1000
committerStewart Smith <stewart@linux.vnet.ibm.com>2017-08-11 16:37:30 +1000
commit0818df625e3539a6aaad025ee6f1d1a441dee4a5 (patch)
treeffb69adb4b544a13fd8b8797192140a2b594d9ea /hdata/i2c.c
parenta298f3767469f28a0f005d8717cb866a50110bac (diff)
downloadskiboot-0818df625e3539a6aaad025ee6f1d1a441dee4a5.zip
skiboot-0818df625e3539a6aaad025ee6f1d1a441dee4a5.tar.gz
skiboot-0818df625e3539a6aaad025ee6f1d1a441dee4a5.tar.bz2
hdata/i2c: Work around broken I2C array version
Work around a bug in the I2C devices array that shows the array version as being v2 when only the v1 data is populated. Signed-off-by: Oliver O'Halloran <oohall@gmail.com> [stewart@linux.vnet.ibm.com: only parse V2 as V1, still pass on >v2] Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
Diffstat (limited to 'hdata/i2c.c')
-rw-r--r--hdata/i2c.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/hdata/i2c.c b/hdata/i2c.c
index 1c26e2e..9de6aa4 100644
--- a/hdata/i2c.c
+++ b/hdata/i2c.c
@@ -193,8 +193,11 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
version = be32_to_cpu(ahdr->version);
}
- if (version != 1) {
- prerror("I2C: HDAT version %d not supported! THIS IS A BUG\n",
+ 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",
version);
return -1;
}
@@ -237,6 +240,9 @@ int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
}
node = dt_new_addr(bus, name, i2c_addr);
+ if (!node)
+ continue;
+
dt_add_property_cells(node, "reg", i2c_addr);
dt_add_property_cells(node, "link-id",
be32_to_cpu(dev->i2c_link));