+#if defined(CONFIG_DM_I2C) && !defined(CONFIG_DM_I2C_COMPAT)
+ struct udevice *dev;
+ struct udevice *bus;
+
+ rc = uclass_get_device_by_seq(UCLASS_I2C, bus_addr, &bus);
+ if (rc)
+ return rc;
+ rc = i2c_get_chip(bus, dev_addr, 1, &dev);
+ if (rc)
+ return rc;
+
+ /*
+ * Read the header first then only read the other contents.
+ */
+ rc = i2c_set_chip_offset_len(dev, 2);
+ if (rc)
+ return rc;
+
+ rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4);
+ if (rc)
+ return rc;
+
+ /* Corrupted data??? */
+ if (hdr_read != header) {
+ rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4);
+ /*
+ * read the eeprom header using i2c again, but use only a
+ * 1 byte address (some legacy boards need this..)
+ */
+ if (rc) {
+ rc = i2c_set_chip_offset_len(dev, 1);
+ if (rc)
+ return rc;
+
+ rc = dm_i2c_read(dev, 0, (uint8_t *)&hdr_read, 4);
+ }
+ if (rc)
+ return rc;
+ }
+ if (hdr_read != header)
+ return -1;
+
+ rc = dm_i2c_read(dev, 0, ep, size);
+ if (rc)
+ return rc;
+#else
+ u32 byte;
+