···165165166166 if (!cpu_has_counter && IOASIC)167167 /* For pre-R4k systems we use the I/O ASIC's counter. */168168- clocksource_mips.read = dec_ioasic_hpt_read;168168+ dec_ioasic_clocksource_init();169169170170 /* Set up the rate of periodic DS1287 interrupts. */171171 CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A);
···11+/*22+ * DEC I/O ASIC's counter clocksource33+ *44+ * Copyright (C) 2008 Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>55+ *66+ * This program is free software; you can redistribute it and/or modify77+ * it under the terms of the GNU General Public License as published by88+ * the Free Software Foundation; either version 2 of the License, or99+ * (at your option) any later version.1010+ *1111+ * This program is distributed in the hope that it will be useful,1212+ * but WITHOUT ANY WARRANTY; without even the implied warranty of1313+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the1414+ * GNU General Public License for more details.1515+ *1616+ * You should have received a copy of the GNU General Public License1717+ * along with this program; if not, write to the Free Software1818+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA1919+ */2020+#include <linux/clocksource.h>2121+#include <linux/init.h>2222+2323+#include <asm/ds1287.h>2424+#include <asm/time.h>2525+#include <asm/dec/ioasic.h>2626+#include <asm/dec/ioasic_addrs.h>2727+2828+static cycle_t dec_ioasic_hpt_read(void)2929+{3030+ return ioasic_read(IO_REG_FCTR);3131+}3232+3333+static struct clocksource clocksource_dec = {3434+ .name = "dec-ioasic",3535+ .read = dec_ioasic_hpt_read,3636+ .mask = CLOCKSOURCE_MASK(32),3737+ .flags = CLOCK_SOURCE_IS_CONTINUOUS,3838+};3939+4040+void __init dec_ioasic_clocksource_init(void)4141+{4242+ unsigned int freq;4343+ u32 start, end;4444+ int i = HZ / 10;4545+4646+4747+ while (!ds1287_timer_state())4848+ ;4949+5050+ start = dec_ioasic_hpt_read();5151+5252+ while (i--)5353+ while (!ds1287_timer_state())5454+ ;5555+5656+ end = dec_ioasic_hpt_read();5757+5858+ freq = (end - start) * 10;5959+ printk(KERN_INFO "I/O ASIC clock frequency %dHz\n", freq);6060+6161+ clocksource_dec.rating = 200 + freq / 10000000;6262+ clocksource_set_clock(&clocksource_dec, freq);6363+6464+ clocksource_register(&clocksource_dec);6565+}