All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH] i2c: i2c-omap: Fix standard and fast mode prescalers
Date: Thu, 8 Jan 2009 15:39:17 +0200	[thread overview]
Message-ID: <20090108133916.GK27566@atomide.com> (raw)
In-Reply-To: <1227775131.27458.24.camel@eenurkka-desktop>

* Eero Nurkkala <ext-eero.nurkkala@nokia.com> [081127 10:39]:
> We scope-verified these scl and sch values for 100 and 400 kHz busses.
> Now they're in the specs.

Pushing to l-o tree and adding to omap-fixes queue for mainline.

Tony

> On Wed, 2008-11-26 at 15:44 +0200, ext-eero.nurkkala@nokia.com wrote:
> > From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> > 
> > The prescalers for 100 kHz and 400 kHz mode
> > are wrong for omap 3430 and omap 2430. The
> > internal clock is the fclock divided by the
> > prescaler. The PSC is an 8 bit field in
> > omap3430 and omap2430. Moreover, the scll and
> > sclh values should be adjusted properly.
> > Having the correct prescaler is important in
> > the process of getting a finite i2c clock. In
> > addition, the prescaler is used in the process
> > of activating the correct noise filter and thus,
> > lets more error resilient i2c communications.
> > 
> > Signed-off-by: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
> > ---
> >  drivers/i2c/busses/i2c-omap.c |   12 +++++++++---
> >  1 files changed, 9 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> > index 630702c..c21af3f 100644
> > --- a/drivers/i2c/busses/i2c-omap.c
> > +++ b/drivers/i2c/busses/i2c-omap.c
> > @@ -337,7 +337,13 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> >  	if (cpu_is_omap2430() || cpu_is_omap34xx()) {
> >  
> >  		/* HSI2C controller internal clk rate should be 19.2 Mhz */
> > -		internal_clk = 19200;
> > +		if (dev->speed > 400)
> > +			internal_clk = 19200;
> > +		else if (dev->speed > 100)
> > +			internal_clk = 9600;
> > +		else
> > +			internal_clk = 4000;
> > +
> >  		fclk_rate = clk_get_rate(dev->fclk) / 1000;
> >  
> >  		/* Compute prescaler divisor */
> > @@ -355,8 +361,8 @@ static int omap_i2c_init(struct omap_i2c_dev *dev)
> >  			hssclh = fclk_rate / (dev->speed * 2) - 6;
> >  		} else {
> >  			/* To handle F/S modes */
> > -			fsscll = internal_clk / (dev->speed * 2) - 6;
> > -			fssclh = internal_clk / (dev->speed * 2) - 6;
> > +			fsscll = internal_clk / (dev->speed * 2) - 3;
> > +			fssclh = internal_clk / (dev->speed * 2) - 9;
> >  		}
> >  		scll = (hsscll << OMAP_I2C_SCLL_HSSCLL) | fsscll;
> >  		sclh = (hssclh << OMAP_I2C_SCLH_HSSCLH) | fssclh;
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-01-08 13:39 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-26 13:44 [PATCH] i2c: i2c-omap: Fix standard and fast mode prescalers ext-eero.nurkkala
2008-11-27  8:38 ` Eero Nurkkala
2009-01-08 13:39   ` Tony Lindgren [this message]
2009-01-09 20:27 ` Kainan Cha
2009-01-12  6:29   ` Eero Nurkkala
  -- strict thread matches above, loose matches on Subject: below --
2009-01-13  6:06 Eero Nurkkala
2009-01-23  2:04 ` Tony Lindgren
2008-11-25  6:56 ext-eero.nurkkala
2008-11-14  8:41 ext-eero.nurkkala
2008-11-14 19:45 ` David Brownell
2008-11-14 20:02   ` Felipe Balbi
2008-11-14 20:08     ` David Brownell
2008-11-14 21:46       ` Felipe Balbi
2008-11-17  2:46         ` shekhar, chandra
2008-11-18  5:36           ` David Brownell
2008-11-14 20:38   ` Steve Sakoman
2008-11-19 12:07   ` Eero Nurkkala
2008-11-21 22:08 ` Tony Lindgren
2008-11-11  6:52 ext-eero.nurkkala
2008-11-11 13:21 ` shekhar, chandra
2008-11-10 10:46 ext-eero.nurkkala

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=20090108133916.GK27566@atomide.com \
    --to=tony@atomide.com \
    --cc=ext-eero.nurkkala@nokia.com \
    --cc=linux-omap@vger.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 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.