aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/gpmc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/gpmc.c')
-rw-r--r--arch/arm/mach-omap2/gpmc.c12
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
171unsigned 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
171unsigned int gpmc_ticks_to_ns(unsigned int ticks) 181unsigned 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;