From: Eddie James <eajames@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org,
wsa@the-dreams.de, robh+dt@kernel.org, joel@jms.id.au,
eajames@linux.vnet.ibm.com,
"Edward A. James" <eajames@us.ibm.com>
Subject: [PATCH v6 7/7] drivers/i2c: Add bus recovery for FSI algorithm
Date: Thu, 16 Nov 2017 13:53:52 -0600 [thread overview]
Message-ID: <1510862032-12394-8-git-send-email-eajames@linux.vnet.ibm.com> (raw)
In-Reply-To: <1510862032-12394-1-git-send-email-eajames@linux.vnet.ibm.com>
From: "Edward A. James" <eajames@us.ibm.com>
Bus recovery should reset the engine and force clock the bus 9 times
to recover most situations.
Signed-off-by: Edward A. James <eajames@us.ibm.com>
---
drivers/i2c/busses/i2c-fsi.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/drivers/i2c/busses/i2c-fsi.c b/drivers/i2c/busses/i2c-fsi.c
index 1751c44..10f693f 100644
--- a/drivers/i2c/busses/i2c-fsi.c
+++ b/drivers/i2c/busses/i2c-fsi.c
@@ -671,6 +671,27 @@ static u32 fsi_i2c_functionality(struct i2c_adapter *adap)
| I2C_FUNC_SMBUS_EMUL | I2C_FUNC_SMBUS_BLOCK_DATA;
}
+static int fsi_i2c_recover_bus(struct i2c_adapter *adap)
+{
+ int rc;
+ struct fsi_i2c_port *port = adap->algo_data;
+ struct fsi_i2c_master *master = port->master;
+
+ rc = fsi_i2c_lock_master(master, adap->timeout);
+ if (rc)
+ return rc;
+
+ rc = fsi_i2c_reset(master, port->port);
+
+ fsi_i2c_unlock_master(master);
+
+ return rc;
+}
+
+static struct i2c_bus_recovery_info fsi_i2c_bus_recovery_info = {
+ .recover_bus = fsi_i2c_recover_bus,
+};
+
static const struct i2c_algorithm fsi_i2c_algorithm = {
.master_xfer = fsi_i2c_xfer,
.functionality = fsi_i2c_functionality,
@@ -715,6 +736,7 @@ static int fsi_i2c_probe(struct device *dev)
port->adapter.dev.of_node = np;
port->adapter.dev.parent = dev;
port->adapter.algo = &fsi_i2c_algorithm;
+ port->adapter.bus_recovery_info = &fsi_i2c_bus_recovery_info;
port->adapter.algo_data = port;
snprintf(port->adapter.name, sizeof(port->adapter.name),
--
1.8.3.1
prev parent reply other threads:[~2017-11-16 19:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-11-16 19:53 [PATCH v6 0/7] drivers/i2c: Add FSI-attached I2C master algorithm Eddie James
[not found] ` <1510862032-12394-1-git-send-email-eajames-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-11-16 19:53 ` [PATCH v6 1/7] dt-bindings: i2c: Add FSI-attached I2C master dt binding documentation Eddie James
2017-11-16 19:53 ` [PATCH v6 2/7] drivers/i2c: Add FSI-attached I2C master algorithm Eddie James
2017-11-16 19:53 ` [PATCH v6 3/7] drivers/i2c: Add port structure to FSI algorithm Eddie James
2017-11-16 19:53 ` [PATCH v6 4/7] drivers/i2c: Add abort and hardware reset procedures Eddie James
2017-11-16 19:53 ` [PATCH v6 5/7] drivers/i2c: Add transfer implementation for FSI algorithm Eddie James
2017-11-16 19:53 ` [PATCH v6 6/7] drivers/i2c: Add I2C master locking to " Eddie James
2017-11-16 19:53 ` Eddie James [this message]
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=1510862032-12394-8-git-send-email-eajames@linux.vnet.ibm.com \
--to=eajames@linux.vnet.ibm.com \
--cc=devicetree@vger.kernel.org \
--cc=eajames@us.ibm.com \
--cc=joel@jms.id.au \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=wsa@the-dreams.de \
/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).