···3535#include <asm/dec/ioasic_addrs.h>3636#include <asm/dec/machtype.h>37373838-static unsigned long dec_rtc_get_time(void)3838+unsigned long read_persistent_clock(void)3939{4040 unsigned int year, mon, day, hour, min, sec, real_year;4141 unsigned long flags;···7474}75757676/*7777- * In order to set the CMOS clock precisely, dec_rtc_set_mmss has to7777+ * In order to set the CMOS clock precisely, rtc_mips_set_mmss has to7878 * be called 500 ms after the second nowtime has started, because when7979 * nowtime is written into the registers of the CMOS clock, it will8080 * jump to the next second precisely 500 ms later. Check the Dallas8181 * DS1287 data sheet for details.8282 */8383-static int dec_rtc_set_mmss(unsigned long nowtime)8383+int rtc_mips_set_mmss(unsigned long nowtime)8484{8585 int retval = 0;8686 int real_seconds, real_minutes, cmos_minutes;···139139 return retval;140140}141141142142-143142static int dec_timer_state(void)144143{145144 return (CMOS_READ(RTC_REG_C) & RTC_PF) != 0;···159160}160161161162162162-void __init dec_time_init(void)163163+void __init plat_time_init(void)163164{164164- rtc_mips_get_time = dec_rtc_get_time;165165- rtc_mips_set_mmss = dec_rtc_set_mmss;166166-167165 mips_timer_state = dec_timer_state;168166 mips_timer_ack = dec_timer_ack;169167
···126126127127void __init plat_mem_setup(void)128128{129129- extern void wrppmc_time_init(void);130129 extern void wrppmc_machine_restart(char *command);131130 extern void wrppmc_machine_halt(void);132131 extern void wrppmc_machine_power_off(void);···133134 _machine_restart = wrppmc_machine_restart;134135 _machine_halt = wrppmc_machine_halt;135136 pm_power_off = wrppmc_machine_power_off;136136-137137- /* Use MIPS Count/Compare Timer */138138- board_time_init = wrppmc_time_init;139137140138 /* This makes the operations of 'in/out[bwl]' to the141139 * physical address ( < KSEG0) can work via KSEG1
+1-1
arch/mips/gt64120/wrppmc/time.c
···3838 * NOTE: We disable all GT64120 timers, and use MIPS processor internal3939 * timer as the source of kernel clock tick.4040 */4141-void __init wrppmc_time_init(void)4141+void __init plat_time_init(void)4242{4343 /* Disable GT64120 timers */4444 GT_WRITE(GT_TC_CONTROL_OFS, 0x00);
···4949 * forward reference5050 */5151DEFINE_SPINLOCK(rtc_lock);5252+EXPORT_SYMBOL(rtc_lock);52535353-/*5454- * By default we provide the null RTC ops5555- */5656-static unsigned long null_rtc_get_time(void)5757-{5858- return mktime(2000, 1, 1, 0, 0, 0);5959-}6060-6161-static int null_rtc_set_time(unsigned long sec)5454+int __weak rtc_mips_set_time(unsigned long sec)6255{6356 return 0;6457}5858+EXPORT_SYMBOL(rtc_mips_set_time);65596666-unsigned long (*rtc_mips_get_time)(void) = null_rtc_get_time;6767-int (*rtc_mips_set_time)(unsigned long) = null_rtc_set_time;6868-int (*rtc_mips_set_mmss)(unsigned long);6060+int __weak rtc_mips_set_mmss(unsigned long nowtime)6161+{6262+ return rtc_mips_set_time(nowtime);6363+}69647065int update_persistent_clock(struct timespec now)7166{···242247/*243248 * time_init() - it does the following things.244249 *245245- * 1) board_time_init() -250250+ * 1) plat_time_init() -246251 * a) (optional) set up RTC routines,247252 * b) (optional) calibrate and set the mips_hpt_frequency248253 * (only needed if you intended to use cpu counter as timer interrupt249254 * source)250250- * 2) setup xtime based on rtc_mips_get_time().251251- * 3) calculate a couple of cached variables for later usage252252- * 4) plat_timer_setup() -255255+ * 2) calculate a couple of cached variables for later usage256256+ * 3) plat_timer_setup() -253257 * a) (optional) over-write any choices made above by time_init().254258 * b) machine specific code should setup the timer irqaction.255259 * c) enable the timer interrupt256260 */257257-258258-void (*board_time_init)(void);259261260262unsigned int mips_hpt_frequency;261263···333341 clocksource_register(&clocksource_mips);334342}335343344344+void __init __weak plat_time_init(void)345345+{346346+}347347+336348void __init time_init(void)337349{338338- if (board_time_init)339339- board_time_init();340340-341341- if (!rtc_mips_set_mmss)342342- rtc_mips_set_mmss = rtc_mips_set_time;343343-344344- xtime.tv_sec = rtc_mips_get_time();345345- xtime.tv_nsec = 0;346346-347347- set_normalized_timespec(&wall_to_monotonic,348348- -xtime.tv_sec, -xtime.tv_nsec);350350+ plat_time_init();349351350352 /* Choose appropriate high precision timer routines. */351353 if (!cpu_has_counter && !clocksource_mips.read)···445459 tm->tm_wday = (gday + 4) % 7; /* 1970/1/1 was Thursday */446460}447461448448-EXPORT_SYMBOL(rtc_lock);449462EXPORT_SYMBOL(to_tm);450450-EXPORT_SYMBOL(rtc_mips_set_time);451451-EXPORT_SYMBOL(rtc_mips_get_time);
+3-3
arch/mips/lasat/ds1603.c
···135135 lasat_ndelay(1000);136136}137137138138-/* interface */139139-unsigned long ds1603_read(void)138138+unsigned long read_persistent_clock(void)140139{141140 unsigned long word;142141 unsigned long flags;···146147 word = rtc_read_word();147148 rtc_end_op();148149 spin_unlock_irqrestore(&rtc_lock, flags);150150+149151 return word;150152}151153152152-int ds1603_set(unsigned long time)154154+int rtc_mips_set_mmss(unsigned long time)153155{154156 unsigned long flags;155157
···11/*22 * Copyright 2001, 2002, 2003 MontaVista Software Inc.33 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net44+ * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)45 *56 * Common time service routines for MIPS machines. See67 * Documents/MIPS/README.txt.···4746}48474948/*5050- * pnx8550_time_init() - it does the following things:4949+ * plat_time_init() - it does the following things:5150 *5252- * 1) board_time_init() -5151+ * 1) plat_time_init() -5352 * a) (optional) set up RTC routines,5453 * b) (optional) calibrate and set the mips_hpt_frequency5554 * (only needed if you intended to use cpu counter as timer interrupt5655 * source)5756 */58575959-void pnx8550_time_init(void)5858+__init void plat_time_init(void)6059{6160 unsigned int n;6261 unsigned int m;
···3636#include <msp_int.h>3737#include <msp_regs.h>38383939-void __init msp_timer_init(void)3939+void __init plat_time_init(void)4040{4141 char *endp, *s;4242 unsigned long cpu_rate = 0;···8080 /* timer frequency is 1/2 clock rate */8181 mips_hpt_frequency = cpu_rate/2;8282}8383-84838584void __init plat_timer_setup(struct irqaction *irq)8685{
+3-15
arch/mips/pmc-sierra/yosemite/setup.c
···7070}717172727373-unsigned long m48t37y_get_time(void)7373+unsigned long read_persistent_clock(void)7474{7575 unsigned int year, month, day, hour, min, sec;7676 unsigned long flags;···9595 return mktime(year, month, day, hour, min, sec);9696}97979898-int m48t37y_set_time(unsigned long sec)9898+int rtc_mips_set_time(unsigned long tim)9999{100100 struct rtc_time tm;101101 unsigned long flags;···138138 setup_irq(7, irq);139139}140140141141-void yosemite_time_init(void)141141+void __init plat_time_init(void)142142{143143 mips_hpt_frequency = cpu_clock_freq / 2;144144mips_hpt_frequency = 33000000 * 3 * 5;···198198 m48t37_base = ioremap(YOSEMITE_RTC_BASE, YOSEMITE_RTC_SIZE);199199 if (!m48t37_base)200200 printk(KERN_ERR "Mapping the RTC failed\n");201201-202202- rtc_mips_get_time = m48t37y_get_time;203203- rtc_mips_set_time = m48t37y_set_time;204204-205205- write_seqlock(&xtime_lock);206206- xtime.tv_sec = m48t37y_get_time();207207- xtime.tv_nsec = 0;208208-209209- set_normalized_timespec(&wall_to_monotonic,210210- -xtime.tv_sec, -xtime.tv_nsec);211211- write_sequnlock(&xtime_lock);212201}213202214203/* Not only time init but that's what the hook it's called through is named */···210221211222void __init plat_mem_setup(void)212223{213213- board_time_init = yosemite_time_init;214224 late_time_init = py_late_time_init;215225216226 /* Add memory regions */
-2
arch/mips/sgi-ip22/ip22-setup.c
···5151EXPORT_SYMBOL(ip22_do_break);52525353extern void ip22_be_init(void) __init;5454-extern void ip22_time_init(void) __init;55545655void __init plat_mem_setup(void)5756{···5859 char *cserial;59606061 board_be_init = ip22_be_init;6161- ip22_time_init();62626363 /* Init the INDY HPC I/O controller. Need to call this before6464 * fucking with the memory controller because it needs to know the
+3-12
arch/mips/sgi-ip22/ip22-time.c
···3232 * note that mktime uses month from 1 to 12 while to_tm3333 * uses 0 to 11.3434 */3535-static unsigned long indy_rtc_get_time(void)3535+unsigned long read_persistent_clock(void)3636{3737 unsigned int yrs, mon, day, hrs, min, sec;3838 unsigned int save_control;···6060 return mktime(yrs + 1900, mon, day, hrs, min, sec);6161}62626363-static int indy_rtc_set_time(unsigned long tim)6363+int rtc_mips_set_time(unsigned long tim)6464{6565 struct rtc_time tm;6666 unsigned int save_control;···128128/*129129 * Here we need to calibrate the cycle counter to at least be close.130130 */131131-static __init void indy_time_init(void)131131+__init void plat_time_init(void)132132{133133 unsigned long r4k_ticks[3];134134 unsigned long r4k_tick;···206206207207 /* setup irqaction */208208 setup_irq(SGI_TIMER_IRQ, irq);209209-}210210-211211-void __init ip22_time_init(void)212212-{213213- /* setup hookup functions */214214- rtc_mips_get_time = indy_rtc_get_time;215215- rtc_mips_set_time = indy_rtc_set_time;216216-217217- board_time_init = indy_time_init;218209}
···4455#include <asm/sni.h>66#include <asm/time.h>77+#include <asm-generic/rtc.h>7889#define SNI_CLOCK_TICK_RATE 3686400910#define SNI_COUNTER2_DIV 64···7271/*7372 * Here we need to calibrate the cycle counter to at least be close.7473 */7575-__init void sni_cpu_time_init(void)7474+void __init plat_time_init(void)7675{7776 unsigned long r4k_ticks[3];7877 unsigned long r4k_tick;···146145 sni_cpu_timer_setup (irq);147146 break;148147 }148148+}149149+150150+unsigned long read_persistent_clock(void)151151+{152152+ return -1;149153}
···2626extern spinlock_t rtc_lock;27272828/*2929- * RTC ops. By default, they point to no-RTC functions.3030- * rtc_mips_get_time - mktime(year, mon, day, hour, min, sec) in seconds.2929+ * RTC ops. By default, they point to weak no-op RTC functions.3130 * rtc_mips_set_time - reverse the above translation and set time to RTC.3231 * rtc_mips_set_mmss - similar to rtc_set_time, but only min and sec need3332 * to be set. Used by RTC sync-up.3433 */3535-extern unsigned long (*rtc_mips_get_time)(void);3636-extern int (*rtc_mips_set_time)(unsigned long);3737-extern int (*rtc_mips_set_mmss)(unsigned long);3434+extern int rtc_mips_set_time(unsigned long);3535+extern int rtc_mips_set_mmss(unsigned long);38363937/*4038 * Timer interrupt functions.···73757476/*7577 * board specific routines required by time_init().7676- * board_time_init is defaulted to NULL and can remain so.7777- * plat_timer_setup must be setup properly in machine setup routine.7878 */7979struct irqaction;8080-extern void (*board_time_init)(void);8080+extern void plat_time_init(void);8181extern void plat_timer_setup(struct irqaction *irq);82828383/*