From 98d5efdc537f3b7da14b8cb8ea4e71912c56bbc6 Mon Sep 17 00:00:00 2001 From: blogic Date: Sat, 10 May 2008 00:20:36 +0000 Subject: fixes timer issues git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11102 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- .../linux/ifxmips/files/arch/mips/ifxmips/setup.c | 26 ++++++++++++++-------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'target/linux/ifxmips/files/arch') diff --git a/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c b/target/linux/ifxmips/files/arch/mips/ifxmips/setup.c index ade78d1bf..1e6202907 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; -- cgit v1.2.3