From: Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
To: Richard Zhao <linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org
Subject: Re: [PATCH 2/4] i2c: imx: only imx1 needs disable delay
Date: Thu, 1 Oct 2009 09:57:02 +0200 [thread overview]
Message-ID: <20091001075702.GZ27039@pengutronix.de> (raw)
In-Reply-To: <4e090d470910010052k37a0a4eep6d436e45e6524234-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On Thu, Oct 01, 2009 at 03:52:15PM +0800, Richard Zhao wrote:
> On Thu, Oct 1, 2009 at 3:26 PM, Sascha Hauer <s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> wrote:
> > On Thu, Oct 01, 2009 at 09:13:31AM +0800, Richard Zhao wrote:
> >> check cpu_is_mx1() when set disable_delay.
> >>
> >> Signed-off-by: Richard Zhao <linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> >>
> >> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> >> index 156cc95..c1e541c 100644
> >> --- a/drivers/i2c/busses/i2c-imx.c
> >> +++ b/drivers/i2c/busses/i2c-imx.c
> >> @@ -254,14 +254,16 @@ static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
> >> /* Write divider value to register */
> >> writeb(i2c_clk_div[i][1], i2c_imx->base + IMX_I2C_IFDR);
> >>
> >> - /*
> >> - * There dummy delay is calculated.
> >> - * It should be about one I2C clock period long.
> >> - * This delay is used in I2C bus disable function
> >> - * to fix chip hardware bug.
> >> - */
> >> - i2c_imx->disable_delay = (500000U * i2c_clk_div[i][0]
> >> - + (i2c_clk_rate / 2) - 1) / (i2c_clk_rate / 2);
> >> + if (cpu_is_mx1()) {
> >> + /*
> >> + * There dummy delay is calculated.
> >> + * It should be about one I2C clock period long.
> >> + * This delay is used in I2C bus disable function
> >> + * to fix chip hardware bug.
> >> + */
> >> + i2c_imx->disable_delay = (500000U * i2c_clk_div[i][0]
> >> + + (i2c_clk_rate / 2) - 1) / (i2c_clk_rate / 2);
> >> + }
> >
> > I think you should put the udelay(i2c_imx->disable_delay) in
> > cpu_is_mx1() rather than the calculation.
> >
> > Sascha
> >
> >
> > --
> > Pengutronix e.K. | |
> > Industrial Linux Solutions | http://www.pengutronix.de/ |
> > Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
> >
> Do you think udelay(0) wast any more time than if()?
if (cpu_is_mx1()) is optimized out by the compiler.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2009-10-01 7:57 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 1:13 [PATCH 1/4] i2c: imx: check busy bit when START/STOP Richard Zhao
[not found] ` <1254359613-21210-1-git-send-email-linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-10-01 1:13 ` [PATCH 2/4] i2c: imx: only imx1 needs disable delay Richard Zhao
[not found] ` <1254359613-21210-2-git-send-email-linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-10-01 1:13 ` [PATCH 3/4] i2c: imx: add macros and printk to make debug easy Richard Zhao
[not found] ` <1254359613-21210-3-git-send-email-linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-10-01 1:13 ` [PATCH 4/4] i2c: imx: disable clock when it's possible to save power Richard Zhao
[not found] ` <1254359613-21210-4-git-send-email-linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-10-01 7:34 ` Sascha Hauer
[not found] ` <20091001073434.GY27039-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-01 7:56 ` Richard Zhao
[not found] ` <4e090d470910010056n56bff9f4l1fec703c2dde9edf-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-01 8:00 ` Sascha Hauer
2009-10-01 7:29 ` [PATCH 3/4] i2c: imx: add macros and printk to make debug easy Sascha Hauer
[not found] ` <20091001072934.GX27039-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-01 8:01 ` Richard Zhao
[not found] ` <4e090d470910010101r6839cc9ax4fe84f04a1afbb00-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-01 8:26 ` Sascha Hauer
[not found] ` <20091001082610.GB27039-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-01 9:30 ` Richard Zhao
2009-10-01 7:26 ` [PATCH 2/4] i2c: imx: only imx1 needs disable delay Sascha Hauer
2009-10-01 7:52 ` Richard Zhao
[not found] ` <4e090d470910010052k37a0a4eep6d436e45e6524234-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-01 7:57 ` Sascha Hauer [this message]
2009-10-01 8:03 ` [PATCH 1/4] i2c: imx: check busy bit when START/STOP Richard Zhao
[not found] ` <4e090d470910010103o611d9fb2t3acf93632216fc88-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-01 8:38 ` Sascha Hauer
[not found] ` <20091001083831.GD27039-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-01 9:11 ` Richard Zhao
[not found] ` <4e090d470910010211k4ce78763i1a5163ec6ea57fe8-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-01 9:52 ` Sascha Hauer
[not found] ` <20091001095239.GE27039-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-01 14:54 ` Richard Zhao
[not found] ` <4e090d470910010754r1ebc4455u6220ccfd803491b0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-01 16:37 ` Wolfram Sang
[not found] ` <20091001163753.GA20103-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-02 0:57 ` Richard Zhao
[not found] ` <4e090d470910011757g261c693ehdca40ce43ebee2ec-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-02 7:26 ` Sascha Hauer
[not found] ` <20091002072643.GH27039-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2009-10-02 8:17 ` Richard Zhao
[not found] ` <4e090d470910020117w620fda4cta7b26b912d01bc24-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-02 14:11 ` Wolfram Sang
-- strict thread matches above, loose matches on Subject: below --
2009-09-30 5:55 Richard Zhao
[not found] ` <1254290106-29272-1-git-send-email-linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-09-30 5:55 ` [PATCH 2/4] i2c: imx: only imx1 needs disable delay Richard Zhao
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=20091001075702.GZ27039@pengutronix.de \
--to=s.hauer-bicnvbalz9megne8c9+irq@public.gmane.org \
--cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linuxzsc-Re5JQEeQqe8AvxtiuMwx3w@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