dm: i2c: Add a dm_ prefix to driver model bus speed functions
As with i2c_read() and i2c_write(), add a dm_ prefix to the driver model versions of these functions to avoid conflicts. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heiko Schocher <hs@denx.de>
This commit is contained in:
parent
0da0fcd51f
commit
ca88b9b939
|
@ -1730,7 +1730,7 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
|
|||
#endif
|
||||
if (argc == 1) {
|
||||
#ifdef CONFIG_DM_I2C
|
||||
speed = i2c_get_bus_speed(bus);
|
||||
speed = dm_i2c_get_bus_speed(bus);
|
||||
#else
|
||||
speed = i2c_get_bus_speed();
|
||||
#endif
|
||||
|
@ -1740,7 +1740,7 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
|
|||
speed = simple_strtoul(argv[1], NULL, 10);
|
||||
printf("Setting bus speed to %d Hz\n", speed);
|
||||
#ifdef CONFIG_DM_I2C
|
||||
ret = i2c_set_bus_speed(bus, speed);
|
||||
ret = dm_i2c_set_bus_speed(bus, speed);
|
||||
#else
|
||||
ret = i2c_set_bus_speed(speed);
|
||||
#endif
|
||||
|
|
|
@ -325,7 +325,7 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint chip_flags,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
|
||||
int dm_i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
|
||||
{
|
||||
struct dm_i2c_ops *ops = i2c_get_ops(bus);
|
||||
struct dm_i2c_bus *i2c = bus->uclass_priv;
|
||||
|
@ -346,12 +346,7 @@ int i2c_set_bus_speed(struct udevice *bus, unsigned int speed)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* i2c_get_bus_speed:
|
||||
*
|
||||
* Returns speed of selected I2C bus in Hz
|
||||
*/
|
||||
int i2c_get_bus_speed(struct udevice *bus)
|
||||
int dm_i2c_get_bus_speed(struct udevice *bus)
|
||||
{
|
||||
struct dm_i2c_ops *ops = i2c_get_ops(bus);
|
||||
struct dm_i2c_bus *i2c = bus->uclass_priv;
|
||||
|
@ -440,7 +435,7 @@ static int i2c_post_probe(struct udevice *dev)
|
|||
i2c->speed_hz = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
|
||||
"clock-frequency", 100000);
|
||||
|
||||
return i2c_set_bus_speed(dev, i2c->speed_hz);
|
||||
return dm_i2c_set_bus_speed(dev, i2c->speed_hz);
|
||||
}
|
||||
|
||||
static int i2c_post_bind(struct udevice *dev)
|
||||
|
|
|
@ -125,21 +125,21 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint chip_flags,
|
|||
struct udevice **devp);
|
||||
|
||||
/**
|
||||
* i2c_set_bus_speed() - set the speed of a bus
|
||||
* dm_i2c_set_bus_speed() - set the speed of a bus
|
||||
*
|
||||
* @bus: Bus to adjust
|
||||
* @speed: Requested speed in Hz
|
||||
* @return 0 if OK, -EINVAL for invalid values
|
||||
*/
|
||||
int i2c_set_bus_speed(struct udevice *bus, unsigned int speed);
|
||||
int dm_i2c_set_bus_speed(struct udevice *bus, unsigned int speed);
|
||||
|
||||
/**
|
||||
* i2c_get_bus_speed() - get the speed of a bus
|
||||
* dm_i2c_get_bus_speed() - get the speed of a bus
|
||||
*
|
||||
* @bus: Bus to check
|
||||
* @return speed of selected I2C bus in Hz, -ve on error
|
||||
*/
|
||||
int i2c_get_bus_speed(struct udevice *bus);
|
||||
int dm_i2c_get_bus_speed(struct udevice *bus);
|
||||
|
||||
/**
|
||||
* i2c_set_chip_flags() - set flags for a chip
|
||||
|
|
|
@ -67,10 +67,10 @@ static int dm_test_i2c_speed(struct dm_test_state *dms)
|
|||
|
||||
ut_assertok(uclass_get_device_by_seq(UCLASS_I2C, busnum, &bus));
|
||||
ut_assertok(i2c_get_chip(bus, chip, 1, &dev));
|
||||
ut_assertok(i2c_set_bus_speed(bus, 100000));
|
||||
ut_assertok(dm_i2c_set_bus_speed(bus, 100000));
|
||||
ut_assertok(dm_i2c_read(dev, 0, buf, 5));
|
||||
ut_assertok(i2c_set_bus_speed(bus, 400000));
|
||||
ut_asserteq(400000, i2c_get_bus_speed(bus));
|
||||
ut_assertok(dm_i2c_set_bus_speed(bus, 400000));
|
||||
ut_asserteq(400000, dm_i2c_get_bus_speed(bus));
|
||||
ut_assertok(dm_i2c_read(dev, 0, buf, 5));
|
||||
ut_asserteq(-EINVAL, dm_i2c_write(dev, 0, buf, 5));
|
||||
|
||||
|
|
Loading…
Reference in New Issue