public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: "shekhar, chandra" <x0044955@ti.com>
To: linux-omap@vger.kernel.org
Cc: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
Subject: Re: [PATCH] i2c: i2c-omap: Fix standard and fast mode prescalers
Date: Tue, 11 Nov 2008 18:51:30 +0530	[thread overview]
Message-ID: <034e01c94400$69fa2620$LocalHost@wipultra806> (raw)
In-Reply-To: 12263863521940-git-send-email-ext-eero.nurkkala@nokia.com


----- Original Message ----- 
From: <ext-eero.nurkkala@nokia.com>
To: <linux-omap@vger.kernel.org>
Cc: "Eero Nurkkala" <ext-eero.nurkkala@nokia.com>
Sent: Tuesday, November 11, 2008 12:22 PM
Subject: [PATCH] i2c: i2c-omap: Fix standard and fast mode prescalers


> From: Eero Nurkkala <ext-eero.nurkkala@nokia.com>
>
> The prescalers for 100 kHz and 400 kHz mode
> are wrong. The internal clock is the fclock
> divided by the prescaler. Also, the scll and
> sclh values should be adjusted correctly.
> Having the correct prescaler is important in
> the process of getting standard i2c clock. In
> addition, it (psc) is used to get 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 f15668d..cee2f2d 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -288,7 +288,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;

Is internal clk 4000 valid??  PSC_REG  field cannot encompass ( its 4 bit field) 
the calculated psc if internal_clk is 4000.

> +
>  fclk_rate = clk_get_rate(dev->fclk) / 1000;
>
>  /* Compute prescaler divisor */
> @@ -306,8 +312,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) - 7;
> + fssclh = internal_clk / (dev->speed * 2) - 5;
>  }
>  scll = (hsscll << OMAP_I2C_SCLL_HSSCLL) | fsscll;
>  sclh = (hssclh << OMAP_I2C_SCLH_HSSCLH) | fssclh;
> -- 
> 1.6.0
>
> --
> 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:[~2008-11-11 13:21 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-11  6:52 [PATCH] i2c: i2c-omap: Fix standard and fast mode prescalers ext-eero.nurkkala
2008-11-11 13:21 ` shekhar, chandra [this message]
  -- 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-26 13:44 ext-eero.nurkkala
2008-11-27  8:38 ` Eero Nurkkala
2009-01-08 13:39   ` Tony Lindgren
2009-01-09 20:27 ` Kainan Cha
2009-01-12  6:29   ` Eero Nurkkala
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-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='034e01c94400$69fa2620$LocalHost@wipultra806' \
    --to=x0044955@ti.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox