From: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org,
Michael Hennerich
<michael.hennerich-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>,
Bryan Wu <cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH 1/3] Blackfin I2C/TWI Driver: make sure we don't end up with a CLKDIV=0
Date: Wed, 27 May 2009 09:05:42 +0200 [thread overview]
Message-ID: <20090527070542.GA3085@pengutronix.de> (raw)
In-Reply-To: <1243405210-26227-2-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2805 bytes --]
On Wed, May 27, 2009 at 02:20:08AM -0400, Mike Frysinger wrote:
> From: Michael Hennerich <michael.hennerich-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
>
> Make sure we don't end up with an invalid CLKDIV=0 in case someone
> specifies 20kHz SCL or less (5 * 1024 / 20 = 0x100).
>
> Signed-off-by: Michael Hennerich <michael.hennerich-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org>
> Signed-off-by: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
> Signed-off-by: Bryan Wu <cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> ---
> drivers/i2c/busses/Kconfig | 2 +-
> drivers/i2c/busses/i2c-bfin-twi.c | 11 ++++++++---
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
> index f1c6ca7..c8460fa 100644
> --- a/drivers/i2c/busses/Kconfig
> +++ b/drivers/i2c/busses/Kconfig
> @@ -298,7 +298,7 @@ config I2C_BLACKFIN_TWI
> config I2C_BLACKFIN_TWI_CLK_KHZ
> int "Blackfin TWI I2C clock (kHz)"
> depends on I2C_BLACKFIN_TWI
> - range 10 400
> + range 21 400
> default 50
> help
> The unit of the TWI clock is kHz.
> diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c
> index fc548b3..3ab1f66 100644
> --- a/drivers/i2c/busses/i2c-bfin-twi.c
> +++ b/drivers/i2c/busses/i2c-bfin-twi.c
> @@ -614,6 +614,7 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
> struct i2c_adapter *p_adap;
> struct resource *res;
> int rc;
> + unsigned int clkhilow;
>
> iface = kzalloc(sizeof(struct bfin_twi_iface), GFP_KERNEL);
> if (!iface) {
> @@ -675,10 +676,14 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev)
> /* Set TWI internal clock as 10MHz */
> write_CONTROL(iface, ((get_sclk() / 1024 / 1024 + 5) / 10) & 0x7F);
>
> + /*
> + * We will not end up with a CLKDIV=0 cause no one will specifies
specify
> + * 20kHz SCL or less in Kconfig now. (5 * 1024 / 20 = 0x100)
> + */
> + clkhilow = 5 * 1024 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ;
> +
> /* Set Twi interface clock as specified */
> - write_CLKDIV(iface, ((5*1024 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ)
> - << 8) | ((5*1024 / CONFIG_I2C_BLACKFIN_TWI_CLK_KHZ)
> - & 0xFF));
> + write_CLKDIV(iface, (clkhilow << 8) | clkhilow);
>
> /* Enable TWI */
> write_CONTROL(iface, read_CONTROL(iface) | TWI_ENA);
> --
> 1.6.3.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
next prev parent reply other threads:[~2009-05-27 7:05 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 6:20 [PATCH 0/3] Blackfin I2C updates for 2.6.31 Mike Frysinger
[not found] ` <1243405210-26227-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2009-05-27 6:20 ` [PATCH 1/3] Blackfin I2C/TWI Driver: make sure we don't end up with a CLKDIV=0 Mike Frysinger
[not found] ` <1243405210-26227-2-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2009-05-27 7:05 ` Wolfram Sang [this message]
[not found] ` <20090527070542.GA3085-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-06-01 5:37 ` [PATCH 1/3 v2] " Mike Frysinger
2009-05-27 6:20 ` [PATCH 2/3] Blackfin I2C TWI Driver: fix bug - REPEAT START mode doesn't repeat Mike Frysinger
2009-05-27 6:20 ` [PATCH 3/3] Blackfin I2C/TWI Drivers: fix bug - not work well on BF537 Mike Frysinger
2009-06-01 22:49 ` [PATCH 0/3] Blackfin I2C updates for 2.6.31 Ben Dooks
[not found] ` <20090601224949.GA18453-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2009-06-01 23:37 ` [Uclinux-dist-devel] " Mike Frysinger
[not found] ` <8bd0f97a0906011637q3f309c05w9222cc7779207fa1-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-02 22:41 ` Ben Dooks
[not found] ` <20090602224159.GD18453-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2009-06-02 22:47 ` Mike Frysinger
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=20090527070542.GA3085@pengutronix.de \
--to=w.sang-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=cooloney-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=michael.hennerich-OyLXuOCK7orQT0dZR+AlfA@public.gmane.org \
--cc=uclinux-dist-devel-ZG0+EudsQA8dtHy/vicBwGD2FQJk+8+b@public.gmane.org \
--cc=vapier-aBrp7R+bbdUdnm+yROfE0A@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 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.