rockchip: rk3188: add boot_devices mapping to support 'same-as-spl'
[oweals/u-boot.git] / arch / arm / mach-keystone / ddr3_spd.c
index c541886787077cfc17e033cd2e84546b34ffd1c9..6eee9ad13a0b30cad794674c017e753ea92bcae9 100644 (file)
@@ -1,9 +1,8 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Keystone2: DDR3 SPD configuration
  *
  * (C) Copyright 2015-2016 Texas Instruments Incorporated, <www.ti.com>
- *
- * SPDX-License-Identifier:     GPL-2.0+
  */
 
 #include <common.h>
@@ -404,6 +403,7 @@ static void init_ddr3param(struct ddr3_spd_cb *spd_cb,
 static int ddr3_read_spd(ddr3_spd_eeprom_t *spd_params)
 {
        int ret;
+#ifndef CONFIG_DM_I2C
        int old_bus;
 
        i2c_init(CONFIG_SYS_DAVINCI_I2C_SPEED, CONFIG_SYS_DAVINCI_I2C_SLAVE);
@@ -414,7 +414,13 @@ static int ddr3_read_spd(ddr3_spd_eeprom_t *spd_params)
        ret = i2c_read(0x53, 0, 1, (unsigned char *)spd_params, 256);
 
        i2c_set_bus_num(old_bus);
+#else
+       struct udevice *dev;
 
+       ret = i2c_get_chip_for_busnum(1, 0x53, 1, &dev);
+       if (!ret)
+               ret = dm_i2c_read(dev, 0, (unsigned char *)spd_params, 256);
+#endif
        if (ret) {
                printf("Cannot read DIMM params\n");
                return 1;