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

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to