X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;ds=sidebyside;f=arch%2Farm%2Fmach-keystone%2Fddr3_spd.c;h=6eee9ad13a0b30cad794674c017e753ea92bcae9;hb=3b3c623e61319ae268c5ccb55078931161bc719e;hp=c541886787077cfc17e033cd2e84546b34ffd1c9;hpb=88033d737d9f46e7eebda6a8f9770957eb9aae9c;p=oweals%2Fu-boot.git diff --git a/arch/arm/mach-keystone/ddr3_spd.c b/arch/arm/mach-keystone/ddr3_spd.c index c541886787..6eee9ad13a 100644 --- a/arch/arm/mach-keystone/ddr3_spd.c +++ b/arch/arm/mach-keystone/ddr3_spd.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Keystone2: DDR3 SPD configuration * * (C) Copyright 2015-2016 Texas Instruments Incorporated, - * - * SPDX-License-Identifier: GPL-2.0+ */ #include @@ -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;