diff options
author | Paul Burton <paul.burton@imgtec.com> | 2013-12-02 11:48:36 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-01-23 07:02:35 -0500 |
commit | a87ea88d8f6c7ce5551b3761f8db5a4341c8b25d (patch) | |
tree | e894227ceae0a499542b8a7ca2b2b5b6f02267f7 /arch/mips/mti-malta | |
parent | 9fbf59cfb9afb04a771ac1c68be16fb6bd070d50 (diff) |
MIPS: Malta: initialise the RTC at boot
The RTC is used on Malta to estimate the clock frequency of the CPU &
optionally the GIC. However the kernel previously did not initialise the
RTC, instead relying upon the bootloader having done so. In order to
minimise dependencies which the kernel has upon the bootloader this
patch causes the kernel to initialise the RTC itself prior to making use
of it.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Reviewed-by: Markos Chandras <markos.chandras@imgtec.com>
Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/6184/
Diffstat (limited to 'arch/mips/mti-malta')
-rw-r--r-- | arch/mips/mti-malta/malta-time.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/mips/mti-malta/malta-time.c b/arch/mips/mti-malta/malta-time.c index 136c5dcab4f0..319009912142 100644 --- a/arch/mips/mti-malta/malta-time.c +++ b/arch/mips/mti-malta/malta-time.c | |||
@@ -166,11 +166,24 @@ unsigned int get_c0_compare_int(void) | |||
166 | return mips_cpu_timer_irq; | 166 | return mips_cpu_timer_irq; |
167 | } | 167 | } |
168 | 168 | ||
169 | static void __init init_rtc(void) | ||
170 | { | ||
171 | /* stop the clock whilst setting it up */ | ||
172 | CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL); | ||
173 | |||
174 | /* 32KHz time base */ | ||
175 | CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT); | ||
176 | |||
177 | /* start the clock */ | ||
178 | CMOS_WRITE(RTC_24H, RTC_CONTROL); | ||
179 | } | ||
180 | |||
169 | void __init plat_time_init(void) | 181 | void __init plat_time_init(void) |
170 | { | 182 | { |
171 | unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK); | 183 | unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK); |
172 | unsigned int freq; | 184 | unsigned int freq; |
173 | 185 | ||
186 | init_rtc(); | ||
174 | estimate_frequencies(); | 187 | estimate_frequencies(); |
175 | 188 | ||
176 | freq = mips_hpt_frequency; | 189 | freq = mips_hpt_frequency; |