linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
To: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Fabio Estevam
	<fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: Re: [RFC PATCH] mxs: i2c: Implement arbitrary clock speed derivation algorithm
Date: Thu, 24 Jan 2013 13:21:14 +0100	[thread overview]
Message-ID: <201301241321.15117.marex@denx.de> (raw)
In-Reply-To: <20130124072555.GD8364-8EAEigeeuNG034pCzgS/Qg7AFbiQbgqx@public.gmane.org>

Dear Wolfram Sang,

> Hi Marek,
> 
> On Fri, Nov 30, 2012 at 06:48:35PM +0100, Marek Vasut wrote:
> > This patch drops the i2c timing tables from this driver and instead
> > derives the timing based from the requested clock sleep. The timing
> > tables were completely wrong anyway when observed on a scope.
> > 
> > This new algorithm is also only derived by using a scope, but it seems
> > to produce much more accurate result.
> > 
> > Signed-off-by: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>
> > Cc: Fabio Estevam <fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org>
> > Cc: Shawn Guo <shawn.guo-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> > Cc: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
> > ---
> > 
> >  drivers/i2c/busses/i2c-mxs.c |   94
> >  ++++++++++++++++++++++++------------------ 1 file changed, 55
> >  insertions(+), 39 deletions(-)
> > 
> > NOTE: Can someone please test if this patch works for them as well?
> > 
> >       I tested this on DENX M28EVK and Freescale MX28EVK.
> 
> Second call for testers.

[...]

> > +static void mxs_i2c_derive_timing(struct mxs_i2c_dev *i2c, int speed)
> > +{
> > +	/* The I2C block clock run at 24MHz */
> > +	const uint32_t clk = 24000000;
> > +	uint32_t base;
> > +	uint16_t high_count, low_count, rcv_count, xmit_count;
> > +	struct device *dev = i2c->dev;
> > +
> > +	if (speed > 540000) {
> > +		dev_err(dev, "Speed too high (%d Hz), using 540 kHz\n", speed);
> > +		speed = 540000;
> > +	} else if (speed < 12000) {
> > +		dev_err(dev, "Speed too low (%d Hz), using 12 kHz\n", speed);
> > +		speed = 12000;
> > +	}
> 
> I'd think dev_warn would do, since we are able to continue. No need to
> resend, though.
> 
> Rest looks good, thanks!

Ah, good catch. We can put this one on hold, it's not as important as the 
PIO/DMA one. I'd like to see the PIO/DMA one hit mainline though.

Thanks!

Best regards,
Marek Vasut

  parent reply	other threads:[~2013-01-24 12:21 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-30 17:48 [RFC PATCH] mxs: i2c: Implement arbitrary clock speed derivation algorithm Marek Vasut
     [not found] ` <1354297715-12201-1-git-send-email-marex-ynQEQJNshbs@public.gmane.org>
2013-01-08 18:14   ` Marek Vasut
2013-01-24  7:25   ` Wolfram Sang
     [not found]     ` <20130124072555.GD8364-8EAEigeeuNG034pCzgS/Qg7AFbiQbgqx@public.gmane.org>
2013-01-24 12:21       ` Marek Vasut [this message]
2013-01-25  6:33       ` Shawn Guo
2013-02-10 13:57   ` Wolfram Sang
     [not found]     ` <20130210135737.GB15546-8EAEigeeuNG034pCzgS/Qg7AFbiQbgqx@public.gmane.org>
2013-02-10 14:17       ` Marek Vasut
     [not found]         ` <201302101517.10571.marex-ynQEQJNshbs@public.gmane.org>
2013-02-10 14:44           ` 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=201301241321.15117.marex@denx.de \
    --to=marex-ynqeqjnshbs@public.gmane.org \
    --cc=fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=shawn.guo-QSEj5FYQhm4dnm+yROfE0A@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).