diff options
Diffstat (limited to 'cpu/arm926ejs/mx25')
-rw-r--r-- | cpu/arm926ejs/mx25/generic.c | 7 | ||||
-rw-r--r-- | cpu/arm926ejs/mx25/timer.c | 22 |
2 files changed, 12 insertions, 17 deletions
diff --git a/cpu/arm926ejs/mx25/generic.c b/cpu/arm926ejs/mx25/generic.c index 23b5cce..5ee10d4 100644 --- a/cpu/arm926ejs/mx25/generic.c +++ b/cpu/arm926ejs/mx25/generic.c @@ -70,6 +70,11 @@ unsigned int mx25_get_ipg_clk(void) return mx25_get_ahb_clk()/2; } +unsigned int mx25_get_cspi_clk(void) +{ + return mx25_get_ipg_clk(); +} + void mx25_dump_clocks(void) { u32 cpufreq = mx25_get_mcu_main_clk(); @@ -88,6 +93,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk) case MXC_IPG_PERCLK: case MXC_IPG_CLK: return mx25_get_ipg_clk(); + case MXC_CSPI_CLK: + return mx25_get_cspi_clk(); case MXC_UART_CLK: break; } diff --git a/cpu/arm926ejs/mx25/timer.c b/cpu/arm926ejs/mx25/timer.c index 8b6a061..1900240 100644 --- a/cpu/arm926ejs/mx25/timer.c +++ b/cpu/arm926ejs/mx25/timer.c @@ -84,15 +84,10 @@ void reset_timer(void) ulong get_timer_masked(void) { - ulong now = GPTCNT; /* current tick value */ - - if (now >= lastinc) /* normal mode (non roll) */ - /* move stamp forward with absolut diff ticks */ - timestamp += (now - lastinc); - else /* we have rollover of incrementer */ - timestamp += (0xFFFFFFFF - lastinc) + now; - lastinc = now; - return timestamp; + ulong now = GPTCNT; + now = now * 1000 / CONFIG_SYS_HZ; /* current tick value */ + + return now; } ulong get_timer(ulong base) @@ -111,14 +106,7 @@ void udelay(unsigned long usec) setup_gpt(); - if (usec >= 1000) { /* if "big" number, spread normalize to secs */ - tmo = usec / 1000; /* normalize usec to ticks per sec */ - tmo *= CONFIG_SYS_HZ; /* find number of "ticks" to wait */ - tmo /= 1000; /* finish normalize. */ - } else { /* don't kill prior to HZ multiply */ - tmo = usec * CONFIG_SYS_HZ; - tmo /= (1000*1000); - } + tmo = usec / 1000; /* Current precision is Millisecond */ tmp = get_timer(0); /* get current timestamp */ if ((tmo + tmp + 1) < tmp) /* if overflow time stamp */ |