time.c (5aa85c9fc49a6ce44dc10a42e2011bbde9dc445a) | time.c (940f6b48a130e0a33cb8bd397dd0e277166470ad) |
---|---|
1/* 2 * Copyright 2001 MontaVista Software Inc. 3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 4 * Copyright (c) 2003, 2004 Maciej W. Rozycki 5 * 6 * Common time service routines for MIPS machines. 7 * 8 * This program is free software; you can redistribute it and/or modify it --- 36 unchanged lines hidden (view full) --- 45 return rtc_mips_set_time(nowtime); 46} 47 48int update_persistent_clock(struct timespec now) 49{ 50 return rtc_mips_set_mmss(now.tv_sec); 51} 52 | 1/* 2 * Copyright 2001 MontaVista Software Inc. 3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net 4 * Copyright (c) 2003, 2004 Maciej W. Rozycki 5 * 6 * Common time service routines for MIPS machines. 7 * 8 * This program is free software; you can redistribute it and/or modify it --- 36 unchanged lines hidden (view full) --- 45 return rtc_mips_set_time(nowtime); 46} 47 48int update_persistent_clock(struct timespec now) 49{ 50 return rtc_mips_set_mmss(now.tv_sec); 51} 52 |
53/* 54 * High precision timer functions for a R4k-compatible timer. 55 */ 56static cycle_t c0_hpt_read(void) 57{ 58 return read_c0_count(); 59} 60 | |
61int (*mips_timer_state)(void); 62 63int null_perf_irq(void) 64{ 65 return 0; 66} 67 68EXPORT_SYMBOL(null_perf_irq); --- 10 unchanged lines hidden (view full) --- 79 * b) (optional) calibrate and set the mips_hpt_frequency 80 * (only needed if you intended to use cpu counter as timer interrupt 81 * source) 82 * 2) calculate a couple of cached variables for later usage 83 */ 84 85unsigned int mips_hpt_frequency; 86 | 53int (*mips_timer_state)(void); 54 55int null_perf_irq(void) 56{ 57 return 0; 58} 59 60EXPORT_SYMBOL(null_perf_irq); --- 10 unchanged lines hidden (view full) --- 71 * b) (optional) calibrate and set the mips_hpt_frequency 72 * (only needed if you intended to use cpu counter as timer interrupt 73 * source) 74 * 2) calculate a couple of cached variables for later usage 75 */ 76 77unsigned int mips_hpt_frequency; 78 |
87static struct clocksource clocksource_mips = { 88 .name = "MIPS", 89 .read = c0_hpt_read, 90 .mask = CLOCKSOURCE_MASK(32), 91 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 92}; 93 | |
94void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) 95{ 96 u64 temp; 97 u32 shift; 98 99 /* Find a shift value */ 100 for (shift = 32; shift > 0; shift--) { 101 temp = (u64) NSEC_PER_SEC << shift; --- 17 unchanged lines hidden (view full) --- 119 do_div(temp, NSEC_PER_SEC); 120 if ((temp >> 32) == 0) 121 break; 122 } 123 cd->shift = shift; 124 cd->mult = (u32) temp; 125} 126 | 79void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock) 80{ 81 u64 temp; 82 u32 shift; 83 84 /* Find a shift value */ 85 for (shift = 32; shift > 0; shift--) { 86 temp = (u64) NSEC_PER_SEC << shift; --- 17 unchanged lines hidden (view full) --- 104 do_div(temp, NSEC_PER_SEC); 105 if ((temp >> 32) == 0) 106 break; 107 } 108 cd->shift = shift; 109 cd->mult = (u32) temp; 110} 111 |
127static void __init init_mips_clocksource(void) 128{ 129 /* Calclate a somewhat reasonable rating value */ 130 clocksource_mips.rating = 200 + mips_hpt_frequency / 10000000; 131 132 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency); 133 134 clocksource_register(&clocksource_mips); 135} 136 | |
137void __init __weak plat_time_init(void) 138{ 139} 140 141/* 142 * This function exists in order to cause an error due to a duplicate 143 * definition if platform code should have its own implementation. The hook 144 * to use instead is plat_time_init. plat_time_init does not receive the --- 49 unchanged lines hidden --- | 112void __init __weak plat_time_init(void) 113{ 114} 115 116/* 117 * This function exists in order to cause an error due to a duplicate 118 * definition if platform code should have its own implementation. The hook 119 * to use instead is plat_time_init. plat_time_init does not receive the --- 49 unchanged lines hidden --- |