hdat/i2c: Fix SPD EEPROM compatible string

Message ID 20180112042138.30744-1-oohall@gmail.com
State Accepted
Headers show
Series
  • hdat/i2c: Fix SPD EEPROM compatible string
Related show

Commit Message

Oliver O'Halloran Jan. 12, 2018, 4:21 a.m.
Hostboot doesn't give us accurate information about the DIMM SPD
devices. Hack around by assuming any EEPROM we find on the SPD I2C
master is an SPD eeprom.

Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
---
 hdata/i2c.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

Comments

Stewart Smith Jan. 15, 2018, 6:38 a.m. | #1
Oliver O'Halloran <oohall@gmail.com> writes:
> Hostboot doesn't give us accurate information about the DIMM SPD
> devices. Hack around by assuming any EEPROM we find on the SPD I2C
> master is an SPD eeprom.
>
> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>

Well, this all looks like fun....

Merged to master as of 5e66cc3a347d706eb4bce6a460b44271132e6399

Patch

diff --git a/hdata/i2c.c b/hdata/i2c.c
index 76b7e3900c0a..108584de9a36 100644
--- a/hdata/i2c.c
+++ b/hdata/i2c.c
@@ -259,7 +259,22 @@  int parse_i2c_devs(const struct HDIF_common_hdr *hdr, int idata_index,
 		purpose = be32_to_cpu(dev->purpose);
 		type = map_type(dev->type);
 		label = map_label(purpose);
-		if (type) {
+
+		/* HACK: Hostboot doesn't export the correct type information
+		 * for the DIMM SPD EEPROMs. This is a problem because SPD
+		 * EEPROMs have a different wire protocol to the atmel,24XXXX
+		 * series. The main difference being that SPD EEPROMs have an
+		 * 8bit offset rather than a 16bit offset. This means that the
+		 * driver will send 2 bytes when doing a random read,
+		 * potentially overwriting part of the SPD information.
+		 *
+		 * To work around this we force the compat string to "spd"
+		 */
+		if (proc_gen == proc_gen_p9 && dev->type == 0x2 &&
+		    dev->i2cm_engine == 3) {
+			compat = "spd";
+			name = "eeprom";
+		} else if (type) {
 			compat = type->compat;
 			name = type->name;
 		} else {