diff options
author | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-05-10 00:20:36 +0000 |
---|---|---|
committer | blogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2008-05-10 00:20:36 +0000 |
commit | 98d5efdc537f3b7da14b8cb8ea4e71912c56bbc6 (patch) | |
tree | 705a69a2db722876c63d8b583b27da72cace9a7f /target/linux/ifxmips/files | |
parent | c38330ce3859dad8a7231b33b672168fa4415ca3 (diff) |
fixes timer issues
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@11102 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ifxmips/files')
-rw-r--r-- | target/linux/ifxmips/files/arch/mips/ifxmips/setup.c | 26 |
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 ade78d1bf5..1e62029076 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; |