From: Tom Rini Date: Wed, 5 Dec 2018 20:06:24 +0000 (-0500) Subject: Merge branch 'master' of git://git.denx.de/u-boot-spi X-Git-Url: http://git.dujemihanovic.xyz/img/sics.gif?a=commitdiff_plain;h=9450ab2ba8d720bd9f73bccc0af2e2b5a2c2aaf1;p=u-boot.git Merge branch 'master' of git://git.denx.de/u-boot-spi - Various MTD fixes from Boris - Zap various unused / legacy paths. - pxa3xx NAND update from Miquel Signed-off-by: Tom Rini --- 9450ab2ba8d720bd9f73bccc0af2e2b5a2c2aaf1 diff --cc cmd/eeprom.c index e88cb131a1,9136630ada..6c29b33ba3 --- a/cmd/eeprom.c +++ b/cmd/eeprom.c @@@ -129,31 -124,6 +124,23 @@@ static int eeprom_rw_block(unsigned off { int ret = 0; - /* SPI */ - #if defined(CONFIG_MPC8XX_SPI) && !defined(CONFIG_ENV_EEPROM_IS_ON_I2C) - if (read) - spi_read(addr, alen, buffer, len); - else - spi_write(addr, alen, buffer, len); - #else /* I2C */ - +#if defined(CONFIG_DM_I2C) && defined(CONFIG_SYS_I2C_EEPROM_BUS) + struct udevice *dev; + + ret = i2c_get_chip_for_busnum(CONFIG_SYS_I2C_EEPROM_BUS, addr[0], + alen - 1, &dev); + if (ret) { + printf("%s: Cannot find udev for a bus %d\n", __func__, + CONFIG_SYS_I2C_EEPROM_BUS); + return CMD_RET_FAILURE; + } + + if (read) + ret = dm_i2c_read(dev, offset, buffer, len); + else + ret = dm_i2c_write(dev, offset, buffer, len); + +#else /* Non DM I2C support - will be removed */ #if defined(CONFIG_SYS_I2C_EEPROM_BUS) i2c_set_bus_num(CONFIG_SYS_I2C_EEPROM_BUS); #endif @@@ -162,10 -132,9 +149,9 @@@ ret = i2c_read(addr[0], offset, alen - 1, buffer, len); else ret = i2c_write(addr[0], offset, alen - 1, buffer, len); - #endif - +#endif /* CONFIG_DM_I2C && CONFIG_SYS_I2C_EEPROM_BUS */ if (ret) - ret = 1; + ret = CMD_RET_FAILURE; return ret; } diff --cc common/board_f.c index 835b7247c5,a3e80ca951..149a7229e8 --- a/common/board_f.c +++ b/common/board_f.c @@@ -24,10 -23,6 +24,9 @@@ #include #include #include - #include +#ifdef CONFIG_SPL +#include +#endif #include #include #include