All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
@ 2012-11-25  6:31 Viresh Kumar
       [not found] ` <71e27515a050a2c7d18272b84ff7ec3ec8b11cae.1353824555.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Viresh Kumar @ 2012-11-25  6:31 UTC (permalink / raw)
  To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
  Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ, Viresh Kumar

Add i2c bus recovery infrastructure to i2c adapters as specified in the i2c
protocol Rev. 03 section 3.1.16 titled "Bus clear".

http://www.nxp.com/documents/user_manual/UM10204.pdf

Sometimes during operation i2c bus hangs and we need to give dummy clocks to
slave device to start the transfer again. Now we may have capability in the bus
controller to generate these clocks or platform may have gpio pins which can be
toggled to generate dummy clocks. This patch supports both.

This patch also adds in generic bus recovery routines gpio or scl line based
which can be used by bus controller. In addition controller driver may provide
its own version of the bus recovery routine.

This doesn't support multi-master recovery for now.

Signed-off-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---

Hi Wolfram,

I am sending V7 before closing our comments completely on V6 (Very few are left
now :) ), so that you can get an idea of what i am implementing now. It
incorporates all your comments leaving:
- removing skip_sda_polling
- removing clock_rate_khz
- calling recover_bus from core instead of controller driver

V6->V7:
- Lots of review comments from Wolfram incorporated
- get[put]_gpio updated to more generic [un]prepare_recovery with return type as
  void.
- prototypes of generic recovery routines are exposed to controller driver and
  they are now required to pass recover_bus()
- gpio flags removed from recovery info
- default clock rate is 100 KHz if not passed by controller driver
- clk count is 9, fixed.

V5->V6:
- Removed sda_gpio_flags
- Make scl_gpio_flags as GPIOF_OPEN_DRAIN | GPIOF_OUT_INIT_HIGH by default
- update bri->set_scl and bri->get_sda for gpio recovery case in i2c core
- Guaranteed to generate 9 falling-rising edges for bus recovery

V4->V5:
- section name corrected to 3.1.16
- merged gpio and non-gpio recovery routines to remove code redundancy
- Changed types of gpio and gpio-flags to unsigned and unsigned long
- Checking return value of get_gpio() now
- using DIV_ROUND_UP for calculating delay, to get more correct value

 drivers/i2c/i2c-core.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/i2c.h    |  47 +++++++++++++++++
 2 files changed, 183 insertions(+)

diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a7edf98..d100276 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -27,7 +27,9 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
+#include <linux/delay.h>
 #include <linux/errno.h>
+#include <linux/gpio.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
 #include <linux/init.h>
@@ -104,6 +106,106 @@ static int i2c_device_uevent(struct device *dev, struct kobj_uevent_env *env)
 #define i2c_device_uevent	NULL
 #endif	/* CONFIG_HOTPLUG */
 
+/* i2c bus recovery routines */
+#define RECOVERY_CLK_CNT	9
+#define DEFAULT_CLK_RATE	100	/* KHz */
+
+static void set_scl_gpio_value(struct i2c_adapter *adap, int val)
+{
+	gpio_set_value(adap->bus_recovery_info->scl_gpio, val);
+}
+
+static int get_sda_gpio_value(struct i2c_adapter *adap)
+{
+	return gpio_get_value(adap->bus_recovery_info->sda_gpio);
+}
+
+static int i2c_get_gpios_for_recovery(struct i2c_adapter *adap)
+{
+	struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
+	struct device *dev = &adap->dev;
+	int ret = 0;
+
+	ret = gpio_request_one(bri->scl_gpio, GPIOF_OPEN_DRAIN |
+			GPIOF_OUT_INIT_HIGH, "i2c-scl");
+	if (ret) {
+		dev_warn(dev, "gpio request fail: %d\n", bri->scl_gpio);
+		return ret;
+	}
+
+	if (!bri->skip_sda_polling) {
+		if (gpio_request_one(bri->sda_gpio, GPIOF_IN, "i2c-sda")) {
+			/* work without sda polling */
+			dev_warn(dev, "can't get sda: %d. Skip sda polling\n",
+					bri->sda_gpio);
+			bri->skip_sda_polling = true;
+		}
+	}
+
+	return ret;
+}
+
+static void i2c_put_gpios_for_recovery(struct i2c_adapter *adap)
+{
+	struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
+
+	if (!bri->skip_sda_polling)
+		gpio_free(bri->sda_gpio);
+
+	gpio_free(bri->scl_gpio);
+}
+
+static int i2c_generic_recovery(struct i2c_adapter *adap)
+{
+	struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
+	unsigned long delay = 1000000; /* 10^6/KHz for delay in ns */
+	int i, val = 0;
+
+	if (bri->prepare_recovery)
+		bri->prepare_recovery(bri);
+
+	/*
+	 * By this time SCL is high, as we need to give 9 falling-rising edges
+	 */
+
+	delay = DIV_ROUND_UP(delay, bri->clock_rate_khz * 2);
+
+	for (i = 0; i < RECOVERY_CLK_CNT * 2; i++, val = !val) {
+		bri->set_scl(adap, val);
+		ndelay(delay);
+
+		/* break if sda got high, check only when scl line is high */
+		if (!bri->skip_sda_polling && val)
+			if (unlikely(bri->get_sda(adap)))
+				break;
+	}
+
+	if (bri->unprepare_recovery)
+		bri->unprepare_recovery(bri);
+
+	return 0;
+}
+
+int i2c_generic_scl_recovery(struct i2c_adapter *adap)
+{
+	adap->bus_recovery_info->set_scl(adap, 1);
+	return i2c_generic_recovery(adap);
+}
+
+int i2c_generic_gpio_recovery(struct i2c_adapter *adap)
+{
+	int ret;
+
+	ret = i2c_get_gpios_for_recovery(adap);
+	if (ret)
+		return ret;
+
+	ret = i2c_generic_recovery(adap);
+	i2c_put_gpios_for_recovery(adap);
+
+	return ret;
+}
+
 static int i2c_device_probe(struct device *dev)
 {
 	struct i2c_client	*client = i2c_verify_client(dev);
@@ -896,6 +998,40 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 			 "Failed to create compatibility class link\n");
 #endif
 
+	/* bus recovery specific initialization */
+	if (adap->bus_recovery_info) {
+		struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
+
+		if (!bri->recover_bus) {
+			dev_err(&adap->dev, "Invalid recover_bus(), skip recovery \n");
+			adap->bus_recovery_info = NULL;
+			goto exit_recovery;
+		}
+
+		if (!bri->clock_rate_khz) {
+			dev_warn(&adap->dev, "default clk rate used: 100KHz\n");
+			bri->clock_rate_khz = DEFAULT_CLK_RATE;
+		}
+
+		/* GPIO recovery */
+		if (bri->recover_bus == i2c_generic_gpio_recovery) {
+			bri->set_scl = set_scl_gpio_value;
+
+			if (!bri->skip_sda_polling)
+				bri->get_sda = get_sda_gpio_value;
+		} else if (bri->set_scl) {
+			if (!bri->skip_sda_polling && !bri->get_sda) {
+				dev_warn(&adap->dev,
+						"!get_sda. skip sda polling\n");
+				bri->skip_sda_polling = true;
+			}
+		} else {
+			dev_warn(&adap->dev,
+					"doesn't have valid recovery type\n");
+		}
+	}
+
+exit_recovery:
 	/* create pre-declared device nodes */
 	if (adap->nr < __i2c_first_dynamic_bus_num)
 		i2c_scan_static_board_info(adap);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index 800de22..63acd9d 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -368,6 +368,51 @@ struct i2c_algorithm {
 	u32 (*functionality) (struct i2c_adapter *);
 };
 
+/**
+ * struct i2c_bus_recovery_info - I2c bus recovery information
+ * @recover_bus: Recover routine. Either pass driver's recover_bus() routine, or
+ *	i2c_generic_scl_recovery() or i2c_generic_gpio_recovery().
+ * @skip_sda_polling: if true, bus recovery will not poll sda line to check if
+ *	it became high or not. Only required if recover_bus == NULL.
+ * @clock_rate_khz: clock rate of dummy clock in khz. Required for both gpio and
+ *	scl type recovery.
+ * @set_scl: This sets/clears scl line. For GPIO recovery set_scl_gpio_value()
+ *	is used here otherwise controller specific routine must be passed.
+ * @get_sda: This gets current value of sda line. For GPIO recovery
+ *	get_sda_gpio_value() is used here otherwise controller specific routine
+ *	must be passed.
+ * @prepare_recovery: This will be called before starting recovery. Platform may
+ *	configure padmux here for sda/scl line or something else they want.
+ * @unprepare_recovery: This will be called after completing recovery. Platform
+ *	may configure padmux here for sda/scl line or something else they want.
+ * @scl_gpio: gpio number of the scl line. Only required for GPIO recovery.
+ * @sda_gpio: gpio number of the sda line. Only required for GPIO recovery.
+ */
+struct i2c_bus_recovery_info {
+	int (*recover_bus)(struct i2c_adapter *);
+	bool skip_sda_polling;
+	u32 clock_rate_khz;
+
+	/*
+	 * Fn pointers for recovery, will point either to:
+	 * - set_scl_gpio_value and get_sda_gpio_value for gpio recovery
+	 * - Controller specific routines, otherwise
+	 */
+	void (*set_scl)(struct i2c_adapter *, int val);
+	int (*get_sda)(struct i2c_adapter *);
+
+	void (*prepare_recovery)(struct i2c_bus_recovery_info *bri);
+	void (*unprepare_recovery)(struct i2c_bus_recovery_info *bri);
+
+	/* gpio recovery */
+	unsigned scl_gpio;
+	unsigned sda_gpio;
+};
+
+/* Generic recovery routines */
+int i2c_generic_gpio_recovery(struct i2c_adapter *adap);
+int i2c_generic_scl_recovery(struct i2c_adapter *adap);
+
 /*
  * i2c_adapter is the structure used to identify a physical i2c bus along
  * with the access algorithms necessary to access it.
@@ -391,6 +436,8 @@ struct i2c_adapter {
 
 	struct mutex userspace_clients_lock;
 	struct list_head userspace_clients;
+
+	struct i2c_bus_recovery_info *bus_recovery_info;
 };
 #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
 
-- 
1.7.12.rc2.18.g61b472e

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH V7 2/2] i2c/designware: Provide i2c bus recovery support
       [not found] ` <71e27515a050a2c7d18272b84ff7ec3ec8b11cae.1353824555.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2012-11-25  6:31   ` Viresh Kumar
  2012-11-25 11:52   ` [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure Paul Carpenter
  1 sibling, 0 replies; 12+ messages in thread
From: Viresh Kumar @ 2012-11-25  6:31 UTC (permalink / raw)
  To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ
  Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ, Viresh Kumar,
	Vincenzo Frascino, Shiraz Hashim

Add bus recovery support for designware_i2c controller. It uses generic gpio
based i2c_gpio_recover_bus() routine. Platforms need to pass struct
i2c_bus_recovery_info as platform data designware I2C controller.

Signed-off-by: Vincenzo Frascino <vincenzo.frascino-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Shiraz Hashim <shiraz.hashim-qxv4g6HH51o@public.gmane.org>
Signed-off-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
V6->V7:
- removed include/linux/i2c/i2c-designware.h and use struct
  i2c_bus_recovery_info as platform data.
- initialize recover_bus with i2c_generic_gpio_recovery()

 drivers/i2c/busses/i2c-designware-core.c    |  6 +++++-
 drivers/i2c/busses/i2c-designware-platdrv.c | 18 ++++++++++++++++--
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index cbba7db..24feaaf 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -538,7 +538,11 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 	ret = wait_for_completion_interruptible_timeout(&dev->cmd_complete, HZ);
 	if (ret == 0) {
 		dev_err(dev->dev, "controller timed out\n");
-		i2c_dw_init(dev);
+		if (adap->bus_recovery_info) {
+			dev_dbg(dev->dev, "try i2c bus recovery\n");
+			adap->bus_recovery_info->recover_bus(adap);
+		}
+
 		ret = -ETIMEDOUT;
 		goto done;
 	} else if (ret < 0)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0506fef..c7725b2 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -55,6 +55,7 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
 	struct dw_i2c_dev *dev;
 	struct i2c_adapter *adap;
 	struct resource *mem, *ioarea;
+	struct i2c_bus_recovery_info *recovery_info;
 	int irq, r;
 
 	/* NOTE: driver uses the static register mapping */
@@ -141,17 +142,28 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
 	adap->dev.parent = &pdev->dev;
 	adap->dev.of_node = pdev->dev.of_node;
 
+	/* Bus recovery support */
+	recovery_info = dev_get_platdata(&pdev->dev);
+	if (recovery_info) {
+		recovery_info->recover_bus = i2c_generic_gpio_recovery;
+		recovery_info->clock_rate_khz = clk_get_rate(dev->clk) / 1000;
+		adap->bus_recovery_info = recovery_info;
+	} else {
+		adap->bus_recovery_info = NULL;
+	}
+
 	adap->nr = pdev->id;
 	r = i2c_add_numbered_adapter(adap);
 	if (r) {
 		dev_err(&pdev->dev, "failure adding adapter\n");
-		goto err_free_irq;
+		goto err_free_recovery_info;
 	}
 	of_i2c_register_devices(adap);
 
 	return 0;
 
-err_free_irq:
+err_free_recovery_info:
+	kfree(recovery_info);
 	free_irq(dev->irq, dev);
 err_iounmap:
 	iounmap(dev->base);
@@ -174,6 +186,8 @@ static int __devexit dw_i2c_remove(struct platform_device *pdev)
 	struct dw_i2c_dev *dev = platform_get_drvdata(pdev);
 	struct resource *mem;
 
+	kfree(dev->adapter.bus_recovery_info);
+
 	platform_set_drvdata(pdev, NULL);
 	i2c_del_adapter(&dev->adapter);
 	put_device(&pdev->dev);
-- 
1.7.12.rc2.18.g61b472e

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found] ` <71e27515a050a2c7d18272b84ff7ec3ec8b11cae.1353824555.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
  2012-11-25  6:31   ` [PATCH V7 2/2] i2c/designware: Provide i2c bus recovery support Viresh Kumar
@ 2012-11-25 11:52   ` Paul Carpenter
       [not found]     ` <50B20670.5070509-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Paul Carpenter @ 2012-11-25 11:52 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

Viresh Kumar wrote:
 > Add i2c bus recovery infrastructure to i2c adapters as specified in 
the i2c
 > protocol Rev. 03 section 3.1.16 titled "Bus clear".
 >
 > http://www.nxp.com/documents/user_manual/UM10204.pdf

You should also take note of section 3.1.14 and its notes on Software
Reset -
     "Precautions must be taken to ensure that a device is not
      pulling down the SDA or SCL line after applying the supply
      voltage, since these low levels would block the bus"

 > Sometimes during operation i2c bus hangs and we need to give dummy 
clocks to
 > slave device to start the transfer again. Now we may have capability 
in the bus
 > controller to generate these clocks or platform may have gpio pins 
which can be
 > toggled to generate dummy clocks. This patch supports both.

I may have missed it but misses an I2C check step, but that could be
because I do so much embedded and hardware side as well.

 > This patch also adds in generic bus recovery routines gpio or scl 
line based
 > which can be used by bus controller. In addition controller driver 
may provide
 > its own version of the bus recovery routine.
 >
 > This doesn't support multi-master recovery for now.
 >
 > Signed-off-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
 > ---
 >
 > Hi Wolfram,
 >
 > I am sending V7 before closing our comments completely on V6 (Very 
few are left
 > now :) ), so that you can get an idea of what i am implementing now. It
 > incorporates all your comments leaving:
.....

 > +static int i2c_get_gpios_for_recovery(struct i2c_adapter *adap)
 > +{
 > +    struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
 > +    struct device *dev = &adap->dev;
 > +    int ret = 0;

Where is the check that SCL is NOT low (bus fault or device doing clock
stretching)

 > +    ret = gpio_request_one(bri->scl_gpio, GPIOF_OPEN_DRAIN |
 > +            GPIOF_OUT_INIT_HIGH, "i2c-scl");

I always get wary of people driving I2C with non-open-drain, especially
with stuck busses

 > +    if (ret) {
 > +        dev_warn(dev, "gpio request fail: %d\n", bri->scl_gpio);
 > +        return ret;
 > +    }
 > +
 > +    if (!bri->skip_sda_polling) {
 > +        if (gpio_request_one(bri->sda_gpio, GPIOF_IN, "i2c-sda")) {
 > +            /* work without sda polling */
 > +            dev_warn(dev, "can't get sda: %d. Skip sda polling\n",
 > +                    bri->sda_gpio);
 > +            bri->skip_sda_polling = true;
 > +        }
 > +    }
 > +
 > +    return ret;
 > +}

.....


 > +static int i2c_generic_recovery(struct i2c_adapter *adap)
 > +{
 > +    struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
 > +    unsigned long delay = 1000000; /* 106/KHz for delay in ns */
 > +    int i, val = 0;
 > +
 > +    if (bri->prepare_recovery)
 > +        bri->prepare_recovery(bri);
 > +
 > +    /*
 > +     * By this time SCL is high, as we need to give 9 falling-rising 
edges
 > +     */

In my view that needs to be done by an actual check of the real SCL not
assumption.

 > +    delay = DIV_ROUND_UP(delay, bri->clock_rate_khz * 2);
 > +
 > +    for (i = 0; i < RECOVERY_CLK_CNT * 2; i++, val = !val) {
 > +        bri->set_scl(adap, val);
 > +        ndelay(delay);
 > +
 > +        /* break if sda got high, check only when scl line is high */
 > +        if (!bri->skip_sda_polling && val)

Dont use 'val' read the actual SCL line which ensures you you are not
wasting your time because of hardware fault. Possibly saving your GPIO
from being stuck permanently.

 > +            if (unlikely(bri->get_sda(adap)))
 > +                break;
 > +    }
 > +
 > +    if (bri->unprepare_recovery)
 > +        bri->unprepare_recovery(bri);
 > +
 > +    return 0;
 > +}

-- 
Paul Carpenter          | paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org
<http://www.pcserviceselectronics.co.uk/>    PC Services
<http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
<http://www.gnuh8.org.uk/>  GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
<http://www.badweb.org.uk/> For those web sites you hate

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]     ` <50B20670.5070509-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
@ 2012-11-26  2:28       ` Viresh Kumar
       [not found]         ` <CAKohpo=_2xwj+NCpZPB1EsWiGPLafc3XKVbRT+690AkHB76AWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Viresh Kumar @ 2012-11-26  2:28 UTC (permalink / raw)
  To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ, Paul Carpenter
  Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

On 25 November 2012 17:22, Paul Carpenter
<paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org> wrote:
> Viresh Kumar wrote:
>> Add i2c bus recovery infrastructure to i2c adapters as specified in the
>> i2c
>> protocol Rev. 03 section 3.1.16 titled "Bus clear".
>>
>> http://www.nxp.com/documents/user_manual/UM10204.pdf
>
> You should also take note of section 3.1.14 and its notes on Software
> Reset -
>     "Precautions must be taken to ensure that a device is not
>      pulling down the SDA or SCL line after applying the supply
>      voltage, since these low levels would block the bus"

Hmm.. This patch has taken a very long time for being accepted, and the
reason for that was, it was generalizing much more than what is required.

And I am not sure, if checking SCL low would be considered like that only. :)

@Wolfram: I would need your point of view on that, before trying it out.

>> +static int i2c_get_gpios_for_recovery(struct i2c_adapter *adap)
>> +{
>> +    struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
>> +    struct device *dev = &adap->dev;
>> +    int ret = 0;
>
> Where is the check that SCL is NOT low (bus fault or device doing clock
> stretching)

Pending for Wolfram's point of view :)

>> +static int i2c_generic_recovery(struct i2c_adapter *adap)
>> +{
>> +    /*
>> +     * By this time SCL is high, as we need to give 9 falling-rising
>> edges
>> +     */
>
> In my view that needs to be done by an actual check of the real SCL not
> assumption.

Checking that would be tricky. For GPIO recovery, we have to make it GPIO
first in input mode and read its value. Right?

>> +    delay = DIV_ROUND_UP(delay, bri->clock_rate_khz * 2);
>> +
>> +    for (i = 0; i < RECOVERY_CLK_CNT * 2; i++, val = !val) {
>> +        bri->set_scl(adap, val);
>> +        ndelay(delay);
>> +
>> +        /* break if sda got high, check only when scl line is high */
>> +        if (!bri->skip_sda_polling && val)
>
> Dont use 'val' read the actual SCL line which ensures you you are not
> wasting your time because of hardware fault. Possibly saving your GPIO
> from being stuck permanently.

Again, wolfram can decide if it is really required :)

--
viresh

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]         ` <CAKohpo=_2xwj+NCpZPB1EsWiGPLafc3XKVbRT+690AkHB76AWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-11-26 11:45           ` Paul Carpenter
       [not found]             ` <50B35642.7030104-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Paul Carpenter @ 2012-11-26 11:45 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

Viresh Kumar wrote:
> On 25 November 2012 17:22, Paul Carpenter
> <paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org> wrote:
>> Viresh Kumar wrote:
>>> Add i2c bus recovery infrastructure to i2c adapters as specified in the
>>> i2c
>>> protocol Rev. 03 section 3.1.16 titled "Bus clear".
>>>
>>> http://www.nxp.com/documents/user_manual/UM10204.pdf
>> You should also take note of section 3.1.14 and its notes on Software
>> Reset -
>>     "Precautions must be taken to ensure that a device is not
>>      pulling down the SDA or SCL line after applying the supply
>>      voltage, since these low levels would block the bus"
> 
> Hmm.. This patch has taken a very long time for being accepted, and the
> reason for that was, it was generalizing much more than what is required.
> 
> And I am not sure, if checking SCL low would be considered like that only. :)
> 
> @Wolfram: I would need your point of view on that, before trying it out.

Unless you know why the bus is stuck, how can you reset reminder this
method ONLY works if SCL is high and SDA probably was low and the slave 
device is what is stuck in wrong state. NOTE SCL and SDA high can be 
considered as BUS IDLE or having passed SDA = 1 waiting next clock edge
or state transition without other state information.

 From i2c protocol Rev. 03 section 3.1.16 titled "Bus clear" first bit -

   "In the unlikely event where the clock (SCL) is stuck LOW, the
    preferential procedure is to reset the bus using the HW reset signal
    if your I2C devices have HW reset inputs. If the I2C devices do not
    have HW reset inputs, cycle power to the devices to activate the
    mandatory internal Power-On Reset (POR) circuit."

So if you do not check that SCL is NOT stuck Low the rest will just do
nothing, it wont clear the bus and the fault will not be reported.
The open drain nature of the bus means that you may attempt to toggle it
but if SCL is stuck low nothing will happen on the bus.

Attempting to configure an SCL drive as any form of high driving output
will create a situation that when the SCL is driven high a high driver
on the GPIO will be driving into a stuck low situation potentially
creating a short between a power source and a power sink, that in most
cases will damage or shorten life of one or both ends.

In over 10 years of using I2C in various forms the only times I have
seen bus stuck or device in wrong state

1/ Some code changed a bus switch when Bus was NOT idle
	i.e mid transaction
2/ Bit-banged I2C software was wrong incomplete transaction
3/ Short on bus
4/ Faulty device
5/ Faulty design so 1 and 0 thresholds were compromised

If you ever support multi-master you need to monitor SCL to ensure your
clock toggling is doing what you expect.

>>> +static int i2c_get_gpios_for_recovery(struct i2c_adapter *adap)
>>> +{
>>> +    struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
>>> +    struct device *dev = &adap->dev;
>>> +    int ret = 0;
>> Where is the check that SCL is NOT low (bus fault or device doing clock
>> stretching)
> 
> Pending for Wolfram's point of view :)
> 
>>> +static int i2c_generic_recovery(struct i2c_adapter *adap)
>>> +{
>>> +    /*
>>> +     * By this time SCL is high, as we need to give 9 falling-rising
>>> edges
>>> +     */
>> In my view that needs to be done by an actual check of the real SCL not
>> assumption.
> 
> Checking that would be tricky. For GPIO recovery, we have to make it GPIO
> first in input mode and read its value. Right?

Depends on the GPIO, some even when set as output can still be read as
that is the way the GPIO registers are constructed in some cases.

-- 
Paul Carpenter          | paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org
<http://www.pcserviceselectronics.co.uk/>    PC Services
<http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
<http://www.gnuh8.org.uk/>  GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
<http://www.badweb.org.uk/> For those web sites you hate

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]             ` <50B35642.7030104-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
@ 2012-11-26 12:51               ` Viresh Kumar
       [not found]                 ` <CAKohpomNTKFJQCrZdC81OiQpjdtK85XXWfvvB=XYb85e49OBZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 12+ messages in thread
From: Viresh Kumar @ 2012-11-26 12:51 UTC (permalink / raw)
  To: Paul Carpenter
  Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

On 26 November 2012 17:15, Paul Carpenter
<paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org> wrote:
> Unless you know why the bus is stuck, how can you reset reminder this
> method ONLY works if SCL is high and SDA probably was low and the slave
> device is what is stuck in wrong state. NOTE SCL and SDA high can be
> considered as BUS IDLE or having passed SDA = 1 waiting next clock edge
> or state transition without other state information.
>
> From i2c protocol Rev. 03 section 3.1.16 titled "Bus clear" first bit -
>
>   "In the unlikely event where the clock (SCL) is stuck LOW, the
>    preferential procedure is to reset the bus using the HW reset signal
>    if your I2C devices have HW reset inputs. If the I2C devices do not
>    have HW reset inputs, cycle power to the devices to activate the
>    mandatory internal Power-On Reset (POR) circuit."
>
> So if you do not check that SCL is NOT stuck Low the rest will just do
> nothing, it wont clear the bus and the fault will not be reported.
> The open drain nature of the bus means that you may attempt to toggle it
> but if SCL is stuck low nothing will happen on the bus.
>
> Attempting to configure an SCL drive as any form of high driving output
> will create a situation that when the SCL is driven high a high driver
> on the GPIO will be driving into a stuck low situation potentially
> creating a short between a power source and a power sink, that in most
> cases will damage or shorten life of one or both ends.
>
> In over 10 years of using I2C in various forms the only times I have
> seen bus stuck or device in wrong state
>
> 1/ Some code changed a bus switch when Bus was NOT idle
>         i.e mid transaction
> 2/ Bit-banged I2C software was wrong incomplete transaction
> 3/ Short on bus
> 4/ Faulty device
> 5/ Faulty design so 1 and 0 thresholds were compromised
>
> If you ever support multi-master you need to monitor SCL to ensure your
> clock toggling is doing what you expect.

Hi Paul,

I completely agree with what you said, and i also feel the need of it now.
We don't have a solution for SCL stuck low, just by playing with pad values.
And need some sort of reset of device, etc as mentioned by you earlier.

What we can do here, is check SCL's value and give an error message for
SCL stuck low + return error.

The short circuit mentioned earlier will not happen in our case as we
are setting gpio flags as OPEN_DRAIN and so we would never be writing
1 on SCL pad.

Though i would still need confirmation from Wolfram before implementing
this change.

>> Checking that would be tricky. For GPIO recovery, we have to make it GPIO
>> first in input mode and read its value. Right?
>
>
> Depends on the GPIO, some even when set as output can still be read as
> that is the way the GPIO registers are constructed in some cases.

Yes. Probably can read it in output mode too.

--
viresh

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]                 ` <CAKohpomNTKFJQCrZdC81OiQpjdtK85XXWfvvB=XYb85e49OBZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-11-26 13:28                   ` Paul Carpenter
       [not found]                     ` <50B36E76.6010008-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
  2012-11-26 20:20                   ` Uwe Kleine-König
  1 sibling, 1 reply; 12+ messages in thread
From: Paul Carpenter @ 2012-11-26 13:28 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

Viresh Kumar wrote:
> On 26 November 2012 17:15, Paul Carpenter
> <paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org> wrote:
>> Unless you know why the bus is stuck, how can you reset reminder this
>> method ONLY works if SCL is high and SDA probably was low and the slave
....

> Hi Paul,
> 
> I completely agree with what you said, and i also feel the need of it now.
> We don't have a solution for SCL stuck low, just by playing with pad values.
> And need some sort of reset of device, etc as mentioned by you earlier.
> 
> What we can do here, is check SCL's value and give an error message for
> SCL stuck low + return error.

Yes best method error to mean  "SCL stuck low or long clock stretch"

> The short circuit mentioned earlier will not happen in our case as we
> are setting gpio flags as OPEN_DRAIN and so we would never be writing
> 1 on SCL pad.

 From an earlier thread comment

 >> +    ret = gpio_request_one(bri->scl_gpio, GPIOF_OPEN_DRAIN |
 >> +            GPIOF_OUT_INIT_HIGH, "i2c-scl");
 >
 >I always get wary of people driving I2C with non-open-drain, especially
 >with stuck busses

I would want to know what "GPIOF_OUT_INIT_HIGH" did as that is
suspiciously driving output high at startup.


-- 
Paul Carpenter          | paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org
<http://www.pcserviceselectronics.co.uk/>    PC Services
<http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
<http://www.gnuh8.org.uk/>  GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
<http://www.badweb.org.uk/> For those web sites you hate

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]                     ` <50B36E76.6010008-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
@ 2012-11-26 14:51                       ` Viresh Kumar
  0 siblings, 0 replies; 12+ messages in thread
From: Viresh Kumar @ 2012-11-26 14:51 UTC (permalink / raw)
  To: Paul Carpenter
  Cc: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

On 26 November 2012 18:58, Paul Carpenter
<paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org> wrote:
>>> +    ret = gpio_request_one(bri->scl_gpio, GPIOF_OPEN_DRAIN |
>>> +            GPIOF_OUT_INIT_HIGH, "i2c-scl");
>>
>>I always get wary of people driving I2C with non-open-drain, especially
>>with stuck busses
>
> I would want to know what "GPIOF_OUT_INIT_HIGH" did as that is
> suspiciously driving output high at startup.

I didn't get the question correctly. You mean you want me to explain what
GPIOF_OPEN_DRAIN and GPIOF_OUT_INIT_HIGH will do?

If no, exit();

GPIOF_OPEN_DRAIN: With this flag, all will work normally, leaving
gpio_set_val(1);
This will put the GPIO in input mode instead of writing one to it in
output mode.

GPIOF_OUT_INIT_HIGH: This will set the direction to output first, and then will
do gpio_set_val(1), which will do what is mentioned in GPIOF_OPEN_DRAIN and
so this action should be safe enough.

--
viresh

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]                 ` <CAKohpomNTKFJQCrZdC81OiQpjdtK85XXWfvvB=XYb85e49OBZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  2012-11-26 13:28                   ` Paul Carpenter
@ 2012-11-26 20:20                   ` Uwe Kleine-König
       [not found]                     ` <20121126202003.GA3384-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Uwe Kleine-König @ 2012-11-26 20:20 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Paul Carpenter, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

Hello Viresh,

On Mon, Nov 26, 2012 at 06:21:25PM +0530, Viresh Kumar wrote:
> On 26 November 2012 17:15, Paul Carpenter
> <paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org> wrote:
> > Unless you know why the bus is stuck, how can you reset reminder this
> > method ONLY works if SCL is high and SDA probably was low and the slave
> > device is what is stuck in wrong state. NOTE SCL and SDA high can be
> > considered as BUS IDLE or having passed SDA = 1 waiting next clock edge
> > or state transition without other state information.
> >
> > From i2c protocol Rev. 03 section 3.1.16 titled "Bus clear" first bit -
> >
> >   "In the unlikely event where the clock (SCL) is stuck LOW, the
> >    preferential procedure is to reset the bus using the HW reset signal
> >    if your I2C devices have HW reset inputs. If the I2C devices do not
> >    have HW reset inputs, cycle power to the devices to activate the
> >    mandatory internal Power-On Reset (POR) circuit."
> >
> > So if you do not check that SCL is NOT stuck Low the rest will just do
> > nothing, it wont clear the bus and the fault will not be reported.
> > The open drain nature of the bus means that you may attempt to toggle it
> > but if SCL is stuck low nothing will happen on the bus.
> >
> > Attempting to configure an SCL drive as any form of high driving output
> > will create a situation that when the SCL is driven high a high driver
> > on the GPIO will be driving into a stuck low situation potentially
> > creating a short between a power source and a power sink, that in most
> > cases will damage or shorten life of one or both ends.
> >
> > In over 10 years of using I2C in various forms the only times I have
> > seen bus stuck or device in wrong state
> >
> > 1/ Some code changed a bus switch when Bus was NOT idle
> >         i.e mid transaction
not sure what you mean here. Does it include a (SoC i.e. i2c master)
reset while the bus is not idle? That's the problem I was faced with
some time ago.

> > 2/ Bit-banged I2C software was wrong incomplete transaction
> > 3/ Short on bus
> > 4/ Faulty device
> > 5/ Faulty design so 1 and 0 thresholds were compromised
I can add:
6/ device does clock stretching which is not detected/supported by the
   bus master
7/ clock frequency too high for a device

In reply to a more detailed problem report that should be addressed by
this series on spear-devel I asked a few questions to rule out 6/ and
7/. I cannot find it in an public accessible archive though. It's about
a sta529 codec. When switching sample rates the codec then holds down
SDA. After an additional clock pulse the device and bus are OK again.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]                     ` <20121126202003.GA3384-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2012-11-26 23:00                       ` Paul Carpenter
  2012-11-27  5:49                       ` Viresh Kumar
  1 sibling, 0 replies; 12+ messages in thread
From: Paul Carpenter @ 2012-11-26 23:00 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Viresh Kumar, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

Uwe Kleine-König wrote:
> Hello Viresh,
> 
> On Mon, Nov 26, 2012 at 06:21:25PM +0530, Viresh Kumar wrote:
>> On 26 November 2012 17:15, Paul Carpenter
>> <paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org> wrote:
>>> Unless you know why the bus is stuck, how can you reset reminder this
>>> method ONLY works if SCL is high and SDA probably was low and the slave
>>> device is what is stuck in wrong state. NOTE SCL and SDA high can be
>>> considered as BUS IDLE or having passed SDA = 1 waiting next clock edge
>>> or state transition without other state information.
....

>>> In over 10 years of using I2C in various forms the only times I have
>>> seen bus stuck or device in wrong state
>>>
>>> 1/ Some code changed a bus switch when Bus was NOT idle
>>>         i.e mid transaction
> not sure what you mean here. Does it include a (SoC i.e. i2c master)
> reset while the bus is not idle? That's the problem I was faced with
> some time ago.

In this case the I2C master was in an ASIC undergoing manufacturing test
and the system controlling the tests and monitoring results had an
EEPROM and EEPROM emulator only one could be switched in at any time.
At current production rates the particular EEPROM will run out of
allowable write cycles in a day and become unreliable for calibrated
test system. Hence the EEPROM emulator, manufacturer wanted to be able
to switch the i2c bus in use but did not synchronise the switching to
bus idle so two devices would lock up, one the EEPROM halfway through
transaction and the emulator because it got out of sync garbage.

Despite the FPGA having the software programmable functions to switch
correctly, they were not used.

Anything more than that and "I would have to shoot you afterwards" :-)

>>> 2/ Bit-banged I2C software was wrong incomplete transaction
>>> 3/ Short on bus
>>> 4/ Faulty device
>>> 5/ Faulty design so 1 and 0 thresholds were compromised
> I can add:
> 6/ device does clock stretching which is not detected/supported by the
>    bus master
> 7/ clock frequency too high for a device

Yep those can happen as well but I tend to deal mainly with embedded
systems so all clock speeds and clock stretching are none before hand.

> In reply to a more detailed problem report that should be addressed by
> this series on spear-devel I asked a few questions to rule out 6/ and
> 7/. I cannot find it in an public accessible archive though. It's about
> a sta529 codec. When switching sample rates the codec then holds down
> SDA. After an additional clock pulse the device and bus are OK again.

I mainly see clock stretching issues, but try to design them out by
different devices or controllers.

> Best regards
> Uwe
> 


-- 
Paul Carpenter          | paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org
<http://www.pcserviceselectronics.co.uk/>    PC Services
<http://www.pcserviceselectronics.co.uk/fonts/> Timing Diagram Font
<http://www.gnuh8.org.uk/>  GNU H8 - compiler & Renesas H8/H8S/H8 Tiny
<http://www.badweb.org.uk/> For those web sites you hate

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]                     ` <20121126202003.GA3384-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  2012-11-26 23:00                       ` Paul Carpenter
@ 2012-11-27  5:49                       ` Viresh Kumar
       [not found]                         ` <CAKohpokgcvaSHNDoN2epnsxSmpKJ6GaWph0EW+rrkCfXjBrUyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  1 sibling, 1 reply; 12+ messages in thread
From: Viresh Kumar @ 2012-11-27  5:49 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Paul Carpenter, w.sang-bIcnvbaLZ9MEGnE8C9+IrQ,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

On 27 November 2012 01:50, Uwe Kleine-König
<u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> In reply to a more detailed problem report that should be addressed by
> this series on spear-devel I asked a few questions to rule out 6/ and
> 7/. I cannot find it in an public accessible archive though. It's about
> a sta529 codec. When switching sample rates the codec then holds down
> SDA. After an additional clock pulse the device and bus are OK again.

Thanks for adding these here :)

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure
       [not found]                         ` <CAKohpokgcvaSHNDoN2epnsxSmpKJ6GaWph0EW+rrkCfXjBrUyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2012-11-30 14:05                           ` Wolfram Sang
  0 siblings, 0 replies; 12+ messages in thread
From: Wolfram Sang @ 2012-11-30 14:05 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Uwe Kleine-König, Paul Carpenter,
	khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	spear-devel-nkJGhpqTU55BDgjK7y7TUQ

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

On Tue, Nov 27, 2012 at 11:19:09AM +0530, Viresh Kumar wrote:
> On 27 November 2012 01:50, Uwe Kleine-König
> <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > In reply to a more detailed problem report that should be addressed by
> > this series on spear-devel I asked a few questions to rule out 6/ and
> > 7/. I cannot find it in an public accessible archive though. It's about
> > a sta529 codec. When switching sample rates the codec then holds down
> > SDA. After an additional clock pulse the device and bus are OK again.
> 
> Thanks for adding these here :)

Hmm, the points mentioned seem valid to me.

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-11-30 14:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-25  6:31 [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
     [not found] ` <71e27515a050a2c7d18272b84ff7ec3ec8b11cae.1353824555.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-11-25  6:31   ` [PATCH V7 2/2] i2c/designware: Provide i2c bus recovery support Viresh Kumar
2012-11-25 11:52   ` [PATCH V7 1/2] i2c/adapter: Add bus recovery infrastructure Paul Carpenter
     [not found]     ` <50B20670.5070509-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
2012-11-26  2:28       ` Viresh Kumar
     [not found]         ` <CAKohpo=_2xwj+NCpZPB1EsWiGPLafc3XKVbRT+690AkHB76AWw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-26 11:45           ` Paul Carpenter
     [not found]             ` <50B35642.7030104-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
2012-11-26 12:51               ` Viresh Kumar
     [not found]                 ` <CAKohpomNTKFJQCrZdC81OiQpjdtK85XXWfvvB=XYb85e49OBZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-26 13:28                   ` Paul Carpenter
     [not found]                     ` <50B36E76.6010008-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
2012-11-26 14:51                       ` Viresh Kumar
2012-11-26 20:20                   ` Uwe Kleine-König
     [not found]                     ` <20121126202003.GA3384-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-11-26 23:00                       ` Paul Carpenter
2012-11-27  5:49                       ` Viresh Kumar
     [not found]                         ` <CAKohpokgcvaSHNDoN2epnsxSmpKJ6GaWph0EW+rrkCfXjBrUyA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-11-30 14:05                           ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.