mirror of
https://github.com/brain-hackers/u-boot-brain
synced 2024-09-28 23:50:26 +09:00
board: gateworks: venice: fix gsc_get_dev
use dm_i2c_probe instead of i2c_get_chip which appears to be more reliable. Signed-off-by: Tim Harvey <tharvey@gateworks.com> Reviewed-by: Fabio Estevam <festevam@gmail.com>
This commit is contained in:
parent
985e7afa81
commit
b9b63790ca
@ -125,29 +125,18 @@ enum {
|
|||||||
|
|
||||||
static struct udevice *gsc_get_dev(int busno, int slave)
|
static struct udevice *gsc_get_dev(int busno, int slave)
|
||||||
{
|
{
|
||||||
struct udevice *dev;
|
static const char * const i2c[] = { "i2c@30a20000", "i2c@30a30000" };
|
||||||
|
struct udevice *dev, *bus;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
#if (IS_ENABLED(CONFIG_SPL_BUILD))
|
ret = uclass_get_device_by_name(UCLASS_I2C, i2c[busno - 1], &bus);
|
||||||
ret = i2c_get_chip_for_busnum(busno + 1, slave, 1, &dev);
|
if (ret) {
|
||||||
|
printf("GSC : failed I2C%d probe: %d\n", busno, ret);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ret = dm_i2c_probe(bus, slave, 0, &dev);
|
||||||
if (ret)
|
if (ret)
|
||||||
return NULL;
|
return NULL;
|
||||||
#else
|
|
||||||
struct udevice *bus;
|
|
||||||
|
|
||||||
busno--;
|
|
||||||
|
|
||||||
ret = uclass_get_device_by_seq(UCLASS_I2C, busno, &bus);
|
|
||||||
if (ret) {
|
|
||||||
printf("i2c%d: no bus %d\n", busno + 1, ret);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
ret = i2c_get_chip(bus, slave, 1, &dev);
|
|
||||||
if (ret) {
|
|
||||||
printf("i2c%d@0x%02x: no chip %d\n", busno + 1, slave, ret);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user