linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laine Walker-Avina <lwalkera@ieee.org>
To: linux-omap@vger.kernel.org
Cc: Laine Walker-Avina <lwalkera@ieee.org>
Subject: [PATCH v2] OMAP: Make set_gpmc_timing_reg aware of the TIMEPARAGRANULARITY flag
Date: Thu, 29 Jul 2010 14:44:26 -0700	[thread overview]
Message-ID: <1280439866-32208-1-git-send-email-lwalkera@ieee.org> (raw)
In-Reply-To: <876344jjiy.fsf@deeprootsystems.com>

This patch modifies the math used to convert clock ticks to nanoseconds
so that it is aware of the effect of the TIMEPARAGRANULARITY flag which
acts as a divide by 2 to the GPMC timing registers. This enables the use
of slower devices on the GPMC bus.
---
 arch/arm/mach-omap2/gpmc.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c
index 5bc3ca0..6c3a786 100644
--- a/arch/arm/mach-omap2/gpmc.c
+++ b/arch/arm/mach-omap2/gpmc.c
@@ -171,12 +171,15 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
 #endif
 {
 	u32 l;
-	int ticks, mask, nr_bits;
+	int ticks, mask, nr_bits, para_gran;
+
+	para_gran = (gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1) &
+		GPMC_CONFIG1_TIME_PARA_GRAN ? 2:1);
 
 	if (time == 0)
 		ticks = 0;
 	else
-		ticks = gpmc_ns_to_ticks(time);
+		ticks = gpmc_ns_to_ticks(time/para_gran);
 	nr_bits = end_bit - st_bit + 1;
 	if (ticks >= 1 << nr_bits) {
 #ifdef DEBUG
@@ -191,8 +194,8 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit,
 #ifdef DEBUG
 	printk(KERN_INFO
 		"GPMC CS%d: %-10s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n",
-	       cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000,
-			(l >> st_bit) & mask, time);
+	       cs, name, ticks, gpmc_get_fclk_period() * para_gran *
+		   ticks / 1000, (l >> st_bit) & mask, time);
 #endif
 	l &= ~(mask << st_bit);
 	l |= ticks << st_bit;
-- 
1.6.3.3


  reply	other threads:[~2010-07-29 21:54 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-06 16:51 [PATCH 0/5] Initial change for merge of new board Laine Walker-Avina
2010-04-06 16:51 ` [PATCH 1/5] OMAP: Add in helper macros for the SDRAM timings Laine Walker-Avina
2010-04-06 16:51   ` [PATCH 2/5] OMAP: Convert the sdram-*.h timings to use the SDRAM timing macros Laine Walker-Avina
2010-04-06 16:51     ` [PATCH 3/5] OMAP: Add SDRAM timings for Micron mt46h16m32lf-6 Laine Walker-Avina
2010-04-06 16:51       ` [PATCH 4/5] OMAP: Add support for setting the divider for sys_clkout2 using clk_set_rate Laine Walker-Avina
2010-04-06 16:51         ` [PATCH 5/5] OMAP: Make set_gpmc_timing_reg aware of the TIMEPARAGRANULARITY flag Laine Walker-Avina
2010-04-06 22:36           ` Kevin Hilman
2010-07-29 21:44             ` Laine Walker-Avina [this message]
2010-04-23  0:55         ` [PATCH 4/5] OMAP: Add support for setting the divider for sys_clkout2 using clk_set_rate Paul Walmsley
2010-05-18 22:04           ` Paul Walmsley
2010-04-06 17:17   ` [PATCH 1/5] OMAP: Add in helper macros for the SDRAM timings Felipe Balbi
2010-04-06 17:26     ` Laine Walker-Avina
2010-04-06 17:28       ` Felipe Balbi
2010-04-06 17:31     ` [PATCH v2 " Laine Walker-Avina
2010-04-23  0:48 ` [PATCH 0/5] Initial change for merge of new board Paul Walmsley

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=1280439866-32208-1-git-send-email-lwalkera@ieee.org \
    --to=lwalkera@ieee.org \
    --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;
as well as URLs for NNTP newsgroup(s).