From: Wolfram Sang <wsa@the-dreams.de>
To: Peter Griffin <peter.griffin@linaro.org>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com,
maxime.coquelin@st.com, patrice.chotard@st.com,
lee.jones@linaro.org, linux-i2c@vger.kernel.org,
Frederic Pillon <frederic.pillon@st.com>
Subject: Re: [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks
Date: Sun, 24 Apr 2016 23:10:44 +0200 [thread overview]
Message-ID: <20160424211044.GD4317@katana> (raw)
In-Reply-To: <1460467759-11737-1-git-send-email-peter.griffin@linaro.org>
[-- Attachment #1: Type: text/plain, Size: 2016 bytes --]
> +/*
> + * i2c bus recovery routines
> + * get_scl and set_scl must be defined to avoid the recover_bus field of
> + * i2c_bus_recovery_info to be overriden with NULL during the
> + * i2c_add_adapter call
> + */
Oh, that shouldn't be like this. Can you try this patch and remove the
empty functions please?
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 4979728f7fb2de..604936955807e5 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1595,10 +1595,12 @@ 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) {
+ } else if (bri->recover_bus == i2c_generic_scl_recovery) {
/* Generic SCL recovery */
- dev_err(&adap->dev, "No {get|set}_gpio() found, not using recovery\n");
- adap->bus_recovery_info = NULL;
+ if (!bri->set_scl || !bri->get_scl) {
+ dev_err(&adap->dev, "No {get|set}_scl() found, not using recovery\n");
+ adap->bus_recovery_info = NULL;
+ }
}
}
> +static int st_i2c_recover_bus(struct i2c_adapter *i2c_adap)
> +{
Can you describe what the function does? It is not clear to me that it
generates 9 scl pulses.
> + struct st_i2c_dev *i2c_dev = i2c_get_adapdata(i2c_adap);
> + u32 ctl;
> +
> + dev_err(i2c_dev->dev, "Trying to recover bus\n");
This is not an error. Either dev_dbg or drop it, I'd say.
> +
> + /* Disable interrupts */
> + writel_relaxed(0, i2c_dev->base + SSC_IEN);
> +
> + st_i2c_hw_config(i2c_dev);
> +
> + ctl = SSC_CTL_EN | SSC_CTL_MS | SSC_CTL_EN_RX_FIFO | SSC_CTL_EN_TX_FIFO;
> + st_i2c_set_bits(i2c_dev->base + SSC_CTL, ctl);
> +
> + st_i2c_clr_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
> + usleep_range(8000, 10000);
> +
> + writel_relaxed(0, i2c_dev->base + SSC_TBUF);
> + usleep_range(2000, 4000);
> + st_i2c_set_bits(i2c_dev->base + SSC_I2C, SSC_I2C_I2CM);
> +
> + return 0;
> +}
Thanks,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-04-24 21:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-12 13:29 [PATCH] i2c: st: Implement i2c_bus_recovery_info callbacks Peter Griffin
2016-04-24 21:10 ` Wolfram Sang [this message]
2016-04-28 13:30 ` Maxime Coquelin
2016-04-28 14:57 ` Wolfram Sang
2016-04-29 11:26 ` Maxime Coquelin
2016-04-29 14:03 ` Peter Griffin
2016-05-11 15:01 ` Wolfram Sang
2016-05-11 15:26 ` Peter Griffin
2016-05-11 16:22 ` Peter Griffin
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=20160424211044.GD4317@katana \
--to=wsa@the-dreams.de \
--cc=frederic.pillon@st.com \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.coquelin@st.com \
--cc=patrice.chotard@st.com \
--cc=peter.griffin@linaro.org \
--cc=srinivas.kandagatla@gmail.com \
/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).