uint chip;
u_char data[128];
u_char cksum;
- int j;
+ int j, ret;
+#ifdef CONFIG_DM_I2C
+ struct udevice *dev;
+#endif
static const char *decode_CAS_DDR2[] = {
" TBD", " 6", " 5", " 4", " 3", " 2", " TBD", " TBD"
*/
chip = simple_strtoul (argv[1], NULL, 16);
- if (i2c_read (chip, 0, 1, data, sizeof (data)) != 0) {
+#ifdef CONFIG_DM_I2C
+ ret = i2c_get_cur_bus_chip(chip, &dev);
+ if (!ret)
+ ret = dm_i2c_read(dev, 0, data, sizeof(data));
+#else
+ ret = i2c_read(chip, 0, 1, data, sizeof(data));
+#endif
+ if (ret) {
puts ("No SDRAM Serial Presence Detect found.\n");
return 1;
}