From: Viresh Kumar <viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Cc: u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org,
ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org,
paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org,
Viresh Kumar
<viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
Vincenzo Frascino
<vincenzo.frascino-qxv4g6HH51o@public.gmane.org>,
Shiraz Hashim <shiraz.hashim-qxv4g6HH51o@public.gmane.org>
Subject: [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support
Date: Fri, 25 Jan 2013 15:17:49 +0530 [thread overview]
Message-ID: <f7d8d29a338704deaa7a542f9a213fc7696625c9.1359106966.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
In-Reply-To: <59a73d182bf1ce330becf32ad780f3501a57aed0.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
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
next prev parent reply other threads:[~2013-01-25 9:47 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Viresh Kumar [this message]
[not found] ` <f7d8d29a338704deaa7a542f9a213fc7696625c9.1359106966.git.viresh.kumar-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2013-04-05 6:42 ` [PATCH V10 2/2] i2c/designware: Provide i2c bus recovery support 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f7d8d29a338704deaa7a542f9a213fc7696625c9.1359106966.git.viresh.kumar@linaro.org \
--to=viresh.kumar-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
--cc=khali-PUYAD+kWke1g9hUCZPvPmw@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=paul-YHLC2tV1sDlxR4N9A70vTlRxknfHcPLb9dF7HbQ/qKg@public.gmane.org \
--cc=shiraz.hashim-qxv4g6HH51o@public.gmane.org \
--cc=spear-devel-nkJGhpqTU55BDgjK7y7TUQ@public.gmane.org \
--cc=u.kleine-koenig-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=vincenzo.frascino-qxv4g6HH51o@public.gmane.org \
--cc=w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).