diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-05-12 18:35:32 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:39:21 -0700 |
commit | 8ca61798f16369fa245b84fd6d22a487b61864ec (patch) | |
tree | b13fdbcd3c5224e19ae506e5f02a2295aecfcea5 /board/nvidia/chromeos | |
parent | bdfc6085f392252b2b900af4ff3e04c70d39b406 (diff) |
Implement cold reboot
The verified boot spec requires that firmware cold (not warm) reboots so
that TPM gets reseted.
BUG=chrome-os-partner:3574
TEST=manual
1. Run load_fw twice, and verify that SetupTPM failed in the second run
------------------------------------------------------------
CrOS> cros load_fw 0x0 0x01000000 0x00400000 0x10000000
...
DEBUG: TPM: SetupTPM(r0, d0)
...
DEBUG: TPM: SetupTPM() succeeded
...
CrOS> cros load_fw 0x0 0x01000000 0x00400000 0x10000000
...
DEBUG: TPM: SetupTPM(r0, d0)
...
DEBUG: Unable to setup TPM and read stored versions.
------------------------------------------------------------
2. Run load_fw twice and a reset in between, and results the same
------------------------------------------------------------
CrOS> cros load_fw 0x0 0x01000000 0x00400000 0x10000000
...
CrOS> reset
...
CrOS> cros load_fw 0x0 0x01000000 0x00400000 0x10000000
------------------------------------------------------------
3. Run load_fw twice and a "cros cold_reboot" in between, and verify
that SetupTPM succeeds in both runs
------------------------------------------------------------
CrOS> cros load_fw 0x0 0x01000000 0x00400000 0x10000000
...
CrOS> cros cold_reboot
...
CrOS> cros load_fw 0x0 0x01000000 0x00400000 0x10000000
------------------------------------------------------------
Cherry-pick: bbb6ba7
Change-Id: Ie74bb214c80714d1814b4ae295c4780aa2bc7ddc
Reviewed-on: http://gerrit.chromium.org/gerrit/756
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
Diffstat (limited to 'board/nvidia/chromeos')
-rw-r--r-- | board/nvidia/chromeos/Makefile | 1 | ||||
-rw-r--r-- | board/nvidia/chromeos/power_management.c | 56 |
2 files changed, 57 insertions, 0 deletions
diff --git a/board/nvidia/chromeos/Makefile b/board/nvidia/chromeos/Makefile index b1d3bd1b70..7b1d1cdc6c 100644 --- a/board/nvidia/chromeos/Makefile +++ b/board/nvidia/chromeos/Makefile @@ -39,6 +39,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)libchromeos_hardware_interface.a COBJS-$(CONFIG_CHROMEOS) += gpio.o +COBJS-$(CONFIG_CHROMEOS) += power_management.o COBJS := $(COBJS-y) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/nvidia/chromeos/power_management.c b/board/nvidia/chromeos/power_management.c new file mode 100644 index 0000000000..118f5df600 --- /dev/null +++ b/board/nvidia/chromeos/power_management.c @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2011 The Chromium OS Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + * + * Alternatively, this software may be distributed under the terms of the + * GNU General Public License ("GPL") version 2 as published by the Free + * Software Foundation. + */ + +/* Implementation of per-board power management function */ + +#include <common.h> +#include <i2c.h> + +#include <chromeos/power_management.h> + +#define PREFIX "cold_reboot: " + +#define PMIC_I2C_BUS 0x00 +#define PMIC_I2C_DEVICE_ADDRESS 0x34 +#define TPS6586X_SUPPLYENE 0x14 + +/* This function never returns */ +void cold_reboot(void) +{ + uint8_t byte; + + if (i2c_set_bus_num(PMIC_I2C_BUS)) { + debug(PREFIX "i2c_set_bus_num fail\n"); + goto FATAL; + } + + if (i2c_read(PMIC_I2C_DEVICE_ADDRESS, TPS6586X_SUPPLYENE, 1, + &byte, sizeof(byte))) { + debug(PREFIX "i2c_read fail\n"); + goto FATAL; + } + + /* Set TPS6586X_SUPPLYENE bit0 to 1 */ + byte |= 1; + + if (i2c_write(PMIC_I2C_DEVICE_ADDRESS, TPS6586X_SUPPLYENE, 1, + &byte, sizeof(byte))) { + debug(PREFIX "i2c_write fail\n"); + goto FATAL; + } + + /* The PMIC will reboot the whole system after 10 ms */ + udelay(100); + +FATAL: + /* The final solution of doing a cold reboot */ + printf("Please press cold reboot button\n"); + while (1); +} |