gru: Instantiate SPI TPM driver at startup.
authorVadim Bendebury <vbendeb@chromium.org>
Thu, 23 Jun 2016 02:17:09 +0000 (19:17 -0700)
committerchrome-bot <chrome-bot@chromium.org>
Fri, 24 Jun 2016 09:04:50 +0000 (02:04 -0700)
This adds code which creates structures for the SPI interface and the
TPM driver on Gru and Kevin boards.

BRANCH=none
BUG=chrome-os-partner:50645
TEST=with the rest of the patches applied; attempts of vboot_firmware
     to communicate with the TPM trigger proper TPM initialization
     (which indicates that SPI interface is operational and is plugged
     in properly). Chrome OS boot fails because vboot_firmware does not
     speak TPM2 yet.

Change-Id: Ib10f67df772fd53c354ab6323d46ebbfb2a8e700
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/355262

src/board/gru/board.c

index fa5bce9..b921d96 100644 (file)
@@ -27,7 +27,6 @@
 #include "drivers/bus/usb/usb.h"
 #include "drivers/ec/cros/spi.h"
 #include "drivers/flash/spi.h"
-#include "drivers/flash/spi.h"
 #include "drivers/gpio/rockchip.h"
 #include "drivers/gpio/sysinfo.h"
 #include "drivers/sound/i2s.h"
@@ -36,6 +35,7 @@
 #include "drivers/storage/dw_mmc.h"
 #include "drivers/storage/rk_dwmmc.h"
 #include "drivers/storage/sdhci.h"
+#include "drivers/tpm/spi.h"
 #include "drivers/video/display.h"
 #include "vboot/util/flag.h"
 
@@ -69,8 +69,12 @@ static int board_setup(void)
        // Claim that we have an power key to satisfy vboot.
        flag_replace(FLAG_PWRSW, new_gpio_low());
 
-       RkSpi *spi1 = new_rockchip_spi(0xff1d0000);
+       // TPM on Gru is connected to SPI bus #0
+       RkSpi *spi0 = new_rockchip_spi(0xff1c0000);
+       tpm_set_ops(&new_tpm_spi(&spi0->ops)->ops);
 
+       // Flash on Gru is connected to SPI bus #1.
+       RkSpi *spi1 = new_rockchip_spi(0xff1d0000);
        flash_set_ops(&new_spi_flash(&spi1->ops)->ops);
 
        // EC is connected to SPI bus #5