All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
To: Wolfram Sang <wsa@the-dreams.de>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Wolfram Sang <wsa+renesas@sang-engineering.com>,
	"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
	"linux-renesas-soc@vger.kernel.org"
	<linux-renesas-soc@vger.kernel.org>,
	Hiromitsu Yamasaki <hiromitsu.yamasaki.ym@renesas.com>
Subject: RE: [RFC PATCH 1/1] i2c: rcar: handle RXDMA HW bug on Gen3
Date: Tue, 26 Jun 2018 08:38:12 +0000	[thread overview]
Message-ID: <TY2PR01MB22973680E5B69BAD232C234DD8490@TY2PR01MB2297.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <20180626030510.gq3xyejsrc5gd5wj@ninjato>

Hi Wolfram-san, Geert-san,

I'm sorry for delayed response. I completely overlooked this email...

> From: Wolfram Sang <wsa@the-dreams.de>, Sent: Tuesday, June 26, 2018 12:05 PM
> 
> > > I got information about this topic.
> > >
> > > < In CPG / MSSR point of view >
> > >  - This needs 35 usec wait while asserting.
> > >  - After deasserted a reset, no wait needs.
> > >   - In other words, there is each hardware IP dependence.
> >
> > Let's call the above procedure A.
> >
> > > < In I2C point of view >
> > >  - After deasserted the reset, this nees SRCR register polling.
> >
> > Let's call the above procedure B.
> >
> > > So, I don't think cpg_mssr_reset() checks the status bit after deasserted a reset.
> > > But, what do you think?
> >
> > cpg_mssr_reset() indeed does not check the status bit after deasserting
> > the reset, as it follows procedure A.
> >
> > Such a check could be added, though. Then it'll become
> > (let's call this procedure C):
> >
> >         /* Reset module */
> >         spin_lock_irqsave(&priv->rmw_lock, flags);
> >         value = readl(priv->base + SRCR(reg));
> >         value |= bitmask;
> >         writel(value, priv->base + SRCR(reg));
> >         spin_unlock_irqrestore(&priv->rmw_lock, flags);
> >
> >         /* Wait for at least one cycle of the RCLK clock (@ ca. 32 kHz) */
> >         udelay(35);
> >
> >         /* Release module from reset state */
> >         writel(bitmask, priv->base + SRSTCLR(reg));
> >
> > +       /* Wait until deassertion has completed */
> > +       while (readl(priv->base + SRCR(reg)) & bitmask)
> > +               cpu_relax();
> > 
> > Probably we need an upper limit on the number of loops, and call udelay(1)
> > after each iteration?
> >
> >         for (i 0; i < 35; i++) {
> >                 if (!(readl(priv->base + SRCR(reg)) & bitmask))
> >                         return 0;
> >                 udelay(1);
> >         }
> >         return -EIO;
> >
> > Any advice from the hardware team about that?

The hardware team said:
 - In CPG point of view:
   - such polling doesn't need (because the reset pulse is generated correctly).
   - About the interval after deassert the reset, this is depend on each hardware module.
     (In other words, if each hardware module has a special handling about after the deassert interval,
      we should follow the special handling.)
 - The I2C controller needs an interval of reading SRCR at least (this is a special handling).

So, I think adding this code is not good fit in CPG point of view.

> > But according to procedure A, the check is not needed?

As hardware team said, the check (that means procedure C) is not needed.

> > Probably because 35µs is an upper limit satisfying all individual hardware
> > modules?
> >
> > I'm wondering whether we could use procedure B in the general case,
> > as it explicitly checks for completion?
> >
> > Procedure C is safest, though, so probably the way to go.
> 
> Any news about this topic?
> 
> And how to upstream all this? My I2C patch is clearly a bugfix, but the
> necessary CPG update technically isn't? Not sure about this one...

I think we have to add reset_control_status() calling into the i2c-rcar.c
to follow procedure B.
But, Geert-san, what do you think?

Best regards,
Yoshihiro Shimoda


  reply	other threads:[~2018-06-26  8:38 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-29 10:58 [RFC PATCH 0/1] i2c: rcar: handle RXDMA HW bug on Gen3 Wolfram Sang
2018-05-29 10:58 ` [RFC PATCH 1/1] " Wolfram Sang
2018-05-30  8:35   ` Yoshihiro Shimoda
2018-05-31  8:31     ` Wolfram Sang
2018-05-31  9:22       ` Yoshihiro Shimoda
2018-05-31  8:45     ` Geert Uytterhoeven
2018-05-31  9:12       ` Yoshihiro Shimoda
2018-06-07  5:36         ` Yoshihiro Shimoda
2018-06-07 10:08           ` Geert Uytterhoeven
2018-06-26  3:05             ` Wolfram Sang
2018-06-26  8:38               ` Yoshihiro Shimoda [this message]
2018-06-26  8:58                 ` Geert Uytterhoeven
2018-06-26  9:26                   ` Yoshihiro Shimoda
2018-06-27  8:44                   ` Wolfram Sang
2018-06-27  8:51                     ` Geert Uytterhoeven
2018-06-27  9:10                       ` Wolfram Sang
2018-06-27  9:48                     ` Yoshihiro Shimoda
2018-06-28  5:13                       ` Wolfram Sang
2018-06-28  7:33                   ` Wolfram Sang

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=TY2PR01MB22973680E5B69BAD232C234DD8490@TY2PR01MB2297.jpnprd01.prod.outlook.com \
    --to=yoshihiro.shimoda.uh@renesas.com \
    --cc=geert@linux-m68k.org \
    --cc=hiromitsu.yamasaki.ym@renesas.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=wsa+renesas@sang-engineering.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.