summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/arm/imx-common/i2c-mxv7.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/arch/arm/imx-common/i2c-mxv7.c b/arch/arm/imx-common/i2c-mxv7.c
index ff72b1a..d358d6c 100644
--- a/arch/arm/imx-common/i2c-mxv7.c
+++ b/arch/arm/imx-common/i2c-mxv7.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 Boundary Devices Inc.
+ * Copyright (C) 2014-2016 Freescale Semiconductor, Inc.
*
* SPDX-License-Identifier: GPL-2.0+
*/
@@ -33,13 +34,36 @@ int force_idle_bus(void *priv)
printf("%s: sda=%d scl=%d sda.gp=0x%x scl.gp=0x%x\n", __func__,
sda, scl, p->sda.gp, p->scl.gp);
+ gpio_direction_output(p->scl.gp, 1);
+ udelay(1000);
/* Send high and low on the SCL line */
for (i = 0; i < 9; i++) {
- gpio_direction_output(p->scl.gp, 0);
+ gpio_direction_output(p->scl.gp, 1);
udelay(50);
- gpio_direction_input(p->scl.gp);
+ gpio_direction_output(p->scl.gp, 0);
udelay(50);
}
+
+ /* Simulate the NACK */
+ gpio_direction_output(p->sda.gp, 1);
+ udelay(50);
+ gpio_direction_output(p->scl.gp, 1);
+ udelay(50);
+ gpio_direction_output(p->scl.gp, 0);
+ udelay(50);
+
+ /* Simulate the STOP signal */
+ gpio_direction_output(p->sda.gp, 0);
+ udelay(50);
+ gpio_direction_output(p->scl.gp, 1);
+ udelay(50);
+ gpio_direction_output(p->sda.gp, 1);
+ udelay(50);
+
+ /* Get the bus status */
+ gpio_direction_input(p->sda.gp);
+ gpio_direction_input(p->scl.gp);
+
start_time = get_timer(0);
for (;;) {
sda = gpio_get_value(p->sda.gp);