diff options
author | Adrian Hunter <adrian.hunter@nokia.com> | 2010-12-09 03:48:27 -0500 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2010-12-21 15:05:25 -0500 |
commit | a3551f5b0c3ca7aaa053e554e3ee766983b5d713 (patch) | |
tree | 76fec6e7169219e26c67ff206713b2d09771e33b /arch/arm/mach-omap2/gpmc.c | |
parent | 4584acc3ee236424b5d0b52f143d980cae3c2be5 (diff) |
OMAP2/3: GPMC: put sync_clk value in picoseconds instead of nanoseconds
The calculations done with sync_clk are anyway in picoseconds
and switching to picoseconds allows sync_clk values that are
not a whole number of nanoseconds - which is sometimes the
case.
Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap2/gpmc.c')
-rw-r--r-- | arch/arm/mach-omap2/gpmc.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index f46933bc9373..1b7b3e7d02f7 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
@@ -168,6 +168,16 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns) | |||
168 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; | 168 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; |
169 | } | 169 | } |
170 | 170 | ||
171 | unsigned int gpmc_ps_to_ticks(unsigned int time_ps) | ||
172 | { | ||
173 | unsigned long tick_ps; | ||
174 | |||
175 | /* Calculate in picosecs to yield more exact results */ | ||
176 | tick_ps = gpmc_get_fclk_period(); | ||
177 | |||
178 | return (time_ps + tick_ps - 1) / tick_ps; | ||
179 | } | ||
180 | |||
171 | unsigned int gpmc_ticks_to_ns(unsigned int ticks) | 181 | unsigned int gpmc_ticks_to_ns(unsigned int ticks) |
172 | { | 182 | { |
173 | return ticks * gpmc_get_fclk_period() / 1000; | 183 | return ticks * gpmc_get_fclk_period() / 1000; |
@@ -235,7 +245,7 @@ int gpmc_cs_calc_divider(int cs, unsigned int sync_clk) | |||
235 | int div; | 245 | int div; |
236 | u32 l; | 246 | u32 l; |
237 | 247 | ||
238 | l = sync_clk * 1000 + (gpmc_get_fclk_period() - 1); | 248 | l = sync_clk + (gpmc_get_fclk_period() - 1); |
239 | div = l / gpmc_get_fclk_period(); | 249 | div = l / gpmc_get_fclk_period(); |
240 | if (div > 4) | 250 | if (div > 4) |
241 | return -1; | 251 | return -1; |