summaryrefslogtreecommitdiff
path: root/drivers/i2c/sandbox_i2c.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-01-23 11:48:22 -0700
committerHeiko Schocher <hs@denx.de>2020-01-27 07:24:02 +0100
commitf3d461521a8ef6540dbcb2314802eae5790a9408 (patch)
treece6d8f74e77beb84779c63718de19065f7d1a25d /drivers/i2c/sandbox_i2c.c
parentb0a22d0fa9507baa8b3782b392471df94974d831 (diff)
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 <sjg@chromium.org> Reviewed-by: Heiko Schocher <hs@denx.de>
Diffstat (limited to 'drivers/i2c/sandbox_i2c.c')
-rw-r--r--drivers/i2c/sandbox_i2c.c3
1 files changed, 2 insertions, 1 deletions
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;
}