summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-05-10 13:44:02 -0700
committerChromeBot <chrome-bot@google.com>2013-05-10 16:37:11 -0700
commitf10abeb19fd74573ddb7ceb582906a765a9be60b (patch)
tree83ec60319f033eb52616a69ac14313b5f2da0a82
parent1e4b0b6194b3ff16233e824daa4bab18a8dcce0f (diff)
downloadchrome-ec-f10abeb19fd74573ddb7ceb582906a765a9be60b.tar.gz
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>
-rw-r--r--chip/lm4/clock.c7
-rw-r--r--chip/lm4/flash.c7
-rw-r--r--chip/lm4/openocd/lm4x_cmds.tcl4
-rw-r--r--chip/lm4/openocd/servo_v2_slower.cfg3
-rw-r--r--chip/lm4/system.c4
-rw-r--r--common/x86_power_haswell.c43
-rwxr-xr-xutil/flash_ec2
7 files changed, 64 insertions, 6 deletions
diff --git a/chip/lm4/clock.c b/chip/lm4/clock.c
index fea8873969..05a0aac36f 100644
--- a/chip/lm4/clock.c
+++ b/chip/lm4/clock.c
@@ -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
@@ -116,6 +120,7 @@ void clock_init(void)
*/
LM4_SYSTEM_MOSCCTL = 0x04;
#endif
+#endif
/*
* TODO: UART seems to glitch unless we wait 500k cycles before
diff --git a/chip/lm4/flash.c b/chip/lm4/flash.c
index 23e31a69f0..7fc59e1ecb 100644
--- a/chip/lm4/flash.c
+++ b/chip/lm4/flash.c
@@ -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;
diff --git a/chip/lm4/openocd/lm4x_cmds.tcl b/chip/lm4/openocd/lm4x_cmds.tcl
index 3261460de7..d34d7352f7 100644
--- a/chip/lm4/openocd/lm4x_cmds.tcl
+++ b/chip/lm4/openocd/lm4x_cmds.tcl
@@ -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
diff --git a/chip/lm4/openocd/servo_v2_slower.cfg b/chip/lm4/openocd/servo_v2_slower.cfg
index bd0aac3637..b748de8d84 100644
--- a/chip/lm4/openocd/servo_v2_slower.cfg
+++ b/chip/lm4/openocd/servo_v2_slower.cfg
@@ -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]
diff --git a/chip/lm4/system.c b/chip/lm4/system.c
index 4a29d7ed9a..6944db7716 100644
--- a/chip/lm4/system.c
+++ b/chip/lm4/system.c
@@ -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;
diff --git a/common/x86_power_haswell.c b/common/x86_power_haswell.c
index a29062d4e7..19f46a9b5e 100644
--- a/common/x86_power_haswell.c
+++ b/common/x86_power_haswell.c
@@ -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);
}
}
diff --git a/util/flash_ec b/util/flash_ec
index 93ae431f8c..ef104750b7 100755
--- a/util/flash_ec
+++ b/util/flash_ec
@@ -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