mirror of
https://xff.cz/git/u-boot/
synced 2025-09-02 09:12:08 +02:00
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:
@@ -1730,7 +1730,7 @@ static int do_i2c_bus_speed(cmd_tbl_t * cmdtp, int flag, int argc, char * const
|
|||||||
#endif
|
#endif
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
#ifdef CONFIG_DM_I2C
|
#ifdef CONFIG_DM_I2C
|
||||||
speed = i2c_get_bus_speed(bus);
|
speed = dm_i2c_get_bus_speed(bus);
|
||||||
#else
|
#else
|
||||||
speed = i2c_get_bus_speed();
|
speed = i2c_get_bus_speed();
|
||||||
#endif
|
#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);
|
speed = simple_strtoul(argv[1], NULL, 10);
|
||||||
printf("Setting bus speed to %d Hz\n", speed);
|
printf("Setting bus speed to %d Hz\n", speed);
|
||||||
#ifdef CONFIG_DM_I2C
|
#ifdef CONFIG_DM_I2C
|
||||||
ret = i2c_set_bus_speed(bus, speed);
|
ret = dm_i2c_set_bus_speed(bus, speed);
|
||||||
#else
|
#else
|
||||||
ret = i2c_set_bus_speed(speed);
|
ret = i2c_set_bus_speed(speed);
|
||||||
#endif
|
#endif
|
||||||
|
@@ -325,7 +325,7 @@ int dm_i2c_probe(struct udevice *bus, uint chip_addr, uint chip_flags,
|
|||||||
return ret;
|
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_ops *ops = i2c_get_ops(bus);
|
||||||
struct dm_i2c_bus *i2c = bus->uclass_priv;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
int dm_i2c_get_bus_speed(struct udevice *bus)
|
||||||
* i2c_get_bus_speed:
|
|
||||||
*
|
|
||||||
* Returns speed of selected I2C bus in Hz
|
|
||||||
*/
|
|
||||||
int i2c_get_bus_speed(struct udevice *bus)
|
|
||||||
{
|
{
|
||||||
struct dm_i2c_ops *ops = i2c_get_ops(bus);
|
struct dm_i2c_ops *ops = i2c_get_ops(bus);
|
||||||
struct dm_i2c_bus *i2c = bus->uclass_priv;
|
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,
|
i2c->speed_hz = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
|
||||||
"clock-frequency", 100000);
|
"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)
|
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);
|
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
|
* @bus: Bus to adjust
|
||||||
* @speed: Requested speed in Hz
|
* @speed: Requested speed in Hz
|
||||||
* @return 0 if OK, -EINVAL for invalid values
|
* @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
|
* @bus: Bus to check
|
||||||
* @return speed of selected I2C bus in Hz, -ve on error
|
* @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
|
* 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(uclass_get_device_by_seq(UCLASS_I2C, busnum, &bus));
|
||||||
ut_assertok(i2c_get_chip(bus, chip, 1, &dev));
|
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(dm_i2c_read(dev, 0, buf, 5));
|
||||||
ut_assertok(i2c_set_bus_speed(bus, 400000));
|
ut_assertok(dm_i2c_set_bus_speed(bus, 400000));
|
||||||
ut_asserteq(400000, i2c_get_bus_speed(bus));
|
ut_asserteq(400000, dm_i2c_get_bus_speed(bus));
|
||||||
ut_assertok(dm_i2c_read(dev, 0, buf, 5));
|
ut_assertok(dm_i2c_read(dev, 0, buf, 5));
|
||||||
ut_asserteq(-EINVAL, dm_i2c_write(dev, 0, buf, 5));
|
ut_asserteq(-EINVAL, dm_i2c_write(dev, 0, buf, 5));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user