From 6b8a859c9baa05739a13719d674a4915c02d8341 Mon Sep 17 00:00:00 2001 From: Ye Li Date: Thu, 18 May 2017 07:47:14 -0500 Subject: [PATCH] MLK-14938-14 imx_lpi2c: Fix bus stop timeout issue When checking the timeout for NACK, the start time should be got at stop command send out, not before controller's TX ready. Signed-off-by: Ye Li --- drivers/i2c/imx_lpi2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/imx_lpi2c.c b/drivers/i2c/imx_lpi2c.c index aa83b6fe4c..69fd569c75 100644 --- a/drivers/i2c/imx_lpi2c.c +++ b/drivers/i2c/imx_lpi2c.c @@ -192,7 +192,7 @@ static int bus_i2c_stop(struct udevice *bus) struct imx_lpi2c_reg *regs = (struct imx_lpi2c_reg *)dev_get_addr(bus); lpi2c_status_t result = LPI2C_SUCESS; u32 status; - ulong start_time = get_timer(0); + ulong start_time; result = bus_i2c_wait_for_tx_ready(bus); if (result) { @@ -203,6 +203,7 @@ static int bus_i2c_stop(struct udevice *bus) /* send stop command */ writel(LPI2C_MTDR_CMD(0x2), ®s->mtdr); + start_time = get_timer(0); while (1) { status = readl(®s->msr); result = imx_lpci2c_check_clear_error(bus); -- 2.17.1