* [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
@ 2013-01-25 9:47 Viresh Kumar
[not found] ` <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-01-25 9:47 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,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, 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.
Reviewed-by: Paul Carpenter <paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
Signed-off-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
V9->V10:
- Check sda value at the begining of loop to guarantee that we are not trying to
clock a working bus.
- Remove clk_delay variable, do the calculation in advance and create
RECOVERY_NDELAY macro for it
- Fix grammer and casing of few strings
- check get_scl() too at the begining as it was mandatory for SCL type recovery
drivers/i2c/i2c-core.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/i2c.h | 40 +++++++++++++
2 files changed, 196 insertions(+)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e388590..24c8a1e 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>
@@ -109,6 +111,128 @@ 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 */
+static int get_scl_gpio_value(struct i2c_adapter *adap)
+{
+ return gpio_get_value(adap->bus_recovery_info->scl_gpio);
+}
+
+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->get_sda) {
+ if (gpio_request_one(bri->sda_gpio, GPIOF_IN, "i2c-sda")) {
+ /* work without SDA polling */
+ dev_warn(dev, "can't get SDA: %d. not using SDA polling\n",
+ bri->sda_gpio);
+ bri->get_sda = NULL;
+ }
+ }
+
+ 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->get_sda)
+ gpio_free(bri->sda_gpio);
+
+ gpio_free(bri->scl_gpio);
+}
+
+/*
+ * We need to provide delay after every half clock pulse,
+ * delay in ns = (10^6/ 100 KHz)/2
+ */
+#define RECOVERY_CLK_CNT 9
+#define RECOVERY_NDELAY 5000
+static int i2c_generic_recovery(struct i2c_adapter *adap)
+{
+ struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
+ int i = 0, val = 1, ret = 0;
+
+ if (bri->prepare_recovery)
+ bri->prepare_recovery(bri);
+
+ /*
+ * By this time SCL is high, as we need to give 9 falling-rising edges
+ */
+ while (i++ < RECOVERY_CLK_CNT * 2) {
+ if (val) {
+ /* break if SDA got high */
+ if (bri->get_sda && bri->get_sda(adap))
+ break;
+ /* SCL shouldn't be low here */
+ if (!bri->get_scl(adap)) {
+ dev_err(&adap->dev,
+ "SCL is stuck low exit recovery\n");
+ ret = -EBUSY;
+ break;
+ }
+ }
+
+ val = !val;
+ bri->set_scl(adap, val);
+ ndelay(RECOVERY_NDELAY);
+ }
+
+ if (bri->unprepare_recovery)
+ bri->unprepare_recovery(bri);
+
+ return ret;
+}
+
+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;
+}
+
+int i2c_recover_bus(struct i2c_adapter *adap)
+{
+ if (!adap->bus_recovery_info)
+ return -EOPNOTSUPP;
+
+ dev_dbg(&adap->dev, "trying i2c bus recovery\n");
+ return adap->bus_recovery_info->recover_bus(adap);
+}
+
static int i2c_device_probe(struct device *dev)
{
struct i2c_client *client = i2c_verify_client(dev);
@@ -902,6 +1026,38 @@ 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, "No recover_bus(), not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ goto exit_recovery;
+ }
+
+ /* GPIO recovery */
+ if (bri->recover_bus == i2c_generic_gpio_recovery) {
+ if (!gpio_is_valid(bri->scl_gpio)) {
+ dev_err(&adap->dev, "Invalid SCL gpio, not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ goto exit_recovery;
+ }
+
+ if (gpio_is_valid(bri->sda_gpio))
+ bri->get_sda = get_sda_gpio_value;
+ else
+ bri->get_sda = NULL;
+
+ bri->get_scl = get_scl_gpio_value;
+ bri->set_scl = set_scl_gpio_value;
+ } else if (!bri->set_scl || !bri->get_scl) {
+ dev_warn(&adap->dev,
+ "set_scl() is must for SCL recovery\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 d0c4db7..05a1966 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -370,6 +370,44 @@ 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().
+ * @get_scl: This gets current value of SCL line. Mandatory for generic SCL
+ * recovery. Used internally for generic GPIO recovery.
+ * @set_scl: This sets/clears SCL line. Mandatory for generic SCL recovery. Used
+ * internally for generic GPIO recovery.
+ * @get_sda: This gets current value of SDA line. Optional for generic SCL
+ * recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO
+ * recovery.
+ * @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 *);
+
+ int (*get_scl)(struct i2c_adapter *);
+ 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);
+int i2c_recover_bus(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.
@@ -393,6 +431,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] 16+ messages in thread
* [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support
[not found] ` <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2013-01-25 9:47 ` Viresh Kumar
[not found] ` <f7d8d29a338704deaa7a542f9a213fc7696625c9.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-01-25 9:48 ` [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
2013-01-25 11:13 ` Wolfram Sang
2 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-01-25 9:47 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,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, 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 to 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>
---
V9->V10: None
drivers/i2c/busses/i2c-designware-core.c | 5 ++++-
drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index f5258c2..d0423ef 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -539,7 +539,10 @@ 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 (i2c_recover_bus(adap) < 0)
+ i2c_dw_init(dev);
+
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 343357a..9142f0c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -141,6 +141,12 @@ static int dw_i2c_probe(struct platform_device *pdev)
adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;
+ /* Bus recovery support */
+ adap->bus_recovery_info = dev_get_platdata(&pdev->dev);
+ if (adap->bus_recovery_info)
+ adap->bus_recovery_info->recover_bus =
+ i2c_generic_gpio_recovery;
+
adap->nr = pdev->id;
r = i2c_add_numbered_adapter(adap);
if (r) {
--
1.7.12.rc2.18.g61b472e
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-01-25 9:47 ` [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support Viresh Kumar
@ 2013-01-25 9:48 ` Viresh Kumar
2013-01-25 11:13 ` Wolfram Sang
2 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-01-25 9:48 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,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Viresh Kumar
[-- Attachment #1: Type: text/plain, Size: 873 bytes --]
On 25 January 2013 15:17, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> 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
>
> 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.
ARM mail servers are still broken. Please apply attached patches.
[-- Attachment #2: 0001-i2c-adapter-Add-bus-recovery-infrastructure.patch --]
[-- Type: application/octet-stream, Size: 8683 bytes --]
From 59a73d182bf1ce330becf32ad780f3501a57aed0 Mon Sep 17 00:00:00 2001
Message-Id: <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar@linaro.org>
From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Tue, 28 Feb 2012 18:26:31 +0530
Subject: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
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.
Reviewed-by: Paul Carpenter <paul@pcserviceselectronics.co.uk>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V9->V10:
- Check sda value at the begining of loop to guarantee that we are not trying to
clock a working bus.
- Remove clk_delay variable, do the calculation in advance and create
RECOVERY_NDELAY macro for it
- Fix grammer and casing of few strings
- check get_scl() too at the begining as it was mandatory for SCL type recovery
drivers/i2c/i2c-core.c | 156 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/i2c.h | 40 +++++++++++++
2 files changed, 196 insertions(+)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e388590..24c8a1e 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>
@@ -109,6 +111,128 @@ 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 */
+static int get_scl_gpio_value(struct i2c_adapter *adap)
+{
+ return gpio_get_value(adap->bus_recovery_info->scl_gpio);
+}
+
+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->get_sda) {
+ if (gpio_request_one(bri->sda_gpio, GPIOF_IN, "i2c-sda")) {
+ /* work without SDA polling */
+ dev_warn(dev, "can't get SDA: %d. not using SDA polling\n",
+ bri->sda_gpio);
+ bri->get_sda = NULL;
+ }
+ }
+
+ 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->get_sda)
+ gpio_free(bri->sda_gpio);
+
+ gpio_free(bri->scl_gpio);
+}
+
+/*
+ * We need to provide delay after every half clock pulse,
+ * delay in ns = (10^6/ 100 KHz)/2
+ */
+#define RECOVERY_CLK_CNT 9
+#define RECOVERY_NDELAY 5000
+static int i2c_generic_recovery(struct i2c_adapter *adap)
+{
+ struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
+ int i = 0, val = 1, ret = 0;
+
+ if (bri->prepare_recovery)
+ bri->prepare_recovery(bri);
+
+ /*
+ * By this time SCL is high, as we need to give 9 falling-rising edges
+ */
+ while (i++ < RECOVERY_CLK_CNT * 2) {
+ if (val) {
+ /* break if SDA got high */
+ if (bri->get_sda && bri->get_sda(adap))
+ break;
+ /* SCL shouldn't be low here */
+ if (!bri->get_scl(adap)) {
+ dev_err(&adap->dev,
+ "SCL is stuck low exit recovery\n");
+ ret = -EBUSY;
+ break;
+ }
+ }
+
+ val = !val;
+ bri->set_scl(adap, val);
+ ndelay(RECOVERY_NDELAY);
+ }
+
+ if (bri->unprepare_recovery)
+ bri->unprepare_recovery(bri);
+
+ return ret;
+}
+
+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;
+}
+
+int i2c_recover_bus(struct i2c_adapter *adap)
+{
+ if (!adap->bus_recovery_info)
+ return -EOPNOTSUPP;
+
+ dev_dbg(&adap->dev, "trying i2c bus recovery\n");
+ return adap->bus_recovery_info->recover_bus(adap);
+}
+
static int i2c_device_probe(struct device *dev)
{
struct i2c_client *client = i2c_verify_client(dev);
@@ -902,6 +1026,38 @@ 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, "No recover_bus(), not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ goto exit_recovery;
+ }
+
+ /* GPIO recovery */
+ if (bri->recover_bus == i2c_generic_gpio_recovery) {
+ if (!gpio_is_valid(bri->scl_gpio)) {
+ dev_err(&adap->dev, "Invalid SCL gpio, not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ goto exit_recovery;
+ }
+
+ if (gpio_is_valid(bri->sda_gpio))
+ bri->get_sda = get_sda_gpio_value;
+ else
+ bri->get_sda = NULL;
+
+ bri->get_scl = get_scl_gpio_value;
+ bri->set_scl = set_scl_gpio_value;
+ } else if (!bri->set_scl || !bri->get_scl) {
+ dev_warn(&adap->dev,
+ "set_scl() is must for SCL recovery\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 d0c4db7..05a1966 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -370,6 +370,44 @@ 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().
+ * @get_scl: This gets current value of SCL line. Mandatory for generic SCL
+ * recovery. Used internally for generic GPIO recovery.
+ * @set_scl: This sets/clears SCL line. Mandatory for generic SCL recovery. Used
+ * internally for generic GPIO recovery.
+ * @get_sda: This gets current value of SDA line. Optional for generic SCL
+ * recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO
+ * recovery.
+ * @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 *);
+
+ int (*get_scl)(struct i2c_adapter *);
+ 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);
+int i2c_recover_bus(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.
@@ -393,6 +431,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
[-- Attachment #3: 0002-i2c-designware-Provide-i2c-bus-recovery-support.patch --]
[-- Type: application/octet-stream, Size: 2342 bytes --]
From f7d8d29a338704deaa7a542f9a213fc7696625c9 Mon Sep 17 00:00:00 2001
Message-Id: <f7d8d29a338704deaa7a542f9a213fc7696625c9.1359106966.git.viresh.kumar@linaro.org>
In-Reply-To: <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar@linaro.org>
References: <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar@linaro.org>
From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Wed, 29 Feb 2012 23:16:15 +0530
Subject: [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support
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 to designware I2C controller.
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
V9->V10: None
drivers/i2c/busses/i2c-designware-core.c | 5 ++++-
drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index f5258c2..d0423ef 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -539,7 +539,10 @@ 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 (i2c_recover_bus(adap) < 0)
+ i2c_dw_init(dev);
+
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 343357a..9142f0c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -141,6 +141,12 @@ static int dw_i2c_probe(struct platform_device *pdev)
adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;
+ /* Bus recovery support */
+ adap->bus_recovery_info = dev_get_platdata(&pdev->dev);
+ if (adap->bus_recovery_info)
+ adap->bus_recovery_info->recover_bus =
+ i2c_generic_gpio_recovery;
+
adap->nr = pdev->id;
r = i2c_add_numbered_adapter(adap);
if (r) {
--
1.7.12.rc2.18.g61b472e
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-01-25 9:47 ` [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support Viresh Kumar
2013-01-25 9:48 ` [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
@ 2013-01-25 11:13 ` Wolfram Sang
[not found] ` <20130125111322.GA2649-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2 siblings, 1 reply; 16+ messages in thread
From: Wolfram Sang @ 2013-01-25 11:13 UTC (permalink / raw)
To: Viresh Kumar
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg
[-- Attachment #1: Type: text/plain, Size: 1877 bytes --]
On Fri, Jan 25, 2013 at 03:17:48PM +0530, 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
>
> 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.
>
> Reviewed-by: Paul Carpenter <paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org>
> Signed-off-by: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Code-wise I am mostly satisfied, except that I need to think about
clock-stretching a little more. We could add that later, too.
However, while I understand you are keen to get rid of this series ASAP,
it seems that this eagerness results in some sloppyness which is a bit
cumbersome (most lines changed since last time have something to comment
on).
So, I'll try a different review style this time and let you do the
detective work :)
1) Please be strict and consistent with spaces around operators.
2) Make sure the warnings and printouts match the code
3) Take the printouts serious and invest a thought if they can be
further improved.
Regards,
Wolfram
--
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] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <20130125111322.GA2649-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2013-01-26 5:13 ` Viresh Kumar
[not found] ` <CAKohpok2arxhsAt3xOxRCZZjvLMTed1EYX3ZRUSQ3733wx2mMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-01-26 5:13 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg
[-- Attachment #1: Type: text/plain, Size: 5289 bytes --]
On 25 January 2013 16:43, Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> Code-wise I am mostly satisfied, except that I need to think about
> clock-stretching a little more. We could add that later, too.
Great!!
> However, while I understand you are keen to get rid of this series ASAP,
> it seems that this eagerness results in some sloppyness which is a bit
> cumbersome (most lines changed since last time have something to comment
> on).
:(
> So, I'll try a different review style this time and let you do the
> detective work :)
>
> 1) Please be strict and consistent with spaces around operators.
Sorry, but i couldn't find any such issues in code (but were there
in a comment)
> 2) Make sure the warnings and printouts match the code
> 3) Take the printouts serious and invest a thought if they can be
> further improved.
I have looked them again and attached are the final patches.
Following are the improvements i have:
Author: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Date: Sat Jan 26 10:31:42 2013 +0530
fixup! i2c/adapter: Add bus recovery infrastructure
---
drivers/i2c/i2c-core.c | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 24c8a1e..3ec040e 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -136,14 +136,14 @@ static int i2c_get_gpios_for_recovery(struct
i2c_adapter *adap)
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);
+ dev_warn(dev, "Can't get SCL gpio: %d\n", bri->scl_gpio);
return ret;
}
if (bri->get_sda) {
if (gpio_request_one(bri->sda_gpio, GPIOF_IN, "i2c-sda")) {
/* work without SDA polling */
- dev_warn(dev, "can't get SDA: %d. not using
SDA polling\n",
+ dev_warn(dev, "Can't get SDA gpio: %d. Not
using SDA polling\n",
bri->sda_gpio);
bri->get_sda = NULL;
}
@@ -163,8 +163,11 @@ static void i2c_put_gpios_for_recovery(struct
i2c_adapter *adap)
}
/*
- * We need to provide delay after every half clock pulse,
- * delay in ns = (10^6/ 100 KHz)/2
+ * We are generating clock pulse. ndelay() would decide durating of clk pulse.
+ * We will generate clock with rate 100 KHz and so duration of both
clock levels
+ * would be:
+ *
+ * delay in ns = (10^6 / 100) / 2
*/
#define RECOVERY_CLK_CNT 9
#define RECOVERY_NDELAY 5000
@@ -181,13 +184,13 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
*/
while (i++ < RECOVERY_CLK_CNT * 2) {
if (val) {
- /* break if SDA got high */
+ /* Break if SDA is high */
if (bri->get_sda && bri->get_sda(adap))
break;
/* SCL shouldn't be low here */
if (!bri->get_scl(adap)) {
dev_err(&adap->dev,
- "SCL is stuck low exit recovery\n");
+ "SCL is stuck low, exit recovery\n");
ret = -EBUSY;
break;
}
@@ -229,7 +232,7 @@ int i2c_recover_bus(struct i2c_adapter *adap)
if (!adap->bus_recovery_info)
return -EOPNOTSUPP;
- dev_dbg(&adap->dev, "trying i2c bus recovery\n");
+ dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
return adap->bus_recovery_info->recover_bus(adap);
}
@@ -1031,12 +1034,12 @@ static int i2c_register_adapter(struct
i2c_adapter *adap)
struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
if (!bri->recover_bus) {
- dev_err(&adap->dev, "No recover_bus(), not
using recovery\n");
+ dev_err(&adap->dev, "No recover_bus() found,
not using recovery\n");
adap->bus_recovery_info = NULL;
goto exit_recovery;
}
- /* GPIO recovery */
+ /* Generic GPIO recovery */
if (bri->recover_bus == i2c_generic_gpio_recovery) {
if (!gpio_is_valid(bri->scl_gpio)) {
dev_err(&adap->dev, "Invalid SCL gpio,
not using recovery\n");
@@ -1052,8 +1055,9 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
bri->get_scl = get_scl_gpio_value;
bri->set_scl = set_scl_gpio_value;
} else if (!bri->set_scl || !bri->get_scl) {
- dev_warn(&adap->dev,
- "set_scl() is must for SCL recovery\n");
+ /* Generic SCL recovery */
+ dev_err(&adap->dev, "No get[set]_gpio() found,
not using recovery\n");
+ adap->bus_recovery_info = NULL;
}
}
[-- Attachment #2: 0001-i2c-adapter-Add-bus-recovery-infrastructure.patch --]
[-- Type: application/octet-stream, Size: 8558 bytes --]
From 68f1dea5e585a7cf4d719232ff94c02aef8620e6 Mon Sep 17 00:00:00 2001
Message-Id: <68f1dea5e585a7cf4d719232ff94c02aef8620e6.1359177099.git.viresh.kumar@linaro.org>
From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Tue, 28 Feb 2012 18:26:31 +0530
Subject: [PATCH V11 1/2] i2c/adapter: Add bus recovery infrastructure
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.
Reviewed-by: Paul Carpenter <paul@pcserviceselectronics.co.uk>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/i2c/i2c-core.c | 160 +++++++++++++++++++++++++++++++++++++++++++++++++
include/linux/i2c.h | 40 +++++++++++++
2 files changed, 200 insertions(+)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e388590..3ec040e 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>
@@ -109,6 +111,131 @@ 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 */
+static int get_scl_gpio_value(struct i2c_adapter *adap)
+{
+ return gpio_get_value(adap->bus_recovery_info->scl_gpio);
+}
+
+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, "Can't get SCL gpio: %d\n", bri->scl_gpio);
+ return ret;
+ }
+
+ if (bri->get_sda) {
+ if (gpio_request_one(bri->sda_gpio, GPIOF_IN, "i2c-sda")) {
+ /* work without SDA polling */
+ dev_warn(dev, "Can't get SDA gpio: %d. Not using SDA polling\n",
+ bri->sda_gpio);
+ bri->get_sda = NULL;
+ }
+ }
+
+ 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->get_sda)
+ gpio_free(bri->sda_gpio);
+
+ gpio_free(bri->scl_gpio);
+}
+
+/*
+ * We are generating clock pulse. ndelay() would decide durating of clk pulse.
+ * We will generate clock with rate 100 KHz and so duration of both clock levels
+ * would be:
+ *
+ * delay in ns = (10^6 / 100) / 2
+ */
+#define RECOVERY_CLK_CNT 9
+#define RECOVERY_NDELAY 5000
+static int i2c_generic_recovery(struct i2c_adapter *adap)
+{
+ struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
+ int i = 0, val = 1, ret = 0;
+
+ if (bri->prepare_recovery)
+ bri->prepare_recovery(bri);
+
+ /*
+ * By this time SCL is high, as we need to give 9 falling-rising edges
+ */
+ while (i++ < RECOVERY_CLK_CNT * 2) {
+ if (val) {
+ /* Break if SDA is high */
+ if (bri->get_sda && bri->get_sda(adap))
+ break;
+ /* SCL shouldn't be low here */
+ if (!bri->get_scl(adap)) {
+ dev_err(&adap->dev,
+ "SCL is stuck low, exit recovery\n");
+ ret = -EBUSY;
+ break;
+ }
+ }
+
+ val = !val;
+ bri->set_scl(adap, val);
+ ndelay(RECOVERY_NDELAY);
+ }
+
+ if (bri->unprepare_recovery)
+ bri->unprepare_recovery(bri);
+
+ return ret;
+}
+
+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;
+}
+
+int i2c_recover_bus(struct i2c_adapter *adap)
+{
+ if (!adap->bus_recovery_info)
+ return -EOPNOTSUPP;
+
+ dev_dbg(&adap->dev, "Trying i2c bus recovery\n");
+ return adap->bus_recovery_info->recover_bus(adap);
+}
+
static int i2c_device_probe(struct device *dev)
{
struct i2c_client *client = i2c_verify_client(dev);
@@ -902,6 +1029,39 @@ 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, "No recover_bus() found, not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ goto exit_recovery;
+ }
+
+ /* Generic GPIO recovery */
+ if (bri->recover_bus == i2c_generic_gpio_recovery) {
+ if (!gpio_is_valid(bri->scl_gpio)) {
+ dev_err(&adap->dev, "Invalid SCL gpio, not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ goto exit_recovery;
+ }
+
+ if (gpio_is_valid(bri->sda_gpio))
+ bri->get_sda = get_sda_gpio_value;
+ else
+ bri->get_sda = NULL;
+
+ bri->get_scl = get_scl_gpio_value;
+ bri->set_scl = set_scl_gpio_value;
+ } else if (!bri->set_scl || !bri->get_scl) {
+ /* Generic SCL recovery */
+ dev_err(&adap->dev, "No get[set]_gpio() found, not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ }
+ }
+
+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 d0c4db7..05a1966 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -370,6 +370,44 @@ 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().
+ * @get_scl: This gets current value of SCL line. Mandatory for generic SCL
+ * recovery. Used internally for generic GPIO recovery.
+ * @set_scl: This sets/clears SCL line. Mandatory for generic SCL recovery. Used
+ * internally for generic GPIO recovery.
+ * @get_sda: This gets current value of SDA line. Optional for generic SCL
+ * recovery. Used internally, if sda_gpio is a valid GPIO, for generic GPIO
+ * recovery.
+ * @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 *);
+
+ int (*get_scl)(struct i2c_adapter *);
+ 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);
+int i2c_recover_bus(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.
@@ -393,6 +431,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
[-- Attachment #3: 0002-i2c-designware-Provide-i2c-bus-recovery-support.patch --]
[-- Type: application/octet-stream, Size: 2327 bytes --]
From 6ea3f443f668ca87dc3ec1f302551c30d532e5c1 Mon Sep 17 00:00:00 2001
Message-Id: <6ea3f443f668ca87dc3ec1f302551c30d532e5c1.1359177099.git.viresh.kumar@linaro.org>
In-Reply-To: <68f1dea5e585a7cf4d719232ff94c02aef8620e6.1359177099.git.viresh.kumar@linaro.org>
References: <68f1dea5e585a7cf4d719232ff94c02aef8620e6.1359177099.git.viresh.kumar@linaro.org>
From: Viresh Kumar <viresh.kumar@linaro.org>
Date: Wed, 29 Feb 2012 23:16:15 +0530
Subject: [PATCH V11 2/2] i2c/designware: Provide i2c bus recovery support
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 to designware I2C controller.
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@st.com>
Signed-off-by: Shiraz Hashim <shiraz.hashim@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/i2c/busses/i2c-designware-core.c | 5 ++++-
drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index f5258c2..d0423ef 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -539,7 +539,10 @@ 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 (i2c_recover_bus(adap) < 0)
+ i2c_dw_init(dev);
+
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 343357a..9142f0c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -141,6 +141,12 @@ static int dw_i2c_probe(struct platform_device *pdev)
adap->dev.parent = &pdev->dev;
adap->dev.of_node = pdev->dev.of_node;
+ /* Bus recovery support */
+ adap->bus_recovery_info = dev_get_platdata(&pdev->dev);
+ if (adap->bus_recovery_info)
+ adap->bus_recovery_info->recover_bus =
+ i2c_generic_gpio_recovery;
+
adap->nr = pdev->id;
r = i2c_add_numbered_adapter(adap);
if (r) {
--
1.7.12.rc2.18.g61b472e
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <CAKohpok2arxhsAt3xOxRCZZjvLMTed1EYX3ZRUSQ3733wx2mMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-01-31 2:28 ` Viresh Kumar
[not found] ` <CAKohpokNVPOvAc=Gbxn4ZquPnG4huukDmwhOsqaV51p0aRo8xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-01-31 2:28 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg
On 26 January 2013 10:43, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> I have looked them again and attached are the final patches.
> Following are the improvements i have:
>
> Author: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> Date: Sat Jan 26 10:31:42 2013 +0530
>
> fixup! i2c/adapter: Add bus recovery infrastructure
Hi Wolfram,
Any inputs ?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <CAKohpokNVPOvAc=Gbxn4ZquPnG4huukDmwhOsqaV51p0aRo8xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-15 8:51 ` Viresh Kumar
[not found] ` <CAKohpokCqe7LHFMn0t7EivTQ7US9Fp=07nowGP2H2ujeDKbHXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-03-15 8:51 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Andrew Morton
On 31 January 2013 07:58, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On 26 January 2013 10:43, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> I have looked them again and attached are the final patches.
>> Following are the improvements i have:
>>
>> Author: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> Date: Sat Jan 26 10:31:42 2013 +0530
>>
>> fixup! i2c/adapter: Add bus recovery infrastructure
>
> Hi Wolfram,
>
> Any inputs ?
Hi Wolfram,
We have already spent lot of time reviewing this patchset (more than a year),
its better we take it now and patch then for any improvements.
What do you say?
--
viresh
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <CAKohpokCqe7LHFMn0t7EivTQ7US9Fp=07nowGP2H2ujeDKbHXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-15 9:13 ` Viresh Kumar
[not found] ` <CAKohpondDBBjTQYgV9XOFMYp_aKO+SdeRR1gjxe1ovTLuOm2Wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-03-15 9:13 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Andrew Morton
Fixing Wolfram's email id.
On 15 March 2013 14:21, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On 31 January 2013 07:58, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> On 26 January 2013 10:43, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>> I have looked them again and attached are the final patches.
>>> Following are the improvements i have:
>>>
>>> Author: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>>> Date: Sat Jan 26 10:31:42 2013 +0530
>>>
>>> fixup! i2c/adapter: Add bus recovery infrastructure
>>
>> Hi Wolfram,
>>
>> Any inputs ?
>
> Hi Wolfram,
>
> We have already spent lot of time reviewing this patchset (more than a year),
> its better we take it now and patch then for any improvements.
>
> What do you say?
>
> --
> viresh
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <CAKohpondDBBjTQYgV9XOFMYp_aKO+SdeRR1gjxe1ovTLuOm2Wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-21 9:36 ` Wolfram Sang
[not found] ` <20130321093648.GA19297-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Wolfram Sang @ 2013-03-21 9:36 UTC (permalink / raw)
To: Viresh Kumar
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Andrew Morton
Viresh,
I applied V11 of the core changes with minor modifications. I do wonder
about the hook in the designware driver. You apply the recovery on
transfer timeout. I think this should go into the timeout of
i2c_dw_wait_bus_not_busy()?
Thanks,
Wolfram
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <20130321093648.GA19297-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
@ 2013-03-21 10:15 ` Viresh Kumar
[not found] ` <CAKohpo=NdN64bJ_uD4cZ_aJppz+zschYFMyoP=-2c+NfuOqFfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-24 14:07 ` Viresh Kumar
1 sibling, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-03-21 10:15 UTC (permalink / raw)
To: Wolfram Sang, Rajeev kumar, Shiraz HASHIM
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Andrew Morton
On 21 March 2013 15:06, Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> wrote:
> I applied V11 of the core changes with minor modifications.
Wow!! Thanks.
> I do wonder
> about the hook in the designware driver. You apply the recovery on
> transfer timeout. I think this should go into the timeout of
> i2c_dw_wait_bus_not_busy()?
Hmm.. Rajeev/Shiraz were the guys who tested this code earlier and i am
sure we were failing in this piece of code, which i just fixed and so
i2c_dw_wait_bus_not_busy() didn't fail for us.
Below is a conversation that we had with Uwe some time back on the exact
problem we faced and it was a bit different from the traditional problem.
So, maybe we need bus recovery at both places: i2c_dw_wait_bus_not_busy()
(for the traditional hang) and during transfer (for our case).
--
viresh
> On 7 November 2012 18:53, Uwe Kleine-König
> <u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > Hello Viresh,
> >
> > in our irc conversation you told that the SDA signal being stuck low
> > happened with an sta529 audio codec. I quickly scanned over its
> > datasheet (Doc ID 13095 Rev 3; March 2012).
> >
> > Some questions that come to my mind regarding your issue:
> > - What is the situation the stall occurs? How do you reproduce?
I2C data lines are permanently held low by the slave device
(sta529 codec in this case).
There is a fixed way in which we can always reproduce it. The
codec can support different sample rate. As soon as we switch from
one sample rate to another (and accordingly re-configure sta529),
this happens.
> > - I didn't find a specification of the allowed i2c clock frequency. Do
> > you have a different document that specifies this? (Or maybe I just
> > missed it?!) I assume you're using the device in the right range?
sta529 can work in fast mode at 400 KHz without any issues.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <CAKohpo=NdN64bJ_uD4cZ_aJppz+zschYFMyoP=-2c+NfuOqFfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-03-21 10:34 ` Shiraz Hashim
0 siblings, 0 replies; 16+ messages in thread
From: Shiraz Hashim @ 2013-03-21 10:34 UTC (permalink / raw)
To: Viresh Kumar
Cc: Wolfram Sang, Rajeev kumar,
u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Andrew Morton
On Thu, Mar 21, 2013 at 03:45:29PM +0530, Viresh Kumar wrote:
> On 21 March 2013 15:06, Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> wrote:
> > I applied V11 of the core changes with minor modifications.
>
> Wow!! Thanks.
>
> > I do wonder
> > about the hook in the designware driver. You apply the recovery on
> > transfer timeout. I think this should go into the timeout of
> > i2c_dw_wait_bus_not_busy()?
>
> Hmm.. Rajeev/Shiraz were the guys who tested this code earlier and i am
> sure we were failing in this piece of code, which i just fixed and so
> i2c_dw_wait_bus_not_busy() didn't fail for us.
>
> Below is a conversation that we had with Uwe some time back on the exact
> problem we faced and it was a bit different from the traditional problem.
>
> So, maybe we need bus recovery at both places: i2c_dw_wait_bus_not_busy()
> (for the traditional hang) and during transfer (for our case).
DW_IC_STATUS_ACTIVITY check in i2c_dw_wait_bus_not_busy actually
only represents controller activity status and has nothing to do
with real bus status.
--
regards
Shiraz
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <20130321093648.GA19297-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-03-21 10:15 ` Viresh Kumar
@ 2013-03-24 14:07 ` Viresh Kumar
[not found] ` <CAKohpokQY=g1eUrwwydA4mMruebt2xZinLPCL5_+mkg4oediEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
1 sibling, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-03-24 14:07 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Andrew Morton
On 21 March 2013 15:06, Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> wrote:
> I applied V11 of the core changes with minor modifications. I do wonder
I can't find it linux-next or here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure
[not found] ` <CAKohpokQY=g1eUrwwydA4mMruebt2xZinLPCL5_+mkg4oediEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-04-01 6:45 ` Viresh Kumar
0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-04-01 6:45 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Andrew Morton
On 24 March 2013 19:37, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On 21 March 2013 15:06, Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org> wrote:
>> I applied V11 of the core changes with minor modifications. I do wonder
>
> I can't find it linux-next or here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git
I can see it now in your for-next branch, thanks.
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support
[not found] ` <f7d8d29a338704deaa7a542f9a213fc7696625c9.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
@ 2013-04-05 6:42 ` Viresh Kumar
[not found] ` <CAKohpom=DQDv6v7xwnCRvtWBxC+a5mGZeOv=ad8AjKwV2yGBow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-04-05 6:42 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Viresh Kumar,
Vincenzo Frascino, Shiraz Hashim
Hi Wolfram,
On 25 January 2013 15:17, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> 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 to 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>
> ---
> V9->V10: None
>
> drivers/i2c/busses/i2c-designware-core.c | 5 ++++-
> drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++++
> 2 files changed, 10 insertions(+), 1 deletion(-)
Can you apply this one too?
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support
[not found] ` <CAKohpom=DQDv6v7xwnCRvtWBxC+a5mGZeOv=ad8AjKwV2yGBow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-05-13 9:18 ` Viresh Kumar
[not found] ` <CAKohpokAPohg2aAjawLN2t_Jh29CZAuiWqKz2ah-bJP9Dw4YvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
0 siblings, 1 reply; 16+ messages in thread
From: Viresh Kumar @ 2013-05-13 9:18 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Viresh Kumar,
Vincenzo Frascino, Shiraz Hashim
On 5 April 2013 12:12, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> Hi Wolfram,
>
> On 25 January 2013 15:17, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> 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 to 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>
>> ---
>> V9->V10: None
>>
>> drivers/i2c/busses/i2c-designware-core.c | 5 ++++-
>> drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++++
>> 2 files changed, 10 insertions(+), 1 deletion(-)
>
> Can you apply this one too?
Ping!!
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support
[not found] ` <CAKohpokAPohg2aAjawLN2t_Jh29CZAuiWqKz2ah-bJP9Dw4YvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2013-05-31 10:50 ` Viresh Kumar
0 siblings, 0 replies; 16+ messages in thread
From: Viresh Kumar @ 2013-05-31 10:50 UTC (permalink / raw)
To: Wolfram Sang
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ,
khali-PUYAD+kWke1g9hUCZPvPmw, ben-linux-elnMNo+KYs3YtjvyW6yDsg,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg, Viresh Kumar,
Vincenzo Frascino, Shiraz Hashim
On 13 May 2013 14:48, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> On 5 April 2013 12:12, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> Hi Wolfram,
>>
>> On 25 January 2013 15:17, Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>>> 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 to 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>
>>> ---
>>> V9->V10: None
>>>
>>> drivers/i2c/busses/i2c-designware-core.c | 5 ++++-
>>> drivers/i2c/busses/i2c-designware-platdrv.c | 6 ++++++
>>> 2 files changed, 10 insertions(+), 1 deletion(-)
>>
>> Can you apply this one too?
>
> Ping!!
Ping!!
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2013-05-31 10:50 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-25 9:47 [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
[not found] ` <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-01-25 9:47 ` [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support Viresh Kumar
[not found] ` <f7d8d29a338704deaa7a542f9a213fc7696625c9.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-04-05 6:42 ` Viresh Kumar
[not found] ` <CAKohpom=DQDv6v7xwnCRvtWBxC+a5mGZeOv=ad8AjKwV2yGBow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-13 9:18 ` Viresh Kumar
[not found] ` <CAKohpokAPohg2aAjawLN2t_Jh29CZAuiWqKz2ah-bJP9Dw4YvA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-31 10:50 ` Viresh Kumar
2013-01-25 9:48 ` [PATCH V10 1/2] i2c/adapter: Add bus recovery infrastructure Viresh Kumar
2013-01-25 11:13 ` Wolfram Sang
[not found] ` <20130125111322.GA2649-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2013-01-26 5:13 ` Viresh Kumar
[not found] ` <CAKohpok2arxhsAt3xOxRCZZjvLMTed1EYX3ZRUSQ3733wx2mMw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-31 2:28 ` Viresh Kumar
[not found] ` <CAKohpokNVPOvAc=Gbxn4ZquPnG4huukDmwhOsqaV51p0aRo8xw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-15 8:51 ` Viresh Kumar
[not found] ` <CAKohpokCqe7LHFMn0t7EivTQ7US9Fp=07nowGP2H2ujeDKbHXg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-15 9:13 ` Viresh Kumar
[not found] ` <CAKohpondDBBjTQYgV9XOFMYp_aKO+SdeRR1gjxe1ovTLuOm2Wg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-21 9:36 ` Wolfram Sang
[not found] ` <20130321093648.GA19297-z923LK4zBo2bacvFa/9K2g@public.gmane.org>
2013-03-21 10:15 ` Viresh Kumar
[not found] ` <CAKohpo=NdN64bJ_uD4cZ_aJppz+zschYFMyoP=-2c+NfuOqFfg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-03-21 10:34 ` Shiraz Hashim
2013-03-24 14:07 ` Viresh Kumar
[not found] ` <CAKohpokQY=g1eUrwwydA4mMruebt2xZinLPCL5_+mkg4oediEQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-04-01 6:45 ` Viresh Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).