From: Robert Hancock <robert.hancock@calian.com>
To: "shubhrajyoti.datta@xilinx.com" <shubhrajyoti.datta@xilinx.com>,
"wsa@kernel.org" <wsa@kernel.org>
Cc: "michal.simek@xilinx.com" <michal.simek@xilinx.com>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
"shubhrajyoti.datta@amd.com" <shubhrajyoti.datta@amd.com>
Subject: Re: [PATCH v2] i2c: cadence: Add standard bus recovery support
Date: Thu, 7 Jul 2022 22:14:35 +0000 [thread overview]
Message-ID: <6140bac860fea41348a7922b4772ab6af4ec41ff.camel@calian.com> (raw)
In-Reply-To: <YsdKCeEbEW7ZodZe@shikoro>
On Thu, 2022-07-07 at 23:03 +0200, Wolfram Sang wrote:
> Hi,
>
> On Mon, Jul 04, 2022 at 11:24:20AM +0530, Shubhrajyoti Datta wrote:
> > From: Robert Hancock <robert.hancock@calian.com>
> >
> > Hook up the standard GPIO/pinctrl-based recovery support..
> > In the discurssion
> > https://patchwork.ozlabs.org/project/linux-i2c/patch/20211129090116.16628-1-shubhrajyoti.datta@xilinx.com/
> >
> > recovery should be done at the beginning of the transaction.
> > Here we are doing the recovery at the beginning on a timeout.
>
> Which is still wrong.
>
> >
> > Signed-off-by: Robert Hancock <robert.hancock@calian.com>
> > Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
>
> This is an AMD address, but the one you sent from is from Xilinx?
>
> > if (time_left == 0) {
> > + i2c_recover_bus(adap);
>
> This is the wrong part.
>
> > cdns_i2c_master_reset(adap);
> > dev_err(id->adap.dev.parent,
> > "timeout waiting on completion\n");
> > @@ -852,8 +858,12 @@ static int cdns_i2c_master_xfer(struct
> > i2c_adapter *adap, struct i2c_msg *msgs,
> > #endif
> >
> > /* Check if the bus is free */
> > - if (cdns_i2c_readreg(CDNS_I2C_SR_OFFSET) & CDNS_I2C_SR_BA)
> > {
> > + ret = readl_poll_timeout(id->membase + CDNS_I2C_SR_OFFSET,
> > reg,
> > + !(reg & CDNS_I2C_SR_BA),
> > + CDNS_I2C_POLL_US,
> > CDNS_I2C_TIMEOUT_US);
> > + if (ret) {
> > ret = -EAGAIN;
> > + i2c_recover_bus(adap);
> > goto out;
>
> This is proper.
>
> > }
> >
> > @@ -1278,6 +1288,7 @@ static int cdns_i2c_probe(struct
> > platform_device *pdev)
> > id->adap.retries = 3; /* Default retry value. */
> > id->adap.algo_data = id;
> > id->adap.dev.parent = &pdev->dev;
> > + id->adap.bus_recovery_info = &id->rinfo;
>
> Since 'rinfo' is never populated with actual data, I am quite sure
> this
> patch has never been tested.
I think this (setting bus_recovery_info to point to a zeroed structure)
is sufficient to allow the generic recovery initialization in i2c-core-
base.c to work. i2c_gpio_init_recovery should fill in the required info
based on the available pinctrl and gpio configuration in this case.
>
> Regards,
>
> Wolfram
>
next prev parent reply other threads:[~2022-07-07 22:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-04 5:54 [PATCH v2] i2c: cadence: Add standard bus recovery support Shubhrajyoti Datta
2022-07-04 11:30 ` Michal Simek
2022-07-07 21:03 ` Wolfram Sang
2022-07-07 22:14 ` Robert Hancock [this message]
2022-07-14 7:22 ` Datta, Shubhrajyoti
-- strict thread matches above, loose matches on Subject: below --
2021-11-29 9:01 Shubhrajyoti Datta
2021-11-29 12:00 ` Wolfram Sang
2022-01-07 22:24 ` Robert Hancock
2022-02-23 16:51 ` Shubhrajyoti Datta
2022-04-12 10:16 ` Shubhrajyoti Datta
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=6140bac860fea41348a7922b4772ab6af4ec41ff.camel@calian.com \
--to=robert.hancock@calian.com \
--cc=linux-i2c@vger.kernel.org \
--cc=michal.simek@xilinx.com \
--cc=shubhrajyoti.datta@amd.com \
--cc=shubhrajyoti.datta@xilinx.com \
--cc=wsa@kernel.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).