Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[MIPS] add DECstation I/O ASIC clocksource

Add DECstation I/O ASIC clocksource

Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

authored by

Yoichi Yuasa and committed by
Ralf Baechle
4247417d 05a96fae

+73 -1
+4
arch/mips/Kconfig
··· 82 82 bool "DECstations" 83 83 select BOOT_ELF32 84 84 select CEVT_R4K 85 + select CSRC_IOASIC 85 86 select CSRC_R4K 86 87 select CPU_DADDI_WORKAROUNDS if 64BIT 87 88 select CPU_R4000_WORKAROUNDS if 64BIT ··· 783 782 bool 784 783 785 784 config CSRC_BCM1480 785 + bool 786 + 787 + config CSRC_IOASIC 786 788 bool 787 789 788 790 config CSRC_R4K
+1 -1
arch/mips/dec/time.c
··· 165 165 166 166 if (!cpu_has_counter && IOASIC) 167 167 /* For pre-R4k systems we use the I/O ASIC's counter. */ 168 - clocksource_mips.read = dec_ioasic_hpt_read; 168 + dec_ioasic_clocksource_init(); 169 169 170 170 /* Set up the rate of periodic DS1287 interrupts. */ 171 171 CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A);
+1
arch/mips/kernel/Makefile
··· 14 14 obj-$(CONFIG_CEVT_SB1250) += cevt-sb1250.o 15 15 obj-$(CONFIG_CEVT_TXX9) += cevt-txx9.o 16 16 obj-$(CONFIG_CSRC_BCM1480) += csrc-bcm1480.o 17 + obj-$(CONFIG_CSRC_IOASIC) += csrc-ioasic.o 17 18 obj-$(CONFIG_CSRC_R4K) += csrc-r4k.o 18 19 obj-$(CONFIG_CSRC_SB1250) += csrc-sb1250.o 19 20 obj-$(CONFIG_SYNC_R4K) += sync-r4k.o
+65
arch/mips/kernel/csrc-ioasic.c
··· 1 + /* 2 + * DEC I/O ASIC's counter clocksource 3 + * 4 + * Copyright (C) 2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp> 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + * 11 + * This program is distributed in the hope that it will be useful, 12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 + * GNU General Public License for more details. 15 + * 16 + * You should have received a copy of the GNU General Public License 17 + * along with this program; if not, write to the Free Software 18 + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 + */ 20 + #include <linux/clocksource.h> 21 + #include <linux/init.h> 22 + 23 + #include <asm/ds1287.h> 24 + #include <asm/time.h> 25 + #include <asm/dec/ioasic.h> 26 + #include <asm/dec/ioasic_addrs.h> 27 + 28 + static cycle_t dec_ioasic_hpt_read(void) 29 + { 30 + return ioasic_read(IO_REG_FCTR); 31 + } 32 + 33 + static struct clocksource clocksource_dec = { 34 + .name = "dec-ioasic", 35 + .read = dec_ioasic_hpt_read, 36 + .mask = CLOCKSOURCE_MASK(32), 37 + .flags = CLOCK_SOURCE_IS_CONTINUOUS, 38 + }; 39 + 40 + void __init dec_ioasic_clocksource_init(void) 41 + { 42 + unsigned int freq; 43 + u32 start, end; 44 + int i = HZ / 10; 45 + 46 + 47 + while (!ds1287_timer_state()) 48 + ; 49 + 50 + start = dec_ioasic_hpt_read(); 51 + 52 + while (i--) 53 + while (!ds1287_timer_state()) 54 + ; 55 + 56 + end = dec_ioasic_hpt_read(); 57 + 58 + freq = (end - start) * 10; 59 + printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq); 60 + 61 + clocksource_dec.rating = 200 + freq / 10000000; 62 + clocksource_set_clock(&clocksource_dec, freq); 63 + 64 + clocksource_register(&clocksource_dec); 65 + }
+2
include/asm-mips/dec/ioasic.h
··· 33 33 34 34 extern void init_ioasic_irqs(int base); 35 35 36 + extern void dec_ioasic_clocksource_init(void); 37 + 36 38 #endif /* __ASM_DEC_IOASIC_H */