From da57bddb827ff0da2eb8da33b7081ff56d9dea2d Mon Sep 17 00:00:00 2001 From: Justin Waters Date: Wed, 19 Dec 2012 11:13:24 -0500 Subject: vybrid: Fix hardware clock drift We must enable the external 32kHz oscillator in order to work around a known clock drift issue with the internal 32kHz oscillator. This fixes the Linux kernel system clock drift. Signed-off-by: Anthony Huereca Signed-off-by: Jiri Kotzian Signed-off-by: Justin Waters --- board/freescale/vybrid/vybrid.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'board') diff --git a/board/freescale/vybrid/vybrid.c b/board/freescale/vybrid/vybrid.c index a1507e170b..c9b423888f 100644 --- a/board/freescale/vybrid/vybrid.c +++ b/board/freescale/vybrid/vybrid.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -512,9 +513,23 @@ int board_early_init_f(void) int board_init(void) { + u32 temp; + struct vybrid_scsc_reg *scsc = (struct vybrid_scsc_reg *)SCSCM_BASE_ADDR; + /* address of boot parameters */ gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + /* + * Enable external 32K Oscillator + * + * The internal clock experiences significant drift + * so we must use the external oscillator in order + * to maintain correct time in the hwclock + */ + temp = __raw_readl(&scsc->sosc_ctr); + temp |= VYBRID_SCSC_SICR_CTR_SOSC_EN; + __raw_writel(temp, &scsc->sosc_ctr); + return 0; } -- cgit v1.2.3