From f3d461521a8ef6540dbcb2314802eae5790a9408 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 23 Jan 2020 11:48:22 -0700 Subject: i2c: Update drivers to use enum for speed Convert the obvious uses of i2c bus speeds to use the enum. Use livetree access for code changes. Signed-off-by: Simon Glass Reviewed-by: Heiko Schocher --- drivers/i2c/sandbox_i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers/i2c/sandbox_i2c.c') diff --git a/drivers/i2c/sandbox_i2c.c b/drivers/i2c/sandbox_i2c.c index 0dbbaa0c447..1a4521d5b8e 100644 --- a/drivers/i2c/sandbox_i2c.c +++ b/drivers/i2c/sandbox_i2c.c @@ -72,7 +72,8 @@ static int sandbox_i2c_xfer(struct udevice *bus, struct i2c_msg *msg, * 400KHz for reads. */ is_read = nmsgs > 1; - if (i2c->speed_hz > (is_read ? 400000 : 100000)) { + if (i2c->speed_hz > (is_read ? I2C_SPEED_FAST_RATE : + I2C_SPEED_STANDARD_RATE)) { debug("%s: Max speed exceeded\n", __func__); return -EINVAL; } -- cgit v1.2.3