summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2016-07-28 21:04:29 (GMT)
committerDouglas Anderson <dianders@chromium.org>2016-08-02 22:33:30 (GMT)
commit0758b2bbca5007c5eb1057dde35f1a74d9de27c0 (patch)
tree4289aa3fe2d2e41a1a79893b22ab038613fe374b
parentf5937d9bc3437201d00fba07e9ee1ac32e8b45ef (diff)
downloaddepthcharge-factory-gru-8652.B.tar.gz
depthcharge-factory-gru-8652.B.tar.xz
kevin: Add code to support I2C TPM, move older config to kevin-tpm2factory-gru-8652.B
Coming Kevin revisions will switch back to an I2C TPM. This patch adds the required configuration options and code to support that. Since the TPM type can currently only be changed at compile time, we can no longer support older Kevins with the same image. In order to build for Kevin revisions < 5, build the kevin-tpm2 board instead. BRANCH=None BUG=chrome-os-partner:55523 TEST=Compiled both Kevin and Gru, confirmed that output binary had the appropriate code differences. Change-Id: I2deb331b65b6d9ed009e7e673bdb21938fa6510f Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/364171 Reviewed-by: Douglas Anderson <dianders@chromium.org> (cherry picked from commit a9c71ed5874245970d907818ad6c7641818ddefc) Reviewed-on: https://chromium-review.googlesource.com/365464 Tested-by: Douglas Anderson <dianders@chromium.org>
-rw-r--r--board/kevin-tpm2/defconfig45
-rw-r--r--board/kevin-tpm2/fmap.dts206
-rw-r--r--board/kevin/defconfig5
-rw-r--r--src/board/gru/board.c12
4 files changed, 262 insertions, 6 deletions
diff --git a/board/kevin-tpm2/defconfig b/board/kevin-tpm2/defconfig
new file mode 100644
index 0000000..45d1e85
--- /dev/null
+++ b/board/kevin-tpm2/defconfig
@@ -0,0 +1,45 @@
+# Arch
+CONFIG_ARCH_ARM=y
+CONFIG_ARCH_ARM_V8=y
+
+# Board
+CONFIG_BOARD="kevin"
+CONFIG_BOARD_DIR="gru"
+
+# Image
+CONFIG_BASE_ADDRESS=0x18000000
+CONFIG_FMAP_OFFSET=0x00300000
+CONFIG_HEAP_SIZE=0x01000000
+CONFIG_KERNEL_START=0x15000000
+
+# Vboot
+CONFIG_TPM2_MODE=y
+CONFIG_EC_SOFTWARE_SYNC=y
+CONFIG_VIRTUAL_DEV_SWITCH=y
+
+CONFIG_CROSSYSTEM_FDT=y
+#CONFIG_NV_STORAGE_CROS_EC=y
+CONFIG_NV_STORAGE_FLASH=y
+
+# Kernel format
+CONFIG_KERNEL_FIT=y
+CONFIG_KERNEL_FIT_FDT_ADDR=0x6400000
+
+# Drivers
+CONFIG_DRIVER_BUS_I2S_ROCKCHIP=y
+CONFIG_DRIVER_BUS_SPI_ROCKCHIP=y
+CONFIG_DRIVER_EC_CROS=y
+CONFIG_DRIVER_EC_CROS_SPI=y
+CONFIG_DRIVER_EC_CROS_SPI_WAKEUP_DELAY_US=100
+CONFIG_DRIVER_FLASH_SPI=y
+CONFIG_DRIVER_GPIO_RK3399=y
+CONFIG_DRIVER_INPUT_MKBP=y
+CONFIG_DRIVER_INPUT_MKBP_KEYMATRIX_STANDARD=y
+CONFIG_DRIVER_INPUT_USB=y
+CONFIG_DRIVER_SDHCI=y
+CONFIG_DRIVER_SOUND_I2S=y
+CONFIG_DRIVER_SOUND_MAX98357A=y
+CONFIG_DRIVER_SOUND_ROUTE=y
+CONFIG_DRIVER_STORAGE_DWMMC_RK3399=y
+CONFIG_DRIVER_STORAGE_MMC=y
+CONFIG_DRIVER_TPM_SPI=y
diff --git a/board/kevin-tpm2/fmap.dts b/board/kevin-tpm2/fmap.dts
new file mode 100644
index 0000000..58d4314
--- /dev/null
+++ b/board/kevin-tpm2/fmap.dts
@@ -0,0 +1,206 @@
+/dts-v1/;
+
+/ {
+ model = "Google Kevin";
+ config {
+ hwid = "KEVIN TEST 1422";
+ };
+ chromeos-config {
+ /* Enable factory-friendly features. */
+ gbb-flag-dev-screen-short-delay;
+ gbb-flag-force-dev-switch-on;
+ gbb-flag-force-dev-boot-usb;
+ gbb-flag-disable-fw-rollback-check;
+ };
+ flash@0 {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "chromeos,flashmap";
+ reg = <0x00000000 0x00800000>;
+
+ /* ---- Section: Read-only ---- */
+ wp-ro {
+ label = "wp-ro";
+ reg = <0x00000000 0x00400000>;
+ read-only;
+ };
+
+ ro-section {
+ label = "ro-section";
+ reg = <0x00000000 0x003e0000>;
+ read-only;
+ };
+ ro-boot {
+ label = "coreboot";
+ size = <0x00300000>;
+ read-only;
+ type = "blob coreboot";
+ required;
+ };
+
+ ro-fmap {
+ label = "fmap";
+
+ /* We encourage to align FMAP partition in as large
+ * block as possible so that flashrom can find it soon.
+ * For example, aligning to 512KB is better than to
+ * 256KB. */
+
+ reg = <0x00300000 0x00001000>;
+ read-only;
+ type = "fmap";
+ ver-major = <1>;
+ ver-minor = <0>;
+ };
+
+ ro-gbb {
+ label = "gbb";
+
+ /* GBB offset must be aligned to 4K bytes */
+ reg = <0x00301000 0x000def00>;
+ read-only;
+ type = "blob gbb";
+ };
+
+ ro-firmware-id {
+ label = "ro-frid";
+ reg = <0x003dff00 0x00000100>;
+ read-only;
+ type = "blobstring fwid";
+ };
+
+ /* ---- Section: Vital-product data (VPD) ---- */
+ ro-vpd {
+ label = "ro-vpd";
+
+ /* VPD offset must be aligned to 4K bytes */
+ reg = <0x003e0000 0x00020000>;
+ read-only;
+ type = "wiped";
+ wipe-value = [ff];
+ };
+
+ /* ---- Section: Rewritable slot A ---- */
+ rw-a {
+ label = "rw-section-a";
+ /* Alignment: 4k (for updating) */
+ reg = <0x00400000 0x000e8000>;
+ };
+ rw-a-vblock {
+ label = "vblock-a";
+ /*
+ * Alignment: 4k (for updating) and must be in start of
+ * each RW_SECTION.
+ */
+ reg = <0x00400000 0x00002000>;
+ type = "keyblock cbfs/rw/a-boot";
+ keyblock = "firmware.keyblock";
+ signprivate = "firmware_data_key.vbprivk";
+ version = <1>;
+ kernelkey = "kernel_subkey.vbpubk";
+ preamble-flags = <0>;
+ };
+ rw-a-boot {
+ /* Alignment: no requirement (yet). */
+ label = "fw-main-a";
+ reg = <0x00402000 0x000e5f00>;
+ type = "blob cbfs/rw/a-boot";
+ };
+ rw-a-firmware-id {
+ /* Alignment: no requirement. */
+ label = "rw-fwid-a";
+ reg = <0x004e7f00 0x00000100>;
+ read-only;
+ type = "blobstring fwid";
+ };
+
+ /* ---- Section: Rewritable VPD 32 KB ---- */
+ rw-vpd {
+ label = "rw-vpd";
+ /* Alignment: 4k (for updating) */
+ reg = <0x004e8000 0x00008000>;
+ type = "wiped";
+ wipe-value = [ff];
+ };
+
+ /* ---- Section: Rewritable slot B ---- */
+ rw-b {
+ label = "rw-section-b";
+ /* Alignment: 4k (for updating) */
+ reg = <0x004f0000 0x000e8000>;
+ };
+ rw-b-vblock {
+ label = "vblock-b";
+ /*
+ * Alignment: 4k (for updating) and must be in start of
+ * each RW_SECTION.
+ */
+ reg = <0x004f0000 0x00002000>;
+ type = "keyblock cbfs/rw/b-boot";
+ keyblock = "firmware.keyblock";
+ signprivate = "firmware_data_key.vbprivk";
+ version = <1>;
+ kernelkey = "kernel_subkey.vbpubk";
+ preamble-flags = <0>;
+ };
+ rw-b-boot {
+ label = "fw-main-b";
+ /* Alignment: no requirement (yet). */
+ reg = <0x004f2000 0x000e5f00>;
+ type = "blob cbfs/rw/b-boot";
+ };
+ rw-b-firmware-id {
+ label = "rw-fwid-b";
+ /* Alignment: no requirement. */
+ reg = <0x005d7f00 0x00000100>;
+ read-only;
+ type = "blobstring fwid";
+ };
+
+ /* ---- Section: Rewritable Event Log 16 KB ---- */
+ rw-elog {
+ label = "rw-elog";
+ /* Alignment: 4K (for updating) */
+ reg = <0x005d8000 0x00008000>;
+ type = "wiped";
+ wipe-value = [ff];
+ };
+
+ /* ---- Section: Rewritable shared 8 KB ---- */
+ shared-section {
+ /*
+ * Alignment: 4k (for updating).
+ * Anything in this range may be updated in recovery.
+ */
+ label = "rw-shared";
+ reg = <0x005e0000 0x00010000>;
+ };
+
+ shared-data {
+ label = "shared-data";
+ /*
+ * Alignment: 4k (for random read/write).
+ * RW firmware can put calibration data here.
+ */
+ reg = <0x005e0000 0x00010000>;
+ type = "wiped";
+ wipe-value = [00];
+ };
+
+
+ /* ---- Section: Storage to simulate 64 KB of NVRAM ---- */
+ rw-nvram {
+ label = "rw-nvram";
+ reg = <0x005f0000 0x00010000>;
+ type = "wiped";
+ wipe-value = [ff];
+ };
+
+ rw-legacy {
+ label = "rw-legacy";
+ reg = <0x00600000 0x00200000>;
+ type = "wiped";
+ wipe-value = [ff];
+ };
+ };
+};
diff --git a/board/kevin/defconfig b/board/kevin/defconfig
index 45d1e85..d450590 100644
--- a/board/kevin/defconfig
+++ b/board/kevin/defconfig
@@ -13,12 +13,10 @@ CONFIG_HEAP_SIZE=0x01000000
CONFIG_KERNEL_START=0x15000000
# Vboot
-CONFIG_TPM2_MODE=y
CONFIG_EC_SOFTWARE_SYNC=y
CONFIG_VIRTUAL_DEV_SWITCH=y
CONFIG_CROSSYSTEM_FDT=y
-#CONFIG_NV_STORAGE_CROS_EC=y
CONFIG_NV_STORAGE_FLASH=y
# Kernel format
@@ -26,6 +24,7 @@ CONFIG_KERNEL_FIT=y
CONFIG_KERNEL_FIT_FDT_ADDR=0x6400000
# Drivers
+CONFIG_DRIVER_BUS_I2C_ROCKCHIP=y
CONFIG_DRIVER_BUS_I2S_ROCKCHIP=y
CONFIG_DRIVER_BUS_SPI_ROCKCHIP=y
CONFIG_DRIVER_EC_CROS=y
@@ -42,4 +41,4 @@ CONFIG_DRIVER_SOUND_MAX98357A=y
CONFIG_DRIVER_SOUND_ROUTE=y
CONFIG_DRIVER_STORAGE_DWMMC_RK3399=y
CONFIG_DRIVER_STORAGE_MMC=y
-CONFIG_DRIVER_TPM_SPI=y
+CONFIG_DRIVER_TPM_SLB9635_I2C=y
diff --git a/src/board/gru/board.c b/src/board/gru/board.c
index 2b88b32..35bc5c7 100644
--- a/src/board/gru/board.c
+++ b/src/board/gru/board.c
@@ -22,6 +22,7 @@
#include "boot/fit.h"
#include "boot/ramoops.h"
#include "config.h"
+#include "drivers/bus/i2c/rockchip.h"
#include "drivers/bus/i2s/rockchip.h"
#include "drivers/bus/spi/rockchip.h"
#include "drivers/bus/usb/usb.h"
@@ -36,6 +37,7 @@
#include "drivers/storage/dw_mmc.h"
#include "drivers/storage/rk_dwmmc.h"
#include "drivers/storage/sdhci.h"
+#include "drivers/tpm/slb9635_i2c.h"
#include "drivers/tpm/spi.h"
#include "drivers/video/display.h"
#include "vboot/util/flag.h"
@@ -114,9 +116,13 @@ static GpioOps *power_btn_gpio(void)
static int board_setup(void)
{
- // TPM on Gru is connected to SPI bus #0
- RkSpi *spi0 = new_rockchip_spi(0xff1c0000);
- tpm_set_ops(&new_tpm_spi(&spi0->ops)->ops);
+ if (IS_ENABLED(CONFIG_TPM2_MODE)) {
+ RkSpi *spi0 = new_rockchip_spi(0xff1c0000);
+ tpm_set_ops(&new_tpm_spi(&spi0->ops)->ops);
+ } else {
+ RkI2c *i2c0 = new_rockchip_i2c((void *)0xff3c0000);
+ tpm_set_ops(&new_slb9635_i2c(&i2c0->ops, 0x20)->base.ops);
+ }
// Flash on Gru is connected to SPI bus #1.
RkSpi *spi1 = new_rockchip_spi(0xff1d0000);