fixes timer issues

SVN-Revision: 11102
This commit is contained in:
John Crispin 2008-05-10 00:20:36 +00:00
parent ace5c1dac5
commit 40881701d0
2 changed files with 41 additions and 19 deletions

View file

@ -96,13 +96,21 @@ ifxmips_get_cpu_ver (void)
} }
EXPORT_SYMBOL(ifxmips_get_cpu_ver); EXPORT_SYMBOL(ifxmips_get_cpu_ver);
void static __inline__ u32 get_counter_resolution(void)
ifxmips_time_init (void)
{ {
mips_hpt_frequency = ifxmips_get_cpu_hz() / 2; u32 res;
r4k_offset = mips_hpt_frequency / HZ; __asm__ __volatile__(
printk("mips_hpt_frequency:%d\n", mips_hpt_frequency); ".set push\n"
printk("r4k_offset: %08x(%d)\n", r4k_offset, r4k_offset); ".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 int
@ -117,9 +125,9 @@ ifxmips_be_handler(struct pt_regs *regs, int is_fixup)
void __init void __init
plat_time_init (void) plat_time_init (void)
{ {
mips_hpt_frequency = ifxmips_get_cpu_hz()/get_counter_resolution();
r4k_cur = (read_c0_count() + r4k_offset); r4k_cur = (read_c0_count() + r4k_offset);
write_c0_compare(r4k_cur); write_c0_compare(r4k_cur);
ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_GPT | IFXMIPS_PMU_PWDCR_FPI); ifxmips_pmu_enable(IFXMIPS_PMU_PWDCR_GPT | IFXMIPS_PMU_PWDCR_FPI);
writel(0x100, IFXMIPS_GPTU_GPT_CLC); writel(0x100, IFXMIPS_GPTU_GPT_CLC);
@ -130,7 +138,7 @@ plat_time_init (void)
extern const char* get_system_type (void); extern const char* get_system_type (void);
void (*board_time_init)(void); //void (*board_time_init)(void);
void __init void __init
plat_mem_setup (void) plat_mem_setup (void)
{ {
@ -144,7 +152,7 @@ plat_mem_setup (void)
write_c0_status(status); write_c0_status(status);
ifxmips_reboot_setup(); ifxmips_reboot_setup();
board_time_init = ifxmips_time_init; // board_time_init = ifxmips_time_init;
board_be_handler = &ifxmips_be_handler; board_be_handler = &ifxmips_be_handler;
ioport_resource.start = IOPORT_RESOURCE_START; ioport_resource.start = IOPORT_RESOURCE_START;

View file

@ -1,8 +1,8 @@
Index: linux-2.6.25/arch/mips/Kconfig Index: linux-2.6.25.1/arch/mips/Kconfig
=================================================================== ===================================================================
--- linux-2.6.25.orig/arch/mips/Kconfig 2008-05-05 08:35:34.000000000 +0100 --- linux-2.6.25.1.orig/arch/mips/Kconfig 2008-05-10 01:03:55.000000000 +0100
+++ linux-2.6.25/arch/mips/Kconfig 2008-05-05 08:35:46.000000000 +0100 +++ linux-2.6.25.1/arch/mips/Kconfig 2008-05-10 01:09:11.000000000 +0100
@@ -78,6 +78,17 @@ @@ -78,6 +78,19 @@
select SYS_SUPPORTS_LITTLE_ENDIAN select SYS_SUPPORTS_LITTLE_ENDIAN
select GENERIC_HARDIRQS_NO__DO_IRQ select GENERIC_HARDIRQS_NO__DO_IRQ
@ -10,6 +10,8 @@ Index: linux-2.6.25/arch/mips/Kconfig
+ bool "IFXMips support" + bool "IFXMips support"
+ select DMA_NONCOHERENT + select DMA_NONCOHERENT
+ select IRQ_CPU + select IRQ_CPU
+ select CEVT_R4K
+ select CSRC_R4K
+ select SYS_HAS_CPU_MIPS32_R1 + select SYS_HAS_CPU_MIPS32_R1
+ select HAVE_STD_PC_SERIAL_PORT + select HAVE_STD_PC_SERIAL_PORT
+ select SYS_SUPPORTS_BIG_ENDIAN + select SYS_SUPPORTS_BIG_ENDIAN
@ -20,10 +22,10 @@ Index: linux-2.6.25/arch/mips/Kconfig
config MACH_DECSTATION config MACH_DECSTATION
bool "DECstations" bool "DECstations"
select BOOT_ELF32 select BOOT_ELF32
Index: linux-2.6.25/arch/mips/Makefile Index: linux-2.6.25.1/arch/mips/Makefile
=================================================================== ===================================================================
--- linux-2.6.25.orig/arch/mips/Makefile 2008-05-05 08:35:35.000000000 +0100 --- linux-2.6.25.1.orig/arch/mips/Makefile 2008-05-10 01:04:02.000000000 +0100
+++ linux-2.6.25/arch/mips/Makefile 2008-05-05 08:35:46.000000000 +0100 +++ linux-2.6.25.1/arch/mips/Makefile 2008-05-10 01:04:03.000000000 +0100
@@ -282,6 +282,13 @@ @@ -282,6 +282,13 @@
cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/mach-cobalt cflags-$(CONFIG_MIPS_COBALT) += -Iinclude/asm-mips/mach-cobalt
load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000 load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
@ -38,10 +40,10 @@ Index: linux-2.6.25/arch/mips/Makefile
# #
# DECstation family # DECstation family
# #
Index: linux-2.6.25/include/asm-mips/bootinfo.h Index: linux-2.6.25.1/include/asm-mips/bootinfo.h
=================================================================== ===================================================================
--- linux-2.6.25.orig/include/asm-mips/bootinfo.h 2008-05-05 08:35:35.000000000 +0100 --- linux-2.6.25.1.orig/include/asm-mips/bootinfo.h 2008-05-10 01:03:55.000000000 +0100
+++ linux-2.6.25/include/asm-mips/bootinfo.h 2008-05-05 08:35:46.000000000 +0100 +++ linux-2.6.25.1/include/asm-mips/bootinfo.h 2008-05-10 01:04:03.000000000 +0100
@@ -94,6 +94,12 @@ @@ -94,6 +94,12 @@
#define MACH_MSP7120_FPGA 5 /* PMC-Sierra MSP7120 Emulation */ #define MACH_MSP7120_FPGA 5 /* PMC-Sierra MSP7120 Emulation */
#define MACH_MSP_OTHER 255 /* PMC-Sierra unknown board type */ #define MACH_MSP_OTHER 255 /* PMC-Sierra unknown board type */
@ -55,3 +57,15 @@ Index: linux-2.6.25/include/asm-mips/bootinfo.h
#define CL_SIZE COMMAND_LINE_SIZE #define CL_SIZE COMMAND_LINE_SIZE
extern char *system_type; extern char *system_type;
Index: linux-2.6.25.1/arch/mips/kernel/traps.c
===================================================================
--- linux-2.6.25.1.orig/arch/mips/kernel/traps.c 2008-05-10 01:09:32.000000000 +0100
+++ linux-2.6.25.1/arch/mips/kernel/traps.c 2008-05-10 01:10:07.000000000 +0100
@@ -1379,6 +1379,7 @@
*/
if (cpu_has_mips_r2) {
cp0_compare_irq = (read_c0_intctl() >> 29) & 7;
+ cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7;
if (cp0_perfcount_irq == cp0_compare_irq)
cp0_perfcount_irq = -1;