Slippy: Changes needed to boot EC without bricking.

This commits the hacks made during board bringup. Bugs can be filed and
fixed based on this starting point.

BUG=chrome-os-partner:18825
BRANCH=slippy
TEST=manual

Try it and see.

Change-Id: Ia663eaf9a357633873b1b5d5cc6dbdda63513082
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/50875
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
This commit is contained in:
Bill Richardson
2013-05-10 13:44:02 -07:00
committed by ChromeBot
parent 1e4b0b6194
commit f10abeb19f
7 changed files with 64 additions and 6 deletions

View File

@@ -27,6 +27,7 @@ static int freq;
*/
static void disable_pll(void)
{
#ifndef BOARD_slippy /* FIXME: crosbug.com/p/19366 */
/* Switch to 16MHz internal oscillator and power down the PLL */
LM4_SYSTEM_RCC = LM4_SYSTEM_RCC_SYSDIV(0) |
LM4_SYSTEM_RCC_BYPASS |
@@ -34,6 +35,7 @@ static void disable_pll(void)
LM4_SYSTEM_RCC_OSCSRC(1) |
LM4_SYSTEM_RCC_MOSCDIS;
LM4_SYSTEM_RCC2 &= ~LM4_SYSTEM_RCC2_USERCC2;
#endif
freq = INTERNAL_CLOCK;
}
@@ -46,6 +48,7 @@ static void enable_pll(void)
/* Disable the PLL so we can reconfigure it */
disable_pll();
#ifndef BOARD_slippy /* FIXME: crosbug.com/p/19366 */
/*
* Enable the PLL (PWRDN is no longer set) and set divider. PLL is
* still bypassed, since it hasn't locked yet.
@@ -63,7 +66,7 @@ static void enable_pll(void)
/* Remove bypass on PLL */
LM4_SYSTEM_RCC &= ~LM4_SYSTEM_RCC_BYPASS;
#endif
freq = PLL_CLOCK;
}
@@ -93,6 +96,7 @@ int clock_get_freq(void)
void clock_init(void)
{
#ifndef BOARD_slippy /* FIXME: crosbug.com/p/19366 */
#ifdef BOARD_bds
/*
* Perform an auto calibration of the internal oscillator using the
@@ -115,6 +119,7 @@ void clock_init(void)
* can disable main oscillator control to reduce power consumption.
*/
LM4_SYSTEM_MOSCCTL = 0x04;
#endif
#endif
/*

View File

@@ -163,6 +163,10 @@ static int write_buffer(void)
{
int t;
#ifdef BOARD_slippy /* FIXME: crosbug.com/p/19366 */
return EC_ERROR_UNKNOWN;
#endif
if (all_protected)
return EC_ERROR_ACCESS_DENIED;
@@ -235,6 +239,9 @@ int flash_physical_write(int offset, int size, const char *data)
int flash_physical_erase(int offset, int size)
{
#ifdef BOARD_slippy /* FIXME: crosbug.com/p/19366 */
return EC_ERROR_UNKNOWN;
#endif
if (all_protected)
return EC_ERROR_ACCESS_DENIED;

View File

@@ -31,6 +31,10 @@ proc flash_bds { } {
flash_lm4 ../../../build/bds/ec.bin 0
}
proc flash_slippy { } {
flash_lm4 ../../../build/slippy/ec.bin 0
}
proc unprotect_link { } {
reset halt
flash erase_sector 0 254 255

View File

@@ -6,7 +6,8 @@ gdb_flash_program enable
interface ft2232
ft2232_layout jtagkey
ft2232_vid_pid 0x18d1 0x5002
jtag_khz 600
adapter_khz 600
#jtag_khz 600
#jtag_khz 0
#jtag_rclk 6000
source [find lm4x.cfg]

View File

@@ -295,6 +295,7 @@ void system_hibernate(uint32_t seconds, uint32_t microseconds)
void system_pre_init(void)
{
#ifndef BOARD_slippy /* FIXME: crosbug.com/p/19366 */
volatile uint32_t scratch __attribute__((unused));
/* Enable clocks to the hibernation module */
@@ -338,11 +339,13 @@ void system_pre_init(void)
LM4_HIBERNATE_HIBRTCT = 0x7fff;
wait_for_hibctl_wc();
LM4_HIBERNATE_HIBIM = 0;
#endif
check_reset_cause();
/* HEY: read LM4_SYSTEM_BOOTCFG bit 4 to determine WRKEY value */
#ifndef BOARD_slippy /* FIXME: crosbug.com/p/19366 */
/* Initialize bootcfg if needed */
if (LM4_SYSTEM_BOOTCFG != BOOTCFG_VALUE) {
LM4_FLASH_FMD = BOOTCFG_VALUE;
@@ -351,6 +354,7 @@ void system_pre_init(void)
while (LM4_FLASH_FMC & 0x08)
;
}
#endif
/* Brown-outs should trigger a reset */
LM4_SYSTEM_PBORCTL |= 0x02;

View File

@@ -13,6 +13,7 @@
#include "hooks.h"
#include "host_command.h"
#include "lid_switch.h"
#include "power_button.h"
#include "switch.h"
#include "system.h"
#include "task.h"
@@ -89,7 +90,7 @@ void chipset_exit_hard_off(void)
void chipset_throttle_cpu(int throttle)
{
CPRINTF("[%T %s(%d)]\n", __func__, throttle);
/* FIXME CPRINTF("[%T %s(%d)]\n", __func__, throttle);*/
}
/*****************************************************************************/
@@ -151,8 +152,44 @@ void chipset_task(void)
{
while (1) {
CPRINTF("[%T %s()]\n", __func__);
/* do NOTHING until we know what we should do. */
task_wait_event(-1);
/* for wait power button */
while (gpio_get_level(GPIO_POWER_BUTTON_L) == 1)
usleep(200000);
CPRINTF("[%T %s() PWRBTN is pressed.]\n", __func__);
gpio_set_level(GPIO_PP5000_EN, 1);
usleep(200000);
gpio_set_level(GPIO_PCH_DPWROK, 1);
usleep(200000);
gpio_set_level(GPIO_SUSP_VR_EN, 1);
usleep(200000);
gpio_set_level(GPIO_PCH_RSMRST_L, 1);
usleep(200000);
gpio_set_level(GPIO_PCH_PWRBTN_L, 0);
usleep(200000);
gpio_set_level(GPIO_PCH_PWRBTN_L, 1);
usleep(200000);
gpio_set_level(GPIO_PP1350_EN, 1);
usleep(200000);
gpio_set_level(GPIO_PCH_PWROK, 1);
usleep(200000);
gpio_set_level(GPIO_SYS_PWROK, 1);
usleep(200000);
CPRINTF("[%T %s() boot seq done.]\n", __func__);
while (1)
task_wait_event(-1);
}
}

View File

@@ -202,7 +202,7 @@ save="$(servo_save)"
case "${BOARD}" in
daisy | snow | spring | pit ) flash_daisy ;;
link ) flash_link ;;
link | slippy ) flash_link ;;
*) die "board ${BOARD} not supported" ;;
esac