Skip to content

Commit

Permalink
MIPS: Malta: initialise the RTC at boot
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
Paul Burton authored and Ralf Baechle committed Jan 23, 2014
1 parent 9fbf59c commit a87ea88
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions arch/mips/mti-malta/malta-time.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,24 @@ unsigned int get_c0_compare_int(void)
return mips_cpu_timer_irq;
}

static void __init init_rtc(void)
{
/* stop the clock whilst setting it up */
CMOS_WRITE(RTC_SET | RTC_24H, RTC_CONTROL);

/* 32KHz time base */
CMOS_WRITE(RTC_REF_CLCK_32KHZ, RTC_FREQ_SELECT);

/* start the clock */
CMOS_WRITE(RTC_24H, RTC_CONTROL);
}

void __init plat_time_init(void)
{
unsigned int prid = read_c0_prid() & (PRID_COMP_MASK | PRID_IMP_MASK);
unsigned int freq;

init_rtc();
estimate_frequencies();

freq = mips_hpt_frequency;
Expand Down

0 comments on commit a87ea88

Please sign in to comment.