From: David Woodhouse <dwmw2@infradead.org>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-mtd@lists.infradead.org, Matt Reimer <mreimer@vpop.net>,
Eric Miao <eric.y.miao@gmail.com>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] [MTD] [NAND] pxa3xx: fix ns2cycle equation
Date: Mon, 16 Aug 2010 11:32:18 +0100 [thread overview]
Message-ID: <1281954738.21549.65.camel@localhost> (raw)
In-Reply-To: <1281946149.10299.1.camel@mola>
On Mon, 2010-08-16 at 16:09 +0800, Axel Lin wrote:
> Test on a PXA310 platform with Samsung K9F2G08X0B NAND flash,
> with tCH=5 and clk is 156MHz, ns2cycle(5, 156000000) returns -1.
>
> ns2cycle returns negtive value will break NDTR0_tXX macros.
>
> After checking the commit log, I found the problem is introduced by
> commit 5b0d4d7c8a67c5ba3d35e6ceb0c5530cc6846db7
> "[MTD] [NAND] pxa3xx: convert from ns to clock ticks more accurately"
>
> To get num of clock cycles, we use below equation:
> num of clock cycles = time (ns) / one clock cycle (ns) + 1
> We need to add 1 cycle here because integer division will truncate the result.
> It is possible the developers set the Min values in SPEC for timing settings.
> Thus the truncate may cause problem, and it is safe to add an extra cycle here.
>
> The various fields in NDTR{01} are in units of clock ticks minus one,
> thus we should subtract 1 cycle then.
>
> Thus the correct equation should be:
> num of clock cycles = time (ns) / one clock cycle (ns) + 1 - 1
> = time (ns) / one clock cycle (ns)
Looks sane to me; thanks. Wants to go to stable@ too, yes?
Can I have an Acked-By: from Matt and/or Eric?
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@intel.com Intel Corporation
next prev parent reply other threads:[~2010-08-16 10:32 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-16 8:09 [PATCH] [MTD] [NAND] pxa3xx: fix ns2cycle equation Axel Lin
2010-08-16 10:32 ` David Woodhouse [this message]
2010-08-16 12:14 ` Eric Miao
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=1281954738.21549.65.camel@localhost \
--to=dwmw2@infradead.org \
--cc=axel.lin@gmail.com \
--cc=eric.y.miao@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mreimer@vpop.net \
/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).