Commit e504c4b6 authored by Baruch Siach's avatar Baruch Siach Committed by Chris Zankel

xtensa: cleanup ccount frequency tracking

Remove unused nsec_per_ccount, and rename ccount_per_jiffy to ccount_preq.
Signed-off-by: default avatarBaruch Siach <baruch@tkos.co.il>
Signed-off-by: default avatarChris Zankel <chris@zankel.net>
parent ed9dfed6
...@@ -36,9 +36,8 @@ ...@@ -36,9 +36,8 @@
#endif #endif
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
extern unsigned long ccount_per_jiffy; extern unsigned long ccount_freq;
extern unsigned long nsec_per_ccount; #define CCOUNT_PER_JIFFY (ccount_freq / HZ)
#define CCOUNT_PER_JIFFY ccount_per_jiffy
#else #else
#define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ)) #define CCOUNT_PER_JIFFY (CONFIG_XTENSA_CPU_CLOCK*(1000000UL/HZ))
#endif #endif
......
...@@ -41,6 +41,6 @@ _F(void, pcibios_init, (void), { }); ...@@ -41,6 +41,6 @@ _F(void, pcibios_init, (void), { });
_F(void, calibrate_ccount, (void), _F(void, calibrate_ccount, (void),
{ {
pr_err("ERROR: Cannot calibrate cpu frequency! Assuming 10MHz.\n"); pr_err("ERROR: Cannot calibrate cpu frequency! Assuming 10MHz.\n");
ccount_per_jiffy = 10 * (1000000UL/HZ); ccount_freq = 10 * 1000000UL;
}); });
#endif #endif
...@@ -28,8 +28,7 @@ ...@@ -28,8 +28,7 @@
#include <asm/platform.h> #include <asm/platform.h>
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
unsigned long ccount_per_jiffy; /* per 1/HZ */ unsigned long ccount_freq; /* ccount Hz */
unsigned long nsec_per_ccount; /* nsec per ccount increment */
#endif #endif
static cycle_t ccount_read(struct clocksource *cs) static cycle_t ccount_read(struct clocksource *cs)
...@@ -57,8 +56,8 @@ void __init time_init(void) ...@@ -57,8 +56,8 @@ void __init time_init(void)
#ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT #ifdef CONFIG_XTENSA_CALIBRATE_CCOUNT
printk("Calibrating CPU frequency "); printk("Calibrating CPU frequency ");
platform_calibrate_ccount(); platform_calibrate_ccount();
printk("%d.%02d MHz\n", (int)ccount_per_jiffy/(1000000/HZ), printk("%d.%02d MHz\n", (int)ccount_freq/1000000,
(int)(ccount_per_jiffy/(10000/HZ))%100); (int)(ccount_freq/10000)%100);
#endif #endif
clocksource_register_hz(&ccount_clocksource, CCOUNT_PER_JIFFY * HZ); clocksource_register_hz(&ccount_clocksource, CCOUNT_PER_JIFFY * HZ);
......
...@@ -179,8 +179,7 @@ void __init platform_calibrate_ccount(void) ...@@ -179,8 +179,7 @@ void __init platform_calibrate_ccount(void)
if (!clk_freq) if (!clk_freq)
clk_freq = *(long *)XTFPGA_CLKFRQ_VADDR; clk_freq = *(long *)XTFPGA_CLKFRQ_VADDR;
ccount_per_jiffy = clk_freq / HZ; ccount_freq = clk_freq;
nsec_per_ccount = 1000000000UL / clk_freq;
} }
#endif #endif
......
...@@ -22,6 +22,5 @@ void platform_calibrate_ccount(void) ...@@ -22,6 +22,5 @@ void platform_calibrate_ccount(void)
a = b; a = b;
} while (--i >= 0); } while (--i >= 0);
b -= a; b -= a;
nsec_per_ccount = (LOOPS * 10000) / b; ccount_freq = b * (100000UL / LOOPS);
ccount_per_jiffy = b * (100000UL / (LOOPS * HZ));
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment