From: eric.y.miao@gmail.com (Eric Miao)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] pxa2xx/cpufreq: Simplify DRI recomputation routine
Date: Mon, 28 Jun 2010 12:38:16 +0800 [thread overview]
Message-ID: <AANLkTilIQOmzV5JNk63dQvCViFjYOASLuZ39AZKykf6Z@mail.gmail.com> (raw)
In-Reply-To: <1277387833-5419-2-git-send-email-marek.vasut@gmail.com>
On Thu, Jun 24, 2010 at 9:57 PM, Marek Vasut <marek.vasut@gmail.com> wrote:
> This patch:
> 1) Simpifies the DRI recomputation routine by pulling out the common code
> 2) Fixes a bug in PXA27x DRI recomputation caused by incorrect parenthesis
>
> Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Good catch, I've modified it a bit so it's more compact and reable below
and I'll apply this to the 'fix' branch.
diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
index 9e4d981..268a9bc 100644
--- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
+++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
@@ -256,13 +256,9 @@ static void init_sdram_rows(void)
static u32 mdrefr_dri(unsigned int freq)
{
- u32 dri = 0;
+ u32 interval = freq * SDRAM_TREF / sdram_rows;
- if (cpu_is_pxa25x())
- dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
- if (cpu_is_pxa27x())
- dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
- return dri;
+ return (interval - (cpu_is_pxa27x() ? 31 : 0)) / 32;
}
/* find a valid frequency point */
> ---
> ?arch/arm/mach-pxa/cpufreq-pxa2xx.c | ? ?9 +++++----
> ?1 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/cpufreq-pxa2xx.c b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
> index 9e4d981..bb5f21e 100644
> --- a/arch/arm/mach-pxa/cpufreq-pxa2xx.c
> +++ b/arch/arm/mach-pxa/cpufreq-pxa2xx.c
> @@ -256,12 +256,13 @@ static void init_sdram_rows(void)
>
> ?static u32 mdrefr_dri(unsigned int freq)
> ?{
> - ? ? ? u32 dri = 0;
> + ? ? ? u32 dri = freq * SDRAM_TREF / sdram_rows;
>
> - ? ? ? if (cpu_is_pxa25x())
> - ? ? ? ? ? ? ? dri = ((freq * SDRAM_TREF) / (sdram_rows * 32));
> ? ? ? ?if (cpu_is_pxa27x())
> - ? ? ? ? ? ? ? dri = ((freq * SDRAM_TREF) / (sdram_rows - 31)) / 32;
> + ? ? ? ? ? ? ? dri -= 31;
> +
> + ? ? ? dri /= 32;
> +
> ? ? ? ?return dri;
> ?}
>
> --
> 1.7.1
>
>
next prev parent reply other threads:[~2010-06-28 4:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-06-24 13:57 [PATCH 1/3] pxa3xx: Fix HSIO bus x24 multiplier Marek Vasut
2010-06-24 13:57 ` [PATCH 2/3] pxa2xx/cpufreq: Simplify DRI recomputation routine Marek Vasut
2010-06-28 4:38 ` Eric Miao [this message]
2010-06-28 12:04 ` Marek Vasut
2010-06-24 13:57 ` [PATCH 3/3] pxa2xx/cpufreq: Fix PCMCIA frequency scaling Marek Vasut
2010-06-28 4:53 ` Eric Miao
2010-06-28 3:56 ` [PATCH 1/3] pxa3xx: Fix HSIO bus x24 multiplier 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=AANLkTilIQOmzV5JNk63dQvCViFjYOASLuZ39AZKykf6Z@mail.gmail.com \
--to=eric.y.miao@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).