summaryrefslogtreecommitdiff
path: root/target/linux/ifxmips/files/arch/mips
diff options
context:
space:
mode:
authorJohn Crispin <john@openwrt.org>2008-05-10 00:20:36 +0000
committerJohn Crispin <john@openwrt.org>2008-05-10 00:20:36 +0000
commit40881701d0864c965d98ef0d7b217006847c18bd (patch)
tree7bd8d6721673dddc5f413a2e1331d0c4f9b73757 /target/linux/ifxmips/files/arch/mips
parentace5c1dac5a45de03650acfbaa65a4b79554151e (diff)
downloadmtk-20170518-40881701d0864c965d98ef0d7b217006847c18bd.zip
mtk-20170518-40881701d0864c965d98ef0d7b217006847c18bd.tar.gz
mtk-20170518-40881701d0864c965d98ef0d7b217006847c18bd.tar.bz2
fixes timer issues
SVN-Revision: 11102
Diffstat (limited to 'target/linux/ifxmips/files/arch/mips')
-rw-r--r--target/linux/ifxmips/files/arch/mips/ifxmips/setup.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c b/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c
index ade78d1..1e62029 100644
--- a/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c
+++ b/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c
@@ -96,13 +96,21 @@ ifxmips_get_cpu_ver (void)
}
EXPORT_SYMBOL(ifxmips_get_cpu_ver);
-void
-ifxmips_time_init (void)
+static __inline__ u32 get_counter_resolution(void)
{
- mips_hpt_frequency = ifxmips_get_cpu_hz() / 2;
- r4k_offset = mips_hpt_frequency / HZ;
- printk("mips_hpt_frequency:%d\n", mips_hpt_frequency);
- printk("r4k_offset: %08x(%d)\n", r4k_offset, r4k_offset);
+ u32 res;
+ __asm__ __volatile__(
+ ".set push\n"
+ ".set mips32r2\n"
+ ".set noreorder\n"
+ "rdhwr %0, $3\n"
+ "ehb\n"
+ ".set pop\n"
+ : "=&r" (res)
+ : /* no input */
+ : "memory");
+ instruction_hazard();
+ return res;
}
int
@@ -117,9 +125,9 @@ ifxmips_be_handler(struct pt_regs *regs, int is_fixup)
void __init
plat_time_init (void)
{
+ mips_hpt_frequency = ifxmips_get_cpu_hz()/get_counter_resolution();
r4k_cur = (read_c0_count() + r4k_offset);
write_c0_compare(r4k_cur);
-
ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_GPT | IFXMIPS_PMU_PWDCR_FPI);
writel(0x100, IFXMIPS_GPTU_GPT_CLC);
@@ -130,7 +138,7 @@ plat_time_init (void)
extern const char* get_system_type (void);
-void (*board_time_init)(void);
+//void (*board_time_init)(void);
void __init
plat_mem_setup (void)
{
@@ -144,7 +152,7 @@ plat_mem_setup (void)
write_c0_status(status);
ifxmips_reboot_setup();
- board_time_init = ifxmips_time_init;
+// board_time_init = ifxmips_time_init;
board_be_handler = &ifxmips_be_handler;
ioport_resource.start = IOPORT_RESOURCE_START;