From 34df8261f70fab14d0300a2c316a7b827f38a705 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Fri, 20 Apr 2012 10:11:38 -0700 Subject: [PATCH] Remove clock calibration for PIOSC Proto1 has A3 silicon which is factory-trimmed. Signed-off-by: Randall Spangler BUG=chrome-os-partner:7693 TEST=boot and look for glitchy EC console. If it's not glitchy, it worked. Change-Id: I56cb2458e600e76e458bce0f24832ef4f456ac14 --- chip/lm4/clock.c | 18 +++++++++--------- chip/lm4/registers.h | 8 +++++++- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c index 12a1896ff7..290af0223f 100644 --- a/chip/lm4/clock.c +++ b/chip/lm4/clock.c @@ -192,16 +192,11 @@ DECLARE_CONSOLE_COMMAND(nopll, command_disable_pll); int clock_init(void) { -#ifndef BOARD_bds - /* Only BDS has an external crystal; other boards don't have one, and - * can disable main oscillator control to reduce power consumption. */ - LM4_SYSTEM_MOSCCTL = 0x04; -#endif - +#ifdef BOARD_bds /* Perform an auto calibration of the internal oscillator using the - * 32.768KHz hibernate clock, unless we've already done so. */ - /* TODO: (crosbug.com/p/7693) This is only needed on early chips which - * aren't factory trimmed. */ + * 32.768KHz hibernate clock, unless we've already done so. This is + * only necessary on A2 silicon as on BDS; A3 silicon is all + * factory-trimmed. */ if ((LM4_SYSTEM_PIOSCSTAT & 0x300) != 0x100) { /* Start calibration */ LM4_SYSTEM_PIOSCCAL = 0x80000000; @@ -211,6 +206,11 @@ int clock_init(void) while (!(LM4_SYSTEM_PIOSCSTAT & 0x300)) ; } +#else + /* Only BDS has an external crystal; other boards don't have one, and + * can disable main oscillator control to reduce power consumption. */ + LM4_SYSTEM_MOSCCTL = 0x04; +#endif /* TODO: UART seems to glitch unless we wait 500k cycles before * enabling the PLL, but only if this is a cold boot. Why? UART diff --git a/chip/lm4/registers.h b/chip/lm4/registers.h index b05bc0ac9a..10719965fd 100644 --- a/chip/lm4/registers.h +++ b/chip/lm4/registers.h @@ -200,7 +200,13 @@ static inline int lm4_fan_addr(int ch, int offset) #define LM4_SYSTEM_RCC_IOSCDIS (1 << 1) #define LM4_SYSTEM_RCC_MOSCDIS (1 << 0) #define LM4_SYSTEM_RCC2 LM4REG(0x400fe070) -#define LM4_SYSTEM_RCC2_USERCC2 (1 << 31) +#define LM4_SYSTEM_RCC2_USERCC2 (1 << 31) +#define LM4_SYSTEM_RCC2_DIV400 (1 << 30) +#define LM4_SYSTEM_RCC2_SYSDIV2(x) (((x) & 0x3f) << 23) +#define LM4_SYSTEM_RCC2_SYSDIV2LSB (1 << 22) +#define LM4_SYSTEM_RCC2_PWRDN2 (1 << 13) +#define LM4_SYSTEM_RCC2_BYPASS2 (1 << 11) +#define LM4_SYSTEM_RCC2_OSCSRC2(x) (((x) & 0x7) << 4) #define LM4_SYSTEM_MOSCCTL LM4REG(0x400fe07c) #define LM4_SYSTEM_PIOSCCAL LM4REG(0x400fe150) #define LM4_SYSTEM_PIOSCSTAT LM4REG(0x400fe154)